tag: 'i',
cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
});
+
}
h.push(
{
tag: 'span',
cls : 'panel-title',
- html : this.header
+ html : (this.expandable ? ' ' : '') + this.header
},
{
tag: 'span',
files.push(file);
- this.el.createChild({
+ var preview = new Roo.Element({
tag : 'div',
cls : 'roo-document-manager-preview',
cn : [
tag : 'div',
tooltip : file.filename,
cls : 'roo-document-manager-thumb',
- html : '<img src="' + baseURL +'/Images/Thumb/50/' + file.id + '/' + file.filename + '">'
+ html : '<img src="' + baseURL +'/Images/Thumb/50x80/' + file.id + '/' + file.filename + '">'
+ },
+ {
+ tag : 'button',
+ cls : 'close',
+ html : 'x'
+ }
+ ]
+ }, true);
+
+ var preview = this.el.createChild({
+ tag : 'div',
+ cls : 'roo-document-manager-preview',
+ cn : [
+ {
+ tag : 'div',
+ tooltip : file.filename,
+ cls : 'roo-document-manager-thumb',
+ html : '<img src="' + baseURL +'/Images/Thumb/50x80/' + file.id + '/' + file.filename + '">'
},
{
tag : 'button',
html : 'x'
}
]
-
});
+ var close = preview.select('button.close', true).first();
+
+ close.on('click', this.onRemove, this, { item : preview, data : file} );
+
return;
}, this);
Roo.bootstrap.Container=function(A){Roo.bootstrap.Container.superclass.constructor.call(this,A);this.addEvents({"expand":true,"collapse":true});};Roo.extend(Roo.bootstrap.Container,Roo.bootstrap.Component,{jumbotron:false,well:'',panel:'',header:'',footer:'',sticky:'',tag:false,alert:false,fa:false,icon:false,expandable:false,rheader:'',expanded:true,getChildContainer:function(){if(!this.el){return false;
}if(this.panel.length){return this.el.select('.panel-body',true).first();}return this.el;},getAutoCreate:function(){var A={tag:this.tag||'div',html:'',cls:''};if(this.jumbotron){A.cls='jumbotron';}if(this.sticky.length){var bd=Roo.get(document.body);if(!bd.hasClass('bootstrap-sticky')){bd.addClass('bootstrap-sticky');
Roo.select('html',true).setStyle('height','100%');}A.cls+='bootstrap-sticky-'+this.sticky;}if(this.well.length){switch(this.well){case 'lg':case 'sm':A.cls+=' well well-'+this.well;break;default:A.cls+=' well';break;}}if(this.hidden){A.cls+=' hidden';}if(this.alert&&["success","info","warning","danger"].indexOf(this.alert)>-1){A.cls+=' alert alert-'+this.alert;
-}var B=A;if(this.panel.length){A.cls+=' panel panel-'+this.panel;A.cn=[];if(this.header.length){var h=[];if(this.expandable){A.cls=A.cls+' expandable';h.push({tag:'i',cls:(this.expanded?'fa fa-minus':'fa fa-plus')});}h.push({tag:'span',cls:'panel-title',html:this.header}
+}var B=A;if(this.panel.length){A.cls+=' panel panel-'+this.panel;A.cn=[];if(this.header.length){var h=[];if(this.expandable){A.cls=A.cls+' expandable';h.push({tag:'i',cls:(this.expanded?'fa fa-minus':'fa fa-plus')});}h.push({tag:'span',cls:'panel-title',html:(this.expandable?' ':'')+this.header}
,{tag:'span',cls:'panel-header-right',html:this.rheader});A.cn.push({cls:'panel-heading',cn:h});}B=false;A.cn.push({cls:'panel-body'+(this.expanded?'':' hide'),html:this.html});if(this.footer.length){A.cn.push({cls:'panel-footer',html:this.footer});}}if(B){B.html=this.html||A.html;
if(this.fa){B.html='<i class="fa fa-'+this.fa+'"></i>'+B.html;}if(this.icon){B.html='<i class="glyphicon glyphicon-'+this.icon+'"></i>'+B.html;}}if((!this.cls||!this.cls.length)&&(!A.cls||!A.cls.length)){A.cls='container';}return A;},initEvents:function(){if(!this.expandable){return;
}var A=this.headerEl();if(!A){return;}A.on('click',this.onToggleClick,this);},onToggleClick:function(){var A=this.headerEl();if(!A){return;}if(this.expanded){this.collapse();return;}this.expand();},expand:function(){if(this.fireEvent('expand',this)){this.expanded=true;
]});},this);if(this.files.length>11){this.uploader.hide();}var B={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};A.open(this.method,this.url,true);for(var C in B){var D=B[C];if(D){A.setRequestHeader(C,D);}}var E=this;
A.onload=function(){E.xhrOnLoad(A);};A.onerror=function(){E.xhrOnError(A);};var F=new FormData();F.append('returnHTML','NO');Roo.each(this.files,function(G,H){if(typeof(G.id)!='undefined'&&G.id*1>0){return;}F.append(this.getParamName(H),G,G.name);},this);
if(this.fireEvent('prepare',this,F)!=false){A.send(F);};},getParamName:function(i){if(!this.multiple){return this.paramName;}return this.paramName+"_"+i;},refresh:function(){Roo.each(this.el.select('.roo-document-manager-preview',true).elements,function(el){el.remove();
-},this);var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'&&B.id*1<1){return;}A.push(B);this.el.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50/'+B.id+'/'+B.filename+'">'}
-,{tag:'button',cls:'close',html:'x'}]});return;},this);this.files=A;this.uploader.show();if(this.files.length>11){this.uploader.hide();}},xhrOnLoad:function(A){if(A.readyState!==4){this.refresh();this.fireEvent('exception',this,A);return;}var B=Roo.decode(A.responseText);
-if(!B.success){this.refresh();this.fireEvent('exception',this,A);return;}var i=0;Roo.each(this.files,function(C,D){if(typeof(C.id)!='undefined'&&C.id*1>0){return;}this.files[D]=B.data[i];i++;return;},this);this.refresh();},xhrOnError:function(){Roo.log('xhr on error');
-var A=Roo.decode(xhr.responseText);Roo.log(A);}});
+},this);var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'&&B.id*1<1){return;}A.push(B);var C=new Roo.Element({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50x80/'+B.id+'/'+B.filename+'">'}
+,{tag:'button',cls:'close',html:'x'}]},true);var C=this.el.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50x80/'+B.id+'/'+B.filename+'">'}
+,{tag:'button',cls:'close',html:'x'}]});var D=C.select('button.close',true).first();D.on('click',this.onRemove,this,{item:C,data:B});return;},this);this.files=A;this.uploader.show();if(this.files.length>11){this.uploader.hide();}},xhrOnLoad:function(A){if(A.readyState!==4){this.refresh();
+this.fireEvent('exception',this,A);return;}var B=Roo.decode(A.responseText);if(!B.success){this.refresh();this.fireEvent('exception',this,A);return;}var i=0;Roo.each(this.files,function(C,D){if(typeof(C.id)!='undefined'&&C.id*1>0){return;}this.files[D]=B.data[i];
+i++;return;},this);this.refresh();},xhrOnError:function(){Roo.log('xhr on error');var A=Roo.decode(xhr.responseText);Roo.log(A);}});