KWA-MDM/js/dialogs/MDMManageSharedFolderPanel.js
csoni 568eb9170d List folders that have been opened through the api
Added button in MDMDeviceGeneralTab
Created MDMManageSharedFolderContentPanel and MDMManageSharedFolderPanel to show a dialog with multi select hierarchy
Created substore sharedfolder
Added proxy and response handler to handel device response

Used message class instead of object type,
Override hierarchy tree , hierarchy loader and folder node ui
2017-08-04 07:17:11 -07:00

132 lines
3.2 KiB
JavaScript

Ext.namespace('Zarafa.plugins.mdm.dialogs');
/**
* @class Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel
* @extends Ext.Panel
* @xtype mdm.managesharedfolderpanel
*
* Panel for users to show the {@link Zarafa.core.data.IPFRecord folders} which are shared with device
*/
Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel = Ext.extend(Ext.Panel, {
/**
* @constructor
* @param {Object} config Configuration structure
*/
constructor: function (config)
{
config = config || {};
Ext.applyIf(config, {
xtype: 'mdm.managesharedfolderpanel',
layout: {
type: 'fit',
align: 'stretch'
},
border: false,
header: false,
items: [
this.createTreePanel()
],
buttonAlign: 'right',
buttons: [{
text: _('Apply'),
ref: '../okButton',
cls: 'zarafa-action',
scope: this
}, {
text: _('Cancel'),
ref: '../cancelButton',
handler: this.onCancel,
scope: this
}]
});
Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel.superclass.constructor.call(this, config);
},
/**
* Creates a {@link Zarafa.hierarchy.ui.Tree treepanel}
* which contains all the {@link Zarafa.hierarchy.data.MAPIFolderRecord folders}
* on which search get perform.
* @return {Object} Configuration object for the tree panel.
* @private
*/
createTreePanel: function ()
{
return {
xtype: 'panel',
layout : 'form',
defaults: {
cls : 'mdm-create-tree-panel-item'
},
border: false,
flex: 1,
items: [{
xtype: 'displayfield',
hideLabel : true,
value: dgettext('plugin_mdm','Select folders to sync on your device')
}, {
xtype: 'mdm.hierarchytree',
autoScroll : true,
nodeConfig : {
checked : false
},
multiSelect: true,
hideShowAllFolders: true,
border: true,
treeSorter: true,
bbarConfig: {
hidden: true
},
enableDD: false,
anchor: '100% 90%',
ref: '../hierarchyTree'
}]
};
},
/**
* Initialize the events
* @private
*/
initEvents: function ()
{
Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel.superclass.initEvents.apply(this, arguments);
this.mon(this.hierarchyTree, 'load', this.onTreeNodeLoad, this);
},
/**
* Fired when the {@link Zarafa.hierarchy.ui.Tree Tree} fires the {@link Zarafa.hierarchy.ui.Tree#load load}
* event. This function will try to select those {@link Ext.tree.TreeNode TreeNode} in
* {@link Zarafa.hierarchy.ui.Tree Tree} which was shared with respective device. When the given node is not loaded yet, it will try again
* later when the event is fired again.
*
* @private
*/
onTreeNodeLoad: function ()
{
var subStore = this.dialog.record.getSubStore('sharedfolders');
var folders = subStore.getRange();
folders.forEach(function (folder) {
var node = this.hierarchyTree.getNodeById(folder.get('entryid'));
if (Ext.isDefined(node)) {
if(node.hasChildNodes()){
node.expand();
}
node.getUI().toggleCheck(true)
}
}, this);
},
/**
* Action handler when the user presses the "Cancel" button.
* This will close the panel.
*/
onCancel: function ()
{
this.dialog.close();
}
});
Ext.reg('mdm.managesharedfolderpanel', Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel);