Pman.Dialog.BAdminEmail.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminEmail.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.BAdminEmail= function() {}
8 Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
9
10  _strings : {
11   '843627586c62e389041a4d8800143974' :"Searching",
12   '2c466a2c159463f1d9ef5a7b57b52827' :"Select BCC Group",
13   '396ecabf0cd1f9503e591418851ef406' :"Edit / Create Message",
14   '3858712080cb3d846ea206d1d1070674' :"Test Class (for system reference only):",
15   '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
16   '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
17   '0a5fecb1d88a50f47cc2ed2fd985c304' :"BCC Group:",
18   '4182c8f19d40c7ca236a5f4f83faeb6b' :"Unsubscribe",
19   'b2bce8099bf8e6f51345bee5c9015c89' :"Convert HTML to Plain Text",
20   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
21   'c4ca4238a0b923820dcc509a6f75849b' :"1",
22   '1e6d57e813355689e9c77e947d73ad8f' :"From:",
23   '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
24   '47a0be8d1015d526a1fbaa56c3102135' :"Subject:",
25   '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
26   '7038eac66e387c3b3a0834d786a88757' :"Insert Image",
27   'e71c729cd7f3c6b6ebdb447e65952dfd' :"From email address:",
28   'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
29   'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
30   'c9cc8cce247e49bae79f15173ce97354' :"Save",
31   '49ee3087348e8d44e1feda1917443987' :"Name",
32   'fb981fe689fbec75c6531eb7410971f4' :"To group:",
33   'e05f77bdf3f659c1fd354a88526c03da' :"Select Group",
34   '36a65bbd12f7586ea1f9b0be4e8848aa' :"HTML Editor"
35  },
36
37  dialog : false,
38  callback:  false,
39
40  show : function(data, cb)
41  {
42   if (!this.dialog) {
43    this.create();
44   }
45
46   this.callback = cb;
47   this.data = data;
48   this.dialog.show(this.data._el);
49   if (this.form) {
50    this.form.reset();
51    this.form.setValues(data);
52    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
53   }
54
55  },
56
57  create : function()
58  {
59   var _this = this;
60   this.dialog = Roo.factory({
61     xtype : 'Modal',
62     cls : 'modal-body-enable-overflow-y',
63     fitwindow : true,
64     title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
65     listeners : {
66      hide : function (_self)
67       {
68           if(_this.autosave) {
69               
70               clearInterval(_this.autosave);
71           }
72       },
73      render : function (_self)
74       {
75       
76       },
77      show : function (_self)
78       {
79       
80       }
81     },
82     xns : Roo.bootstrap,
83     '|xns' : 'Roo.bootstrap',
84     buttons : [
85      {
86       xtype : 'Button',
87       html : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
88       name : 'send',
89       weight : 'default',
90       listeners : {
91        click : function (_self, e)
92         {
93             //_this.dialog.hide();
94         
95             var id = _this.form.findField('id').getValue();
96             
97             if(id*1 < 1){
98                 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
99                 return;
100             }
101            
102             new Pman.Request({
103                 url : baseURL + '/Core/MessagePreview',
104                 method : 'POST',
105                 mask: 'Sending',
106                 params : {
107                     _id : id,
108                     _table : _this.data.module
109                 }, 
110                 success : function(res) {
111                     if(res.data == 'SUCCESS'){
112                         Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
113                     }
114                 }
115             });
116         }
117       },
118       xns : Roo.bootstrap,
119       '|xns' : 'Roo.bootstrap'
120      },
121      {
122       xtype : 'Button',
123       html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
124       name : 'preview',
125       weight : 'default',
126       listeners : {
127        click : function (_self, e)
128         {
129             Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
130         }
131       },
132       xns : Roo.bootstrap,
133       '|xns' : 'Roo.bootstrap'
134      },
135      {
136       xtype : 'Button',
137       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
138       name : 'cancel',
139       weight : 'default',
140       listeners : {
141        click : function (_self, e)
142         {
143             _this.dialog.hide();
144         }
145       },
146       xns : Roo.bootstrap,
147       '|xns' : 'Roo.bootstrap'
148      },
149      {
150       xtype : 'Button',
151       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
152       name : 'save',
153       weight : 'primary',
154       listeners : {
155        click : function (_self, e)
156         {
157             _this.form.preValidate(function(res) {
158                 if (!res) {
159                     return; //failed.
160                 }
161             });
162         }
163       },
164       xns : Roo.bootstrap,
165       '|xns' : 'Roo.bootstrap'
166      }
167     ],
168     items  : [
169      {
170       xtype : 'Container',
171       xns : Roo.bootstrap,
172       '|xns' : 'Roo.bootstrap',
173       items  : [
174        {
175         xtype : 'Form',
176         errorMask : true,
177         hideshow : function()
178         {
179             if (this.findField('to_group').getValue() == -1) {
180                 _this.to_group_row.hide();
181             } else {
182                 _this.to_group_row.show();
183             }
184         },
185         method : 'POST',
186         preValidate : function(done_callback) {
187             
188             if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
189                 _this.form.findField('bodytext').syncValue();
190             }else{
191                 _this.form.findField('bodytext').pushValue();
192             }
193             
194             var html = _this.form.findField('bodytext').getValue();
195             
196             var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
197             
198             var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
199             
200             
201             var nodes = [];
202             
203             s.select('img[src]').each(function(i) {
204                 nodes.push(i.dom);
205             });
206             
207             
208             var total = nodes.length;
209             
210             var mkimg = function() {
211                 if (!nodes.length) {
212                       _this.form.findField('bodytext').syncValue();
213                       done_callback(true);
214                       _this.form.doAction("submit");
215                       return;
216                 }
217                 var i = nodes.pop(); 
218                 
219                 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
220                 
221                 if(n){
222                     mkimg();
223                     return;
224                 }
225                 
226                 n = i.getAttribute('src').match(/^http(.*)/);
227                
228                 if(!n ){
229                     mkimg();
230                     return;
231                 }
232                 
233                 
234                 
235                 new Pman.Request({
236                     url : baseURL + '/Roo/Images.php',
237                     method : 'POST',
238                     params : {
239                         onid : _this.form.findField('id').getValue(),
240                         ontable : ontable ,
241                         _remote_upload : i.src
242                     },
243                     success : function(res){
244                         if(res.success == true){      
245                             i.setAttribute('src', res.data);
246                         }
247                         mkimg();
248                     }
249                 });
250                
251             }
252             mkimg();
253         },
254         url : baseURL + '/Roo/crm_mailing_list_message.php',
255         listeners : {
256          actioncomplete : function(_self,action)
257           {
258              
259               if (action.type == 'setdata') {
260                   
261                   _this.data.module = _this.data.module || 'crm_mailing_list_message';
262                   this.url = baseURL + '/Roo/' + _this.data.module;
263                   
264                   if(_this.data.id*1 > 0){
265                       _this.dialog.el.mask("Loading");
266                       this.doAction(
267                           'load',
268                           { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
269                       );
270                       return;
271                   }
272                   
273                   this.findField('name').setDisabled(false);
274                   this.findField('test_class').setDisabled(false);
275                   
276                   this.reset();
277                   
278                   this.findField('to_group').setValue(-1);
279                   this.findField('bodytext').setValue('');
280                   
281                   this.setValues({
282                       'from_name' : Pman.Login.authUser.name,
283                       'from_email' : Pman.Login.authUser.email
284                   });
285                   
286                   this.clearInvalid();
287                   
288                   this.hideshow();
289                   
290                   return;
291               }
292               
293               if (action.type == 'load') {
294                   
295                   this.findField('name').setDisabled(false);
296                   this.findField('test_class').setDisabled(false);
297                   
298                   if(action.result.data['is_system'] == 1) {
299                       this.findField('name').setDisabled(true);
300                       this.findField('test_class').setDisabled(true);
301                   }
302                   
303                   _this.dialog.el.unmask();
304                   
305                   this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
306                   
307                   _this.form_data = action.result.data;
308                   this.findField('_ignore_group_count').setValue('0');
309                   this.hideshow();
310                   
311                   return;
312               }
313               
314               if (action.type =='submit') {
315               
316                   _this.dialog.el.unmask();
317                   _this.dialog.hide();
318                   
319                    if (_this.callback) {
320                       _this.callback.call(_this, action.result.data);
321                    }
322                    
323                    this.reset();
324                    
325                    return;
326               }
327           },
328          actionfailed : function (_self, action)
329           {
330           
331              var displayErr = function() {
332                  if(action.result.errorMsg.length >= 200) {
333                      Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
334                  } else {
335                      Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
336                  }
337              }
338              switch(action.failureType) {
339               case Roo.form.Action.SERVER_INVALID: 
340                  if(action.result.errors.errcode) {
341                      switch (action.result.errors.errcode) {
342                          case 100:
343                              Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
344                                  if(ret == 'no'){
345                                      return;
346                                  }
347                                  _this.form.findField('_ignore_group_count').setValue('1');
348                                  _this.form.doAction("submit");                       
349                              }, this);
350                          break;
351                          
352                          default:
353                              displayErr();
354                              break;
355                      }
356                      return;
357                  }
358                  displayErr();
359                  
360                  break;
361               case Roo.form.Action.CLIENT_INVALID: //for validation
362                  break;
363               case Roo.form.Action.CONNECT_FAILURE:
364                  Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
365                  break;
366               default: 
367                  Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
368                  break;
369                  
370               }
371           },
372          render : function (_self)
373           {
374               _this.form = this;
375           }
376         },
377         xns : Roo.bootstrap,
378         '|xns' : 'Roo.bootstrap',
379         items  : [
380          {
381           xtype : 'Row',
382           xns : Roo.bootstrap,
383           '|xns' : 'Roo.bootstrap',
384           items  : [
385            {
386             xtype : 'Column',
387             md : 8,
388             xs : 12,
389             xns : Roo.bootstrap,
390             '|xns' : 'Roo.bootstrap',
391             items  : [
392              {
393               xtype : 'Input',
394               allowBlank : false,
395               fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
396               indicatorpos : 'right',
397               labelWidth : 3,
398               name : 'name',
399               xns : Roo.bootstrap,
400               '|xns' : 'Roo.bootstrap'
401              }
402             ]
403            },
404            {
405             xtype : 'Column',
406             md : 4,
407             xns : Roo.bootstrap,
408             '|xns' : 'Roo.bootstrap',
409             items  : [
410              {
411               xtype : 'CheckBox',
412               boxLabel : 'Enabled - will be sent out',
413               checked : true,
414               indicatorpos : 'right',
415               name : 'active',
416               value : 1,
417               valueOff : 0,
418               listeners : {
419                check : function (_self, checked)
420                 {
421                     var boxLabel = 'Enabled - will be sent out';
422                     
423                     if(!checked){
424                         boxLabel = 'Disabled - will NOT be sent out';
425                     }
426                     
427                     //this.setBoxLabel(boxLabel);
428                 }
429               },
430               xns : Roo.bootstrap,
431               '|xns' : 'Roo.bootstrap'
432              }
433             ]
434            }
435           ]
436          },
437          {
438           xtype : 'Row',
439           xns : Roo.bootstrap,
440           '|xns' : 'Roo.bootstrap',
441           items  : [
442            {
443             xtype : 'Column',
444             md : 6,
445             name : 'from_name',
446             xs : 12,
447             xns : Roo.bootstrap,
448             '|xns' : 'Roo.bootstrap',
449             items  : [
450              {
451               xtype : 'Input',
452               allowBlank : false,
453               fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
454               indicatorpos : 'right',
455               labelWidth : 4,
456               name : 'from_name',
457               xns : Roo.bootstrap,
458               '|xns' : 'Roo.bootstrap'
459              }
460             ]
461            },
462            {
463             xtype : 'Column',
464             md : 6,
465             xs : 12,
466             xns : Roo.bootstrap,
467             '|xns' : 'Roo.bootstrap',
468             items  : [
469              {
470               xtype : 'Input',
471               allowBlank : false,
472               fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
473               indicatorpos : 'right',
474               labelWidth : 4,
475               name : 'from_email',
476               vtype : 'email',
477               xns : Roo.bootstrap,
478               '|xns' : 'Roo.bootstrap'
479              }
480             ]
481            }
482           ]
483          },
484          {
485           xtype : 'Row',
486           listeners : {
487            render : function (_self)
488             {
489                 _this.to_group_row = this;
490             }
491           },
492           xns : Roo.bootstrap,
493           '|xns' : 'Roo.bootstrap',
494           items  : [
495            {
496             xtype : 'Column',
497             md : 6,
498             xs : 12,
499             xns : Roo.bootstrap,
500             '|xns' : 'Roo.bootstrap',
501             items  : [
502              {
503               xtype : 'ComboBox',
504               allowBlank : true,
505               alwaysQuery : true,
506               displayField : 'name',
507               editable : false,
508               fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
509               forceSelection : true,
510               hiddenName : 'to_group',
511               labelAlign : 'left',
512               labelWidth : 4,
513               loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
514               minChars : 2,
515               name : 'to_group_name',
516               pageSize : 20,
517               placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
518               triggerAction : 'all',
519               typeAhead : true,
520               valueField : 'id',
521               listeners : {
522                render : function (_self)
523                 {
524                     _this.combo_to_group = _self;
525                 }
526               },
527               xns : Roo.bootstrap,
528               '|xns' : 'Roo.bootstrap',
529               store : {
530                xtype : 'Store',
531                remoteSort : true,
532                sortInfo : { direction : 'ASC', field: 'name' },
533                listeners : {
534                 beforeload : function (_self, o){
535                      o.params = o.params || {};
536                      
537                      o.params._direct_return = 1;
538                  }
539                },
540                xns : Roo.data,
541                '|xns' : 'Roo.data',
542                proxy : {
543                 xtype : 'HttpProxy',
544                 method : 'GET',
545                 url : baseURL + '/Roo/Core_group',
546                 xns : Roo.data,
547                 '|xns' : 'Roo.data'
548                },
549                reader : {
550                 xtype : 'JsonReader',
551                 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
552                 id : 'name',
553                 root : 'data',
554                 totalProperty : 'total',
555                 xns : Roo.data,
556                 '|xns' : 'Roo.data'
557                }
558               }
559              }
560             ]
561            },
562            {
563             xtype : 'Column',
564             md : 6,
565             xs : 12,
566             xns : Roo.bootstrap,
567             '|xns' : 'Roo.bootstrap',
568             items  : [
569              {
570               xtype : 'ComboBox',
571               allowBlank : true,
572               alwaysQuery : true,
573               displayField : 'name',
574               editable : false,
575               fieldLabel : _this._strings['0a5fecb1d88a50f47cc2ed2fd985c304'] /* BCC Group: */,
576               forceSelection : true,
577               hiddenName : 'bcc_group',
578               labelAlign : 'left',
579               labelWidth : 4,
580               loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
581               minChars : 2,
582               name : 'bcc_group_name',
583               pageSize : 20,
584               placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
585               triggerAction : 'all',
586               typeAhead : true,
587               valueField : 'id',
588               xns : Roo.bootstrap,
589               '|xns' : 'Roo.bootstrap',
590               store : {
591                xtype : 'Store',
592                remoteSort : true,
593                sortInfo : { direction : 'ASC', field: 'name' },
594                listeners : {
595                 beforeload : function (_self, o){
596                      o.params = o.params || {};
597                      
598                      o.params._direct_return = 1;
599                  }
600                },
601                xns : Roo.data,
602                '|xns' : 'Roo.data',
603                proxy : {
604                 xtype : 'HttpProxy',
605                 method : 'GET',
606                 url : baseURL + '/Roo/Core_group',
607                 xns : Roo.data,
608                 '|xns' : 'Roo.data'
609                },
610                reader : {
611                 xtype : 'JsonReader',
612                 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
613                 id : 'name',
614                 root : 'data',
615                 totalProperty : 'total',
616                 xns : Roo.data,
617                 '|xns' : 'Roo.data'
618                }
619               }
620              }
621             ]
622            }
623           ]
624          },
625          {
626           xtype : 'Row',
627           xns : Roo.bootstrap,
628           '|xns' : 'Roo.bootstrap',
629           items  : [
630            {
631             xtype : 'Column',
632             md : 12,
633             xs : 12,
634             xns : Roo.bootstrap,
635             '|xns' : 'Roo.bootstrap',
636             items  : [
637              {
638               xtype : 'Input',
639               allowBlank : false,
640               fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
641               indicatorpos : 'right',
642               labelWidth : 2,
643               name : 'subject',
644               xns : Roo.bootstrap,
645               '|xns' : 'Roo.bootstrap'
646              }
647             ]
648            }
649           ]
650          },
651          {
652           xtype : 'Row',
653           xns : Roo.bootstrap,
654           '|xns' : 'Roo.bootstrap',
655           items  : [
656            {
657             xtype : 'Column',
658             md : 12,
659             xns : Roo.bootstrap,
660             '|xns' : 'Roo.bootstrap',
661             items  : [
662              {
663               xtype : 'Container',
664               header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
665               panel : 'default',
666               xns : Roo.bootstrap,
667               '|xns' : 'Roo.bootstrap',
668               items  : [
669                {
670                 xtype : 'HtmlEditor',
671                 name : 'bodytext',
672                 listeners : {
673                  autosave : function (_self)
674                   {
675                       Roo.log('autosave');
676                       
677                       var id = _this.form.findField('id').getValue() * 1;
678                       
679                       new Pman.Request({
680                           url : baseURL + '/Roo/Events.php',
681                           method :'POST',
682                           params : {
683                               id : 0,
684                               action : 'AUTOSAVE',
685                               on_id : (id > 0) ? id : 0,
686                               on_table : 'crm_mailing_list_message',
687                               remarks : 'BODY',
688                               source: _self.getValue()
689                           },
690                           success : function() {
691                               _self.originalValue = _self.getValue();
692                               
693                           },
694                           failure : function() 
695                           {
696                               Roo.log('body autosave failed?!');
697                           }
698                       });
699                       
700                   },
701                  render : function (_self)
702                   {
703                       _this.htmleditor = this;
704                   },
705                  savedpreview : function (_self)
706                   {
707                       var id = _this.form.findField('id').getValue() * 1;
708                       
709                       var successFn = function(res){
710                           return res.data.POST.source;
711                       };
712                       
713                       var params = {
714                           action : 'AUTOSAVE',
715                           remarks : 'BODY',
716                           on_id : (id < 1) ? 0 : id,
717                           on_table : 'core_email',
718                           successFn : successFn
719                       };
720                       
721                       
722                       Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
723                           _self.setValue(res);
724                           _self.originalValue = res;
725                       });
726                   }
727                 },
728                 xns : Roo.bootstrap,
729                 '|xns' : 'Roo.bootstrap',
730                 btns : [
731                  {
732                   xtype : 'Button',
733                   glyphicon : 'camera',
734                   html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
735                   toggle : false,
736                   listeners : {
737                    click : function (_self, e)
738                     {
739                         if (!_this.form.findField('bodytext').editorcore.activated) {
740                             Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
741                             return;
742                         }
743                         
744                         var id = _this.form.findField('id').getValue();
745                         
746                         if(id*1 < 1){
747                             Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
748                             return;
749                         }
750                         
751                         var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
752                         
753                         Pman.Dialog.BAdminImageManager.show({
754                             id : 0,
755                             onid: id,
756                             ontable: ontable
757                         });
758                         
759                     }
760                   },
761                   xns : Roo.bootstrap,
762                   '|xns' : 'Roo.bootstrap'
763                  },
764                  {
765                   xtype : 'Button',
766                   glyphicon : 'tag',
767                   html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
768                   toggle : false,
769                   xns : Roo.bootstrap,
770                   '|xns' : 'Roo.bootstrap',
771                   menu : {
772                    xtype : 'Menu',
773                    xns : Roo.bootstrap,
774                    '|xns' : 'Roo.bootstrap',
775                    items  : [
776                     {
777                      xtype : 'MenuItem',
778                      html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
779                      listeners : {
780                       click : function (_self, e)
781                        {
782                            if (!_this.form.findField('bodytext').editorcore.activated) {
783                                Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
784                                return;
785                            }
786                            
787                            _this.form.findField('bodytext').editorcore.insertAtCursor(
788                                String.format('{0}',
789                                    '{person.name}'
790                                )
791                            );
792                        }
793                      },
794                      xns : Roo.bootstrap,
795                      '|xns' : 'Roo.bootstrap'
796                     },
797                     {
798                      xtype : 'MenuItem',
799                      html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
800                      listeners : {
801                       click : function (_self, e)
802                        {
803                            if (!_this.form.findField('bodytext').editorcore.activated) {
804                                Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
805                                return;
806                            }
807                            
808                            _this.form.findField('bodytext').editorcore.insertAtCursor(
809                                String.format('<a href="{0}">{1}</a>',
810                                    '#unsubscribe',  "Unsubscribe"
811                                )
812                            );
813                        }
814                      },
815                      xns : Roo.bootstrap,
816                      '|xns' : 'Roo.bootstrap'
817                     }
818                    ]
819                   }
820                  },
821                  {
822                   xtype : 'Button',
823                   glyphicon : 'refresh',
824                   html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
825                   toggle : false,
826                   listeners : {
827                    click : function (_self, e)
828                     {
829                         var h = _this.form.findField('bodytext').getValue();
830                         var p = _this.form.findField('plaintext');
831                         
832                         new Pman.Request({\r
833                             url : baseURL + '/Core/ImportMailMessage.php',\r
834                             method : 'POST',\r
835                             params : {
836                               bodytext : h,\r
837                               _convertToPlain : true,
838                               _check_unsubscribe : true\r
839                             }, \r
840                             success : function(res) {\r
841                                 if(res.success == true){
842                                    p.setValue(res.data);
843                                 }\r
844                             }\r
845                         });
846                         
847                     }
848                   },
849                   xns : Roo.bootstrap,
850                   '|xns' : 'Roo.bootstrap'
851                  },
852                  {
853                   xtype : 'Button',
854                   glyphicon : 'floppy-disk',
855                   html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
856                   toggle : false,
857                   listeners : {
858                    click : function (_self, e)
859                     {
860                         this.scope.owner.fireEvent('savedpreview', this.scope.owner);
861                     }
862                   },
863                   xns : Roo.bootstrap,
864                   '|xns' : 'Roo.bootstrap'
865                  }
866                 ]
867                }
868               ]
869              }
870             ]
871            }
872           ]
873          },
874          {
875           xtype : 'Row',
876           listeners : {
877            click : function (_self, e)
878             {
879                 var h = _this.form.findField('bodytext').getValue();
880                 var p = _this.form.findField('plaintext');
881                 
882                 new Pman.Request({\r
883                     url : baseURL + '/Core/ImportMailMessage.php',\r
884                     method : 'POST',\r
885                     params : {
886                       bodytext : h,\r
887                       _convertToPlain : true,
888                       _check_unsubscribe : true\r
889                     }, \r
890                     success : function(res) {\r
891                         if(res.success == true){
892                            p.setValue(res.data);
893                         }\r
894                     }\r
895                 });
896                 
897             }
898           },
899           xns : Roo.bootstrap,
900           '|xns' : 'Roo.bootstrap',
901           items  : [
902            {
903             xtype : 'Column',
904             md : 12,
905             xns : Roo.bootstrap,
906             '|xns' : 'Roo.bootstrap',
907             items  : [
908              {
909               xtype : 'Container',
910               header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
911               panel : 'default',
912               xns : Roo.bootstrap,
913               '|xns' : 'Roo.bootstrap',
914               items  : [
915                {
916                 xtype : 'TextArea',
917                 name : 'plaintext',
918                 xns : Roo.bootstrap,
919                 '|xns' : 'Roo.bootstrap'
920                }
921               ]
922              }
923             ]
924            }
925           ]
926          },
927          {
928           xtype : 'Row',
929           xns : Roo.bootstrap,
930           '|xns' : 'Roo.bootstrap',
931           items  : [
932            {
933             xtype : 'Column',
934             md : 12,
935             xns : Roo.bootstrap,
936             '|xns' : 'Roo.bootstrap',
937             items  : [
938              {
939               xtype : 'Input',
940               fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
941               labelAlign : 'top',
942               name : 'test_class',
943               xns : Roo.bootstrap,
944               '|xns' : 'Roo.bootstrap'
945              }
946             ]
947            }
948           ]
949          },
950          {
951           xtype : 'Input',
952           inputType : 'hidden',
953           labelWidth : 3,
954           name : 'id',
955           xns : Roo.bootstrap,
956           '|xns' : 'Roo.bootstrap'
957          },
958          {
959           xtype : 'Input',
960           inputType : 'hidden',
961           labelWidth : 3,
962           name : '_ignore_group_count',
963           xns : Roo.bootstrap,
964           '|xns' : 'Roo.bootstrap'
965          }
966         ]
967        }
968       ]
969      }
970     ]
971    }  );
972  }
973 });
974 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);