disable autoclean on emails
[Pman.Core] / Pman.Dialog.CoreEmail.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.CoreEmail = {
8
9  _strings : {
10   'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
11   '2f26e35d61be90501e099089dc533638' :"Select Images",
12   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
13   'b357b524e740bc85b9790a0712d84a30' :"Email address",
14   '962b90039a542a29cedd51d87a9f28a1' :"Html Editor",
15   '72d6d7a1885885bb55a565fd1070581a' :"Import",
16   '28690be026c0bb9003aa58e45e5662ca' :"Enabled - will be sent out",
17   'ea30b40c3caf28acb29198d20d243e54' :"Images / Attachments >>",
18   '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
19   'b337c8a67244afb6551ee1f8f9717676' :"Test Class <BR/> (for system reference only)",
20   '884df8e413319ff51a3f5f528606238a' :"Use template",
21   'e6b391a8d2c4d45902a23a8b6585703d' :"URL",
22   '6f16a5f8ff5d75ab84c018adacdfcbb7' :"Field",
23   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
24   '2393ad754ba179442d85e415d1d5167c' :"Displayorder",
25   'e9968623956c15023d54335ea3699855' :"Convert Html to Text",
26   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
27   '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
28   'c7892ebbb139886662c6f2fc8c450710' :"Subject",
29   'dc0de523c25be298ba751c63c694109e' :"Responsive Email (1)",
30   '396ecabf0cd1f9503e591418851ef406' :"Edit / Create Message",
31   'b9c49611cfda3259a2b837b39489e650' :"Add Image",
32   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
33   '68b00d723d37122f64da8d9939f836f0' :"BCC Group",
34   'c4ca4238a0b923820dcc509a6f75849b' :"1",
35   'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
36   'b20a8b77b05d53b4e695738731400c85' :"Mailout Name",
37   '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
38   '2c466a2c159463f1d9ef5a7b57b52827' :"Select BCC Group",
39   '5da618e8e4b89c66fe86e32cdafde142' :"From",
40   '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
41   'b78a3223503896721cca1303f776159b' :"Title",
42   '278c491bdd8a53618c149c4ac790da34' :"Template",
43   '1351017ac6423911223bc19a8cb7c653' :"Filename",
44   '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
45   'c9cc8cce247e49bae79f15173ce97354' :"Save",
46   '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
47   '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
48   'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
49  },
50  _named_strings : {
51   'active_boxLabel' : '28690be026c0bb9003aa58e45e5662ca' /* Enabled - will be sent out */ ,
52   'template_fieldLabel' : '278c491bdd8a53618c149c4ac790da34' /* Template */ ,
53   'name_fieldLabel' : 'b20a8b77b05d53b4e695738731400c85' /* Mailout Name */ ,
54   'bcc_group_id_name_qtip' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
55   'bcc_group_id_name_emptyText' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
56   'template_qtip' : '31bb2f6e9b8fb11cbb7fb63c6025223f' /* Select Template */ ,
57   'template_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
58   'from_email_fieldLabel' : 'b357b524e740bc85b9790a0712d84a30' /* Email address */ ,
59   'template_emptyText' : '31bb2f6e9b8fb11cbb7fb63c6025223f' /* Select Template */ ,
60   'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
61   'from_name_fieldLabel' : '5da618e8e4b89c66fe86e32cdafde142' /* From */ ,
62   'bcc_group_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
63   'bcc_group_id_name_fieldLabel' : '68b00d723d37122f64da8d9939f836f0' /* BCC Group */ ,
64   'subject_fieldLabel' : 'c7892ebbb139886662c6f2fc8c450710' /* Subject */ ,
65   'test_class_fieldLabel' : 'b337c8a67244afb6551ee1f8f9717676' /* Test Class <BR/> (for system reference only) */ 
66  },
67
68  dialog : false,
69  callback:  false,
70
71  show : function(data, cb)
72  {
73   if (!this.dialog) {
74    this.create();
75   }
76
77   this.callback = cb;
78   this.data = data;
79   this.dialog.show.apply(this.dialog,  Array.prototype.slice.call(arguments).slice(2));
80   if (this.form) {
81    this.form.reset();
82    this.form.setValues(data);
83    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
84   }
85
86  },
87
88  create : function()
89  {
90    var _this = this;
91    this.dialog = Roo.factory({
92     xtype : 'LayoutDialog',
93     closable : true,
94     collapsible : false,
95     height : 500,
96     modal : true,
97     resizable : true,
98     title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
99     width : 800,
100     listeners : {
101      show : function (_self)
102       {
103           
104           _self.layout.getRegion('center').showPanel(0);
105           var w = Roo.lib.Dom.getViewWidth();\r
106           var h = Roo.lib.Dom.getViewHeight();    \r    this.resizeTo(w-50, h-50);\r
107           this.center();\r    
108           var ew = Math.max(250, w-320);\r
109           var eh = Math.max(250, h-350) ;\r
110           var e = _this.dialog.layout.getRegion('east');
111           if (e.visible) {
112               e.hide();
113           }
114           
115           var el = _self.getEl();
116           var elw = el.dom.clientWidth;
117           
118           var bdtext = _this.form.findField('bodytext');
119           var ptext = _this.form.findField('plaintext');
120           if(bdtext.resizeEl){
121               bdtext.width = elw-100;
122               bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height  ] );
123               ptext.setSize(bdtext.width , bdtext.height);
124           }
125           
126       }
127     },
128     xns : Roo,
129     '|xns' : 'Roo',
130     center : {
131      xtype : 'LayoutRegion',
132      tabPosition : 'top',
133      xns : Roo,
134      '|xns' : 'Roo'
135     },
136     east : {
137      xtype : 'LayoutRegion',
138      hidden : true,
139      split : true,
140      title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
141      titlebar : true,
142      width : 500,
143      xns : Roo,
144      '|xns' : 'Roo'
145     },
146     buttons : [
147      {
148       xtype : 'Button',
149       text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
150       listeners : {
151        click : function (_self, e)
152         {
153             //_this.dialog.hide();
154             Roo.log(_this.data.module);
155             Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
156         },
157        render : function (_self)
158         {
159             _this.preview_btn = _self;
160         }
161       },
162       xns : Roo,
163       '|xns' : 'Roo'
164      },
165      {
166       xtype : 'Button',
167       text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
168       listeners : {
169        click : function (_self, e)
170         {
171             //_this.dialog.hide();
172         
173             var id = _this.form.findField('id').getValue();
174             
175             if(id*1 < 1){
176                 Roo.MessageBox.alert('Error', 'Please save the message frist!');
177                 return;
178             }
179            
180             new Pman.Request({
181                 url : baseURL + '/Core/MessagePreview',
182                 method : 'POST',
183                 mask: 'Sending',
184                 params : {
185                     _id : id,
186                     _table : _this.data.module
187                 }, 
188                 success : function(res) { 
189                     if(res.data == 'SUCCESS'){
190                         Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
191                     }
192                 }
193             });
194         },
195        render : function (_self)
196         {
197             _this.html_preview = _self;
198         }
199       },
200       xns : Roo,
201       '|xns' : 'Roo'
202      },
203      {
204       xtype : 'Button',
205       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
206       listeners : {
207        click : function (_self, e)
208         {
209             _this.dialog.hide();
210         }
211       },
212       xns : Roo,
213       '|xns' : 'Roo'
214      },
215      {
216       xtype : 'Button',
217       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
218       listeners : {
219        click : function (_self, e)
220         {
221         
222             // do some checks?
223             _this.form.preValidate(function(res) {
224                 if (!res) {
225                     return; //failed.
226                 }
227                  _this.form.doAction("submit");
228             });
229         
230         }
231       },
232       xns : Roo,
233       '|xns' : 'Roo'
234      }
235     ],
236     items  : [
237      {
238       xtype : 'NestedLayoutPanel',
239       autoScroll : false,
240       fitContainer : true,
241       fitToFrame : true,
242       region : 'center',
243       xns : Roo,
244       '|xns' : 'Roo',
245       toolbar : {
246        xtype : 'Toolbar',
247        xns : Roo,
248        '|xns' : 'Roo',
249        items  : [
250         {
251          xtype : 'Button',
252          text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
253          xns : Roo.Toolbar,
254          '|xns' : 'Roo.Toolbar',
255          menu : {
256           xtype : 'Menu',
257           xns : Roo.menu,
258           '|xns' : 'Roo.menu',
259           items  : [
260            {
261             xtype : 'Item',
262             text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
263             listeners : {
264              click : function (_self, e)
265               {
266                   Pman.Dialog.CoreImportUrl.show({
267                       target : '/Core/ImportMailMessage.php'
268                   }, function(data) {
269                       if  (data) {
270                         //  Roo.log(data);
271                           _this.form.findField('bodytext').setValue(data);
272                       }
273                   });
274               }
275             },
276             xns : Roo.menu,
277             '|xns' : 'Roo.menu'
278            },
279            {
280             xtype : 'Item',
281             text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
282             listeners : {
283              click : function (_self, e)
284               {
285                   Pman.Dialog.Image.show({
286                       _url : baseURL + '/Core/ImportMailMessage.php'
287                   }, function(data) {
288                       if  (data) {
289                           _this.form.findField('bodytext').setValue(data);
290                       }
291                   });
292               }
293             },
294             xns : Roo.menu,
295             '|xns' : 'Roo.menu'
296            }
297           ]
298          }
299         },
300         {
301          xtype : 'Button',
302          text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
303          xns : Roo.Toolbar,
304          '|xns' : 'Roo.Toolbar',
305          menu : {
306           xtype : 'Menu',
307           xns : Roo.menu,
308           '|xns' : 'Roo.menu',
309           items  : [
310            {
311             xtype : 'Item',
312             text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
313             listeners : {
314              click : function (_self, e)
315               {
316               
317                   var l = document.location;
318                   new Pman.Request({
319               
320                       url : baseURL + '/Core/ImportMailMessage.php',
321               
322                       method: 'POST',
323                       mask : "Loading",
324                       params : {
325                             importUrl : l.protocol +'//' + l.host +   rootURL + '/Pman/Crm/mail_templates/responsive1.html'
326                      },
327                       success : function (res) {
328               
329                        _this.form.findField('bodytext').setValue(res.data);
330                       }
331                 
332                   });
333               }
334             },
335             xns : Roo.menu,
336             '|xns' : 'Roo.menu'
337            }
338           ]
339          }
340         },
341         {
342          xtype : 'ComboBox',
343          allowBlank : true,
344          alwaysQuery : true,
345          displayField : 'file',
346          editable : false,
347          emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
348          fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
349          forceSelection : true,
350          hiddenName : 'template',
351          listWidth : 400,
352          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
353          minChars : 2,
354          name : 'template',
355          pageSize : 20,
356          qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
357          selectOnFocus : true,
358          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
359          triggerAction : 'all',
360          typeAhead : true,
361          valueField : 'file',
362          width : 200,
363          listeners : {
364           select : function (combo, record, index)
365            {
366               
367            /*
368                (function() { 
369                    combo.setValue('');
370                }).defer(100);
371            */    
372                if(!record){
373                    return;
374                }
375                _this.form.findField('bodytext').setValue(record.data.content);
376            
377            }
378          },
379          xns : Roo.form,
380          '|xns' : 'Roo.form',
381          store : {
382           xtype : 'Store',
383           remoteSort : true,
384           sortInfo : { direction : 'DESC', field: 'file' },
385           listeners : {
386            beforeload : function (_self, o){
387                 o.params = o.params || {};
388                 // set more here
389                
390             }
391           },
392           xns : Roo.data,
393           '|xns' : 'Roo.data',
394           proxy : {
395            xtype : 'HttpProxy',
396            method : 'GET',
397            url : baseURL + '/Core/MailTemplateList.php',
398            xns : Roo.data,
399            '|xns' : 'Roo.data'
400           },
401           reader : {
402            xtype : 'JsonReader',
403            fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
404            id : 'name',
405            root : 'data',
406            totalProperty : 'total',
407            xns : Roo.data,
408            '|xns' : 'Roo.data'
409           }
410          }
411         },
412         {
413          xtype : 'Fill',
414          xns : Roo.Toolbar,
415          '|xns' : 'Roo.Toolbar'
416         },
417         {
418          xtype : 'Button',
419          text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
420          listeners : {
421           click : function (_self, e)
422            {
423                var el = _this.dialog.layout.getRegion('east');
424                if (el.visible) {
425                    el.hide();
426                } else {
427                    el.show();
428                    el.showPanel(0);
429                }
430                
431            }
432          },
433          xns : Roo.Toolbar,
434          '|xns' : 'Roo.Toolbar'
435         }
436        ]
437       },
438       layout : {
439        xtype : 'BorderLayout',
440        xns : Roo,
441        '|xns' : 'Roo',
442        center : {
443         xtype : 'LayoutRegion',
444         autoScroll : true,
445         xns : Roo,
446         '|xns' : 'Roo'
447        },
448        items  : [
449         {
450          xtype : 'ContentPanel',
451          autoScroll : false,
452          background : false,
453          fitContainer : true,
454          fitToFrame : true,
455          region : 'center',
456          title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
457          listeners : {
458           render : function (_self, width, height)
459            {
460                
461                  Roo.log("RESIZE, " + width + ',' + height);
462                
463                var ew = Math.max(250, width-50);
464                var eh = Math.max(250,height-50) ;
465                
466               
467            
468            },
469           resize : function (_self, width, height)\r
470            {\r
471               var ew = Math.max(250, width-50);\r
472                var eh = Math.max(250,height-50) ;
473                
474                if (!_this.form) {\r
475                    return;\r
476                }\r
477                var bdtext = _this.form.findField('bodytext');\r
478                var ptext = _this.form.findField('plaintext');\r
479                if(bdtext.resizeEl){\r
480                    bdtext.width = ew-50;\r
481                    bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height  ] );\r
482                    ptext.setSize(bdtext.width , bdtext.height);\r
483                }\r\r
484            \r
485            }
486          },
487          xns : Roo,
488          '|xns' : 'Roo',
489          items  : [
490           {
491            xtype : 'Form',
492            labelAlign : 'right',
493            labelWidth : 120,
494            method : 'POST',
495            preValidate : function(done_callback) {
496                
497                Roo.MessageBox.progress("Uploading Images", "Uploading");
498                
499                if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
500                    _this.form.findField('bodytext').syncValue();
501                }else{
502                    _this.form.findField('bodytext').pushValue();
503                }
504                
505                var html = _this.form.findField('bodytext').getValue();
506                
507                var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
508                
509                var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
510                
511                var nodes = [];
512                s.select('img[src]').each(function(i) {
513                    nodes.push(i.dom);
514                });
515                var total = nodes.length;
516                var mkimg = function() {
517                
518                    if (!nodes.length) {
519                          Roo.MessageBox.hide();
520                          _this.form.findField('bodytext').syncValue();
521                          done_callback(true);
522                       //    _this.form.doAction("submit");
523                          return;
524                    }
525                    var i = nodes.pop(); 
526                    
527                    var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
528                    
529                    if(n){
530                        mkimg();
531                        return;
532                    }
533                    
534                    n = i.getAttribute('src').match(/^http(.*)/);
535                   
536                    if(!n ){
537                        mkimg();
538                        return;
539                    }
540                    
541                    new Pman.Request({
542                        url : baseURL + '/Roo/Images.php',
543                        method : 'POST',
544                        params : {
545                            onid : _this.form.findField('id').getValue(),
546                            ontable : ontable ,
547                            _remote_upload : i.src
548                        },
549                        success : function(res){
550                            if(res.success == true){      
551                                i.setAttribute('src', res.data);
552                                Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
553                            }
554                            mkimg();
555                        }
556                    });
557                   
558                }
559                
560                if (!_this.form.findField('bodytext').getValue().match(/unsubscribe/i)) {
561                    Roo.MessageBox.confirm("Missing unusubscribe",
562                        "There is no unsubscribe link on the email  are you sure you want to save it",
563                        function(res) {
564                            if (res == 'no') {
565                                return;
566                            }
567                            mkimg();
568                        }
569                    );
570            
571                    return;
572                }
573                
574                mkimg();
575            },
576            style : 'margin:10px',
577            url : baseURL + '/Roo/crm_mailing_list_message.php',
578            listeners : {
579             actioncomplete : function(_self,action)
580              {
581                 
582                  if (action.type == 'setdata') {
583                  
584                      setInterval(_this.form.findField('bodytext').autosave, 5000);
585                      
586                      _this.data.module = _this.data.module || 'crm_mailing_list_message';
587                      
588                      _this.form.url = baseURL + '/Roo/' + _this.data.module;
589                      
590                      _this.html_preview.hide();
591                      _this.preview_btn.hide();
592                          
593                      if(_this.data.id*1 > 0){
594                          _this.dialog.el.mask("Loading");
595                          this.load({ method: 'GET', params: { '_id' : _this.data.id }});
596                          _this.html_preview.show();
597                          _this.preview_btn.show();
598                          
599                      } else {
600                          _this.form.setValues({
601                              'from_name' : Pman.Login.authUser.name,
602                              'from_email' : Pman.Login.authUser.email
603                          });
604                      }
605                     return;
606                  }
607                  if (action.type == 'load') {
608                      _this.dialog.el.unmask();
609                      
610                      _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();
611                      
612                      return;
613                  }
614                  if (action.type =='submit') {
615                  
616                      _this.dialog.el.unmask();
617                      _this.dialog.hide();
618                  
619                       if (_this.callback) {
620                          _this.callback.call(_this, action.result.data);
621                       }
622                       _this.form.reset();
623                       return;
624                  }
625              },
626             rendered : function (form)
627              {
628                  _this.form= form;
629              }
630            },
631            xns : Roo.form,
632            '|xns' : 'Roo.form',
633            items  : [
634             {
635              xtype : 'Row',
636              xns : Roo.form,
637              '|xns' : 'Roo.form',
638              items  : [
639               {
640                xtype : 'TextField',
641                allowBlank : false,
642                fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
643                name : 'name',
644                width : 400,
645                xns : Roo.form,
646                '|xns' : 'Roo.form'
647               },
648               {
649                xtype : 'Column',
650                hideLabels : true,
651                xns : Roo.form,
652                '|xns' : 'Roo.form',
653                items  : [
654                 {
655                  xtype : 'Checkbox',
656                  boxLabel : _this._strings['28690be026c0bb9003aa58e45e5662ca'] /* Enabled - will be sent out */,
657                  checked : true,
658                  name : 'active',
659                  value : 1,
660                  valueOff : 0,
661                  listeners : {
662                   check : function (_self, checked)
663                    {
664                        var boxLabel = 'Enabled - will be sent out';
665                        
666                        if(!checked){
667                            boxLabel = 'Disabled - will NOT be sent out';
668                        }
669                        
670                        this.setBoxLabel(boxLabel);
671                    }
672                  },
673                  xns : Roo.form,
674                  '|xns' : 'Roo.form'
675                 }
676                ]
677               }
678              ]
679             },
680             {
681              xtype : 'Row',
682              xns : Roo.form,
683              '|xns' : 'Roo.form',
684              items  : [
685               {
686                xtype : 'TextField',
687                allowBlank : false,
688                fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
689                name : 'from_name',
690                width : 300,
691                xns : Roo.form,
692                '|xns' : 'Roo.form'
693               },
694               {
695                xtype : 'TextField',
696                allowBlank : false,
697                fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
698                name : 'from_email',
699                width : 300,
700                xns : Roo.form,
701                '|xns' : 'Roo.form'
702               },
703               {
704                xtype : 'ComboBox',
705                allowBlank : true,
706                alwaysQuery : true,
707                displayField : 'name',
708                editable : false,
709                emptyText : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
710                fieldLabel : _this._strings['68b00d723d37122f64da8d9939f836f0'] /* BCC Group */,
711                forceSelection : true,
712                hiddenName : 'bcc_group_id',
713                loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
714                minChars : 2,
715                name : 'bcc_group_id_name',
716                pageSize : 25,
717                qtip : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
718                selectOnFocus : true,
719                tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
720                triggerAction : 'all',
721                typeAhead : true,
722                valueField : 'id',
723                width : 300,
724                xns : Roo.form,
725                '|xns' : 'Roo.form',
726                store : {
727                 xtype : 'Store',
728                 remoteSort : true,
729                 sortInfo : { direction : 'ASC', field: 'name' },
730                 listeners : {
731                  beforeload : function (_self, o){
732                       o.params = o.params || {};
733                       
734                       o.params._direct_return = 1;
735                   }
736                 },
737                 xns : Roo.data,
738                 '|xns' : 'Roo.data',
739                 proxy : {
740                  xtype : 'HttpProxy',
741                  method : 'GET',
742                  url : baseURL + '/Roo/Core_group',
743                  xns : Roo.data,
744                  '|xns' : 'Roo.data'
745                 },
746                 reader : {
747                  xtype : 'JsonReader',
748                  fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
749                  id : 'name',
750                  root : 'data',
751                  totalProperty : 'total',
752                  xns : Roo.data,
753                  '|xns' : 'Roo.data'
754                 }
755                }
756               }
757              ]
758             },
759             {
760              xtype : 'TextField',
761              allowBlank : false,
762              fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
763              name : 'subject',
764              width : 600,
765              xns : Roo.form,
766              '|xns' : 'Roo.form'
767             },
768             {
769              xtype : 'Row',
770              hideLabels : true,
771              xns : Roo.form,
772              '|xns' : 'Roo.form',
773              items  : [
774               {
775                xtype : 'FieldSet',
776                hideLabels : true,
777                legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
778                style : 'text-align:center;',
779                xns : Roo.form,
780                '|xns' : 'Roo.form',
781                items  : [
782                 {
783                  xtype : 'HtmlEditor',
784                  allowComments : true,
785                  autoClean : false,
786                  autosave : function() {
787                      
788                      var body = _this.form.findField('bodytext');
789                      
790                      if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
791                          Roo.log('body not dirty');
792                          return;
793                      }
794                      
795                      Roo.log('body dirty, auto save!');
796                      
797                      body.fireEvent('autosave', body);
798                     
799                  },
800                  clearUp : false,
801                  cwhite : [ 
802                      'background',
803                      'background-color',
804                      'border',
805                      'border-radius',
806                      'border-bottom',
807                      'border-left',
808                      'border-right',
809                      'border-top',
810                      'border-collapse',
811                       'border-color',
812                       'border-style',
813                      'border-width',
814                  
815                      
816                      'box-shadow',
817                      'clear',
818                      'color',
819                      'cursor',
820                      'display',
821                      'float' ,
822                      'font-family',
823                      'font-size',
824                      'font-style',        
825                      'font-weight',
826                  
827                      'height',
828                      'left',
829                      'line-height',
830                      'list-style',
831                      'margin',
832                      'margin-bottom',
833                      'margin-left',
834                      'margin-right',
835                      'margin-top',
836                      'max-width',
837                      'min-height',
838                      '-ms-interpolation-mode',
839                      'mso-table-rspace',
840                      '-ms-text-size-adjust',
841                      'outline',
842                      'overflow',
843                      'padding',
844                      'padding-bottom',
845                      'padding-left',
846                      'padding-right',
847                      'padding-top',
848                      'position',
849                      'right',
850                      'text-align',
851                      'text-decoration',
852                      'top',
853                      'vertical-align',
854                      '-webkit-text-size-adjust',
855                      'width',
856                      'width',
857                      'z-index'
858                   ],
859                  enableBlocks : false,
860                  height : 250,
861                  name : 'bodytext',
862                  resizable : 's',
863                  listeners : {
864                   autosave : function (_self)
865                    {
866                        Roo.log('autosave');
867                        
868                        var id = _this.form.findField('id').getValue() * 1;
869                        
870                        /*
871                        if(!_self.editorcore.sourceEditMode){
872                            _self.syncValue();
873                        }else{
874                            _self.pushValue();
875                        }
876                        */
877                        
878                        new Pman.Request({
879                            url : baseURL + '/Roo/Events.php',
880                            method :'POST',
881                            params : {
882                                id : 0,
883                                action : 'AUTOSAVE',
884                                on_id : (id > 0) ? id : 0,
885                                on_table : 'crm_mailing_list_message',
886                                remarks : 'BODY',
887                                source: _self.getValue()
888                            },
889                            success : function() {
890                                _self.originalValue = _self.getValue();
891                                
892                            },
893                            failure : function() 
894                            {
895                                Roo.log('body autosave failed?!');
896                            }
897                        });
898                        
899                    },
900                   savedpreview : function (_self)
901                    {
902                        var id = _this.form.findField('id').getValue() * 1;
903                        
904                        var successFn = function(res){
905                            return res.data.POST.source;
906                        };
907                        
908                        var params = {
909                            action : 'AUTOSAVE',
910                            remarks : 'BODY',
911                            on_id : (id < 1) ? 0 : id,
912                            on_table : 'crm_mailing_list_message',
913                            successFn : successFn
914                        };
915                        
916                        
917                        Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
918                            _self.setValue(res);
919                            _self.originalValue = res;
920                        });
921                    }
922                  },
923                  xns : Roo.form,
924                  '|xns' : 'Roo.form',
925                  toolbars : [
926                   {
927                    xtype : 'ToolbarContext',
928                    xns : Roo.form.HtmlEditor,
929                    '|xns' : 'Roo.form.HtmlEditor'
930                   },
931                   {
932                    xtype : 'ToolbarStandard',
933                    xns : Roo.form.HtmlEditor,
934                    '|xns' : 'Roo.form.HtmlEditor',
935                    btns : [
936                     {
937                      xtype : 'ComboBox',
938                      alwaysQuery : true,
939                      displayField : 'name',
940                      editable : false,
941                      emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
942                      fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
943                      forceSelection : true,
944                      listWidth : 400,
945                      loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
946                      minChars : 2,
947                      pageSize : 20,
948                      qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
949                      selectOnFocus : true,
950                      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>',
951                      triggerAction : 'all',
952                      typeAhead : true,
953                      valueField : 'id',
954                      width : 100,
955                      listeners : {
956                       beforequery : function (combo, query, forceAll, cancel, e)
957                        {
958                            var id = _this.form.findField('id').getValue() * 1;    
959                            if (!id) {
960                                Roo.MessageBox.alert("Error", "Save message first");
961                                return false;
962                            }
963                        },
964                       render : function (_self)
965                        {
966                            _this.extendimgselect = _self;
967                        },
968                       select : function (combo, record, index)
969                        {
970                            Roo.log(record);
971                            (function() { 
972                                combo.setValue('');
973                            }).defer(100);
974                            var editor = _this.form.findField('bodytext').editorcore;
975                            
976                            var curnode = editor.getSelectedNode();
977                            if (curnode && curnode.tagName == 'IMG') {
978                                curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
979                                        baseURL,  record.data.id, record.data.filename
980                                    );
981                                    // note -forces an update... hopefully...
982                                editor.owner.fireEvent('editorevent', editor, false);
983                            } else {
984                            
985                                editor.insertAtCursor(
986                                    String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
987                                    baseURL,  record.data.id, record.data.filename
988                                    )
989                                );
990                        
991                            }
992                            
993                         }
994                      },
995                      xns : Roo.form,
996                      '|xns' : 'Roo.form',
997                      store : {
998                       xtype : 'Store',
999                       remoteSort : true,
1000                       sortInfo : { direction : 'ASC', field: 'id' },
1001                       listeners : {
1002                        beforeload : function (_self, o){
1003                             o.params = o.params || {};
1004                         
1005                             var id = _this.form.findField('id').getValue() * 1;    
1006                             if (!id) {
1007                                 Roo.MessageBox.alert("Error", "Save email template first");
1008                                 return false;
1009                             }
1010                             o.params.onid = id;
1011                             o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1012                             
1013                            // o.params.imgtype = 'PressRelease';
1014                             //o.params['query[imagesize]'] = '150x150';
1015                             // set more here
1016                         }
1017                       },
1018                       xns : Roo.data,
1019                       '|xns' : 'Roo.data',
1020                       proxy : {
1021                        xtype : 'HttpProxy',
1022                        method : 'GET',
1023                        url : baseURL + '/Roo/Images.php',
1024                        xns : Roo.data,
1025                        '|xns' : 'Roo.data'
1026                       },
1027                       reader : {
1028                        xtype : 'JsonReader',
1029                        fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
1030                        id : 'id',
1031                        root : 'data',
1032                        totalProperty : 'total',
1033                        xns : Roo.data,
1034                        '|xns' : 'Roo.data'
1035                       }
1036                      }
1037                     },
1038                     {
1039                      xtype : 'ComboBox',
1040                      alwaysQuery : true,
1041                      displayField : 'name',
1042                      editable : false,
1043                      emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
1044                      fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
1045                      forceSelection : true,
1046                      listWidth : 400,
1047                      loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1048                      minChars : 2,
1049                      pageSize : 20,
1050                      qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
1051                      selectOnFocus : true,
1052                      tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
1053                      triggerAction : 'all',
1054                      typeAhead : true,
1055                      valueField : 'type',
1056                      width : 100,
1057                      listeners : {
1058                       render : function (_self)
1059                        {
1060                            _this.unsubscribeselect = _self;
1061                        },
1062                       select : function (combo, record, index)
1063                        {
1064                            Roo.log(record);
1065                            (function() { 
1066                                combo.setValue('');
1067                            }).defer(100);
1068                            var editor = _this.form.findField('bodytext').editorcore;
1069                            
1070                            if(record.data.name == 'Unsubscribe'){
1071                                editor.insertAtCursor(
1072                                    String.format('<a href="{0}">{1}</a>',
1073                                        record.data.type,  record.data.name
1074                                    )
1075                                );
1076                                return;     
1077                            }
1078                            
1079                            editor.insertAtCursor(
1080                                String.format('{0}',
1081                                    record.data.type
1082                                )
1083                            );
1084                            
1085                         }
1086                      },
1087                      xns : Roo.form,
1088                      '|xns' : 'Roo.form',
1089                      store : {
1090                       xtype : 'SimpleStore',
1091                       data : [ 
1092                           [ '{person.firstname}', "First Name"],
1093                           [ '{person.lastname}' , "Last Name"],
1094                           [ '{person.name}', "Full Name"],
1095                           [ '#unsubscribe', "Unsubscribe"]
1096                       ],
1097                       fields : [  'type', 'name'],
1098                       xns : Roo.data,
1099                       '|xns' : 'Roo.data'
1100                      }
1101                     },
1102                     {
1103                      xtype : 'Separator',
1104                      xns : Roo.Toolbar,
1105                      '|xns' : 'Roo.Toolbar'
1106                     },
1107                     {
1108                      xtype : 'Button',
1109                      cls : 'x-init-enable',
1110                      text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
1111                      listeners : {
1112                       click : function (_self, e)
1113                        {
1114                            this.scope.owner.fireEvent('savedpreview', this.scope.owner);
1115                            
1116                        }
1117                      },
1118                      xns : Roo.Toolbar,
1119                      '|xns' : 'Roo.Toolbar'
1120                     }
1121                    ]
1122                   }
1123                  ]
1124                 }
1125                ]
1126               }
1127              ]
1128             },
1129             {
1130              xtype : 'Row',
1131              hideLabels : true,
1132              xns : Roo.form,
1133              '|xns' : 'Roo.form',
1134              items  : [
1135               {
1136                xtype : 'Button',
1137                text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
1138                listeners : {
1139                 click : function (_self, e)
1140                  {
1141                      var h = _this.form.findField('bodytext').getValue();
1142                      var p = _this.form.findField('plaintext');
1143                      
1144                      new Pman.Request({\r
1145                          url : baseURL + '/Core/ImportMailMessage.php',\r
1146                          method : 'POST',\r
1147                          params : {
1148                            bodytext : h,\r
1149                            _convertToPlain : true,
1150                            _check_unsubscribe : true\r
1151                          }, \r
1152                          success : function(res) {\r
1153                              if(res.success == true){
1154                                 p.setValue(res.data);
1155                              }\r
1156                          }\r
1157                      });
1158                      
1159                  }
1160                },
1161                xns : Roo,
1162                '|xns' : 'Roo'
1163               }
1164              ]
1165             },
1166             {
1167              xtype : 'Row',
1168              hideLabels : true,
1169              xns : Roo.form,
1170              '|xns' : 'Roo.form',
1171              items  : [
1172               {
1173                xtype : 'FieldSet',
1174                hideLabels : true,
1175                legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
1176                style : 'text-align:center;',
1177                xns : Roo.form,
1178                '|xns' : 'Roo.form',
1179                items  : [
1180                 {
1181                  xtype : 'TextArea',
1182                  height : 50,
1183                  name : 'plaintext',
1184                  xns : Roo.form,
1185                  '|xns' : 'Roo.form'
1186                 }
1187                ]
1188               }
1189              ]
1190             },
1191             {
1192              xtype : 'Row',
1193              xns : Roo.form,
1194              '|xns' : 'Roo.form',
1195              items  : [
1196               {
1197                xtype : 'TextField',
1198                allowBlank : true,
1199                fieldLabel : _this._strings['b337c8a67244afb6551ee1f8f9717676'] /* Test Class <BR/> (for system reference only) */,
1200                name : 'test_class',
1201                readOnly : true,
1202                width : 300,
1203                xns : Roo.form,
1204                '|xns' : 'Roo.form'
1205               }
1206              ]
1207             },
1208             {
1209              xtype : 'Hidden',
1210              name : 'id',
1211              xns : Roo.form,
1212              '|xns' : 'Roo.form'
1213             }
1214            ]
1215           }
1216          ]
1217         }
1218        ]
1219       }
1220      },
1221      {
1222       xtype : 'GridPanel',
1223       autoScroll : false,
1224       background : false,
1225       fitContainer : true,
1226       fitToframe : true,
1227       region : 'east',
1228       tableName : 'Images',
1229       title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1230       listeners : {
1231        activate : function() {
1232             _this.ipanel = this;
1233             if (_this.igrid) {
1234                _this.igrid.ds.load({});
1235             }
1236         }
1237       },
1238       xns : Roo,
1239       '|xns' : 'Roo',
1240       grid : {
1241        xtype : 'Grid',
1242        autoExpandColumn : 'filename',
1243        loadMask : true,
1244        listeners : {
1245         render : function() 
1246          {
1247              _this.igrid = this; 
1248              //_this.dialog = Pman.Dialog.FILL_IN
1249              if (_this.ipanel.active) {
1250             //    _this.igrid.ds.load({});
1251              }
1252          }
1253        },
1254        xns : Roo.grid,
1255        '|xns' : 'Roo.grid',
1256        toolbar : {
1257         xtype : 'Toolbar',
1258         xns : Roo,
1259         '|xns' : 'Roo',
1260         items  : [
1261          {
1262           xtype : 'Button',
1263           cls : 'x-btn-text-icon',
1264           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1265           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1266           listeners : {
1267            click : function()
1268             {
1269                 var id = _this.form.findField('id').getValue();
1270                 
1271                 if(id*1 < 1){
1272                     Roo.MessageBox.alert('Error', 'Please save the email template first');
1273                     return;
1274                 }
1275                 
1276                 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1277                 
1278                 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1279                     _this.igrid.getDataSource().load({});
1280                 });
1281             }
1282           },
1283           xns : Roo.Toolbar,
1284           '|xns' : 'Roo.Toolbar'
1285          },
1286          {
1287           xtype : 'Button',
1288           cls : 'x-btn-text-icon',
1289           icon : rootURL + '/Pman/templates/images/trash.gif',
1290           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1291           listeners : {
1292            click : function()
1293             {
1294                 var s = _this.igrid.getSelectionModel().getSelected();
1295                 if (!s || isNaN(s.id *1)) {
1296                     Roo.MessageBox.alert("Error", "Select a image"); 
1297                     return;
1298                 }
1299                 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1300                     if (v != 'yes') {
1301                         return;
1302                     }
1303                     
1304                     new Pman.Request({
1305                         url : baseURL + '/Roo/Images.php',
1306                         method: 'POST',
1307                         params : {
1308                             _delete : s.id
1309                         },
1310                         success : function()
1311                         {
1312                             Roo.log('Got Success!!');
1313                            _this.igrid.ds.load({});
1314                         }
1315                     });
1316                 });
1317             }
1318           },
1319           xns : Roo.Toolbar,
1320           '|xns' : 'Roo.Toolbar'
1321          }
1322         ]
1323        },
1324        dataSource : {
1325         xtype : 'Store',
1326         remoteSort : true,
1327         sortInfo : { field : 'filename', direction: 'ASC' },
1328         listeners : {
1329          beforeload : function (_self, options)
1330           {
1331               options.params = options.params || {};
1332               if (typeof(_this.data) == 'undefined') {
1333                   return false;
1334               }
1335               if(_this.data.id * 1 >= 0)
1336               {
1337                   options.params.onid = _this.data.id;
1338           
1339                   options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1340               }
1341           }
1342         },
1343         xns : Roo.data,
1344         '|xns' : 'Roo.data',
1345         proxy : {
1346          xtype : 'HttpProxy',
1347          method : 'GET',
1348          url : baseURL + '/Roo/Images.php',
1349          xns : Roo.data,
1350          '|xns' : 'Roo.data'
1351         },
1352         reader : {
1353          xtype : 'JsonReader',
1354          fields : [
1355              {
1356                  'name': 'id',
1357                  'type': 'int'
1358              },
1359              {
1360                  'name': 'filename',
1361                  'type': 'string'
1362              },
1363              {
1364                  'name': 'ontable',
1365                  'type': 'string'
1366              },
1367              {
1368                  'name': 'onid',
1369                  'type': 'int'
1370              },
1371              {
1372                  'name': 'mimetype',
1373                  'type': 'string'
1374              },
1375              {
1376                  'name': 'width',
1377                  'type': 'int'
1378              },
1379              {
1380                  'name': 'height',
1381                  'type': 'int'
1382              },
1383              {
1384                  'name': 'filesize',
1385                  'type': 'int'
1386              },
1387              {
1388                  'name': 'displayorder',
1389                  'type': 'int'
1390              },
1391              {
1392                  'name': 'language',
1393                  'type': 'string'
1394              },
1395              {
1396                  'name': 'parent_image_id',
1397                  'type': 'int'
1398              },
1399              {
1400                  'name': 'created',
1401                  'type': 'date',
1402                  'dateFormat': 'Y-m-d'
1403              },
1404              {
1405                  'name': 'imgtype',
1406                  'type': 'string'
1407              },
1408              {
1409                  'name': 'linkurl',
1410                  'type': 'string'
1411              },
1412              {
1413                  'name': 'descript',
1414                  'type': 'string'
1415              },
1416              {
1417                  'name': 'title',
1418                  'type': 'string'
1419              },
1420              {
1421                  'name': 'parent_image_id_id',
1422                  'type': 'int'
1423              },
1424              {
1425                  'name': 'parent_image_id_filename',
1426                  'type': 'string'
1427              },
1428              {
1429                  'name': 'parent_image_id_ontable',
1430                  'type': 'string'
1431              },
1432              {
1433                  'name': 'parent_image_id_onid',
1434                  'type': 'int'
1435              },
1436              {
1437                  'name': 'parent_image_id_mimetype',
1438                  'type': 'string'
1439              },
1440              {
1441                  'name': 'parent_image_id_width',
1442                  'type': 'int'
1443              },
1444              {
1445                  'name': 'parent_image_id_height',
1446                  'type': 'int'
1447              },
1448              {
1449                  'name': 'parent_image_id_filesize',
1450                  'type': 'int'
1451              },
1452              {
1453                  'name': 'parent_image_id_displayorder',
1454                  'type': 'int'
1455              },
1456              {
1457                  'name': 'parent_image_id_language',
1458                  'type': 'string'
1459              },
1460              {
1461                  'name': 'parent_image_id_parent_image_id',
1462                  'type': 'int'
1463              },
1464              {
1465                  'name': 'parent_image_id_created',
1466                  'type': 'date'
1467              },
1468              {
1469                  'name': 'parent_image_id_imgtype',
1470                  'type': 'string'
1471              },
1472              {
1473                  'name': 'parent_image_id_linkurl',
1474                  'type': 'string'
1475              },
1476              {
1477                  'name': 'parent_image_id_descript',
1478                  'type': 'string'
1479              },
1480              {
1481                  'name': 'parent_image_id_title',
1482                  'type': 'string'
1483              }
1484          ],
1485          id : 'id',
1486          root : 'data',
1487          totalProperty : 'total',
1488          xns : Roo.data,
1489          '|xns' : 'Roo.data'
1490         }
1491        },
1492        colModel : [
1493         {
1494          xtype : 'ColumnModel',
1495          dataIndex : 'filename',
1496          header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1497          renderer : function(v,x,r)
1498          {
1499              var width = r.data.width;
1500              var height = r.data.height;
1501              
1502              if(width > 50){
1503                  height = Math.round(height * 50 / width);
1504                  width = 50;
1505              }
1506              
1507             return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1508          },
1509          width : 300,
1510          xns : Roo.grid,
1511          '|xns' : 'Roo.grid'
1512         },
1513         {
1514          xtype : 'ColumnModel',
1515          dataIndex : 'displayorder',
1516          header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1517          renderer : function(v) { return String.format('{0}', v); },
1518          width : 75,
1519          xns : Roo.grid,
1520          '|xns' : 'Roo.grid'
1521         },
1522         {
1523          xtype : 'ColumnModel',
1524          dataIndex : 'title',
1525          header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1526          renderer : function(v) { return String.format('{0}', v); },
1527          width : 75,
1528          xns : Roo.grid,
1529          '|xns' : 'Roo.grid'
1530         }
1531        ]
1532       }
1533      }
1534     ]
1535    });
1536  }
1537 };