1
0
Fork 0
mirror of https://github.com/silentsakky/zarafa-webapp-passwd synced 2026-08-04 22:43:25 +02:00

added dialog for password change

implemented skeleton for php code
This commit is contained in:
Saket Patel 2013-07-03 03:30:43 +05:30
commit b434706684
7 changed files with 340 additions and 12 deletions

View file

@ -5,4 +5,4 @@ Ext.namespace('Zarafa.plugins.passwd');
*
* The copyright string holding the copyright notice for the Zarafa passwd Plugin.
*/
Zarafa.plugins.sugarcrm.ABOUT = "Something should be here";
Zarafa.plugins.passwd.ABOUT = "Something should be here";

34
js/PasswdContentPanel.js Normal file
View file

@ -0,0 +1,34 @@
Ext.namespace('Zarafa.plugins.passwd');
/**
* @class Zarafa.plugins.passwd.PasswdContentPanel
* @extends Zarafa.core.ui.ContentPanel
*
* Content panel that will layout the container
*/
Zarafa.plugins.passwd.PasswdContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
/**
* @constructor
* @param {Object} config configuration object that needs to be used when creating this dialog
*/
constructor : function(config)
{
config = config || {};
Ext.applyIf(config, {
xtype : 'zarafa.passwdcontentpanel',
layout : 'fit',
height : 175,
width : 400,
title : _('Change password'),
items : [{
xtype : 'zarafa.passwdpanel'
}]
});
Zarafa.plugins.passwd.PasswdContentPanel.superclass.constructor.apply(this, arguments);
}
});
Ext.reg('zarafa.passwdcontentpanel', Zarafa.plugins.passwd.PasswdContentPanel);

96
js/PasswdPanel.js Normal file
View file

@ -0,0 +1,96 @@
Ext.namespace('Zarafa.plugins.passwd');
/**
* @class Zarafa.plugins.passwd.PasswdPanel
* @extends Ext.form.FormPanel
*
* Panel which holds a form that will be used to change the password
*/
Zarafa.plugins.passwd.PasswdPanel = Ext.extend(Ext.form.FormPanel, {
/**
* @property
* @type Ext.LoadMask
*/
saveMask : undefined,
/**
* @constructor
* @param {Object} config configuration object that needs to be used when creating this dialog
*/
constructor : function(config)
{
config = config || {};
Ext.applyIf(config, {
xtype : 'zarafa.passwdpanel',
labelWidth : 150,
defaults : {
width : 200
},
items : [{
xtype : 'displayfield',
ref : 'userNameField',
fieldLabel : 'User name'
}, {
xtype : 'textfield',
ref : 'oldPasswdField',
fieldLabel : 'Current password',
inputType : 'password'
}, {
xtype : 'textfield',
ref : 'newPasswdField',
fieldLabel : 'New password',
inputType : 'password'
}, {
xtype : 'textfield',
ref : 'newPasswdRepeatField',
fieldLabel : 'Retype new password',
inputType : 'password'
}],
buttons : [{
text : 'Ok',
handler : this.onOk,
scope : this
}, {
text : 'Cancel',
handler : this.onCancel,
scope : this
}]
});
Zarafa.plugins.passwd.PasswdPanel.superclass.constructor.apply(this, arguments);
this.on('afterrender', this.initialize, this);
},
initialize : function()
{
this.userNameField.setValue(container.getUser().getUserName());
this.saveMask = new Ext.LoadMask(this.getEl(), {
msg : _('Saving please wait ...')
})
},
onOk : function()
{
// send request
this.saveMask.show();
container.getRequest().singleRequest('passwdmodule', 'save', {
username : this.userNameField.getValue(),
current_password : this.oldPasswdField.getValue(),
new_password : this.newPasswdField.getValue(),
new_password_repeat : this.newPasswdRepeatField.getValue()
//}, new Zarafa.plugins.sugarcrm.data.SugarCRMResponseHandler());
});
},
onCancel : function()
{
this.dialog.close();
}
});
Ext.reg('zarafa.passwdpanel', Zarafa.plugins.passwd.PasswdPanel);

View file

@ -19,6 +19,49 @@ Zarafa.plugins.passwd.PasswdPlugin = Ext.extend(Zarafa.core.Plugin, {
Zarafa.plugins.passwd.PasswdPlugin.superclass.initPlugin.apply(this, arguments);
this.registerInsertionPoint('main.maintabbar.right', this.putTabbarButton, this);
// Register common specific dialog types
Zarafa.core.data.SharedComponentType.addProperty('plugins.passwd.passwdpanel');
},
/**
* 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.
* @return {Number} The bid for the shared component
*/
bidSharedComponent: function(type, record)
{
var bid = -1;
switch (type) {
// Bid for password dialog
case Zarafa.core.data.SharedComponentType['plugins.passwd.passwdpanel']:
bid = 1;
break;
}
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 {Ext.Component} Component
*/
getSharedComponent: function(type, record)
{
var component;
switch (type) {
case Zarafa.core.data.SharedComponentType['plugins.passwd.passwdpanel']:
component = Zarafa.plugins.passwd.PasswdContentPanel;
break;
}
return component;
},
/**
@ -42,7 +85,10 @@ Zarafa.plugins.passwd.PasswdPlugin = Ext.extend(Zarafa.core.Plugin, {
*/
clickPasswdButton : function()
{
// open a dialog
var componentType = Zarafa.core.data.SharedComponentType['plugins.passwd.passwdpanel'];
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, {
modal : true
});
}
});