File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/components/bitrix/bizproc.automation/templates/.default/disk_uploader.min.js
Back
if(!BX.getClass("BX.Bizproc.Automation.DiskUploader"))(function(e){"use strict";e.namespace("BX.Bizproc.Automation");var t=function(){this._id="";this._settings={};this._messages={};this._agent=null;this._form=this._wrapper=this._switchContainer=this._container=this._fileInput=this._fileSelector=this._label=this._dropZoneWrapper=this._dropZone=this._itemContainer=null;this._mode=t.InterfaceMode.edit;this._items=[];this._fileUploadStartHandler=e.delegate(this._onFileUploadStart,this);this._fileUploadProgressHandler=e.delegate(this._onFileUploadProgress,this);this._fileUploadCompleteHandler=e.delegate(this._onFileUploadComplete,this);this._fileUploadErrorHandler=e.delegate(this._onFileUploadError,this);this._fileSelectButtonClickHandler=e.delegate(this._onFileSelectButtonClick,this);this._fileDialogInitHandler=e.delegate(this._onFileDialogInit,this);this._dropZoneMouseOverHandler=e.delegate(this._onDropZoneMouseOver,this);this._dropZoneMouseOutHandler=e.delegate(this._onDropZoneMouseOut,this);this._agentErrorHandler=e.delegate(this._onAgentError,this);this._agentFileInputReinitHandler=e.delegate(this._onAgentFileInputReinit,this);this._agentFileInitHandler=e.delegate(this._onAgentFileInit,this);this._uploadFileUrl="/bitrix/tools/disk/uf.php?action=uploadfile";this._selectFileUrl="/bitrix/tools/disk/uf.php?action=selectFile";this._isShown=false;this._hasLayout=false};t.InterfaceMode={edit:1,view:2};t.prototype={initialize:function(e,t){this._id=e;this._settings=t?t:{};this._messages=this.getSetting("msg",{})},getId:function(){return this._id},getSetting:function(e,t){return typeof this._settings[e]!="undefined"?this._settings[e]:t},getMessages:function(){return this.getSetting("msg",{})},getMessage:function(e,t){if(typeof t==="undefined"){t=""}return this._messages.hasOwnProperty(e)?this._messages[e]:t},getFileInputName:function(){return this._fileInput},getPlaceHolder:function(){return this._itemContainer},getMode:function(){return this._mode},setMode:function(e){if(this._mode===e){return}if(this._hasLayout){throw"Could not set mode while control has layout."}this._mode=e},getAgent:function(){return this._agent},getItems:function(){return this._items},getItem:function(e){for(var t=0;t<this._items.length;t++){var i=this._items[t];if(i.getId()===e){return i}}return null},hasItems:function(){return this._items.length>0},getFileIds:function(){var e=[];for(var t=0;t<this._items.length;t++){var i=this._items[t].getFileId();if(i>0){e.push(i)}}return e},getValues:function(){return this.getFileIds()},setValues:function(t){for(var i=0;i<t.length;i++){var s=t[i];var a=typeof s["ID"]!=="undefined"?parseInt(s["ID"]):0;var r=this.addItem(a.toString(),{fileId:a,name:s["NAME"],size:s["SIZE"],viewUrl:e.type.isNotEmptyString(s["VIEW_URL"])?s["VIEW_URL"]:"",progress:100});if(this._hasLayout){r.setContainer(this._itemContainer);r.layout()}}if(this.hasItems()){this.show(true)}},clearValues:function(){this.removeAllItems()},removeItem:function(e){for(var t=0;t<this._items.length;t++){if(this._items[t]===e){e.cleanLayout();this._items.splice(t,1);return}}},removeAllItems:function(){for(var e=0;e<this._items.length;e++){this._items[e].cleanLayout()}this._items=[]},layout:function(i){var s=this._mode;if(s===t.InterfaceMode.edit){this.prepareEditLayout(i);this._agent=e.Uploader.getInstance({id:this._id,allowUpload:"A",uploadMethod:"immediate",uploadFileUrl:this._uploadFileUrl,deleteFileOnServer:true,filesInputMultiple:true,filesInputName:this.getFileInputName(),input:this._fileInput,dropZone:this._dropZone,showImage:false,fields:{preview:{params:{width:212,height:119}}}});e.addCustomEvent(this._agent,"onError",this._agentErrorHandler);e.addCustomEvent(this._agent,"onFileinputIsReinited",this._agentFileInputReinitHandler);e.addCustomEvent(this._agent,"onFileIsInited",this._agentFileInitHandler);this._container.style.display=this._isShown?"block":"none";this._switchContainer.style.display=this._isShown?"none":"block";this._label.style.display=this.hasItems()?"":"none"}else if(s===t.InterfaceMode.view){this._prepareViewLayout(i)}for(var a=0;a<this._items.length;a++){var r=this._items[a];r.setContainer(this._itemContainer);r.layout()}this._hasLayout=true},cleanLayout:function(){if(!this._hasLayout){return}if(this._agent){e.removeCustomEvent(this._agent,"onError",this._agentErrorHandler);e.removeCustomEvent(this._agent,"onFileinputIsReinited",this._agentFileInputReinitHandler);e.removeCustomEvent(this._agent,"onFileIsInited",this._agentFileInitHandler)}if(this._dropZoneWrapper){e.unbind(this._dropZoneWrapper,"mouseover",this._dropZoneMouseOverHandler);e.unbind(this._dropZoneWrapper,"mouseout",this._dropZoneMouseOutHandler)}if(this._fileSelector){e.unbind(this._fileSelector,"click",this._fileSelectButtonClickHandler)}if(this._wrapper){e.cleanNode(this._wrapper,true)}for(var t=0;t<this._items.length;t++){var i=this._items[t];i.cleanLayout();i.setContainer(null)}this._form=this._wrapper=this._switchContainer=this._container=this._fileInput=this._label=this._dropZone=this._itemContainer=null;this._hasLayout=false},show:function(e){e=!!e;if(this._isShown===e){return}this._isShown=e;if(this._hasLayout){this._container.style.display=e?"block":"none";this._switchContainer.style.display=e?"none":"block"}},showLabel:function(e){if(this._hasLayout){this._label.style.display=!!e?"":"none"}},prepareEditLayout:function(t){if(!e.type.isElementNode(t)){return}this._form=e.create("FORM",{});t.appendChild(this._form);this._form.appendChild(e.create("INPUT",{props:{type:"hidden",name:"sessid",value:e.bitrix_sessid()}}));this._switchContainer=e.create("DIV",{attrs:{className:"bx-crm-add-file-link"},children:[e.create("SPAN",{attrs:{className:"bx-crm-add-file-link-text"},text:this.getMessage("diskAttachFiles"),events:{click:e.delegate(this._onSwitchButtonClick,this)}})]});this._form.appendChild(this._switchContainer);this._container=e.create("DIV",{attrs:{className:"bx-crm-dialog-activity-diskuf-container"}});this._form.appendChild(this._container);this._container.style.height="auto";this._innerContainer=e.create("DIV",{attrs:{className:"bx-crm-dialog-activity-diskuf-container-inner"}});this._container.appendChild(this._innerContainer);this._wrapper=e.create("DIV",{attrs:{className:"diskuf-selectdialog"}});this._innerContainer.appendChild(this._wrapper);this._wrapper.style.display="block";this._wrapper.style.opacity="1";var i=e.create("DIV",{attrs:{className:"diskuf-files-block"}});i.style.display="block";this._wrapper.appendChild(i);this._label=e.create("DIV",{attrs:{className:"diskuf-label"},children:[e.create("SPAN",{text:this.getMessage("diskAttachedFiles")+":"}),e.create("SPAN",{attrs:{className:"diskuf-label-icon"}})]});i.appendChild(this._label);var s=e.create("DIV",{attrs:{className:"diskuf-placeholder"}});i.appendChild(s);this._itemContainer=e.create("TABLE",{attrs:{className:"files-list",cellspacing:"0",cellpadding:"0",border:"0"}});s.appendChild(this._itemContainer);var a=e.create("DIV",{attrs:{className:"diskuf-extended"}});a.style.display="block";this._wrapper.appendChild(a);var r=e.create("TABLE",{attrs:{className:"diskuf-selector-table wd-fa-add-file-light-table",cellspacing:"0",cellpadding:"0",border:"0"}});a.appendChild(r);var n=r.insertRow(-1);var l=n.insertCell(-1);l.className="wd-fa-add-file-light-cell";this._fileSelector=e.create("DIV",{attrs:{className:"wd-fa-add-file-light-title-text diskuf-selector-link"},text:this.getMessage("diskSelectFile")});e.bind(this._fileSelector,"click",this._fileSelectButtonClickHandler);l.appendChild(e.create("SPAN",{attrs:{className:"wd-fa-add-file-light"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-text"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-title"},children:[this._fileSelector]}),e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-descript"},text:this.getMessage("diskSelectFileLegend")})]})]}));l=n.insertCell(-1);l.className="wd-fa-add-file-form-light-separate-cell";l.appendChild(e.create("DIV",{attrs:{className:"wd-fa-add-file-form-light-spacer"}}));l=this._dropZoneWrapper=n.insertCell(-1);l.className="diskuf-selector wd-fa-add-file-light-cell wd-fa-add-file-from-main";this._fileInput=e.create("INPUT",{attrs:{className:"diskuf-fileUploader wd-test-file-light-inp "},props:{type:"file",size:1,multiple:"multiple",name:this.getFileInputName()}});if(e.browser.IsIE()){this._dropZone=e.create("DIV",{attrs:{className:"wduf-selector"},children:[e.create("SPAN",{attrs:{className:"wduf-uploader"},children:[e.create("SPAN",{attrs:{className:"wduf-uploader-left"}}),e.create("SPAN",{attrs:{className:"wduf-but-text"},text:this.getMessage("loadFiles")}),e.create("SPAN",{attrs:{className:"wduf-uploader-right"}}),this._fileInput]})]})}else{this._dropZone=e.create("DIV",{attrs:{className:"diskuf-uploader"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-text"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-title"},children:[e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-title-text"},text:this.getMessage("diskUploadFile")})]}),e.create("SPAN",{attrs:{className:"wd-fa-add-file-light-descript"},text:this.getMessage("diskUploadFileLegend")})]})]}),this._fileInput]})}l.appendChild(this._dropZone);e.bind(l,"mouseover",this._dropZoneMouseOverHandler);e.bind(l,"mouseout",this._dropZoneMouseOutHandler)},_prepareViewLayout:function(t){if(!e.type.isElementNode(t)){return}this._form=e.create("FORM",{});t.appendChild(this._form);this._form.appendChild(e.create("INPUT",{props:{type:"hidden",name:"sessid",value:e.bitrix_sessid()}}));this._container=e.create("DIV",{attrs:{className:"bx-crm-dialog-activity-diskuf-container"}});this._form.appendChild(this._container);this._container.style.height="auto";this._innerContainer=e.create("DIV",{attrs:{className:"bx-crm-dialog-activity-diskuf-container-inner"}});this._container.appendChild(this._innerContainer);this._wrapper=e.create("DIV",{attrs:{className:"diskuf-selectdialog"}});this._innerContainer.appendChild(this._wrapper);this._wrapper.style.display="block";this._wrapper.style.opacity="1";var i=e.create("DIV",{attrs:{className:"diskuf-files-block"}});i.style.display="block";this._wrapper.appendChild(i);this._label=e.create("DIV",{attrs:{className:"diskuf-label"},children:[e.create("SPAN",{text:this.getMessage("diskAttachedFiles")+":"}),e.create("SPAN",{attrs:{className:"diskuf-label-icon"}})]});i.appendChild(this._label);var s=e.create("DIV",{attrs:{className:"diskuf-placeholder"}});i.appendChild(s);this._itemContainer=e.create("TABLE",{attrs:{className:"files-list",cellspacing:"0",cellpadding:"0",border:"0"}});s.appendChild(this._itemContainer)},processItemDeletion:function(e){this.removeItem(e);if(!this.hasItems()){this.showLabel(false)}},_onSwitchButtonClick:function(t){this.show(true);return e.PreventDefault(t)},_onAgentFileInputReinit:function(e){if(e||this._agent.fileInput){this._fileInput=e?e:this._agent.fileInput}},_onAgentError:function(e,t,i){},_onAgentFileInit:function(t,i,s){e.addCustomEvent(i,"onUploadStart",this._fileUploadStartHandler);e.addCustomEvent(i,"onUploadProgress",this._fileUploadProgressHandler);e.addCustomEvent(i,"onUploadDone",this._fileUploadCompleteHandler);e.addCustomEvent(i,"onUploadError",this._fileUploadErrorHandler)},addItem:function(t,s){var a=i.create(t,{uploader:this,container:this._itemContainer,name:e.type.isNotEmptyString(s.name)?s.name:"",size:e.type.isNotEmptyString(s.size)?s.size:"",fileId:e.type.isNumber(s.fileId)?s.fileId:0,viewUrl:e.type.isNotEmptyString(s.viewUrl)?s.viewUrl:"",progress:e.type.isNumber(s.progress)?s.progress:0});this._items.push(a);return a},_onFileUploadStart:function(e,t,i,s){var a=this.addItem(e.id,{name:e.name,size:e.size,fileId:0,progress:parseInt(t)});a.layout()},_onFileUploadProgress:function(e,t,i,s){var a=this.getItem(e.id);if(a){if(t>=100)t=99;a.setProgress(t)}},_onFileUploadComplete:function(t,i,s,a){var r=this.getItem(t.id);if(!r){return}r.setProgress(100);e.removeCustomEvent(t,"onUploadStart",this._fileUploadStartHandler);e.removeCustomEvent(t,"onUploadProgress",this._fileUploadProgressHandler);e.removeCustomEvent(t,"onUploadDone",this._fileUploadCompleteHandler);e.removeCustomEvent(t,"onUploadError",this._fileUploadErrorHandler);var n=0;if(typeof i.file!=="undefined"){if(typeof i.file["fileId"]!=="undefined"){n=parseInt(i.file["fileId"])}else if(typeof i.file["originalId"]!=="undefined"){n=parseInt(i.file["originalId"])}}if(n>0){r.setFileId(n)}this.showLabel(true)},_onFileUploadError:function(t,i,s,a){var r=this.getItem(t.id);if(r){r.remove()}e.removeCustomEvent(t,"onUploadStart",this._fileUploadStartHandler);e.removeCustomEvent(t,"onUploadProgress",this._fileUploadProgressHandler);e.removeCustomEvent(t,"onUploadDone",this._fileUploadCompleteHandler);e.removeCustomEvent(t,"onUploadError",this._fileUploadErrorHandler)},_onFileSelectButtonClick:function(t){e.addCustomEvent(e.DiskFileDialog,"inited",this._fileDialogInitHandler);e.ajax({url:this._selectFileUrl,method:"GET",timeout:30});return e.PreventDefault(t)},_onFileDialogInit:function(t){e.removeCustomEvent(e.DiskFileDialog,"inited",this._fileDialogInitHandler);this.flagFileDialogInited=true;e.DiskFileDialog.obCallback[t]={saveButton:e.delegate(this._onFileSelect,this)};e.DiskFileDialog.openDialog(t)},_onFileSelect:function(t,i,s){for(var a in s){if(!s.hasOwnProperty(a)){return}var r=s[a];var n=e.type.isNotEmptyString(r["type"])?r["type"]:"";if(n!=="file"){continue}var l=e.type.isNotEmptyString(r["id"])?r["id"]:"";if(l===""){continue}var o=/^n(\d+)$/;var d=o.exec(l);if(d&&d.length>1){var h=parseInt(d[1]);if(h>0){var p=e.type.isNotEmptyString(r["name"])?r["name"]:l;var c=e.type.isNotEmptyString(r["size"])?r["size"]:0;this.addItem(l,{fileId:h,name:p,size:c,progress:100}).layout()}}}},_onDropZoneMouseOver:function(t){e.addClass(this._dropZoneWrapper,"wd-fa-add-file-light-hover")},_onDropZoneMouseOut:function(t){e.removeClass(this._dropZoneWrapper,"wd-fa-add-file-light-hover")}};t.items={};t.create=function(i,s){if(!e.type.isNotEmptyString(i)){i="BX_BP_ATM_FILEUPLOADER_"+Math.random()}var a=new t;a.initialize(i,s);this.items[i]=a;return a};var i=function(){this._id="";this._settings={};this._fileId=0;this._name="";this._size="";this._viewUrl="";this._progress=0;this._uploader=this._container=this._wrapper=null;this._progressContainer=this._progressWrap=this._progressTerminateBtn=this._progressBar=this._progressText=this._deleteButton=null;this._deleteButtonClickHandler=e.delegate(this._onDeleteButtonClick,this);this._hasLayout=false};i.prototype={initialize:function(e,t){this._id=e;this._settings=t?t:{};this._uploader=this.getSetting("uploader");this._container=this.getSetting("container");this._fileId=parseInt(this.getSetting("fileId",0));this._name=this.getSetting("name","");this._size=this.getSetting("size","");this._viewUrl=this.getSetting("viewUrl","");this.setProgress(this.getSetting("progress",0))},getId:function(){return this._id},getSetting:function(e,t){return typeof this._settings[e]!="undefined"?this._settings[e]:t},getFileId:function(){return this._fileId},setFileId:function(e){this._fileId=e},getName:function(){return this._name},getSize:function(){return this._size},getProgress:function(){return this._progress},setProgress:function(e){e=parseInt(e);if(isNaN(e)||e<0){e=0}if(e>100){e=100}if(this._progress===e){return}this._progress=e;if(this._hasLayout){this._progressBar.style.width=this._progress+"%";this._progressText.innerHTML=this._progress+"%";this._progressWrap.style.display=e<100?"":"none"}},getContainer:function(){return this._container},setContainer:function(e){this._container=e},layout:function(){if(this._hasLayout){return}if(!this._container){throw"Error: Could not find container."}var i=this._wrapper=this._container.insertRow(-1);var s=i.insertCell(-1);s.className="files-name";if(this._viewUrl!==""){s.appendChild(e.create("A",{attrs:{className:"files-text",href:this._viewUrl},text:this._name}))}else{s.appendChild(e.create("SPAN",{attrs:{className:"files-text"},text:this._name}))}s=i.insertCell(-1);s.className="files-size";s.innerHTML=this._size;s=this._progressContainer=i.insertCell(-1);s.className="files-storage";this._progressWrap=e.create("SPAN",{attrs:{className:"feed-add-post-loading-wrap"}});s.appendChild(this._progressWrap);this._progressTerminateBtn=e.create("SPAN",{attrs:{className:"feed-add-post-loading-cancel del-but"}});e.bind(this._progressTerminateBtn,"click",this._deleteButtonClickHandler);this._progressWrap.appendChild(e.create("SPAN",{attrs:{className:"feed-add-post-loading"},children:[this._progressTerminateBtn]}));this._progressBar=e.create("SPAN",{attrs:{className:"feed-add-post-load-indicator"},style:{width:this._progress+"%"}});this._progressWrap.appendChild(this._progressBar);this._progressText=e.create("SPAN",{attrs:{className:"feed-add-post-load-number"},text:this._progress+"%"});this._progressBar.appendChild(this._progressText);if(this._progress===100){this._progressWrap.style.display="none"}s=i.insertCell(-1);s.className="files-del-btn";if(this._uploader.getMode()===t.InterfaceMode.edit){this._deleteButton=e.create("SPAN",{attrs:{className:"del-but"}});e.bind(this._deleteButton,"click",this._deleteButtonClickHandler);s.appendChild(this._deleteButton)}this._hasLayout=true},cleanLayout:function(){if(!this._hasLayout){return}e.unbind(this._progressTerminateBtn,"click",this._deleteButtonClickHandler);if(this._deleteButton){e.unbind(this._deleteButton,"click",this._deleteButtonClickHandler)}this._container.deleteRow(this._wrapper.rowIndex);this._wrapper=this._progressContainer=this._progressWrap=this._progressTerminateBtn=this._progressBar=this._progressText=this._deleteButton=null;this._hasLayout=false},remove:function(){if(this._uploader.getMode()!==t.InterfaceMode.edit){return}var e=this._uploader.getAgent();if(e){var i=e.queue.items.getItem(this._id);if(i){i.deleteFile()}}this._uploader.processItemDeletion(this)},_onDeleteButtonClick:function(e){this.remove()}};i.create=function(e,t){var s=new i;s.initialize(e,t);return s};e.Bizproc.Automation.DiskUploader=t})(window.BX||window.top.BX);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings