<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2024-07-29T23:27:34.0000000">
    <CreatedUserId>Admin</CreatedUserId>
    <CreatedUtcDate>2021-08-16T23:47:51.8020000</CreatedUtcDate>
    <UpdatedUserId>Admin</UpdatedUserId>
    <UpdatedUtcDate>2024-07-29T23:26:45.8080000</UpdatedUtcDate>
    <ScriptId>TMT</ScriptId>
    <Description>Tasks Task Manager folder</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Bookmarks />
    <Category />
    <Code>' HtmlWidget_TaskManagerFolder_Tasks
Option Explicit On
Option Strict On

' #################################################################
' Tasks Task Manager Folder
'
' Version: 1.07 (30/07/2024)
'
' Usage: System-defined HTML Widget
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  18/10/2022  ISS      J027012   Created
'    1.01  09/02/2023  ISS      J030430   Group By column support added
'    1.02  21/03/2023  ISS      J030639   Support for custom Summary Page
'          22/03/2023  ISS      J030714   Incorrectly selecting rows for sorted grids after action
'    1.03  29/06/2023  ISS      J031371   Support for new FolderCountMessage and FolderCountDisableRefresh Script properties
'          30/06/2023  ISS      J031451   Allow update of Log Owner User
'          06/07/2023  ISS      J031501   Option to allow Template Text caching
'          12/07/2023  ISS      J031552   Button to toggle preview pane added
'          31/07/2023  ISS      J029795   Added ability to customise grid columns
'          22/08/2023  ISS      J031821   Font size for Subject column now standardised
'          28/08/2023  ISS      J031892   "Delegated" column now shows bold for the current Task Manager User
'          28/08/2023  ISS      J031497   User Logs should always be created for the current User
'    1.04  27/09/2023  ISS      J031640   Toggle button to hide summary (PreviewPaneToggle) updated
'          17/10/2023  ISS      J032240   More chart types supported
'    1.05  21/03/2024  ISS      J033149   "Type" column non longer line breaks
'    1.06  10/05/2024  ISS      J033342   Allow all items to be loaded where permitted
'          10/05/2024  ISS      J033414   User, Role or User lookups caused refresh in desktop when cancelled
'    1.07  30/07/2024  ISS      J033861   Added ability to reply to a log
' #################################################################

' Constants
Private Const FORM_KEY As String = "TaskManager"

' Objects
Private mCombinedParameters As ISKeyValueList
Private mParameters As ISKeyValueList
Private mStartupParameters As ISKeyValueList

' Standard Parameters
Private mDateAsAt As Date
Private mDateAsAtMnemonic As String
Private mFolderId As String
Private mLoadAll As Boolean
Private mUserId As String

Public Function Main(eventId As String,
                     parametersJson As String,
                     startUpParametersJson As String,
                     hostingContext As isefinHtmlWidgetHostingContext,
                     requestInfo As finScriptRequestInfo,
                     ByRef returnValue As String) As Boolean

  ' Assume Success
  Main = True

  ' Get Parameters
  mParameters = finBL.CreateKeyValueList()
  mParameters.FromSimpleJsonString(parametersJson)
  mStartupParameters = finBL.CreateKeyValueList()
  mStartupParameters.FromSimpleJsonString(startUpParametersJson)

  ' Get Combined Parameters (Startup Parameters updated with event Parameters)
  mCombinedParameters = mStartupParameters.Clone()
  mCombinedParameters.UpdateFromKeyValueList(mParameters, True)

  ' Other Parameters
  With mCombinedParameters
    mDateAsAt = .GetDate("DateAsAt")
    mDateAsAtMnemonic = .GetString("DateAsAtMnemonic")
    mFolderId = .GetString("FolderId")
    mLoadAll = .GetBoolean("LoadAll")
    mUserId = .GetString("UserId")
  End With

  ' Handle Events
  Select Case eventId
    Case ""
      ' Main event, i.e., return initial HTML content (excluding html and body tags)
      returnValue = ScriptInfo.TemplateText

    Case "GetInitialisationInfo"
      ' Get Initialisation Information required for this form
      Main = GetInitialisationInfo(returnValue)

    Case "GetItemPreview"
      ' Get Item Preview
      Main = GetItemPreview(returnValue)

    Case "PerformAction"
      ' Perform Action
      Main = PerformAction(returnValue)

'    Case "[GetFolderCount]"
'       ' Task Manager support
'       returnValue = CStr(999)
'       returnValue = "-1" ' Probably has records but too expensive to count
'       returnValue = "Unavailable" ' String value should be used carefully

    Case Else
      finBL.Error.ErrorBeginFormat("Unhandled event '{0}'.", eventId)
      Main = False
  End Select

End Function

