Skip to main content

 

ConnectWise

SC.popout.js

SC.popout.getPanel()

Used to reference the currently initialized popout panel.

Parameters

Name Type Description
None    

Return type

Returns the currently displayed popout panel.

Example

When attempting to hide the current popout panel, the hidePanel method’s first action is to retrieve it.

  SC.popout.hidePanel = function () {
       var popoutPanel = SC.popout.getPanel();
       …
};

 

SC.popout.hidePanel()

Used to hide the currently displayed popout panel if one is available.

Parameters

Name Type Description
None    

Return type

Returns a Boolean of whether or not a panel was present and thus hidden.

Example

The first action performed by the showConfirmationDialog method is to ensure that the previous popout panel is hidden before displaying its own.

  SC.popout.showConfirmationDialog = function (popoutFrom, message, yesText, noText, ye-sProc, noProc) {
    SC.popout.hidePanel();
    SC.popout.togglePanel(…)
};

 

SC.popout.togglePanel(popoutFrom, buildProc, showProc, stayOpenOnExecuteCommand)

Used to build and display a popout panel from a specific element

Parameters

Name Type Description
popoutFrom DOM object Dictates the element from where the panel should originate
buildProc function Function to be executed in order to create and populate the popout panel
showProc function Function to be executed immediately when the popoutpanel is displayed
stayOpenOnExecuteCommand boolean Whether or not the popout panel should remain displayed when a command is executed

Return type

void

Example

When the More command is executed within the Host page, the following method displays the appropriate popout panel using the button from where it was spawned.  The More popout panel displays a list of additional session command buttons (Reinstall, Run Tool, etc).

  if (eventArgs.commandName == 'More') {
SC.popout.togglePanel(eventArgs.commandElement, function (popoutPanel) {
              SC.css.ensureClass(popoutPanel, 'Overflow', true);
              SC.command.queryAndAddCommandButtons(popoutPanel, 'HostDetailPopoutPanel');
              window.updateDetailPanels();
       });
}

 

SC.popout.computePopoutCommandsVisible(baseEventArgs)

Used to determine which command buttons should be visible within the popout panel

Parameters

Name Type Description
baseEventArgs DOM event object Base event arguments used to determine command button visibility

Return type

Returns a list of command buttons that should be visible within the current popout panel

Example

Within the Extension tab on the Administration page, the ability to Edit an Extension is determined by whether or not the Extension Developer extension is installed.

  SC.event.addGlobalHandler(SC.event.QueryCommandButtonState, function (eventArgs) {
    switch (eventArgs.commandName) {
        case 'DevelopExtension':
        eventArgs.isVisible = SC.popout.computePopoutCommandsVisible(eventArgs);
        break;
    }
});

 

SC.popout.showPanelFromCommand(baseEventArgs, commandContext)

Used to build a popout panel, display it, and populate it with specific command buttons based upon the originating event.

Parameters

Name Type Description
baseEventArgs DOM event object Base event arguments used to determine command button visibility
commandContext  DOM command object the contextual information about from where the command was executed

Return type

void

Example

Within the Security tab on the Administration page, when a command is executed, the subsequent popout panel behavior is determined by the element from where it was executed.

SC.event.addGlobalHandler(SC.event.ExecuteCommand, function (eventArgs) {
    switch (eventArgs.commandName) {
        case 'Options':
            SC.popout.showPanelFromCommand(eventArgs, { userSourceInfo: SC.command.getEventDataItem(eventArgs) });
            break;
        case 'AddUserSource':
            SC.popout.showPanelFromCommand(eventArgs, { userSourceInfo: SC.command.getEventDataItem(eventArgs) });
            break;
…
};

 

SC.popout.showConfirmationDialog(popoutFrom, message, yesText, noText, yesProc, noProc)

Used to display a subsequent dialog to ensure the action about to be taken is intended by the user

Parameters

Name Type Description
popoutFrom DOM element The element from where the confirmation dialog will spawn
message String A message to be displayed asking the user to confirm the action
yesText String Text label used to confirm the action
noText String Text label used to deny the action
yesProc function Function to be executed upon action confirmation
noProc function Function to be executed if the action is denied

Return type

void

Example

When using the Shared Toolbox from the Host page, if a user right-clicks a Tool and then executes Delete, the following method is invoked to confirm the action.

  switch (eventArgs.commandName) {
    case 'DeleteToolboxItem':
        SC.popout.showConfirmationDialog(
            SC.event.getElement(eventArgs),
            SC.util.formatString(SC.res['DeleteToolboxItemPanel.MessageFormat'], pathAsArray.join('/')),
            SC.res['DeleteToolboxItemPanel.DeleteText'],
            SC.res['DeleteToolboxItemPanel.CancelText'],
            function () {
                SC.css.ensureClass(SC.event.getElement(eventArgs), 'MarkedForDeletion', true);
SC.service.ProcessToolboxOperation(SC.types.ToolboxOperation.Delete, pathAsArray.join('/'), null, function () {
SC.service.GetToolbox(function (toolbox) {
                    loadedToolbox = toolbox;
                    renderProc(pathAsArray.slice(0, -1));
                });
            });
        }
        );
        break;
};

 

 

  • Was this article helpful?
Leave feedback