roojs-mailer.js
[roojs1] / roojs-mailer-debug.js
1 /*
2  * - LGPL
3  *
4  * element
5  
6                               
7  */
8 Roo.mailer = Roo.mailer || {};
9
10 /**
11  * @class Roo.mailer.BodyContainer 
12  * @extends Roo.bootstrap.Component
13  * Bootstrap Element class
14  * @cfg {String} cls class of the element
15  * 
16  * @constructor
17  * Create a new Element
18  * @param {Object} config The config object
19  */
20
21 _calls = 0;
22
23 Roo.mailer.Body  = function(config){
24     Roo.mailer.Body.superclass.constructor.call(this, config);
25     //this.el = Roo.get(document.body);
26     var body = Roo.get(document.body);
27     body.attr({
28         leftmargin : 0,
29         marginwidth : 0,
30         topmargin : 0,
31         marginheight : 0,
32         offset : 0
33     });
34     _calls++;
35     if (_calls > 1) {
36         throw "test";
37     }
38     
39     this.onRender(body);
40     this.onRender = function() { };
41
42 };
43
44 Roo.extend(Roo.mailer.Body, Roo.bootstrap.Component,  {
45     
46     
47     cls: '',
48      
49     
50     getAutoCreate : function(){
51         
52         var cfg ={
53             tag : 'center',
54             cn : [
55                 {
56                     tag: 'table',
57                     border : 0,
58                     cellpadding : 0,
59                     cellspacing : 0,
60                     height : '100%',
61                     align : 'center',
62                     cls: 'roo-m-body-table ' + this.cls,
63                     
64                     cn : [
65                         {
66                             tag : 'tr',
67                             cn : [
68                                 {
69                                     tag : 'td',
70                                     align : 'center',
71                                     valight : 'top',
72                                     cls : 'roo-m-body-cell'
73                                 }
74                             ]
75                         }
76                     ]
77                 }
78             ]
79         };
80          
81         
82         return cfg;
83     },
84     getChildContainer : function()
85     {
86         // add a child...
87          
88         return this.el.select('.roo-m-body-cell').first();
89     },
90     addxtype :   function (tree, cntr)
91     {
92         return this.addxtypeChild(tree,cntr);
93     }
94
95     
96     
97    
98 });
99
100  
101
102  /*
103  * - LGPL
104  *
105  * element
106  * <!-- BEGIN TEMPLATE // -->
107                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
108                                 <tr>
109                                 <td align="center" valign="top">
110                               
111  */
112
113 /**
114  * @class Roo.mailer.Block 
115  * @extends Roo.bootstrap.Component
116  * Bootstrap Element class
117  * @cfg {String} cls class of the element
118  * @cfg {String} html content of header (not used for columns)
119  * @cfg {String} blocktype  (header|preheader|footer|body|row)
120  * 
121  * @constructor
122  * Create a new Element
123  * @param {Object} config The config object
124  */
125
126 Roo.mailer.Block = function(config){
127     Roo.mailer.Block.superclass.constructor.call(this, config);
128 };
129
130 Roo.extend(Roo.mailer.Block, Roo.bootstrap.Component,  {
131     
132     
133     cls: '',
134     html : '',
135     blocktype :   'header',
136      
137     getAutoCreate : function(){
138                                             
139         var tr = {
140             tag : 'tr',
141             cls : 'roo-m-block-tr'
142         }
143         if (this.blocktype != 'row') {
144            tr.cn = [
145                 {
146                     tag : 'td',
147                     align : 'center',
148                     valight : 'top',
149                     cls : 'roo-m-' + this.blocktype + '-content',
150                     html : this.html
151                 }
152            ]
153         }
154         
155         var cfg =   {
156             tag: 'table',
157             border : 0,
158             cellpadding : 0,
159             cellspacing : 0,
160             width : '100%',
161             align : 'center',
162             cls: 'roo-m-' + this.blocktype + ' ' + this.cls,
163             
164             cn : [ tr ]
165             
166         };
167  
168         
169         return cfg;
170     },
171     getChildContainer : function(build_call)
172     {
173         // add a child...
174         if (this.blocktype == 'row' && build_call) {
175             var par = this.el.select(
176                         '.roo-m-block-tr',true
177                     ).first();
178             return par.createChild( {    
179                     tag:  'td',
180                     align : 'center',
181                     valign : 'top',
182                     style : 'padding-top : 20px;',
183                     cls : 'roo-m-column'
184                 }
185           
186             );
187         }
188         
189         return this.el.select('.roo-m-' + this.blocktype + '-content',true).first();
190     }
191     
192     
193     
194     
195    
196 });
197
198  
199
200  /*
201  * - LGPL
202  *
203  * element
204  * <!-- BEGIN TEMPLATE // -->
205                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
206                                 <tr>
207                                 <td align="center" valign="top">
208                               
209  */
210
211 /**
212  * @class Roo.mailer.BodyContainer 
213  * @extends Roo.bootstrap.Component
214  * Bootstrap Element class
215  * @cfg {String} cls class of the element
216  * 
217  * @constructor
218  * Create a new Element
219  * @param {Object} config The config object
220  */
221
222 Roo.mailer.BodyContainer = function(config){
223     Roo.mailer.BodyContainer.superclass.constructor.call(this, config);
224 };
225
226 Roo.extend(Roo.mailer.BodyContainer, Roo.bootstrap.Component,  {
227     
228     
229     cls: '',
230      
231     
232     getAutoCreate : function(){
233         
234         var cfg = {
235             tag: 'table',
236             border : 0,
237             cellpadding : 0,
238             cellspacing : 0,
239             cls: 'roo-m-body-container ' + this.cls,
240             cn : [
241                 {  tag : 'tbody' }
242             ]
243         };
244         
245         
246         
247         return cfg;
248     },
249     getChildContainer : function()
250     {
251         // add a child...
252         var tr = this.el.select('tbody',true).first().createChild({
253                     tag : 'tr',
254                     cn : [
255                         {   
256                             tag:  'td',
257                             align : 'center',
258                             valign : 'top',
259                             cls : 'roo-m-child-ctr'
260                         }
261                     ]
262                 });
263         
264         return tr.select('.roo-m-child-ctr').first();
265     }
266     
267     
268     
269     
270    
271 });
272
273  
274
275  /*
276  * - LGPL
277  *
278  * element
279  * <!-- BEGIN TEMPLATE // -->
280                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
281                                 <tr>
282                                 <td align="center" valign="top">
283                               
284  */
285
286 /**
287  * @class Roo.mailer.Column 
288  * @extends Roo.bootstrap.Component
289  * Bootstrap Element class
290  * @cfg {String} cls class of the element
291  * @cfg {String} html content of body
292  * @cfg {String} src image url
293  * @cfg {String} column  (left|right)
294  * 
295  * @constructor
296  * Create a new Element
297  * @param {Object} config The config object
298  */
299
300 Roo.mailer.Column = function(config){
301     Roo.mailer.Column.superclass.constructor.call(this, config);
302 };
303
304 Roo.extend(Roo.mailer.Column, Roo.bootstrap.Component,  {
305     
306     
307     cls: '',
308     html : '',
309     src : '',
310     column : 'left',
311      
312     getAutoCreate : function(){
313                                             
314         var tr = {
315             tag : 'tr',
316             cn : [ ]
317         }
318          
319        
320         
321         var cfg =   { 
322             tag: 'table',
323             border : 0,
324             cellpadding :20,
325             cellspacing : 0,
326             width : '100%',
327             cn :  []
328             
329         };
330         if (this.src != '') {
331            cfg.cn.push({
332                 tag  : 'tr',
333                 cn : [
334                     {
335                         tag : 'td',
336                         align : 'center',
337                         valight : 'top',
338                         cls : 'roo-m-column-'+ this.column + '-content',
339                         cn : [
340                             {
341                                 tag : 'img',
342                                 src : this.src,
343                                 cls : 'roo-m-column-image',
344                                 style : 'max-width: 260px;'
345                             }
346                         ]
347                     }
348                 ]
349             });
350            
351         }
352         cfg.cn.push({
353              tag  : 'tr',
354              cn : [
355                  {
356                      tag : 'td',
357                      align : 'center',
358                      valight : 'top',
359                      cls : 'roo-m-column-'+ this.column + '-content roo-m-column-body',
360                      html : this.html
361                  }
362              ]
363          });
364            
365         
366         return cfg;
367     },
368     getChildContainer : function()
369     {
370         // add a child...
371         
372         return this.el.select('.roo-m-column-body',true).first();
373     }
374     
375     
376     
377     
378    
379 });
380
381  
382
383