Pman.Dialog.CoreMailingListMessage.bjs
[Pman.Core] / Pman.Dialog.CoreMailingListMessage.bjs
1 {
2     "id": "roo-file-315",
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 : 'aaa.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": "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                                     "|xns": "Roo.Toolbar",
105                                     "xtype": "Fill"
106                                 },
107                                 {
108                                     "listeners": {
109                                         "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}"
110                                     },
111                                     "text": "Images / Attachments >>",
112                                     "xtype": "Button",
113                                     "|xns": "Roo.Toolbar"
114                                 }
115                             ]
116                         },
117                         {
118                             "|xns": "Roo",
119                             "xtype": "BorderLayout",
120                             "*prop": "layout",
121                             "items": [
122                                 {
123                                     "*prop": "center",
124                                     "autoScroll": true,
125                                     "xtype": "LayoutRegion",
126                                     "|xns": "Roo"
127                                 },
128                                 {
129                                     "listeners": {
130                                         "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}",
131                                         "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}"
132                                     },
133                                     "autoScroll": false,
134                                     "background": false,
135                                     "fitContainer": true,
136                                     "fitToFrame": true,
137                                     "region": "center",
138                                     "title": "Message",
139                                     "xtype": "ContentPanel",
140                                     "|xns": "Roo",
141                                     "items": [
142                                         {
143                                             "listeners": {
144                                                 "|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",
145                                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
146                                             },
147                                             "labelAlign": "right",
148                                             "labelWidth": 120,
149                                             "method": "POST",
150                                             "style": "margin:10px",
151                                             "xtype": "Form",
152                                             "|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 : 'crm_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",
153                                             "|url": "baseURL + '/Roo/Core_mailing_list_message.php'",
154                                             "|xns": "Roo.form",
155                                             "items": [
156                                                 {
157                                                     "xtype": "Row",
158                                                     "|xns": "Roo.form",
159                                                     "items": [
160                                                         {
161                                                             "allowBlank": false,
162                                                             "fieldLabel": "Mailout Name",
163                                                             "name": "name",
164                                                             "width": 400,
165                                                             "xtype": "TextField",
166                                                             "|xns": "Roo.form"
167                                                         }
168                                                     ]
169                                                 },
170                                                 {
171                                                     "xtype": "Row",
172                                                     "|xns": "Roo.form",
173                                                     "items": [
174                                                         {
175                                                             "allowBlank": false,
176                                                             "fieldLabel": "From",
177                                                             "name": "from_name",
178                                                             "width": 300,
179                                                             "xtype": "TextField",
180                                                             "|xns": "Roo.form"
181                                                         },
182                                                         {
183                                                             "allowBlank": false,
184                                                             "fieldLabel": "Email address",
185                                                             "name": "from_email",
186                                                             "width": 300,
187                                                             "xtype": "TextField",
188                                                             "|xns": "Roo.form"
189                                                         }
190                                                     ]
191                                                 },
192                                                 {
193                                                     "allowBlank": false,
194                                                     "fieldLabel": "Subject",
195                                                     "name": "subject",
196                                                     "width": 600,
197                                                     "xtype": "TextField",
198                                                     "|xns": "Roo.form"
199                                                 },
200                                                 {
201                                                     "hideLabels": true,
202                                                     "xtype": "Row",
203                                                     "|xns": "Roo.form",
204                                                     "items": [
205                                                         {
206                                                             "hideLabels": true,
207                                                             "legend": "Html Editor",
208                                                             "style": "text-align:center;",
209                                                             "xtype": "FieldSet",
210                                                             "|xns": "Roo.form",
211                                                             "items": [
212                                                                 {
213                                                                     "height": 250,
214                                                                     "name": "bodytext",
215                                                                     "resizable": "s",
216                                                                     "xtype": "HtmlEditor",
217                                                                     "|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 ]",
218                                                                     "|xns": "Roo.form",
219                                                                     "items": [
220                                                                         {
221                                                                             "|xns": "Roo.form.HtmlEditor",
222                                                                             "xtype": "ToolbarContext",
223                                                                             "*prop": "toolbars[]"
224                                                                         },
225                                                                         {
226                                                                             "*prop": "toolbars[]",
227                                                                             "xtype": "ToolbarStandard",
228                                                                             "|xns": "Roo.form.HtmlEditor",
229                                                                             "items": [
230                                                                                 {
231                                                                                     "listeners": {
232                                                                                         "render": "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
233                                                                                         "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 }",
234                                                                                         "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}"
235                                                                                     },
236                                                                                     "*prop": "btns[]",
237                                                                                     "alwaysQuery": true,
238                                                                                     "displayField": "name",
239                                                                                     "editable": false,
240                                                                                     "emptyText": "Add Image",
241                                                                                     "fieldLabel": "Images",
242                                                                                     "forceSelection": true,
243                                                                                     "listWidth": 400,
244                                                                                     "loadingText": "Searching...",
245                                                                                     "minChars": 2,
246                                                                                     "pageSize": 20,
247                                                                                     "qtip": "Select Images",
248                                                                                     "selectOnFocus": true,
249                                                                                     "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>",
250                                                                                     "triggerAction": "all",
251                                                                                     "typeAhead": true,
252                                                                                     "valueField": "id",
253                                                                                     "width": 100,
254                                                                                     "xtype": "ComboBox",
255                                                                                     "|xns": "Roo.form",
256                                                                                     "items": [
257                                                                                         {
258                                                                                             "listeners": {
259                                                                                                 "|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 press release first\");\n        return false;\n    }\n    o.params.onid = id\n    o.params.ontable = 'crm_mailing_list_message';\n    \n   // o.params.imgtype = 'PressRelease';\n    //o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
260                                                                                             },
261                                                                                             "*prop": "store",
262                                                                                             "remoteSort": true,
263                                                                                             "xtype": "Store",
264                                                                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
265                                                                                             "|xns": "Roo.data",
266                                                                                             "items": [
267                                                                                                 {
268                                                                                                     "*prop": "proxy",
269                                                                                                     "xtype": "HttpProxy",
270                                                                                                     "method": "GET",
271                                                                                                     "|xns": "Roo.data",
272                                                                                                     "|url": "baseURL + '/Roo/Images.php'"
273                                                                                                 },
274                                                                                                 {
275                                                                                                     "*prop": "reader",
276                                                                                                     "id": "id",
277                                                                                                     "root": "data",
278                                                                                                     "totalProperty": "total",
279                                                                                                     "xtype": "JsonReader",
280                                                                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
281                                                                                                     "|xns": "Roo.data"
282                                                                                                 }
283                                                                                             ]
284                                                                                         }
285                                                                                     ]
286                                                                                 },
287                                                                                 {
288                                                                                     "listeners": {
289                                                                                         "render": "function (_self)\n{\n    _this.unsubscribeselect = _self;\n}",
290                                                                                         "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 }"
291                                                                                     },
292                                                                                     "*prop": "btns[]",
293                                                                                     "alwaysQuery": true,
294                                                                                     "displayField": "name",
295                                                                                     "editable": false,
296                                                                                     "emptyText": "Insert Field",
297                                                                                     "fieldLabel": "Field",
298                                                                                     "forceSelection": true,
299                                                                                     "listWidth": 400,
300                                                                                     "loadingText": "Searching...",
301                                                                                     "minChars": 2,
302                                                                                     "pageSize": 20,
303                                                                                     "qtip": "Insert Field",
304                                                                                     "selectOnFocus": true,
305                                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
306                                                                                     "triggerAction": "all",
307                                                                                     "typeAhead": true,
308                                                                                     "valueField": "type",
309                                                                                     "width": 100,
310                                                                                     "xtype": "ComboBox",
311                                                                                     "|xns": "Roo.form",
312                                                                                     "items": [
313                                                                                         {
314                                                                                             "*prop": "store",
315                                                                                             "xtype": "SimpleStore",
316                                                                                             "|data": "[ \n    [ '{person.firstname}', \"First Name\"],\n    [ '{person.lastname}' , \"Last Name\"],\n    [ '{person.name}', \"Full Name\"],\n    [ '#unsubscribe', \"Unsubscribe\"]\n]\n",
317                                                                                             "|fields": "[  'type', 'name']",
318                                                                                             "|xns": "Roo.data"
319                                                                                         }
320                                                                                     ]
321                                                                                 }
322                                                                             ]
323                                                                         }
324                                                                     ]
325                                                                 }
326                                                             ]
327                                                         }
328                                                     ]
329                                                 },
330                                                 {
331                                                     "hideLabels": true,
332                                                     "xtype": "Row",
333                                                     "|xns": "Roo.form",
334                                                     "items": [
335                                                         {
336                                                             "listeners": {
337                                                                 "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}"
338                                                             },
339                                                             "text": "Convert Html to Text",
340                                                             "xtype": "Button",
341                                                             "|xns": "Roo"
342                                                         }
343                                                     ]
344                                                 },
345                                                 {
346                                                     "hideLabels": true,
347                                                     "xtype": "Row",
348                                                     "|xns": "Roo.form",
349                                                     "items": [
350                                                         {
351                                                             "hideLabels": true,
352                                                             "legend": "Plain Text",
353                                                             "style": "text-align:center;",
354                                                             "xtype": "FieldSet",
355                                                             "|xns": "Roo.form",
356                                                             "items": [
357                                                                 {
358                                                                     "height": 50,
359                                                                     "name": "plaintext",
360                                                                     "xtype": "TextArea",
361                                                                     "|xns": "Roo.form"
362                                                                 }
363                                                             ]
364                                                         }
365                                                     ]
366                                                 },
367                                                 {
368                                                     "name": "id",
369                                                     "|xns": "Roo.form",
370                                                     "xtype": "Hidden"
371                                                 }
372                                             ]
373                                         }
374                                     ]
375                                 }
376                             ]
377                         }
378                     ]
379                 },
380                 {
381                     "listeners": {
382                         "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       _this.igrid.ds.load({});\n    }\n}"
383                     },
384                     "autoScroll": false,
385                     "background": false,
386                     "fitContainer": true,
387                     "fitToframe": true,
388                     "region": "east",
389                     "tableName": "Images",
390                     "title": "Images / Attachments",
391                     "xtype": "GridPanel",
392                     "|xns": "Roo",
393                     "items": [
394                         {
395                             "listeners": {
396                                 "|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}"
397                             },
398                             "*prop": "grid",
399                             "autoExpandColumn": "filename",
400                             "loadMask": true,
401                             "xtype": "Grid",
402                             "|xns": "Roo.grid",
403                             "items": [
404                                 {
405                                     "listeners": {
406                                         "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}"
407                                     },
408                                     "*prop": "dataSource",
409                                     "remoteSort": true,
410                                     "xtype": "Store",
411                                     "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
412                                     "|xns": "Roo.data",
413                                     "items": [
414                                         {
415                                             "*prop": "proxy",
416                                             "xtype": "HttpProxy",
417                                             "method": "GET",
418                                             "|url": "baseURL + '/Roo/Images.php'",
419                                             "|xns": "Roo.data"
420                                         },
421                                         {
422                                             "*prop": "reader",
423                                             "id": "id",
424                                             "root": "data",
425                                             "totalProperty": "total",
426                                             "xtype": "JsonReader",
427                                             "|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]",
428                                             "|xns": "Roo.data"
429                                         }
430                                     ]
431                                 },
432                                 {
433                                     "*prop": "toolbar",
434                                     "xtype": "Toolbar",
435                                     "|xns": "Roo",
436                                     "items": [
437                                         {
438                                             "listeners": {
439                                                 "|click": "function()\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"
440                                             },
441                                             "cls": "x-btn-text-icon",
442                                             "text": "Add",
443                                             "xtype": "Button",
444                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
445                                             "|xns": "Roo.Toolbar"
446                                         },
447                                         {
448                                             "listeners": {
449                                                 "|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        "
450                                             },
451                                             "cls": "x-btn-text-icon",
452                                             "text": "Delete",
453                                             "xtype": "Button",
454                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
455                                             "|xns": "Roo.Toolbar"
456                                         }
457                                     ]
458                                 },
459                                 {
460                                     "*prop": "colModel[]",
461                                     "dataIndex": "filename",
462                                     "header": "Filename",
463                                     "width": 300,
464                                     "xtype": "ColumnModel",
465                                     "|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}",
466                                     "|xns": "Roo.grid"
467                                 },
468                                 {
469                                     "xtype": "ColumnModel",
470                                     "header": "Displayorder",
471                                     "width": 75,
472                                     "dataIndex": "displayorder",
473                                     "|renderer": "function(v) { return String.format('{0}', v); }",
474                                     "|xns": "Roo.grid",
475                                     "*prop": "colModel[]"
476                                 },
477                                 {
478                                     "*prop": "colModel[]",
479                                     "dataIndex": "title",
480                                     "header": "Title",
481                                     "width": 75,
482                                     "xtype": "ColumnModel",
483                                     "|renderer": "function(v) { return String.format('{0}', v); }",
484                                     "|xns": "Roo.grid"
485                                 }
486                             ]
487                         }
488                     ]
489                 },
490                 {
491                     "listeners": {
492                         "click": "function (_self, e)\n{\n    //_this.dialog.hide();\n    \n    Pman.Dialog.CrmMailingListMessagePreview.show({ id : _this.form.findField('id').getValue() });\n}",
493                         "render": "function (_self)\n{\n    _this.preview_btn = _self;\n}"
494                     },
495                     "*prop": "buttons[]",
496                     "text": "Preview",
497                     "xtype": "Button",
498                     "|xns": "Roo"
499                 },
500                 {
501                     "listeners": {
502                         "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}",
503                         "render": "function (_self)\n{\n    _this.html_preview = _self;\n}"
504                     },
505                     "*prop": "buttons[]",
506                     "text": "Send me a test copy",
507                     "xtype": "Button",
508                     "|xns": "Roo"
509                 },
510                 {
511                     "listeners": {
512                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
513                     },
514                     "*prop": "buttons[]",
515                     "text": "Cancel",
516                     "xtype": "Button",
517                     "|xns": "Roo"
518                 },
519                 {
520                     "listeners": {
521                         "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}"
522                     },
523                     "*prop": "buttons[]",
524                     "text": "Save",
525                     "xtype": "Button",
526                     "|xns": "Roo"
527                 }
528             ]
529         }
530     ],
531     "permname": "",
532     "modOrder": "001"
533 }