Wkst Module Development for 7.0

Author:JonK
Last Updated:March 05, 2020 12:43 PM

\Wkst\config\ScreenConfigData.xml

This file contains configuration information for the entire workstation application.  Every module ("ContentMgmt", "Admin", "UserMgmt", etc.) is specified in this file.

To add a new icon to the "apps" menu, insert an App element into the Apps section of the xml.

<Apps>
  <App IconLink="/ContentMgmt" IconID="globe" IconLabel="Content" Security="IsWkstAuthor" />
  <App IconLink="/Admin" IconID="gears" IconLabel="Admin" Security="IsUberUser" />
  <App IconLink="/UserMgmt" IconID="users" IconLabel="Users" Security="IsUserAdmin" />
  <App IconLink="/SmartSearch" IconID="search" IconLabel="SmartSearch" Security="IsSmartSearchAdmin" />
  <!-- insert here -->
</Apps>

To provide configuration for the new module, create an new element in the XML and provide the following:

<ConfigData>
  ...
  
  <YourModule>
    <ActionButtons>
      <!-- define any buttons that go at the top (e.g. Create, Save) -->
    </ActionButtons>

    <Tabs>
      <!-- define any tabs that your module requires (e.g. Results, Content) -->
    </Tabs>

    <NavTree jsModule="" jsInitFunc="" jsInitArgs="{}"/>  <!-- provide the js info for your tree -->

    <ItemContext>
      <!-- define the operations that need to go in an Actions menu button -->
    </ItemContext>
  </YourModule>

</ConfigData>

After you provide this configuration, you're ready to actually build it. 

 

Buttons

A properly configured Button will automatically be wired up to it's JS implementation in \Wkst\scripts\NWS.Wkst.ActionButtons.js

Add the code to the operations variable. 

var operations = { 
    ... 
    MyButton: {
      IsOn: function (source, selection) {
        // return boolean indicating on (true) or off (false)
      },

      Action: function () {
        // Do your work an call your Controller methods
      }
    }
};

 

Controller

Your module will need a controller, and it will live in \Wkst\Controllers.  It should be named [YourModuleName]Controller

We use attribute binding for routes, so you need to specify explicitly the RoutePrefix and Route for the Controller class and your methods. 

Use the "Authorize" and "AjaxAuthorize" attributes to get the automatic redirect to the Login if your session is expired.

The main method will be Index and it should simply return the View, which will contain the HTML framework for the module.

 

Views

Your module will need a View.  If your module has any tree implementation or other JS needs, the XSL and JS files should go along with your razor file in \Wkst\Views\YourModuleName 

The HTML scaffolding of the Workstation is provided via a separate View, which is specified as the Layout. After that, you only need to setup a section call for the NavTree. 

Example Index.cshtml

@{
    ViewBag.Title = StaticText.ModuleName_YourModuleName;  // from the StaticText resource class which you need to add a value to
    Layout = "~/Views/Shared/_WkstLayout.cshtml";
}

@section NavTree
{
   @Html.Action("LoadYourTree")
}

Your tree will have an implementation that you need to build. There is a base Tree js that you will use, but with your own implementation details. Look at other modules as an example based on whay you need.

  • AdminTree is a good example of a mostly static tree
  • NavTree and UserTree are examples of dynamic trees

 

Tabs

The guts of your module UI will be implemented using the Tabs construct, which has been throughly documented.

 

Dialogs

The bulk of the operations your module will perform will be executed in the context of a Dialog, which has also been thoroughly documented.

top