X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Dialog.PersonEditor.js;h=8349841b7c5528ae6fd4bd9a25791b9f7a5b4a65;hp=9f73756def461a880d0b5e0b0dbf84f34f262410;hb=HEAD;hpb=d2a6a425610710398f56710bb5eec61600e1089e diff --git a/Pman.Dialog.PersonEditor.js b/Pman.Dialog.PersonEditor.js index 9f73756d..8349841b 100644 --- a/Pman.Dialog.PersonEditor.js +++ b/Pman.Dialog.PersonEditor.js @@ -31,7 +31,7 @@ Pman.Dialog.PersonEditor.prototype = { return; } var _this = this; - this.dialog = new Ext.LayoutDialog(Ext.get(document.body).createChild({tag:'div'}), + this.dialog = new Roo.LayoutDialog(Roo.get(document.body).createChild({tag:'div'}), Roo.apply({ autoCreated: true, title: 'Edit Contact Details', @@ -69,7 +69,7 @@ Pman.Dialog.PersonEditor.prototype = { this.layout.beginUpdate(); - this.form = new Ext.form.Form({ + this.form = new Roo.form.Form({ labelWidth: 120, listeners : { actionfailed : function(f, act) { @@ -81,8 +81,8 @@ Pman.Dialog.PersonEditor.prototype = { actioncomplete: function(f, act) { _this.dialog.el.unmask(); if (act.type == 'load') { + _this.data = act.result.data; - } @@ -90,6 +90,9 @@ Pman.Dialog.PersonEditor.prototype = { var data = _this.data; // we dont have a form where company name is sent in - and is editable.. //this.form.findField('office_id') + if(!data.countries && _this.form.findField('countries')){ + _this.form.findField('countries').setValue();// set empty array by default... + } if (_this.form.findField('company_id') && _this.form.findField('company_id').setFromData) { _this.form.findField('company_id').setFromData( data.company_id ? { @@ -140,6 +143,8 @@ Pman.Dialog.PersonEditor.prototype = { } } + + return; } @@ -167,10 +172,16 @@ Pman.Dialog.PersonEditor.prototype = { this.loadItemTypes(); Roo.each(this.itemList, function(il) { if (typeof(il) != 'object') { + // no permission for Core offices.. - can not show department... + if (il == 'office_id_name' && !Pman.hasPerm('Core.Offices','S')) { + return true; + } + _this.form.addxtype(_this.itemTypes[il]); return true; } _this.form.addxtype(Roo.apply(il, _this.itemTypes[il.name])); + return true; }); var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'}); @@ -178,7 +189,7 @@ Pman.Dialog.PersonEditor.prototype = { this.form.render(ef.dom); - var vp = this.dialog.getLayout().add('center', new Ext.ContentPanel(ef, { + var vp = this.dialog.getLayout().add('center', new Roo.ContentPanel(ef, { autoCreate : true, //title: 'Org Details', //toolbar: this.tb, @@ -224,10 +235,10 @@ Pman.Dialog.PersonEditor.prototype = { // load using HTTP proxy:{ xtype: 'HttpProxy', - url: baseURL + '/Roo/Companies.html', + url: baseURL + '/Roo/core_company', method: 'GET' }, - reader: Pman.Readers.Companies, + reader: new Roo.data.JsonReader({}, []), //Pman.Readers.Companies, listeners : { beforeload : function(st,o) { @@ -248,12 +259,12 @@ Pman.Dialog.PersonEditor.prototype = { forceSelection: true, //mode: 'local', triggerAction: 'all', - tpl: new Ext.Template( + tpl: new Roo.Template( '
', '{name} {address}', '
' ), - queryParam: 'query[name]', + queryParam: 'search[name_starts]', loadingText: "Searching...", listWidth: 400, @@ -297,10 +308,10 @@ Pman.Dialog.PersonEditor.prototype = { // load using HTTP proxy: { xtype : 'HttpProxy', - url: baseURL + '/Roo/Office.html', + url: baseURL + '/Roo/Core_office.html', method: 'GET' }, - reader: Pman.Readers.Office, + reader: new Roo.data.JsonReader({}, []), //Pman.Readers.Office, listeners : { beforeload : function(st,o) { @@ -326,7 +337,7 @@ Pman.Dialog.PersonEditor.prototype = { if (_this.type == 'new') { data = _this.form.findField('company_id').lastData; if (!data.id ) { - Ext.MessageBox.alert("Error", "Select An Company First"); + Roo.MessageBox.alert("Error", "Select An Company First"); return false } @@ -361,7 +372,7 @@ Pman.Dialog.PersonEditor.prototype = { beforequery : function (qe) { var coid = _this.form.findField('company_id').getValue(); if (coid < 1 ) { - Ext.MessageBox.alert("Error", "Select An Company First"); + Roo.MessageBox.alert("Error", "Select An Company First"); return false; } } @@ -373,7 +384,7 @@ Pman.Dialog.PersonEditor.prototype = { forceSelection: true, //mode: 'local', triggerAction: 'all', - tpl: new Ext.Template( + tpl: new Roo.Template( '
', '{name} {address}', '
' @@ -455,73 +466,34 @@ Pman.Dialog.PersonEditor.prototype = { xtype : 'TextField', width : 300 }, - country : { + countries : { xtype: 'ComboBoxArray', xns: Roo.form, - fieldLabel : 'Journalist', - hiddenName : 'country_id', - name : 'country', + fieldLabel : 'Country', + hiddenName : 'countries', + name : 'countries_name', width : 300, combo : { xtype: 'ComboBox', xns: Roo.form, - listeners : { - add : function (combo) - { - Pman.Dialog.ClippingJournalist.show({ - id:0, - _clipping_id : _this.form.findField('id').getValue(), - publication : _this.data.media_name, - country : _this.data.country, - campaign_id : _this.data.project_id, - campaign_name : _this.data.project_id_name - - }); - } - }, allowBlank : true, alwaysQuery : true, - displayField : 'name', + displayField : 'title', editable : false, - emptyText : "Select News", - fieldLabel : 'Journalist', + emptyText : "Select Country", forceSelection : true, idField : 'id', - loadingText : "Searching...", - minChars : 2, - pageSize : 20, - tpl : '
{name}, {publication}, {country_tr}
', triggerAction : 'all', typeAhead : true, - valueField : 'id', - width : 480, + valueField : 'code', + width : 280, store : { - xtype: 'Store', + xtype: 'SimpleStore', xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - o.params.campaign_id = _this.data.project_id; - } - }, - isLocal : false, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/Clipping_journalist.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [ - {"name":"id","type":"int"}, - {"name":"name","type":"string"} - ] - } + data : (function() { + return Pman.I18n.simpleStoreData('c'); + })(), + fields : [ 'code', 'title' ] } } }, @@ -545,6 +517,25 @@ Pman.Dialog.PersonEditor.prototype = { xtype : 'TextField', width : 220 }, + secure_password : { + name : 'secure_password', + fieldLabel : "Secure passwords", + inputValue : 1, + valueOff : 0, + checked : true, + xtype : 'Checkbox', + xns : Roo.form, + width : 220, + listeners : { + check : function (_self, checked) { + this.form.findField('passwd1').insecure = false; + + if(!checked){ + this.form.findField('passwd1').insecure = true; + } + } + } + }, project_id_fs : { xtype : 'FieldSetEx', name: 'project_id_fs', @@ -570,7 +561,7 @@ Pman.Dialog.PersonEditor.prototype = { width: 50, - store: new Ext.data.SimpleStore({ + store: new Roo.data.SimpleStore({ // load using HTTP fields: [ 'code', 'desc' ], data: [[ 'ACTION_REQUIRED', "Yes"] , [ 'NOTIFY', "No"] ] @@ -622,7 +613,7 @@ Pman.Dialog.PersonEditor.prototype = { } if (this.form.findField('company_id') && !this.form.findField('company_id').getValue()) { - Ext.MessageBox.alert("Error", "Select a Company"); + Roo.MessageBox.alert("Error", "Select a Company"); return; } @@ -632,19 +623,19 @@ Pman.Dialog.PersonEditor.prototype = { var p2 = this.form.findField('passwd2').getValue(); if (this.sendAfterSave && !p1.length) { - Ext.MessageBox.alert("Error", "You must create a password to send introduction mail"); + Roo.MessageBox.alert("Error", "You must create a password to send introduction mail"); return; } if (Pman.Login.authUser.id < 0 && !p1.length) { - Ext.MessageBox.alert("Error", "You must create a password for the admin account"); + Roo.MessageBox.alert("Error", "You must create a password for the admin account"); return; } if (p1.length || p2.length) { if (p1 != p2) { - Ext.MessageBox.alert("Error", "Passwords do not match"); + Roo.MessageBox.alert("Error", "Passwords do not match"); return; } } @@ -662,7 +653,7 @@ Pman.Dialog.PersonEditor.prototype = { } this.dialog.el.mask("Sending"); this.form.doAction('submit', { - url: baseURL + '/Roo/Person.html', + url: baseURL + '/Roo/core_person', method: 'POST', params: { _id: this._id , @@ -685,7 +676,7 @@ Pman.Dialog.PersonEditor.prototype = { this.dialog.show(); this.dialog.el.mask("Loading"); this.form.doAction('load', { - url: baseURL + '/Roo/Person.html', + url: baseURL + '/Roo/core_person', method: 'GET', params: { _id: this._id ,