How to use Zip&Download in smartUI

This is a control in smartUI. Basic infos are:

This control uses the command:

–lib\src\csui\utils\commands\zipanddownload.js

Requires:

“module”, “require”, “csui/lib/underscore”, “csui/lib/jquery”, “i18n!csui/utils/commands/nls/localized.strings”, “csui/utils/command.error”,   “csui/utils/commandhelper”, “csui/models/command”, ” csui/utils/url ”   

Triggered, when more than 1 file is selected. Action.ID = “zipanddownload« 

Uses ‘csui/controls/globalmessage/globalmessage’,         “csui/models/zipanddownload/zipanddownload.preflight”,         “csui/models/zipanddownload/zipanddownload.stages”,         “csui/dialogs/modal.alert/modal.alert”  in local require.

Uses REST Calls. To use the command, these REST calls must exist on the Content Server side.

  • Post api/v2/zipanddownload with body={” id_list”:[oids zu compress],”type” : “zipanddownload ” 
    • Returns in results/data/jobs/id the oid of the archive to download
  • Post api/v2/zipanddownload/oid to download the compressed archive

Simply put the command in a place where your menu options are. Typically in a toolbar config like

/* Example where to put the command
define([
'module',
"csui/controls/toolbar/toolitem.model",
'csui/controls/toolbar/toolitems.factory',
'i18n!conws/utils/commands/nls/commands.lang'
], function (module, ToolItemModel, ToolItemsFactory, lang) {
var toolbarItems = {
    otherToolbar: new ToolItemsFactory({

        first: [{
                signature: "AddParticipant",
                name: lang.CommandNameAddParticipant,
                icon: "binf-glyphicon binf-glyphicon-plus"
            },
            {
                signature: "YourCommand",
                name: "YourCommandname",
                icon: "Your Binf-Glyphicon"
            },
            {
                signature: "PrintParticipants",
                name: lang.CommandNamePrintParticipants,
                icon: "binf-glyphicon binf-glyphicon-print"
            }, {
                signature: "ExportParticipants",
                name: lang.CommandNameExportParticipants,
                icon: "binf-glyphicon binf-glyphicon-download"
            }, {
                signature: "ShowRoles",
                name: lang.CommandNameShowRoles
            }, {
                signature: "RemoveParticipant",
                name: lang.CommandNameRemoveParticipant
            }

        ],
        second: [
        ],
        third: [
        ]
    }, {
        maxItemsShown: 99,
        dropDownIcon: "icon icon-toolbar-more"
    })

};

return toolbarItems;

});