mirror of
https://github.com/silentsakky/zarafa-webapp-passwd
synced 2026-07-27 18:41:08 +02:00
only chnage password when category is visible
show saving mask
This commit is contained in:
parent
47faed5f6b
commit
227bb4a886
3 changed files with 104 additions and 17 deletions
|
|
@ -7,13 +7,6 @@ Ext.namespace('Zarafa.plugins.passwd.settings');
|
||||||
* Panel which holds a form that will be used to change the password
|
* Panel which holds a form that will be used to change the password
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
/**
|
|
||||||
* @property
|
|
||||||
* @type Ext.LoadMask
|
|
||||||
* Save mask that will be displayed when request has been sent to server for password change
|
|
||||||
* and waiting for the response.
|
|
||||||
*/
|
|
||||||
saveMask : undefined,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|
@ -69,7 +62,22 @@ Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
* @event userchange
|
* @event userchange
|
||||||
* Fires when a field is modified in the form panel
|
* Fires when a field is modified in the form panel
|
||||||
*/
|
*/
|
||||||
'userchange'
|
'userchange',
|
||||||
|
/**
|
||||||
|
* @event beforesave
|
||||||
|
* Fires when this form panel about to send request to server
|
||||||
|
*/
|
||||||
|
'beforesave',
|
||||||
|
/**
|
||||||
|
* @event save
|
||||||
|
* Fires when this form panel has successfully changed password
|
||||||
|
*/
|
||||||
|
'save',
|
||||||
|
/**
|
||||||
|
* @event exception
|
||||||
|
* Fires when this form panel was not able to change password
|
||||||
|
*/
|
||||||
|
'exception'
|
||||||
);
|
);
|
||||||
|
|
||||||
Zarafa.plugins.passwd.settings.PasswdPanel.superclass.constructor.apply(this, arguments);
|
Zarafa.plugins.passwd.settings.PasswdPanel.superclass.constructor.apply(this, arguments);
|
||||||
|
|
@ -86,10 +94,6 @@ Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
this.getForm().setValues({
|
this.getForm().setValues({
|
||||||
username : container.getUser().getUserName()
|
username : container.getUser().getUserName()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.saveMask = new Ext.LoadMask(this.getEl(), {
|
|
||||||
msg : _('Saving please wait ...')
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,8 +111,7 @@ Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
*/
|
*/
|
||||||
saveChanges : function()
|
saveChanges : function()
|
||||||
{
|
{
|
||||||
// show load mask
|
this.fireEvent('beforesave', this);
|
||||||
this.saveMask.show();
|
|
||||||
|
|
||||||
var data = this.getForm().getFieldValues();
|
var data = this.getForm().getFieldValues();
|
||||||
|
|
||||||
|
|
@ -136,8 +139,11 @@ Zarafa.plugins.passwd.settings.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
*/
|
*/
|
||||||
callbackFn : function(success, response)
|
callbackFn : function(success, response)
|
||||||
{
|
{
|
||||||
// hide load mask
|
if(success) {
|
||||||
this.saveMask.hide();
|
this.fireEvent('save', this);
|
||||||
|
} else {
|
||||||
|
this.fireEvent('exception', this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,82 @@ Zarafa.plugins.passwd.settings.SettingsPasswdCategory = Ext.extend(Zarafa.settin
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.passwd.settings.SettingsPasswdCategory.superclass.constructor.call(this, config);
|
Zarafa.plugins.passwd.settings.SettingsPasswdCategory.superclass.constructor.call(this, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by superclass when the Category has been deselected and is hidden from the user,
|
||||||
|
* this will unregister the {@link #onBeforeSaveRules} event handler.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
onHide : function()
|
||||||
|
{
|
||||||
|
Zarafa.common.settings.SettingsRuleCategory.superclass.onHide.apply(this, arguments);
|
||||||
|
|
||||||
|
// Unregister the 'beforesave' event. This could be lingering when
|
||||||
|
// 'savesettings' was fired but it was cancelled by one of the
|
||||||
|
// event handlers.
|
||||||
|
var panel = this.get(0).passwdPanel;
|
||||||
|
this.mun(panel, 'beforesave', this.onBeforeSavePasswd, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler for the
|
||||||
|
* {@link Zarafa.settings.SettingsContextModel ContextModel}#{@link Zarafa.settings.SettingsContextModel#beforesavesettings beforesavesettings}
|
||||||
|
* event. It will reset the {@link #savingElCounter} and his will register the event handler for
|
||||||
|
* {@link Zarafa.settings.SettingsModel#beforesave beforesave} event.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
onBeforeSaveSettingsModel : function()
|
||||||
|
{
|
||||||
|
Zarafa.common.settings.SettingsRuleCategory.superclass.onBeforeSaveSettingsModel.apply(this, arguments);
|
||||||
|
|
||||||
|
var panel = this.get(0).passwdPanel;
|
||||||
|
this.mon(panel, 'beforesave', this.onBeforeSavePasswd, this, { single : true });
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler which is fired when the {@link Zarafa.plugins.passwd.settings.PasswdPanel Passwd Panel}
|
||||||
|
* fires the 'beforesave' event. This will {@link #displaySavingMask show a notification} and register the
|
||||||
|
* event handlers for the completion of the save.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
onBeforeSavePasswd : function()
|
||||||
|
{
|
||||||
|
this.displaySavingMask();
|
||||||
|
|
||||||
|
var panel = this.get(0).passwdPanel;
|
||||||
|
this.mon(panel, 'save', this.onPasswdSave, this);
|
||||||
|
this.mon(panel, 'exception', this.onPasswdException, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler which is fired when the {@link Zarafa.common.rules.data.RulesStore Rules Store}
|
||||||
|
* fires the 'save' event indicating the successfull save of the rules. This will
|
||||||
|
* {@link #hideSavingMask hide the notification}.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
onPasswdSave : function()
|
||||||
|
{
|
||||||
|
this.hideSavingMask(true);
|
||||||
|
|
||||||
|
var panel = this.get(0).passwdPanel;
|
||||||
|
this.mun(panel, 'save', this.onPasswdSave, this);
|
||||||
|
this.mun(panel, 'exception', this.onPasswdException, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler which is fired when the {@link Zarafa.common.rules.data.RulesStore Rules Store}
|
||||||
|
* fires the 'exception' event indicating a failing save of the rules. This will
|
||||||
|
* {@link #hideSavingMask hide the notification}.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
onPasswdException : function()
|
||||||
|
{
|
||||||
|
this.hideSavingMask(false);
|
||||||
|
|
||||||
|
var panel = this.get(0).passwdPanel;
|
||||||
|
this.mun(panel, 'save', this.onPasswdSave, this);
|
||||||
|
this.mun(panel, 'exception', this.onPasswdException, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ Zarafa.plugins.passwd.settings.SettingsPasswdWidget = Ext.extend(Zarafa.settings
|
||||||
ref : 'passwdPanel',
|
ref : 'passwdPanel',
|
||||||
listeners : {
|
listeners : {
|
||||||
userchange : this.setModelDirty,
|
userchange : this.setModelDirty,
|
||||||
|
beforesave : this.onBeforeSave,
|
||||||
|
|
||||||
scope : this
|
scope : this
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
@ -63,7 +65,10 @@ Zarafa.plugins.passwd.settings.SettingsPasswdWidget = Ext.extend(Zarafa.settings
|
||||||
*/
|
*/
|
||||||
onSaveSettings : function()
|
onSaveSettings : function()
|
||||||
{
|
{
|
||||||
this.passwdPanel.saveChanges();
|
// only save when this category is visible on screen
|
||||||
|
if(this.ownerCt.isVisible()) {
|
||||||
|
this.passwdPanel.saveChanges();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue