initial commit
This commit is contained in:
32
js/data/JsonDeviceReader.js
Normal file
32
js/data/JsonDeviceReader.js
Normal file
@ -0,0 +1,32 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.JsonCertificateReader
|
||||
* @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
|
||||
});
|
||||
|
||||
recordType = Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_MDM);
|
||||
|
||||
Zarafa.plugins.mdm.data.JsonCertificateReader.superclass.constructor.call(this, meta, recordType);
|
||||
}
|
||||
});
|
33
js/data/MDMDeviceRecord.js
Normal file
33
js/data/MDMDeviceRecord.js
Normal file
@ -0,0 +1,33 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm');
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceRecordFields = [
|
||||
{name: 'entryid', type: 'string'},
|
||||
{name: 'changed', type: 'boolean'},
|
||||
{name: 'deviceos', type: 'string'},
|
||||
{name: 'devicefriendlyname', type: 'string'},
|
||||
{name: 'deviceinfo', type: 'string'},
|
||||
{name: 'devicetype', type: 'string'},
|
||||
{name: 'devicemodel', type: 'string'},
|
||||
{name: 'domain', type: 'string'},
|
||||
{name: 'hierarchyuuid', type: 'string'},
|
||||
// ignoredmessages
|
||||
{name: 'firstsynctime', type: 'date', dateFormat: 'timestamp'},
|
||||
{name: 'lastupdatetime', type: 'date', dateFormat: 'timestamp'},
|
||||
{name: 'wipestatus', type: 'string'},
|
||||
{name: 'useragent', type: 'string'}
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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);
|
33
js/data/MDMDeviceStore.js
Normal file
33
js/data/MDMDeviceStore.js
Normal file
@ -0,0 +1,33 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMDeviceStore
|
||||
* @extends Zarafa.core.data.ListModuleStore
|
||||
* @xtype mdm.devicestore
|
||||
* Store specific for MDM Plugin which creates {@link Zarafa.plugins.mdm.MDMDeviceRecord record}.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMDeviceStore = Ext.extend(Zarafa.core.data.ListModuleStore, {
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration object
|
||||
*/
|
||||
constructor : function(config)
|
||||
{
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
autoLoad : true,
|
||||
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'
|
||||
})
|
||||
});
|
||||
|
||||
Zarafa.plugins.mdm.data.MDMDeviceStore.superclass.constructor.call(this, config);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('mdm.devicestore', Zarafa.plugins.mdm.data.MDMDeviceStore);
|
0
js/data/MDMRecord.js
Normal file
0
js/data/MDMRecord.js
Normal file
74
js/data/MDMResponseHandler.js
Normal file
74
js/data/MDMResponseHandler.js
Normal file
@ -0,0 +1,74 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.MDMResponseHandler
|
||||
* @extends Zarafa.core.data.AbstractResponseHandler
|
||||
*
|
||||
* MDM specific response handler.
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.MDMResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
||||
|
||||
/**
|
||||
* @cfg {Function} successCallback The function which
|
||||
* will be called after success request.
|
||||
*/
|
||||
successCallback : Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* @cfg {Function} failureCallback The function which
|
||||
* will be called after a failed request.
|
||||
* This callback is optional and currently unused.
|
||||
*/
|
||||
failureCallback : Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* Device information from Z-Push's soap call,
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doInfo : function(response) {
|
||||
this.successCallback(response);
|
||||
/*
|
||||
if(response.status != true && this.failureCallback != null) {
|
||||
this.failureCallback(response);
|
||||
} else {
|
||||
this.successCallback(response);
|
||||
}*/
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function if device was successfully removed from
|
||||
* z-push server.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doRemove : function(response)
|
||||
{
|
||||
if(response.remove){
|
||||
this.successCallback();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If wipe request response was successful, show informative message.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doWipe : function(response) {
|
||||
if (response.wipe === true) {
|
||||
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Wiping device'));
|
||||
} else {
|
||||
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Password incorrect'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If resync request response was successful, show informative message.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doResync : function(response) {
|
||||
if (response.resync === true) {
|
||||
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Full resync in progress'));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Ext.reg('mdm.responsehandler', Zarafa.plugins.mdm.data.MDMResponseHandler);
|
67
js/data/ProvisioningStatus.js
Normal file
67
js/data/ProvisioningStatus.js
Normal file
@ -0,0 +1,67 @@
|
||||
Ext.namespace('Zarafa.plugins.mdm.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.mdm.data.ProvisioningStatus
|
||||
* @extends Zarafa.core.Enum
|
||||
*
|
||||
* @singleton
|
||||
*/
|
||||
Zarafa.plugins.mdm.data.ProvisioningStatus = Zarafa.core.Enum.create({
|
||||
/**
|
||||
* Denotes that the wipe is not applicable.
|
||||
* @property
|
||||
* @type Number
|
||||
*/
|
||||
'NOT_APPLICABLE' : 0,
|
||||
|
||||
/**
|
||||
* Denotes that the wipe is ok.
|
||||
* @property
|
||||
* @type Number
|
||||
*/
|
||||
'OK' : 1,
|
||||
|
||||
/**
|
||||
* Denotes that the wipe is pending.
|
||||
* @property
|
||||
* @type Number
|
||||
*/
|
||||
'WIPE_PENDING' : 2,
|
||||
|
||||
/**
|
||||
* Denotes that the Wipe is requested.
|
||||
* @property
|
||||
* @type Number
|
||||
*/
|
||||
'WIPE_REQUESTED' : 4,
|
||||
|
||||
/**
|
||||
* Denotes that the Wipe is executed.
|
||||
* @property
|
||||
* @type Number
|
||||
*/
|
||||
'WIPE_EXECUTED' : 8,
|
||||
|
||||
/**
|
||||
* Return the display name for the given provisioning Status
|
||||
* @param {Zarafa.plugins.mdm.js.data.ProvisioningStatus} provisioningStatus The given provisioning status
|
||||
* @return {String} The display name for the provisioning status
|
||||
*/
|
||||
getDisplayName : function(provisioningStatus)
|
||||
{
|
||||
switch (provisioningStatus) {
|
||||
case Zarafa.plugins.mdm.data.ProvisioningStatus.NOT_APPLICABLE:
|
||||
return _('Not Applicable');
|
||||
case Zarafa.plugins.mdm.data.ProvisioningStatus.OK:
|
||||
return _('Ok');
|
||||
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_PENDING:
|
||||
return _('Wipe Pending');
|
||||
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_REQUESTED:
|
||||
return _('Wipe Requested');
|
||||
case Zarafa.plugins.mdm.data.ProvisioningStatus.WIPE_EXECUTED:
|
||||
return _('Wipe Executed');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user