''' &lt;summary&gt;
'''  Get Initialisation Information required for this wizard
''' &lt;/summary&gt;
Private Function GetInitialisationInfo(ByRef returnValue As String) As Boolean

  Dim FolderCountMessage As String
  Dim FolderCountDisableRefresh As Boolean
  Dim FormInitialisationInfo As FormInitialisationInfo
  Dim MaxSizeExceeded As Boolean
  Dim Success As Boolean
  Dim TaskManager As finTaskManager2
  Dim TaskManagerFolder As finTaskManagerFolder   
  Dim Tasks As List(Of finTaskManager2Task)
  Dim UserDataHeadings As List(Of finTaskManager2UserDataHeading)  

  ' Assume Success
  Success = True

  ' Initialise
  FormInitialisationInfo = New FormInitialisationInfo()

  ' Create Task Manager
  If Len(mDateAsAtMnemonic) = 0 Then
    TaskManager = finBL.CreateTaskManager2FromDateAsAt(mUserId, mDateAsAt)
  Else
    TaskManager = finBL.CreateTaskManager2FromDateAsAtMnemonic(mUserId, mDateAsAtMnemonic)
  End If
  
  ' Load All Content?
  If mLoadAll AndAlso finBL.SettingsUser.TaskManagerAllowMaxFolderSizeOverride Then
    TaskManager.IgnoreMaxFolderSize = True
  End If

  ' Get Folder Content
  Success = TaskManager.GetTasks(mFolderId, Tasks, TaskManagerFolder, MaxSizeExceeded, UserDataHeadings, FolderCountMessage, FolderCountDisableRefresh)

  ' Get Form Initialisation Info
  If Success Then
    With FormInitialisationInfo
      ' Record
      .ReadOnly = finBL.Database.IsReadOnly
      .CurrentUserId = finBL.CurrentUser.UserId
      .DateAsAtText = TaskManager.DateAsAtText
      .FolderId = mFolderId
      .ShowFolderCount = TaskManagerFolder.ShowFolderCount
      .ShowPreviewPane = TaskManagerFolder.ShowPreviewPane
      .PersistId = TaskManager.UserId &amp; "|" &amp; mFolderId
      .TimeZoneDescription = finBL.Runtime.TimeZones(finBL.TimeZoneId).WindowsTimeZoneDisplayName
      .UserId = TaskManager.UserId

      ' Items
      .Items = Tasks

      ' User Data
      .UserDataHeadings = UserDataHeadings
      
      ' Columns
      .GroupByColumn = TaskManagerFolder.GroupByColumn
      .GroupByColumnHide = TaskManagerFolder.GroupByColumnHide
      If Len(TaskManagerFolder.Columns) &lt;&gt; 0 Then
        .Columns = Split(TaskManagerFolder.Columns, "|")
      End If
  
      ' Folder Count
      ' NOTE: Set regardless of the Folder's ShowFolderCount property which is designed to be used by the Task Manager Treeview
      .FolderCount = CStr(Tasks.Count)
      .FolderCountMessage = FolderCountMessage
      .FolderCountDisableRefresh = FolderCountDisableRefresh
      If MaxSizeExceeded Then
        .FolderCount &amp;= "+"
        .WarningMessage = "Maximum folder size exceeded. Grid will only show the first " &amp; TaskManager.MAX_FOLDER_SIZE_RESOLVED &amp; " items."
      End If

      ' Permissions
      If Not .ReadOnly Then
        .AllowAddLog = finBL.CurrentUser.Permissions.Allow("Account.Logs.Add") OrElse finBL.CurrentUser.Permissions.Allow("Client.Logs.Add") OrElse finBL.CurrentUser.Permissions.Allow("AccountApp.Logs.Add") OrElse  finBL.CurrentUser.Permissions.Allow("SecurityStmt.Logs.Add") OrElse finBL.CurrentUser.Permissions.Allow("User.Logs.Add")
        .AllowAddWorkflow = finBL.Settings.AddOns.Workflow AndAlso (finBL.CurrentUser.Permissions.Allow("Account.Workflows.Add") OrElse finBL.CurrentUser.Permissions.Allow("Client.Workflows.Add") OrElse finBL.CurrentUser.Permissions.Allow("AccountApp.Workflows.Add"))
      End If
      .AllowLoadAll = Not mLoadAll AndAlso MaxSizeExceeded AndAlso finBL.SettingsUser.TaskManagerAllowMaxFolderSizeOverride       

      ' Configuration
      .AllowPageVisualisation = True
      .SupportsWebMail = finBL.Settings.AddOns.WebAutomation AndAlso finBL.Settings.WebAutomationUseWebMail
    End With
  End If

  ' Serialise
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(FormInitialisationInfo, returnValue)
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Get an HTML Summary of a row in the grid.
''' &lt;/summary&gt;
Private Function GetItemPreview(ByRef returnValue As String) As Boolean

  Dim Success As Boolean
  Dim TaskManager As finTaskManager2
  Dim UniqueId As String

  ' Assume Success
  Success = True

  ' Get Parameters
  With mCombinedParameters
    UniqueId = .GetString("UniqueId")
  End With

  ' Create Task Manager
  If Len(mDateAsAtMnemonic) = 0 Then
    TaskManager = finBL.CreateTaskManager2FromDateAsAt(mUserId, mDateAsAt)
  Else
    TaskManager = finBL.CreateTaskManager2FromDateAsAtMnemonic(mUserId, mDateAsAtMnemonic)
  End If

  ' Get HTML Summary
  returnValue = TaskManager.GetItemPreviewFromUniqueId(UniqueId)

  Return Success

End Function

''' &lt;summary&gt;
'''  Perform Action.
''' &lt;/summary&gt;
Private Function PerformAction(ByRef returnValue As String) As Boolean

  Dim ActionId As String
  Dim ActionParametersJson As String
  Dim obj As Object
  Dim Success As Boolean
  Dim TaskManager As finTaskManager2
  Dim UniqueIds As ISList
  Dim Warnings As finWarnings

  ' Assume Success
  Success = True

  ' Get Parameters
  With mCombinedParameters
    ActionId = .GetString("ActionId")
    ActionParametersJson = .GetString("ActionParametersJson")
    UniqueIds =  .GetListFromJsonArray("UniqueIds")
  End With

  ' Create Task Manager
  If Len(mDateAsAtMnemonic) = 0 Then
    TaskManager = finBL.CreateTaskManager2FromDateAsAt(mUserId, mDateAsAt)
  Else
    TaskManager = finBL.CreateTaskManager2FromDateAsAtMnemonic(mUserId, mDateAsAtMnemonic)
  End If

  ' Perform Action
  Select Case ActionId
    Case Else
      Success = TaskManager.ActionItemsFromUniqueIdsList(ActionId, ActionParametersJson, UniqueIds, Warnings)
  End Select

  ' Response
  If success Then
    obj = New With {
      .Warnings = Warnings.ToStringList()
    }
  End If

  ' Serialise
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(obj, returnValue)
  End If

  Return Success

End Function



''' &lt;summary&gt;
'''  Form Initialisation Information
''' &lt;/summary&gt;
Public Class FormInitialisationInfo

  ' Record
  Public CurrentUserId As String
  Public DateAsAtText As String
  Public FolderId As String
  Public PersistId As String
  Public ShowFolderCount As Boolean
  Public ShowPreviewPane As Boolean
  Public TimeZoneDescription As String
  Public UserId As String

  ' Items
  Public Items As List(Of finTaskManager2Task)

  ' User Data (Scripted)
  Public UserDataHeadings As List(Of finTaskManager2UserDataHeading)
  
  ' Columns
  Public GroupByColumn As String
  Public GroupByColumnHide As Boolean
  Public Columns As String()
  
  ' Folder Count
  Public FolderCount As String
  Public FolderCountMessage As String
  Public FolderCountDisableRefresh As Boolean  
  Public WarningMessage As String

  ' Permissions
  Public AllowAddLog As Boolean
  Public AllowAddWorkflow As Boolean
  Public AllowLoadAll As Boolean

  ' Configuration
  Public AllowPageVisualisation As Boolean
  Public [ReadOnly] As Boolean
  Public SupportsWebMail As Boolean

  Public Sub New()
  End Sub

