fix #8131 - chinese translations
[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   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
32   "68b00d723d37122f64da8d9939f836f0" : "BCC Group",
33   "c4ca4238a0b923820dcc509a6f75849b" : "1",
34   "4994a8ffeba4ac3140beb89e8d41f174" : "Language",
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   "template_fieldLabel" : "278c491bdd8a53618c149c4ac790da34",
53   "name_fieldLabel" : "b20a8b77b05d53b4e695738731400c85",
54   "bcc_group_id_name_qtip" : "2c466a2c159463f1d9ef5a7b57b52827",
55   "bcc_group_id_name_emptyText" : "2c466a2c159463f1d9ef5a7b57b52827",
56   "language_name_fieldLabel" : "4994a8ffeba4ac3140beb89e8d41f174",
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      "$ xns" : "Roo",
86      "tabPosition" : "top",
87      "* prop" : "center"
88     },
89     {
90      "hidden" : true,
91      "xtype" : "LayoutRegion",
92      "title" : "Images / Attachments",
93      "width" : 500,
94      "$ xns" : "Roo",
95      "split" : true,
96      "* prop" : "east",
97      "titlebar" : true
98     },
99     {
100      "autoScroll" : false,
101      "region" : "center",
102      "fitToFrame" : true,
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              "method" : "GET",
204              "xtype" : "HttpProxy",
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          "fitToFrame" : true,
253          "background" : false,
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            "labelAlign" : "right",
266            "$ 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",
267            "$ url" : "baseURL + '/Roo/crm_mailing_list_message.php'",
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                "String labelSeparator" : " ",
290                "Number labelWidth" : 0,
291                "items" : [
292                 {
293                  "listeners" : {
294                   "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}"
295                  },
296                  "String name" : "active",
297                  "Boolean checked" : true,
298                  "xtype" : "Checkbox",
299                  "String valueOff" : 0,
300                  "String boxLabel" : "Enabled - will be sent out",
301                  "$ xns" : "Roo.form",
302                  "Mixed value" : 1
303                 }
304                ]
305               }
306              ]
307             },
308             {
309              "xtype" : "Row",
310              "$ xns" : "Roo.form",
311              "items" : [
312               {
313                "fieldLabel" : "From",
314                "xtype" : "TextField",
315                "allowBlank" : false,
316                "width" : 300,
317                "$ xns" : "Roo.form",
318                "name" : "from_name"
319               },
320               {
321                "fieldLabel" : "Email address",
322                "xtype" : "TextField",
323                "allowBlank" : false,
324                "width" : 300,
325                "$ xns" : "Roo.form",
326                "name" : "from_email"
327               },
328               {
329                "alwaysQuery" : true,
330                "triggerAction" : "all",
331                "fieldLabel" : "BCC Group",
332                "forceSelection" : true,
333                "selectOnFocus" : true,
334                "pageSize" : 25,
335                "displayField" : "name",
336                "emptyText" : "Select BCC Group",
337                "hiddenName" : "bcc_group_id",
338                "minChars" : 2,
339                "valueField" : "id",
340                "xtype" : "ComboBox",
341                "allowBlank" : true,
342                "typeAhead" : true,
343                "editable" : false,
344                "width" : 300,
345                "$ xns" : "Roo.form",
346                "name" : "bcc_group_id_name",
347                "qtip" : "Select BCC Group",
348                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
349                "loadingText" : "Searching...",
350                "Boolean forceSelection" : true,
351                "items" : [
352                 {
353                  "listeners" : {
354                   "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._direct_return = 1;\n}\n"
355                  },
356                  "xtype" : "Store",
357                  "remoteSort" : true,
358                  "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
359                  "$ xns" : "Roo.data",
360                  "* prop" : "store",
361                  "items" : [
362                   {
363                    "$ url" : "baseURL + '/Roo/Core_group'",
364                    "xtype" : "HttpProxy",
365                    "method" : "GET",
366                    "$ xns" : "Roo.data",
367                    "* prop" : "proxy"
368                   },
369                   {
370                    "id" : "name",
371                    "root" : "data",
372                    "xtype" : "JsonReader",
373                    "$ fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]",
374                    "$ xns" : "Roo.data",
375                    "* prop" : "reader",
376                    "totalProperty" : "total"
377                   }
378                  ]
379                 }
380                ]
381               }
382              ]
383             },
384             {
385              "xtype" : "Row",
386              "$ xns" : "Roo.form",
387              "items" : [
388               {
389                "fieldLabel" : "Subject",
390                "xtype" : "TextField",
391                "allowBlank" : false,
392                "width" : 600,
393                "$ xns" : "Roo.form",
394                "name" : "subject"
395               },
396               {
397                "listWidth" : 200,
398                "triggerAction" : "all",
399                "fieldLabel" : "Language",
400                "displayField" : "title",
401                "hiddenName" : "language",
402                "valueField" : "code",
403                "xtype" : "ComboBox",
404                "allowBlank" : false,
405                "editable" : false,
406                "width" : 200,
407                "$ xns" : "Roo.form",
408                "mode" : "local",
409                "name" : "language_name",
410                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
411                "items" : [
412                 {
413                  "| data" : "(function() {return typeof(Pman) == 'object'  ? Pman.I18n.simpleStoreData('l') : []})()",
414                  "xtype" : "SimpleStore",
415                  "$ fields" : "['code', 'title']",
416                  "$ xns" : "Roo.data",
417                  "* prop" : "store"
418                 }
419                ]
420               }
421              ]
422             },
423             {
424              "hideLabels" : true,
425              "xtype" : "Row",
426              "$ xns" : "Roo.form",
427              "items" : [
428               {
429                "hideLabels" : true,
430                "legend" : "Html Editor",
431                "style" : "text-align:center;",
432                "xtype" : "FieldSet",
433                "$ xns" : "Roo.form",
434                "items" : [
435                 {
436                  "listeners" : {
437                   "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}",
438                   "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}"
439                  },
440                  "bool allowComments" : true,
441                  "xtype" : "HtmlEditor",
442                  "| 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",
443                  "$ 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 ]",
444                  "boolean autoClean" : false,
445                  "$ xns" : "Roo.form",
446                  "resizable" : "s",
447                  "boolean enableBlocks" : false,
448                  "name" : "bodytext",
449                  "height" : 250,
450                  "clearUp" : false,
451                  "items" : [
452                   {
453                    "xtype" : "ToolbarContext",
454                    "$ xns" : "Roo.form.HtmlEditor",
455                    "* prop" : "toolbars[]"
456                   },
457                   {
458                    "xtype" : "ToolbarStandard",
459                    "$ xns" : "Roo.form.HtmlEditor",
460                    "* prop" : "toolbars[]",
461                    "items" : [
462                     {
463                      "listeners" : {
464                       "render" : "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
465                       "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}",
466                       "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 }"
467                      },
468                      "alwaysQuery" : true,
469                      "listWidth" : 400,
470                      "triggerAction" : "all",
471                      "fieldLabel" : "Images",
472                      "forceSelection" : true,
473                      "selectOnFocus" : true,
474                      "pageSize" : 20,
475                      "displayField" : "name",
476                      "emptyText" : "Add Image",
477                      "minChars" : 2,
478                      "valueField" : "id",
479                      "xtype" : "ComboBox",
480                      "typeAhead" : true,
481                      "editable" : false,
482                      "width" : 100,
483                      "$ xns" : "Roo.form",
484                      "* prop" : "btns[]",
485                      "qtip" : "Select Images",
486                      "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>",
487                      "loadingText" : "Searching...",
488                      "items" : [
489                       {
490                        "listeners" : {
491                         "|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"
492                        },
493                        "xtype" : "Store",
494                        "remoteSort" : true,
495                        "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
496                        "$ xns" : "Roo.data",
497                        "* prop" : "store",
498                        "items" : [
499                         {
500                          "$ url" : "baseURL + '/Roo/Images.php'",
501                          "xtype" : "HttpProxy",
502                          "method" : "GET",
503                          "$ xns" : "Roo.data",
504                          "* prop" : "proxy"
505                         },
506                         {
507                          "id" : "id",
508                          "root" : "data",
509                          "xtype" : "JsonReader",
510                          "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
511                          "$ xns" : "Roo.data",
512                          "* prop" : "reader",
513                          "totalProperty" : "total"
514                         }
515                        ]
516                       }
517                      ]
518                     },
519                     {
520                      "listeners" : {
521                       "render" : "function (_self)\n{\n    _this.unsubscribeselect = _self;\n}",
522                       "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 }"
523                      },
524                      "alwaysQuery" : true,
525                      "listWidth" : 400,
526                      "triggerAction" : "all",
527                      "fieldLabel" : "Field",
528                      "forceSelection" : true,
529                      "selectOnFocus" : true,
530                      "pageSize" : 20,
531                      "displayField" : "name",
532                      "emptyText" : "Insert Field",
533                      "minChars" : 2,
534                      "valueField" : "type",
535                      "xtype" : "ComboBox",
536                      "typeAhead" : true,
537                      "editable" : false,
538                      "width" : 100,
539                      "$ xns" : "Roo.form",
540                      "* prop" : "btns[]",
541                      "qtip" : "Insert Field",
542                      "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
543                      "loadingText" : "Searching...",
544                      "items" : [
545                       {
546                        "xtype" : "SimpleStore",
547                        "$ data" : "[ \n    [ '{person.firstname}', \"First Name\"],\n    [ '{person.lastname}' , \"Last Name\"],\n    [ '{person.name}', \"Full Name\"],\n    [ '#unsubscribe', \"Unsubscribe\"]\n]\n",
548                        "$ fields" : "[  'type', 'name']",
549                        "$ xns" : "Roo.data",
550                        "* prop" : "store"
551                       }
552                      ]
553                     },
554                     {
555                      "xtype" : "Separator",
556                      "$ xns" : "Roo.Toolbar",
557                      "* prop" : "btns[]"
558                     },
559                     {
560                      "listeners" : {
561                       "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n    \n}"
562                      },
563                      "String cls" : "x-init-enable",
564                      "text" : "Saved Version",
565                      "xtype" : "Button",
566                      "$ xns" : "Roo.Toolbar",
567                      "* prop" : "btns[]"
568                     }
569                    ]
570                   }
571                  ]
572                 }
573                ]
574               }
575              ]
576             },
577             {
578              "hideLabels" : true,
579              "xtype" : "Row",
580              "$ xns" : "Roo.form",
581              "items" : [
582               {
583                "listeners" : {
584                 "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}"
585                },
586                "text" : "Convert Html to Text",
587                "xtype" : "Button",
588                "$ xns" : "Roo"
589               }
590              ]
591             },
592             {
593              "hideLabels" : true,
594              "xtype" : "Row",
595              "$ xns" : "Roo.form",
596              "items" : [
597               {
598                "hideLabels" : true,
599                "legend" : "Plain Text",
600                "style" : "text-align:center;",
601                "xtype" : "FieldSet",
602                "$ xns" : "Roo.form",
603                "items" : [
604                 {
605                  "xtype" : "TextArea",
606                  "$ xns" : "Roo.form",
607                  "height" : 50,
608                  "name" : "plaintext"
609                 }
610                ]
611               }
612              ]
613             },
614             {
615              "xtype" : "Row",
616              "$ xns" : "Roo.form",
617              "items" : [
618               {
619                "fieldLabel" : "Test Class <BR/> (for system reference only)",
620                "Boolean readOnly" : true,
621                "xtype" : "TextField",
622                "allowBlank" : true,
623                "width" : 300,
624                "$ xns" : "Roo.form",
625                "name" : "test_class"
626               }
627              ]
628             },
629             {
630              "xtype" : "Hidden",
631              "$ xns" : "Roo.form",
632              "name" : "id"
633             }
634            ]
635           }
636          ]
637         }
638        ]
639       }
640      ]
641     },
642     {
643      "listeners" : {
644       "|activate" : "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       _this.igrid.ds.load({});\n    }\n}"
645      },
646      "autoScroll" : false,
647      "fitToframe" : true,
648      "background" : false,
649      "region" : "east",
650      "title" : "Images / Attachments",
651      "xtype" : "GridPanel",
652      "fitContainer" : true,
653      "$ xns" : "Roo",
654      "tableName" : "Images",
655      "items" : [
656       {
657        "listeners" : {
658         "|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}"
659        },
660        "autoExpandColumn" : "filename",
661        "xtype" : "Grid",
662        "loadMask" : true,
663        "$ xns" : "Roo.grid",
664        "* prop" : "grid",
665        "items" : [
666         {
667          "listeners" : {
668           "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}"
669          },
670          "xtype" : "Store",
671          "remoteSort" : true,
672          "$ sortInfo" : "{ field : 'filename', direction: 'ASC' }",
673          "$ xns" : "Roo.data",
674          "* prop" : "dataSource",
675          "items" : [
676           {
677            "$ url" : "baseURL + '/Roo/Images.php'",
678            "xtype" : "HttpProxy",
679            "method" : "GET",
680            "$ xns" : "Roo.data",
681            "* prop" : "proxy"
682           },
683           {
684            "id" : "id",
685            "root" : "data",
686            "xtype" : "JsonReader",
687            "$ 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]",
688            "$ xns" : "Roo.data",
689            "* prop" : "reader",
690            "totalProperty" : "total"
691           }
692          ]
693         },
694         {
695          "xtype" : "Toolbar",
696          "$ xns" : "Roo",
697          "* prop" : "toolbar",
698          "items" : [
699           {
700            "listeners" : {
701             "|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"
702            },
703            "text" : "Add",
704            "xtype" : "Button",
705            "cls" : "x-btn-text-icon",
706            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
707            "$ xns" : "Roo.Toolbar"
708           },
709           {
710            "listeners" : {
711             "|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        "
712            },
713            "text" : "Delete",
714            "xtype" : "Button",
715            "cls" : "x-btn-text-icon",
716            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
717            "$ xns" : "Roo.Toolbar"
718           }
719          ]
720         },
721         {
722          "xtype" : "ColumnModel",
723          "width" : 300,
724          "header" : "Filename",
725          "$ 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}",
726          "$ xns" : "Roo.grid",
727          "* prop" : "colModel[]",
728          "dataIndex" : "filename"
729         },
730         {
731          "xtype" : "ColumnModel",
732          "header" : "Displayorder",
733          "width" : 75,
734          "$ renderer" : "function(v) { return String.format('{0}', v); }",
735          "$ xns" : "Roo.grid",
736          "* prop" : "colModel[]",
737          "dataIndex" : "displayorder"
738         },
739         {
740          "xtype" : "ColumnModel",
741          "width" : 75,
742          "header" : "Title",
743          "$ renderer" : "function(v) { return String.format('{0}', v); }",
744          "$ xns" : "Roo.grid",
745          "* prop" : "colModel[]",
746          "dataIndex" : "title"
747         }
748        ]
749       }
750      ]
751     },
752     {
753      "listeners" : {
754       "render" : "function (_self)\n{\n    _this.preview_btn = _self;\n}",
755       "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}"
756      },
757      "text" : "Preview",
758      "xtype" : "Button",
759      "$ xns" : "Roo",
760      "* prop" : "buttons[]"
761     },
762     {
763      "listeners" : {
764       "render" : "function (_self)\n{\n    _this.html_preview = _self;\n}",
765       "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}"
766      },
767      "text" : "Send me a test copy",
768      "xtype" : "Button",
769      "$ xns" : "Roo",
770      "* prop" : "buttons[]"
771     },
772     {
773      "listeners" : {
774       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
775      },
776      "text" : "Cancel",
777      "xtype" : "Button",
778      "$ xns" : "Roo",
779      "* prop" : "buttons[]"
780     },
781     {
782      "listeners" : {
783       "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}"
784      },
785      "text" : "Save",
786      "xtype" : "Button",
787      "$ xns" : "Roo",
788      "* prop" : "buttons[]"
789     }
790    ]
791   }
792  ]
793 }