Pman.Dialog.CoreEmailPreview.bjs
[Pman.Core] / Pman.Dialog.CoreEmailPreview.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CoreEmailPreview = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             listeners : {
34                 show : function (_self)
35                 {
36                     var m = 'Core';
37                     
38                     if(_this.data.module == 'crm_mailing_list_message'){
39                         m = 'Crm';
40                     }
41                 
42                     _self.layout.getRegion('center').showPanel(0);
43                     _this.panel.load({ 
44                         url: baseURL + '/' + m + '/MessagePreview', 
45                         params  : {
46                             _id : _this.data.id
47                         },
48                         method : 'GET'
49                     });
50                     _this.hpanel.load({ 
51                         url: baseURL + '/' + m + '/MessagePreview', 
52                         params  : {
53                             _as_html : 1,
54                             _id : _this.data.id
55                         },
56                         method : 'GET'
57                     });
58                         
59                 }
60             },
61             autoScroll : true,
62             closable : true,
63             height : 800,
64             shadow : 'true',
65             title : "Email Preview",
66             width : 1200,
67             items : [
68                 {
69                     xtype: 'ContentPanel',
70                     xns: Roo,
71                     listeners : {
72                         render : function (_self)
73                         {
74                             _this.panel = _self;
75                         }
76                     },
77                     fitContainer : true,
78                     fitToFrame : true,
79                     region : 'center',
80                     title : "Plain"
81                 },
82                 {
83                     xtype: 'ContentPanel',
84                     xns: Roo,
85                     listeners : {
86                         render : function (_self)
87                         {
88                             _this.hpanel = _self;
89                         }
90                     },
91                     fitContainer : true,
92                     fitToFrame : true,
93                     region : 'center',
94                     title : "HTML"
95                 }
96             ],
97             center : {
98                 xtype: 'LayoutRegion',
99                 xns: Roo,
100                 autoScroll : true,
101                 tabPosition : 'top'
102             },
103             buttons : [
104                 {
105                     xtype: 'Button',
106                     xns: Roo,
107                     listeners : {
108                         click : function (_self, e)
109                         {
110                             _this.dialog.hide();
111                         }
112                     },
113                     text : "OK"
114                 }
115             ]
116         });
117     }
118 };