fix typo
[Pman.Core] / Pman.Dialog.CoreEmail.bjs
1 {
2  "name" : "Pman.Dialog.CoreEmail",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/leon/gitlive/web.MediaOutreach/Pman/Core/Pman.Dialog.CoreEmail.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "e44b145bd8b49b06e0ad2ced1ad56466" : "Plain Text",
10   "2f26e35d61be90501e099089dc533638" : "Select Images",
11   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
12   "b357b524e740bc85b9790a0712d84a30" : "Email address",
13   "962b90039a542a29cedd51d87a9f28a1" : "Html Editor",
14   "72d6d7a1885885bb55a565fd1070581a" : "Import",
15   "28690be026c0bb9003aa58e45e5662ca" : "Enabled - will be sent out",
16   "ea30b40c3caf28acb29198d20d243e54" : "Images / Attachments >>",
17   "31fde7b05ac8952dacf4af8a704074ec" : "Preview",
18   "b337c8a67244afb6551ee1f8f9717676" : "Test Class <BR/> (for system reference only)",
19   "884df8e413319ff51a3f5f528606238a" : "Use template",
20   "e6b391a8d2c4d45902a23a8b6585703d" : "URL",
21   "6f16a5f8ff5d75ab84c018adacdfcbb7" : "Field",
22   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
23   "2393ad754ba179442d85e415d1d5167c" : "Displayorder",
24   "e9968623956c15023d54335ea3699855" : "Convert Html to Text",
25   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
26   "5b8ef4e762c00a15a41cfc26dc3ef99c" : "Send me a test copy",
27   "c7892ebbb139886662c6f2fc8c450710" : "Subject",
28   "dc0de523c25be298ba751c63c694109e" : "Responsive Email (1)",
29   "396ecabf0cd1f9503e591418851ef406" : "Edit / Create Message",
30   "b9c49611cfda3259a2b837b39489e650" : "Add Image",
31   "cafbb1cfc96d63acd85e7de928e1636b" : "To Group <BR/> (for system reference only)",
32   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
33   "68b00d723d37122f64da8d9939f836f0" : "BCC Group",
34   "c4ca4238a0b923820dcc509a6f75849b" : "1",
35   "bd88a20b53a47f7b5704a83a15ff5506" : "Saved Version",
36   "b20a8b77b05d53b4e695738731400c85" : "Mailout Name",
37   "1bd18d39370b7f26c1c5e18067b74c6f" : "Html File",
38   "2c466a2c159463f1d9ef5a7b57b52827" : "Select BCC Group",
39   "5da618e8e4b89c66fe86e32cdafde142" : "From",
40   "31bb2f6e9b8fb11cbb7fb63c6025223f" : "Select Template",
41   "b78a3223503896721cca1303f776159b" : "Title",
42   "278c491bdd8a53618c149c4ac790da34" : "Template",
43   "308f2757bfc9ce92fb00ff93fdffd279" : "Images / Attachments",
44   "1351017ac6423911223bc19a8cb7c653" : "Filename",
45   "c9cc8cce247e49bae79f15173ce97354" : "Save",
46   "5feb9bf3c03b32635135006cbacb9542" : "Insert Field",
47   "4c2a8fe7eaf24721cc7a9f0175115bd4" : "Message",
48   "fff0d600f8a0b5e19e88bfb821dd1157" : "Images"
49  },
50  "named_strings" : {
51   "active_boxLabel" : "28690be026c0bb9003aa58e45e5662ca",
52   "to_group_id_name_fieldLabel" : "cafbb1cfc96d63acd85e7de928e1636b",
53   "template_fieldLabel" : "278c491bdd8a53618c149c4ac790da34",
54   "name_fieldLabel" : "b20a8b77b05d53b4e695738731400c85",
55   "bcc_group_id_name_qtip" : "2c466a2c159463f1d9ef5a7b57b52827",
56   "bcc_group_id_name_emptyText" : "2c466a2c159463f1d9ef5a7b57b52827",
57   "template_qtip" : "31bb2f6e9b8fb11cbb7fb63c6025223f",
58   "template_loadingText" : "1243daf593fa297e07ab03bf06d925af",
59   "from_email_fieldLabel" : "b357b524e740bc85b9790a0712d84a30",
60   "template_emptyText" : "31bb2f6e9b8fb11cbb7fb63c6025223f",
61   "active_value" : "c4ca4238a0b923820dcc509a6f75849b",
62   "from_name_fieldLabel" : "5da618e8e4b89c66fe86e32cdafde142",
63   "bcc_group_id_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
64   "bcc_group_id_name_fieldLabel" : "68b00d723d37122f64da8d9939f836f0",
65   "subject_fieldLabel" : "c7892ebbb139886662c6f2fc8c450710",
66   "test_class_fieldLabel" : "b337c8a67244afb6551ee1f8f9717676"
67  },
68  "items" : [
69   {
70    "listeners" : {
71     "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}"
72    },
73    "modal" : true,
74    "collapsible" : false,
75    "title" : "Edit / Create Message",
76    "xtype" : "LayoutDialog",
77    "width" : 800,
78    "$ xns" : "Roo",
79    "closable" : true,
80    "resizable" : true,
81    "height" : 500,
82    "items" : [
83     {
84      "xtype" : "LayoutRegion",
85      "tabPosition" : "top",
86      "$ xns" : "Roo",
87      "* prop" : "center"
88     },
89     {
90      "hidden" : true,
91      "title" : "Images / Attachments",
92      "xtype" : "LayoutRegion",
93      "width" : 500,
94      "$ xns" : "Roo",
95      "split" : true,
96      "* prop" : "east",
97      "titlebar" : true
98     },
99     {
100      "autoScroll" : false,
101      "fitToFrame" : true,
102      "region" : "center",
103      "xtype" : "NestedLayoutPanel",
104      "fitContainer" : true,
105      "$ xns" : "Roo",
106      "items" : [
107       {
108        "xtype" : "Toolbar",
109        "$ xns" : "Roo",
110        "* prop" : "toolbar",
111        "items" : [
112         {
113          "text" : "Import",
114          "xtype" : "Button",
115          "$ xns" : "Roo.Toolbar",
116          "items" : [
117           {
118            "xtype" : "Menu",
119            "$ xns" : "Roo.menu",
120            "* prop" : "menu",
121            "items" : [
122             {
123              "listeners" : {
124               "click" : "function (_self, e)\n{\n    Pman.Dialog.CoreImportUrl.show({\n        target : '/Core/ImportMailMessage.php'\n    }, function(data) {\n        if  (data) {\n          //  Roo.log(data);\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
125              },
126              "text" : "URL",
127              "xtype" : "Item",
128              "$ xns" : "Roo.menu"
129             },
130             {
131              "listeners" : {
132               "click" : "function (_self, e)\n{\n    Pman.Dialog.Image.show({\n        _url : baseURL + '/Core/ImportMailMessage.php'\n    }, function(data) {\n        if  (data) {\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
133              },
134              "text" : "Html File",
135              "xtype" : "Item",
136              "$ xns" : "Roo.menu"
137             }
138            ]
139           }
140          ]
141         },
142         {
143          "text" : "Use template",
144          "xtype" : "Button",
145          "$ xns" : "Roo.Toolbar",
146          "items" : [
147           {
148            "xtype" : "Menu",
149            "$ xns" : "Roo.menu",
150            "* prop" : "menu",
151            "items" : [
152             {
153              "listeners" : {
154               "click" : "function (_self, e)\n{\n\n    var l = document.location;\n    new Pman.Request({\n\n        url : baseURL + '/Core/ImportMailMessage.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}"
155              },
156              "text" : "Responsive Email (1)",
157              "xtype" : "Item",
158              "$ xns" : "Roo.menu"
159             }
160            ]
161           }
162          ]
163         },
164         {
165          "listeners" : {
166           "select" : "function (combo, record, index)\n{\n   \n/*\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n*/    \n    if(!record){\n        return;\n    }\n    _this.form.findField('bodytext').setValue(record.data.content);\n\n}"
167          },
168          "alwaysQuery" : true,
169          "listWidth" : 400,
170          "triggerAction" : "all",
171          "fieldLabel" : "Template",
172          "forceSelection" : true,
173          "selectOnFocus" : true,
174          "pageSize" : 20,
175          "displayField" : "file",
176          "emptyText" : "Select Template",
177          "hiddenName" : "template",
178          "minChars" : 2,
179          "valueField" : "file",
180          "xtype" : "ComboBox",
181          "allowBlank" : true,
182          "typeAhead" : true,
183          "editable" : false,
184          "width" : 200,
185          "$ xns" : "Roo.form",
186          "name" : "template",
187          "qtip" : "Select Template",
188          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>",
189          "loadingText" : "Searching...",
190          "items" : [
191           {
192            "listeners" : {
193             "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
194            },
195            "xtype" : "Store",
196            "remoteSort" : true,
197            "$ sortInfo" : "{ direction : 'DESC', field: 'file' }",
198            "$ xns" : "Roo.data",
199            "* prop" : "store",
200            "items" : [
201             {
202              "$ url" : "baseURL + '/Core/MailTemplateList.php'",
203              "xtype" : "HttpProxy",
204              "method" : "GET",
205              "$ xns" : "Roo.data",
206              "* prop" : "proxy"
207             },
208             {
209              "id" : "name",
210              "root" : "data",
211              "xtype" : "JsonReader",
212              "$ fields" : "[{\"name\":\"file\",\"type\":\"string\"},{\"name\":\"content\",\"type\":\"string\"}]",
213              "$ xns" : "Roo.data",
214              "* prop" : "reader",
215              "totalProperty" : "total"
216             }
217            ]
218           }
219          ]
220         },
221         {
222          "xtype" : "Fill",
223          "$ xns" : "Roo.Toolbar"
224         },
225         {
226          "listeners" : {
227           "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}"
228          },
229          "text" : "Images / Attachments >>",
230          "xtype" : "Button",
231          "$ xns" : "Roo.Toolbar"
232         }
233        ]
234       },
235       {
236        "xtype" : "BorderLayout",
237        "$ xns" : "Roo",
238        "* prop" : "layout",
239        "items" : [
240         {
241          "autoScroll" : true,
242          "xtype" : "LayoutRegion",
243          "$ xns" : "Roo",
244          "* prop" : "center"
245         },
246         {
247          "listeners" : {
248           "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}",
249           "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}"
250          },
251          "autoScroll" : false,
252          "background" : false,
253          "fitToFrame" : true,
254          "region" : "center",
255          "title" : "Message",
256          "xtype" : "ContentPanel",
257          "fitContainer" : true,
258          "$ xns" : "Roo",
259          "items" : [
260           {
261            "listeners" : {
262             "|actioncomplete" : "function(_self,action)\n{\n   \n    if (action.type == 'setdata') {\n    \n        setInterval(_this.form.findField('bodytext').autosave, 5000);\n        \n        _this.data.module = _this.data.module || 'crm_mailing_list_message';\n        \n        _this.form.url = baseURL + '/Roo/' + _this.data.module;\n        \n        _this.html_preview.hide();\n        _this.preview_btn.hide();\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            \n        } else {\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        \n        _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();\n        \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",
263             "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
264            },
265            "$ preValidate" : "function(done_callback) {\n    \n    Roo.MessageBox.progress(\"Uploading Images\", \"Uploading\");\n    \n    if(!_this.form.findField('bodytext').editorcore.sourceEditMode){\n        _this.form.findField('bodytext').syncValue();\n    }else{\n        _this.form.findField('bodytext').pushValue();\n    }\n    \n    var html = _this.form.findField('bodytext').getValue();\n    \n    var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);\n    \n    var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\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        \n        var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);\n        \n        if(n){\n            mkimg();\n            return;\n        }\n        \n        n = i.getAttribute('src').match(/^http(.*)/);\n       \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 : ontable ,\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    \n    if (!_this.form.findField('bodytext').getValue().match(/unsubscribe/i)) {\n        Roo.MessageBox.confirm(\"Missing unusubscribe\",\n            \"There is no unsubscribe link on the email  are you sure you want to save it\",\n            function(res) {\n                if (res == 'no') {\n                    return;\n                }\n                mkimg();\n            }\n        );\n\n        return;\n    }\n    \n    mkimg();\n}\n",
266            "$ url" : "baseURL + '/Roo/crm_mailing_list_message.php'",
267            "labelAlign" : "right",
268            "method" : "POST",
269            "style" : "margin:10px",
270            "xtype" : "Form",
271            "labelWidth" : 120,
272            "$ xns" : "Roo.form",
273            "items" : [
274             {
275              "xtype" : "Row",
276              "$ xns" : "Roo.form",
277              "items" : [
278               {
279                "fieldLabel" : "Mailout Name",
280                "xtype" : "TextField",
281                "allowBlank" : false,
282                "width" : 400,
283                "$ xns" : "Roo.form",
284                "name" : "name"
285               },
286               {
287                "xtype" : "Column",
288                "$ xns" : "Roo.form",
289                "Boolean hideLabels" : true,
290                "items" : [
291                 {
292                  "listeners" : {
293                   "check" : "function (_self, checked)\n{\n    var boxLabel = 'Enabled - will be sent out';\n    \n    if(!checked){\n        boxLabel = 'Disabled - will NOT be sent out';\n    }\n    \n    this.setBoxLabel(boxLabel);\n}"
294                  },
295                  "String name" : "active",
296                  "Boolean checked" : true,
297                  "xtype" : "Checkbox",
298                  "String valueOff" : 0,
299                  "String boxLabel" : "Enabled - will be sent out",
300                  "$ xns" : "Roo.form",
301                  "Mixed value" : 1
302                 }
303                ]
304               }
305              ]
306             },
307             {
308              "xtype" : "Row",
309              "$ xns" : "Roo.form",
310              "items" : [
311               {
312                "fieldLabel" : "From",
313                "xtype" : "TextField",
314                "allowBlank" : false,
315                "width" : 300,
316                "$ xns" : "Roo.form",
317                "name" : "from_name"
318               },
319               {
320                "fieldLabel" : "Email address",
321                "xtype" : "TextField",
322                "allowBlank" : false,
323                "width" : 300,
324                "$ xns" : "Roo.form",
325                "name" : "from_email"
326               },
327               {
328                "alwaysQuery" : true,
329                "triggerAction" : "all",
330                "fieldLabel" : "BCC Group",
331                "forceSelection" : true,
332                "selectOnFocus" : true,
333                "pageSize" : 25,
334                "displayField" : "name",
335                "emptyText" : "Select BCC Group",
336                "hiddenName" : "bcc_group_id",
337                "minChars" : 2,
338                "valueField" : "id",
339                "xtype" : "ComboBox",
340                "allowBlank" : true,
341                "typeAhead" : true,
342                "editable" : false,
343                "width" : 300,
344                "$ xns" : "Roo.form",
345                "name" : "bcc_group_id_name",
346                "qtip" : "Select BCC Group",
347                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
348                "loadingText" : "Searching...",
349                "Boolean forceSelection" : true,
350                "items" : [
351                 {
352                  "listeners" : {
353                   "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._direct_return = 1;\n}\n"
354                  },
355                  "xtype" : "Store",
356                  "remoteSort" : true,
357                  "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
358                  "$ xns" : "Roo.data",
359                  "* prop" : "store",
360                  "items" : [
361                   {
362                    "$ url" : "baseURL + '/Roo/Core_group'",
363                    "method" : "GET",
364                    "xtype" : "HttpProxy",
365                    "$ xns" : "Roo.data",
366                    "* prop" : "proxy"
367                   },
368                   {
369                    "id" : "name",
370                    "root" : "data",
371                    "xtype" : "JsonReader",
372                    "$ fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]",
373                    "$ xns" : "Roo.data",
374                    "* prop" : "reader",
375                    "totalProperty" : "total"
376                   }
377                  ]
378                 }
379                ]
380               }
381              ]
382             },
383             {
384              "fieldLabel" : "Subject",
385              "xtype" : "TextField",
386              "allowBlank" : false,
387              "width" : 600,
388              "$ xns" : "Roo.form",
389              "name" : "subject"
390             },
391             {
392              "hideLabels" : true,
393              "xtype" : "Row",
394              "$ xns" : "Roo.form",
395              "items" : [
396               {
397                "hideLabels" : true,
398                "style" : "text-align:center;",
399                "legend" : "Html Editor",
400                "xtype" : "FieldSet",
401                "$ xns" : "Roo.form",
402                "items" : [
403                 {
404                  "listeners" : {
405                   "savedpreview" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'BODY',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'crm_mailing_list_message',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
406                   "autosave" : "function (_self)\n{\n    Roo.log('autosave');\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    \n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'crm_mailing_list_message',\n            remarks : 'BODY',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            Roo.log('body autosave failed?!');\n        }\n    });\n    \n}"
407                  },
408                  "bool allowComments" : true,
409                  "| function autosave" : "function() {\n    \n    var body = _this.form.findField('bodytext');\n    \n    if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n        Roo.log('body not dirty');\n        return;\n    }\n    \n    Roo.log('body dirty, auto save!');\n    \n    body.fireEvent('autosave', body);\n   \n}\n",
410                  "xtype" : "HtmlEditor",
411                  "$ cwhite" : "[ \n    'background',\n    'background-color',\n    'border',\n    'border-radius',\n    'border-bottom',\n    'border-left',\n    'border-right',\n    'border-top',\n    'border-collapse',\n     'border-color',\n     'border-style',\n    'border-width',\n\n    \n    'box-shadow',\n    'clear',\n    'color',\n    'cursor',\n    'display',\n    'float' ,\n    'font-family',\n    'font-size',\n    'font-style',        \n    'font-weight',\n\n    'height',\n    'left',\n    'line-height',\n    'list-style',\n    'margin',\n    'margin-bottom',\n    'margin-left',\n    'margin-right',\n    'margin-top',\n    'max-width',\n    'min-height',\n    '-ms-interpolation-mode',\n    'mso-table-rspace',\n    '-ms-text-size-adjust',\n    'outline',\n    'overflow',\n    'padding',\n    'padding-bottom',\n    'padding-left',\n    'padding-right',\n    'padding-top',\n    'position',\n    'right',\n    'text-align',\n    'text-decoration',\n    'top',\n    'vertical-align',\n    '-webkit-text-size-adjust',\n    'width',\n    'width',\n    'z-index'\n ]",
412                  "boolean autoClean" : false,
413                  "$ xns" : "Roo.form",
414                  "resizable" : "s",
415                  "boolean enableBlocks" : false,
416                  "name" : "bodytext",
417                  "height" : 250,
418                  "clearUp" : false,
419                  "items" : [
420                   {
421                    "xtype" : "ToolbarContext",
422                    "$ xns" : "Roo.form.HtmlEditor",
423                    "* prop" : "toolbars[]"
424                   },
425                   {
426                    "xtype" : "ToolbarStandard",
427                    "$ xns" : "Roo.form.HtmlEditor",
428                    "* prop" : "toolbars[]",
429                    "items" : [
430                     {
431                      "listeners" : {
432                       "render" : "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
433                       "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 message first\");\n        return false;\n    }\n}",
434                       "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').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \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    \n }"
435                      },
436                      "alwaysQuery" : true,
437                      "listWidth" : 400,
438                      "triggerAction" : "all",
439                      "fieldLabel" : "Images",
440                      "forceSelection" : true,
441                      "selectOnFocus" : true,
442                      "pageSize" : 20,
443                      "displayField" : "name",
444                      "emptyText" : "Add Image",
445                      "minChars" : 2,
446                      "valueField" : "id",
447                      "xtype" : "ComboBox",
448                      "typeAhead" : true,
449                      "editable" : false,
450                      "width" : 100,
451                      "$ xns" : "Roo.form",
452                      "* prop" : "btns[]",
453                      "qtip" : "Select Images",
454                      "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>",
455                      "loadingText" : "Searching...",
456                      "items" : [
457                       {
458                        "listeners" : {
459                         "|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 = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    \n   // o.params.imgtype = 'PressRelease';\n    //o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
460                        },
461                        "xtype" : "Store",
462                        "remoteSort" : true,
463                        "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
464                        "$ xns" : "Roo.data",
465                        "* prop" : "store",
466                        "items" : [
467                         {
468                          "$ url" : "baseURL + '/Roo/Images.php'",
469                          "method" : "GET",
470                          "xtype" : "HttpProxy",
471                          "$ xns" : "Roo.data",
472                          "* prop" : "proxy"
473                         },
474                         {
475                          "id" : "id",
476                          "root" : "data",
477                          "xtype" : "JsonReader",
478                          "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
479                          "$ xns" : "Roo.data",
480                          "* prop" : "reader",
481                          "totalProperty" : "total"
482                         }
483                        ]
484                       }
485                      ]
486                     },
487                     {
488                      "listeners" : {
489                       "render" : "function (_self)\n{\n    _this.unsubscribeselect = _self;\n}",
490                       "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').editorcore;\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 }"
491                      },
492                      "alwaysQuery" : true,
493                      "listWidth" : 400,
494                      "triggerAction" : "all",
495                      "fieldLabel" : "Field",
496                      "forceSelection" : true,
497                      "selectOnFocus" : true,
498                      "pageSize" : 20,
499                      "displayField" : "name",
500                      "emptyText" : "Insert Field",
501                      "minChars" : 2,
502                      "valueField" : "type",
503                      "xtype" : "ComboBox",
504                      "typeAhead" : true,
505                      "editable" : false,
506                      "width" : 100,
507                      "$ xns" : "Roo.form",
508                      "* prop" : "btns[]",
509                      "qtip" : "Insert Field",
510                      "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
511                      "loadingText" : "Searching...",
512                      "items" : [
513                       {
514                        "xtype" : "SimpleStore",
515                        "$ data" : "[ \n    [ '{person.firstname}', \"First Name\"],\n    [ '{person.lastname}' , \"Last Name\"],\n    [ '{person.name}', \"Full Name\"],\n    [ '#unsubscribe', \"Unsubscribe\"]\n]\n",
516                        "$ fields" : "[  'type', 'name']",
517                        "$ xns" : "Roo.data",
518                        "* prop" : "store"
519                       }
520                      ]
521                     },
522                     {
523                      "xtype" : "Separator",
524                      "$ xns" : "Roo.Toolbar",
525                      "* prop" : "btns[]"
526                     },
527                     {
528                      "listeners" : {
529                       "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n    \n}"
530                      },
531                      "String cls" : "x-init-enable",
532                      "text" : "Saved Version",
533                      "xtype" : "Button",
534                      "$ xns" : "Roo.Toolbar",
535                      "* prop" : "btns[]"
536                     }
537                    ]
538                   }
539                  ]
540                 }
541                ]
542               }
543              ]
544             },
545             {
546              "hideLabels" : true,
547              "xtype" : "Row",
548              "$ xns" : "Roo.form",
549              "items" : [
550               {
551                "listeners" : {
552                 "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 + '/Core/ImportMailMessage.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}"
553                },
554                "text" : "Convert Html to Text",
555                "xtype" : "Button",
556                "$ xns" : "Roo"
557               }
558              ]
559             },
560             {
561              "hideLabels" : true,
562              "xtype" : "Row",
563              "$ xns" : "Roo.form",
564              "items" : [
565               {
566                "hideLabels" : true,
567                "style" : "text-align:center;",
568                "legend" : "Plain Text",
569                "xtype" : "FieldSet",
570                "$ xns" : "Roo.form",
571                "items" : [
572                 {
573                  "xtype" : "TextArea",
574                  "$ xns" : "Roo.form",
575                  "height" : 50,
576                  "name" : "plaintext"
577                 }
578                ]
579               }
580              ]
581             },
582             {
583              "xtype" : "Row",
584              "$ xns" : "Roo.form",
585              "items" : [
586               {
587                "fieldLabel" : "Test Class <BR/> (for system reference only)",
588                "Boolean readOnly" : true,
589                "xtype" : "TextField",
590                "allowBlank" : true,
591                "width" : 300,
592                "$ xns" : "Roo.form",
593                "name" : "test_class"
594               }
595              ]
596             },
597             {
598              "xtype" : "Row",
599              "$ xns" : "Roo.form",
600              "items" : [
601               {
602                "fieldLabel" : "To Group <BR/> (for system reference only)",
603                "Boolean readOnly" : true,
604                "xtype" : "TextField",
605                "allowBlank" : true,
606                "width" : 300,
607                "$ xns" : "Roo.form",
608                "name" : "to_group_id_name"
609               }
610              ]
611             },
612             {
613              "xtype" : "Hidden",
614              "$ xns" : "Roo.form",
615              "name" : "id"
616             }
617            ]
618           }
619          ]
620         }
621        ]
622       }
623      ]
624     },
625     {
626      "listeners" : {
627       "|activate" : "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       _this.igrid.ds.load({});\n    }\n}"
628      },
629      "autoScroll" : false,
630      "background" : false,
631      "fitToframe" : true,
632      "region" : "east",
633      "title" : "Images / Attachments",
634      "xtype" : "GridPanel",
635      "fitContainer" : true,
636      "$ xns" : "Roo",
637      "tableName" : "Images",
638      "items" : [
639       {
640        "listeners" : {
641         "|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}"
642        },
643        "autoExpandColumn" : "filename",
644        "xtype" : "Grid",
645        "loadMask" : true,
646        "$ xns" : "Roo.grid",
647        "* prop" : "grid",
648        "items" : [
649         {
650          "listeners" : {
651           "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\n        options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    }\n}"
652          },
653          "xtype" : "Store",
654          "remoteSort" : true,
655          "$ sortInfo" : "{ field : 'filename', direction: 'ASC' }",
656          "$ xns" : "Roo.data",
657          "* prop" : "dataSource",
658          "items" : [
659           {
660            "$ url" : "baseURL + '/Roo/Images.php'",
661            "method" : "GET",
662            "xtype" : "HttpProxy",
663            "$ xns" : "Roo.data",
664            "* prop" : "proxy"
665           },
666           {
667            "id" : "id",
668            "root" : "data",
669            "xtype" : "JsonReader",
670            "$ 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]",
671            "$ xns" : "Roo.data",
672            "* prop" : "reader",
673            "totalProperty" : "total"
674           }
675          ]
676         },
677         {
678          "xtype" : "Toolbar",
679          "$ xns" : "Roo",
680          "* prop" : "toolbar",
681          "items" : [
682           {
683            "listeners" : {
684             "|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    var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    \n    Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {\n        _this.igrid.getDataSource().load({});\n    });\n}\n"
685            },
686            "text" : "Add",
687            "xtype" : "Button",
688            "cls" : "x-btn-text-icon",
689            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
690            "$ xns" : "Roo.Toolbar"
691           },
692           {
693            "listeners" : {
694             "|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        "
695            },
696            "text" : "Delete",
697            "xtype" : "Button",
698            "cls" : "x-btn-text-icon",
699            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
700            "$ xns" : "Roo.Toolbar"
701           }
702          ]
703         },
704         {
705          "xtype" : "ColumnModel",
706          "header" : "Filename",
707          "width" : 300,
708          "$ renderer" : "function(v,x,r)\n{\n    var width = r.data.width;\n    var height = r.data.height;\n    \n    if(width > 50){\n        height = Math.round(height * 50 / width);\n        width = 50;\n    }\n    \n   return '<img src=\"' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '\" width=\"' + width + '\" height=\"' + height + '\" />';\n}",
709          "$ xns" : "Roo.grid",
710          "* prop" : "colModel[]",
711          "dataIndex" : "filename"
712         },
713         {
714          "xtype" : "ColumnModel",
715          "width" : 75,
716          "header" : "Displayorder",
717          "$ renderer" : "function(v) { return String.format('{0}', v); }",
718          "$ xns" : "Roo.grid",
719          "* prop" : "colModel[]",
720          "dataIndex" : "displayorder"
721         },
722         {
723          "xtype" : "ColumnModel",
724          "header" : "Title",
725          "width" : 75,
726          "$ renderer" : "function(v) { return String.format('{0}', v); }",
727          "$ xns" : "Roo.grid",
728          "* prop" : "colModel[]",
729          "dataIndex" : "title"
730         }
731        ]
732       }
733      ]
734     },
735     {
736      "listeners" : {
737       "render" : "function (_self)\n{\n    _this.preview_btn = _self;\n}",
738       "click" : "function (_self, e)\n{\n    //_this.dialog.hide();\n    Roo.log(_this.data.module);\n    Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });\n}"
739      },
740      "text" : "Preview",
741      "xtype" : "Button",
742      "$ xns" : "Roo",
743      "* prop" : "buttons[]"
744     },
745     {
746      "listeners" : {
747       "render" : "function (_self)\n{\n    _this.html_preview = _self;\n}",
748       "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 save the message frist!');\n        return;\n    }\n   \n    new Pman.Request({\n        url : baseURL + '/Core/MessagePreview',\n        method : 'POST',\n        mask: 'Sending',\n        params : {\n            _id : id,\n            _table : _this.data.module\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}"
749      },
750      "text" : "Send me a test copy",
751      "xtype" : "Button",
752      "$ xns" : "Roo",
753      "* prop" : "buttons[]"
754     },
755     {
756      "listeners" : {
757       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
758      },
759      "text" : "Cancel",
760      "xtype" : "Button",
761      "$ xns" : "Roo",
762      "* prop" : "buttons[]"
763     },
764     {
765      "listeners" : {
766       "click" : "function (_self, e)\n{\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}"
767      },
768      "text" : "Save",
769      "xtype" : "Button",
770      "$ xns" : "Roo",
771      "* prop" : "buttons[]"
772     }
773    ]
774   }
775  ]
776 }