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