KWA-MDM/js/data/MDMResponseHandler.js

75 lines
2.1 KiB
JavaScript
Raw Normal View History

2016-05-11 10:40:44 +02:00
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', 'plugin_mdm'));
2016-05-11 10:40:44 +02:00
} else {
container.getNotifier().notify('info.mdm', _('Mobile Device Manager'), _('Password incorrect', 'plugin_mdm'));
2016-05-11 10:40:44 +02:00
}
},
/**
* 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', 'plugin_mdm'));
2016-05-11 10:40:44 +02:00
}
}
});
Ext.reg('mdm.responsehandler', Zarafa.plugins.mdm.data.MDMResponseHandler);