Pman.Dialog.BAdminEmail.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminEmail.bjs
1 {
2  "name" : "Pman.Dialog.BAdminEmail",
3  "parent" : "",
4  "title" : "Pman.Dialog.BAdminEmail",
5  "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminEmail.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "843627586c62e389041a4d8800143974" : "Searching",
10   "2c466a2c159463f1d9ef5a7b57b52827" : "Select BCC Group",
11   "396ecabf0cd1f9503e591418851ef406" : "Edit / Create Message",
12   "3858712080cb3d846ea206d1d1070674" : "Test Class (for system reference only):",
13   "31fde7b05ac8952dacf4af8a704074ec" : "Preview",
14   "5b8ef4e762c00a15a41cfc26dc3ef99c" : "Send me a test copy",
15   "4182c8f19d40c7ca236a5f4f83faeb6b" : "Unsubscribe",
16   "b2bce8099bf8e6f51345bee5c9015c89" : "Convert HTML to Plain Text",
17   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
18   "c4ca4238a0b923820dcc509a6f75849b" : "1",
19   "1e6d57e813355689e9c77e947d73ad8f" : "From:",
20   "47a0be8d1015d526a1fbaa56c3102135" : "Subject:",
21   "5feb9bf3c03b32635135006cbacb9542" : "Insert Field",
22   "292f75d54a6892cfe18a93e64230112a" : "Mailout Name:",
23   "7038eac66e387c3b3a0834d786a88757" : "Insert Image",
24   "e71c729cd7f3c6b6ebdb447e65952dfd" : "From email address:",
25   "edddfc18b2ffb806573a1b3f341832cd" : "BCC to Group:",
26   "bd88a20b53a47f7b5704a83a15ff5506" : "Saved Version",
27   "e44b145bd8b49b06e0ad2ced1ad56466" : "Plain Text",
28   "c9cc8cce247e49bae79f15173ce97354" : "Save",
29   "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
30   "49ee3087348e8d44e1feda1917443987" : "Name",
31   "28690be026c0bb9003aa58e45e5662ca" : "Enabled - will be sent out",
32   "fb981fe689fbec75c6531eb7410971f4" : "To group:",
33   "e05f77bdf3f659c1fd354a88526c03da" : "Select Group",
34   "36a65bbd12f7586ea1f9b0be4e8848aa" : "HTML Editor"
35  },
36  "named_strings" : {
37   "description_fieldLabel" : "b5a7adde1af5c87d7fd797b6245c2a39",
38   "active_boxLabel" : "28690be026c0bb9003aa58e45e5662ca",
39   "to_group_id_name_loadingText" : "843627586c62e389041a4d8800143974",
40   "to_group_id_name_fieldLabel" : "fb981fe689fbec75c6531eb7410971f4",
41   "save_html" : "c9cc8cce247e49bae79f15173ce97354",
42   "bcc_group_id_name_placeholder" : "2c466a2c159463f1d9ef5a7b57b52827",
43   "name_fieldLabel" : "292f75d54a6892cfe18a93e64230112a",
44   "cancel_html" : "ea4788705e6873b424c65e91c2846b19",
45   "from_email_fieldLabel" : "e71c729cd7f3c6b6ebdb447e65952dfd",
46   "to_group_id_name_placeholder" : "e05f77bdf3f659c1fd354a88526c03da",
47   "preview_html" : "31fde7b05ac8952dacf4af8a704074ec",
48   "active_value" : "c4ca4238a0b923820dcc509a6f75849b",
49   "send_html" : "5b8ef4e762c00a15a41cfc26dc3ef99c",
50   "from_name_fieldLabel" : "1e6d57e813355689e9c77e947d73ad8f",
51   "bcc_group_id_name_loadingText" : "843627586c62e389041a4d8800143974",
52   "bcc_group_id_name_fieldLabel" : "edddfc18b2ffb806573a1b3f341832cd",
53   "subject_fieldLabel" : "47a0be8d1015d526a1fbaa56c3102135",
54   "test_class_fieldLabel" : "3858712080cb3d846ea206d1d1070674"
55  },
56  "items" : [
57   {
58    "listeners" : {
59     "show" : "function (_self)\n{\n\n}",
60     "render" : "function (_self)\n{\n\n}",
61     "hide" : "function (_self)\n{\n    if(_this.autosave) {\n        \n        clearInterval(_this.autosave);\n    }\n}"
62    },
63    "string fitwindow" : true,
64    "String cls" : "modal-body-enable-overflow-y",
65    "xtype" : "Modal",
66    "$ xns" : "Roo.bootstrap",
67    "String title" : "Edit / Create Message",
68    "items" : [
69     {
70      "listeners" : {
71       "click" : "function (_self, e)\n{\n    var id = _this.form.findField('id').getValue();\n    \n    if(id*1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');\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.bootstrap.MessageBox.alert(\"Email Sent\", 'The report was sent to your email (HTML format).');\n            }\n        }\n    });\n}"
72      },
73      "xtype" : "Button",
74      "$ xns" : "Roo.bootstrap",
75      "String html" : "Send me a test copy",
76      "* prop" : "buttons[]",
77      "string name" : "send",
78      "$ String weight" : "'default'"
79     },
80     {
81      "listeners" : {
82       "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });\n}"
83      },
84      "xtype" : "Button",
85      "$ xns" : "Roo.bootstrap",
86      "String html" : "Preview",
87      "* prop" : "buttons[]",
88      "string name" : "preview",
89      "$ String weight" : "'default'"
90     },
91     {
92      "listeners" : {
93       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
94      },
95      "xtype" : "Button",
96      "$ xns" : "Roo.bootstrap",
97      "String html" : "Cancel",
98      "* prop" : "buttons[]",
99      "string name" : "cancel",
100      "$ String weight" : "'default'"
101     },
102     {
103      "listeners" : {
104       "click" : "function (_self, e)\n{\n    _this.form.preValidate(function(res) {\n        if (!res) {\n            return; //failed.\n        }\n    });\n}"
105      },
106      "xtype" : "Button",
107      "$ xns" : "Roo.bootstrap",
108      "String html" : "Save",
109      "* prop" : "buttons[]",
110      "string name" : "save",
111      "$ String weight" : "'primary'"
112     },
113     {
114      "xtype" : "Container",
115      "$ xns" : "Roo.bootstrap",
116      "items" : [
117       {
118        "listeners" : {
119         "actionfailed" : "function (_self, action)\n{\n\n   var displayErr = function() {\n       if(action.result.errorMsg.length >= 200) {\n           Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg.substring(0,199) + '...');\n       } else {\n           Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n       }\n   }\n   switch(action.failureType) {\n    case Roo.form.Action.SERVER_INVALID: \n       if(action.result.errors.errcode) {\n           switch (action.result.errors.errcode) {\n               case 100:\n                   \n                   Roo.bootstrap.MessageBox.show({\n                       title: 'Confirm Save',\n                       msg: 'No member found in To Group: '+ _this.combo_to_group.getRawValue(),\n                       buttons: {yes:'OK Save anyway', no:'Change to another group'},\n                       fn: function(ret){\n                           \n                           if(ret == 'no'){\n                               return;\n                           }\n                            \n                           _this.form.findField('_ignore_group_count').setValue('1');\n                           _this.form.doAction(\"submit\");                       \n                       }\n                   });\n                 \n                   \n               break;\n               \n               default:\n                   displayErr();\n                   break;\n           }\n           return;\n       }\n       displayErr();\n       \n       break;\n    case Roo.form.Action.CLIENT_INVALID: //for validation\n       break;\n    case Roo.form.Action.CONNECT_FAILURE:\n       Roo.bootstrap.MessageBox.alert(\"Connect Error\", action.result.errorMsg);\n       break;\n    default: \n       Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n       break;\n       \n    }\n}",
120         "actioncomplete" : "function(_self,action)\n{\n   \n    if (action.type == 'setdata') {\n        \n        _this.data.module = _this.data.module || 'crm_mailing_list_message';\n        this.url = baseURL + '/Roo/' + _this.data.module;\n        \n        if(_this.data.id*1 > 0){\n            _this.dialog.el.mask(\"Loading\");\n            this.doAction(\n                'load',\n                { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}\n            );\n            return;\n        }\n        \n        //this.findField('name').setDisabled(false);\n        //this.findField('test_class').setDisabled(false);\n        \n        this.reset();\n        \n        this.findField('to_group_id').setValue(-1);\n        this.findField('bodytext').setValue('');\n        \n        this.setValues({\n            'from_name' : Pman.Login.authUser.name,\n            'from_email' : Pman.Login.authUser.email\n        });\n        \n        this.clearInvalid();\n        \n        this.hideshow();\n        \n        return;\n    }\n    \n    if (action.type == 'load') {\n        \n        /*\n        this.findField('name').setDisabled(false);\n        this.findField('test_class').setDisabled(false);\n        \n        if(action.result.data['is_system'] == 1) {\n            this.findField('name').setDisabled(true);\n            this.findField('test_class').setDisabled(true);\n        }\n        */\n        \n        _this.dialog.el.unmask();\n        \n        this.findField('bodytext').originalValue = this.findField('bodytext').getValue();\n        \n        _this.form_data = action.result.data;\n        \n        if(_this.form_data._css && _this.form_data._css.length){\n            _this.htmleditor.editorcore.setStyle(_this.form_data._css);\n        }\n        \n        this.findField('_ignore_group_count').setValue('0');\n        \n        if(!_this.form_data.description.length){\n            _this.form_data.findField('description').setValue(_this.form_data.name);\n        }\n        \n        this.hideshow();\n        \n        return;\n    }\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         \n         this.reset();\n         \n         return;\n    }\n}\n",
121         "render" : "function (_self)\n{\n    _this.form = this;\n}"
122        },
123        "| function hideshow" : "function()\n{\n    _this.to_group_row.hide();\n    \n    if (this.findField('to_group_id').getValue() == -1) {\n        return;\n    }\n    \n    _this.to_group_row.show();\n}",
124        "$ string preValidate" : "function(done_callback) {\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    \n    var nodes = [];\n    \n    s.select('img[src]').each(function(i) {\n        nodes.push(i.dom);\n    });\n    \n    \n    var total = nodes.length;\n    \n    var mkimg = function() {\n        if (!nodes.length) {\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        \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                }\n                mkimg();\n            }\n        });\n       \n    }\n    mkimg();\n}\n",
125        "xtype" : "Form",
126        "$ xns" : "Roo.bootstrap",
127        "String method" : "POST",
128        "string errorMask" : true,
129        "$ String url" : "baseURL + '/Roo/crm_mailing_list_message.php'",
130        "items" : [
131         {
132          "xtype" : "Row",
133          "$ xns" : "Roo.bootstrap",
134          "items" : [
135           {
136            "Number md" : 8,
137            "xtype" : "Column",
138            "Number xs" : 12,
139            "$ xns" : "Roo.bootstrap",
140            "items" : [
141             {
142              "Boolean allowBlank" : false,
143              "String name" : "description",
144              "xtype" : "Input",
145              "string fieldLabel" : "Description",
146              "$ xns" : "Roo.bootstrap",
147              "Number labelWidth" : 3,
148              "String indicatorpos" : "right"
149             }
150            ]
151           },
152           {
153            "Number md" : 4,
154            "xtype" : "Column",
155            "$ xns" : "Roo.bootstrap",
156            "items" : [
157             {
158              "listeners" : {
159               "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}"
160              },
161              "String name" : "active",
162              "Boolean checked" : true,
163              "xtype" : "CheckBox",
164              "String valueOff" : 0,
165              "String boxLabel" : "Enabled - will be sent out",
166              "$ xns" : "Roo.bootstrap",
167              "string value" : 1,
168              "String indicatorpos" : "right"
169             }
170            ]
171           }
172          ]
173         },
174         {
175          "xtype" : "Row",
176          "$ xns" : "Roo.bootstrap",
177          "items" : [
178           {
179            "Number md" : 6,
180            "xtype" : "Column",
181            "Number xs" : 12,
182            "$ xns" : "Roo.bootstrap",
183            "string name" : "from_name",
184            "items" : [
185             {
186              "Boolean allowBlank" : false,
187              "String name" : "from_name",
188              "xtype" : "Input",
189              "string fieldLabel" : "From:",
190              "$ xns" : "Roo.bootstrap",
191              "Number labelWidth" : 4,
192              "String indicatorpos" : "right"
193             }
194            ]
195           },
196           {
197            "Number md" : 6,
198            "xtype" : "Column",
199            "Number xs" : 12,
200            "$ xns" : "Roo.bootstrap",
201            "items" : [
202             {
203              "Boolean allowBlank" : false,
204              "String name" : "from_email",
205              "xtype" : "Input",
206              "string fieldLabel" : "From email address:",
207              "$ xns" : "Roo.bootstrap",
208              "String vtype" : "email",
209              "Number labelWidth" : 4,
210              "String indicatorpos" : "right"
211             }
212            ]
213           }
214          ]
215         },
216         {
217          "xtype" : "Row",
218          "$ xns" : "Roo.bootstrap",
219          "items" : [
220           {
221            "listeners" : {
222             "render" : "function (_self)\n{\n    _this.to_group_row = this;\n}"
223            },
224            "Number md" : 6,
225            "xtype" : "Column",
226            "Number xs" : 12,
227            "$ xns" : "Roo.bootstrap",
228            "items" : [
229             {
230              "listeners" : {
231               "render" : "function (_self)\n{\n    _this.combo_to_group = _self;\n}"
232              },
233              "Number pageSize" : 20,
234              "Boolean allowBlank" : true,
235              "String loadingText" : "Searching",
236              "String name" : "to_group_id_name",
237              "Number minChars" : 2,
238              "String valueField" : "id",
239              "Boolean typeAhead" : true,
240              "xtype" : "ComboBox",
241              "Boolean editable" : false,
242              "String triggerAction" : "all",
243              "String labelAlign" : "left",
244              "string fieldLabel" : "To group:",
245              "Boolean alwaysQuery" : true,
246              "string placeholder" : "Select Group",
247              "$ xns" : "Roo.bootstrap",
248              "Number labelWidth" : 4,
249              "String hiddenName" : "to_group_id",
250              "String displayField" : "name",
251              "Boolean forceSelection" : true,
252              "String indicatorpos" : "right",
253              "items" : [
254               {
255                "listeners" : {
256                 "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._direct_return = 1;\n}\n"
257                },
258                "$ Object sortInfo" : "{ direction : 'ASC', field: 'name' }",
259                "xtype" : "Store",
260                "boolean remoteSort" : true,
261                "$ xns" : "Roo.data",
262                "* prop" : "store",
263                "items" : [
264                 {
265                  "xtype" : "HttpProxy",
266                  "$ xns" : "Roo.data",
267                  "String method" : "GET",
268                  "* prop" : "proxy",
269                  "$ String url" : "baseURL + '/Roo/Core_group'"
270                 },
271                 {
272                  "$ Array fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]",
273                  "xtype" : "JsonReader",
274                  "String root" : "data",
275                  "$ xns" : "Roo.data",
276                  "String id" : "name",
277                  "* prop" : "reader",
278                  "String totalProperty" : "total"
279                 }
280                ]
281               }
282              ]
283             }
284            ]
285           },
286           {
287            "Number md" : 6,
288            "xtype" : "Column",
289            "Number xs" : 12,
290            "$ xns" : "Roo.bootstrap",
291            "items" : [
292             {
293              "Number pageSize" : 20,
294              "Boolean allowBlank" : true,
295              "String loadingText" : "Searching",
296              "String name" : "bcc_group_id_name",
297              "Number minChars" : 2,
298              "String valueField" : "id",
299              "Boolean typeAhead" : true,
300              "xtype" : "ComboBox",
301              "Boolean editable" : false,
302              "String triggerAction" : "all",
303              "String labelAlign" : "left",
304              "string fieldLabel" : "BCC to Group:",
305              "Boolean alwaysQuery" : true,
306              "string placeholder" : "Select BCC Group",
307              "$ xns" : "Roo.bootstrap",
308              "Number labelWidth" : 4,
309              "String hiddenName" : "bcc_group_id",
310              "String displayField" : "name",
311              "Boolean forceSelection" : true,
312              "String indicatorpos" : "right",
313              "items" : [
314               {
315                "listeners" : {
316                 "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._direct_return = 1;\n}\n"
317                },
318                "$ Object sortInfo" : "{ direction : 'ASC', field: 'name' }",
319                "xtype" : "Store",
320                "boolean remoteSort" : true,
321                "$ xns" : "Roo.data",
322                "* prop" : "store",
323                "items" : [
324                 {
325                  "xtype" : "HttpProxy",
326                  "$ xns" : "Roo.data",
327                  "String method" : "GET",
328                  "* prop" : "proxy",
329                  "$ String url" : "baseURL + '/Roo/Core_group'"
330                 },
331                 {
332                  "$ Array fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]",
333                  "xtype" : "JsonReader",
334                  "String root" : "data",
335                  "$ xns" : "Roo.data",
336                  "String id" : "name",
337                  "* prop" : "reader",
338                  "String totalProperty" : "total"
339                 }
340                ]
341               }
342              ]
343             }
344            ]
345           }
346          ]
347         },
348         {
349          "xtype" : "Row",
350          "$ xns" : "Roo.bootstrap",
351          "items" : [
352           {
353            "Number md" : 12,
354            "xtype" : "Column",
355            "Number xs" : 12,
356            "$ xns" : "Roo.bootstrap",
357            "items" : [
358             {
359              "Boolean allowBlank" : false,
360              "String name" : "subject",
361              "xtype" : "Input",
362              "string fieldLabel" : "Subject:",
363              "$ xns" : "Roo.bootstrap",
364              "Number labelWidth" : 2,
365              "String indicatorpos" : "right"
366             }
367            ]
368           }
369          ]
370         },
371         {
372          "xtype" : "Row",
373          "$ xns" : "Roo.bootstrap",
374          "items" : [
375           {
376            "Number md" : 12,
377            "xtype" : "Column",
378            "$ xns" : "Roo.bootstrap",
379            "items" : [
380             {
381              "String header" : "HTML Editor",
382              "xtype" : "Container",
383              "String panel" : "default",
384              "$ xns" : "Roo.bootstrap",
385              "items" : [
386               {
387                "listeners" : {
388                 "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 : 'core_email',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
389                 "render" : "function (_self)\n{\n    _this.htmleditor = this;\n}",
390                 "autosave" : "function (_self)\n{\n    Roo.log('autosave');\n    \n    var id = _this.form.findField('id').getValue() * 1;\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}"
391                },
392                "String name" : "bodytext",
393                "String bodyCls" : "roo-email",
394                "xtype" : "HtmlEditor",
395                "$ xns" : "Roo.bootstrap",
396                "Array stylesheets" : "",
397                "items" : [
398                 {
399                  "listeners" : {
400                   "click" : "function (_self, e)\n{\n    if (!_this.form.findField('bodytext').editorcore.activated) {\n        Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');\n        return;\n    }\n    \n    var id = _this.form.findField('id').getValue();\n    \n    if(id*1 < 1){\n        Roo.bootstrap.MessageBox.alert('Cannot add any image', '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.BAdminImageManager.show({\n        onid: id,\n        ontable: ontable\n    }, function(img){\n        _this.form.findField('bodytext').editorcore.insertAtCursor(\n            String.format(\n                '<img src=\"{0}/Images/{1}/{2}#image-{1}\" height=\"{3}\" width=\"{4}\" alt=\"{5}\" align=\"{6}\">',\n                baseURL,\n                img.id,\n                img.filename,\n                img.height,\n                img.width,\n                img.alt,\n                img.align\n            )\n        )\n    });\n    \n}"
401                  },
402                  "Boolean toggle" : false,
403                  "xtype" : "Button",
404                  "$ xns" : "Roo.bootstrap",
405                  "String glyphicon" : "camera",
406                  "String html" : "Insert Image",
407                  "* prop" : "btns[]"
408                 },
409                 {
410                  "Boolean toggle" : false,
411                  "$ String glyphicon" : "'tag'",
412                  "xtype" : "Button",
413                  "$ xns" : "Roo.bootstrap",
414                  "String html" : "Insert Field",
415                  "* prop" : "btns[]",
416                  "items" : [
417                   {
418                    "xtype" : "Menu",
419                    "$ xns" : "Roo.bootstrap",
420                    "* prop" : "menu",
421                    "items" : [
422                     {
423                      "listeners" : {
424                       "click" : "function (_self, e)\n{\n    if (!_this.form.findField('bodytext').editorcore.activated) {\n        Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');\n        return;\n    }\n    \n    _this.form.findField('bodytext').editorcore.insertAtCursor(\n        String.format('{0}',\n            '{person.name}'\n        )\n    );\n}"
425                      },
426                      "xtype" : "MenuItem",
427                      "$ xns" : "Roo.bootstrap",
428                      "String html" : "Name"
429                     },
430                     {
431                      "listeners" : {
432                       "click" : "function (_self, e)\n{\n    if (!_this.form.findField('bodytext').editorcore.activated) {\n        Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');\n        return;\n    }\n    \n    _this.form.findField('bodytext').editorcore.insertAtCursor(\n        String.format('<a href=\"{0}\">{1}</a>',\n            '#unsubscribe',  \"Unsubscribe\"\n        )\n    );\n}"
433                      },
434                      "xtype" : "MenuItem",
435                      "$ xns" : "Roo.bootstrap",
436                      "String html" : "Unsubscribe"
437                     }
438                    ]
439                   }
440                  ]
441                 },
442                 {
443                  "listeners" : {
444                   "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}"
445                  },
446                  "Boolean toggle" : false,
447                  "$ String glyphicon" : "'refresh'",
448                  "xtype" : "Button",
449                  "$ xns" : "Roo.bootstrap",
450                  "String html" : "Convert HTML to Plain Text",
451                  "* prop" : "btns[]"
452                 },
453                 {
454                  "listeners" : {
455                   "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n}"
456                  },
457                  "Boolean toggle" : false,
458                  "$ String glyphicon" : "'floppy-disk'",
459                  "xtype" : "Button",
460                  "$ xns" : "Roo.bootstrap",
461                  "String html" : "Saved Version",
462                  "* prop" : "btns[]"
463                 }
464                ]
465               }
466              ]
467             }
468            ]
469           }
470          ]
471         },
472         {
473          "listeners" : {
474           "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}"
475          },
476          "xtype" : "Row",
477          "$ xns" : "Roo.bootstrap",
478          "items" : [
479           {
480            "Number md" : 12,
481            "xtype" : "Column",
482            "$ xns" : "Roo.bootstrap",
483            "items" : [
484             {
485              "String header" : "Plain Text",
486              "$ String panel" : "'default'",
487              "xtype" : "Container",
488              "$ xns" : "Roo.bootstrap",
489              "items" : [
490               {
491                "String name" : "plaintext",
492                "xtype" : "TextArea",
493                "$ xns" : "Roo.bootstrap"
494               }
495              ]
496             }
497            ]
498           }
499          ]
500         },
501         {
502          "xtype" : "Row",
503          "$ xns" : "Roo.bootstrap",
504          "items" : [
505           {
506            "Number md" : 6,
507            "xtype" : "Column",
508            "$ xns" : "Roo.bootstrap",
509            "items" : [
510             {
511              "Boolean allowBlank" : false,
512              "String name" : "name",
513              "xtype" : "Input",
514              "string fieldLabel" : "Mailout Name:",
515              "String labelAlign" : "top",
516              "Boolean disabled" : true,
517              "$ xns" : "Roo.bootstrap",
518              "String indicatorpos" : "right"
519             }
520            ]
521           },
522           {
523            "Number md" : 6,
524            "xtype" : "Column",
525            "$ xns" : "Roo.bootstrap",
526            "items" : [
527             {
528              "String name" : "test_class",
529              "xtype" : "Input",
530              "string fieldLabel" : "Test Class (for system reference only):",
531              "String labelAlign" : "top",
532              "Boolean disabled" : true,
533              "$ xns" : "Roo.bootstrap"
534             }
535            ]
536           }
537          ]
538         },
539         {
540          "String name" : "id",
541          "xtype" : "Input",
542          "String inputType" : "hidden",
543          "$ xns" : "Roo.bootstrap",
544          "Number labelWidth" : 3
545         },
546         {
547          "String name" : "_ignore_group_count",
548          "xtype" : "Input",
549          "String inputType" : "hidden",
550          "$ xns" : "Roo.bootstrap",
551          "Number labelWidth" : 3
552         }
553        ]
554       }
555      ]
556     }
557    ]
558   }
559  ]
560 }