diff --git a/config.php b/config.php
index fae929e..b015301 100644
--- a/config.php
+++ b/config.php
@@ -1,4 +1,13 @@
\ No newline at end of file
diff --git a/js/ABOUT.js b/js/ABOUT.js
index c9da29e..b37c85b 100644
--- a/js/ABOUT.js
+++ b/js/ABOUT.js
@@ -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";
diff --git a/js/PasswdContentPanel.js b/js/PasswdContentPanel.js
new file mode 100644
index 0000000..a282132
--- /dev/null
+++ b/js/PasswdContentPanel.js
@@ -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);
\ No newline at end of file
diff --git a/js/PasswdPanel.js b/js/PasswdPanel.js
new file mode 100644
index 0000000..18bdeca
--- /dev/null
+++ b/js/PasswdPanel.js
@@ -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);
\ No newline at end of file
diff --git a/js/PasswdPlugin.js b/js/PasswdPlugin.js
index 9ff37b0..6aaec5c 100644
--- a/js/PasswdPlugin.js
+++ b/js/PasswdPlugin.js
@@ -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
+ });
}
});
diff --git a/manifest.xml b/manifest.xml
index 9c55014..c39dcd9 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -23,6 +23,8 @@
js/passwd.js
js/passwd-debug.js
js/PasswdPlugin.js
+ js/PasswdContentPanel.js
+ js/PasswdPanel.js
js/ABOUT.js