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