End Class</Code>
    <Language>VisualBasic</Language>
    <Notes>System defined HTML Widget.

Used to display a "Tasks" type Task Manager folder.</Notes>
    <PermissionKeyExecute />
    <ReferenceLinq>false</ReferenceLinq>
    <RunWithoutPrompts>false</RunWithoutPrompts>
    <TemplateText>&lt;div id="frmMain" class="is-widget-content" style="visibility:hidden"&gt;

  &lt;!-- Form Header --&gt;
  &lt;header&gt;
    &lt;!-- Tabs --&gt;
    &lt;div id="tabDetails" class="is-tabs"&gt;
      &lt;ul&gt;
        &lt;li tabId="General"&gt;Tasks&lt;/li&gt;
        &lt;li tabId="Visualisation" icon="Chart"&gt;Visualisation&lt;/li&gt;
      &lt;ul&gt;
    &lt;/div&gt;
  &lt;/header&gt;


  &lt;!-- Pages --&gt;
  &lt;div class="is-widget-form-body"&gt;

    &lt;!-- General --&gt;
    &lt;div id="pageGeneral"&gt;
      &lt;div class="is-dock-fill is-split-container split5050"&gt;
        &lt;div class="panel"&gt;
          &lt;div id="gridItems"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="pnlItems" class="panel"&gt;
          &lt;div id="wbItems" class="is-dock-fill"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;



    &lt;!-- Visualisation --&gt;
    &lt;div id="pageVisualisation"&gt;
      &lt;div class="is-dock-fill"&gt;
        &lt;div id="gvVisualiser" class="is-dock-fill"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;

  &lt;/div&gt;

&lt;/div&gt;

&lt;script&gt;
// Properties
var mRecord;
var mRecord_Items;
var mFolderInfo;

// Other
var mActiveRowUniqueId = "";    // Only used when the 'Refresh' button is clicked
var mPreviewPaneVisible = true;
var mSelectedRowDetails = [];   // Used to retain selected rows after action is performed

// Controls
var C = {
  // General
  gridItems: null,
  pnlItems: null,
  wbItems: null,

  // Visualisation
  gvVisualiser: null,
}

// Form
var frmMain;
var tabDetails;

// Other
var mLoadAll = false;

// Initialise
$(function () {
  // Mobile optimisations
  $(window).resize(Form_Resize);

  // Controls
  C.pnlItems = $("#pnlItems");
  C.wbItems = widget.UI.PreviewPane("wbItems", {
    applicationShortcutHandler: wbItems_ApplicationShortcutHandler,
  });

  // Grids
  C.gridItems = widget.UI.Grid("gridItems", {
    allowMultiRowSelect: true,
    docked: true,
    rowNumbering: true,
    showSearchBox: true,
    showRowSelectors: true,
    stickyHeader: true,
    rowNumbering: true,

    onAction: gridItems_Action,
    onAfterRowActivate: gridItems_AfterRowActivate,
    onInitialiseRow: gridItems_InitialiseRow,
    onSelectedRowsChanged: gridItems_SelectedRowsChanged
  });

  // Grid Visualiser
  C.gvVisualiser = widget.UI.Charts.ApexCharts.GridVisualiser("gvVisualiser", C.gridItems, {});

  // Create Widget form
  // NOTE: Hide by default for a cleaner startup
  frmMain = new widget.UI.Form("frmMain", { visible: false });

  // Create Tabs
  tabDetails = new widget.UI.Tabs("tabDetails", {
    style: "normal",
    onSelectedTabChanged: tabDetails_Refresh,
  });

// Handle Notifications
  widget.ActionNotificationHandle(Widget_NotificationHandler);

  // Reset
  Form_Reset();
});

// ==========
// Form Reset
// ==========
function Form_Reset() {
  // Defaults
  C.gridItems.SearchClear();

  // Set Tab
  tabDetails.SelectedTabId("General");

  // Resize
  Form_Resize();

  // Load Record (i.e., initialise wizard)
  Record_Load();
}

// ===========
// Record Load
// ===========
function Record_Load() {
  // Initialise
  mRecord = null;
  mRecord_Items = null;

  // Clear cached summary pages
  C.wbItems.CacheClear();

  // Hide content
  frmMain.Visible(false);

  // Block UI
  widget.UI.Block("Loading folder, please wait...");

  // Load Initialisation details
  widget.GetString("GetInitialisationInfo", { loadAll: mLoadAll },
    // Success
    function (data) {
      mRecord = JSON.parse(data);
      mRecord_Items = mRecord.Items;

      // Page Permissions
      if (!mRecord.AllowPageVisualisation) tabDetails.TabVisible("Visualisation", false);

      // Notify Task Manager to update Folder Count
      if (mRecord.ShowFolderCount &amp;&amp; !mRecord.FolderCountDisableRefresh) {
        widget.ParentNotify("UpdateTaskManagerFolderCount", { folderId: mRecord.FolderId, count: mRecord.FolderCount });
      }

      // Custom filter message
      if (mRecord.FolderCountMessage) {
        C.gridItems.CustomFilterMessage(mRecord.FolderCountMessage);
      }

      Fields_Load();
    },

    // Fail
    function (message) {
      widget.UI.MsgBoxAlert("fail: " + message);
      Fields_Load();
    }
  );
}

// ===========
// Fields Load
// ===========
function Fields_Load() {
  if (mRecord) {
    // General
    gridItems_Refresh();
  }

  // Unblock UI
  widget.UI.Unblock();

  // Update Controls

  // Update fields
  Fields_Update();

  // Refresh Tab
  tabDetails_Refresh(0);
}

// =============
// Fields Update
// =============
function Fields_Update() {
  // Information Lists

  // Lists

  // Controls
  if(mRecord) {
    if (tabDetails.TabCountVisible() &lt; 2) tabDetails.Style("wizard");

    // Useful for support
    mFolderInfo = "To end of day " + mRecord.DateAsAtText + " - " + mRecord.TimeZoneDescription + " - for user '" + mRecord.UserId + "'";
    tabDetails.TabTooltipText("General", mFolderInfo);
    
    // Preview Pane
    if (mRecord.ShowPreviewPane) {
      C.pnlItems.show();
    }
    else {
      C.pnlItems.hide();
    }
  }

  // Show content
  frmMain.Visible(mRecord != null);

  // Resize
  tabDetails_Resize();
}

