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