//>>built
require({cache:{"url:mill/jssupport/form/attachment.html":'\x3cdiv\x3e\x3ca href\x3d"javascript:"\x3e\x3cdiv data-dojo-type\x3d"office.TranslatableNode" data-dojo-props\x3d"display: \'inline\'" data-dojo-attach-point\x3d"translatableNode" class\x3d"officeAttachmentTextNode blue"\x3e\x3c/div\x3e\x3cdiv class\x3d"officeAttachmentInputContainer"\x3e\x3cinput type\x3d"file" name\x3d"${name}" data-dojo-attach-point\x3d"inputNode, focusNode" data-dojo-attach-event\x3d"onchange: onChange"/\x3e\x3c/div\x3e\x3c/a\x3e\x3cdiv data-dojo-type\x3d"office.TranslatableNode" data-dojo-attach-point\x3d"progressNode" class\x3d"margin-5px-0 blue small"\x3e\x3c/div\x3e\x3cdiv data-dojo-type\x3d"office.TranslatableNode" data-dojo-attach-point\x3d"fileErrorNode" class\x3d"margin-5px-0 red small"\x3e\x3c/div\x3e\x3c/div\x3e'}});
define("mill/jssupport/form/Attachment","dojo/_base/declare dojo/_base/lang dojo/query dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-style dijit/form/_FormWidget dijit/_WidgetsInTemplateMixin dojo/text!mill/jssupport/form/attachment.html mill/jssupport/base mill/mill".split(" "),function(h,c,k,l,f,d,e,m,n,p,q,g){return mill.registerAlias("office.form.Attachment",h("mill.jssupport.form.Attachment",[m,n],{baseClass:"officeAttachment",templateString:p,labelIdentifier:null,label:null,anotherFileLabel:null,
required:null,readOnly:null,tabIndex:"-1",attachmentType:"blob",extension:"bmp|jpeg|png|tif|pdf",accept:null,extensionText:"",maxSize:15,_uploadedFile:null,_fileName:"",_uploadState:0,validateState:0,_savedValue:null,_savedValueNode:null,_setLabelIdentifierAttr:function(a){this.set("label",this.labelIdentifier=a)},_setRequiredAttr:function(a){this._required=a},_setLabelAttr:function(a){this.translatableNode.set("text",this.value=a)},_setExtensionAttr:function(a){this.extension=new RegExp(a,"i");this.extensionText=
a.split("|").join(", ")},_setAcceptAttr:function(a){l.set(this.inputNode,"accept",this.accept=a)},_setMaxSizeAttr:function(a){this.maxSize=1048576*a},_setValidateStateAttr:function(a){0<(this.validateState=a)&&this.set("label",this.anotherFileLabel)},_getSize:function(){return mill.formatSize(this.inputNode.files[0].size)},_setProgressNodeColor:function(a){f.remove(this.progressNode.domNode,["blue","green","red"]);f.add(this.progressNode.domNode,a||"blue")},validate:function(){var a=0<=this._uploadState&&
(!this._required||this._required&&0<this._uploadState||0<this.validateState);this._set("state",a?"":"Error");return a},onChange:function(a){this.inputNode.files.length&&(0>this._uploadState?this.inputNode.value="":this.inputNode.files[0].type.match(this.extension)||"application/vnd.ms-excel"===this.inputNode.files[0].type&&"xls".match(this.extension)?this.inputNode.files[0].size>this.maxSize?(this.fileErrorNode.set("text","\x3cb\x3e"+this.inputNode.files[0].name+"\x3c/b\x3e: ;Office.MaxSizeError; "+
this.maxSize/1024/1024+" Mb"),this.inputNode.value=""):(this.set("readOnly",!0),this._set("state",""),a=this._getSize(),this._fileName="\x3cb\x3e"+this.inputNode.files[0].name+(0<this.inputNode.files[0].size?" ["+a.size+" "+a.unit+"]":"")+"\x3c/b\x3e",this.set("label","Office.UploadingData"),this._setProgressNodeColor(),this.fileErrorNode.set("text",""),this.upload()):(this.fileErrorNode.set("text","\x3cb\x3e"+this.inputNode.files[0].name+"\x3c/b\x3e: ;Office.ExtensionError; "+this.extensionText),
this.inputNode.value=""))},onProgress:function(a){"progress"===a.type&&1>a.decimal?this.progressNode.set("text",[this._fileName," ",a.percent].join(";")):"progress"===a.type&&1===a.decimal&&this.progressNode.set("text",[this._fileName," ;Office.AlmostUploaded"].join(";"))},onUpload:new Function,_onComplete:function(a,b){this._uploadState=1;this._uploadedFile=a||c.mixin({},this.inputNode.files[0]);this._fileName=b?a?"\x3cb\x3e"+a.name+"\x3c/b\x3e":"":this._fileName||(a?"\x3cb\x3e"+a.name+"\x3c/b\x3e":
"");this.inputNode.value="";this.set("label",this.anotherFileLabel);this.progressNode.set("text",[this._fileName," ;Office.Uploaded"].join(";"));this._setProgressNodeColor("green");this._set("state","");this.set("readOnly",!1)},onComplete:function(a,b){this._onComplete(a,b);this.onUpload()},onError:function(){var a=this._fileName;this.reset();this.progressNode.set("text",["Office.UploadError; ",a].join(";"));this._setProgressNodeColor("red")},reset:function(){this._fileName=null;this._uploadState=
0;this._uploadedFile=null;this.inputNode.value="";this.set("label",this.labelIdentifier);this.progressNode.set("text","");this.fileErrorNode.set("text","");this._setProgressNodeColor();this._set("state","");this.set("readOnly",!1)},doubleName:"",specialName:"",upload:function(){this._uploadState=-1;var a=new FormData;this.doubleName&&a.append(this.doubleName,this.inputNode.files[0]);a.append(this.specialName||this.name,this.inputNode.files[0]);this.createXhr().send(a)},_xhrProgress:function(a){a.lengthComputable&&
this.onProgress({type:a.type,percent:"load"===a.type?"100%":Math.ceil(a.loaded/a.total*100)+"%",decimal:"load"===a.type?1:a.loaded/a.total})},createXhr:function(){var a=new XMLHttpRequest;a.upload.addEventListener("progress",c.hitch(this,"_xhrProgress"),!1);a.addEventListener("load",c.hitch(this,"_xhrProgress"),!1);a.addEventListener("error",c.hitch(this,"onError"),!1);a.onreadystatechange=c.hitch(this,function(){if(4===a.readyState)this.onComplete()});a.open("POST",g.getRequestUrl(".system","session.xml"));
return a},hideForValue:function(a){a&&a.hasData&&(this._savedValue=a);d.destroy(this._savedValueNode);if(this._savedValue&&c.isObject(this._savedValue)){var b=[this._savedValue.className,this._savedValue.propName,this._savedValue.ID];this._savedValue.fileName&&this._savedValue.extension&&b.push(this._savedValue.fileName,this._savedValue.extension);b=b.join("','");a="image"===this.attachmentType?"":this._savedValue.fileName||"\x3cspan class\x3d'icon-set-attachment'\x3e\x3c/span\x3e";this._savedValueNode=
d.create("span",null,this.domNode.parentNode);b=d.create("a",{innerHTML:a,href:"javascript:base.downloadBlob('"+b+"')"},this._savedValueNode);"\x3cspan class\x3d'icon-set-attachment'\x3e\x3c/span\x3e"===a&&(new office.TranslatableNode({className:"green",text:" ;Office.Uploaded",display:"inline"})).placeAt(this._savedValueNode,"last");k(".icon-set-attachment",b).length&&e.set(b,{textDecoration:"none"});"image"===this.attachmentType&&(this._savedValueNode=d.create("img",{src:"/"+q.mainHandler+"/getblob.jpg?query\x3d"+
g._itemsToQuery({className:this._savedValue.className,propName:this._savedValue.propName,ID:this._savedValue.ID}).split('"').join("'"),width:"100%"},this._savedValueNode))}e.set(this.domNode,{display:"none"})},unhideForValue:function(){d.destroy(this._savedValueNode);e.set(this.domNode,{display:"inline-block"})}}))});