function tabDetails_Refresh() {
   // Load details
  switch (tabDetails.SelectedTabId()) {
    case "General":
      break;

    case "Visualisation":
      gvVisualiser_Refresh();
      break;

    default:
      break;
  }

  // Update Heading
  switch (tabDetails.SelectedTabId()) {
    default:
      frmMain.RefreshHeading(tabDetails.TabCaption(tabDetails.SelectedTabId()), tabDetails.TabTooltipText(tabDetails.SelectedTabId()));
      break;
  }

  // Resize
  tabDetails_Resize();

  // Focus
  switch (tabDetails.SelectedTabId()) {
    default:
      tabDetails.FocusFirst();
      break;
  }
}

function tabDetails_Resize() {
  switch (tabDetails.SelectedTabId()) {
    case "General":
      break;

    default:
      break;
  }
}

// =================
// Execute an Action
// =================
function Form_ExecuteAction(actionId) {
  switch (actionId.toUpperCase()) {
    default:
      window.alert(mViewName + ".Form_ExecuteAction: Unhandled action '" + actionId + "'");
      break;
  }
}

function Form_Resize() {
  // General

  // Tab
  tabDetails_Resize();
}


// ====================
// Notification Handler
// ====================
function Widget_NotificationHandler(actionId, data) {
  switch(actionId) {
    case "Refresh":
      // Refresh
      // NOTE: This can be called from the Task Manager to refresh this folder
      gridItems_Action("Refresh");
      break;

    case "WorkflowRefresh":
      // Refresh Workflow (e.g., if an action has been invoked and completed from the summary page)
      if (typeof data === "string") data = JSON.parse(data);

      if (data &amp;&amp; data.workflowId) {
        // See if Workflow Id exists
        for (var i = 0; i &lt; mRecord_Items.length; i++) {
          var item = mRecord_Items[i];
          if (item.WorkflowId == data.workflowId) {
            // Remove summary page from cache
            C.wbItems.CacheRemove(item.UniqueId);

            // Update preview
            if (i == C.gridItems.ActiveDataRowListIndex()) wbItems_Preview();

            // Refresh row
            // TODO: Maybe implement this by refetching the individual record (for performance) rather than refreshing the entire grid
            break;
          }
        }
      }
      break;
  }
}

