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.Body  = function(config){
24     Roo.mailer.Body.superclass.constructor.call(this, config);
25     //this.el = Roo.get(document.body);
26     
27     Roo.get(document.body).attr({
28         leftmargin : 0,
29         marginwidth : 0,
30         topmargin : 0,
31         marginheight : 0,
32         offset : 0
33     });
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|column-container)
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 != 'column-container') {
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()
162     {
163         // add a child...
164         if (this.blogtype == 'column-container') {
165             var par = this.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-column-container'
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-template-container ' + this.cls 
230             
231         };
232         
233         
234         
235         return cfg;
236     },
237     getChildContainer : function()
238     {
239         // add a child...
240         var tr = this.el.createChild({
241                     tag : 'tr',
242                     cn : [
243                         {   
244                             tag:  'td',
245                             align : 'center',
246                             valign : 'top',
247                             cls : 'roo-m-child-ctr'
248                         }
249                     ]
250                 });
251         
252         return tr.select('.roo-m-child-ctr').first();
253     }
254     
255     
256     
257     
258    
259 });
260
261  
262
263  /*
264  * - LGPL
265  *
266  * element
267  * <!-- BEGIN TEMPLATE // -->
268                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
269                                 <tr>
270                                 <td align="center" valign="top">
271                               
272  */
273
274 /**
275  * @class Roo.mailer.Column 
276  * @extends Roo.bootstrap.Component
277  * Bootstrap Element class
278  * @cfg {String} cls class of the element
279  * @cfg {String} html content of body
280  * @cfg {String} src image url
281  * @cfg {String} column  (left|right)
282  * 
283  * @constructor
284  * Create a new Element
285  * @param {Object} config The config object
286  */
287
288 Roo.mailer.Column = function(config){
289     Roo.mailer.Column.superclass.constructor.call(this, config);
290 };
291
292 Roo.extend(Roo.mailer.Column, Roo.bootstrap.Component,  {
293     
294     
295     cls: '',
296     html : '',
297     src : '',
298     column : 'left',
299      
300     getAutoCreate : function(){
301                                             
302         var tr = {
303             tag : 'tr',
304             cn : [ ]
305         }
306          
307        
308         
309         var cfg =   { 
310             tag: 'table',
311             border : 0,
312             cellpadding :20,
313             cellspacing : 0,
314             width : '100%',
315            
316             cn :  []
317             
318         };
319         if (this.src != '') {
320            cfg.cn.push({
321                 tag  : 'tr',
322                 cn : [
323                     {
324                         tag : 'td',
325                         align : 'center',
326                         valight : 'top',
327                         cls : 'roo-m-column-left-content',
328                         cn : [
329                             {
330                                 tag : 'img',
331                                 src : this.src,
332                                 cls : 'roo-m-column-image',
333                                 style : 'max-width: 260px;'
334                             }
335                         ]
336                     }
337                 ]
338             });
339            
340         }
341         cfg.cn.push({
342              tag  : 'tr',
343              cn : [
344                  {
345                      tag : 'td',
346                      align : 'center',
347                      valight : 'top',
348                      cls : 'roo-m-column-left-content roo-m-column-body',
349                      html : this.html
350                  }
351              ]
352          });
353            
354         
355         return cfg;
356     },
357     getChildContainer : function()
358     {
359         // add a child...
360         
361         return this.el.select('.roo-m-column-body',true).first();
362     }
363     
364     
365     
366     
367    
368 });
369
370  
371
372