diff options
Diffstat (limited to 'core/js/dist/maintenance.js')
-rw-r--r-- | core/js/dist/maintenance.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/js/dist/maintenance.js b/core/js/dist/maintenance.js index 2cb5489c3f5..f3ee56f6517 100644 --- a/core/js/dist/maintenance.js +++ b/core/js/dist/maintenance.js @@ -44,7 +44,7 @@ function(e){var t,n,r,i,a,o,s,u,c,l,d,f,h,m,_,p,y,g,v,M="sizzle"+1*new Date,L=e. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - */var z={YES_NO_BUTTONS:70,OK_BUTTONS:71,FILEPICKER_TYPE_CHOOSE:1,FILEPICKER_TYPE_MOVE:2,FILEPICKER_TYPE_COPY:3,FILEPICKER_TYPE_COPY_MOVE:4,FILEPICKER_TYPE_CUSTOM:5,dialogsCounter:0,alert:function(e,t,n,r){this.message(e,t,"alert",z.OK_BUTTON,n,r)},info:function(e,t,n,r){this.message(e,t,"info",z.OK_BUTTON,n,r)},confirm:function(e,t,n,r){return this.message(e,t,"notice",z.YES_NO_BUTTONS,n,r)},confirmDestructive:function(e,t,n,r,i){return this.message(e,t,"none",n,r,i)},confirmHtml:function(e,t,n,r){return this.message(e,t,"notice",z.YES_NO_BUTTONS,n,r,!0)},prompt:function(e,n,r,i,a,o){return s.a.when(this._getMessageTemplate()).then((function(u){var c="oc-dialog-"+z.dialogsCounter+"-content",d="#"+c,f=u.octemplate({dialog_name:c,title:n,message:e,type:"notice"}),h=s()("<input/>");h.attr("type",o?"password":"text").attr("id",c+"-input").attr("placeholder",a);var m=s()("<label/>").attr("for",c+"-input").text(a+": ");f.append(m),f.append(h),void 0===i&&(i=!1),s()("body").append(f),void 0!==r&&(r=l.default.once(r));var _=[{text:t("core","No"),click:function(){void 0!==r&&r(!1,h.val()),s()(d).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==r&&r(!0,h.val()),s()(d).ocdialog("close")},defaultButton:!0}];s()(d).ocdialog({closeOnEscape:!0,modal:i,buttons:_,close:function(){void 0!==r&&r(!1,h.val())}}),h.focus(),z.dialogsCounter++}))},filepicker:function(e,n,r,i,a,o,u,c){var d=this;if(this.filepicker.sortField="name",this.filepicker.sortOrder="asc",!this.filepicker.loading){void 0===o&&(o=this.FILEPICKER_TYPE_CHOOSE);var f=t("core","No files in here"),h=t("files","New folder");o!==this.FILEPICKER_TYPE_COPY&&o!==this.FILEPICKER_TYPE_MOVE&&o!==this.FILEPICKER_TYPE_COPY_MOVE||(f=t("core","No more subfolders in here")),this.filepicker.loading=!0,this.filepicker.filesClient=F.a.Sharing&&F.a.Sharing.PublicApp&&F.a.Sharing.PublicApp.fileList?F.a.Sharing.PublicApp.fileList.filesClient:me.Files.getClient(),this.filelist=null,u=u||"",c=Object.assign({allowDirectoryChooser:!1},c),s.a.when(this._getFilePickerTemplate()).then((function(m){d.filepicker.loading=!1;d.$filePicker&&d.$filePicker.ocdialog("close"),null==i&&(i=[]),"string"==typeof i&&(i=[i]),d.$filePicker=m.octemplate({dialog_name:"oc-dialog-filepicker-content",title:e,emptytext:f,newtext:h,nameCol:t("core","Name"),sizeCol:t("core","Size"),modifiedCol:t("core","Modified")}).data("path",u).data("multiselect",r).data("mimetype",i).data("allowDirectoryChooser",c.allowDirectoryChooser),void 0===a&&(a=!1),void 0===r&&(r=!1),me.Util.isIE()&&(d.$filePicker.find("#picker-view-toggle").remove(),d.$filePicker.find("#picker-filestable").removeClass("view-grid")),s()("body").append(d.$filePicker),d.$showGridView=s()("input#picker-showgridview"),d.$showGridView.on("change",l.default.bind(d._onGridviewChange,d)),me.Util.isIE()||d._getGridSettings();var _=d.$filePicker.find(".actions.creatable .button-add");o!==d.FILEPICKER_TYPE_CHOOSE||c.allowDirectoryChooser||_.hide(),_.on("focus",(function(){d.$filePicker.ocdialog("setEnterCallback",(function(){event.stopImmediatePropagation(),event.preventDefault(),_.click()}))})),_.on("blur",(function(){d.$filePicker.ocdialog("unsetEnterCallback")})),me.registerMenu(_,d.$filePicker.find(".menu"),(function(){y.focus(),d.$filePicker.ocdialog("setEnterCallback",(function(){event.stopImmediatePropagation(),event.preventDefault(),d.$filePicker.submit()}));var e=y.val(),t=e.lastIndexOf(".");-1===t&&(t=e.length),y.selectRange(0,t)}));var p=d.$filePicker.find(".filenameform"),y=p.find("input[type='text']");p.find("input[type='submit']").on("click",(function(e){e.stopImmediatePropagation(),e.preventDefault(),p.submit()}));var g=function(){var e=y.val();try{if(function(e){var n=e.trim();if("."===n||".."===n)throw t("files",'"{name}" is an invalid file name.',{name:e});if(0===n.length)throw t("files","File name cannot be empty.");if(-1!==n.indexOf("/"))throw t("files",'"/" is not allowed inside a file name.');if(n.match(me.config.blacklist_files_regex))throw t("files",'"{name}" is not an allowed filetype',{name:e});return!0}(e)){if(d.filelist.find((function(e){return e.name===this}),e))throw t("files","{newName} already exists",{newName:e},void 0,{escape:!1});return!0}}catch(e){y.attr("title",e),y.tooltip({placement:"right",trigger:"manual",container:".newFolderMenu"}),y.tooltip("fixTitle"),y.tooltip("show"),y.addClass("error")}return!1};p.on("submit",(function(e){if(e.stopPropagation(),e.preventDefault(),g()){var t=y.val();d.filepicker.filesClient.createDirectory(d.$filePicker.data("path")+"/"+t).always((function(e){d._fillFilePicker(d.$filePicker.data("path")+"/"+t)})),me.hideMenus(),d.$filePicker.ocdialog("unsetEnterCallback"),d.$filePicker.click(),y.val(h)}})),y.keypress((function(e){13!==e.keyCode&&13!==e.which||(e.stopImmediatePropagation(),e.preventDefault(),p.submit())})),d.$filePicker.ready((function(){d.$fileListHeader=d.$filePicker.find(".filelist thead tr"),d.$filelist=d.$filePicker.find(".filelist tbody"),d.$filelistContainer=d.$filePicker.find(".filelist-container"),d.$dirTree=d.$filePicker.find(".dirtree"),d.$dirTree.on("click","div:not(:last-child)",d,(function(e){d._handleTreeListSelect(e,o)})),d.$filelist.on("click","tr",(function(e){d._handlePickerClick(e,s()(this),o)})),d.$fileListHeader.on("click","a",(function(e){var t=d.$filePicker.data("path");d.filepicker.sortField=s()(e.currentTarget).data("sort"),d.filepicker.sortOrder="asc"===d.filepicker.sortOrder?"desc":"asc",d._fillFilePicker(t)})),d._fillFilePicker(u)}));var v=function(e){if(void 0!==n){var t;if(!0===r)t=[],d.$filelist.find("tr.filepicker_element_selected").each((function(e,n){t.push(d.$filePicker.data("path")+"/"+s()(n).data("entryname"))}));else{t=d.$filePicker.data("path");var i=d.$filelist.find("tr.filepicker_element_selected").data("entryname");i&&(t+="/"+i)}n(t,e),d.$filePicker.ocdialog("close")}},M=[];o===z.FILEPICKER_TYPE_CHOOSE?M.push({text:t("core","Choose"),click:function(){v(z.FILEPICKER_TYPE_CHOOSE)},defaultButton:!0}):o===z.FILEPICKER_TYPE_CUSTOM?c.buttons.forEach((function(e){M.push({text:e.text,click:function(){v(e.type)},defaultButton:e.defaultButton})})):(o!==z.FILEPICKER_TYPE_COPY&&o!==z.FILEPICKER_TYPE_COPY_MOVE||M.push({text:t("core","Copy"),click:function(){v(z.FILEPICKER_TYPE_COPY)},defaultButton:!1}),o!==z.FILEPICKER_TYPE_MOVE&&o!==z.FILEPICKER_TYPE_COPY_MOVE||M.push({text:t("core","Move"),click:function(){v(z.FILEPICKER_TYPE_MOVE)},defaultButton:!0})),d.$filePicker.ocdialog({closeOnEscape:!0,width:600,height:500,modal:a,buttons:M,style:{buttons:"aside"},close:function(){try{s()(this).ocdialog("destroy").remove()}catch(e){}d.$filePicker=null}});var L=d.$filePicker.closest(".oc-dialog").find(".primary");-1!==d.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||d.$filePicker.data("allowDirectoryChooser")?L.prop("disabled",!1):L.prop("disabled",!0)})).fail((function(e,n){d.filepicker.loading=!1,0!==e&&alert(t("core","Error loading file picker template: {error}",{error:n}))}))}},message:function(e,n,r,i,a,o,u){return s.a.when(this._getMessageTemplate()).then((function(c){var l="oc-dialog-"+z.dialogsCounter+"-content",d="#"+l,f=c.octemplate({dialog_name:l,title:n,message:e,type:r},u?{escapeFunction:""}:{});void 0===o&&(o=!1),s()("body").append(f);var h=[];switch(i){case z.YES_NO_BUTTONS:h=[{text:t("core","No"),click:function(){void 0!==a&&a(!1),s()(d).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==a&&a(!0),s()(d).ocdialog("close")},defaultButton:!0}];break;case z.OK_BUTTON:h[0]={text:t("core","OK"),click:function(){s()(d).ocdialog("close"),void 0!==a&&a()},defaultButton:!0};break;default:if("object"===W(i))switch(i.type){case z.YES_NO_BUTTONS:h=[{text:i.cancel||t("core","No"),click:function(){void 0!==a&&a(!1),s()(d).ocdialog("close")}},{text:i.confirm||t("core","Yes"),click:function(){void 0!==a&&a(!0),s()(d).ocdialog("close")},defaultButton:!0,classes:i.confirmClasses}]}}s()(d).ocdialog({closeOnEscape:!0,modal:o,buttons:h}),z.dialogsCounter++})).fail((function(r,i){0===r?alert(n+": "+e):alert(t("core","Error loading message template: {error}",{error:i}))}))},_fileexistsshown:!1,fileexists:function(e,r,i,a){var o=this,u=new s.a.Deferred,c=function(e){var t,n,r,i=document.createElement("canvas"),a=e.width,o=e.height;return a>o?(n=0,t=(a-o)/2):(n=(o-a)/2,t=0),r=Math.min(a,o),i.width=r,i.height=r,i.getContext("2d").drawImage(e,t,n,r,r,0,0,r,r),l(i,r,r,96,96),i.toDataURL("image/png",.7)},l=function(e,t,n,r,i){r=Math.round(r),i=Math.round(i);for(var a=e.getContext("2d").getImageData(0,0,t,n),o=e.getContext("2d").getImageData(0,0,r,i),s=a.data,u=o.data,c=t/r,l=n/i,d=Math.ceil(c/2),f=Math.ceil(l/2),h=0;h<i;h++)for(var m=0;m<r;m++){for(var _=4*(m+h*r),p=0,y=0,g=0,v=0,M=0,L=0,w=0,k=(h+.5)*l,Y=Math.floor(h*l);Y<(h+1)*l;Y++)for(var b=Math.abs(k-(Y+.5))/f,T=(m+.5)*c,x=b*b,D=Math.floor(m*c);D<(m+1)*c;D++){var S=Math.abs(T-(D+.5))/d,E=Math.sqrt(x+S*S);E>=-1&&E<=1&&(p=2*E*E*E-3*E*E+1)>0&&(w+=p*s[(S=4*(D+Y*t))+3],g+=p,s[S+3]<255&&(p=p*s[S+3]/250),v+=p*s[S],M+=p*s[S+1],L+=p*s[S+2],y+=p)}u[_]=v/y,u[_+1]=M/y,u[_+2]=L/y,u[_+3]=w/g}e.getContext("2d").clearRect(0,0,Math.max(t,r),Math.max(n,i)),e.width=r,e.height=i,e.getContext("2d").putImageData(o,0,0)},d=function(n,r,i){var a=n.find(".template").clone().removeClass("template").addClass("conflict"),o=a.find(".original"),u=a.find(".replacement");a.data("data",e),a.find(".filename").text(r.name),o.find(".size").text(me.Util.humanFileSize(r.size)),o.find(".mtime").text(formatDate(r.mtime)),i.size&&i.lastModifiedDate&&(u.find(".size").text(me.Util.humanFileSize(i.size)),u.find(".mtime").text(formatDate(i.lastModifiedDate)));var l=r.directory+"/"+r.name,d={file:l,x:96,y:96,c:r.etag,forceIcon:0},f=Files.generatePreviewUrl(d);f=f.replace(/'/g,"%27"),o.find(".icon").css({"background-image":"url('"+f+"')"}),function(e){var t=new s.a.Deferred,n=e.type&&e.type.split("/").shift();if(window.FileReader&&"image"===n){var r=new FileReader;r.onload=function(e){var n=new Blob([e.target.result]);window.URL=window.URL||window.webkitURL;var r=window.URL.createObjectURL(n),i=new Image;i.src=r,i.onload=function(){var e=c(i);t.resolve(e)}},r.readAsArrayBuffer(e)}else t.reject();return t}(i).then((function(e){u.find(".icon").css("background-image","url("+e+")")}),(function(){l=me.MimeType.getIconUrl(i.type),u.find(".icon").css("background-image","url("+l+")")}));var h=n.find(".conflict").length;o.find("input:checkbox").attr("id","checkbox_original_"+h),u.find("input:checkbox").attr("id","checkbox_replacement_"+h),n.append(a),i.lastModifiedDate&&i.lastModifiedDate.getTime()>r.mtime?u.find(".mtime").css("font-weight","bold"):i.lastModifiedDate&&i.lastModifiedDate.getTime()<r.mtime&&o.find(".mtime").css("font-weight","bold"),i.size&&i.size>r.size?u.find(".size").css("font-weight","bold"):i.size&&i.size<r.size&&o.find(".size").css("font-weight","bold"),"readonly"===r.status&&(o.addClass("readonly").find('input[type="checkbox"]').prop("checked",!0).prop("disabled",!0),o.find(".message").text(t("core","read-only")))},f="#oc-dialog-fileexists-content";if(this._fileexistsshown){var h=s()(f+" .conflicts");d(h,r,i);var m=s()(f+" .conflict").length,_=n("core","{count} file conflict","{count} file conflicts",m,{count:m});s()(f).parent().children(".oc-dialog-title").text(_),s()(window).trigger("resize"),u.resolve()}else this._fileexistsshown=!0,s.a.when(this._getFileExistsTemplate()).then((function(n){var c=t("core","One file conflict"),l=n.octemplate({dialog_name:"oc-dialog-fileexists-content",title:c,type:"fileexists",allnewfiles:t("core","New Files"),allexistingfiles:t("core","Already existing files"),why:t("core","Which files do you want to keep?"),what:t("core","If you select both versions, the copied file will have a number added to its name.")});if(s()("body").append(l),r&&i){var h=l.find(".conflicts");d(h,r,i)}var m=[{text:t("core","Cancel"),classes:"cancel",click:function(){void 0!==a.onCancel&&a.onCancel(e),s()(f).ocdialog("close")}},{text:t("core","Continue"),classes:"continue",click:function(){void 0!==a.onContinue&&a.onContinue(s()(f+" .conflict")),s()(f).ocdialog("close")}}];s()(f).ocdialog({width:500,closeOnEscape:!0,modal:!0,buttons:m,closeButton:null,close:function(){o._fileexistsshown=!1,s()(this).ocdialog("destroy").remove()}}),s()(f).css("height","auto");var _=l.closest(".oc-dialog").find("button.continue");function p(){var e=l.find(".conflicts .checkbox:checked").length;_.prop("disabled",0===e)}_.prop("disabled",!0),s()(f).find(".allnewfiles").on("click",(function(){s()(f).find('.conflict .replacement input[type="checkbox"]').prop("checked",s()(this).prop("checked"))})),s()(f).find(".allexistingfiles").on("click",(function(){s()(f).find('.conflict .original:not(.readonly) input[type="checkbox"]').prop("checked",s()(this).prop("checked"))})),s()(f).find(".conflicts").on("click",".replacement,.original:not(.readonly)",(function(){var e=s()(this).find('input[type="checkbox"]');e.prop("checked",!e.prop("checked"))})),s()(f).find(".conflicts").on("click",'.replacement input[type="checkbox"],.original:not(.readonly) input[type="checkbox"]',(function(){var e=s()(this);e.prop("checked",!e.prop("checked"))})),s()(f).on("click",".replacement,.allnewfiles",(function(){var e=s()(f).find('.conflict .replacement input[type="checkbox"]:checked').length;e===s()(f+" .conflict").length?(s()(f).find(".allnewfiles").prop("checked",!0),s()(f).find(".allnewfiles + .count").text(t("core","(all selected)"))):e>0?(s()(f).find(".allnewfiles").prop("checked",!1),s()(f).find(".allnewfiles + .count").text(t("core","({count} selected)",{count:e}))):(s()(f).find(".allnewfiles").prop("checked",!1),s()(f).find(".allnewfiles + .count").text("")),p()})),s()(f).on("click",".original,.allexistingfiles",(function(){var e=s()(f).find('.conflict .original input[type="checkbox"]:checked').length;e===s()(f+" .conflict").length?(s()(f).find(".allexistingfiles").prop("checked",!0),s()(f).find(".allexistingfiles + .count").text(t("core","(all selected)"))):e>0?(s()(f).find(".allexistingfiles").prop("checked",!1),s()(f).find(".allexistingfiles + .count").text(t("core","({count} selected)",{count:e}))):(s()(f).find(".allexistingfiles").prop("checked",!1),s()(f).find(".allexistingfiles + .count").text("")),p()})),u.resolve()})).fail((function(){u.reject(),alert(t("core","Error loading file exists template"))}));return u.promise()},_getGridSettings:function(){var e=this;s.a.get(me.generateUrl("/apps/files/api/v1/showgridview"),(function(t){e.$showGridView.get(0).checked=t.gridview,e.$showGridView.next("#picker-view-toggle").removeClass("icon-toggle-filelist icon-toggle-pictures").addClass(t.gridview?"icon-toggle-filelist":"icon-toggle-pictures"),s()(".list-container").toggleClass("view-grid",t.gridview)}))},_onGridviewChange:function(){var e=this.$showGridView.is(":checked");me.currentUser&&s.a.post(me.generateUrl("/apps/files/api/v1/showgridview"),{show:e}),this.$showGridView.next("#picker-view-toggle").removeClass("icon-toggle-filelist icon-toggle-pictures").addClass(e?"icon-toggle-filelist":"icon-toggle-pictures"),s()(".list-container").toggleClass("view-grid",e)},_getFilePickerTemplate:function(){var e=s.a.Deferred();if(this.$filePickerTemplate)e.resolve(this.$filePickerTemplate);else{var t=this;s.a.get(me.filePath("core","templates","filepicker.html"),(function(n){t.$filePickerTemplate=s()(n),t.$listTmpl=t.$filePickerTemplate.find(".filelist tbody tr:first-child").detach(),e.resolve(t.$filePickerTemplate)})).fail((function(t,n,r){e.reject(t.status,r)}))}return e.promise()},_getMessageTemplate:function(){var e=s.a.Deferred();if(this.$messageTemplate)e.resolve(this.$messageTemplate);else{var t=this;s.a.get(me.filePath("core","templates","message.html"),(function(n){t.$messageTemplate=s()(n),e.resolve(t.$messageTemplate)})).fail((function(t,n,r){e.reject(t.status,r)}))}return e.promise()},_getFileExistsTemplate:function(){var e=s.a.Deferred();if(this.$fileexistsTemplate)e.resolve(this.$fileexistsTemplate);else{var t=this;s.a.get(me.filePath("files","templates","fileexists.html"),(function(n){t.$fileexistsTemplate=s()(n),e.resolve(t.$fileexistsTemplate)})).fail((function(){e.reject()}))}return e.promise()},_getFileList:function(e,t){return"string"==typeof t&&(t=[t]),s.a.getJSON(me.filePath("files","ajax","list.php"),{dir:e,mimetypes:JSON.stringify(t)})},_fillFilePicker:function(e){var n=this;this.$filelist.empty(),this.$filePicker.find(".emptycontent").hide(),this.$filelistContainer.addClass("icon-loading"),this.$filePicker.data("path",e);var r=this.$filePicker.data("mimetype");"string"==typeof r&&(r=[r]),n.$fileListHeader.find(".sort-indicator").addClass("hidden").removeClass("icon-triangle-n").removeClass("icon-triangle-s"),n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").removeClass("hidden"),"asc"===n.filepicker.sortOrder?n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").addClass("icon-triangle-n"):n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").addClass("icon-triangle-s"),n.filepicker.filesClient.getFolderContents(e).then((function(i,a){n.filelist=a,r&&r.length>0&&-1===r.indexOf("*")&&(a=a.filter((function(e){return"dir"===e.type||-1!==r.indexOf(e.mimetype)})));var o={name:function(e,t){return"dir"===e.type&&"dir"!==t.type?-1:"dir"!==e.type&&"dir"===t.type?1:me.Util.naturalSortCompare(e.name,t.name)},size:function(e,t){return e.size-t.size},mtime:function(e,t){return e.mtime-t.mtime}},u=o[n.filepicker.sortField]||o.name;a=a.sort((function(e,t){var r=function(e){return e.tags&&e.tags.indexOf(me.TAG_FAVORITE)>=0};return r(e)&&!r(t)?-1:!r(e)&&r(t)?1:"asc"===n.filepicker.sortOrder?u(e,t):-u(e,t)})),n._fillSlug(),0===a.length?(n.$filePicker.find(".emptycontent").show(),n.$fileListHeader.hide()):(n.$filePicker.find(".emptycontent").hide(),n.$fileListHeader.show()),s.a.each(a,(function(r,i){var a,o;if(i.icon=me.MimeType.getIconUrl(i.mimetype),void 0!==i.size&&i.size>=0?(a=me.Util.humanFileSize(parseInt(i.size,10),!0),o=Math.round(160-Math.pow(i.size/1048576,2))):(a=t("files","Pending"),o=80),i.name.length>=10)var u=Math.min(Math.floor(i.name.length/2),10),c=i.name.substr(0,i.name.length-u),l=i.name.substr(i.name.length-u);else c=i.name,l="";var d=n.$listTmpl.octemplate({type:i.type,dir:e,filename:i.name,filename1:c,filename2:l,date:me.Util.relativeModifiedDate(i.mtime),size:a,sizeColor:o,icon:i.icon});if("file"===i.type){var f={file:e+"/"+i.name,x:100,y:100},h=new Image,m=me.generateUrl("/core/preview.png?")+s.a.param(f);h.onload=function(){h.width>5&&d.find("td.filename").attr("style","background-image:url("+m+")")},h.src=m}n.$filelist.append(d)})),n.$filelistContainer.removeClass("icon-loading")}))},_fillSlug:function(){this.$dirTree.empty();var e=this,t=this.$filePicker.data("path"),n=s()('<div data-dir="{dir}"><a>{name}</a></div>').addClass("crumb");if(t){var r=t.split("/");s.a.each(r,(function(t,i){if(""===(i=r.pop()))return!1;e.$dirTree.prepend(n.octemplate({dir:r.join("/")+"/"+i,name:i}))}))}n.octemplate({dir:"",name:""},{escapeFunction:null}).prependTo(this.$dirTree)},_handleTreeListSelect:function(e,t){var n=e.data,r=s()(e.target).closest(".crumb").data("dir");n._fillFilePicker(r);var i=e.target.closest(".oc-dialog"),a=s()(".primary",i);this._changeButtonsText(t,r.split(/[/]+/).pop()),-1!==this.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||this.$filePicker.data("allowDirectoryChooser")?a.prop("disabled",!1):a.prop("disabled",!0)},_handlePickerClick:function(e,t,n){var r=this.$filePicker.closest(".oc-dialog").find(".primary");"file"===t.data("type")?(!0===this.$filePicker.data("multiselect")&&e.ctrlKey||this.$filelist.find(".filepicker_element_selected").removeClass("filepicker_element_selected"),t.toggleClass("filepicker_element_selected"),r.prop("disabled",!1)):"dir"===t.data("type")&&(this._fillFilePicker(this.$filePicker.data("path")+"/"+t.data("entryname")),this._changeButtonsText(n,t.data("entryname")),-1!==this.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||this.$filePicker.data("allowDirectoryChooser")?r.prop("disabled",!1):r.prop("disabled",!0))},_changeButtonsText:function(e,n){var r=""===n?t("core","Copy"):t("core","Copy to {folder}",{folder:n}),i=""===n?t("core","Move"):t("core","Move to {folder}",{folder:n}),a=s()(".oc-dialog-buttonrow button");switch(e){case this.FILEPICKER_TYPE_CHOOSE:case this.FILEPICKER_TYPE_CUSTOM:break;case this.FILEPICKER_TYPE_COPY:a.text(r);break;case this.FILEPICKER_TYPE_MOVE:a.text(i);break;case this.FILEPICKER_TYPE_COPY_MOVE:a.eq(0).text(r),a.eq(1).text(i)}}},U=z,$=i(63),B=function e(t,n){var r,i,a="";if(this.typelessListeners=[],this.closed=!1,this.listeners={},n)for(r in n)a+=r+"="+encodeURIComponent(n[r])+"&";if(a+="requesttoken="+encodeURIComponent(Object($.a)()),this.useFallBack||"undefined"==typeof EventSource){var o="oc_eventsource_iframe_"+e.iframeCount;e.fallBackSources[e.iframeCount]=this,this.iframe=s()("<iframe/>"),this.iframe.attr("id",o),this.iframe.hide(),i="&",-1===t.indexOf("?")&&(i="?"),this.iframe.attr("src",t+i+"fallback=true&fallback_id="+e.iframeCount+"&"+a),s()("body").append(this.iframe),this.useFallBack=!0,e.iframeCount++}else i="&",-1===t.indexOf("?")&&(i="?"),this.source=new EventSource(t+i+a),this.source.onmessage=function(e){for(var t=0;t<this.typelessListeners.length;t++)this.typelessListeners[t](JSON.parse(e.data))}.bind(this);this.listen("__internal__",function(e){"close"===e&&this.close()}.bind(this))};B.fallBackSources=[],B.iframeCount=0,B.fallBackCallBack=function(e,t,n){B.fallBackSources[e].fallBackCallBack(t,n)},B.prototype={typelessListeners:[],iframe:null,listeners:{},useFallBack:!1,fallBackCallBack:function(e,t){var n;if(!this.closed)if(e){if(void 0!==this.listeners.done)for(n=0;n<this.listeners[e].length;n++)this.listeners[e][n](t)}else for(n=0;n<this.typelessListeners.length;n++)this.typelessListeners[n](t)},lastLength:0,listen:function(e,t){t&&t.call&&(e?this.useFallBack?(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)):this.source.addEventListener(e,(function(e){void 0!==e.data?t(JSON.parse(e.data)):t("")}),!1):this.typelessListeners.push(t))},close:function(){this.closed=!0,void 0!==this.source&&this.source.close()}};var q=B,J=window._oc_capabilities||{},G=function(){return J},V=null,K=function(e){if(V){var t=V;V.trigger(new s.a.Event("beforeHide")),V.slideUp(A.j,(function(){t.trigger(new s.a.Event("afterHide")),e&&e.apply(this,arguments)}))}s()(".menutoggle").attr("aria-expanded",!1),s()(".openedMenu").removeClass("openedMenu"),V=null,null},X=!!window._oc_isadmin,Z=i(56),Q=i(25),ee={startSaving:function(e){this.startAction(e,t("core","Saving …"))},startAction:function(e,t){s()(e).text(t).removeClass("success").removeClass("error").stop(!0,!0).show()},finishedSaving:function(e,t){this.finishedAction(e,t)},finishedAction:function(e,t){"success"===t.status?this.finishedSuccess(e,t.data.message):this.finishedError(e,t.data.message)},finishedSuccess:function(e,t){s()(e).text(t).addClass("success").removeClass("error").stop(!0,!0).delay(3e3).fadeOut(900).show()},finishedError:function(e,t){s()(e).text(t).addClass("error").removeClass("success").show()}},te=i(228),ne=function(e){me.Search.search(e,null,0,30)}; + */var z={YES_NO_BUTTONS:70,OK_BUTTONS:71,FILEPICKER_TYPE_CHOOSE:1,FILEPICKER_TYPE_MOVE:2,FILEPICKER_TYPE_COPY:3,FILEPICKER_TYPE_COPY_MOVE:4,FILEPICKER_TYPE_CUSTOM:5,dialogsCounter:0,alert:function(e,t,n,r){this.message(e,t,"alert",z.OK_BUTTON,n,r)},info:function(e,t,n,r){this.message(e,t,"info",z.OK_BUTTON,n,r)},confirm:function(e,t,n,r){return this.message(e,t,"notice",z.YES_NO_BUTTONS,n,r)},confirmDestructive:function(e,t,n,r,i){return this.message(e,t,"none",n,r,i)},confirmHtml:function(e,t,n,r){return this.message(e,t,"notice",z.YES_NO_BUTTONS,n,r,!0)},prompt:function(e,n,r,i,a,o){return s.a.when(this._getMessageTemplate()).then((function(u){var c="oc-dialog-"+z.dialogsCounter+"-content",d="#"+c,f=u.octemplate({dialog_name:c,title:n,message:e,type:"notice"}),h=s()("<input/>");h.attr("type",o?"password":"text").attr("id",c+"-input").attr("placeholder",a);var m=s()("<label/>").attr("for",c+"-input").text(a+": ");f.append(m),f.append(h),void 0===i&&(i=!1),s()("body").append(f),void 0!==r&&(r=l.default.once(r));var _=[{text:t("core","No"),click:function(){void 0!==r&&r(!1,h.val()),s()(d).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==r&&r(!0,h.val()),s()(d).ocdialog("close")},defaultButton:!0}];s()(d).ocdialog({closeOnEscape:!0,modal:i,buttons:_,close:function(){void 0!==r&&r(!1,h.val())}}),h.focus(),z.dialogsCounter++}))},filepicker:function(e,n,r,i,a,o,u,c){var d=this;if(this.filepicker.sortField="name",this.filepicker.sortOrder="asc",!this.filepicker.loading){void 0===o&&(o=this.FILEPICKER_TYPE_CHOOSE);var f=t("core","No files in here"),h=t("files","New folder");o!==this.FILEPICKER_TYPE_COPY&&o!==this.FILEPICKER_TYPE_MOVE&&o!==this.FILEPICKER_TYPE_COPY_MOVE||(f=t("core","No more subfolders in here")),this.filepicker.loading=!0,this.filepicker.filesClient=F.a.Sharing&&F.a.Sharing.PublicApp&&F.a.Sharing.PublicApp.fileList?F.a.Sharing.PublicApp.fileList.filesClient:me.Files.getClient(),this.filelist=null,u=u||"",c=Object.assign({allowDirectoryChooser:!1},c),s.a.when(this._getFilePickerTemplate()).then((function(m){d.filepicker.loading=!1;d.$filePicker&&d.$filePicker.ocdialog("close"),null==i&&(i=[]),"string"==typeof i&&(i=[i]),d.$filePicker=m.octemplate({dialog_name:"oc-dialog-filepicker-content",title:e,emptytext:f,newtext:h,nameCol:t("core","Name"),sizeCol:t("core","Size"),modifiedCol:t("core","Modified")}).data("path",u).data("multiselect",r).data("mimetype",i).data("allowDirectoryChooser",c.allowDirectoryChooser),void 0===a&&(a=!1),void 0===r&&(r=!1),me.Util.isIE()&&(d.$filePicker.find("#picker-view-toggle").remove(),d.$filePicker.find("#picker-filestable").removeClass("view-grid")),s()("body").append(d.$filePicker),d.$showGridView=s()("input#picker-showgridview"),d.$showGridView.on("change",l.default.bind(d._onGridviewChange,d)),me.Util.isIE()||d._getGridSettings();var _=d.$filePicker.find(".actions.creatable .button-add");o!==d.FILEPICKER_TYPE_CHOOSE||c.allowDirectoryChooser||_.hide(),_.on("focus",(function(){d.$filePicker.ocdialog("setEnterCallback",(function(){event.stopImmediatePropagation(),event.preventDefault(),_.click()}))})),_.on("blur",(function(){d.$filePicker.ocdialog("unsetEnterCallback")})),me.registerMenu(_,d.$filePicker.find(".menu"),(function(){y.focus(),d.$filePicker.ocdialog("setEnterCallback",(function(){event.stopImmediatePropagation(),event.preventDefault(),d.$filePicker.submit()}));var e=y.val(),t=e.lastIndexOf(".");-1===t&&(t=e.length),y.selectRange(0,t)}));var p=d.$filePicker.find(".filenameform"),y=p.find("input[type='text']");p.find("input[type='submit']").on("click",(function(e){e.stopImmediatePropagation(),e.preventDefault(),p.submit()}));var g=function(){var e=y.val();try{if(function(e){var n=e.trim();if("."===n||".."===n)throw t("files",'"{name}" is an invalid file name.',{name:e});if(0===n.length)throw t("files","File name cannot be empty.");if(-1!==n.indexOf("/"))throw t("files",'"/" is not allowed inside a file name.');if(n.match(me.config.blacklist_files_regex))throw t("files",'"{name}" is not an allowed filetype',{name:e});return!0}(e)){if(d.filelist.find((function(e){return e.name===this}),e))throw t("files","{newName} already exists",{newName:e},void 0,{escape:!1});return!0}}catch(e){y.attr("title",e),y.tooltip({placement:"right",trigger:"manual",container:".newFolderMenu"}),y.tooltip("fixTitle"),y.tooltip("show"),y.addClass("error")}return!1};p.on("submit",(function(e){if(e.stopPropagation(),e.preventDefault(),g()){var t=y.val();d.filepicker.filesClient.createDirectory(d.$filePicker.data("path")+"/"+t).always((function(e){d._fillFilePicker(d.$filePicker.data("path")+"/"+t)})),me.hideMenus(),d.$filePicker.ocdialog("unsetEnterCallback"),d.$filePicker.click(),y.val(h)}})),y.keypress((function(e){13!==e.keyCode&&13!==e.which||(e.stopImmediatePropagation(),e.preventDefault(),p.submit())})),d.$filePicker.ready((function(){d.$fileListHeader=d.$filePicker.find(".filelist thead tr"),d.$filelist=d.$filePicker.find(".filelist tbody"),d.$filelistContainer=d.$filePicker.find(".filelist-container"),d.$dirTree=d.$filePicker.find(".dirtree"),d.$dirTree.on("click","div:not(:last-child)",d,(function(e){d._handleTreeListSelect(e,o)})),d.$filelist.on("click","tr",(function(e){d._handlePickerClick(e,s()(this),o)})),d.$fileListHeader.on("click","a",(function(e){var t=d.$filePicker.data("path");d.filepicker.sortField=s()(e.currentTarget).data("sort"),d.filepicker.sortOrder="asc"===d.filepicker.sortOrder?"desc":"asc",d._fillFilePicker(t)})),d._fillFilePicker(u)}));var v=function(e){if(void 0!==n){var t;if(!0===r)t=[],d.$filelist.find("tr.filepicker_element_selected").each((function(e,n){t.push(d.$filePicker.data("path")+"/"+s()(n).data("entryname"))}));else{t=d.$filePicker.data("path");var i=d.$filelist.find("tr.filepicker_element_selected").data("entryname");i&&(t+="/"+i)}n(t,e),d.$filePicker.ocdialog("close")}},M=[];o===z.FILEPICKER_TYPE_CHOOSE?M.push({text:t("core","Choose"),click:function(){v(z.FILEPICKER_TYPE_CHOOSE)},defaultButton:!0}):o===z.FILEPICKER_TYPE_CUSTOM?c.buttons.forEach((function(e){M.push({text:e.text,click:function(){v(e.type)},defaultButton:e.defaultButton})})):(o!==z.FILEPICKER_TYPE_COPY&&o!==z.FILEPICKER_TYPE_COPY_MOVE||M.push({text:t("core","Copy"),click:function(){v(z.FILEPICKER_TYPE_COPY)},defaultButton:!1}),o!==z.FILEPICKER_TYPE_MOVE&&o!==z.FILEPICKER_TYPE_COPY_MOVE||M.push({text:t("core","Move"),click:function(){v(z.FILEPICKER_TYPE_MOVE)},defaultButton:!0})),d.$filePicker.ocdialog({closeOnEscape:!0,width:600,height:500,modal:a,buttons:M,style:{buttons:"aside"},close:function(){try{s()(this).ocdialog("destroy").remove()}catch(e){}d.$filePicker=null}});var L=d.$filePicker.closest(".oc-dialog").find(".primary");-1!==d.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||d.$filePicker.data("allowDirectoryChooser")?L.prop("disabled",!1):L.prop("disabled",!0)})).fail((function(e,n){d.filepicker.loading=!1,0!==e&&alert(t("core","Error loading file picker template: {error}",{error:n}))}))}},message:function(e,n,r,i,a,o,u){return s.a.when(this._getMessageTemplate()).then((function(c){var l="oc-dialog-"+z.dialogsCounter+"-content",d="#"+l,f=c.octemplate({dialog_name:l,title:n,message:e,type:r},u?{escapeFunction:""}:{});void 0===o&&(o=!1),s()("body").append(f);var h=[];switch(i){case z.YES_NO_BUTTONS:h=[{text:t("core","No"),click:function(){void 0!==a&&a(!1),s()(d).ocdialog("close")}},{text:t("core","Yes"),click:function(){void 0!==a&&a(!0),s()(d).ocdialog("close")},defaultButton:!0}];break;case z.OK_BUTTON:h[0]={text:t("core","OK"),click:function(){s()(d).ocdialog("close"),void 0!==a&&a()},defaultButton:!0};break;default:if("object"===W(i))switch(i.type){case z.YES_NO_BUTTONS:h=[{text:i.cancel||t("core","No"),click:function(){void 0!==a&&a(!1),s()(d).ocdialog("close")}},{text:i.confirm||t("core","Yes"),click:function(){void 0!==a&&a(!0),s()(d).ocdialog("close")},defaultButton:!0,classes:i.confirmClasses}]}}s()(d).ocdialog({closeOnEscape:!0,modal:o,buttons:h}),z.dialogsCounter++})).fail((function(r,i){0===r?alert(n+": "+e):alert(t("core","Error loading message template: {error}",{error:i}))}))},_fileexistsshown:!1,fileexists:function(e,r,i,a){var o=this,u=new s.a.Deferred,c=function(e){var t,n,r,i=document.createElement("canvas"),a=e.width,o=e.height;return a>o?(n=0,t=(a-o)/2):(n=(o-a)/2,t=0),r=Math.min(a,o),i.width=r,i.height=r,i.getContext("2d").drawImage(e,t,n,r,r,0,0,r,r),l(i,r,r,96,96),i.toDataURL("image/png",.7)},l=function(e,t,n,r,i){r=Math.round(r),i=Math.round(i);for(var a=e.getContext("2d").getImageData(0,0,t,n),o=e.getContext("2d").getImageData(0,0,r,i),s=a.data,u=o.data,c=t/r,l=n/i,d=Math.ceil(c/2),f=Math.ceil(l/2),h=0;h<i;h++)for(var m=0;m<r;m++){for(var _=4*(m+h*r),p=0,y=0,g=0,v=0,M=0,L=0,w=0,k=(h+.5)*l,Y=Math.floor(h*l);Y<(h+1)*l;Y++)for(var b=Math.abs(k-(Y+.5))/f,T=(m+.5)*c,x=b*b,D=Math.floor(m*c);D<(m+1)*c;D++){var S=Math.abs(T-(D+.5))/d,E=Math.sqrt(x+S*S);E>=-1&&E<=1&&(p=2*E*E*E-3*E*E+1)>0&&(w+=p*s[(S=4*(D+Y*t))+3],g+=p,s[S+3]<255&&(p=p*s[S+3]/250),v+=p*s[S],M+=p*s[S+1],L+=p*s[S+2],y+=p)}u[_]=v/y,u[_+1]=M/y,u[_+2]=L/y,u[_+3]=w/g}e.getContext("2d").clearRect(0,0,Math.max(t,r),Math.max(n,i)),e.width=r,e.height=i,e.getContext("2d").putImageData(o,0,0)},d=function(n,r,i){var a=n.find(".template").clone().removeClass("template").addClass("conflict"),o=a.find(".original"),u=a.find(".replacement");a.data("data",e),a.find(".filename").text(r.name),o.find(".size").text(me.Util.humanFileSize(r.size)),o.find(".mtime").text(formatDate(r.mtime)),i.size&&i.lastModifiedDate&&(u.find(".size").text(me.Util.humanFileSize(i.size)),u.find(".mtime").text(formatDate(i.lastModifiedDate)));var l=r.directory+"/"+r.name,d={file:l,x:96,y:96,c:r.etag,forceIcon:0},f=Files.generatePreviewUrl(d);f=f.replace(/'/g,"%27"),o.find(".icon").css({"background-image":"url('"+f+"')"}),function(e){var t=new s.a.Deferred,n=e.type&&e.type.split("/").shift();if(window.FileReader&&"image"===n){var r=new FileReader;r.onload=function(e){var n=new Blob([e.target.result]);window.URL=window.URL||window.webkitURL;var r=window.URL.createObjectURL(n),i=new Image;i.src=r,i.onload=function(){var e=c(i);t.resolve(e)}},r.readAsArrayBuffer(e)}else t.reject();return t}(i).then((function(e){u.find(".icon").css("background-image","url("+e+")")}),(function(){l=me.MimeType.getIconUrl(i.type),u.find(".icon").css("background-image","url("+l+")")}));var h=n.find(".conflict").length;o.find("input:checkbox").attr("id","checkbox_original_"+h),u.find("input:checkbox").attr("id","checkbox_replacement_"+h),n.append(a),i.lastModifiedDate&&i.lastModifiedDate.getTime()>r.mtime?u.find(".mtime").css("font-weight","bold"):i.lastModifiedDate&&i.lastModifiedDate.getTime()<r.mtime&&o.find(".mtime").css("font-weight","bold"),i.size&&i.size>r.size?u.find(".size").css("font-weight","bold"):i.size&&i.size<r.size&&o.find(".size").css("font-weight","bold"),"readonly"===r.status&&(o.addClass("readonly").find('input[type="checkbox"]').prop("checked",!0).prop("disabled",!0),o.find(".message").text(t("core","read-only")))},f="#oc-dialog-fileexists-content";if(this._fileexistsshown){var h=s()(f+" .conflicts");d(h,r,i);var m=s()(f+" .conflict").length,_=n("core","{count} file conflict","{count} file conflicts",m,{count:m});s()(f).parent().children(".oc-dialog-title").text(_),s()(window).trigger("resize"),u.resolve()}else this._fileexistsshown=!0,s.a.when(this._getFileExistsTemplate()).then((function(n){var c=t("core","One file conflict"),l=n.octemplate({dialog_name:"oc-dialog-fileexists-content",title:c,type:"fileexists",allnewfiles:t("core","New Files"),allexistingfiles:t("core","Already existing files"),why:t("core","Which files do you want to keep?"),what:t("core","If you select both versions, the copied file will have a number added to its name.")});if(s()("body").append(l),r&&i){var h=l.find(".conflicts");d(h,r,i)}var m=[{text:t("core","Cancel"),classes:"cancel",click:function(){void 0!==a.onCancel&&a.onCancel(e),s()(f).ocdialog("close")}},{text:t("core","Continue"),classes:"continue",click:function(){void 0!==a.onContinue&&a.onContinue(s()(f+" .conflict")),s()(f).ocdialog("close")}}];s()(f).ocdialog({width:500,closeOnEscape:!0,modal:!0,buttons:m,closeButton:null,close:function(){o._fileexistsshown=!1,s()(this).ocdialog("destroy").remove()}}),s()(f).css("height","auto");var _=l.closest(".oc-dialog").find("button.continue");function p(){var e=l.find(".conflicts .checkbox:checked").length;_.prop("disabled",0===e)}_.prop("disabled",!0),s()(f).find(".allnewfiles").on("click",(function(){s()(f).find('.conflict .replacement input[type="checkbox"]').prop("checked",s()(this).prop("checked"))})),s()(f).find(".allexistingfiles").on("click",(function(){s()(f).find('.conflict .original:not(.readonly) input[type="checkbox"]').prop("checked",s()(this).prop("checked"))})),s()(f).find(".conflicts").on("click",".replacement,.original:not(.readonly)",(function(){var e=s()(this).find('input[type="checkbox"]');e.prop("checked",!e.prop("checked"))})),s()(f).find(".conflicts").on("click",'.replacement input[type="checkbox"],.original:not(.readonly) input[type="checkbox"]',(function(){var e=s()(this);e.prop("checked",!e.prop("checked"))})),s()(f).on("click",".replacement,.allnewfiles",(function(){var e=s()(f).find('.conflict .replacement input[type="checkbox"]:checked').length;e===s()(f+" .conflict").length?(s()(f).find(".allnewfiles").prop("checked",!0),s()(f).find(".allnewfiles + .count").text(t("core","(all selected)"))):e>0?(s()(f).find(".allnewfiles").prop("checked",!1),s()(f).find(".allnewfiles + .count").text(t("core","({count} selected)",{count:e}))):(s()(f).find(".allnewfiles").prop("checked",!1),s()(f).find(".allnewfiles + .count").text("")),p()})),s()(f).on("click",".original,.allexistingfiles",(function(){var e=s()(f).find('.conflict .original input[type="checkbox"]:checked').length;e===s()(f+" .conflict").length?(s()(f).find(".allexistingfiles").prop("checked",!0),s()(f).find(".allexistingfiles + .count").text(t("core","(all selected)"))):e>0?(s()(f).find(".allexistingfiles").prop("checked",!1),s()(f).find(".allexistingfiles + .count").text(t("core","({count} selected)",{count:e}))):(s()(f).find(".allexistingfiles").prop("checked",!1),s()(f).find(".allexistingfiles + .count").text("")),p()})),u.resolve()})).fail((function(){u.reject(),alert(t("core","Error loading file exists template"))}));return u.promise()},_getGridSettings:function(){var e=this;s.a.get(me.generateUrl("/apps/files/api/v1/showgridview"),(function(t){e.$showGridView.get(0).checked=t.gridview,e.$showGridView.next("#picker-view-toggle").removeClass("icon-toggle-filelist icon-toggle-pictures").addClass(t.gridview?"icon-toggle-filelist":"icon-toggle-pictures"),s()(".list-container").toggleClass("view-grid",t.gridview)}))},_onGridviewChange:function(){var e=this.$showGridView.is(":checked");me.currentUser&&s.a.post(me.generateUrl("/apps/files/api/v1/showgridview"),{show:e}),this.$showGridView.next("#picker-view-toggle").removeClass("icon-toggle-filelist icon-toggle-pictures").addClass(e?"icon-toggle-filelist":"icon-toggle-pictures"),s()(".list-container").toggleClass("view-grid",e)},_getFilePickerTemplate:function(){var e=s.a.Deferred();if(this.$filePickerTemplate)e.resolve(this.$filePickerTemplate);else{var t=this;s.a.get(me.filePath("core","templates","filepicker.html"),(function(n){t.$filePickerTemplate=s()(n),t.$listTmpl=t.$filePickerTemplate.find(".filelist tbody tr:first-child").detach(),e.resolve(t.$filePickerTemplate)})).fail((function(t,n,r){e.reject(t.status,r)}))}return e.promise()},_getMessageTemplate:function(){var e=s.a.Deferred();if(this.$messageTemplate)e.resolve(this.$messageTemplate);else{var t=this;s.a.get(me.filePath("core","templates","message.html"),(function(n){t.$messageTemplate=s()(n),e.resolve(t.$messageTemplate)})).fail((function(t,n,r){e.reject(t.status,r)}))}return e.promise()},_getFileExistsTemplate:function(){var e=s.a.Deferred();if(this.$fileexistsTemplate)e.resolve(this.$fileexistsTemplate);else{var t=this;s.a.get(me.filePath("files","templates","fileexists.html"),(function(n){t.$fileexistsTemplate=s()(n),e.resolve(t.$fileexistsTemplate)})).fail((function(){e.reject()}))}return e.promise()},_getFileList:function(e,t){return"string"==typeof t&&(t=[t]),s.a.getJSON(me.filePath("files","ajax","list.php"),{dir:e,mimetypes:JSON.stringify(t)})},_fillFilePicker:function(e){var n=this;this.$filelist.empty(),this.$filePicker.find(".emptycontent").hide(),this.$filelistContainer.addClass("icon-loading"),this.$filePicker.data("path",e);var r=this.$filePicker.data("mimetype");"string"==typeof r&&(r=[r]),n.$fileListHeader.find(".sort-indicator").addClass("hidden").removeClass("icon-triangle-n").removeClass("icon-triangle-s"),n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").removeClass("hidden"),"asc"===n.filepicker.sortOrder?n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").addClass("icon-triangle-n"):n.$fileListHeader.find("[data-sort="+n.filepicker.sortField+"] .sort-indicator").addClass("icon-triangle-s"),n.filepicker.filesClient.getFolderContents(e).then((function(i,a){n.filelist=a,r&&r.length>0&&-1===r.indexOf("*")&&(a=a.filter((function(e){return"dir"===e.type||-1!==r.indexOf(e.mimetype)})));var o={name:function(e,t){return"dir"===e.type&&"dir"!==t.type?-1:"dir"!==e.type&&"dir"===t.type?1:me.Util.naturalSortCompare(e.name,t.name)},size:function(e,t){return e.size-t.size},mtime:function(e,t){return e.mtime-t.mtime}},u=o[n.filepicker.sortField]||o.name;a=a.sort((function(e,t){var r=function(e){return e.tags&&e.tags.indexOf(me.TAG_FAVORITE)>=0};return r(e)&&!r(t)?-1:!r(e)&&r(t)?1:"asc"===n.filepicker.sortOrder?u(e,t):-u(e,t)})),n._fillSlug(),0===a.length?(n.$filePicker.find(".emptycontent").show(),n.$fileListHeader.hide()):(n.$filePicker.find(".emptycontent").hide(),n.$fileListHeader.show()),s.a.each(a,(function(r,i){var a,o;if(i.icon=me.MimeType.getIconUrl(i.mimetype),void 0!==i.size&&i.size>=0?(a=me.Util.humanFileSize(parseInt(i.size,10),!0),o=Math.round(160-Math.pow(i.size/1048576,2))):(a=t("files","Pending"),o=80),i.name.length>=10)var u=Math.min(Math.floor(i.name.length/2),10),c=i.name.substr(0,i.name.length-u),l=i.name.substr(i.name.length-u);else c=i.name,l="";var d=n.$listTmpl.octemplate({type:i.type,dir:e,filename:i.name,filename1:c,filename2:l,date:me.Util.relativeModifiedDate(i.mtime),size:a,sizeColor:o,icon:i.icon});if("file"===i.type){var f={file:e+"/"+i.name,x:100,y:100},h=new Image,m=me.generateUrl("/core/preview.png?")+s.a.param(f);h.onload=function(){h.width>5&&d.find("td.filename").attr("style","background-image:url("+m+")")},h.src=m}n.$filelist.append(d)})),n.$filelistContainer.removeClass("icon-loading")}))},_fillSlug:function(){var e=this.$dirTree.find(".actions.creatable").detach();this.$dirTree.empty();var t=this;t.$dirTree.append(e);var n=this.$filePicker.data("path"),r=s()('<div data-dir="{dir}"><a>{name}</a></div>').addClass("crumb");if(n){var i=n.split("/");s.a.each(i,(function(e,n){if(""===(n=i.pop()))return!1;t.$dirTree.prepend(r.octemplate({dir:i.join("/")+"/"+n,name:n}))}))}r.octemplate({dir:"",name:""},{escapeFunction:null}).prependTo(this.$dirTree)},_handleTreeListSelect:function(e,t){var n=e.data,r=s()(e.target).closest(".crumb").data("dir");n._fillFilePicker(r);var i=e.target.closest(".oc-dialog"),a=s()(".primary",i);this._changeButtonsText(t,r.split(/[/]+/).pop()),-1!==this.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||this.$filePicker.data("allowDirectoryChooser")?a.prop("disabled",!1):a.prop("disabled",!0)},_handlePickerClick:function(e,t,n){var r=this.$filePicker.closest(".oc-dialog").find(".primary");"file"===t.data("type")?(!0===this.$filePicker.data("multiselect")&&e.ctrlKey||this.$filelist.find(".filepicker_element_selected").removeClass("filepicker_element_selected"),t.toggleClass("filepicker_element_selected"),r.prop("disabled",!1)):"dir"===t.data("type")&&(this._fillFilePicker(this.$filePicker.data("path")+"/"+t.data("entryname")),this._changeButtonsText(n,t.data("entryname")),-1!==this.$filePicker.data("mimetype").indexOf("httpd/unix-directory")||this.$filePicker.data("allowDirectoryChooser")?r.prop("disabled",!1):r.prop("disabled",!0))},_changeButtonsText:function(e,n){var r=""===n?t("core","Copy"):t("core","Copy to {folder}",{folder:n}),i=""===n?t("core","Move"):t("core","Move to {folder}",{folder:n}),a=s()(".oc-dialog-buttonrow button");switch(e){case this.FILEPICKER_TYPE_CHOOSE:case this.FILEPICKER_TYPE_CUSTOM:break;case this.FILEPICKER_TYPE_COPY:a.text(r);break;case this.FILEPICKER_TYPE_MOVE:a.text(i);break;case this.FILEPICKER_TYPE_COPY_MOVE:a.eq(0).text(r),a.eq(1).text(i)}}},U=z,$=i(63),B=function e(t,n){var r,i,a="";if(this.typelessListeners=[],this.closed=!1,this.listeners={},n)for(r in n)a+=r+"="+encodeURIComponent(n[r])+"&";if(a+="requesttoken="+encodeURIComponent(Object($.a)()),this.useFallBack||"undefined"==typeof EventSource){var o="oc_eventsource_iframe_"+e.iframeCount;e.fallBackSources[e.iframeCount]=this,this.iframe=s()("<iframe/>"),this.iframe.attr("id",o),this.iframe.hide(),i="&",-1===t.indexOf("?")&&(i="?"),this.iframe.attr("src",t+i+"fallback=true&fallback_id="+e.iframeCount+"&"+a),s()("body").append(this.iframe),this.useFallBack=!0,e.iframeCount++}else i="&",-1===t.indexOf("?")&&(i="?"),this.source=new EventSource(t+i+a),this.source.onmessage=function(e){for(var t=0;t<this.typelessListeners.length;t++)this.typelessListeners[t](JSON.parse(e.data))}.bind(this);this.listen("__internal__",function(e){"close"===e&&this.close()}.bind(this))};B.fallBackSources=[],B.iframeCount=0,B.fallBackCallBack=function(e,t,n){B.fallBackSources[e].fallBackCallBack(t,n)},B.prototype={typelessListeners:[],iframe:null,listeners:{},useFallBack:!1,fallBackCallBack:function(e,t){var n;if(!this.closed)if(e){if(void 0!==this.listeners.done)for(n=0;n<this.listeners[e].length;n++)this.listeners[e][n](t)}else for(n=0;n<this.typelessListeners.length;n++)this.typelessListeners[n](t)},lastLength:0,listen:function(e,t){t&&t.call&&(e?this.useFallBack?(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)):this.source.addEventListener(e,(function(e){void 0!==e.data?t(JSON.parse(e.data)):t("")}),!1):this.typelessListeners.push(t))},close:function(){this.closed=!0,void 0!==this.source&&this.source.close()}};var q=B,J=window._oc_capabilities||{},G=function(){return J},V=null,K=function(e){if(V){var t=V;V.trigger(new s.a.Event("beforeHide")),V.slideUp(A.j,(function(){t.trigger(new s.a.Event("afterHide")),e&&e.apply(this,arguments)}))}s()(".menutoggle").attr("aria-expanded",!1),s()(".openedMenu").removeClass("openedMenu"),V=null,null},X=!!window._oc_isadmin,Z=i(56),Q=i(25),ee={startSaving:function(e){this.startAction(e,t("core","Saving …"))},startAction:function(e,t){s()(e).text(t).removeClass("success").removeClass("error").stop(!0,!0).show()},finishedSaving:function(e,t){this.finishedAction(e,t)},finishedAction:function(e,t){"success"===t.status?this.finishedSuccess(e,t.data.message):this.finishedError(e,t.data.message)},finishedSuccess:function(e,t){s()(e).text(t).addClass("success").removeClass("error").stop(!0,!0).delay(3e3).fadeOut(900).show()},finishedError:function(e,t){s()(e).text(t).addClass("error").removeClass("success").show()}},te=i(228),ne=function(e){me.Search.search(e,null,0,30)}; /** * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> * |