roojs-mailer.js
[roojs1] / roojs-mailer-debug.js
1 /*
2  * - LGPL
3  *
4  * element
5  * <!-- BEGIN TEMPLATE // -->
6                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
7                                 <tr>
8                                 <td align="center" valign="top">
9                               
10  */
11
12 /**
13  * @class Roo.mailer.BodyContainer 
14  * @extends Roo.bootstrap.Component
15  * Bootstrap Element class
16  * @cfg {String} cls class of the element
17  * 
18  * @constructor
19  * Create a new Element
20  * @param {Object} config The config object
21  */
22
23 Roo.mailer = Roo.mailer || {};
24
25 Roo.mailer.Body  = function(config){
26     Roo.mailer.Body.superclass.constructor.call(this, config);
27     //this.el = Roo.get(document.body);
28     
29     Roo.get(document.body).attr({
30         leftmargin : 0,
31         marginwidth : 0,
32         topmargin : 0,
33         marginheight : 0,
34         offset : 0
35     });
36
37 };
38
39 Roo.extend(Roo.mailer.Body, Roo.bootstrap.Component,  {
40     
41     
42     cls: '',
43      
44     
45     getAutoCreate : function(){
46         
47         var cfg ={
48             tag : 'center',
49             cn : [
50                 {
51                     tag: 'table',
52                     border : 0,
53                     cellpadding : 0,
54                     cellspacing : 0,
55                     height : '100%',
56                     align : 'center',
57                     cls: 'roo-m-body-table ' + this.cls,
58                     
59                     cn : [
60                         {
61                             tag : 'tr',
62                             cn : [
63                                 {
64                                     tag : 'td',
65                                     align : 'center',
66                                     valight : 'top',
67                                     cls : 'roo-m-body-cell'
68                                 }
69                             ]
70                         }
71                     ]
72                 }
73             ]
74         };
75          
76         
77         return cfg;
78     },
79     getChildContainer : function()
80     {
81         // add a child...
82          
83         return this.el.select('.roo-m-body-cell').first();
84     }
85     
86     
87     
88     
89    
90 });
91
92  
93
94  /*
95  * - LGPL
96  *
97  * element
98  * <!-- BEGIN TEMPLATE // -->
99                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
100                                 <tr>
101                                 <td align="center" valign="top">
102                               
103  */
104
105 /**
106  * @class Roo.mailer.Block 
107  * @extends Roo.bootstrap.Component
108  * Bootstrap Element class
109  * @cfg {String} cls class of the element
110  * @cfg {String} html content of header (not used for columns)
111  * @cfg {String} blocktype  (header|preheader|footer|body|olumn-container)
112  * 
113  * @constructor
114  * Create a new Element
115  * @param {Object} config The config object
116  */
117
118 Roo.mailer.Block = function(config){
119     Roo.mailer.Block.superclass.constructor.call(this, config);
120 };
121
122 Roo.extend(Roo.mailer.Block, Roo.bootstrap.Component,  {
123     
124     
125     cls: '',
126     html : '',
127     blocktype :   'header',
128      
129     getAutoCreate : function(){
130                                             
131         var tr = {
132             tag : 'tr',
133             cls : 'roo-m-block-tr'
134         }
135         if (this.blocktype != 'column-container') {
136            tr.cn = [
137                 {
138                     tag : 'td',
139                     align : 'center',
140                     valight : 'top',
141                     cls : 'roo-m-' + this.blocktype + '-content',
142                     html : this.html
143                 }
144            ]
145         }
146         
147         var cfg =   {
148             tag: 'table',
149             border : 0,
150             cellpadding : 0,
151             cellspacing : 0,
152             width : '100%',
153             align : 'center',
154             cls: 'roo-m-' + this.blocktype + ' ' + this.cls,
155             
156             cn : [ tr ]
157             
158         };
159  
160         
161         return cfg;
162     },
163     getChildContainer : function()
164     {
165         // add a child...
166         if (this.blogtype == 'column-container') {
167             var par = this.select(
168                         'roo-m-block-tr',true
169                     ).first();
170             return par.createChild( {    
171                     tag:  'td',
172                     align : 'center',
173                     valign : 'top',
174                     style : 'padding-top : 20px;',
175                     cls : 'roo-m-column-container'
176                 }
177           
178             );
179         }
180         
181         return this.el.select('.roo-m-' + this.blocktype + '-content',true).first();
182     }
183     
184     
185     
186     
187    
188 });
189
190  
191
192  /*
193  * - LGPL
194  *
195  * element
196  * <!-- BEGIN TEMPLATE // -->
197                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
198                                 <tr>
199                                 <td align="center" valign="top">
200                               
201  */
202
203 /**
204  * @class Roo.mailer.BodyContainer 
205  * @extends Roo.bootstrap.Component
206  * Bootstrap Element class
207  * @cfg {String} cls class of the element
208  * 
209  * @constructor
210  * Create a new Element
211  * @param {Object} config The config object
212  */
213
214 Roo.mailer.BodyContainer = function(config){
215     Roo.mailer.BodyContainer.superclass.constructor.call(this, config);
216 };
217
218 Roo.extend(Roo.mailer.BodyContainer, Roo.bootstrap.Component,  {
219     
220     
221     cls: '',
222      
223     
224     getAutoCreate : function(){
225         
226         var cfg = {
227             tag: 'table',
228             border : 0,
229             cellpadding : 0,
230             cellspacing : 0,
231             cls: 'roo-m-body-container ' + this.cls 
232             
233         };
234         
235         
236         
237         return cfg;
238     },
239     getChildContainer : function()
240     {
241         // add a child...
242         var tr = this.el.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