diff --git a/module/bug/control.php b/module/bug/control.php index 69cf045934..dad61c063c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -465,7 +465,7 @@ class bug extends control $this->view->productName = $productName; $this->view->modulePath = $this->tree->getParents($bug->module); $this->view->bug = $bug; - $this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($bug->branch); + $this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($bug->branch, $bug->product); $this->view->users = $this->user->getPairs('noletter'); $this->view->actions = $this->action->getList('bug', $bugID); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = ''); diff --git a/module/bug/css/edit.css b/module/bug/css/edit.css index d8ae28005e..581c88c64e 100644 --- a/module/bug/css/edit.css +++ b/module/bug/css/edit.css @@ -2,4 +2,5 @@ .col-side .chosen-container {width: 218px!important} .col-side .chosen-container[id^="openedBuild"] {width: 172px!important} .col-side .chosen-container[id^="resolvedBuild"] {width: 172px!important} +.chosen-choices li.search-choice{word-break: break-all;} #linkBugBox > li {margin-left:-56px} diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index afa9bc89c8..03872a9008 100644 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -20,7 +20,7 @@ session->currentProductType !== 'normal') echo '' . $branches[$branch] . '';?>
2、如果文件名开头含有 数字+下划线,以方便排序,程序会将他们忽略。
-3、图片格式:jpg|jpeg|gif|png。
-EOD; +$lang->file->uploadImagesExplain = '注:请上传"jpg|jpeg|gif|png"格式的图片,程序会以文件名作为标题,以图片作为内容。'; diff --git a/module/file/model.php b/module/file/model.php index ff63a48d7d..60ccc86013 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -171,6 +171,109 @@ class fileModel extends model return $files; } + /** + * get uploaded image file from zui.uploader. + * + * @param string $htmlTagName + * @access public + * @return array + */ + public function getUploadImageFile($htmlTagName = 'file') + { + if(!isset($_FILES[$htmlTagName]) || empty($_FILES[$htmlTagName]['name'])) return; + + $this->app->loadClass('purifier', true); + $config = HTMLPurifier_Config::createDefault(); + $config->set('Cache.DefinitionImpl', null); + $purifier = new HTMLPurifier($config); + + extract($_FILES[$htmlTagName]); + if(!validater::checkFileName($name)) return array(); + if($this->post->name) $name = $this->post->name; + + $file = array(); + $file['id'] = 0; + $file['extension'] = $this->getExtension($name); + $file['title'] = !empty($_POST['label']) ? htmlspecialchars($_POST['label']) : substr($name, 0, strpos($name, $file['extension']) - 1); + $file['title'] = $purifier->purify($file['title']); + $file['size'] = $_POST['size']; + $file['tmpname'] = $tmp_name; + $file['uuid'] = $_POST['uuid']; + $file['pathname'] = $this->setPathName(0, $file['extension']); + $file['chunkpath'] = 'chunks' . DS .'f_' . $file['uuid'] . '.' . $file['extension'] . '.part'; + $file['chunks'] = isset($_POST['chunks']) ? intval($_POST['chunks']) : 0; + $file['chunk'] = isset($_POST['chunk']) ? intval($_POST['chunk']) : 0; + + return $file; + } + + /** + * Save uploaded image file. + * + * @param int $file + * @param int $uid + * @access public + * @return array|bool + */ + public function saveUploadImageFile($file, $uid) + { + $imageFile = array(); + + $cachePath = $this->app->getCacheRoot() . 'uploadimages/'; + if(!is_dir($cachePath)) mkdir($cachePath, 0777, true); + + $imageFilePath = $cachePath . $uid . '/'; + if(!is_dir($imageFilePath)) mkdir($imageFilePath); + + $fileName = basename($file['pathname']); + $file['realpath'] = $imageFilePath . $fileName; + + if($file['chunks'] > 1) + { + $fileSavePath = $cachePath . $file['chunkpath']; + if(!file_exists($fileSavePath)) mkdir(dirname($fileSavePath)); + + if($file['chunk'] > 0) + { + $uploadFile = fopen($fileSavePath, 'a+b'); + $tmpChunkFile = fopen($file['tmpname'], 'rb'); + while($buff = fread($tmpChunkFile, 4069)) + { + fwrite($uploadFile, $buff); + } + fclose($uploadFile); + fclose($tmpChunkFile); + } + else + { + if(!move_uploaded_file($file['tmpname'], $fileSavePath)) return false; + } + + if($file['chunk'] == ($file['chunks'] - 1)) + { + rename($fileSavePath, $file['realpath']); + + $imageFile['extension'] = $file['extension']; + $imageFile['pathname'] = $file['pathname']; + $imageFile['title'] = $file['title']; + $imageFile['realpath'] = $file['realpath']; + $imageFile['size'] = $file['size']; + } + } + else + { + if(!move_uploaded_file($file['tmpname'], $file['realpath'])) return false; + + $imageFile['extension'] = $file['extension']; + $imageFile['pathname'] = $file['pathname']; + $imageFile['title'] = $file['title']; + $imageFile['realpath'] = $file['realpath']; + $imageFile['size'] = $file['size']; + } + + return $imageFile; + } + /** * Get extension of a file. * diff --git a/module/file/view/uploadimages.html.php b/module/file/view/uploadimages.html.php index de2a71e66e..1fe8a4f155 100644 --- a/module/file/view/uploadimages.html.php +++ b/module/file/view/uploadimages.html.php @@ -11,13 +11,42 @@ */ ?> - + + +| idAB);?> | -testreport->title);?> | -openedByAB);?> | -testreport->createdDate);?> | -testreport->project);?> | -testreport->testtask;?> | -actions;?> | -
|---|---|---|---|---|---|---|
| id?> | -id&from=$objectType"), $report->title)?> | -createdBy);?> | -createdDate, 2);?> | - project . $projects[$report->project];?> -- tasks) as $taskID) $taskName .= '#' . $taskID . $tasks[$taskID] . ' '; - ?> - | - | - id", '', 'list'); - common::printIcon('testreport', 'delete', "id=$report->id", '', 'list', 'remove', 'hiddenwin'); - ?> - | -
| show();?> | ||||||
| testreport->noReport;?> | ||||||
| idAB);?> | +testreport->title);?> | +openedByAB);?> | +testreport->createdDate);?> | +testreport->project);?> | +testreport->testtask;?> | +actions;?> | +
|---|---|---|---|---|---|---|
| id?> | +id&from=$objectType"), $report->title)?> | +createdBy);?> | +createdDate, 2);?> | + project . $projects[$report->project];?> ++ tasks) as $taskID) $taskName .= '#' . $taskID . $tasks[$taskID] . ' '; + ?> + | + | + id", '', 'list'); + common::printIcon('testreport', 'delete', "id=$report->id", '', 'list', 'remove', 'hiddenwin'); + ?> + | +
| show();?> | ||||||
| testreport->noReport;?> | ||||||
]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return l},abort:function(){var t=this;c&&c.contentWindow&&(c.contentWindow.stop?c.contentWindow.stop():c.contentWindow.document.execCommand?c.contentWindow.document.execCommand("Stop"):c.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),s(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)}),!function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?u.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?u.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size>0&&(n.slice_blob=!0),u.isEmptyObj(e.resize)&&e.multipart||(n.send_binary_string=!0),u.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,o={},s=t.core.utils,a=t.runtime.Runtime,u={VERSION:"2.2.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:s.Mime.mimes,ua:s.Env,typeOf:s.Basic.typeOf,extend:s.Basic.extend,guid:s.Basic.guid,getAll:function(e){var t,i=[];"array"!==u.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=u.get(e[n]),t&&i.push(t);return i.length?i:null},get:s.Dom.get,each:s.Basic.each,getPos:s.Dom.getPos,getSize:s.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:s.Basic.toArray,inArray:s.Basic.inArray,inSeries:s.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:s.Basic.sprintf,isEmptyObj:s.Basic.isEmptyObj,hasClass:s.Dom.hasClass,addClass:s.Dom.addClass,removeClass:s.Dom.removeClass,getStyle:s.Dom.getStyle,addEvent:s.Events.addEvent,removeEvent:s.Events.removeEvent,removeAllEvents:s.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return u.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+u.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+u.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+u.translate("mb"):e>1024?Math.round(e/1024)+" "+u.translate("kb"):e+" "+u.translate("b")},parseSize:s.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new u.Uploader(e),n=a.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){o[e]=t}};u.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:u.FILE_EXTENSION_ERROR,message:u.translate("File extension error."),file:t}),i(!1)):i(!0)}),u.addFileFilter("max_file_size",function(e,t,i){var n;e=u.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:u.FILE_SIZE_ERROR,message:u.translate("File size error."),file:t}),i(!1)):i(!0)}),u.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:u.FILE_DUPLICATE_ERROR,message:u.translate("Duplicate file error."),file:t}),void i(!1);i(!0)}),u.Uploader=function(e){function s(){var e,t,i=0;if(this.state==u.STARTED){for(t=0;t0?Math.ceil(100*(e.loaded/e.size)):100,c()}function c(){var e,t;for(A.reset(),e=0;e0?Math.ceil(100*(A.uploaded/D.length)):0:(A.bytesPerSec=Math.ceil(A.loaded/((+new Date-I||1)/1e3)),A.percent=A.size>0?Math.ceil(100*(A.loaded/A.size)):0)}function d(){var e=C[0]||N[0];return e?e.getRuntime().uid:!1}function p(e,t){if(e.ruid){var i=a.getInfo(e.ruid);if(i)return i.can(t)}return!1}function f(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",E),this.bind("BeforeUpload",v),this.bind("UploadFile",x),this.bind("UploadProgress",y),this.bind("StateChanged",w),this.bind("QueueChanged",c),this.bind("Error",_),this.bind("FileUploaded",b),this.bind("Destroy",R)}function m(e,i){var n=this,r=0,o=[],s={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:F,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};u.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(s[t]=e[t])}),e.browse_button&&u.each(e.browse_button,function(i){o.push(function(o){var l=new t.file.FileInput(u.extend({},s,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));l.onready=function(){var e=a.getInfo(this.ruid);u.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,C.push(this),o()},l.onchange=function(){n.addFile(this.files)},l.bind("mouseenter mouseleave mousedown mouseup",function(t){L||(e.browse_button_hover&&("mouseenter"===t.type?u.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&u.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?u.addClass(i,e.browse_button_active):"mouseup"===t.type&&u.removeClass(i,e.browse_button_active)))}),l.bind("mousedown",function(){n.trigger("Browse")}),l.bind("error runtimeerror",function(){l=null,o()}),l.init()})}),e.drop_element&&u.each(e.drop_element,function(e){o.push(function(i){var o=new t.file.FileDrop(u.extend({},s,{drop_zone:e}));o.onready=function(){var e=a.getInfo(this.ruid);u.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,N.push(this),i()},o.ondrop=function(){n.addFile(this.files)},o.bind("error runtimeerror",function(){o=null,i()}),o.init()})}),u.inSeries(o,function(){"function"==typeof i&&i(r)})}function h(e,n,r){var o=new t.image.Image;try{o.onload=function(){return n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),r(e)):void o.downsize(n.width,n.height,n.crop,n.preserve_headers)},o.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},o.onerror=function(){r(e)},o.load(e)}catch(s){r(e)}}function g(e,i,r){function o(e,i,n){var r=S[e];switch(e){case"max_file_size":"max_file_size"===e&&(S.max_file_size=S.filters.max_file_size=i);break;case"chunk_size":(i=u.parseSize(i))&&(S[e]=i,S.send_file_name=!0);break;case"multipart":S[e]=i,i||(S.send_file_name=!0);break;case"unique_names":S[e]=i,i&&(S.send_file_name=!0);break;case"filters":"array"===u.typeOf(i)&&(i={mime_types:i}),n?u.extend(S.filters,i):S.filters=i,i.mime_types&&("string"===u.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return u.each(e,function(e){u.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),S.filters.mime_types=i.mime_types);break;case"resize":S.resize=i?u.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":S.prevent_duplicates=S.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?u.get(i):u.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":S[e]=i,n||(l=!0);break;default:S[e]=i}n||s.trigger("OptionChanged",e,i,r)}var s=this,l=!1;"object"==typeof e?u.each(e,function(e,t){o(t,e,r)}):o(e,i,r),r?(S.required_features=n(u.extend({},S)),F=n(u.extend({},S,{required_features:!0}))):l&&(s.trigger("Destroy"),m.call(s,S,function(e){e?(s.runtime=a.getInfo(d()).type,s.trigger("Init",{runtime:s.runtime}),s.trigger("PostInit")):s.trigger("Error",{code:u.INIT_ERROR,message:u.translate("Init error.")})}))}function v(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function x(e,i){function n(){c-- >0?r(o,1e3):(i.loaded=f,e.trigger("Error",{code:u.HTTP_ERROR,message:u.translate("HTTP Error."),file:i,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}))}function o(){var p,m,h,g={};i.status===u.UPLOADING&&e.state!==u.STOPPED&&(e.settings.send_file_name&&(g.name=i.target_name||i.name),l&&d.chunks&&s.size>l?(h=Math.min(l,s.size-f),p=s.slice(f,f+h)):(h=s.size,p=s),l&&d.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/l),g.chunks=Math.ceil(s.size/l)):(g.offset=f,g.total=s.size)),T=new t.xhr.XMLHttpRequest,T.upload&&(T.upload.onprogress=function(t){i.loaded=Math.min(i.size,f+t.loaded),e.trigger("UploadProgress",i)}),T.onload=function(){return T.status>=400?void n():(c=e.settings.max_retries,h=s.size?(i.size!=i.origSize&&(s.destroy(),s=null),e.trigger("UploadProgress",i),i.status=u.DONE,e.trigger("FileUploaded",i,{response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()})):r(o,1)))},T.onerror=function(){n()},T.onloadend=function(){this.destroy(),T=null},e.settings.multipart&&d.multipart?(T.open("post",a,!0),u.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),m=new t.xhr.FormData,u.each(u.extend(g,e.settings.multipart_params),function(e,t){m.append(t,e)}),m.append(e.settings.file_data_name,p),T.send(m,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(a=u.buildUrl(e.settings.url,u.extend(g,e.settings.multipart_params)),T.open("post",a,!0),u.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),T.hasRequestHeader("Content-Type")||T.setRequestHeader("Content-Type","application/octet-stream"),T.send(p,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})))}var s,a=e.settings.url,l=e.settings.chunk_size,c=e.settings.max_retries,d=e.features,f=0;i.loaded&&(f=i.loaded=l?l*Math.floor(i.loaded/l):0),s=i.getSource(),!u.isEmptyObj(e.settings.resize)&&p(s,"send_binary_string")&&-1!==u.inArray(s.type,["image/jpeg","image/png"])?h.call(this,s,e.settings.resize,function(e){s=e,i.size=e.size,o()}):o()}function y(e,t){l(t)}function w(e){if(e.state==u.STARTED)I=+new Date;else if(e.state==u.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==u.UPLOADING&&(e.files[t].status=u.QUEUED,c())}function E(){T&&T.abort()}function b(e){c(),r(function(){s.call(e)},1)}function _(e,t){t.code===u.INIT_ERROR?e.destroy():t.code===u.HTTP_ERROR&&(t.file.status=u.FAILED,l(t.file),e.state==u.STARTED&&(e.trigger("CancelUpload"),r(function(){s.call(e)},1)))}function R(e){e.stop(),u.each(D,function(e){e.destroy()}),D=[],C.length&&(u.each(C,function(e){e.destroy()}),C=[]),N.length&&(u.each(N,function(e){e.destroy()}),N=[]),F={},L=!1,I=T=null,A.reset()}var S,I,A,T,O=u.guid(),D=[],F={},C=[],N=[],L=!1;S={runtimes:a.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:!1,send_file_name:!0,send_chunk_number:!0},g.call(this,e,null,!0),A=new u.QueueProgress,u.extend(this,{id:O,uid:O,state:u.STOPPED,features:{},runtime:null,files:D,settings:S,total:A,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):u.each(e,function(e,t){i.bind(t,e)}),f.call(i),u.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:u.INIT_ERROR,message:u.sprintf(u.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):S.browse_button||S.drop_element?void m.call(i,S,function(e){var t=i.getOption("init");"function"==typeof t?t(i):u.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=a.getInfo(d()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:u.INIT_ERROR,message:u.translate("Init error.")})}):i.trigger("Error",{code:u.INIT_ERROR,message:u.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){g.call(this,e,t,!this.runtime)},getOption:function(e){return e?S[e]:S},refresh:function(){C.length&&u.each(C,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=u.STARTED&&(this.state=u.STARTED,this.trigger("StateChanged"),s.call(this))},stop:function(){this.state!=u.STOPPED&&(this.state=u.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){L=arguments[0]!==i?arguments[0]:!0,C.length&&u.each(C,function(e){e.disable(L)}),this.trigger("DisableBrowse",L)},getFile:function(e){var t;for(t=D.length-1;t>=0;t--)if(D[t].id===e)return D[t]},addFile:function(e,i){function n(e,t){var i=[];u.each(l.settings.filters,function(t,n){o[n]&&i.push(function(i){o[n].call(l,t,e,function(e){i(!e)})})}),u.inSeries(i,t)}function s(e){var o=u.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!a)return!1;e.ruid=a,e.connectRuntime(a)}s(new u.File(e))}else e instanceof t.file.Blob?(s(e.getSource()),e.destroy()):e instanceof u.File?(i&&(e.name=i),c.push(function(t){n(e,function(i){i||(D.push(e),p.push(e),l.trigger("FileFiltered",e)),r(t,1)})})):-1!==u.inArray(o,["file","blob"])?s(new t.file.File(null,e)):"node"===o&&"filelist"===u.typeOf(e.files)?u.each(e.files,s):"array"===o&&(i=null,u.each(e,s))}var a,l=this,c=[],p=[];a=d(),s(e),c.length&&u.inSeries(c,function(){p.length&&l.trigger("FilesAdded",p)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=D.length-1;i>=0;i--)if(D[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=D.splice(e===i?0:e,t===i?D.length:t),r=!1;return this.state==u.STARTED&&(u.each(n,function(e){return e.status===u.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),u.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n