diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index fbe416470..b201f758b 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -401,447 +401,225 @@ Ext.onReady(function () { mode : 'local' }); - if (MODE == "edit") { - var informationFields = new Ext.form.FieldSet({ - title : _('ID_PERSONAL_INFORMATION'), - items : [ - { - id : 'USR_FIRSTNAME', - fieldLabel : _('ID_FIRSTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_LASTNAME', - fieldLabel : _('ID_LASTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_USERNAME', - fieldLabel : _('ID_USER_ID'), - xtype : 'textfield', - width : 260, - allowBlank : false, - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, - listeners: { - blur : function(ob) - { - // trim - this.value = this.getValue().replace(/^\s+|\s+$/g,""); - document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); - - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); - - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); - - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); - - usernameText = this.getValue(); - - validateUserName(); - - Ext.getCmp('usernameReview').setVisible(true); - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'usernameReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_EMAIL', - fieldLabel : _('ID_EMAIL'), - vtype : 'email', - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - xtype : 'textarea', - name : 'USR_ADDRESS', - fieldLabel : _('ID_ADDRESS'), - labelSeparator : '', - height : 50, - width : 260 - }, - { - id : 'USR_ZIP_CODE', - fieldLabel : _('ID_ZIP_CODE'), - xtype : 'textfield', - width : 260 - }, - comboCountry, - comboRegion, - comboLocation, - { - id : 'USR_PHONE', - fieldLabel : _('ID_PHONE'), - xtype : 'textfield', - width : 260 - }, - { - id : 'USR_POSITION', - fieldLabel : _('ID_POSITION'), - xtype : 'textfield', - width : 260 - }, - comboReplacedBy, - dateField, - comboCalendar, - comboStatus, - comboRole - ] - }); - - var passwordFields = new Ext.form.FieldSet({ - title : _('ID_CHANGE_PASSWORD'), - items : [ - { - xtype : "textfield", - id : "currentPassword", - name : "currentPassword", - fieldLabel : _("ID_PASSWORD_CURRENT"), - inputType : "password", - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? false : true, - width : 260 - }, - { - id : 'USR_NEW_PASS', - fieldLabel : _('ID_NEW_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_PASSWORD_TESTING'); - - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); - - var passwordText = this.getValue(); - - Ext.Ajax.request({ - url : 'usersAjax', - method:'POST', - params : { - 'action' : 'testPassword', - 'PASSWORD_TEXT' : passwordText - }, - success: function(r,o){ - var resp = Ext.util.JSON.decode(r.responseText); - - if (resp.STATUS) { - flagPoliciesPassword = true; - } else { - flagPoliciesPassword = false; - } - - Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); - }, - failure: function () { - Ext.MessageBox.show({ - title: _('ID_ERROR'), - msg: _('ID_FAILED_STORE_DATA'), - buttons: Ext.MessageBox.OK, - animEl: 'mb9', - icon: Ext.MessageBox.ERROR - }); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); - } - }); - - Ext.getCmp('passwordReview').setVisible(true); - - if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { - userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); - } - - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_CNF_PASS', - fieldLabel : _('ID_CONFIRM_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - var passwordText = Ext.getCmp('USR_NEW_PASS').getValue(); - var passwordConfirm = this.getValue(); - - if (passwordText != passwordConfirm) { - var spanErrorConfirm = ''; - var imageErrorConfirm = ''; - var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS'); - - Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '', false); - Ext.getCmp('passwordConfirm').setVisible(true); - } else { - Ext.getCmp('passwordConfirm').setVisible(false); - } - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordConfirm', - width: 300, - labelSeparator: '' - } - - ] - }); - }else{ - var informationFields = new Ext.form.FieldSet({ - title : _('ID_PERSONAL_INFORMATION'), - items : [ + var informationFields = new Ext.form.FieldSet({ + title : _('ID_PERSONAL_INFORMATION'), + items : [ + { + id : 'USR_FIRSTNAME', + fieldLabel : MODE == 'edit' ? _('ID_FIRSTNAME') : ' * ' + _('ID_FIRSTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_LASTNAME', + fieldLabel : MODE == 'edit' ? _('ID_LASTNAME') : ' * ' + _('ID_LASTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_USERNAME', + fieldLabel : MODE == 'edit' ? _('ID_USER_ID') : ' * ' + _('ID_USER_ID'), + xtype : 'textfield', + width : 260, + allowBlank : false, + hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, + listeners: { + blur : function(ob) { - id : 'USR_FIRSTNAME', - fieldLabel : ' * ' + _('ID_FIRSTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_LASTNAME', - fieldLabel : ' * ' + _('ID_LASTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_USERNAME', - fieldLabel : ' * ' + _('ID_USER_ID'), - xtype : 'textfield', - width : 260, - allowBlank : false, - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, - listeners: { - blur : function(ob) - { - // trim - this.value = this.getValue().replace(/^\s+|\s+$/g,""); - document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); + // trim + this.value = this.getValue().replace(/^\s+|\s+$/g,""); + document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_USERNAME_TESTING'); - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); + Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('usernameReview').setVisible(true); - usernameText = this.getValue(); + usernameText = this.getValue(); - validateUserName(); + validateUserName(); - Ext.getCmp('usernameReview').setVisible(true); - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'usernameReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_EMAIL', - fieldLabel : ' * ' + _('ID_EMAIL'), - vtype : 'email', - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - xtype : 'textarea', - name : 'USR_ADDRESS', - fieldLabel : _('ID_ADDRESS'), - labelSeparator : '', - height : 50, - width : 260 - }, - { - id : 'USR_ZIP_CODE', - fieldLabel : _('ID_ZIP_CODE'), - xtype : 'textfield', - width : 260 - }, - comboCountry, - comboRegion, - comboLocation, - { - id : 'USR_PHONE', - fieldLabel : _('ID_PHONE'), - xtype : 'textfield', - width : 260 - }, - { - id : 'USR_POSITION', - fieldLabel : _('ID_POSITION'), - xtype : 'textfield', - width : 260 - }, - comboReplacedBy, - dateField, - comboCalendar, - comboStatus, - comboRole - ] - }); - - var passwordFields = new Ext.form.FieldSet({ - title : _('ID_CHANGE_PASSWORD'), - items : [ - { - xtype : "textfield", - id : "currentPassword", - name : "currentPassword", - fieldLabel : _("ID_PASSWORD_CURRENT"), - inputType : "password", - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? false : true, - width : 260 - }, - { - id : 'USR_NEW_PASS', - fieldLabel : ' * ' + _('ID_NEW_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_PASSWORD_TESTING'); - - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); - - var passwordText = this.getValue(); - - Ext.Ajax.request({ - url : 'usersAjax', - method:'POST', - params : { - 'action' : 'testPassword', - 'PASSWORD_TEXT' : passwordText - }, - success: function(r,o){ - var resp = Ext.util.JSON.decode(r.responseText); - - if (resp.STATUS) { - flagPoliciesPassword = true; - } else { - flagPoliciesPassword = false; - } - - Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); - }, - failure: function () { - Ext.MessageBox.show({ - title: _('ID_ERROR'), - msg: _('ID_FAILED_STORE_DATA'), - buttons: Ext.MessageBox.OK, - animEl: 'mb9', - icon: Ext.MessageBox.ERROR - }); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); - } - }); - - Ext.getCmp('passwordReview').setVisible(true); - - if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { - userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); - } - - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_CNF_PASS', - fieldLabel : ' * ' + _('ID_CONFIRM_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - var passwordText = Ext.getCmp('USR_NEW_PASS').getValue(); - var passwordConfirm = this.getValue(); - - if (passwordText != passwordConfirm) { - var spanErrorConfirm = ''; - var imageErrorConfirm = ''; - var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS'); - - Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '', false); - Ext.getCmp('passwordConfirm').setVisible(true); - } else { - Ext.getCmp('passwordConfirm').setVisible(false); - } - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordConfirm', - width: 300, - labelSeparator: '' + Ext.getCmp('usernameReview').setVisible(true); } + } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'usernameReview', + width: 300, + labelSeparator: '' + }, + { + id : 'USR_EMAIL', + fieldLabel : MODE == 'edit' ? _('ID_EMAIL') : ' * ' + _('ID_EMAIL'), + vtype : 'email', + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + xtype : 'textarea', + name : 'USR_ADDRESS', + fieldLabel : _('ID_ADDRESS'), + labelSeparator : '', + height : 50, + width : 260 + }, + { + id : 'USR_ZIP_CODE', + fieldLabel : _('ID_ZIP_CODE'), + xtype : 'textfield', + width : 260 + }, + comboCountry, + comboRegion, + comboLocation, + { + id : 'USR_PHONE', + fieldLabel : _('ID_PHONE'), + xtype : 'textfield', + width : 260 + }, + { + id : 'USR_POSITION', + fieldLabel : _('ID_POSITION'), + xtype : 'textfield', + width : 260 + }, + comboReplacedBy, + dateField, + comboCalendar, + comboStatus, + comboRole + ] + }); - ] - }); - } + var passwordFields = new Ext.form.FieldSet({ + title : _('ID_CHANGE_PASSWORD'), + items : [ + { + xtype : "textfield", + id : "currentPassword", + name : "currentPassword", + fieldLabel : _("ID_PASSWORD_CURRENT"), + inputType : "password", + hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? false : true, + width : 260 + }, + { + id : 'USR_NEW_PASS', + fieldLabel : MODE == 'edit' ? _('ID_NEW_PASSWORD') : ' * ' + _('ID_NEW_PASSWORD'), + xtype : 'textfield', + inputType : 'password', + width : 260, + allowBlank : allowBlackStatus, + listeners: { + blur : function(ob) + { + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_PASSWORD_TESTING'); + + Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('passwordReview').setVisible(true); + + var passwordText = this.getValue(); + + Ext.Ajax.request({ + url : 'usersAjax', + method:'POST', + params : { + 'action' : 'testPassword', + 'PASSWORD_TEXT' : passwordText + }, + success: function(r,o){ + var resp = Ext.util.JSON.decode(r.responseText); + + if (resp.STATUS) { + flagPoliciesPassword = true; + } else { + flagPoliciesPassword = false; + } + + Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); + Ext.getCmp('saveB').enable(); + Ext.getCmp('cancelB').enable(); + }, + failure: function () { + Ext.MessageBox.show({ + title: _('ID_ERROR'), + msg: _('ID_FAILED_STORE_DATA'), + buttons: Ext.MessageBox.OK, + animEl: 'mb9', + icon: Ext.MessageBox.ERROR + }); + Ext.getCmp('saveB').enable(); + Ext.getCmp('cancelB').enable(); + } + }); + + Ext.getCmp('passwordReview').setVisible(true); + + if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { + userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); + } + + } + } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'passwordReview', + width: 300, + labelSeparator: '' + }, + { + id : 'USR_CNF_PASS', + fieldLabel : MODE == 'edit' ? _('ID_CONFIRM_PASSWORD') : ' * ' + _('ID_CONFIRM_PASSWORD'), + xtype : 'textfield', + inputType : 'password', + width : 260, + allowBlank : allowBlackStatus, + listeners: { + blur : function(ob) + { + var passwordText = Ext.getCmp('USR_NEW_PASS').getValue(); + var passwordConfirm = this.getValue(); + + if (passwordText != passwordConfirm) { + var spanErrorConfirm = ''; + var imageErrorConfirm = ''; + var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS'); + + Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '', false); + Ext.getCmp('passwordConfirm').setVisible(true); + } else { + Ext.getCmp('passwordConfirm').setVisible(false); + } + } + } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'passwordConfirm', + width: 300, + labelSeparator: '' + } + + ] + }); var accountOptions = new Ext.form.FieldSet({ title: _('ID_ACCOUNT_OPTIONS'),