Fix #6685 - more changes as per inspection master xls
[Pman.Admin] / Pman.Dialog.AdminPerson.bjs
1 {
2  "name" : "Pman.Dialog.AdminPerson",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminPerson.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
10   "7573b7fd7836c9118dbfb69f3abf3858" : "Change / Set Password",
11   "abb1d799e06329cb0c38276ea918300b" : "Secure passwords",
12   "2b0d7f748b64304e6657207cb03cd8f2" : "Edit / Create Staff Details",
13   "7e17f8478e121357b78646ca5b5d5ac9" : "Displaying Settings  {0} - {1} of {2}",
14   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
15   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
16   "3544848f820b9d94a3f3871a382cf138" : "New password",
17   "689202409e48743b914713f96d93947c" : "Value",
18   "8a25a3ae30ab6e8ceb5b8c4009a3336f" : "Role / Position",
19   "be5f40c0d2692cf4e9f8be8d389737a5" : "Department / Office",
20   "315fce99b77b7f392bf68d5eb14f88c7" : "Password (type again to confirm)",
21   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
22   "e4709a73a287a5f033f5b1b5142cb74d" : "System Settings",
23   "49ee3087348e8d44e1feda1917443987" : "Name",
24   "a5da1d5de4f3a80e2acf5227283c630d" : "Staff Details",
25   "c373dd4bd4ba0b5d3e0c7522c5629880" : "Select Office",
26   "662de0725ac8055bff7edae51fbf3c78" : "No Settings Found",
27   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
28   "e55f75a29310d7b60f7ac1d390c8ae42" : "Module",
29   "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
30   "c9cc8cce247e49bae79f15173ce97354" : "Save"
31  },
32  "named_strings" : {
33   "secure_password_fieldLabel" : "abb1d799e06329cb0c38276ea918300b",
34   "role_fieldLabel" : "8a25a3ae30ab6e8ceb5b8c4009a3336f",
35   "name_fieldLabel" : "49ee3087348e8d44e1feda1917443987",
36   "office_id_name_emptyText" : "be5f40c0d2692cf4e9f8be8d389737a5",
37   "phone_fieldLabel" : "bcc254b55c4a1babdf1dcb82c207506b",
38   "passwd1_fieldLabel" : "315fce99b77b7f392bf68d5eb14f88c7",
39   "office_id_name_fieldLabel" : "be5f40c0d2692cf4e9f8be8d389737a5",
40   "office_id_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
41   "email_fieldLabel" : "ce8ae9da5b7cd6c3df2929543a9af92d",
42   "office_id_name_qtip" : "c373dd4bd4ba0b5d3e0c7522c5629880"
43  },
44  "items" : [
45   {
46    "Boolean modal" : true,
47    "collapsible" : false,
48    "title" : "Edit / Create Staff Details",
49    "xtype" : "LayoutDialog",
50    "width" : 450,
51    "$ xns" : "Roo",
52    "closable" : false,
53    "resizable" : false,
54    "height" : 400,
55    "items" : [
56     {
57      "xtype" : "LayoutRegion",
58      "$ xns" : "Roo",
59      "* prop" : "center"
60     },
61     {
62      "region" : "center",
63      "xtype" : "ContentPanel",
64      "$ xns" : "Roo",
65      "String title" : "Staff Details",
66      "items" : [
67       {
68        "listeners" : {
69         "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        _this.dialog.layout.getRegion('center').showPanel(0);\n       //_this.dialog.el.mask(\"Loading\");\n       if ( _this.data.id* 1 > 0) { \n            this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n            return;\n        }\n        this.form.findField('company_id').setValue(Pman.Login.authUser.company_id);\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
70         "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
71        },
72        "$ url" : "baseURL + '/Roo/core_person'",
73        "xtype" : "Form",
74        "method" : "POST",
75        "style" : "margin:10px;",
76        "$ xns" : "Roo.form",
77        "Number labelWidth" : 120,
78        "items" : [
79         {
80          "fieldLabel" : "Name",
81          "xtype" : "TextField",
82          "allowBlank" : true,
83          "width" : 250,
84          "$ xns" : "Roo.form",
85          "name" : "name"
86         },
87         {
88          "fieldLabel" : "Email",
89          "xtype" : "TextField",
90          "allowBlank" : false,
91          "width" : 250,
92          "$ xns" : "Roo.form",
93          "name" : "email"
94         },
95         {
96          "fieldLabel" : "Role / Position",
97          "xtype" : "TextField",
98          "width" : 250,
99          "$ xns" : "Roo.form",
100          "name" : "role"
101         },
102         {
103          "fieldLabel" : "Phone",
104          "xtype" : "TextField",
105          "width" : 150,
106          "$ xns" : "Roo.form",
107          "name" : "phone"
108         },
109         {
110          "xtype" : "Hidden",
111          "$ xns" : "Roo.form",
112          "name" : "company_id"
113         },
114         {
115          "listeners" : {
116           "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n        var coid = _this.form.findField('company_id').getValue();\n        if (coid < 1 ) {\n            Ext.MessageBox.alert(\"Error\", \"Select An Company First\");\n            return false;\n        }\n}"
117          },
118          "listWidth" : 400,
119          "triggerAction" : "all",
120          "fieldLabel" : "Department / Office",
121          "forceSelection" : true,
122          "selectOnFocus" : true,
123          "pageSize" : 20,
124          "displayField" : "name",
125          "emptyText" : "Department / Office",
126          "hiddenName" : "office_id",
127          "minChars" : 2,
128          "valueField" : "id",
129          "xtype" : "ComboBox",
130          "allowBlank" : true,
131          "typeAhead" : true,
132          "editable" : false,
133          "width" : 250,
134          "$ xns" : "Roo.form",
135          "name" : "office_id_name",
136          "qtip" : "Select Office",
137          "queryParam" : "query[name]",
138          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
139          "loadingText" : "Searching...",
140          "items" : [
141           {
142            "listeners" : {
143             "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    var coid = _this.form.findField('company_id').getValue();\n    o.params.company_id = coid;\n}\n"
144            },
145            "xtype" : "Store",
146            "remoteSort" : true,
147            "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
148            "$ xns" : "Roo.data",
149            "* prop" : "store",
150            "items" : [
151             {
152              "$ url" : "baseURL + '/Roo/core_office'",
153              "xtype" : "HttpProxy",
154              "method" : "GET",
155              "$ xns" : "Roo.data",
156              "* prop" : "proxy"
157             },
158             {
159              "id" : "id",
160              "root" : "data",
161              "xtype" : "JsonReader",
162              "$ xns" : "Roo.data",
163              "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
164              "* prop" : "reader",
165              "totalProperty" : "total"
166             }
167            ]
168           }
169          ]
170         },
171         {
172          "xtype" : "Hidden",
173          "$ xns" : "Roo.form",
174          "name" : "id"
175         },
176         {
177          "xtype" : "FieldSet",
178          "$ xns" : "Roo.form",
179          "String legend" : "Change / Set Password",
180          "String/Object/Function style" : "width:370px",
181          "Number labelWidth" : 200,
182          "items" : [
183           {
184            "fieldLabel" : "New password",
185            "xtype" : "SecurePass",
186            "string inputType" : "password",
187            "width" : 150,
188            "$ xns" : "Roo.form",
189            "name" : "passwd1"
190           },
191           {
192            "fieldLabel" : "Password (type again to confirm)",
193            "xtype" : "TextField",
194            "allowBlank" : true,
195            "String inputType" : "password",
196            "width" : 150,
197            "$ xns" : "Roo.form",
198            "name" : "passwd1"
199           },
200           {
201            "listeners" : {
202             "check" : "function (_self, checked)\n{\n    this.form.findField('passwd1').insecure = false;\n        \n    if(!checked){\n        this.form.findField('passwd1').insecure = true;\n    }\n}"
203            },
204            "String name" : "secure_password",
205            "Boolean checked" : true,
206            "xtype" : "Checkbox",
207            "String valueOff" : 0,
208            "$ xns" : "Roo.form",
209            "String fieldLabel" : "Secure passwords",
210            "String inputValue" : 1
211           }
212          ]
213         }
214        ]
215       }
216      ]
217     },
218     {
219      "listeners" : {
220       "|activate" : "function() {\n    _this.panel = this;\n \n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
221      },
222      "region" : "center",
223      "fitToframe" : true,
224      "background" : true,
225      "title" : "System Settings",
226      "xtype" : "GridPanel",
227      "fitContainer" : true,
228      "$ xns" : "Roo",
229      "items" : [
230       {
231        "listeners" : {
232         "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) {\n         return;\n     }\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n}\n",
233         "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
234        },
235        "autoExpandColumn" : "data",
236        "xtype" : "Grid",
237        "loadMask" : true,
238        "$ xns" : "Roo.grid",
239        "* prop" : "grid",
240        "items" : [
241         {
242          "listeners" : {
243           "beforeload" : "function (_self, o)\n{\n  \n    o.params = o.params ? o.params : {};\n    o.params.person_id =  _this.form.findField('id').getValue();\n    \n   \n}"
244          },
245          "xtype" : "Store",
246          "remoteSort" : true,
247          "$ sortInfo" : "{ field : 'name', direction: 'ASC' }",
248          "$ xns" : "Roo.data",
249          "* prop" : "dataSource",
250          "items" : [
251           {
252            "$ url" : "baseURL + '/Roo/core_person_settings'",
253            "method" : "GET",
254            "xtype" : "HttpProxy",
255            "$ xns" : "Roo.data",
256            "* prop" : "proxy"
257           },
258           {
259            "id" : "id",
260            "root" : "data",
261            "xtype" : "JsonReader",
262            "$ xns" : "Roo.data",
263            "* prop" : "reader",
264            "totalProperty" : "total"
265           }
266          ]
267         },
268         {
269          "pageSize" : 25,
270          "xtype" : "PagingToolbar",
271          "emptyMsg" : "No Settings Found",
272          "$ xns" : "Roo",
273          "displayMsg" : "Displaying Settings  {0} - {1} of {2}",
274          "displayInfo" : true,
275          "* prop" : "footer"
276         },
277         {
278          "xtype" : "Toolbar",
279          "$ xns" : "Roo",
280          "* prop" : "toolbar",
281          "items" : [
282           {
283            "xtype" : "Fill",
284            "$ xns" : "Roo.Toolbar"
285           },
286           {
287            "listeners" : {
288             "|click" : "function()\n{\n     Pman.genericDelete(_this, 'core_person_settings'); \n}\n        "
289            },
290            "text" : "Delete",
291            "xtype" : "Button",
292            "cls" : "x-btn-text-icon",
293            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
294            "$ xns" : "Roo.Toolbar"
295           }
296          ]
297         },
298         {
299          "xtype" : "ColumnModel",
300          "sortable" : true,
301          "header" : "Module",
302          "width" : 120,
303          "$ xns" : "Roo.grid",
304          "* prop" : "colModel[]",
305          "dataIndex" : "scope"
306         },
307         {
308          "xtype" : "ColumnModel",
309          "sortable" : true,
310          "header" : "Description",
311          "width" : 150,
312          "$ renderer" : "function(v) { return String.format('{0}', v); }",
313          "$ xns" : "Roo.grid",
314          "* prop" : "colModel[]",
315          "dataIndex" : "description"
316         },
317         {
318          "xtype" : "ColumnModel",
319          "sortable" : true,
320          "header" : "Value",
321          "width" : 200,
322          "$ renderer" : "function(v) { return String.format('{0}', v); }",
323          "$ xns" : "Roo.grid",
324          "* prop" : "colModel[]",
325          "dataIndex" : "data"
326         },
327         {
328          "listeners" : {
329           "afterselectionchange" : "function (_self)\n{\n    // load project members.\n}"
330          },
331          "xtype" : "RowSelectionModel",
332          "singleSelect" : true,
333          "$ xns" : "Roo.grid",
334          "* prop" : "sm"
335         }
336        ]
337       }
338      ]
339     },
340     {
341      "listeners" : {
342       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
343      },
344      "text" : "Cancel",
345      "xtype" : "Button",
346      "$ xns" : "Roo",
347      "* prop" : "buttons[]"
348     },
349     {
350      "listeners" : {
351       "click" : "function (_self, e)\n{\n    // do some checks?\n     if (this.form.findField('passwd1')) {\n        \n        var p1 = this.form.findField('passwd1').getValue();\n        var p2 = this.form.findField('passwd2').getValue();\n        \n        if (this.sendAfterSave && !p1.length) {\n            Ext.MessageBox.alert(\"Error\", \"You must create a password to send introduction mail\");\n            return;\n        }\n        \n        if (Pman.Login.authUser.id < 0 && !p1.length) {\n            Ext.MessageBox.alert(\"Error\", \"You must create a password for the admin account\");\n            return;\n        }\n        \n        \n        if (p1.length || p2.length) {\n            if (p1 != p2) {\n                Ext.MessageBox.alert(\"Error\", \"Passwords do not match\");\n                return;\n            }\n        }\n        \n    \n    }\n    \n \n    _this.form.doAction(\"submit\");\n\n}"
352      },
353      "text" : "Save",
354      "xtype" : "Button",
355      "$ xns" : "Roo",
356      "* prop" : "buttons[]"
357     }
358    ]
359   }
360  ]
361 }