Merge pull request #12 in KWA/mobile-device-management from feature/KMP-7-list-folders-that-have-been-opened to master
* commit '568eb9170d61f661bfad04767cdd05e63fa1676a': List folders that have been opened through the api
This commit is contained in:
41
js/data/JsonDeviceFolderReader.js
Normal file
41
js/data/JsonDeviceFolderReader.js
Normal file
@ -0,0 +1,41 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.JsonDeviceFolderReader
|
||||
* @extends Zarafa.core.data.JsonReader
|
||||
*
|
||||
* This extension of the {@link Zarafa.core.data.JsonReader} supports
|
||||
* {@link Zarafa.plugins.mdm.data.MDMDeviceStore stores} which can hold different type of
|
||||
* {@link Zarafa.plugins.mdm.data.MDMDeviceRecord records}.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.JsonDeviceFolderReader = Ext.extend(Zarafa.core.data.JsonReader, {
|
||||
|
||||
/**
|
||||
* @cfg {Zarafa.core.data.RecordCustomObjectType} customObjectType The custom object type
|
||||
* which represents the {@link Ext.data.Record records} which should be created using
|
||||
* {@link Zarafa.core.data.RecordFactory#createRecordObjectByCustomType}.
|
||||
*/
|
||||
customObjectType: Zarafa.core.data.RecordCustomObjectType.MDM_Device_Folder,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} meta Metadata configuration options.
|
||||
* @param {Object} recordType (optional) Optional Record type matches the type
|
||||
* which must be read from response. If no type is given, it will use the
|
||||
* record type for the {@link Zarafa.core.data.RecordCustomObjectType#ZARAFA_RECIPIENT}.
|
||||
*/
|
||||
constructor: function (meta, recordType)
|
||||
{
|
||||
meta = Ext.applyIf(meta || {}, {
|
||||
id: 'folderid',
|
||||
idProperty: 'folderid',
|
||||
dynamicRecord: false
|
||||
});
|
||||
|
||||
if (!Ext.isDefined(recordType)) {
|
||||
recordType = Zarafa.core.data.RecordFactory.getRecordClassByCustomType(meta.customObjectType || this.customObjectType);
|
||||
}
|
||||
|
||||
Zarafa.plugins.mdm.data.JsonDeviceFolderReader.superclass.constructor.call(this, meta, recordType);
|
||||
}
|
||||
});
|
@ -5,28 +5,21 @@ Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
* @extends Zarafa.core.data.JsonReader
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.JsonCertificateReader = Ext.extend(Zarafa.core.data.JsonReader, {
|
||||
/**
|
||||
* @cfg {Zarafa.core.data.RecordCustomObjectType} customObjectType The custom object type
|
||||
* which represents the {@link Ext.data.Record records} which should be created using
|
||||
* {@link Zarafa.core.data.RecordFactory#createRecordObjectByCustomType}.
|
||||
*/
|
||||
customObjectType : Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} meta Metadata configuration options.
|
||||
* @param {Object} recordType (optional) Optional Record type matches the type
|
||||
* which must be read from response. If no type is given, it will use the
|
||||
* record type for the {@link Zarafa.core.data.RecordCustomObjectType#ZARAFA_MDM}.
|
||||
*/
|
||||
constructor : function(meta, recordType)
|
||||
{
|
||||
meta = Ext.applyIf(meta || {}, {
|
||||
dynamicRecord : false
|
||||
});
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} meta Metadata configuration options.
|
||||
* @param {Object} recordType (optional) Optional Record type matches the type
|
||||
* which must be read from response. If no type is given, it will use the
|
||||
* record type for the {@link Zarafa.core.mapi.ObjectType#MAPI_MDM}.
|
||||
*/
|
||||
constructor: function (meta, recordType)
|
||||
{
|
||||
meta = Ext.applyIf(meta || {}, {
|
||||
dynamicRecord: false
|
||||
});
|
||||
recordType = Zarafa.core.data.RecordFactory.getRecordClassByMessageClass('IPM.MDM');
|
||||
|
||||
recordType = Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM);
|
||||
|
||||
Zarafa.plugins.mdm.data.JsonCertificateReader.superclass.constructor.call(this, meta, recordType);
|
||||
}
|
||||
Zarafa.plugins.mdm.data.JsonCertificateReader.superclass.constructor.call(this, meta, recordType);
|
||||
}
|
||||
});
|
||||
|
21
js/data/MDMDeviceFolderRecord.js
Normal file
21
js/data/MDMDeviceFolderRecord.js
Normal file
@ -0,0 +1,21 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceFolderRecordFields
|
||||
*
|
||||
* Array of default fields for the {@link Zarafa.plugins.mdm.data.MDMDeviceFolderRecord} object.
|
||||
* These fields will always be added, regardless of the exact type of
|
||||
* {@link Zarafa.plugins.mdm.data.MDMDeviceFolderRecord record}.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceFolderRecordFields = [
|
||||
{name: 'store', type: 'string'},
|
||||
{name: 'folderid', type: 'string'},
|
||||
{name: 'name', type: 'string'},
|
||||
{name: 'type', type: 'int'},
|
||||
{name: 'flags', type: 'int'},
|
||||
{name: 'entryid', type: 'string'}
|
||||
];
|
||||
|
||||
Zarafa.core.data.RecordCustomObjectType.addProperty('MDM_Device_Folder');
|
||||
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.MDM_Device_Folder, Zarafa.plugins.mdm.data.MDMDeviceFolderRecordFields);
|
||||
Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.MDM_Device_Folder, Zarafa.core.data.MAPIRecord);
|
33
js/data/MDMDeviceFolderStore.js
Normal file
33
js/data/MDMDeviceFolderStore.js
Normal file
@ -0,0 +1,33 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceFolderStore
|
||||
* @extends Zarafa.core.data.MAPISubStore
|
||||
* @xtype mdm.devicefolderstore
|
||||
* Store specific for MDM Plugin which creates {@link Zarafa.plugins.mdm.MDMDeviceFolderStore record}.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceFolderStore = Ext.extend(Zarafa.core.data.MAPISubStore, {
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration object
|
||||
*/
|
||||
constructor: function (config)
|
||||
{
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
autoLoad: true,
|
||||
remoteSort: false,
|
||||
reader: new Zarafa.plugins.mdm.data.JsonDeviceFolderReader(),
|
||||
writer: new Zarafa.core.data.JsonWriter(),
|
||||
proxy: new Zarafa.core.data.IPMProxy({
|
||||
listModuleName: 'pluginmdmmodule',
|
||||
itemModuleName: 'pluginmdmmodule'
|
||||
})
|
||||
});
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceFolderStore.superclass.constructor.call(this, config);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('mdm.devicefolderstore', Zarafa.plugins.mdm.data.MDMDeviceFolderStore);
|
54
js/data/MDMDeviceProxy.js
Normal file
54
js/data/MDMDeviceProxy.js
Normal file
@ -0,0 +1,54 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceProxy
|
||||
* @extends Zarafa.core.data.MAPIProxy
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceProxy = Ext.extend(Zarafa.core.data.MAPIProxy, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor: function (config)
|
||||
{
|
||||
config = config || {};
|
||||
Ext.applyIf(config, {
|
||||
listModuleName: 'pluginmdmmodule',
|
||||
itemModuleName: 'pluginmdmmodule'
|
||||
});
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceProxy.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* This will create a {@link Zarafa.core.data.ProxyResponseHandler ProxyResponseHandler} object
|
||||
* which will be used by the {@link Zarafa.core.data.ResponseRouter ResponseRouter} when the
|
||||
* response for the given request has returned.
|
||||
*
|
||||
* @param {String} modulename The modulename which is being accessed with this request
|
||||
* @param {Zarafa.core.Actions} serverAction The action to perform on the server.
|
||||
* @param {Ext.data.Api.action} action name of the action to perform.
|
||||
* @param {Ext.data.Record[]} records list of records to operate on.
|
||||
* @param {Object} parameters object containing user parameters such as range (pagination) information, sorting information, etc.
|
||||
* @param {Ext.data.DataReader} reader data reader. Converts raw JavaScript objects (in our case) to instances of {@link Ext.data.Record}
|
||||
* @param {Function} callback call back function to call when the request has finished successfully.
|
||||
* @param {Object} scope scope for the call back function.
|
||||
* @param {Object} args arguments object. This will be passed to the call back function on successful read.
|
||||
* @return {Object} An instance of the {@link Zarafa.plugins.mdm.data.MDMDeviceResponseHandler ProxyResponseHandler}
|
||||
* which should be used for this request.
|
||||
* @private
|
||||
*/
|
||||
getResponseHandlerForRequest: function (modulename, serverAction, action, records, parameters, reader, callback, scope, args)
|
||||
{
|
||||
return new Zarafa.plugins.mdm.data.MDMDeviceResponseHandler({
|
||||
proxy: this,
|
||||
action: action,
|
||||
reader: reader,
|
||||
sendRecords: records,
|
||||
options: args,
|
||||
callback: callback,
|
||||
scope: scope
|
||||
});
|
||||
}
|
||||
});
|
@ -1,5 +1,10 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceRecordFields Array of {@link Ext.data.Field field} configurations for the
|
||||
* {@link Zarafa.plugins.mdm.data.MDMDeviceRecord record} object.
|
||||
* @private
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceRecordFields = [
|
||||
{name: 'entryid', type: 'string'},
|
||||
{name: 'devicetype', type: 'string'},
|
||||
@ -12,30 +17,22 @@ Zarafa.plugins.mdm.data.MDMDeviceRecordFields = [
|
||||
{name: 'lastupdatetime', type: 'date', dateFormat: 'timestamp'},
|
||||
{name: 'wipestatus', type: 'string'},
|
||||
{name: 'policyname', type: 'string'},
|
||||
{name: 'totalfolders', type: 'string'},
|
||||
{name: 'sharedfolders', type: 'string'},
|
||||
{name: 'shortfolderids', type: 'string'},
|
||||
{name: 'synchronizedfolders', type: 'string'},
|
||||
{name: 'emailsfolder', type: 'string'},
|
||||
{name: 'contactsfolder', type: 'string'},
|
||||
{name: 'tasksfolder', type: 'string'},
|
||||
{name: 'calendarsfolder', type: 'string'},
|
||||
{name: 'notesfolder', type: 'string'},
|
||||
{name: 'synchronizedfolders', type: 'string', defaultValue:'0'},
|
||||
{name: 'emailsfolder', type: 'string', defaultValue:'0'},
|
||||
{name: 'contactsfolder', type: 'string', defaultValue:'0'},
|
||||
{name: 'tasksfolder', type: 'string', defaultValue:'0'},
|
||||
{name: 'calendarsfolder', type: 'string', defaultValue:'0'},
|
||||
{name: 'notesfolder', type: 'string', defaultValue:'0'},
|
||||
{name: 'koeversion', type: 'string'},
|
||||
{name: 'koebuild', type: 'string'},
|
||||
{name: 'koebuilddate', type: 'date', dateFormat: 'timestamp'}
|
||||
{name: 'koebuilddate', type: 'date', dateFormat: 'timestamp'},
|
||||
{name: 'message_class', type: 'string', defaultValue:"IPM.MDM"}
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceRecord = Ext.extend(Zarafa.core.data.IPMRecord, {});
|
||||
Zarafa.core.data.RecordCustomObjectType.addProperty('ZARAFA_MDM');
|
||||
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM, Zarafa.plugins.mdm.data.MDMDeviceRecordFields);
|
||||
|
||||
Zarafa.core.data.RecordFactory.addListenerToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM, 'createphantom', function(record)
|
||||
{
|
||||
// Phantom records must always be marked as opened (they contain the full set of data)
|
||||
record.afterOpen();
|
||||
});
|
||||
|
||||
Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM, Zarafa.plugins.mdm.data.MDMDeviceRecord);
|
||||
Zarafa.core.data.RecordFactory.addFieldToMessageClass('IPM.MDM', Zarafa.plugins.mdm.data.MDMDeviceRecordFields);
|
||||
Zarafa.core.data.RecordFactory.setBaseClassToMessageClass('IPM.MDM', Zarafa.plugins.mdm.data.MDMDeviceRecord);
|
||||
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass('IPM.MDM', 'sharedfolders', Zarafa.plugins.mdm.data.MDMDeviceFolderStore);
|
||||
|
41
js/data/MDMDeviceResponseHandler.js
Normal file
41
js/data/MDMDeviceResponseHandler.js
Normal file
@ -0,0 +1,41 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceResponseHandler
|
||||
* @extends Zarafa.core.data.ProxyResponseHandler
|
||||
*
|
||||
* A Simple implementation for a {@link Zarafa.plugins.mdm.data.MDMDeviceResponseHandler ResponseHandler}.
|
||||
* This one can only be used by {@link Ext.data.DataProxy proxies} which wish to handle a Response
|
||||
* to their Request.
|
||||
*
|
||||
* This implementation limits itself to firing an {@link Ext.data.DataProxy#exception exception}
|
||||
* on error, and calling a callback function when all processing has been completed.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceResponseHandler = Ext.extend(Zarafa.core.data.ProxyResponseHandler, {
|
||||
|
||||
/**
|
||||
* Handles the list response. Gathers the stores from the response data, converts each entry
|
||||
* into a {@link Zarafa.core.MAPIStore MAPIStore} and pushes them into the collectedItems.
|
||||
* @param {Object} data The response object belonging to the given command.
|
||||
* @return {Boolean} False when action could not be handled successfully. This will
|
||||
* not cancel the transaction itself, but rather causes the 'success' argument for the
|
||||
* {@link #done} function to be false.
|
||||
*/
|
||||
doOpen: function(response)
|
||||
{
|
||||
this.receivedRecords = this.readRecordsFromResponse(response, 'item');
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles the list response. Gathers the stores from the response data, converts each entry
|
||||
* into a {@link Zarafa.core.MAPIStore MAPIStore} and pushes them into the collectedItems.
|
||||
* @param {Object} data The response object belonging to the given command.
|
||||
* @return {Boolean} False when action could not be handled successfully. This will
|
||||
* not cancel the transaction itself, but rather causes the 'success' argument for the
|
||||
* {@link #done} function to be false.
|
||||
*/
|
||||
doList: function(response)
|
||||
{
|
||||
this.receivedRecords = this.readRecordsFromResponse(response, 'item');
|
||||
}
|
||||
});
|
@ -20,10 +20,7 @@ Zarafa.plugins.mdm.data.MDMDeviceStore = Ext.extend(Zarafa.core.data.ListModuleS
|
||||
remoteSort: false,
|
||||
reader : new Zarafa.plugins.mdm.data.JsonCertificateReader(),
|
||||
writer : new Zarafa.core.data.JsonWriter(),
|
||||
proxy : new Zarafa.core.data.IPMProxy({
|
||||
listModuleName: 'pluginmdmmodule',
|
||||
itemModuleName: 'pluginmdmmodule'
|
||||
})
|
||||
proxy : new Zarafa.plugins.mdm.data.MDMDeviceProxy()
|
||||
});
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceStore.superclass.constructor.call(this, config);
|
||||
|
57
js/data/MDMHierarchyTreeLoader.js
Normal file
57
js/data/MDMHierarchyTreeLoader.js
Normal file
@ -0,0 +1,57 @@
|
||||
Ext.namespace('Zarafa.hierarchy.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMHierarchyTreeLoader
|
||||
* @extends Zarafa.hierarchy.data.HierarchyTreeLoader
|
||||
*
|
||||
* A Special treeloader to be used by the {@link Zarafa.plugins.mdm.data.MDMHierarchyTreeLoader MDMHierarchyTree}.
|
||||
* This wil dynamically load the child nodes for a given node by obtaining the subfolders of
|
||||
* the folder related to the given node.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMHierarchyTreeLoader = Ext.extend(Zarafa.hierarchy.data.HierarchyTreeLoader, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor : function(config)
|
||||
{
|
||||
Zarafa.plugins.mdm.data.MDMHierarchyTreeLoader.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add extra attributes for a new {@link Zarafa.hierarchy.ui.FolderNode folderNode} which is about
|
||||
* to be created. This will check the {@link Zarafa.hierarchy.ui.FolderNode#folder folder} to
|
||||
* see what properties must be set.
|
||||
*
|
||||
* Override to provide (@link Zarafa.plugins.mdm.ui.MDMFolderNodeUI MDMFolderNodeUI} to ui provider
|
||||
* @param {Object} attr The attributes which will be used to create the node
|
||||
* @return {Zarafa.hierarchy.ui.FolderNode} The created node
|
||||
*/
|
||||
createNode : function(attr)
|
||||
{
|
||||
var folder = attr.folder;
|
||||
|
||||
if (folder) {
|
||||
if (attr.nodeType === 'rootfolder') {
|
||||
attr.extendedDisplayName = this.tree.hasFilter();
|
||||
}
|
||||
|
||||
// To uniquely identify the favorites tree nodes we append the "favorites-" key word with node id
|
||||
// when the node is created.
|
||||
attr.id = folder.isFavoritesFolder() ? "favorites-" + folder.get('entryid') : folder.get('entryid');
|
||||
if (folder.isFavoritesRootFolder()) {
|
||||
attr.leaf = folder.get('assoc_content_count') === 0;
|
||||
} else {
|
||||
attr.leaf = !folder.get('has_subfolder');
|
||||
}
|
||||
|
||||
attr.uiProvider = Zarafa.plugins.mdm.ui.MDMFolderNodeUI;
|
||||
attr.expanded = this.tree.isFolderOpened(folder);
|
||||
attr.allowDrag = !folder.isDefaultFolder();
|
||||
}
|
||||
|
||||
// call parent of parent because of parent class will change ui provider
|
||||
return Zarafa.hierarchy.data.HierarchyTreeLoader.superclass.createNode.apply(this, arguments);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user