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
This commit is contained in:
csoni
2017-04-20 17:19:55 +05:30
committed by root
parent 42dda5a34b
commit 568eb9170d
21 changed files with 808 additions and 69 deletions

View File

@ -2,12 +2,12 @@ Ext.namespace('Zarafa.plugins.mdm.dialogs');
/**
* @class Zarafa.plugins.mdm.dialogs.MDMDeviceContentPanel
* @extends Zarafa.core.ui.ContentPanel
* @extends Zarafa.core.ui.RecordContentPanel
* @xtype mdmplugin.devicecontentpanel
*
* The content panel which is use to show device detail panel.
*/
Zarafa.plugins.mdm.dialogs.MDMDeviceContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
Zarafa.plugins.mdm.dialogs.MDMDeviceContentPanel = Ext.extend(Zarafa.core.ui.RecordContentPanel, {
/**
* @constructor
@ -16,19 +16,24 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceContentPanel = Ext.extend(Zarafa.core.ui.Con
constructor: function (config)
{
config = config || {};
var isKOE = config.record && config.record.get('koeversion') ? true : false;
var isKOE = config.record && config.record.get('koeversion') ? true : false;
Ext.applyIf(config, {
xtype: 'mdmplugin.devicecontentpanel',
modal: true,
title: dgettext('plugin_mdm', config.record.get('devicetype')),
layout : 'fit',
stateful : false,
width : isKOE ? 440 : 405,
height : isKOE ? 395 : 360,
recordComponentPluginConfig: Ext.applyIf(config.recordComponentPluginConfig || {}, {
allowWrite: true,
useShadowStore: true
}),
layout: 'fit',
stateful: false,
showLoadMask: false,
width: isKOE ? 440 : 405,
height: isKOE ? 450 : 420,
items: [{
xtype: 'mdmplugin.mdmdevicepanel',
record: config.record,
isKoe : isKOE,
isKoe: isKOE,
buttons: [{
text: _('Ok'),
handler: this.onOk,

View File

@ -12,7 +12,7 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
/**
* @cfg {Boolean} isKoe True if device has Kopano Outlook Extension information.
*/
isKoe : false,
isKoe: false,
/**
* @constructor
@ -54,7 +54,7 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
createDeviceInfoPanel: function (config)
{
return {
cls : 'mdm-device-panel',
cls: 'mdm-device-panel',
defaultType: 'displayfield',
defaults: {
disabled: true
@ -89,7 +89,7 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
createFolderInfoPanel: function ()
{
return {
cls : 'mdm-device-panel mdm-field-sep',
cls: 'mdm-device-panel mdm-field-sep',
defaultType: 'displayfield',
items: [{
cls: 'mdm-display-name',
@ -104,7 +104,7 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
xtype: 'fieldset',
layout: 'form',
labelWidth: 140,
cls : 'mdm-synchronize-panel',
cls: 'mdm-synchronize-panel',
defaultType: 'displayfield',
defaults: {
labelSeparator: '',
@ -126,7 +126,48 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
}, {
fieldLabel: _('Tasks'),
name: 'tasksfolder'
}]
},
this.createSharedFolderInfoPanel()
]
}]
};
},
/**
* Function which is use to create shared folders panel
* @returns {Object} Configuration object for the panel which shows folders properties
*/
createSharedFolderInfoPanel: function ()
{
return {
xtype: 'panel',
border: false,
cls: 'mdm-synchronize-shared-panel',
height: 50,
disabled: false,
layout: {
type: 'hbox',
align: 'stretch',
pack: 'start'
},
items: [{
layout: 'form',
border: false,
items: [{
xtype: 'displayfield',
fieldLabel: 'Shared Folders',
disabled: true,
name : 'sharedfolders'
}],
flex: 1
}, {
xtype: 'button',
text: dgettext('plugin_mdm', 'Managed shared Folders'),
cls: 'mdm-managesharedfolder-button',
listeners: {
click: this.onClickManageSharedFolder,
scope: this
}
}]
};
},
@ -142,13 +183,25 @@ Zarafa.plugins.mdm.dialogs.MDMDeviceGeneralTab = Ext.extend(Ext.form.FormPanel,
/**
* Function which handles the after render event of status field.
* Which is use to set the the display name for the given Provisioning Status into given field
* Which is use to set the display name for the given Provisioning Status into given field
* @param {Ext.form.TextField} statusField text field
*/
onAfterRenderStatus: function (statusField)
{
var status = parseInt(this.record.get("wipestatus"));
statusField.setValue(Zarafa.plugins.mdm.data.ProvisioningStatus.getDisplayName(status));
},
/**
* Function which handles the click event of manage shared folder button.
* It will open {@link Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel dialog}
*/
onClickManageSharedFolder: function ()
{
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['mdm.dialog.mdmmanagesharedfoldercontentpanel'], undefined, {
manager: Ext.WindowMgr,
record: this.dialog.record
});
}
});

View File

@ -0,0 +1,36 @@
Ext.namespace('Zarafa.plugins.mdm.dialogs');
/**
* @class Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel
* @extends Zarafa.core.ui.ContentPanel
* @xtype zarafa.managesharedfoldercontentpanel
*
* This will display a {@link Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderPanel contentpanel}
* to show {@link Zarafa.core.data.IPFRecord folders} which are shared with device.
*/
Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
/**
* @constructor
* @param config Configuration structure
*/
constructor: function (config) {
config = config || {};
Ext.applyIf(config,
{
xtype: 'mdm.managesharedfoldercontentpanel',
layout: 'fit',
title: dgettext('plugin_mdm','Manage Shared Folder'),
width: 300,
height: 350,
items: [{
xtype: 'mdm.managesharedfolderpanel'
}]
});
Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel.superclass.constructor.call(this, config);
}
});
Ext.reg('mdm.managesharedfoldercontentpanel', Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel);

View File

@ -0,0 +1,132 @@
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);