Pman.Tab.BAdminEmailTemplates.bjs
[Pman.BAdmin] / Pman.Tab.BAdminEmailTemplates.bjs
1 {
2  "name" : "Pman.Tab.BAdminEmailTemplates",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "Pman.Tab.BAdminEmailTemplates",
5  "path" : "/home/khlau/gitlive/Pman.BAdmin/Pman.Tab.BAdminEmailTemplates.bjs",
6  "permname" : "",
7  "modOrder" : "004",
8  "strings" : {
9   "cdb6b6bab1fd18b9dbfe3fb84a5d34ae" : "<i class=\"fa fa-search\"></i>",
10   "cae905999a2ad1dfb8f4eae0e8cda73b" : "From Name<br/>Email",
11   "98d2ee61ddce0c7666297d81639914f1" : "To / BCC Group",
12   "73ea6b4441cdced246d236b22c8f991c" : "HTML File",
13   "694e249c3a9503141fa5ce3fb71d5477" : "<i class=\"fa fa-edit\"></i> Edit",
14   "cffbd822c38679e2fbf11cc182c945e5" : "search for email template",
15   "b78a3223503896721cca1303f776159b" : "Title",
16   "68b00d723d37122f64da8d9939f836f0" : "BCC Group",
17   "9e11143e29a031212f2cdefcf61f39e9" : "View Message",
18   "f49559cda3fb906fbd7736f8b8a0e37d" : "Email Template",
19   "27a7146e1e1890e289bc7fad72876831" : "<i class=\"fa fa-plus\"></i> Create a template",
20   "cd6df251f262cc64514b25f04aecf3c8" : "<i class=\"fa fa-clipboard\"></i> Copy",
21   "ed807858fcb68abdd180481f1fcba5c5" : "<i class=\"fa fa-trash\"></i> Delete",
22   "03c2e7e41ffc181a4e84080b4710e81e" : "New",
23   "49ee3087348e8d44e1feda1917443987" : "Name",
24   "e6b391a8d2c4d45902a23a8b6585703d" : "URL"
25  },
26  "items" : [
27   {
28    "xtype" : "Nest",
29    "$ xns" : "Roo.bootstrap.panel",
30    "String title" : "Email Template",
31    "Boolean background" : true,
32    "items" : [
33     {
34      "xtype" : "Border",
35      "$ xns" : "Roo.bootstrap.layout",
36      "* prop" : "layout",
37      "items" : [
38       {
39        "String tabPosition" : "top",
40        "Boolean hideTabs" : true,
41        "xtype" : "Region",
42        "$ xns" : "Roo.bootstrap.layout",
43        "* prop" : "center"
44       },
45       {
46        "Boolean titlebar" : true,
47        "String tabPosition" : "top",
48        "xtype" : "Region",
49        "Boolean hideTabs" : true,
50        "Number height" : 200,
51        "$ xns" : "Roo.bootstrap.layout",
52        "Boolean autoScroll" : true,
53        "* prop" : "south",
54        "Boolean split" : true
55       },
56       {
57        "listeners" : {
58         "activate" : "function (_self)\n{\n    _this.edit_btn.hide();\n    _this.copy_btn.hide();\n    _this.delete_btn.hide();\n    \n    if (_this.table) {\n        _this.table.footer.onClick('first');\n    }\n    \n}",
59         "render" : "function (_self)\n{\n    _this.grid = this;\n}"
60        },
61        "Boolean fitContainer" : true,
62        "xtype" : "Grid",
63        "Boolean fitToFrame" : true,
64        "$ xns" : "Roo.bootstrap.panel",
65        "String region" : "center",
66        "Boolean background" : false,
67        "Boolean closable" : false,
68        "items" : [
69         {
70          "xtype" : "NavSimplebar",
71          "$ xns" : "Roo.bootstrap",
72          "* prop" : "toolbar",
73          "items" : [
74           {
75            "xtype" : "NavGroup",
76            "$ xns" : "Roo.bootstrap",
77            "items" : [
78             {
79              "xtype" : "NavItem",
80              "$ xns" : "Roo.bootstrap",
81              "items" : [
82               {
83                "xtype" : "Element",
84                "$ xns" : "Roo.bootstrap",
85                "items" : [
86                 {
87                  "String cls" : "roo-toolbar",
88                  "xtype" : "Row",
89                  "$ xns" : "Roo.bootstrap",
90                  "items" : [
91                   {
92                    "Number md" : 4,
93                    "xtype" : "Column",
94                    "$ xns" : "Roo.bootstrap",
95                    "items" : [
96                     {
97                      "listeners" : {
98                       "specialkey" : "function (_self, e)\n{\n    _this.table.footer.onClick('first');\n}",
99                       "render" : "function (_self)\n{\n    _this.searchBox = this;\n}"
100                      },
101                      "xtype" : "Input",
102                      "string placeholder" : "search for email template",
103                      "$ xns" : "Roo.bootstrap",
104                      "items" : [
105                       {
106                        "listeners" : {
107                         "click" : "function (_self, e)\n{\n    _this.table.footer.onClick('first');\n}"
108                        },
109                        "xtype" : "Button",
110                        "$ xns" : "Roo.bootstrap",
111                        "String html" : "<i class=\"fa fa-search\"></i>",
112                        "* prop" : "after"
113                       }
114                      ]
115                     }
116                    ]
117                   },
118                   {
119                    "Number md" : 8,
120                    "xtype" : "Column",
121                    "$ xns" : "Roo.bootstrap",
122                    "String style" : "text-align: right;",
123                    "items" : [
124                     {
125                      "String cls" : "roo-toolbar-button",
126                      "xtype" : "Button",
127                      "$ xns" : "Roo.bootstrap",
128                      "String html" : "<i class=\"fa fa-plus\"></i> Create a template",
129                      "items" : [
130                       {
131                        "xtype" : "Menu",
132                        "$ xns" : "Roo.bootstrap",
133                        "* prop" : "menu",
134                        "items" : [
135                         {
136                          "listeners" : {
137                           "click" : "function (_self, e)\n{\n    if (!_this.dialog) {\n        return;\n    }\n    \n    _this.dialog.show( { id : 0, module : 'core_email' } , function() {\n        _this.table.footer.onClick('first');\n   });\n}"
138                          },
139                          "xtype" : "MenuItem",
140                          "String fa" : "file-o",
141                          "$ xns" : "Roo.bootstrap",
142                          "String html" : "New"
143                         },
144                         {
145                          "listeners" : {
146                           "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminImportUrl.show(\n        {\n            target : '/Core/ImportMailMessage.php'\n        },\n    \n        function(data) {\n            if (data) {\n                Pman.Dialog.BAdminEmail.dialog.show();\n                Pman.Dialog.BAdminEmail.form.findField('bodytext').setValue(data);\n            }\n        }\n    );\n}"
147                          },
148                          "xtype" : "MenuItem",
149                          "String fa" : "link",
150                          "$ xns" : "Roo.bootstrap",
151                          "String html" : "URL"
152                         },
153                         {
154                          "listeners" : {
155                           "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminImage.show(\n        {\n            _url : '/Core/ImportMailMessage.php'\n        },\n    \n        function(data) {\n            if (data) {\n                Pman.Dialog.BAdminEmail.dialog.show();\n                Pman.Dialog.BAdminEmail.form.findField('bodytext').setValue(data);\n            }\n        }\n    );\n}"
156                          },
157                          "xtype" : "MenuItem",
158                          "String fa" : "code",
159                          "$ xns" : "Roo.bootstrap",
160                          "String html" : "HTML File"
161                         }
162                        ]
163                       }
164                      ]
165                     },
166                     {
167                      "listeners" : {
168                       "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.hide();\n}",
169                       "click" : "function (_self, e)\n{\n    var sel = _this.grid.grid.selModel.getSelected();\n    \n    if (!sel || sel.data.id * 1 < 1) {\n        Roo.MessageBox.alert(\"Error\", \"Select a message to edit\");\n        return;\n    }\n    \n    Pman.Dialog.BAdminEmail.show( {id : sel.data.id, module : 'core_email'} , function() {\n        _this.table.footer.onClick('first');\n    }); \n}"
170                      },
171                      "String cls" : "roo-toolbar-button",
172                      "xtype" : "Button",
173                      "$ xns" : "Roo.bootstrap",
174                      "String html" : "<i class=\"fa fa-edit\"></i> Edit"
175                     },
176                     {
177                      "listeners" : {
178                       "render" : "function (_self)\n{\n    _this.copy_btn = this;\n    \n    this.hide();\n}",
179                       "click" : "function (_self, e)\n{\n    var sel = _this.grid.grid.selModel.getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a message to copy\");\n        return;\n    }\n    new 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.table.footer.onClick('refresh');\n        }\n    });\n}"
180                      },
181                      "String cls" : "roo-toolbar-button",
182                      "xtype" : "Button",
183                      "$ xns" : "Roo.bootstrap",
184                      "String html" : "<i class=\"fa fa-clipboard\"></i> Copy"
185                     },
186                     {
187                      "listeners" : {
188                       "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.hide();\n}",
189                       "click" : "function (_self, e)\n{\n    Pman.genericDelete(_this.grid, 'core_email');\n}"
190                      },
191                      "String cls" : "roo-toolbar-button",
192                      "String weight" : "primary",
193                      "xtype" : "Button",
194                      "$ xns" : "Roo.bootstrap",
195                      "String html" : "<i class=\"fa fa-trash\"></i> Delete"
196                     }
197                    ]
198                   }
199                  ]
200                 }
201                ]
202               }
203              ]
204             }
205            ]
206           }
207          ]
208         },
209         {
210          "listeners" : {
211           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    if (!_this.dialog) {\n        return;\n    }\n    \n    //var data = this.getDataSource().getAt(rowIndex).data;\n    var data = _this.table.store.getAt(rowIndex).data;\n    \n    _this.dialog.show( {id : data.id, module : 'core_email'} , function() {\n        \n        _this.table.footer.onClick('first');\n    }); \n}",
212           "render" : "function (_self)\n{\n    \n    _this.table = this;\n    \n    _this.dialog = Pman.Dialog.BAdminEmail;\n}"
213          },
214          "boolean hover" : true,
215          "xtype" : "Table",
216          "boolean responsive" : true,
217          "Boolean rowSelection" : true,
218          "$ xns" : "Roo.bootstrap",
219          "Boolean loadMask" : true,
220          "* prop" : "grid",
221          "items" : [
222           {
223            "listeners" : {
224             "afterselectionchange" : "function (_self)\n{\n    _this.edit_btn.hide();\n    _this.copy_btn.hide();\n    _this.delete_btn.hide();\n    \n    if (!this.getSelected()) {\n        _this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    \n    if(this.getSelected().data) {\n        _this.viewPanel.setContent(this.getSelected().data.bodytext);\n    }\n    \n    _this.edit_btn.show();\n    _this.copy_btn.show();\n    _this.delete_btn.show();\n    \n}"
225            },
226            "Boolean singleSelect" : true,
227            "xtype" : "RowSelectionModel",
228            "$ xns" : "Roo.bootstrap.Table",
229            "* prop" : "sm"
230           },
231           {
232            "listeners" : {
233             "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}",
234             "load" : "function (_self, records, options)\n{\n    _this.edit_btn.hide();\n    _this.copy_btn.hide();\n    _this.delete_btn.hide();\n}"
235            },
236            "xtype" : "Store",
237            "boolean remoteSort" : true,
238            "$ xns" : "Roo.data",
239            "$ sortInfo" : "{field:'name',direction:'ASC'} ",
240            "* prop" : "store",
241            "items" : [
242             {
243              "xtype" : "HttpProxy",
244              "$ xns" : "Roo.data",
245              "String method" : "GET",
246              "* prop" : "proxy",
247              "$ String url" : "baseURL+'/Roo/Core_email.php'"
248             },
249             {
250              "$ Array fields" : "[\n    {\n        \"name\":\"name\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"subject\",\n        \"type\":\"string\"\n    }\n]",
251              "xtype" : "JsonReader",
252              "String root" : "data",
253              "$ xns" : "Roo.data",
254              "String id" : "id",
255              "* prop" : "reader",
256              "String totalProperty" : "total"
257             }
258            ]
259           },
260           {
261            "Number pageSize" : 25,
262            "Boolean displayInfo" : true,
263            "xtype" : "PagingToolbar",
264            "$ xns" : "Roo.bootstrap",
265            "* prop" : "footer"
266           },
267           {
268            "String cursor" : "pointer",
269            "xtype" : "ColumnModel",
270            "Number xs" : 3,
271            "header" : "Name",
272            "$ renderer" : "function(v,x,r) \n{ \n    if(r.data.active * 1 < 1){\n    \n        return String.format('<span style=\"font-size:12px;\"><s>{0}</s><span>', v ? v : ''); \n        \n    }\n    \n    return String.format('<span style=\"font-size:12px;\">{0}<span>', v ? v : ''); \n}",
273            "$ xns" : "Roo.grid",
274            "Boolean sortable" : true,
275            "* prop" : "cm[]",
276            "dataIndex" : "name"
277           },
278           {
279            "String cursor" : "pointer",
280            "xtype" : "ColumnModel",
281            "Number xs" : 3,
282            "header" : "Title",
283            "$ renderer" : "function(v,x,r) \n{ \n    if(r.data.active * 1 < 1){\n        return String.format('<span style=\"font-size:12px;\"><s>{0}</s></span>', v ? v : ''); \n    }\n    \n    return String.format('<span style=\"font-size:12px;\">{0}</span>', v ? v : ''); \n}",
284            "$ xns" : "Roo.grid",
285            "Boolean sortable" : true,
286            "* prop" : "cm[]",
287            "dataIndex" : "subject"
288           },
289           {
290            "String cursor" : "pointer",
291            "xtype" : "ColumnModel",
292            "Number xs" : 3,
293            "header" : "From Name<br/>Email",
294            "$ renderer" : "function(v,x,r)\n{\n    var from_name = r.data.from_name ? r.data.from_name : '';\n    var from_email = r.data.from_email ? r.data.from_email : '';\n    \n    //var r = from_name + '<br>' + from_email ;\n    if(from_name =='') {\n        return String.format('<span style=\"font-size:12px;\">{0}</span>', from_email);\n    }\n    return String.format('<span style=\"font-size:12px;\">{0} <br> {1}</span>', from_name, from_email);\n    \n    /*\n    return String.format(\n        '{0}'+'<'+'{1}'+'>',\n        r.data.from_name ? r.data.from_name : '',\n        r.data.from_email ? r.data.from_email : ''\n    );\n    */\n}",
295            "$ xns" : "Roo.grid",
296            "* prop" : "cm[]",
297            "dataIndex" : "from_email"
298           },
299           {
300            "String cursor" : "pointer",
301            "xtype" : "ColumnModel",
302            "Number xs" : 3,
303            "header" : "To / BCC Group",
304            "$ renderer" : "function(v,x,r)\n{ \n    if(\n       (r.data.group_member_count * 1 < 1 && r.data.to_group_name !='') ||\n       (r.data.bcc_group_member_count * 1 < 1 && r.data.bcc_group_name !='') \n    ){\n     \n        var grp_str = String.format('<span style=\"font-size:12px;\">To: {0} <br>',r.data.to_group_name);\n        \n        if(r.data.group_member_count * 1 < 1 ){\n            grp_str = String.format('<span style=\"font-size:12px;\">To: {0} <span class=\"text-danger\">(0)</span></span> <br>',r.data.to_group_name);\n        }\n\n        var bcc_str = String.format('<span style=\"font-size:12px;\">BCC: {0} </span>',r.data.bcc_group_name);\n        \n        if(r.data.bcc_group_member_count * 1 < 1 ){\n            bcc_str = String.format('<span style=\"font-size:12px;\">BCC: {0} <span class=\"text-danger\">(0)</span></span>',r.data.bcc_group_name);\n        }\n\n        return grp_str + bcc_str;\n    }\n    if(r.data.to_group_name ==''){\n        return String.format('<span style=\"font-size:12px;\">BCC: {0}</span>', r.data.bcc_group_name ); \n    }\n\n    return String.format('<span style=\"font-size:12px;\">To: {0} <br>BCC: {1}</span>', r.data.to_group_name,r.data.bcc_group_name ); \n}",
305            "$ xns" : "Roo.grid",
306            "* prop" : "cm[]",
307            "dataIndex" : "to_group_name"
308           },
309           {
310            "String cursor" : "pointer",
311            "xtype" : "ColumnModel",
312            "Number xs" : 2,
313            "header" : "BCC Group",
314            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
315            "$ xns" : "Roo.grid",
316            "* prop" : "cm[]",
317            "Boolean hidden" : true,
318            "dataIndex" : "bcc_group_name"
319           }
320          ]
321         }
322        ]
323       },
324       {
325        "listeners" : {
326         "render" : "function (_self)\n{\n    _this.viewPanel = this;\n}"
327        },
328        "xtype" : "Content",
329        "Boolean fitToFrame" : true,
330        "$ xns" : "Roo.bootstrap.panel",
331        "String region" : "south",
332        "String title" : "View Message"
333       }
334      ]
335     }
336    ]
337   }
338  ]
339 }