2016-05-11 10:40:44 +02:00
|
|
|
Ext.namespace('Zarafa.plugins.mdm');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class Zarafa.plugins.mdm.MDM
|
|
|
|
* @extends Zarafa.core.Plugin
|
2016-12-07 11:48:14 +01:00
|
|
|
*
|
2016-05-11 10:40:44 +02:00
|
|
|
* Plugin which lists all devices connected to a Kopano account with Z-Push.
|
|
|
|
* The user can wipe, resync, remove a device using buttons in the WebApp.
|
|
|
|
*/
|
|
|
|
Zarafa.plugins.mdm.MDM = Ext.extend(Zarafa.core.Plugin, {
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param {Object} config
|
|
|
|
* @protected
|
|
|
|
*/
|
|
|
|
constructor : function(config) {
|
|
|
|
config = config || {};
|
|
|
|
Zarafa.plugins.mdm.MDM.superclass.constructor.call(this, config);
|
2017-04-20 13:49:55 +02:00
|
|
|
|
|
|
|
// Module information for MDM which will use in shadow store.
|
|
|
|
Zarafa.core.ModuleNames["IPM.MDM"] = {
|
|
|
|
list: 'pluginmdmmodule',
|
|
|
|
item: 'pluginmdmmodule'
|
|
|
|
}
|
2016-05-11 10:40:44 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called after constructor.
|
|
|
|
* Registers insertion points.
|
|
|
|
* @protected
|
|
|
|
*/
|
|
|
|
initPlugin : function()
|
|
|
|
{
|
|
|
|
this.registerInsertionPoint('context.settings.categories', this.createSettingCategory, this);
|
2016-12-07 11:48:14 +01:00
|
|
|
this.registerInsertionPoint('settings.versioninformation', this.createVersionInfo, this);
|
2017-02-21 08:12:13 +01:00
|
|
|
Zarafa.core.data.SharedComponentType.addProperty('mdm.dialog.mdmdevicecontentpanel');
|
2017-04-20 13:49:55 +02:00
|
|
|
Zarafa.core.data.SharedComponentType.addProperty('mdm.dialog.mdmmanagesharedfoldercontentpanel');
|
2016-05-11 10:40:44 +02:00
|
|
|
Zarafa.plugins.mdm.MDM.superclass.initPlugin.apply(this, arguments);
|
|
|
|
},
|
|
|
|
|
2016-12-06 06:52:40 +01:00
|
|
|
/**
|
|
|
|
* Bid for the type of shared component and the given record.
|
|
|
|
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
|
|
|
* @param {Ext.data.Record} record Optionally passed record.
|
|
|
|
* @returns {Number}
|
|
|
|
*/
|
|
|
|
bidSharedComponent : function (type, record)
|
|
|
|
{
|
|
|
|
var bid = -1;
|
|
|
|
switch (type) {
|
2017-02-21 08:12:13 +01:00
|
|
|
case Zarafa.core.data.SharedComponentType['mdm.dialog.mdmdevicecontentpanel']:
|
2016-12-06 06:52:40 +01:00
|
|
|
bid = 1;
|
|
|
|
break;
|
2017-04-20 13:49:55 +02:00
|
|
|
case Zarafa.core.data.SharedComponentType['mdm.dialog.mdmmanagesharedfoldercontentpanel']:
|
|
|
|
bid = 1;
|
|
|
|
break;
|
2016-12-06 06:52:40 +01:00
|
|
|
}
|
|
|
|
return bid;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Will return the reference to the shared component.
|
|
|
|
* Based on the type of component requested a component is returned.
|
|
|
|
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
|
|
|
* @param {Ext.data.Record} record Optionally passed record.
|
|
|
|
* @return {Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel} Component
|
|
|
|
*/
|
|
|
|
getSharedComponent : function (type, record)
|
|
|
|
{
|
2017-04-20 13:49:55 +02:00
|
|
|
var component;
|
|
|
|
switch (type) {
|
|
|
|
case Zarafa.core.data.SharedComponentType['mdm.dialog.mdmdevicecontentpanel']:
|
|
|
|
component = Zarafa.plugins.mdm.dialogs.MDMDeviceContentPanel;
|
|
|
|
break;
|
|
|
|
case Zarafa.core.data.SharedComponentType['mdm.dialog.mdmmanagesharedfoldercontentpanel']:
|
|
|
|
component = Zarafa.plugins.mdm.dialogs.MDMManageSharedFolderContentPanel;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return component;
|
2016-12-06 06:52:40 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
2016-05-11 10:40:44 +02:00
|
|
|
/**
|
|
|
|
* Creates a category in settings for Z-Push
|
2016-12-07 11:48:14 +01:00
|
|
|
* @return {mdmsettingscategory}
|
2016-05-11 10:40:44 +02:00
|
|
|
*/
|
|
|
|
createSettingCategory: function() {
|
|
|
|
return [{
|
|
|
|
xtype : 'Zarafa.plugins.mdm.mdmsettingscategory'
|
|
|
|
}];
|
2016-12-07 11:48:14 +01:00
|
|
|
},
|
2016-05-11 10:40:44 +02:00
|
|
|
|
2016-12-07 11:48:14 +01:00
|
|
|
/**
|
|
|
|
* Creates a displayField that will show the version of the Z-Push server
|
|
|
|
*/
|
|
|
|
createVersionInfo : function() {
|
|
|
|
var version = container.getSettingsModel().get('zarafa/v1/plugins/mdm/zpush-server-version', true);
|
|
|
|
return {
|
|
|
|
fieldLabel : _('Z-Push', 'plugin_mdm'),
|
|
|
|
value : version
|
|
|
|
};
|
|
|
|
}
|
2016-05-11 10:40:44 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Zarafa.onReady(function() {
|
|
|
|
container.registerPlugin(new Zarafa.core.PluginMetaData({
|
|
|
|
name : 'mdm',
|
2016-06-09 11:13:23 +02:00
|
|
|
displayName : _('Mobile device management', 'plugin_mdm'),
|
2016-05-11 10:40:44 +02:00
|
|
|
pluginConstructor : Zarafa.plugins.mdm.MDM
|
|
|
|
}));
|
|
|
|
});
|