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