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