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