//>>built
define("demos/uploader/src",["dojo","dijit","dojox","dojo/require!dojox/form/FileUploader,dijit/form/Button,dojo/parser,dojox/analytics/Urchin,dojox/embed/Flash"],function(_1,_2,_3){_1.require("dojox.form.FileUploader");_1.require("dijit.form.Button");_1.require("dojo.parser");_1.require("dojox.analytics.Urchin");_1.require("dojox.embed.Flash");forceNoFlash=false;selectMultipleFiles=false;var qs=window.location.href.split("?");if(qs.length>1){qs=qs[1];if(qs.indexOf("forceNoFlash")>-1){forceNoFlash=true;}if(qs.indexOf("multiMode")>-1){selectMultipleFiles=true;}}var _4=function(_5){window.location.href=window.location.href.split("?")[0]+_5;};showWithFlash=function(){if(forceNoFlash){_4("");}};showWithoutFlash=function(){if(!forceNoFlash){_4((selectMultipleFiles)?"?forceNoFlash&multiMode":"?forceNoFlash");}};showMulti=function(){if(!selectMultipleFiles){_4((forceNoFlash)?"?forceNoFlash&multiMode":"?multiMode");}};showSingle=function(){if(selectMultipleFiles){_4((forceNoFlash)?"?forceNoFlash":"");}};imageHTML=function(_6){var w=(_6.width<320)?_6.width:320;if(_6.creationDate){var d=_6.creationDate.toString().split(" ");var _7=d[0]+" "+d[1]+" "+d[2]+" "+d[3];}else{_7="NA";}var _8=_6.file.split("/")[_6.file.split("/").length-1];var _9="<div class=\"picFrame\">"+"<img src=\""+_6.file+"\" width=\""+w+"\">"+"<div class=\"picDesc\""+"<div class=\"name\"><strong>"+_8+"</strong></div>"+"<div class=\"date\">Date Created: <strong>"+_7+"</strong></div>"+"<div class=\"dim\">Dimensions: <strong>"+_6.width+" x "+_6.height+"</strong></div>"+"<div class=\"size\">Size: <strong>"+Math.ceil(_6.size*0.001)+"KB</strong></div>"+"</div>"+"</div>";return _9;};var _a="UploadFile.php";var _b="";var _c=[["Jpeg File","*.jpg;*.jpeg"],["GIF File","*.gif"],["PNG File","*.png"],["All Images","*.jpg;*.jpeg;*.gif;*.png"]];_1.addOnLoad(function(){if(forceNoFlash){_3.embed.Flash.available=0;_1.byId("hasFlash").style.display="none";_1.byId("fTypes").style.display="none";}else{_1.byId("noFlash").style.display="none";if(_1.isArray(_c[0])){_1.byId("fTypes").innerHTML+=_c[_c.length-1][1];}else{_1.byId("fTypes").innerHTML+=_c[1];}}if(selectMultipleFiles){_1.byId("fmode").innerHTML=_1.byId("hmode").innerHTML="Multi-File Mode";_1.byId("fSingle").style.display="none";_1.byId("hSingle").style.display="none";_2.byId("fbm").domNode.style.display="none";_2.byId("hbm").domNode.style.display="none";}else{_1.byId("fmode").innerHTML=_1.byId("hmode").innerHTML="Single-File Mode";_1.byId("fMulti").style.display="none";_1.byId("hMulti").style.display="none";_2.byId("fbs").domNode.style.display="none";_2.byId("hbs").domNode.style.display="none";}_1.byId("uploadedFiles").value="";_1.byId("fileToUpload").value="";var f0=new _3.form.FileUploader({button:_2.byId("btn0"),degradable:true,uploadUrl:_a,uploadOnChange:false,selectMultipleFiles:selectMultipleFiles,fileMask:_c,isDebug:true});doUpload=function(){_1.byId("fileToUpload").innerHTML="uploading...";f0.upload();};_1.connect(f0,"onChange",function(_d){var _e=_1.byId("fileToUpload");if(selectMultipleFiles){_1.forEach(_d,function(d){_e.value+=d.name+" "+Math.ceil(d.size*0.001)+"kb \n";});}else{var _f=_d[0];_e.value=_f?(_f.name+" "+Math.ceil(_f.size*0.001)+"kb \n"):"";}});_1.connect(f0,"onProgress",function(_10){console.warn("onProgress",_10);_1.byId("fileToUpload").value="";_1.forEach(_10,function(d){_1.byId("fileToUpload").value+="("+d.percent+"%) "+d.name+" \n";});});_1.connect(f0,"onComplete",function(_11){console.warn("onComplete",_11);_1.forEach(_11,function(d){_1.byId("uploadedFiles").value+=d.file+" \n";_1.byId("rgtCol").innerHTML+=imageHTML(d);_b+=d.file+";";});});Destroy=function(){f0.destroyAll();};new _3.analytics.Urchin({acct:"UA-3572741-1",GAonLoad:function(){this.trackPageView("/demos/uploader");}});});cleanUp=function(){_1.byId("rgtCol").innerHTML="";_1.byId("uploadedFiles").value="";_1.byId("fileToUpload").value="";_1.xhrGet({url:_a,handleAs:"text",content:{rmFiles:_b}});_b="";};_1.addOnUnload(function(){cleanUp();});});