tidy up listing of email templates
[Pman.Admin] / Pman.Tab.AdminEmailTemplates.bjs
1 {
2  "name" : "Pman.Tab.AdminEmailTemplates",
3  "parent" : "Pman.Tab.Admin",
4  "title" : "Manage Email Templates",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminEmailTemplates.bjs",
6  "permname" : "",
7  "modOrder" : "999",
8  "strings" : {
9   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
10   "c7d299bf3f9e37c77ab646f7e5366696" : "core_email",
11   "00d6e06d2f3c092b4f5e1e708a360b0f" : "Displaying Message{0} - {1} of {2}",
12   "9076cbba1d9ef79280b4f39e2aa0d115" : "Nothing found",
13   "b78a3223503896721cca1303f776159b" : "Title",
14   "68b00d723d37122f64da8d9939f836f0" : "BCC Group",
15   "9e11143e29a031212f2cdefcf61f39e9" : "View Message",
16   "f49559cda3fb906fbd7736f8b8a0e37d" : "Email Template",
17   "01bd6a16732dfa2b760dc8566c58afae" : "Download to Excel",
18   "4a4a8fe0c6dfb6bd2a41755d15eb6f0b" : "From Name",
19   "4ca679a383343ab3d4ca1cd7c91b43f7" : "From Email",
20   "5fb63579fc981698f97d55bfecb213ea" : "Copy",
21   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
22   "49ee3087348e8d44e1feda1917443987" : "Name"
23  },
24  "items" : [
25   {
26    "listeners" : {
27     "render" : "function (_self)\n{\n    _this.nest = this;\n}"
28    },
29    "region" : "center",
30    "title" : "Email Template",
31    "xtype" : "NestedLayoutPanel",
32    "$ xns" : "Roo",
33    "items" : [
34     {
35      "xtype" : "BorderLayout",
36      "$ xns" : "Roo",
37      "* prop" : "layout",
38      "items" : [
39       {
40        "autoScroll" : false,
41        "xtype" : "LayoutRegion",
42        "$ xns" : "Roo",
43        "split" : true,
44        "* prop" : "center"
45       },
46       {
47        "autoScroll" : false,
48        "xtype" : "LayoutRegion",
49        "$ xns" : "Roo",
50        "split" : true,
51        "height" : 300,
52        "* prop" : "south",
53        "titlebar" : true
54       },
55       {
56        "listeners" : {
57         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
58        },
59        "region" : "center",
60        "fitToframe" : true,
61        "background" : true,
62        "title" : "core_email",
63        "xtype" : "GridPanel",
64        "fitContainer" : true,
65        "$ xns" : "Roo",
66        "tableName" : "core_email",
67        "items" : [
68         {
69          "listeners" : {
70           "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) { \n        return;\n        }\n    var data = this.getDataSource().getAt(rowIndex).data;\n    _this.dialog.show( {id : data.id, module : 'core_email'} , function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
71           "|render" : "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.CoreEmail;\n    if (_this.panel.active) {\n       _this.grid.footer.onClick('first');\n    }\n}",
72           "rowclick" : "function (_self, rowIndex, e)\n{\n   // _this.grid.ds.load({});\n    _this.viewPanel.view.store.load({});\n}"
73          },
74          "autoExpandColumn" : "subject",
75          "xtype" : "Grid",
76          "loadMask" : true,
77          "$ xns" : "Roo.grid",
78          "* prop" : "grid",
79          "items" : [
80           {
81            "xtype" : "RowSelectionModel",
82            "singleSelect" : true,
83            "$ xns" : "Roo.grid",
84            "* prop" : "sm"
85           },
86           {
87            "listeners" : {
88             "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var s = _this.searchBox.getValue();\n    \n    if(s.length){\n        options.params['search[nameortitle]'] = s;\n    }\n\n}"
89            },
90            "xtype" : "Store",
91            "remoteSort" : true,
92            "$ sortInfo" : "{ field : 'description', direction: 'ASC' }",
93            "$ xns" : "Roo.data",
94            "* prop" : "dataSource",
95            "items" : [
96             {
97              "$ url" : "baseURL + '/Roo/Core_email.php'",
98              "method" : "GET",
99              "xtype" : "HttpProxy",
100              "$ xns" : "Roo.data",
101              "* prop" : "proxy"
102             },
103             {
104              "id" : "id",
105              "root" : "data",
106              "xtype" : "JsonReader",
107              "$ fields" : "[\n    {\n        \"name\":\"name\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"subject\",\n        \"type\":\"string\"\n    }\n]",
108              "$ xns" : "Roo.data",
109              "* prop" : "reader",
110              "totalProperty" : "total"
111             }
112            ]
113           },
114           {
115            "pageSize" : 25,
116            "xtype" : "PagingToolbar",
117            "emptyMsg" : "Nothing found",
118            "$ xns" : "Roo",
119            "displayMsg" : "Displaying Message{0} - {1} of {2}",
120            "displayInfo" : true,
121            "* prop" : "footer",
122            "items" : [
123             {
124              "listeners" : {
125               "|click" : "function()\n{\n   \nnew Pman.Download({\n    url : baseURL + '/Roo/Core_email',\n    method : 'GET',\n    params : {\n        csvCols : '*',\n        csvTitles : '*'\n    }\n});\nRoo.MessageBox.alert(\"Notice\", \"Should be downloading now\");\n  \n}\n"
126              },
127              "text" : "Download to Excel",
128              "xtype" : "Button",
129              "$ xns" : "Roo.Toolbar"
130             }
131            ]
132           },
133           {
134            "xtype" : "Toolbar",
135            "$ xns" : "Roo",
136            "* prop" : "toolbar",
137            "items" : [
138             {
139              "listeners" : {
140               "specialkey" : "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
141               "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
142              },
143              "xtype" : "TextField",
144              "$ xns" : "Roo.form"
145             },
146             {
147              "listeners" : {
148               "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
149              },
150              "xtype" : "Button",
151              "cls" : "x-btn-icon",
152              "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
153              "$ xns" : "Roo.Toolbar"
154             },
155             {
156              "listeners" : {
157               "click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\r\n    _this.grid.footer.onClick('first');\r\n}"
158              },
159              "xtype" : "Button",
160              "cls" : "x-btn-icon",
161              "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
162              "$ xns" : "Roo.Toolbar"
163             },
164             {
165              "xtype" : "Fill",
166              "$ xns" : "Roo.Toolbar"
167             },
168             {
169              "listeners" : {
170               "|click" : "function()\n{\n  var sel = _this.grid.selModel.getSelected();\n  if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a message to copy\");\n        return;\n    }\nnew Pman.Request({\n    url : baseURL + '/Roo/Core_email',\n    method : 'POST',\n    params : {\n        id : sel.data.id,\n        _make_copy : 1\n    },\n    success : function() {\n        _this.grid.footer.onClick('refresh');\n    }\n});\n  \n}\n"
171              },
172              "text" : "Copy",
173              "xtype" : "Button",
174              "cls" : "x-btn-text-icon",
175              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
176              "$ xns" : "Roo.Toolbar"
177             },
178             {
179              "listeners" : {
180               "|click" : "function()\n{\n    if (!_this.dialog) {\n         return;\n         }\n    _this.dialog.show( { id : 0, module : 'core_email' } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
181              },
182              "text" : "Add",
183              "xtype" : "Button",
184              "cls" : "x-btn-text-icon",
185              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
186              "$ xns" : "Roo.Toolbar"
187             },
188             {
189              "xtype" : "Separator",
190              "$ xns" : "Roo.Toolbar"
191             },
192             {
193              "listeners" : {
194               "|click" : "function()\n{\n    Pman.genericDelete(_this, 'core_email');\n    \n}\n"
195              },
196              "text" : "Delete",
197              "xtype" : "Button",
198              "cls" : "x-btn-text-icon",
199              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
200              "$ xns" : "Roo.Toolbar"
201             }
202            ]
203           },
204           {
205            "xtype" : "ColumnModel",
206            "header" : "Name",
207            "width" : 250,
208            "$ renderer" : "function(v,x,r) \n{ \n    if (r.data.description.length > 0) {\n        v = r.data.description;\n    }\n    \n    \n    if(r.data.active * 1 < 1){\n        return String.format('<s>{0}</s>', v ? v : ''); \n    }\n    \n    return String.format('{0}', v ? v : ''); \n}",
209            "$ xns" : "Roo.grid",
210            "Boolean sortable" : true,
211            "* prop" : "cm[]",
212            "dataIndex" : "name"
213           },
214           {
215            "xtype" : "ColumnModel",
216            "header" : "Title",
217            "width" : 300,
218            "$ renderer" : "function(v,x,r) \n{ \n    if(r.data.active * 1 < 1){\n        return String.format('<s>{0}</s>', v ? v : ''); \n    }\n    \n    return String.format('{0}', v ? v : ''); \n}",
219            "$ xns" : "Roo.grid",
220            "Boolean sortable" : true,
221            "* prop" : "cm[]",
222            "dataIndex" : "subject"
223           },
224           {
225            "xtype" : "ColumnModel",
226            "header" : "From Name",
227            "width" : 150,
228            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
229            "$ xns" : "Roo.grid",
230            "Boolean sortable" : true,
231            "* prop" : "cm[]",
232            "dataIndex" : "from_name"
233           },
234           {
235            "xtype" : "ColumnModel",
236            "width" : 150,
237            "header" : "From Email",
238            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
239            "$ xns" : "Roo.grid",
240            "Boolean sortable" : true,
241            "* prop" : "cm[]",
242            "dataIndex" : "from_email"
243           },
244           {
245            "xtype" : "ColumnModel",
246            "header" : "BCC Group",
247            "width" : 150,
248            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
249            "$ xns" : "Roo.grid",
250            "Boolean sortable" : true,
251            "* prop" : "cm[]",
252            "dataIndex" : "bcc_group_name"
253           }
254          ]
255         }
256        ]
257       },
258       {
259        "listeners" : {
260         "render" : "function (_self)\n{\n    _this.viewPanel = _self;\n}"
261        },
262        "autoScroll" : true,
263        "fitToFrame" : true,
264        "background" : false,
265        "region" : "south",
266        "title" : "View Message",
267        "xtype" : "ContentPanel",
268        "fitContainer" : true,
269        "$ xns" : "Roo",
270        "items" : [
271         {
272          "listeners" : {
273           "preparedata" : "function (_self, data, i, rec)\n{\n   // Roo.log(data);\n    //Roo.apply(data, rec.json);\n}"
274          },
275          "$ tpl" : "new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_mail.html'})",
276          "xtype" : "View",
277          "$ xns" : "Roo",
278          "* prop" : "view",
279          "items" : [
280           {
281            "listeners" : {
282             "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    var p = _this.grid.selModel.getSelected();\n    if (!p || !p.data.id) {\n        this.removeAll();\n        return false;\n    }\n   \n    options.params['id'] = p.data.id;\n \n}",
283             "load" : "function (_self, records, options)\n{\n    var p = _this.grid.selModel.getSelected();\n  //  Roo.log(p);\n    if (!p || !p.data.id) {\n        this.removeAll();\n        return false;\n    }\n  /*  \n    new Pman.Request({\n        url : baseURL + '/Roo/crm_action.php',\n        method : 'GET',\n        params : {\n            person_id : p.data.id,\n            sort : 'action_dt',\n            dir : 'DESC'\n        },\n        success : function(res) {\n            if(res.success){\n                var el = _this.cpanel.el.select('.crm-history-content').first();\n                _this.historyTemplate.overwrite(el, res);\n                el.select('.crm-history-log').on('click', Pman.Crm.auditToggle);\n                //Roo.log(res);\n            }\n        },\n        failure : function(e) {\n            //Roo.log(e);\n          _this.grid.ds.load({});\n        }\n        \n    });\n    */\n\n//_this.historyTemplate = new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_history.html'})\n\n/*\n  new pman request ([\n  \n  } successs(data)\n       el = _this.elemmnt.select('.services')\n       _this.serviceTemplate.overwite(el, data)\n  */\n}"
284            },
285            "xtype" : "Store",
286            "$ xns" : "Roo.data",
287            "* prop" : "store",
288            "items" : [
289             {
290              "$ url" : "baseURL+'/Roo/Core_email.php'",
291              "method" : "GET",
292              "xtype" : "HttpProxy",
293              "$ xns" : "Roo.data",
294              "* prop" : "proxy"
295             },
296             {
297              "id" : "id",
298              "root" : "data",
299              "xtype" : "JsonReader",
300              "$ xns" : "Roo.data",
301              "* prop" : "reader",
302              "totalProperty" : "total"
303             }
304            ]
305           }
306          ]
307         }
308        ]
309       }
310      ]
311     }
312    ]
313   }
314  ]
315 }