nulltruemodule("lively.FileUploadWidget").requires().toRun(function(){/*Basicuploadmanagerforsingleormultiplefiles(Safari4Compatible)*adaptedfromAndreaGiammarchi(webreflection.blogspot.com)originalversion(underMIT)*/Object.subclass("FileUploadHelper",{uploadFileMaxSize:30*1024*1024,initialize:function(){this.prefix=""},sendFile:function(handler){if(this.uploadFileMaxSize<handler.file.fileSize){if(Object.isFunction(handler.onerror))handler.onerror();return;};varxhr=newXMLHttpRequest;varupload=xhr.upload;["onabort","onerror","onloadstart","onprogress"].each(function(eachName){upload[eachName]=function(rpe){if(Object.isFunction(handler[eachName]))handler[eachName].call(handler,rpe,xhr);};})upload.onload=function(rpe){if(handler.onreadystatechange===false){if(Object.isFunction(handler.onload))handler.onload(rpe,xhr);}else{setTimeout(function(){if(xhr.readyState===4){if(Object.isFunction(handler.onload))handler.onload(rpe,xhr);}elsesetTimeout(arguments.callee,15);},15);}};xhr.open("PUT",this.urlForFileName(handler.file.fileName),true);xhr.setRequestHeader("If-Modified-Since","Mon,26Jul199705:00:00GMT");xhr.setRequestHeader("Cache-Control","no-cache");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("X-File-Name",handler.file.fileName);xhr.setRequestHeader("X-File-Size",handler.file.fileSize);xhr.setRequestHeader("Content-Type","multipart/form-data");xhr.send(handler.file);returnhandler;},//functiontouploadmultiplefilesviahandlersendMultipleFiles:functionsendMultipleFiles(handler){varlength=handler.files.length;varonload=handler.onload;handler.current=0;handler.total=0;handler.sent=0;while(handler.current<length){handler.total+=handler.files[handler.current++].fileSize;}handler.current=0;varself=this;if(length){handler.file=handler.files[handler.current];varsingleHandler=this.sendFile(handler);if(!singleHandler){return}singleHandler.onload=function(rpe,xhr){if(++handler.current<length){handler.sent+=handler.files[handler.current-1].fileSize;handler.file=handler.files[handler.current];self.sendFile(handler).onload=arguments.callee;}elseif(onload){handler.onload=onload;handler.onload(rpe,xhr);}};};returnhandler;},urlForFileName:function(file){returnthis.prefix+file},parseServerResponse:function(s){varresult={};varm=/<h1>(.*?)<\/h1>/.exec(s);if(m)result.title=m[1];varm=/<p>(.*)<\/p>/.exec(s);if(m)result.message=m[1];returnresult}});Morph.subclass('FileUploadMorph',{//suppressHandles:true,initialize:function($super,bounds){vartempRect=newRectangle(0,0,10,10);bounds=bounds||newRectangle(100,100,400,400);$super(newlively.scene.Rectangle(bounds));this.urlPrefix="media/";this.xeno=newFileUploadXenoMorph(tempRect);this.addMorph(this.xeno);this.bar=newProgressBarMorph(tempRect);this.bar.ignoreEvents();this.bar.setValue(0);this.addMorph(this.bar);this.prefixInput=newTextMorph(tempRect,this.urlPrefix);this.prefixInput.suppressGrabbing=true;this.prefixInput.suppressHandles=true;this.prefixInput.noEval=true;this.addMorph(this.prefixInput);connect(this.prefixInput,"textString",this,"urlPrefix");this.result=newTextMorph(tempRect);this.result.suppressGrabbing=true;this.result.suppressHandles=true;this.addMorph(this.result);this.applyStyle({fill:Color.blue.darker(2).lighter(1),borderRadius:10});this.adjustForNewBounds();},adjustForNewBounds:function($super){$super();varnewExtent=this.innerBounds().extent();varpadding=10;varinnerWidth=newExtent.x-padding-padding;varrunningY=padding;varheight=40;this.xeno.setBounds(newRectangle(padding,runningY,innerWidth,height))runningY+=height+padding;varheight=20;this.bar.setBounds(newRectangle(padding,runningY,innerWidth,height))runningY+=height+padding;varheight=20;this.prefixInput.setBounds(newRectangle(padding,runningY,innerWidth,height))runningY+=height+padding;varremainingHeight=newExtent.y-runningY-padding;this.result.setBounds(newRectangle(padding,runningY,innerWidth,remainingHeight))},})XenoMorph.subclass("FileUploadXenoMorph",{initialize:function($super,bounds){$super(bounds);this.setupHTMLContent();},handlesMouseDown:function(){returntrue},onMouseDown:function(){returnfalse},onMouseMove:function(){returnfalse},setBounds:function($super,newBounds){$super(newBounds);this.updateFoObject(newRectangle(0,0,newBounds.width,newBounds.height));},updateFoObject:function(bounds){this.foRawNode.setAttribute("x",bounds.x)this.foRawNode.setAttribute("y",bounds.y)this.foRawNode.setAttribute("width",bounds.width)this.foRawNode.setAttribute("height",bounds.height)},onDeserialize:function(){console.log("FileUploadXenoMorphonDeserialize:")varforeign=$A(this.rawNode.childNodes).select(function(ea){returnea.tagName=='foreignObject'&&ea!==this.foRawNode},this);foreign.forEach(function(ea){this.rawNode.removeChild(ea)},this);$A(this.foRawNode.childNodes).select(function(ea){this.foRawNode.removeChild(ea)},this)this.setupHTMLContent()},startUpload:function(input){varself=this;varsize=function(bytes){//simplefunctiontoshowafriendlysizevari=0;while(1023<bytes){bytes/=1024;++i;};returni?bytes.toFixed(2)+["","Kb","Mb","Gb","Tb"][i]:bytes+"bytes";};varupload=newFileUploadHelper()if(self.owner.urlPrefix){upload.prefix=self.owner.urlPrefix;if(upload.prefix.endsWith("/")){vardir=newWebResource(URL.source.withFilename(upload.prefix));if(!dir.exists()){console.log("create"+upload.prefix)dir.create()}}}upload.sendMultipleFiles({//listoffilestouploadfiles:input.files,//clearthecontaineronloadstart:function(){},//dosomethingduringupload...onprogress:function(rpe){self.owner.bar.setValue(rpe.loaded/rpe.total)self.owner.result.setTextString(["Uploading:"+this.file.fileName,"Sent:"+size(rpe.loaded)+"of"+size(rpe.total),"TotalSent:"+size(this.sent+rpe.loaded)+"of"+size(this.total)].join("\n"));},//firedwhenlastfilehasbeenuploadedonload:function(rpe,xhr){varresponse=upload.parseServerResponse(xhr.responseText);console.log("response"+response+"source:"+xhr.responseText);Global.areg=xhr.responseText;if(response.message){self.owner.result.setTextString(self.owner.result.textString+"\nServerResponse:"+response.message);}//enabletheinputagaininput.removeAttribute("disabled");},//ifsomethingiswrong...(fromnativeinstanceorbecauseofsize)onerror:function(){self.owner.result.setTextString("Thefile"+this.file.fileName+"istoobig["+size(this.file.fileSize)+"]");//enabletheinputagaininput.removeAttribute("disabled");}});},setupHTMLContent:function(){varinput=document.createElement("input");input.setAttribute("type","file");input.setAttribute("multiple","multiple");//input.setAttribute("style","left:0px;top:-10px;width:100px;height:20px;");this.foRawNode.appendChild(input);varself=this;input.addEventListener("change",function(){//disabletheinputinput.setAttribute("disabled","true");self.startUpload(input);},false);},})FileUploadMorph.openSample=function(){//TestCodeif($morph("FileUpload"))$morph("FileUpload").remove()fileUploadMorph=newFileUploadMorph();fileUploadMorph.xenofileUploadMorph.openInWorld();fileUploadMorph.name="FileUpload"}FileUploadMorph.openSample()})(.*?)<\\/h1>/.exec(s);\n\t\tif (m) result.title = m[1];\n\n\t\tvar m = /(.*)<\\/p>/.exec(s);\n\t\tif (m) result.message = m[1];\n\n\t\treturn result\n\t}\n\n});\n\n\nMorph.subclass('FileUploadMorph', {\n\t//suppressHandles: true,\n\n\tinitialize: function($super, bounds) {\n\t\tvar tempRect = new Rectangle(0,0,10,10);\n\t\t\n\t\tbounds = bounds || new Rectangle(100,100,400,400);\n\n\t\t$super(new lively.scene.Rectangle(bounds));\n\n\t\tthis.urlPrefix = \"media/\";\n\n\t\tthis.xeno = new FileUploadXenoMorph(tempRect);\n\t\tthis.addMorph(this.xeno);\n\n\t\tthis.bar = new ProgressBarMorph(tempRect);\n\t\tthis.bar.ignoreEvents();\n\t\tthis.bar.setValue(0);\n\t\tthis.addMorph(this.bar);\n\n\t\tthis.prefixInput = new TextMorph(tempRect, this.urlPrefix);\n\t\tthis.prefixInput.suppressGrabbing = true;\n\t\tthis.prefixInput.suppressHandles = true;\n\t\tthis.prefixInput.noEval = true;\n\n\t\tthis.addMorph(this.prefixInput);\n\n\t\tconnect(this.prefixInput, \"textString\", this, \"urlPrefix\");\n\n\t\tthis.result = new TextMorph(tempRect);\n\t\tthis.result.suppressGrabbing = true;\n\t\tthis.result.suppressHandles = true;\n\n\t\tthis.addMorph(this.result);\n\n\t\tthis.applyStyle({fill: Color.blue.darker(2).lighter(1), borderRadius: 10});\n\n\n\t\t\n\n\t\t\n\n\n\t\tthis.adjustForNewBounds();\n\t},\n\t\n\tadjustForNewBounds: function ($super) {\n $super();\n var newExtent = this.innerBounds().extent();\n\n\t\tvar padding = 10; \n\t\tvar innerWidth = newExtent.x - padding - padding;\t\n\n\t\tvar runningY = padding;\n\t\t\n\t\tvar height = 40;\n\t\tthis.xeno.setBounds(new Rectangle(padding, runningY,innerWidth, height))\t\n\t\trunningY += height + padding;\n\n\n\t\tvar height = 20;\n\t\tthis.bar.setBounds(new Rectangle(padding, runningY, innerWidth, height))\n\t\trunningY += height + padding;\n\n\t\tvar height = 20;\n\t\tthis.prefixInput.setBounds(new Rectangle(padding, runningY, innerWidth, height))\n\t\trunningY += height + padding;\n\n\t\tvar remainingHeight = newExtent.y - runningY - padding;\n\t\tthis.result.setBounds(new Rectangle(padding, runningY, innerWidth, remainingHeight))\n },\n})\n\nXenoMorph.subclass(\"FileUploadXenoMorph\", {\n\n\tinitialize: function($super, bounds) {\n\t\t$super(bounds);\n\t\tthis.setupHTMLContent();\n\t},\n\n\thandlesMouseDown: function() {return true},\n\tonMouseDown: function() {return false},\n\tonMouseMove: function() {return false},\n\n\tsetBounds: function($super, newBounds) {\n\t\t$super(newBounds);\n\t\tthis.updateFoObject(new Rectangle(0,0,newBounds.width, newBounds.height));\n\t},\n\t\n\tupdateFoObject: function(bounds) {\n\t\tthis.foRawNode.setAttribute(\"x\", bounds.x)\n\t\tthis.foRawNode.setAttribute(\"y\", bounds.y)\n\t\tthis.foRawNode.setAttribute(\"width\", bounds.width)\n\t\tthis.foRawNode.setAttribute(\"height\", bounds.height)\n\t\t\n\t},\n\n\tonDeserialize: function() {\n\t\tconsole.log(\"FileUploadXenoMorph onDeserialize:\")\n\t\tvar foreign = $A(this.rawNode.childNodes).select(function(ea) {\n\t\t\treturn ea.tagName == 'foreignObject' && ea !== this.foRawNode}, this);\n\t\tforeign.forEach(function(ea) { this.rawNode.removeChild(ea) }, this);\n\t\t\n\t\t$A(this.foRawNode.childNodes).select(function(ea) {\n\t\t\tthis.foRawNode.removeChild(ea)\n\t\t}, this)\n\t\t\n\t\tthis.setupHTMLContent()\n\t},\n\n\tstartUpload: function(input) {\n\t\tvar self = this;\n\t\tvar size = function(bytes){\t // simple function to show a friendly size\n\t\t\tvar i = 0;\n\t\t\twhile(1023 < bytes){\n\t\t\t\tbytes /= 1024;\n\t\t\t\t++i;\n\t\t\t};\n\t\t\treturn\ti ? bytes.toFixed(2) + [\"\", \" Kb\", \" Mb\", \" Gb\", \" Tb\"][i] : bytes + \" bytes\";\n\t\t};\n\n\t\tvar upload = new FileUploadHelper()\t\t\t\t\n\t\tif (self.owner.urlPrefix) {\t\t\n\t\t\tupload.prefix = self.owner.urlPrefix;\n\t\t\n\t\t\tif (upload.prefix.endsWith(\"/\")) {\n\t\t\t\tvar dir = new WebResource(URL.source.withFilename(upload.prefix));\n\t\t\t\tif (!dir.exists()) {\n\t\t\t\t\tconsole.log(\"create \" + upload.prefix)\n\t\t\t\t\tdir.create()\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tupload.sendMultipleFiles({\n\n\t\t\t// list of files to upload\n\t\t\tfiles: input.files,\n\n\t\t\t// clear the container \n\t\t\tonloadstart:function(){\n\t\t\t},\n\n\t\t\t// do something during upload ...\n\t\t\tonprogress:function(rpe){\n\t\t\t\tself.owner.bar.setValue(rpe.loaded / rpe.total)\n\t\t\t\tself.owner.result.setTextString([\n\t\t\t\t\t\"Uploading: \" + this.file.fileName,\n\t\t\t\t\t\"Sent: \" + size(rpe.loaded) + \" of \" + size(rpe.total),\n\t\t\t\t\t\"Total Sent: \" + size(this.sent + rpe.loaded) + \" of \" + size(this.total)\n\t\t\t\t\t].join(\"\\n\"));\n\t\t\t\t},\n\n\t\t\t// fired when last file has been uploaded\n\t\t\tonload:function(rpe, xhr){\n\n\t\t\t\tvar response =\tupload.parseServerResponse(xhr.responseText);\n\t\t\t\tconsole.log(\"response \" + response + \" source: \" + xhr.responseText);\n\t\t\t\tGlobal.areg = xhr.responseText;\n\t\t\t\tif (response.message) {\n\t\t\t\t\tself.owner.result.setTextString( self.owner.result.textString + \n\t\t\t\t\t\t\" \\nServer Response: \"\t+ response.message);\n\t\t\t\t} \n\t\t\t\t// enable the input again\n\t\t\t\tinput.removeAttribute(\"disabled\");\n\t\t\t},\n\n\t\t\t// if something is wrong ... (from native instance or because of size)\n\t\t\tonerror:function(){\n\t\t\t\tself.owner.result.setTextString( \"The file \" + this.file.fileName + \n\t\t\t\t\" is too big [\" + size(this.file.fileSize) + \"]\");\t\t\t\t \n\t\t\t\t// enable the input again\n\t\t\t\tinput.removeAttribute(\"disabled\");\n\t\t\t}\n\t\t});\n\t},\n\n\tsetupHTMLContent: function() {\n\n\t\tvar input = document.createElement(\"input\");\n\t\tinput.setAttribute(\"type\", \"file\");\n\t\tinput.setAttribute(\"multiple\", \"multiple\"); \n\t\t//input.setAttribute(\"style\", \"left:0px; top:-10px; width:100px; height:20px;\"); \n\n\t\tthis.foRawNode.appendChild(input);\n\n\t\n\t\tvar self = this;\n\n\t\tinput.addEventListener(\"change\", function(){\t\t\t\t\n\t\t\t// disable the input\n\t\t\tinput.setAttribute(\"disabled\", \"true\");\n\t\t\tself.startUpload(input);\t\t\n\t\t}, false);\n\t},\n})\n\nFileUploadMorph.openSample = function() { \n\t// Test Code\n\tif ($morph(\"FileUpload\"))\n\t\t$morph(\"FileUpload\").remove()\n\n\tfileUploadMorph = new FileUploadMorph();\n\tfileUploadMorph.xeno\n\tfileUploadMorph.openInWorld();\n\tfileUploadMorph.name = \"FileUpload\"\n}\n\n\nFileUploadMorph.openSample()\n\n})\n"]]>
truetruefalsefalse291(.*?)<\\/h1>/.exec(s);\n\t\tif (m) result.title = m[1];\n\n\t\tvar m = /(.*)<\\/p>/.exec(s);\n\t\tif (m) result.message = m[1];\n\n\t\treturn result\n\t}\n\n});\n\n\nMorph.subclass('FileUploadMorph', {\n\t//suppressHandles: true,\n\n\tinitialize: function($super, bounds) {\n\t\tvar tempRect = new Rectangle(0,0,10,10);\n\t\t\n\t\tbounds = bounds || new Rectangle(100,100,400,400);\n\n\t\t$super(new lively.scene.Rectangle(bounds));\n\n\t\tthis.urlPrefix = \"media/\";\n\n\t\tthis.xeno = new FileUploadXenoMorph(tempRect);\n\t\tthis.addMorph(this.xeno);\n\n\t\tthis.bar = new ProgressBarMorph(tempRect);\n\t\tthis.bar.ignoreEvents();\n\t\tthis.bar.setValue(0);\n\t\tthis.addMorph(this.bar);\n\n\t\tthis.prefixInput = new TextMorph(tempRect, this.urlPrefix);\n\t\tthis.prefixInput.suppressGrabbing = true;\n\t\tthis.prefixInput.suppressHandles = true;\n\t\tthis.prefixInput.noEval = true;\n\n\t\tthis.addMorph(this.prefixInput);\n\n\t\tconnect(this.prefixInput, \"textString\", this, \"urlPrefix\");\n\n\t\tthis.result = new TextMorph(tempRect);\n\t\tthis.result.suppressGrabbing = true;\n\t\tthis.result.suppressHandles = true;\n\n\t\tthis.addMorph(this.result);\n\n\t\tthis.applyStyle({fill: Color.blue.darker(2).lighter(1), borderRadius: 10});\n\n\n\t\t\n\n\t\t\n\n\n\t\tthis.adjustForNewBounds();\n\t},\n\t\n\tadjustForNewBounds: function ($super) {\n $super();\n var newExtent = this.innerBounds().extent();\n\n\t\tvar padding = 10; \n\t\tvar innerWidth = newExtent.x - padding - padding;\t\n\n\t\tvar runningY = padding;\n\t\t\n\t\tvar height = 40;\n\t\tthis.xeno.setBounds(new Rectangle(padding, runningY,innerWidth, height))\t\n\t\trunningY += height + padding;\n\n\n\t\tvar height = 20;\n\t\tthis.bar.setBounds(new Rectangle(padding, runningY, innerWidth, height))\n\t\trunningY += height + padding;\n\n\t\tvar height = 20;\n\t\tthis.prefixInput.setBounds(new Rectangle(padding, runningY, innerWidth, height))\n\t\trunningY += height + padding;\n\n\t\tvar remainingHeight = newExtent.y - runningY - padding;\n\t\tthis.result.setBounds(new Rectangle(padding, runningY, innerWidth, remainingHeight))\n },\n})\n\nXenoMorph.subclass(\"FileUploadXenoMorph\", {\n\n\tinitialize: function($super, bounds) {\n\t\t$super(bounds);\n\t\tthis.setupHTMLContent();\n\t},\n\n\thandlesMouseDown: function() {return true},\n\tonMouseDown: function() {return false},\n\tonMouseMove: function() {return false},\n\n\tsetBounds: function($super, newBounds) {\n\t\t$super(newBounds);\n\t\tthis.updateFoObject(new Rectangle(0,0,newBounds.width, newBounds.height));\n\t},\n\t\n\tupdateFoObject: function(bounds) {\n\t\tthis.foRawNode.setAttribute(\"x\", bounds.x)\n\t\tthis.foRawNode.setAttribute(\"y\", bounds.y)\n\t\tthis.foRawNode.setAttribute(\"width\", bounds.width)\n\t\tthis.foRawNode.setAttribute(\"height\", bounds.height)\n\t\t\n\t},\n\n\tonDeserialize: function() {\n\t\tconsole.log(\"FileUploadXenoMorph onDeserialize:\")\n\t\tvar foreign = $A(this.rawNode.childNodes).select(function(ea) {\n\t\t\treturn ea.tagName == 'foreignObject' && ea !== this.foRawNode}, this);\n\t\tforeign.forEach(function(ea) { this.rawNode.removeChild(ea) }, this);\n\t\t\n\t\t$A(this.foRawNode.childNodes).select(function(ea) {\n\t\t\tthis.foRawNode.removeChild(ea)\n\t\t}, this)\n\t\t\n\t\tthis.setupHTMLContent()\n\t},\n\n\tstartUpload: function(input) {\n\t\tvar self = this\n\t\tvar size = function(bytes){\t // simple function to show a friendly size\n\t\t\tvar i = 0;\n\t\t\twhile(1023 < bytes){\n\t\t\t\tbytes /= 1024;\n\t\t\t\t++i;\n\t\t\t};\n\t\t\treturn\ti ? bytes.toFixed(2) + [\"\", \" Kb\", \" Mb\", \" Gb\", \" Tb\"][i] : bytes + \" bytes\";\n\t\t};\n\n\t\tvar upload = new FileUploadHelper()\t\t\t\t\n\t\tif (self.owner.urlPrefix) {\t\t\n\t\t\tupload.prefix = self.owner.urlPrefix;\n\t\t\n\t\t\tif (upload.prefix.endsWith(\"/\")) {\n\t\t\t\tvar dir = new WebResource(URL.source.withFilename(upload.prefix));\n\t\t\t\tif (!dir.exists()) {\n\t\t\t\t\tconsole.log(\"create \" + upload.prefix)\n\t\t\t\t\tdir.create()\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tupload.sendMultipleFiles({\n\n\t\t\t// list of files to upload\n\t\t\tfiles: input.files,\n\n\t\t\t// clear the container \n\t\t\tonloadstart:function(){\n\t\t\t},\n\n\t\t\t// do something during upload ...\n\t\t\tonprogress:function(rpe){\n\t\t\t\tself.owner.bar.setValue(rpe.loaded / rpe.total)\n\t\t\t\tself.owner.result.setTextString([\n\t\t\t\t\t\"Uploading: \" + this.file.fileName,\n\t\t\t\t\t\"Sent: \" + size(rpe.loaded) + \" of \" + size(rpe.total),\n\t\t\t\t\t\"Total Sent: \" + size(this.sent + rpe.loaded) + \" of \" + size(this.total)\n\t\t\t\t\t].join(\"\\n\"));\n\t\t\t\t},\n\n\t\t\t// fired when last file has been uploaded\n\t\t\tonload:function(rpe, xhr){\n\n\t\t\t\tvar response =\tupload.parseServerResponse(xhr.responseText);\n\t\t\t\tconsole.log(\"response \" + response + \" source: \" + xhr.responseText);\n\t\t\t\tGlobal.areg = xhr.responseText;\n\t\t\t\tif (response.message) {\n\t\t\t\t\tself.owner.result.setTextString( self.owner.result.textString + \n\t\t\t\t\t\t\" \\nServer Response: \"\t+ response.message);\n\t\t\t\t} \n\t\t\t\t// enable the input again\n\t\t\t\tinput.removeAttribute(\"disabled\");\n\t\t\t},\n\n\t\t\t// if something is wrong ... (from native instance or because of size)\n\t\t\tonerror:function(){\n\t\t\t\tself.owner.result.setTextString( \"The file \" + this.file.fileName + \n\t\t\t\t\" is too big [\" + size(this.file.fileSize) + \"]\");\t\t\t\t \n\t\t\t\t// enable the input again\n\t\t\t\tinput.removeAttribute(\"disabled\");\n\t\t\t}\n\t\t});\n\t},\n\n\tsetupHTMLContent: function() {\n\n\t\tvar input = document.createElement(\"input\");\n\t\tinput.setAttribute(\"type\", \"file\");\n\t\tinput.setAttribute(\"multiple\", \"multiple\"); \n\t\t//input.setAttribute(\"style\", \"left:0px; top:-10px; width:100px; height:20px;\"); \n\n\t\tthis.foRawNode.appendChild(input);\n\n\t\n\t\tvar self = this;\n\n\t\tinput.addEventListener(\"change\", function(){\t\t\t\t\n\t\t\t// disable the input\n\t\t\tinput.setAttribute(\"disabled\", \"true\");\n\t\t\tself.startUpload(input);\t\t\n\t\t}, false);\n\t},\n})\n\nFileUploadMorph.openSample = function() { \n\t// Test Code\n\tif ($morph(\"FileUpload\"))\n\t\t$morph(\"FileUpload\").remove()\n\n\tfileUploadMorph = new FileUploadMorph();\n\tfileUploadMorph.xeno\n\tfileUploadMorph.openInWorld();\n\tfileUploadMorph.name = \"FileUpload\"\n}\n\n\nFileUploadMorph.openSample()\n\n})\n"]]>