Pman.Dialog.CoreMailingListMessage.bjs
[Pman.Core] / Pman.Dialog.CoreMailingListMessage.bjs
1 {
2     "id": "roo-file-178",
3     "name": "Pman.Dialog.CoreMailingListMessage",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreMailingListMessage.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    \n    _self.layout.getRegion('center').showPanel(0);\n    var w = Roo.lib.Dom.getViewWidth();\r\n    var h = Roo.lib.Dom.getViewHeight();    \r    this.resizeTo(w-50, h-50);\r\n    this.center();\r    \n    var ew = Math.max(250, w-320);\r\n    var eh = Math.max(250, h-350) ;\r\n    var e = _this.dialog.layout.getRegion('east');\n    if (e.visible) {\n        e.hide();\n    }\n    \n    var el = _self.getEl();\n    var elw = el.dom.clientWidth;\n    \n    var bdtext = _this.form.findField('bodytext');\n    var ptext = _this.form.findField('plaintext');\n    if(bdtext.resizeEl){\n        bdtext.width = elw-100;\n        bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height  ] );\n        ptext.setSize(bdtext.width , bdtext.height);\n    }\n    \n}"
11             },
12             "closable": true,
13             "collapsible": false,
14             "height": 500,
15             "modal": true,
16             "resizable": true,
17             "title": "Edit / Create Message",
18             "width": 800,
19             "xtype": "LayoutDialog",
20             "|xns": "Roo",
21             "items": [
22                 {
23                     "*prop": "center",
24                     "tabPosition": "top",
25                     "xtype": "LayoutRegion",
26                     "|xns": "Roo"
27                 },
28                 {
29                     "*prop": "east",
30                     "hidden": true,
31                     "split": true,
32                     "title": "Images / Attachments",
33                     "titlebar": true,
34                     "width": 500,
35                     "xtype": "LayoutRegion",
36                     "|xns": "Roo"
37                 },
38                 {
39                     "autoScroll": false,
40                     "fitContainer": true,
41                     "fitToFrame": true,
42                     "region": "center",
43                     "xtype": "NestedLayoutPanel",
44                     "|xns": "Roo",
45                     "items": [
46                         {
47                             "|xns": "Roo",
48                             "xtype": "Toolbar",
49                             "*prop": "toolbar",
50                             "items": [
51                                 {
52                                     "text": "Import",
53                                     "xtype": "Button",
54                                     "|xns": "Roo.Toolbar",
55                                     "items": [
56                                         {
57                                             "|xns": "Roo.menu",
58                                             "xtype": "Menu",
59                                             "*prop": "menu",
60                                             "items": [
61                                                 {
62                                                     "listeners": {
63                                                         "click": "function (_self, e)\n{\n    Pman.Dialog.CoreImportUrl.show({\n        target : '/Crm/ImportHtml.php'\n    }, function(data) {\n        if  (data) {\n          //  Roo.log(data);\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
64                                                     },
65                                                     "text": "URL",
66                                                     "xtype": "Item",
67                                                     "|xns": "Roo.menu"
68                                                 },
69                                                 {
70                                                     "listeners": {
71                                                         "click": "function (_self, e)\n{\n    Pman.Dialog.Image.show({\n        _url : baseURL + '/Crm/ImportHtml.php'\n    }, function(data) {\n        if  (data) {\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
72                                                     },
73                                                     "text": "Html File",
74                                                     "xtype": "Item",
75                                                     "|xns": "Roo.menu"
76                                                 }
77                                             ]
78                                         }
79                                     ]
80                                 },
81                                 {
82                                     "text": "Use template",
83                                     "xtype": "Button",
84                                     "|xns": "Roo.Toolbar",
85                                     "items": [
86                                         {
87                                             "|xns": "Roo.menu",
88                                             "xtype": "Menu",
89                                             "*prop": "menu",
90                                             "items": [
91                                                 {
92                                                     "listeners": {
93                                                         "click": "function (_self, e)\n{\n\n    var l = document.location;\n    new Pman.Request({\n\n        url : baseURL + '/Crm/ImportHtml.php',\n\n        method: 'POST',\n        mask : \"Loading\",\n        params : {\n              importUrl : l.protocol +'//' + l.host +   rootURL + '/Pman/Crm/mail_templates/responsive1.html',\n       },\n        success : function (res) {\n\n         _this.form.findField('bodytext').setValue(res.data);\n        }\n  \n    });\n}"
94                                                     },
95                                                     "text": "Responsive Email (1)",
96                                                     "xtype": "Item",
97                                                     "|xns": "Roo.menu"
98                                                 }
99                                             ]
100                                         }
101                                     ]
102                                 },
103                                 {
104                                     "allowBlank": true,
105                                     "alwaysQuery": true,
106                                     "displayField": "file",
107                                     "editable": false,
108                                     "emptyText": "Select Template",
109                                     "fieldLabel": "Template",
110                                     "forceSelection": true,
111                                     "hiddenName": "template",
112                                     "listWidth": 400,
113                                     "loadingText": "Searching...",
114                                     "minChars": 2,
115                                     "name": "template",
116                                     "pageSize": 20,
117                                     "qtip": "Select Template",
118                                     "selectOnFocus": true,
119                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>",
120                                     "triggerAction": "all",
121                                     "typeAhead": true,
122                                     "valueField": "file",
123                                     "width": 200,
124                                     "xtype": "ComboBox",
125                                     "|xns": "Roo.form",
126                                     "items": [
127                                         {
128                                             "listeners": {
129                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
130                                             },
131                                             "*prop": "store",
132                                             "remoteSort": true,
133                                             "xtype": "Store",
134                                             "|sortInfo": "{ direction : 'DESC', field: 'name' }",
135                                             "|xns": "Roo.data",
136                                             "items": [
137                                                 {
138                                                     "*prop": "proxy",
139                                                     "method": "GET",
140                                                     "xtype": "HttpProxy",
141                                                     "|url": "baseURL + '/Core/MailTemplateList.php'",
142                                                     "|xns": "Roo.data"
143                                                 },
144                                                 {
145                                                     "*prop": "reader",
146                                                     "id": "name",
147                                                     "root": "data",
148                                                     "totalProperty": "total",
149                                                     "xtype": "JsonReader",
150                                                     "|fields": "[{\"name\":\"file\",\"type\":\"string\"},{\"name\":\"content\",\"type\":\"string\"}]",
151                                                     "|xns": "Roo.data"
152                                                 }
153                                             ]
154                                         }
155                                     ]
156                                 },
157                                 {
158                                     "|xns": "Roo.Toolbar",
159                                     "xtype": "Fill"
160                                 },
161                                 {
162                                     "listeners": {
163                                         "click": "function (_self, e)\n{\n    var el = _this.dialog.layout.getRegion('east');\n    if (el.visible) {\n        el.hide();\n    } else {\n        el.show();\n        el.showPanel(0);\n    }\n    \n}"
164                                     },
165                                     "text": "Images / Attachments >>",
166                                     "xtype": "Button",
167                                     "|xns": "Roo.Toolbar"
168                                 }
169                             ]
170                         },
171                         {
172                             "|xns": "Roo",
173                             "xtype": "BorderLayout",
174                             "*prop": "layout",
175                             "items": [
176                                 {
177                                     "*prop": "center",
178                                     "autoScroll": true,
179                                     "xtype": "LayoutRegion",
180                                     "|xns": "Roo"
181                                 },
182                                 {
183                                     "listeners": {
184                                         "render": "function (_self, width, height)\n{\n    \n      Roo.log(\"RESIZE, \" + width + ',' + height);\n    \n    var ew = Math.max(250, width-50);\n    var eh = Math.max(250,height-50) ;\n    \n   \n\n}",
185                                         "resize": "function (_self, width, height)\r\n{\r\n   var ew = Math.max(250, width-50);\r\n    var eh = Math.max(250,height-50) ;\n    \n    if (!_this.form) {\r\n        return;\r\n    }\r\n    var bdtext = _this.form.findField('bodytext');\r\n    var ptext = _this.form.findField('plaintext');\r\n    if(bdtext.resizeEl){\r\n        bdtext.width = ew-50;\r\n        bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height  ] );\r\n        ptext.setSize(bdtext.width , bdtext.height);\r\n    }\r\r\n\r\n}"
186                                     },
187                                     "autoScroll": false,
188                                     "background": false,
189                                     "fitContainer": true,
190                                     "fitToFrame": true,
191                                     "region": "center",
192                                     "title": "Message",
193                                     "xtype": "ContentPanel",
194                                     "|xns": "Roo",
195                                     "items": [
196                                         {
197                                             "listeners": {
198                                                 "|actioncomplete": "function(_self,action)\n{\n   \n    if (action.type == 'setdata') {\n       // _this.loaded_data = _this.form.getValues();\n\n        if(_this.data.id*1 > 0){\n            _this.dialog.el.mask(\"Loading\");\n            this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n            _this.html_preview.show();\n            _this.preview_btn.show();\n        } else {\n            _this.html_preview.hide();\n            _this.preview_btn.hide();\n            _this.form.setValues({\n                'from_name' : Pman.Login.authUser.name,\n                'from_email' : Pman.Login.authUser.email\n            });\n        }\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, action.result.data);\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
199                                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
200                                             },
201                                             "labelAlign": "right",
202                                             "labelWidth": 120,
203                                             "method": "POST",
204                                             "style": "margin:10px",
205                                             "xtype": "Form",
206                                             "|preValidate": "function(done_callback) {\n    \n    Roo.MessageBox.progress(\"Uploading Images\", \"Uploading\");\n    var html = _this.form.findField('bodytext').getValue();\n    \n    var s = Roo.get(_this.form.findField('bodytext').doc.documentElement);\n    \n    var nodes = [];\n    s.select('img[src]').each(function(i) {\n        nodes.push(i.dom);\n    });\n    var total = nodes.length;\n    var mkimg = function() {\n    \n        if (!nodes.length) {\n              Roo.MessageBox.hide();\n              _this.form.findField('bodytext').syncValue();\n              done_callback(true);\n           //    _this.form.doAction(\"submit\");\n              return;\n        }\n        var i = nodes.pop();        \n        var n = i.getAttribute('src').match(/^http(.*)/);\n        if(!n ){\n            mkimg();\n            return;\n        }\n        \n        new Pman.Request({\n            url : baseURL + '/Roo/Images.php',\n            method : 'POST',\n            params : {\n                onid : _this.form.findField('id').getValue(),\n                ontable : 'core_mailing_list_message' ,\n                _remote_upload : i.src\n            },\n            success : function(res){\n                if(res.success == true){      \n                    i.setAttribute('src', res.data);\n                    Roo.MessageBox.updateProgress( (total - nodes.length) / total , \"Done \" + (total - nodes.length) + '/' + total);\n                }\n                mkimg();\n            }\n        });\n       \n    }\n    mkimg();\n}\n",
207                                             "|url": "baseURL + '/Roo/Core_mailing_list_message.php'",
208                                             "|xns": "Roo.form",
209                                             "items": [
210                                                 {
211                                                     "xtype": "Row",
212                                                     "|xns": "Roo.form",
213                                                     "items": [
214                                                         {
215                                                             "allowBlank": false,
216                                                             "fieldLabel": "Mailout Name",
217                                                             "name": "name",
218                                                             "width": 400,
219                                                             "xtype": "TextField",
220                                                             "|xns": "Roo.form"
221                                                         }
222                                                     ]
223                                                 },
224                                                 {
225                                                     "xtype": "Row",
226                                                     "|xns": "Roo.form",
227                                                     "items": [
228                                                         {
229                                                             "allowBlank": false,
230                                                             "fieldLabel": "From",
231                                                             "name": "from_name",
232                                                             "width": 300,
233                                                             "xtype": "TextField",
234                                                             "|xns": "Roo.form"
235                                                         },
236                                                         {
237                                                             "allowBlank": false,
238                                                             "fieldLabel": "Email address",
239                                                             "name": "from_email",
240                                                             "width": 300,
241                                                             "xtype": "TextField",
242                                                             "|xns": "Roo.form"
243                                                         }
244                                                     ]
245                                                 },
246                                                 {
247                                                     "allowBlank": false,
248                                                     "fieldLabel": "Subject",
249                                                     "name": "subject",
250                                                     "width": 600,
251                                                     "xtype": "TextField",
252                                                     "|xns": "Roo.form"
253                                                 },
254                                                 {
255                                                     "hideLabels": true,
256                                                     "xtype": "Row",
257                                                     "|xns": "Roo.form",
258                                                     "items": [
259                                                         {
260                                                             "hideLabels": true,
261                                                             "legend": "Html Editor",
262                                                             "style": "text-align:center;",
263                                                             "xtype": "FieldSet",
264                                                             "|xns": "Roo.form",
265                                                             "items": [
266                                                                 {
267                                                                     "height": 250,
268                                                                     "name": "bodytext",
269                                                                     "resizable": "s",
270                                                                     "xtype": "HtmlEditor",
271                                                                     "|cwhite": "[ \n    'margin',\n    'padding',\n    'text-align',\n    'background',\n    'height',\n    'width',\n    'background-color',\n    'font-size',\n    'line-height',\n    'color',\n    'outline',\n    'text-decoration',\n    'position',\n    'clear',\n    'overflow',\n    'margin-top',\n    'border-bottom',\n    'top',\n    'list-style',\n    'margin-left',\n    'border',\n    'float' ,\n    'margin-right',\n    'padding-top',\n    'min-height',\n    'left',\n    'padding-left',\n    'font-weight',\n    'font-family',\n    'display',\n    'margin-bottom',\n    'padding-bottom',\n    'vertical-align',\n    'cursor',\n    'z-index',\n    'right',\n ]",
272                                                                     "|xns": "Roo.form",
273                                                                     "items": [
274                                                                         {
275                                                                             "|xns": "Roo.form.HtmlEditor",
276                                                                             "xtype": "ToolbarContext",
277                                                                             "*prop": "toolbars[]"
278                                                                         },
279                                                                         {
280                                                                             "*prop": "toolbars[]",
281                                                                             "xtype": "ToolbarStandard",
282                                                                             "|xns": "Roo.form.HtmlEditor",
283                                                                             "items": [
284                                                                                 {
285                                                                                     "listeners": {
286                                                                                         "render": "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
287                                                                                         "select": "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('bodytext');\n    editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#image-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n     );\n\n    \n }",
288                                                                                         "beforequery": "function (combo, query, forceAll, cancel, e)\n{\n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save email template first\");\n        return false;\n    }\n}"
289                                                                                     },
290                                                                                     "*prop": "btns[]",
291                                                                                     "alwaysQuery": true,
292                                                                                     "displayField": "name",
293                                                                                     "editable": false,
294                                                                                     "emptyText": "Add Image",
295                                                                                     "fieldLabel": "Images",
296                                                                                     "forceSelection": true,
297                                                                                     "listWidth": 400,
298                                                                                     "loadingText": "Searching...",
299                                                                                     "minChars": 2,
300                                                                                     "pageSize": 20,
301                                                                                     "qtip": "Select Images",
302                                                                                     "selectOnFocus": true,
303                                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><img src=\"{public_baseURL}/Core/Images/Thumb/150x150/{id}.jpg\" height=\"150\" width=\"150\"><b>{filename}</b> </div>",
304                                                                                     "triggerAction": "all",
305                                                                                     "typeAhead": true,
306                                                                                     "valueField": "id",
307                                                                                     "width": 100,
308                                                                                     "xtype": "ComboBox",
309                                                                                     "|xns": "Roo.form",
310                                                                                     "items": [
311                                                                                         {
312                                                                                             "listeners": {
313                                                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n\n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save email template first\");\n        return false;\n    }\n    o.params.onid = id\n    o.params.ontable = 'core_mailing_list_message';\n    \n   // o.params.imgtype = 'PressRelease';\n    //o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
314                                                                                             },
315                                                                                             "*prop": "store",
316                                                                                             "remoteSort": true,
317                                                                                             "xtype": "Store",
318                                                                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
319                                                                                             "|xns": "Roo.data",
320                                                                                             "items": [
321                                                                                                 {
322                                                                                                     "*prop": "proxy",
323                                                                                                     "xtype": "HttpProxy",
324                                                                                                     "method": "GET",
325                                                                                                     "|xns": "Roo.data",
326                                                                                                     "|url": "baseURL + '/Roo/Images.php'"
327                                                                                                 },
328                                                                                                 {
329                                                                                                     "*prop": "reader",
330                                                                                                     "id": "id",
331                                                                                                     "root": "data",
332                                                                                                     "totalProperty": "total",
333                                                                                                     "xtype": "JsonReader",
334                                                                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
335                                                                                                     "|xns": "Roo.data"
336                                                                                                 }
337                                                                                             ]
338                                                                                         }
339                                                                                     ]
340                                                                                 },
341                                                                                 {
342                                                                                     "listeners": {
343                                                                                         "render": "function (_self)\n{\n    _this.unsubscribeselect = _self;\n}",
344                                                                                         "select": "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('bodytext');\n    \n    if(record.data.name == 'Unsubscribe'){\n        editor.insertAtCursor(\n            String.format('<a href=\"{0}\">{1}</a>',\n                record.data.type,  record.data.name\n            )\n        );\n        return;     \n    }\n    \n    editor.insertAtCursor(\n        String.format('{0}',\n            record.data.type\n        )\n    );\n    \n }"
345                                                                                     },
346                                                                                     "*prop": "btns[]",
347                                                                                     "alwaysQuery": true,
348                                                                                     "displayField": "name",
349                                                                                     "editable": false,
350                                                                                     "emptyText": "Insert Field",
351                                                                                     "fieldLabel": "Field",
352                                                                                     "forceSelection": true,
353                                                                                     "listWidth": 400,
354                                                                                     "loadingText": "Searching...",
355                                                                                     "minChars": 2,
356                                                                                     "pageSize": 20,
357                                                                                     "qtip": "Insert Field",
358                                                                                     "selectOnFocus": true,
359                                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
360                                                                                     "triggerAction": "all",
361                                                                                     "typeAhead": true,
362                                                                                     "valueField": "type",
363                                                                                     "width": 100,
364                                                                                     "xtype": "ComboBox",
365                                                                                     "|xns": "Roo.form",
366                                                                                     "items": [
367                                                                                         {
368                                                                                             "*prop": "store",
369                                                                                             "xtype": "SimpleStore",
370                                                                                             "|data": "[ \n    [ '{person.firstname}', \"First Name\"],\n    [ '{person.lastname}' , \"Last Name\"],\n    [ '{person.name}', \"Full Name\"],\n    [ '#unsubscribe', \"Unsubscribe\"]\n]\n",
371                                                                                             "|fields": "[  'type', 'name']",
372                                                                                             "|xns": "Roo.data"
373                                                                                         }
374                                                                                     ]
375                                                                                 }
376                                                                             ]
377                                                                         }
378                                                                     ]
379                                                                 }
380                                                             ]
381                                                         }
382                                                     ]
383                                                 },
384                                                 {
385                                                     "hideLabels": true,
386                                                     "xtype": "Row",
387                                                     "|xns": "Roo.form",
388                                                     "items": [
389                                                         {
390                                                             "listeners": {
391                                                                 "click": "function (_self, e)\n{\n    var h = _this.form.findField('bodytext').getValue();\n    var p = _this.form.findField('plaintext');\n    \n    new Pman.Request({\r\n        url : baseURL + '/Crm/ImportHtml.php',\r\n        method : 'POST',\r\n        params : {\n          bodytext : h,\r\n          _convertToPlain : true,\n          _check_unsubscribe : true\r\n        }, \r\n        success : function(res) {\r\n            if(res.success == true){\n               p.setValue(res.data);\n            }\r\n        }\r\n    });  \n    \n}"
392                                                             },
393                                                             "text": "Convert Html to Text",
394                                                             "xtype": "Button",
395                                                             "|xns": "Roo"
396                                                         }
397                                                     ]
398                                                 },
399                                                 {
400                                                     "hideLabels": true,
401                                                     "xtype": "Row",
402                                                     "|xns": "Roo.form",
403                                                     "items": [
404                                                         {
405                                                             "hideLabels": true,
406                                                             "legend": "Plain Text",
407                                                             "style": "text-align:center;",
408                                                             "xtype": "FieldSet",
409                                                             "|xns": "Roo.form",
410                                                             "items": [
411                                                                 {
412                                                                     "height": 50,
413                                                                     "name": "plaintext",
414                                                                     "xtype": "TextArea",
415                                                                     "|xns": "Roo.form"
416                                                                 }
417                                                             ]
418                                                         }
419                                                     ]
420                                                 },
421                                                 {
422                                                     "name": "id",
423                                                     "|xns": "Roo.form",
424                                                     "xtype": "Hidden"
425                                                 }
426                                             ]
427                                         }
428                                     ]
429                                 }
430                             ]
431                         }
432                     ]
433                 },
434                 {
435                     "listeners": {
436                         "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       _this.igrid.ds.load({});\n    }\n}"
437                     },
438                     "autoScroll": false,
439                     "background": false,
440                     "fitContainer": true,
441                     "fitToframe": true,
442                     "region": "east",
443                     "tableName": "Images",
444                     "title": "Images / Attachments",
445                     "xtype": "GridPanel",
446                     "|xns": "Roo",
447                     "items": [
448                         {
449                             "listeners": {
450                                 "|render": "function() \n{\n    _this.igrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.ipanel.active) {\n   //    _this.igrid.ds.load({});\n    }\n}"
451                             },
452                             "*prop": "grid",
453                             "autoExpandColumn": "filename",
454                             "loadMask": true,
455                             "xtype": "Grid",
456                             "|xns": "Roo.grid",
457                             "items": [
458                                 {
459                                     "listeners": {
460                                         "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    if (typeof(_this.data) == 'undefined') {\n        return false;\n    }\n    if(_this.data.id * 1 >= 0)\n    {\n        options.params.onid = _this.data.id;\n        options.params.ontable = 'core_mailing_list_message';\n    }\n}"
461                                     },
462                                     "*prop": "dataSource",
463                                     "remoteSort": true,
464                                     "xtype": "Store",
465                                     "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
466                                     "|xns": "Roo.data",
467                                     "items": [
468                                         {
469                                             "*prop": "proxy",
470                                             "xtype": "HttpProxy",
471                                             "method": "GET",
472                                             "|url": "baseURL + '/Roo/Images.php'",
473                                             "|xns": "Roo.data"
474                                         },
475                                         {
476                                             "*prop": "reader",
477                                             "id": "id",
478                                             "root": "data",
479                                             "totalProperty": "total",
480                                             "xtype": "JsonReader",
481                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'parent_image_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_title',\n        'type': 'string'\n    }\n]",
482                                             "|xns": "Roo.data"
483                                         }
484                                     ]
485                                 },
486                                 {
487                                     "*prop": "toolbar",
488                                     "xtype": "Toolbar",
489                                     "|xns": "Roo",
490                                     "items": [
491                                         {
492                                             "listeners": {
493                                                 "|click": "function()\n{\n    var id = _this.form.findField('id').getValue();\n    \n    if(id*1 < 1){\n        Roo.MessageBox.alert('Error', 'Please save the email template first');\n        return;\n    }\n    \n    Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'core_mailing_list_message' }, function() {\n        _this.igrid.getDataSource().load({});\n    }); \n}\n"
494                                             },
495                                             "cls": "x-btn-text-icon",
496                                             "text": "Add",
497                                             "xtype": "Button",
498                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
499                                             "|xns": "Roo.Toolbar"
500                                         },
501                                         {
502                                             "listeners": {
503                                                 "|click": "function()\n{\n    var s = _this.igrid.getSelectionModel().getSelected();\n    if (!s || isNaN(s.id *1)) {\n        Roo.MessageBox.alert(\"Error\", \"Select a image\"); \n        return;\n    }\n    Roo.MessageBox.confirm(\"Confirm\", \"Are sure you want to delete this image?\", function (v){\n        if (v != 'yes') {\n            return;\n        }\n        \n        new Pman.Request({\n            url : baseURL + '/Roo/Images.php',\n            method: 'POST',\n            params : {\n                _delete : s.id\n            },\n            success : function()\n            {\n                Roo.log('Got Success!!');\n               _this.igrid.ds.load({});\n            }\n        });\n    });\n}\n        "
504                                             },
505                                             "cls": "x-btn-text-icon",
506                                             "text": "Delete",
507                                             "xtype": "Button",
508                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
509                                             "|xns": "Roo.Toolbar"
510                                         }
511                                     ]
512                                 },
513                                 {
514                                     "*prop": "colModel[]",
515                                     "dataIndex": "filename",
516                                     "header": "Filename",
517                                     "width": 300,
518                                     "xtype": "ColumnModel",
519                                     "|renderer": "function(v,x,r)\n{\n   return '<img src=\"' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '\" width=\"' + r.data.width + '\" height=\"' + r.data.height + '\" />';\n}",
520                                     "|xns": "Roo.grid"
521                                 },
522                                 {
523                                     "xtype": "ColumnModel",
524                                     "header": "Displayorder",
525                                     "width": 75,
526                                     "dataIndex": "displayorder",
527                                     "|renderer": "function(v) { return String.format('{0}', v); }",
528                                     "|xns": "Roo.grid",
529                                     "*prop": "colModel[]"
530                                 },
531                                 {
532                                     "*prop": "colModel[]",
533                                     "dataIndex": "title",
534                                     "header": "Title",
535                                     "width": 75,
536                                     "xtype": "ColumnModel",
537                                     "|renderer": "function(v) { return String.format('{0}', v); }",
538                                     "|xns": "Roo.grid"
539                                 }
540                             ]
541                         }
542                     ]
543                 },
544                 {
545                     "listeners": {
546                         "click": "function (_self, e)\n{\n    //_this.dialog.hide();\n    \n    Pman.Dialog.CrmMailingListMessagePreview.show({ id : _this.form.findField('id').getValue() });\n}",
547                         "render": "function (_self)\n{\n    _this.preview_btn = _self;\n}"
548                     },
549                     "*prop": "buttons[]",
550                     "text": "Preview",
551                     "xtype": "Button",
552                     "|xns": "Roo"
553                 },
554                 {
555                     "listeners": {
556                         "click": "function (_self, e)\n{\n    //_this.dialog.hide();\n    \n    var id = _this.form.findField('id').getValue();\n    \n    if(id*1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a queue to send');\n        return;\n    }\n   \n    new Pman.Request({\n        url : baseURL + '/Crm/MessagePreview',\n        method : 'POST',\n        mask: 'Sending',\n        params : {\n            _id : id,\n            _action : 'html'\n        }, \n        success : function(res) { \n            if(res.data == 'SUCCESS'){\n                Roo.MessageBox.alert(\"Email Sent\", 'The report was sent to your email (HTML format).');\n            }\n        }\n    });\n}",
557                         "render": "function (_self)\n{\n    _this.html_preview = _self;\n}"
558                     },
559                     "*prop": "buttons[]",
560                     "text": "Send me a test copy",
561                     "xtype": "Button",
562                     "|xns": "Roo"
563                 },
564                 {
565                     "listeners": {
566                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
567                     },
568                     "*prop": "buttons[]",
569                     "text": "Cancel",
570                     "xtype": "Button",
571                     "|xns": "Roo"
572                 },
573                 {
574                     "listeners": {
575                         "click": "function (_self, e)\n{\n    // do some checks?\n    _this.form.preValidate(function(res) {\n        if (!res) {\n            return; //failed.\n        }\n         _this.form.doAction(\"submit\");\n    });\n\n}"
576                     },
577                     "*prop": "buttons[]",
578                     "text": "Save",
579                     "xtype": "Button",
580                     "|xns": "Roo"
581                 }
582             ]
583         }
584     ],
585     "permname": "",
586     "modOrder": "001"
587 }