From 9aaa20738f27b23a086795974553228b8c350987 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 28 Sep 2016 11:43:51 +0800 Subject: [PATCH] roojs-mailer.js roojs-mailer-debug.js --- roojs-mailer-debug.js | 17 ++++++++++------- roojs-mailer.js | 26 +++++++++++++++----------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/roojs-mailer-debug.js b/roojs-mailer-debug.js index c0e560e813..6b172f916b 100644 --- a/roojs-mailer-debug.js +++ b/roojs-mailer-debug.js @@ -18,7 +18,7 @@ Roo.mailer = Roo.mailer || {}; * @param {Object} config The config object */ -_calls = 0; + Roo.mailer.Body = function(config){ Roo.mailer.Body.superclass.constructor.call(this, config); @@ -31,8 +31,9 @@ Roo.mailer.Body = function(config){ marginheight : 0, offset : 0 }); - _calls++; - if (_calls > 1) { + Roo.mailer.Body._calls++; + if (Roo.mailer.Body._calls > 1) { + return; throw "test"; } @@ -41,6 +42,8 @@ Roo.mailer.Body = function(config){ }; +Roo.mailer.Body._calls = 0; + Roo.extend(Roo.mailer.Body, Roo.bootstrap.Component, { @@ -139,9 +142,9 @@ Roo.extend(Roo.mailer.Block, Roo.bootstrap.Component, { var tr = { tag : 'tr', cls : 'roo-m-block-tr' - } + }; if (this.blocktype != 'row') { - tr.cn = [ + tr.cn = [ { tag : 'td', align : 'center', @@ -149,7 +152,7 @@ Roo.extend(Roo.mailer.Block, Roo.bootstrap.Component, { cls : 'roo-m-' + this.blocktype + '-content', html : this.html } - ] + ]; } var cfg = { @@ -316,7 +319,7 @@ Roo.extend(Roo.mailer.Column, Roo.bootstrap.Component, { var tr = { tag : 'tr', cn : [ ] - } + }; diff --git a/roojs-mailer.js b/roojs-mailer.js index f06caece5f..0023cec4d1 100644 --- a/roojs-mailer.js +++ b/roojs-mailer.js @@ -1,11 +1,15 @@ -//Roo/mailer/Body.js -Roo.mailer=Roo.mailer||{};_calls=0;Roo.mailer.Body=function(A){Roo.mailer.Body.superclass.constructor.call(this,A);var B=Roo.get(document.body);B.attr({leftmargin:0,marginwidth:0,topmargin:0,marginheight:0,offset:0});_calls++;if(_calls>1){throw "test";} -this.onRender(B);this.onRender=function(){};};Roo.extend(Roo.mailer.Body,Roo.bootstrap.Component,{cls:'',getAutoCreate:function(){var A={tag:'center',cn:[{tag:'table',border:0,cellpadding:0,cellspacing:0,height:'100%',align:'center',cls:'roo-m-body-table '+this.cls,cn:[{tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-body-cell'}]}]}]};return A;},getChildContainer:function(){return this.el.select('.roo-m-body-cell').first();},addxtype:function(A,B){return this.addxtypeChild(A,B);}}); -//Roo/mailer/Block.js -Roo.mailer.Block=function(A){Roo.mailer.Block.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Block,Roo.bootstrap.Component,{cls:'',html:'',blocktype:'header',getAutoCreate:function(){var tr={tag:'tr',cls:'roo-m-block-tr'};if(this.blocktype!='row'){tr.cn=[{tag:'td',align:'center',valight:'top',cls:'roo-m-'+this.blocktype+'-content',html:this.html}]}var cfg={tag:'table',border:0,cellpadding:0,cellspacing:0,width:'100%',align:'center',cls:'roo-m-'+this.blocktype+' '+this.cls,cn:[tr]};return cfg;},getChildContainer:function(A){if(this.blocktype=='row'&&A){var B=this.el.select('.roo-m-block-tr',true).first();return B.createChild({tag:'td',align:'center',valign:'top',style:'padding-top : 20px;',cls:'roo-m-column'});}return this.el.select('.roo-m-'+this.blocktype+'-content',true).first();}}); -//Roo/mailer/BodyContainer.js -Roo.mailer.BodyContainer=function(A){Roo.mailer.BodyContainer.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.BodyContainer,Roo.bootstrap.Component,{cls:'',getAutoCreate:function(){var A={tag:'table',border:0,cellpadding:0,cellspacing:0,cls:'roo-m-body-container '+this.cls,cn:[{tag:'tbody'}]};return A;},getChildContainer:function(){var tr=this.el.select('tbody',true).first().createChild({tag:'tr',cn:[{tag:'td',align:'center',valign:'top',cls:'roo-m-child-ctr'}]});return tr.select('.roo-m-child-ctr').first();}}); -//Roo/mailer/Column.js -Roo.mailer.Column=function(A){Roo.mailer.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Column,Roo.bootstrap.Component,{cls:'',html:'',src:'',column:'left',width:'100%',getAutoCreate:function(){var tr={tag:'tr',cn:[]};var cfg={tag:'table',border:0,cellpadding:20,cellspacing:0,width:this.width,cn:[]};if(this.src!=''){var A={tag:'img',src:this.src,cls:'roo-m-column-image',style:'max-width: '+(this.width=='100%'?'260':this.width)+'px;'};if(this.width!='100%'){A.width=this.width;} -cfg.cn.push({tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-column-'+this.column+'-content',cn:[A]}]});} -cfg.cn.push({tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-column-'+this.column+'-content roo-m-column-body',html:this.html}]});return cfg;},getChildContainer:function(){return this.el.select('.roo-m-column-body',true).first();}}); +// Roo/mailer/Body.js +Roo.mailer=Roo.mailer||{};Roo.mailer.Body=function(A){Roo.mailer.Body.superclass.constructor.call(this,A);var B=Roo.get(document.body);B.attr({leftmargin:0,marginwidth:0,topmargin:0,marginheight:0,offset:0});Roo.mailer.Body._calls++;if(Roo.mailer.Body._calls>1){return; +throw "test";}this.onRender(B);this.onRender=function(){};};Roo.mailer.Body._calls=0;Roo.extend(Roo.mailer.Body,Roo.bootstrap.Component,{cls:'',getAutoCreate:function(){var A={tag:'center',cn:[{tag:'table',border:0,cellpadding:0,cellspacing:0,height:'100%',align:'center',cls:'roo-m-body-table '+this.cls,cn:[{tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-body-cell'} +]}]}]};return A;},getChildContainer:function(){return this.el.select('.roo-m-body-cell').first();},addxtype:function(A,B){return this.addxtypeChild(A,B);}}); +// Roo/mailer/Block.js +Roo.mailer.Block=function(A){Roo.mailer.Block.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Block,Roo.bootstrap.Component,{cls:'',html:'',blocktype:'header',getAutoCreate:function(){var tr={tag:'tr',cls:'roo-m-block-tr'};if(this.blocktype!='row'){tr.cn=[{tag:'td',align:'center',valight:'top',cls:'roo-m-'+this.blocktype+'-content',html:this.html} +];}var A={tag:'table',border:0,cellpadding:0,cellspacing:0,width:'100%',align:'center',cls:'roo-m-'+this.blocktype+' '+this.cls,cn:[tr]};return A;},getChildContainer:function(A){if(this.blocktype=='row'&&A){var B=this.el.select('.roo-m-block-tr',true).first(); +return B.createChild({tag:'td',align:'center',valign:'top',style:'padding-top : 20px;',cls:'roo-m-column'});}return this.el.select('.roo-m-'+this.blocktype+'-content',true).first();}}); +// Roo/mailer/BodyContainer.js +Roo.mailer.BodyContainer=function(A){Roo.mailer.BodyContainer.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.BodyContainer,Roo.bootstrap.Component,{cls:'',getAutoCreate:function(){var A={tag:'table',border:0,cellpadding:0,cellspacing:0,cls:'roo-m-body-container '+this.cls,cn:[{tag:'tbody'} +]};return A;},getChildContainer:function(){var tr=this.el.select('tbody',true).first().createChild({tag:'tr',cn:[{tag:'td',align:'center',valign:'top',cls:'roo-m-child-ctr'}]});return tr.select('.roo-m-child-ctr').first();}}); +// Roo/mailer/Column.js +Roo.mailer.Column=function(A){Roo.mailer.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Column,Roo.bootstrap.Component,{cls:'',html:'',src:'',column:'left',width:'100%',getAutoCreate:function(){var tr={tag:'tr',cn:[]};var A={tag:'table',border:0,cellpadding:20,cellspacing:0,width:this.width,cn:[]} +;if(this.src!=''){var B={tag:'img',src:this.src,cls:'roo-m-column-image',style:'max-width: '+(this.width=='100%'?'260':this.width)+'px;'};if(this.width!='100%'){B.width=this.width;}A.cn.push({tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-column-'+this.column+'-content',cn:[B]} +]});}A.cn.push({tag:'tr',cn:[{tag:'td',align:'center',valight:'top',cls:'roo-m-column-'+this.column+'-content roo-m-column-body',html:this.html}]});return A;},getChildContainer:function(){return this.el.select('.roo-m-column-body',true).first();}}); -- 2.39.2