// =========
// gridItems
// =========
function gridItems_Action(actionId) {
  // Initialise
  var item;
  var actionParametersJson = "";
  if (C.gridItems.ActiveDataRowListIndex() != -1) item = mRecord_Items[C.gridItems.ActiveDataRowListIndex()];

  // Get selected rows (including the active row if no selected rows)
  mSelectedRowDetails = C.gridItems.GetSelectedRowDetailsFromUniqueProperty("UniqueId", true);

  switch (actionId.toUpperCase()) {
    case "LOADALL":
      // Load All
      widget.UI.MsgBoxConfirm("Load ALL items into the grid?\n\nWARNING: This may cause performance or memory issues.", { icon: "Grid|Download", heading: "Load ALL Items" },
        function () {
          mLoadAll = true;
          Form_Reset();
        });
      break;
      
    case "LOGADD":
      // Add Log
      if (item.TaskType.startsWith("AccountApp")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=AccountAppLog&amp;accountAppId=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("Account")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=AccountLog&amp;accountId=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("Client")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=ClientLog&amp;clientId=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("SecurityStmt")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=SecurityStmtLog&amp;securityStmtId=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("User")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=UserLog&amp;userId=" + encodeURIComponent(mRecord.CurrentUserId));
      }
      else {
        widget.UI.MsgBoxAlert("A Log cannot be added for this type of Task.");
      }
      break;

    case "LOGREPLY":
      // Reply to a Log
      var replyToLogPk = item.Pk;
      if (widget.GetHostingContext() == "HtmlViewer") {
        // Desktop Log forms only support replying to the top-level parent
        if (item.ParentLogPk) replyToLogPk = item.ParentLogPk;
      }
      if (item.TaskType == "AccountAppLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=AccountAppLog&amp;accountAppId=" + encodeURIComponent(item.Code) + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else if (item.TaskType == "AccountLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=AccountLog&amp;accountId=" + encodeURIComponent(item.Code) + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else if (item.TaskType == "ClientLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=ClientLog&amp;clientId=" + encodeURIComponent(item.Code) + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else if (item.TaskType == "SecurityStmtLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=SecurityStmtLog&amp;securityStmtId=" + encodeURIComponent(item.Code) + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else if (item.TaskType == "SecurityStmtItemLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=SecurityStmtItemLog&amp;SecurityStmtItemPk=" + item.SecurityStmtItemPk + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else if (item.TaskType == "UserLog") {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=UserLog&amp;userId=" + encodeURIComponent(mRecord.CurrentUserId) + "&amp;replyToLogPk=" + replyToLogPk);
      }
      else {
        widget.UI.MsgBoxAlert("A Log cannot be replied to for this type of Task.");
      }
      break;

    case "REFRESH":
      // Refresh grid
      // NOTE: Retain active row only
      if (C.gridItems.ActiveDataRowListIndex() != -1) {
        mActiveRowUniqueId = mRecord_Items[C.gridItems.ActiveDataRowListIndex()].UniqueId;
      }
      mSelectedRowDetails = [];      
      Form_Reset();
      break;

    case "PREVIEWPANETOGGLE":
      // Toggle Preview Pane
      mPreviewPaneVisible = !mPreviewPaneVisible;
      if (mPreviewPaneVisible) {
        C.pnlItems.show();
      }
      else {
        C.pnlItems.hide();
      }
      gridItems_RefreshButtons();
      break;

    case "REPLYWEBMAIL":
      // Reply to Web Mail
      widget.ExecuteApplicationShortcutUrl("app://formshow?form=ClientLog&amp;replyToLogPk=" + (item.ParentLogPk || item.Pk) + "&amp;logType=WebMailToClient");
      break;

    case "WORKFLOWADD":
      // Add Workflow
      if (item.TaskType.startsWith("AccountApp")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=WorkflowNew&amp;type=AccountApp&amp;id=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("Account")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=WorkflowNew&amp;type=Account&amp;id=" + encodeURIComponent(item.Code));
      }
      else if (item.TaskType.startsWith("Client")) {
        widget.ExecuteApplicationShortcutUrl("app://formshow?form=WorkflowNew&amp;type=Client&amp;id=" + encodeURIComponent(item.Code));
      }
      else {
        widget.UI.MsgBoxAlert("A Workflow cannot be added for this type of Task.");
      }
      break;

    default:
      // Get Unique Ids of selected rows
      var uniqueIds = [];
      var canActionCount = 0;
      for (var i = 0; i &lt; mSelectedRowDetails.length; i++) {
        var row = mSelectedRowDetails[i];
        var item = mRecord_Items[row.listIndex];
        uniqueIds.push(row.value);

        // Can this action be performed on this row?
        switch(actionId) {
          case "CompleteTask":
            if (item.CanComplete) canActionCount += 1;
            break;

          case "Postpone1D":
          case "Postpone1W":
          case "Postpone2W":
          case "Postpone1M":
          case "Postpone1Y":
            if (item.CanDefer) canActionCount += 1;
            break;

          case "RoleDelegate":
          case "RoleUndelegate":
            if (item.CanDelegateRole) canActionCount += 1;
            break;
            
          case "LogOwnerUpdate":
            if (item.CanUpdateLogOwner) canActionCount += 1;
            break;

          case "UserDelegate":
          case "UserUndelegate":
            if (item.CanDelegate) canActionCount += 1;
            break;
        }
      }

      // Confirm
      var msg = "", title = "", prompt = true;
      switch (actionId) {
        case "Postpone1D":
          title = "Move Task Forward 1 Day";
          break;

        case "Postpone1W":
          title = "Move Task Forward 1 Week";
          break;

        case "Postpone2W":
          title = "Move Task Forward 2 Weeks";
          break;

        case "Postpone1M":
          title = "Move Task Forward 1 Month";
          break;

        case "Postpone1Y":
          title = "Move Task Forward 1 Year";
          break;

        case "RoleDelegate":
          // Prompt for Role
          widget.UI.Forms.ShowRangeLookupFromStandardRange("Roles", "", { rangeSingle: true },
            function (roleId) {
              if (roleId) gridItems_Action_Perform(actionId, uniqueIds, roleId);
            }
          );
          return;

        case "LogOwnerUpdate":
          // Prompt for User
          widget.UI.Forms.ShowRangeLookupFromStandardRange("Users", "", { sqlWhere: "Active=True", rangeSingle: true },
            function (userId) {
              if (userId) gridItems_Action_Perform(actionId, uniqueIds, userId);
            }
          );
          return;

        case "UserDelegate":
          // Prompt for User
          widget.UI.Forms.ShowRangeLookupFromStandardRange("Users", "", { sqlWhere: "Active=True", rangeSingle: true },
            function (userId) {
              if (userId) gridItems_Action_Perform(actionId, uniqueIds, userId);
            }
          );
          return;

        //case "Sample with no prompt":
          // No prompt required
          //prompt = false;
          //break;

        default:
          title = widget.SplitWordsAtCapitals(actionId);
      }

      switch (mSelectedRowDetails.length) {
        case 1:
          msg += "&lt;p&gt;Perform this action for the &lt;b&gt;1&lt;/b&gt; selected item?&lt;/p&gt;";
          break;

        default:
          msg += "&lt;p&gt;Perform this action for the &lt;b&gt;" + mSelectedRowDetails.length + "&lt;/b&gt; selected items?&lt;/p&gt;";
      }

      if (canActionCount == 0) {
        msg = "&lt;p style='color:red'&gt;&lt;b&gt;WARNING:&lt;/b&gt; This action cannot be performed on any of the selected items.&lt;/p&gt;";
        widget.UI.MsgBoxAlert(msg, { heading: title, messageIsHtml: true });
      }
      else if(prompt) {
        // Confirm action
        if (canActionCount != mSelectedRowDetails.length) {
          msg += "&lt;p style='color:red'&gt;&lt;b&gt;WARNING:&lt;/b&gt; This action can only be performed on &lt;b&gt;" + canActionCount + "&lt;/b&gt; of the &lt;b&gt;" + mSelectedRowDetails.length + "&lt;/b&gt; selected items.&lt;/p&gt;";
        }
        widget.UI.MsgBoxConfirm(msg, { heading: title, messageIsHtml: true }, function () { gridItems_Action_Perform(actionId, uniqueIds, actionParametersJson); });
      }
      else {
        // No confirmation required
        gridItems_Action_Perform(actionId, uniqueIds, actionParametersJson);
      }
      break;
  }
}

function gridItems_Action_Perform(actionId, uniqueIds, actionParametersJson) {
  // Block UI
  widget.UI.Block("Performing action, please wait...");

  // Action
  widget.GetString("PerformAction", { actionId: actionId, uniqueIds: uniqueIds, actionParametersJson: actionParametersJson },
   function (data) {
    // Parse
    data = JSON.parse(data);

    // Unblock UI
    widget.UI.Unblock();

    // Load and refresh grid
    Record_Load();

    // Warnings
    if (data.Warnings) {
      widget.UI.MsgBoxAlert(data.Warnings);
    }
   },

   function (error) {
    // Unblock UI
    widget.UI.Unblock();

    widget.UI.MsgBoxAlert(error);
   }
  );
}

function gridItems_AfterRowActivate(e) {
  // Preview
  wbItems_Preview();

  // Refresh Buttons
  gridItems_RefreshButtons();
}

function gridItems_SelectedRowsChanged(e) {
  // Refresh Buttons
  gridItems_RefreshButtons();
}

function gridItems_RefreshButtons() {
  // Get selected rows (including the active row if no selected rows)
  var rows = C.gridItems.GetSelectedRowIndexes(true, true);
  var singleRowActive = C.gridItems.ActiveDataRowListIndex() != -1 &amp;&amp; rows.length == 1;
  var singleActiveItem = C.gridItems.ActiveDataRowListIndex() != -1 &amp;&amp; rows.length == 1 ? mRecord_Items[C.gridItems.ActiveDataRowListIndex()] : null;

  // Find actions that can be performed on selected rows
  var canComplete = false, canDefer = false, canDelegate = false, canDelegateRole = false, canReplyWebMail = false, canReplyLog = false, canUpdateLogOwner = false;
    for (var i = 0; i &lt; rows.length; i++) {
    var item = mRecord_Items[rows[i]];

    if (item.CanComplete) canComplete = true;
    if (item.CanDefer) canDefer = true;
    if (item.CanDelegate) canDelegate = true;
    if (item.CanDelegateRole) canDelegateRole = true;
    if (item.CanReplyLog) canReplyLog = true;
    if (item.CanReplyWebMail) canReplyWebMail = true;
    if (item.CanUpdateLogOwner) canUpdateLogOwner = true;
  }

  // Update action states
  C.gridItems.Actions().SetEnabled("LogAdd", singleRowActive);
  C.gridItems.Actions().SetEnabled("LogReply", singleRowActive &amp;&amp; canReplyLog);
  C.gridItems.Actions().SetEnabled("WorkflowAdd", singleRowActive);

  C.gridItems.Actions().SetEnabled("ReplyWebMail", singleRowActive &amp;&amp; canReplyWebMail);

  C.gridItems.Actions().SetEnabled("CompleteTask", canComplete);
  C.gridItems.Actions().SetEnabled("Postpone1D", canDefer);
  C.gridItems.Actions().SetEnabled("Postpone1W", canDefer);
  C.gridItems.Actions().SetEnabled("Postpone2W", canDefer);
  C.gridItems.Actions().SetEnabled("Postpone1M", canDefer);
  C.gridItems.Actions().SetEnabled("Postpone1Y", canDefer);

  C.gridItems.Actions().SetEnabled("UserDelegate", canDelegate);
  C.gridItems.Actions().SetEnabled("UserUndelegate", canDelegate);
  
  C.gridItems.Actions().SetEnabled("LogOwnerUpdate", canUpdateLogOwner);

  C.gridItems.Actions().SetEnabled("RoleDelegate", canDelegateRole);
  C.gridItems.Actions().SetEnabled("RoleUndelegate", canDelegateRole);

  C.gridItems.Actions().SetChecked("PreviewPaneToggle", !mPreviewPaneVisible);
  
  C.gridItems.RefreshButtons();
}

function gridItems_InitialiseRow(e) {
  var item = mRecord_Items[e.row.listIndex];

  // Update cells
  e.row.AutoBind(item);
  
  // Update User Data cells
  e.row.AutoBindTaskManager2UserData(item);

  // Cell hyperlinks
  if (item.CodeApplicationShortcutUrl) e.row.cells.Code.hyperlink = item.CodeApplicationShortcutUrl;
  if (item.TaskApplicationShortcutUrl) {
    e.row.cells.TaskTypeText.hyperlink = item.TaskApplicationShortcutUrl;
  }
  else if (item.CodeApplicationShortcutUrl) {
    e.row.cells.TaskTypeText.hyperlink = item.CodeApplicationShortcutUrl;
  }

  // Tooltip
  //e.row.cells.InfoStatusIcon.tooltipText = item.InfoStatusText;

  // Task Type-specific
  switch(item.TaskType) {
    case "AccountClosedPendingReviewDate":
    case "AccountQuoteOutstanding":
    case "AccountReviewDate":
    case "AccountReadyToOpen":
    case "AccountSuspendReviewDate":
      // Account
      e.row.cells.Subject.value = e.row.cells.Name.value;
      break;

    case "AccountPendingWithdrawalReviewDate":
      // Account Pending Withdrawal Review Date
      break;

    case "AccountAppReviewDate":
      // Account Application Review Date
      e.row.cells.Subject.value = e.row.cells.Name.value;
      break;

    case "SecurityStmtReviewDate":
      // Security Statement
      e.row.cells.Subject.value = e.row.cells.Name.value;
      break;

    case "WorkflowReviewDate":
      // Workflow Review
      e.row.cells.Subject.value = e.row.cells.Name.value;
      break;
  }

  // Tweak Task Type Text to make more compact
  switch(item.TaskType) {
    case "AccountClosedPendingReviewDate":
      // Account Closed Pending Review Date
      e.row.cells.TaskTypeText.value = "Closed Pending";
      break;

    case "AccountQuoteOutstanding":
      // Account Quote Outstanding
      e.row.cells.TaskTypeText.value = "Quote Outstanding";
      break;

    case "AccountReadyToOpen":
      // Account Ready to Open
      e.row.cells.TaskTypeText.value = "Quote Ready";
      break;

    case "AccountSuspendReviewDate":
      // Account Suspension Review Date
      e.row.cells.TaskTypeText.value = "Suspension Review";
      break;

    case "AccountAppReviewDate":
      // Account Application Review Date
      e.row.cells.TaskTypeText.value = "Application Review";
      break;

    case "AccountAppLog":
      // Account Application Log
      e.row.cells.TaskTypeText.value = "Application Log";
      break;

    case "SecurityStmtLog":
      // Security Statement Log
      e.row.cells.TaskTypeText.value = "Security Log";
      break;

    case "SecurityStmtReviewDate":
      // Security Statement Review Date
      e.row.cells.TaskTypeText.value = "Security Review";
  }

  // Other cell hyperlinks

  // Styles
  e.row.cells.Name.small = true;
  e.row.cells.Subject.small = true;
  if (item.OwnerUserId == mRecord.UserId) e.row.cells.OwnerUserId.colour = "silver";
  if (item.DelegatedUserId == mRecord.UserId) e.row.cells.DelegatedUserId.bold = true;
}

function gridItems_Refresh() {

  var showColumnDelegatedRole = false;
  var showColumnDelegatedUser = false;
  var showColumnLogSeverity = false;
  var showColumnOwnerUser = false;
  var showColumnSubject = false;

  // Determine which columns should be included
  for(var i = 0; i &lt; mRecord_Items.length; i++) {
    var item = mRecord_Items[i];

    if (item.DelegatedRoleId) showColumnDelegatedRole = true;
    if (item.DelegatedUserId) showColumnDelegatedUser = true;
    if (item.ColourBackground) showColumnLogSeverity = true;
    if (item.OwnerUserId) showColumnOwnerUser = true;
    if (item.Subject) showColumnSubject = true;
  }

  // Add Columns
  // NOTE: Columns may be added but not shown for exporting and visualisation purposes
  C.gridItems.ClearColumns();
  C.gridItems.AddColumnColourBlock("ColourBackground", { caption: "", sortable: true, autoHideBelowScreenWidth: 1024 });
  C.gridItems.AddColumnCode("TaskTypeText", { caption: "Type", width: "10em", noLineBreak: true, sortable: true });
  C.gridItems.AddColumnCode("OwnerUserId", { caption: "Owner", sortable: true, autoHideBelowScreenWidth: 1024, visible: showColumnOwnerUser });
  C.gridItems.AddColumnCode("DelegatedUserId", { caption: "Delegated", sortable: true, autoHideBelowScreenWidth: 1024, visible: showColumnDelegatedUser });
  C.gridItems.AddColumnCode("DelegatedRoleId", { caption: "Role", width: "2em", sortable: true, autoHideBelowScreenWidth: 1024, visible: showColumnDelegatedRole });
  C.gridItems.AddColumnDate("DateDue", { caption: "Due", sortable: true });
  C.gridItems.AddColumnInteger("OverdueDays", { caption: "O/D", sortable: true });
  C.gridItems.AddColumnString("Subject", { caption: "Subject", sortable: true, visible: showColumnSubject });
  C.gridItems.AddColumnIcon("Icon", { caption: "", sortable: true });
  C.gridItems.AddColumnCode("Code", { caption: "Code", sortable: true });
  C.gridItems.AddColumnString("Name", { caption: "Name", sortable: true, autoHideBelowScreenWidth: 1200 });

  // User Data
  if (mRecord.UserDataHeadings &amp;&amp; mRecord.UserDataHeadings.length != 0) {
    for (var i = 0; i &lt; mRecord.UserDataHeadings.length; i++) {
      var heading = mRecord.UserDataHeadings[i];
      
      if (heading.Caption === null) {
        // Ignore
      }
      else {
        C.gridItems.AddColumnFromTaskManager2UserDataHeading(heading);
      }
    }
  }
  
  // Group By Column
  if (mRecord.GroupByColumn) {
    C.gridItems.GroupByColumnsUpdate(mRecord.GroupByColumn);
    if (mRecord.GroupByColumnHide) C.gridItems.ColumnVisible(mRecord.GroupByColumn, false);
  }

  // Columns to display
  if (mRecord.Columns) {
    C.gridItems.SortColumnsByArray(mRecord.Columns, false, true);
  }

  // Warning
  if (mRecord.WarningMessage) {
    widget.UI.ShowNotification("Warning", mRecord.WarningMessage, "", "Folder Limit Exceeded");
  }

  // Actions
  var actions = [];
  actions.push({ actionId: "Refresh", tooltipText:"Refresh", icon: "Refresh" });

  if (!mRecord.ReadOnly) {
    if (mRecord.AllowAddLog || mRecord.AllowAddWorkflow) {
      actions.push({});
      if (mRecord.AllowAddLog) actions.push({ actionId: "LogAdd", icon: "Log|Add", tooltipText: "Add a Log" });
      if (mRecord.AllowAddLog) actions.push({ actionId: "LogReply", icon: "Log_Reply", tooltipText: "Reply to Log/ Continue Thread" });
      if (mRecord.AllowAddWorkflow) actions.push({ actionId: "WorkflowAdd", icon: "Workflow|Add", tooltipText: "Create a new Workflow" });
    }

    if (mRecord.AllowAddLog &amp;&amp; mRecord.SupportsWebMail) {
      actions.push({});
      actions.push({ actionId: "ReplyWebMail", icon: "Webmail_Reply", tooltipText: "Reply to Web Mail" });
    }

    actions.push({});
    actions.push({ actionId: "CompleteTask", icon: "Check", tooltipText: "Complete task" });
    actions.push({ actionId: "Postpone1D", icon: "Date_Plus1", tooltipText: "Move task forward by 1 day" });
    actions.push({ actionId: "Postpone1W", icon: "Date_Plus7", tooltipText: "Move task forward by 1 week" });
    actions.push({ actionId: "Postpone2W", icon: "Date_Plus14", tooltipText: "Move task forward by 2 weeks" });
    actions.push({ actionId: "Postpone1M", icon: "Date_PlusM", tooltipText: "Move task forward by 1 month" });
    actions.push({ actionId: "Postpone1Y", icon: "Date_PlusY", tooltipText: "Move task forward by 1 year" });

    actions.push({});
    actions.push({ actionId: "UserDelegate", icon: "User_Delegate", tooltipText: "Delegate task to User", caption: "User" });
    actions.push({ actionId: "UserUndelegate", icon: "User|Clear", tooltipText: "Clear delegated User" });
    
    actions.push({});
    actions.push({ actionId: "RoleDelegate", icon: "User_Delegate", tooltipText: "Delegate task to Role", caption: "Role" });
    actions.push({ actionId: "RoleUndelegate", icon: "User|Clear", tooltipText: "Clear delegated Role" });
    
    actions.push({});
    actions.push({ actionId: "LogOwnerUpdate", icon: "Log|User", tooltipText: "Update Log Owner User", caption: "Owner" });
  }

  if (mRecord.ShowPreviewPane) {
    actions.push({});
    actions.push({ actionId: "PreviewPaneToggle", icon: "Form_PreviewPane|ArrowDown", tooltipText: "Show or hide summary", checked: !mPreviewPaneVisible });
  }
  
  if (mRecord.AllowLoadAll) {
    actions.push({});
    actions.push({ actionId: "LoadAll", icon: "Grid|Download", caption: "Load ALL Items" });
  }

  C.gridItems.Actions().Define(actions);

  // Give collection ability to form a unique cache key and preview parameters for the Widget
  mRecord_Items.GetCacheKey = function (index) {
    var item = mRecord_Items[index];
    return item.UniqueId;
  };
  mRecord_Items.GetPreviewFetchParameters = function (index) {
    var item = mRecord_Items[index];
    var o = {};

    o.uniqueId = item.UniqueId;
    o.target = "WebInternal";
    o.highDpi = widget.IsHighDpi();

    return o;
  };

  // Refresh
  C.gridItems.VirtualDataRefresh(mRecord_Items, false, { retainSelectedRows: false });

  // Activate First Row
  if (mActiveRowUniqueId) {
    for (var i = 0; i &lt; mRecord_Items.length; i++) {
      if (mRecord_Items[i].UniqueId == mActiveRowUniqueId) {
        C.gridItems.ActiveDataRowListIndex(i);
        break;
      }
    }

    mActiveRowUniqueId = "";
  }
  else {
    C.gridItems.ActivateFirstDataRow();
  }

  // Select Rows
  if (mSelectedRowDetails &amp;&amp; mSelectedRowDetails.length != 0) {
    C.gridItems.SetSelectedRowDetailsFromUniqueProperty("UniqueId", mSelectedRowDetails, true);
    mSelectedRowDetails = [];
  }

  // Refresh buttons (the next section will do this)
  gridItems_RefreshButtons();
}

// =======
// wbItems
// =======
function wbItems_Preview() {
  C.wbItems.PreviewFromGridCollection(C.gridItems, mRecord_Items, "GetItemPreview");
}

function wbItems_ApplicationShortcutHandler(applicationShortcutUrl) {
  if (applicationShortcutUrl.toUpperCase().startsWith("APP://FORMACTION")) {
    // Send to the global form action handler (i.e., this form does not handle it but it can be handled centrally)
    widget.ExecuteApplicationShortcutUrl(applicationShortcutUrl, true);
  }
  else {
    widget.ExecuteApplicationShortcutUrl(applicationShortcutUrl);
  }
}

// ============
// gvVisualiser
// ============
function gvVisualiser_Refresh(hasAccounts, hasAccountApps, hasClients) {
  var hasAccounts = false;
  var hasAccountApps = false;
  var hasClients = false;
  var targetTypes = 0;

  // Determine which special visualisations should be included
  for(var i = 0; i &lt; mRecord_Items.length; i++) {
    var item = mRecord_Items[i];

   // if (!hasAccounts &amp;&amp; item.TargetType == "Account") {
   //   hasAccounts = true;
   //   targetTypes += 1;
   // }
  }

  // Define pre-set visualisations
  var visualisations = [];
  visualisations.push({ caption: "By Delegated Role", chartType: "Pie", seriesColumn: "DelegatedRoleId", labelColumn: "DelegatedRoleId" });
  visualisations.push({ caption: "By Delegated User", chartType: "Pie", seriesColumn: "DelegatedUserId", labelColumn: "DelegatedUserId" });
  visualisations.push({ caption: "By Owner User", chartType: "Pie", seriesColumn: "OwnerUserId", labelColumn: "OwnerUserId" });
  visualisations.push({ caption: "By Task Type", chartType: "Pie", seriesColumn: "TaskTypeText", labelColumn: "TaskTypeText", default: true });
  /*
  if (targetTypes &gt; 1) {
    visualisations.push({ caption: "By Target Type", chartType: "Pie", chartTypes: "Bar,Column,Pie", seriesColumn: "TargetType", labelColumn: "TargetType" });
  }
  visualisations.push({ caption: "By Workflow Type", chartType: "Pie", chartTypes: "Bar,Column,Pie", seriesColumn: "WorkflowTypeId", labelColumn: "WorkflowTypeId", default: true });
  */

  // Options
  var options = {
    persistId: mRecord.PersistId, // Specifying this means that the User's selections will be retained between sessions (on the device) where possible
    visualisations: visualisations,
    allowCustomVisualisation: true, // i.e., allow a simple column/ chart combination
    title: "Tasks",
    subTitle: mFolderInfo,
  };

  // Refresh (options will extend options used when this control was created so only need to specify data-specific options here)
  C.gvVisualiser.Refresh(options);
}
&lt;/script&gt;</TemplateText>
    <TemplateTextBookmarks />
    <TimeoutSeconds>60</TimeoutSeconds>
    <UniqueId>cC5BaI+e1ken9+p50XnBMw</UniqueId>
    <AllowRefresh>true</AllowRefresh>
    <Caption />
    <HtmlWidgetAllowInitialEventCaching>true</HtmlWidgetAllowInitialEventCaching>
    <HtmlWidgetMaxHeight>0</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>1200</HtmlWidgetMaxWidth>
    <HtmlWidgetNeverApplyStyling>false</HtmlWidgetNeverApplyStyling>
    <HtmlWidgetResourceChartsApex>true</HtmlWidgetResourceChartsApex>
    <HtmlWidgetResourceCssSummaryPage2>false</HtmlWidgetResourceCssSummaryPage2>
    <HtmlWidgetResourceCssWidget>true</HtmlWidgetResourceCssWidget>
    <HtmlWidgetResourceJQuery>true</HtmlWidgetResourceJQuery>
    <HtmlWidgetResourceJQueryVersion />
    <HtmlWidgetSpecialEventGetFolderCount>false</HtmlWidgetSpecialEventGetFolderCount>
    <HtmlWidgetSpecialEventShowAsSummaryPage>false</HtmlWidgetSpecialEventShowAsSummaryPage>
    <HtmlWidgetSummaryPageObjectType>None</HtmlWidgetSummaryPageObjectType>
    <Icon />
    <RestrictedOriginsListEnabled>false</RestrictedOriginsListEnabled>
    <RunAsAdministrator>false</RunAsAdministrator>
    <WebServiceName />
    <WebServiceAllowAnonymous>false</WebServiceAllowAnonymous>
    <WebServiceSendDebugInformation>false</WebServiceSendDebugInformation>
    <ShowInMenu>None</ShowInMenu>
    <ParametersType>Custom</ParametersType>
    <Parameters>
      <ISParameterDefs version="1.00">
        <Parameters>
          <Parameter name="" type="SectionStart">
            <BlankTip />
            <Caption>TESTING</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText>These are the Parameters required by this HTML Widget to function correctly.
They are listed here for testing purposes only.</TooltipText>
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="FolderId" type="List">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <List>System_Tasks</List>
            <LimitToList>false</LimitToList>
            <MaxLength>0</MaxLength>
            <Rows>1</Rows>
          </Parameter>
          <Parameter name="UserId" type="List">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <List>RANGE.Users</List>
            <LimitToList>false</LimitToList>
            <MaxLength>20</MaxLength>
            <Rows>1</Rows>
          </Parameter>
          <Parameter name="DateAsAt" type="Date">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <IncludeTime>false</IncludeTime>
            <MaxValue />
            <MinValue />
          </Parameter>
          <Parameter name="DateAsAtMnemonic" type="List">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText>This can be used as an alternative to 'DateAsAt' to provide a relative Date As At.</TooltipText>
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <List>,EOW,EOM,EOM+1,D-7,D-1,D+1,D+7</List>
            <LimitToList>false</LimitToList>
            <MaxLength>10</MaxLength>
            <Rows>1</Rows>
          </Parameter>
        </Parameters>
      </ISParameterDefs>
    </Parameters>
  </finScript>