js-pkg
Version:
Npm package of Syncfusion.JavaScript.
10 lines • 166 kB
JavaScript
/*!
* filename: ej.fileexplorer.min.js
* version : 15.3.0.33
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
(function(n){typeof define=="function"&&define.amd?define(["jsrender","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.touch.min","./../common/ej.draggable.min","./../common/ej.scroller.min","./ej.button.min","./ej.checkbox.min","./ej.treeview.min","./ej.uploadbox.min","./ej.waitingpopup.min","./ej.dialog.min","./ej.splitter.min","./ej.toolbar.min","./ej.menu.min","./ej.splitbutton.min","./ej.grid.min"],n):n()})(function(){(function(n,t,r){t.widget("ejFileExplorer","ej.FileExplorer",{element:null,model:null,validTags:["div"],_addToPersist:["layout","selectedFolder","selectedItems","height","width"],_rootCSS:"e-fileexplorer",_requiresID:!0,defaults:{fileTypes:"*.*",filterSettings:{caseSensitiveSearch:!1,filterType:"contains",allowSearchOnTyping:!0},showToolbar:!0,showCheckbox:!0,showNavigationPane:!0,allowDragAndDrop:!0,showContextMenu:!0,showFooter:!0,layout:"grid",locale:"en-US",selectedFolder:"",selectedItems:"",gridSettings:{allowSorting:!0,columns:[{field:"name",headerText:"Name",width:"30%"},{field:"dateModified",headerText:"Date Modified",width:"30%"},{field:"type",headerText:"Type",width:"15%"},{field:"size",headerText:"Size",width:"12%",textAlign:"right",headerTextAlign:"left"}],allowResizing:!0},tools:{creation:["NewFolder"],navigation:["Back","Forward","Upward"],addressBar:["Addressbar"],editing:["Refresh","Upload","Delete","Rename","Download"],copyPaste:["Cut","Copy","Paste"],getProperties:["Details"],searchBar:["Searchbar"],layout:["Layout"],sortBy:["SortBy"]},toolsList:["layout","creation","navigation","addressBar","editing","copyPaste","sortBy","getProperties","searchBar"],path:"",rootFolderName:"",height:"400px",width:"850px",minWidth:"400px",maxWidth:null,minHeight:"250px",maxHeight:null,isResponsive:!1,uploadSettings:{allowMultipleFile:!0,maxFileSize:31457280,autoUpload:!1},enableResize:!1,cssClass:"",enableRTL:!1,allowKeyboardNavigation:!0,showThumbnail:!0,enableThumbnailCompress:!1,showRoundedCorner:!1,ajaxAction:"",ajaxDataType:"json",ajaxSettings:{read:{},createFolder:{},remove:{},rename:{},paste:{},getDetails:{},download:{},upload:{},getImage:{},search:{}},allowMultiSelection:!0,contextMenuSettings:{items:{navbar:["NewFolder","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","Getinfo"],cwd:["Refresh","Paste","|","SortBy","|","NewFolder","Upload","|","Getinfo"],files:["Open","Download","|","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","OpenFolderLocation","Getinfo"]},customMenuFields:[]},enablePersistence:!1,layoutChange:null,getImage:null,select:null,unselect:null,createFolder:null,remove:null,cut:null,copy:null,paste:null,open:null,beforeOpen:null,beforeUpload:null,beforeDownload:null,beforeGetImage:null,beforeAjaxRequest:null,resizeStart:null,resize:null,resizeStop:null,templateRefresh:null,dragStart:null,drag:null,dragStop:null,drop:null,menuClick:null,menuBeforeOpen:null,menuOpen:null,create:null,destroy:null},dataTypes:{filterSettings:"data",showToolbar:"boolean",showNavigationPane:"boolean",showContextMenu:"boolean",allowDragAndDrop:"boolean",allowKeyboardNavigation:"boolean",showRoundedCorner:"boolean",showFooter:"boolean",layout:"enum",gridSettings:"data",tools:{creation:"array",navigation:"array",addressBar:"array",editing:"array",layout:"array",copyPaste:"array",getProperties:"array",searchBar:"array"},contextMenuSettings:{items:{navbar:"array",cwd:"array",files:"array"},customMenuFields:"array"},toolsList:"array",uploadSettings:"data",ajaxSettings:"data"},_setModel:function(i){var f=this,r,e,o,u;for(r in i)switch(r){case"showToolbar":i[r]?t.isNullOrUndefined(this._toolBarItems)?this._updateToolbar():this._toolBarItems.show():this._toolBarItems.hide();this.adjustSize();break;case"showNavigationPane":case"showTreeview":this.model.showNavigationPane=this.model.showTreeview=i[r];this._showHideSplitBar(this.model.showNavigationPane);break;case"showContextMenu":this._showHideContextMenu();break;case"height":this.element.css("height",this._getProperValue(this.model.height));this.adjustSize();break;case"width":this.element.css("width",this._getProperValue(this.model.width));this.adjustSize();break;case"layout":this._switchLayoutView(!0);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[r];this._draggableOption(i[r]?"_on":"_off");i[r]?this._allowDrag():this._preventDrag();break;case"showThumbnail":this.model.showThumbnail=i[r];this._switchLayoutView();break;case"enableThumbnailCompress":this.model.enableThumbnailCompress=i[r];this.model.showThumbnail&&this.model.layout!="grid"&&this._renderTileView(this._fileExplorer[this._originalPath]);break;case"path":i[r]?this._setPath(i[r]):this._getPath();break;case"enableRTL":this._enableRTL(i[r]);break;case"allowKeyboardNavigation":this._subControlsSetModel("allowKeyboardNavigation",i[r]);this._gridObj&&this._gridObj.setModel({allowKeyboardNavigation:i[r]});break;case"showFooter":i[r]?(this._statusbar.hasClass("e-statusbar")?(e=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight(),this._tileView.height(e),this._gridtag.height(e),this._statusbar.show()):(this._createStatusBar(),this._updateData(),this.model.enableResize&&this._resizeFileExplorer(),this._on(n("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView),this._on(n("#"+this._ExplorerId+"_swithListView"),"click",this._switchView)),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight()-this._statusbar.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}})):(this._tileView.height("auto"),this._gridtag.height("auto"),this._statusbar.hide(),o=this._splittag.height()-this._gridtag.find(".e-gridheader").outerHeight(),this._tileContent.parent(".e-tile-wrapper").ejScroller({height:this._splittag.outerHeight(),scrollerSize:this._scrollerSize,thumbStart:function(n){f._onThumbStart(n)}}));break;case"gridSettings":u=JSON.parse(JSON.stringify(i[r]));u.columns&&(u.columns.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1}),this.model.showCheckbox&&u.columns.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:18,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1}));this._gridObj&&this._gridtag.ejGrid(u);this._showHideContextMenu();this._renderSortbyDrpdwn();break;case"locale":this.model.locale=i[r];this._destroy();this._init();break;case"cssClass":this._changeSkin(i[r]);break;case"fileTypes":n.each(f._fileExplorer,function(n){f._fileExplorer[n]=""});this._removeOldSelectionDetails();this._refreshItems(this._selectedNode,this._currentPath);this._uploadtag.ejUploadbox("option",{extensionsAllow:this.model.fileTypes=="*.*"?"":this.model.fileTypes.replace(/\*/g,"")});break;case"selectedFolder":this._selectedFolder(this.model.selectedFolder);break;case"selectedItems":this._selectedItems=i[r];this._setSelectedItems(i[r]);break;case"allowMultiSelection":i[r]||this._setSelectedItems([]);this._gridtag.find(".e-gridheader").length&&this._gridtag.ejGrid("option",{selectionType:i[r]?"multiple":"single"});t.isNullOrUndefined(this._gridObj)||(this.model.allowMultiSelection?this._gridtag.find(".e-headercelldiv>span.e-chkbox-wrap").show():this._gridtag.find(".e-headercelldiv>span.e-chkbox-wrap").hide());break;case"isResponsive":this.model.isResponsive=i[r];this._toolBarObj&&(this._toolBarObj.option("isResponsive",this.model.isResponsive),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());this._wireResizing();break;case"tools":case"toolsList":r=="tools"?n.extend(this.model.tools,i[r]):this.model.toolsList=i[r];this._toolBarObj&&(this._toolBarObj.destroy(),this.element.find("#"+this._ExplorerId+"_toolbar").remove(),this._updateToolbar(),this.model.showToolbar?this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize());break;case"enableResize":i[r]?i[r]&&this.model.showFooter&&(this._resizeItem=t.buildTag("div.e-icon e-fe-resize e-resize-handle"),this._resizeItem.insertBefore(this.element.find(".e-switchView")),this._resizeFileExplorer()):this._resizeItem&&this._resizeItem.remove();break;case"minHeight":this.element.css("min-height",this._getProperValue(this.model.minHeight));this._refreshResizeHandler();break;case"maxHeight":this.element.css("max-height",this._getProperValue(this.model.maxHeight));this._refreshResizeHandler();break;case"minWidth":this.element.css("min-width",this._getProperValue(this.model.minWidth));this._refreshResizeHandler();break;case"maxWidth":this.element.css("max-width",this._getProperValue(this.model.maxWidth));this._refreshResizeHandler();break;case"showCheckbox":this._changeCheckState=this.model.showCheckbox;this.model.layout=="grid"?this._renderGridView(this._fileExplorer[this._originalPath]):this._renderTileView(this._fileExplorer[this._originalPath],!0);this._setSelectedItems(this.model.selectedItems);break;case"showRoundedCorner":this._roundedCorner(i[r]);break;case"contextMenuSettings":n.extend(this.model[r],i[r]);this._showHideContextMenu();break;case"rootFolderName":this._changeRootFolderName();this._updateAddressBar();this._treeObj.element.find("li:first > div > .e-text").hasClass("e-active")&&this._treeObj.selectNode(this._treeObj.element.find("li:first > div > .e-text"))}},_init:function(){this._cloneElement=this.element.clone();t.isNullOrUndefined(this.model.uploadBoxSettings)||(this.model.uploadSettings=this.model.uploadBoxSettings);t.isNullOrUndefined(this.model.showTreeview)||(this.model.showNavigationPane=this.model.showTreeview);t.isNullOrUndefined(this.model.move)||(this.model.cut=this.model.move);this._initialize();this._render();this._changeLayoutActive(this.model.layout)},_postInit:function(){this._enablePostInit=!1;this._enableRTL(this.model.enableRTL);this._wireEvents();this._wireResizing();this._setMinMaxSizeInInteger();this.model.enableResize&&this.model.showFooter&&this._resizeFileExplorer();this._isClicked=!1;this._selectedTreeFolder&&this._currentPath!=this._selectedTreeFolder&&this._selectedFolder(this._selectedTreeFolder);this._selectedNodes.length&&this._setSelectedItems(this._selectedNodes);this._isClicked=!0},_initialize:function(){this._ExplorerId=this.element[0].id;this._fileExplorer={};this._feParent={};this._updateImages={};this._selectedStates=[];this._updateOnNodeSelection=!1;this._isClicked=!0;this._toolBarObj=null;this._tileView=null;this._tileScroll=null;this._originalPath=null;this._initPath="";this._initUpdate=!1;this._scrollerSize=8;this._editingToolsState=!0;this._renderMultiTouchDialog();this._ensureResolution();this._isDevice=this._checkDevice();this.element.css({height:this._getProperValue(this.model.height),width:this._getProperValue(this.model.width),"min-width":this._getProperValue(this.model.minWidth),"max-width":this._getProperValue(this.model.maxWidth),"min-height":this._getProperValue(this.model.minHeight),"max-height":this._getProperValue(this.model.maxHeight)});this._customCssClass=this.model.cssClass;this.element.addClass(this.model.cssClass);this._isTreeNode=!1;this._selectedItems=[];this._selectedTileItems=[];this._downloadDialog=null;this._newFolderDialog=null;this._renameDialog=null;this._openDialog=null;this._detailsDialog=null;this._alertDialog=null;this._enablePostInit=!0;this._initialTime=(new Date).getTime();this._currentPath=this.model.path.replace(/\\/g,"/");this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._gridObj=null;this._setUploadLocalization();this._restrictedToolbarOptions=[];this._restrictedMenuOption=[];this._changeCheckState=this.model.showCheckbox;this._perRow=1;this._suggestionItems=[];this._highlightedNodes="";this._prevsorting=!0;this._FilteredFiles=[]},_renderMultiTouchDialog:function(){var n,i,r;this._customPop=t.buildTag("div.e-fe-popup","",{display:"none"});n=t.buildTag("div.e-content");i=t.buildTag("div.e-downtail e-tail");this.model.allowMultiSelection&&(r=t.buildTag("span.e-rowselect e-icon"),n.append(r));this._customPop.append(n);this._customPop.append(i);this.element.append(this._customPop);this._on(this._customPop,"mousedown",this._popupClick)},_popupClick:function(){var n=this._customPop.find(".e-rowselect");n.hasClass("e-spanclicked")?this._hidePopup():n.addClass("e-spanclicked")},_hidePopup:function(){this._customPop!=null&&this._customPop.is(":visible")&&(this._customPop.find(".e-rowselect").removeClass("e-spanclicked"),this._customPop.hide())},_ensureResolution:function(){this._isMobileOrTab=n(window).width()<=750?!0:!1;this._isMobileOrTab?(this.element.addClass("e-fe-mobile"),this._toolBarObj&&this._toolBarObj._liTemplte.css("max-width",this.element.width())):(this.element.removeClass("e-fe-mobile"),this._splitObj&&this.model.showNavigationPane&&this._splitObj.element.find(".e-cont1").hasClass("collapsed")&&(this.model.enableRTL?this._splitObj.expand(1):this._splitObj.expand(0)));this._toolBarObj&&this._toolBarObj.option("cssClass",this.model.cssClass+" e-fe-toolbar "+(this._isMobileOrTab?"e-fe-mobile":""));n(window).width()<=350||this.element.width()<=350?this.element.addClass("e-fe-small"):this.element.removeClass("e-fe-small");n(window).width()<=295||this.element.width()<=295?this.element.addClass("e-fe-short"):this.element.removeClass("e-fe-short")},_showHideNavigation:function(){this._splitObj.element.find(".e-cont1").hasClass("collapsed")?this.model.enableRTL?this._splitObj.collapse(0):this._splitObj.collapse(1):this.model.enableRTL?this._splitObj.expand(0):this._splitObj.expand(1)},_renderSplitIcon:function(){this.model.showNavigationPane&&(this._splitIcon=t.buildTag("div.e-fe-split-icon"),this._splitIcon.append("<span class='e-icon e-arrow-sans-left'><\/span>"),this._splitObj.element.find(".e-splitbar").append(this._splitIcon),this._on(this._splitIcon,"touchend click",this._showHideNavigation),this._isMobileOrTab&&this._splitObj&&this.model.showNavigationPane&&(this.model.enableRTL?this._splitObj.collapse(1):this._splitObj.collapse(0)))},_checkDevice:function(){return t.isDevice()&&t.isTouchDevice()},_initContextMenuOptions:function(n){for(var i,f,u=[],r=this.model.contextMenuSettings.items[n],e=this.model.contextMenuSettings.customMenuFields,t=0;t<r.length;t++)r[t]!="|"&&(i=this._getCustomItem(e,r[t]),f=r[t+1]=="|"?"e-fe-separator":null,this._addMenuItem(i,r[t],f,u,n),i&&i.hasOwnProperty("child")&&this._getChildItems(i.child,u,n,i.id));return u},_addMenuItem:function(n,i,r,u,f,e){var o=this._extendAttr(n,"text"),s,h;this["_menu"+i]=o?o:this._getLocalizedLabels("ContextMenu"+i);s=this._extendAttr(n,"htmlAttributes",r);h=this._extendAttr(n,"spriteCssClass","e-fileexplorer-toolbar-icon "+i);u.push({id:t.isNullOrUndefined(n)?this._ExplorerId+"_"+f+"_"+i:i,text:this["_menu"+i],parentId:e,sprite:h,htmlAttr:s})},_getChildItems:function(n,i,r,u){for(var e,f=0,o=n.length;f<o&&!t.isNullOrUndefined(n[f]);f++)e=n[f],this._addMenuItem(e,n[f].id,null,i,r,u),e&&e.hasOwnProperty("child")&&this._getChildItems(e.child,i,r,e.id)},_getCustomItem:function(n,i){for(var u,r=0,f=n.length;r<f&&!t.isNullOrUndefined(n[r]);r++){if(n[r].id==i){u=n[r];break}if(n[r].hasOwnProperty("child")){u=this._getCustomItem(n[r].child,i);break}}return u},_extendAttr:function(n,t,i){return i?t=="htmlAttributes"?{"class":n?n[t]?n[t]["class"]?n[t]["class"]+" "+i:i:i:i}:n?n[t]?n[t]+" "+i:i:i:n?n[t]?n[t]:null:null},_render:function(){this._selectedTreeFolder=this.model.selectedFolder;this._selectedNodes=this.model.selectedItems;this.element.addClass("e-widget e-box").attr({role:"fileexplorer",tabindex:0});this.model.showToolbar&&this._renderToolBar();this._createSplitPane();this._read();this._roundedCorner(this.model.showRoundedCorner)},_read:function(){var i=this,u={data:{ActionType:"Read",Path:this._currentPath,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(n){if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){i._showErrorDialog(n.error);return}i._feParent[i._currentPath]=n.cwd;i._readSuccess(n.files);i._enablePostInit&&i._postInit()}},successAfter:this.model.ajaxSettings.read.success};this.model.ajaxSettings.read.success=r;n.extend(!0,u,this.model.ajaxSettings.read);this._sendAjaxRequest(u)},_sendAjaxRequest:function(i,r){var e,u,f;(!i.dataType&&this.model.ajaxDataType&&(i.dataType=this.model.ajaxDataType),this.model.ajaxAction!=""&&this._currentPath!="")&&((i.data.ActionType!="Read"&&(this._selectedItemDetails=i.data.SelectedItems),e={Name:"",ActionType:"",Path:"",ExtensionsAllow:"",LocationFrom:"",LocationTo:"",Action:"",NewName:"",Names:[],CaseSensitive:!1,SearchString:"",FileUpload:null,CommonFiles:null},r||this._waitingPopup.show(),n.extend(!0,e,i.data),u={data:e,ajaxSettings:i},f=this,u.data.ActionType=="Paste"?(u.data.LocationFrom=this._pathCorrection(u.data.LocationFrom),u.data.LocationTo=this._pathCorrection(u.data.LocationTo)):u.data.Path=this._pathCorrection(u.data.Path),this._trigger("beforeAjaxRequest",u))||(i=u.ajaxSettings,n.ajax({data:i.dataType&&i.dataType.toLowerCase()=="jsonp"||i.contentType=="application/x-www-form-urlencoded"?{json:JSON.stringify(u.data)}:JSON.stringify(u.data),url:i.url,type:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"GET":i.type,async:i.async,success:function(n){f._waitingPopup.hide();i.success.call(this,n);typeof i.successAfter=="function"&&i.successAfter.apply(this,arguments)},contentType:i.contentType?i.contentType:"application/json",dataType:i.dataType,jsonpCallback:i.jsonpCallback?i.jsonpCallback:i.dataType&&i.dataType.toLowerCase()=="jsonp"?"MyCallbackFunction":"",error:i.error?i.error:function(n){f._waitingPopup.hide();var i=n.responseJSON?n.responseJSON.ExceptionType+", "+n.responseJSON.ExceptionMessage:n.statusText;f._alertDialog=f._createDialog(t.buildTag("div.e-fe-dialog-label",i),{width:400,height:"auto",title:f._getLocalizedLabels("Error")});f._alertDialogObj=f._alertDialog.data("ejDialog")},beforeSend:i.beforeSend,complete:function(){f._waitingPopup.hide();i.complete}})))},_pathCorrection:function(n){return this.model.path=="/"&&(n.indexOf(":")>=0?n=n.replace("//",""):n!="/"&&(n=n.replace("/",""))),n},_onBeforeOpen:function(){var t,n=[],i;return t=this._nodeType=="File"?this._currentPath.replace("~","..")+this._selectedFile:this._currentPath,this._selectedFile?n=this._getSelectedItemDetails(this._currentPath,this._selectedFile):this._selectedContent&&(n=this._getSelectedItemDetails(this._getFolderPath(),this._selectedContent)),i={path:t,itemType:this._nodeType,selectedItems:n},this._trigger("beforeOpen",i)},_readSuccess:function(n){var t;if(n!==r&&n!==null){for(this._update=!1,t=0;t<n.length;t++)n[t].sizeInByte=n[t].size,n[t].size=n[t].isFile?this._bytesToSize(n[t].size):"",n[t].cssClass=this._getCssClass(n[t]);var i=this.model.gridSettings.columns[0];this._changeActiveSortedoption(i.headerText,!0);this._sorting(i.field,!0,n);this._fileExplorer[this._currentPath]=n;this._itemStatus&&this._itemStatus.html(this._sorteditems.length+" "+(this._sorteditems.length==1?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")));this._treetag.hasClass("e-treeview")||(this._renderTreeView(this._sorteditems),this._updateOnNodeSelection=!0);this.model.layout=="grid"?this._renderGridView(this._sorteditems):this._renderTileView(this._sorteditems);this._usePreviousValues()}},_getCssClass:function(n){var t=n.name.substr(n.name.lastIndexOf(".")+1).toLowerCase();return n.isFile?/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(n.name)?"e-fe-images":/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(n.name)?"e-fe-audio":/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(n.name)?"e-fe-video":/\.(css|exe|html|js|msi|pdf|pptx|ppt|rar|zip|txt|docx|doc|xlsx|xls|xml|rtf|php)$/i.test(n.name)?"e-fe-"+t:"e-fe-unknown e-fe-"+t:n.permission&&!n.permission.Read?"e-fe-folder e-fe-lock":"e-fe-folder"},_bytesToSize:function(n){var t,i;return n==0?"0 Byte":(t=parseInt(Math.floor(Math.log(n)/Math.log(1024))),i=n/Math.pow(1024,t),i.toFixed(2)+" "+["Bytes","KB","MB","GB","TB"][t])},_setPath:function(n){this.model.path=n;this._treetag.remove();this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView");this._splittag.find(".e-cont1 > .e-tree-wrapper").append(this._treetag);this._fileExplorer=this._updateImages={};this._selectedStates=[];this._selectedItems=[];this._selectedTileItems=[];this._initUpdate=!1;this._initPath="";this._currentPath=this.model.path.replace(/\\/g,"/");this._originalPath=this._rootPath=this._currentPath=this._currentPath.endsWith("/")?this._currentPath:this._currentPath+"/";this._read()},_getPath:function(){return this.model.path},_changeSkin:function(n){this.element.removeClass(this._customCssClass).addClass(n);this._customCssClass=n;this._waitingPopup.option("cssClass",n);this._subControlsSetModel("cssClass",n)},_draggableOption:function(n){this._treeDragEvents(n);this._tileDragEvents(n);this._gridDragEvents(n);n=="_off"&&(this._previousPath=null);this._statusbar&&this[n](this._statusbar,"dragover",this._preventDropOption);this._toolBarItems&&this[n](this._toolBarItems,"dragover",this._preventDropOption)},_swapWith:function(t,i){t=n(t);i=n(i);var r=n("<span>").hide();t.before(r);i.before(t);r.replaceWith(i)},_enableRTL:function(n){var r=this._splittag.find(".e-cont1"),u=this._splittag.find(".e-cont2"),i,t;if(this.model.enableRTL=n,n){for(r.index()<u.index()&&this._swapWith(r,u),i=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),this._oldFormat||(this._oldFormat=JSON.parse(JSON.stringify(i))),t=0;t<i.length;t++)i[t].textAlign=i[t].headerTextAlign="right";this._gridObj&&this._gridObj.columns(i);this.element.addClass("e-rtl");this.element.find(".e-scroller").addClass("e-rtl")}else{if(r.index()>u.index()&&this._swapWith(u,r),this._gridObj&&this._oldFormat){for(t=0;t<this._oldFormat.length;t++)this._oldFormat[t].textAlign||(this._oldFormat[t].textAlign="left"),this._oldFormat[t].headerTextAlign||(this._oldFormat[t].headerTextAlign="left");this._gridObj.columns(this._oldFormat)}this._oldFormat&&(this.model.gridSettings.columns=JSON.parse(JSON.stringify(this._oldFormat)),this._oldFormat=null);this.element.removeClass("e-rtl");this.element.find(".e-scroller").removeClass("e-rtl");this._gridtag&&this._gridtag.removeClass("e-rtl")}this._splitterCorrection();this._subControlsSetModel("enableRTL",n)},_roundedCorner:function(n){var t=n?"addClass":"removeClass";this.element[t]("e-corner-all");this._treeContextMenutag&&this._treeContextMenutag[t]("e-corner");this._tileContextMenutag&&this._tileContextMenutag[t]("e-corner");this._subControlsSetModel("showRoundedCorner",n)},_destroy:function(){this._toolBarObj&&this._toolBarObj.destroy();this._treeContextMenutag&&this._treeContextMenutag.parent().remove();this._tileContextMenutag&&this._tileContextMenutag.parent().remove();this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._removeDialog(this._newFolderDialogObj);this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._removeDialog(this._renameDialogObj);this._openDialogObj&&this._openDialogObj.isOpen()&&this._removeDialog(this._openDialogObj);this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._removeDialog(this._detailsDialogObj);this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._removeDialog(this._alertDialogObj);this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._removeDialog(this._alertWindowObj);this._splitButtonObj&&this._splitButtonObj.destroy();this._splitButtonObj1&&this._splitButtonObj1.destroy();this._waitingPopup&&this._waitingPopup.destroy();this._gridObj&&this._gridObj.element.ejWaitingPopup("destroy");this._unwireEvents();this.element.html("");n(this._cloneElement).attr("style")?this.element.attr("style",n(this._cloneElement).attr("style")):this.element.removeAttr("style");this.element.removeClass("e-widget e-box e-rtl");this.element.removeAttr("role");delete this._prevsortingoption;this._prevsorting},_createFolder:function(i){var u=this,f={data:{ActionType:"CreateFolder",Name:i,Path:this._originalPath,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(this._originalPath),this._treeObj.getText(this._selectedNode))},url:this.model.ajaxAction,type:"POST",success:function(n){var i,e,f,o;if(n!==r&&n!==null){if(n.hasOwnProperty("d")&&(n=n.d),!t.isNullOrUndefined(n.error)){u._showErrorDialog(n.error);return}i=u._selectedNode;e=[{id:n.files[0].name,name:n.files[0].name,spriteCssClass:n.files[0].permission&&!n.files[0].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",hasChild:!1}];u._treetag.ejTreeView("isExpanded",i)||u._treeObj&&u._treeObj.expandNode(i);u._nodeExpanded=!0;u._treeObj.addNode(e,i);u._nodeExpanded=!1;u._update=!0;u._treeObj.selectNode(i);u._refreshTreeScroller();u._treetag.find("li").removeAttr("tabindex");f=u._treetag.find("li div a").not(".e-js");u.model.allowDragAndDrop&&f.length&&(u._drag(f),f.addClass("e-file-draggable"));o={data:n,selectedItems:u._selectedItemDetails};u._trigger("createFolder",o);u._setSelectedItems([n.files[0].name])}},successAfter:this.model.ajaxSettings.createFolder.success};this.model.ajaxSettings.createFolder.success=r;n.extend(!0,f,this.model.ajaxSettings.createFolder);this._sendAjaxRequest(f)},_needToScroll:function(n,i){var f,e=i=="Tree"?n.find("a").eq(0).outerHeight():n.outerHeight()+(this.model.layout=="grid"?0:10),r=0,u;if(r+=n.position().top+e,i=="Tree"){while(n.parent().hasClass("e-treeview-ul"))n=n.parent(),r+=n.position().top;f=this._splittag.find(".e-cont1").height()}else this.model.layout==t.FileExplorer.layoutType.Grid?(f=this._gridtag.find(".e-gridcontent").height(),r=r-this._gridtag.find(".e-gridheader").outerHeight()):f=this._tileViewWrapper.height();u=n.closest(".e-scroller .e-content",".e-fileexplorer");f<r?u.animate({scrollTop:u.scrollTop()+e*2},500,"linear"):r<n.outerHeight()&&u.animate({scrollTop:u.scrollTop()-e*2},500,"linear")},_cut_copy:function(n){var i=this,f,r,e,u,o;if(this._sourcePath==this._currentPath&&this._option=="move"){this.element.find(".e-blur").removeClass("e-blur");this.model.layout!="grid"&&this._clearTileCheckBoxSelection();this._setSelectedItems(this._fileName);n&&(this._activeSource=this.model.selectedItems);return}for(f=this._fileExplorer[this._currentPath],r=typeof this._copiedNodes=="string"?[this._copiedNodes]:this._copiedNodes,this._pastedFiles=r.slice(),e=0;e<r.length;e++)if(!this._isNameExist(this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._sourcePath],r[e]))return;u=i._currentPath;o=function(){if(i._currentPath=u,t.isNullOrUndefined(f)&&(f=i._fileExplorer[u]),i._existingItems=[],i._sourcePath!=u&&f.length)i._getDuplicateItems(i._sourcePath,u,typeof i._fileName=="string"?[i._fileName]:i._fileName),i._existingItems.length?i._createReplaceConformationDiaolg("_pasteOperation","PasteReplaceAlert"):i._pasteOperation();else{for(var n=0;n<r.length;n++)i._pastedFiles[n]=i._getDuplicateName(i._fileExplorer[u],r[n]);i._pasteOperation()}};t.isNullOrUndefined(f)?this._getFileDetails(this._currentPath,"","",o):o()},_createReplaceConformationDiaolg:function(i,r){var u=this,o,f=0,s,y;(r=="PasteReplaceAlert"||r=="UploadReplaceAlert")&&this._getLocalizedLabels("ReplaceAlert")!="ReplaceAlert"?r="ReplaceAlert":o=i=="_customUpload"?"UploadError":i=="pasteOperation"?"PasteError":i=="_rename"?"RenameError":"Error";s=this.model.rootFolderName.length>0?String.format(this._getLocalizedLabels(r),this._changeName(this._existingItems[f].Path),!1):String.format(this._getLocalizedLabels(r),this._existingItems[f].Path);var h=t.buildTag("div.e-get-name"),p=t.buildTag("div.e-fe-dialog-label",s),c=t.buildTag("div.e-fe-dialog-btn e-replace"),e=t.buildTag("button.e-fe-btn-yes ",this._getLocalizedLabels("YesButton")),l=t.buildTag("button.e-fe-btn-yes e-all ",this._getLocalizedLabels("YesToAllButton")),a=t.buildTag("button.e-fe-btn-no ",this._getLocalizedLabels("NoButton")),v=t.buildTag("button.e-fe-btn-no e-all ",this._getLocalizedLabels("NoToAllButton"));e.ejButton({type:"button",cssClass:"e-flat",click:function(){/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[f].Name)&&(u._updateImages[u._existingItems[f].Path]=(new Date).getTime());u._existingItems[f].IsReplace=!0;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});a.ejButton({type:"button",cssClass:"e-flat",click:function(){u._existingItems[f].IsReplace=!1;f++;f<u._existingItems.length?u._alertDialog.find(".e-fe-dialog-label").text(String.format(u._getLocalizedLabels(r),u._existingItems[f].Path)):u._destroyReplaceConformationDiaolg(i)}});l.ejButton({type:"button",cssClass:"e-flat",click:function(){for(var n=f;n<u._existingItems.length;n++)/\.(gif|jpg|jpeg|tiff|png|bmp)$/i.test(u._existingItems[n].Name)&&(u._updateImages[u._existingItems[n].Path]=(new Date).getTime()),u._existingItems[n].IsReplace=!0;u._destroyReplaceConformationDiaolg(i)}});v.ejButton({cssClass:"e-flat",type:"button",click:function(){for(var n=f;n<u._existingItems.length;n++)u._existingItems[n].IsReplace=!1;u._destroyReplaceConformationDiaolg(i)}});c.append(e,l,a,v);n(h).append(p,c);y=function(){e.focus()};this._alertDialog=this._createDialog(h,{width:500,height:"auto",title:this._getLocalizedLabels(o),open:y});this._alertDialogObj=this._alertDialog.data("ejDialog")},_destroyReplaceConformationDiaolg:function(n){this._removeDialog(this._alertDialogObj);this[n]()},_pasteOperation:function(){var i,u,r,o,e,c;for(this._removeBlurEffect(),i=this,u=-1,typeof this._fileName=="string"&&(this._fileName=[this._fileName]),r=0;r<this._fileName.length;r++)if(o=this._sourcePath+this._fileName[r]+"/",this._currentPath.indexOf(o)>=0){u=r;break}if(u!=-1){var l=this._getLocalizedLabels("CancelPasteAction"),s=t.buildTag("div"),a=t.buildTag("div.e-fe-dialog-label",l),h=t.buildTag("div.e-fe-dialog-centerbtn"),f=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));f.ejButton({cssClass:"e-flat",type:"button",click:function(){i._removeDialog(i._alertDialogObj)}});e=t.buildTag("button.e-fe-btn-skip ",this._getLocalizedLabels("SkipButton"));e.ejButton({cssClass:"e-flat",type:"button",click:function(){i._fileName.splice(u,1);i._removeDialog(i._alertDialogObj);i._performPasteOperation()}});h.append(e,f);n(s).append(a,h);c=function(){f.focus()};this._alertDialog=this._createDialog(s,{width:400,height:"auto",title:this._getLocalizedLabels("Error"),open:c});this._alertDialogObj=this._alertDialog.data("ejDialog")}else this._performPasteOperation()},_performPasteOperation:function(){var i=this,u=this._currentPath.split("/"),f={data:{ActionType:"Paste",LocationFrom:this._sourcePath,LocationTo:this._currentPath,Names:typeof this._fileName=="string"?[this._fileName]:this._fileName,Action:this._option,CommonFiles:this._existingItems,SelectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName),TargetFolder:this._getSelectedItemDetails(this._getFolderPath(),u[u.length-2])},url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,f,e,h,c;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}for(typeof i._fileName=="string"&&(i._fileName=[i._fileName]),f=0;f<i._pastedFiles.length;f++)/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(i._pastedFiles[f])&&(i._updateImages[i._currentPath+i._pastedFiles[f]]=(new Date).getTime());if(i._existingItems&&i._existingItems.filter(function(t){if(t.IsReplace==!1){var r=n.inArray(t.Name,i._pastedFiles);r>-1&&i._pastedFiles.splice(r,1)}}),i._existingItems=[],o=i._originalPath,s=i._selectedNode,i._option=="move"){for(f=0;f<i._fileName.length;f++)i._modifySelectedStates(i._sourcePath+i._fileName[f],"");if(i._fileName.length>0)if(i._fileName.length==1)i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode);else for(u=i._refreshNode.siblings(),i._sourceType=="Directory"&&i._treeObj.removeNode(i._refreshNode),f=0;f<i._fileName.length;f++)for(e=0;e<u.length;e++)i._fileName[f]==n(u[e]).text()&&i._treeObj.removeNode(u[e])}n.each(i._fileExplorer,function(n){n.startsWith(o)&&(i._fileExplorer[n]="")});i._currentPath=i._originalPath;i._highlightedNodes=i._pastedFiles;i._option=="move"?i._refreshItems(s,o,function(){i._fileExplorer[i._sourcePath]="";i._getFileDetails(i._sourcePath)}):i._refreshItems(s,o);h=i._getFolderPath();i._option=="move"&&(i._fileName="",i._option=null,i._toolBarItems&&i._toolBarItems.ejToolbar("disableItemByID",i._ExplorerId+"Paste"),i.model.showContextMenu&&(i._viewMenuObj.disableItem(i._menuPaste),i._treeMenuObj.disableItem(i._menuPaste)));c={name:i._fileName,targetPath:i.model.path,selectedItems:i._selectedItemDetails,targetFolder:i._getSelectedItemDetails(h,i._selectedContent)};i._trigger("paste",c)},successAfter:this.model.ajaxSettings.paste.success};this.model.ajaxSettings.paste.success=r;n.extend(!0,f,this.model.ajaxSettings.paste);this._sendAjaxRequest(f)},_deletion:function(i,u){var f=this,o=this._treeObj.getSelectedNode(),e;this._treeObj.isExpanded(o)||this._treeObj&&this._treeObj.expandNode(o);e={data:{ActionType:"Remove",Names:typeof i=="string"?[i]:i,Path:u,SelectedItems:this._getSelectedItemDetails(u,i)},traditional:!0,url:this.model.ajaxAction,type:"POST",success:function(r){var o,s,h;if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){f._showErrorDialog(r.error);return}for(f._selectedItemsTag&&f._selectedItemsTag.html(""),f._fileExplorer[f._ajax_folderPath]="",n.each(f._fileExplorer,function(n){n.startsWith(f._ajax_folderPath)&&(f._fileExplorer[n]="")}),o=0;o<e.data.SelectedItems.length;o++)e.data.SelectedItems[o].isFile==!1&&f._modifySelectedStates(u+e.data.SelectedItems[o].name,"");f._currentPath=f._ajax_folderPath;s=f._selectedContent==f._selectedTreeText?f._parentNode:f._selectedNode;f._refreshItems(s,f._ajax_folderPath);f._treeObj.getSelectedNode().length==0?f._treeObj.selectNode(f._parentNode):f.model.layout=="grid"?f._gridtag.find(".e-gridcontent").click():f._tileViewWrapper.click();h={data:r,path:f._ajax_folderPath,name:i,selectedItems:f._selectedItemDetails};f._trigger("remove",h)},successAfter:this.model.ajaxSettings.remove.success};this.model.ajaxSettings.remove.success=r;n.extend(!0,e,this.model.ajaxSettings.remove);this._sendAjaxRequest(e)},_rename:function(){var i=this,u={data:{ActionType:"Rename",Path:i._currentPath,Name:i._selectedContent,NewName:i._ajax_person,CommonFiles:i._existingItems,SelectedItems:this._getSelectedItemDetails(i._currentPath,this._selectedContent)},url:this.model.ajaxAction,type:"POST",success:function(r){if(!t.isNullOrUndefined(r)&&(r.hasOwnProperty("d")&&(r=r.d),!t.isNullOrUndefined(r.error))){i._showErrorDialog(r.error);return}i._existingItems=[];i._fileExplorer[i._currentPath]="";i._nodeType!="File"&&i._modifySelectedStates(i._currentPath+i._selectedContent,i._currentPath+i._ajax_person);i._splittag.find(".e-cont2 .e-active").length<=0?(n.each(i._fileExplorer,function(n){n.startsWith(i._currentPath+i._selectedContent+"/")&&(i._fileExplorer[n]="")}),i._selectedNode.find("> div > .e-text")[0].lastChild.nodeValue=i._selectedContent=i._ajax_person,i._originalPath=i._currentPath+=i._ajax_person+"/",i._updateAddressBar()):(i.model.selectedItems.length>0?(i.model.selectedItems[i.model.selectedItems.length-1]=i._getOriginalName(i._ajax_person),i._selectedItems[0]=i._ajax_person,i._highlightedNodes=i.model.selectedItems,i._refreshItems(i._selectedNode,i._currentPath)):i._refreshItems(i._parentNode,i._currentPath),i._treeObj.getSelectedNode().length==0&&n(i._parentNode).find("li a").each(function(){if(n(this).text()==i._ajax_person)return i._treeObj.selectNode(n(this).closest("li.e-item")),!1}))},successAfter:this.model.ajaxSettings.rename.success};this.model.ajaxSettings.rename.success=r;n.extend(!0,u,this.model.ajaxSettings.rename);this._sendAjaxRequest(u)},_downloadFile:function(){var i=this._getSelectedItemDetails(this._currentPath,this._selectedItems),r={Path:this._pathCorrection(this._currentPath),ActionType:"Download",SelectedItems:JSON.stringify(i),Names:this._selectedItems},u=this.model.ajaxAction+"?"+n.param(r,!0),t;if(this.model.ajaxSettings.download.url&&(u=this.model.ajaxSettings.download.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.download.url,"?"+n.param(r,!0)):this.model.ajaxSettings.download.url),t={path:this._pathCorrection(this._currentPath),files:this._selectedItems,selectedItems:i,url:u},this._trigger("beforeDownload",t))return!1;window.location=t.url},_removeBlurEffect:function(){this._currntNode&&(this._currntNode.hasClass("e-active")&&this._currntNode.removeClass("e-blur"),this._currntNode.find(".e-active").length&&this._currntNode.find(".e-active").removeClass("e-blur"))},_renderTreeView:function(t){var e=t.length>0?!0:!1,i,r,u,f;for(this._collapse=!1,i=this,r=this._currentPath.split("/"),u=0;u<r.length-2;u++)this._initPath+=r[u]+"/";f=r[r.length-2];this._localData=[{id:1,name:f?f:this._currentPath,spriteCssClass:this._hasReadPermission(this._currentPath)?"e-fe-icon e-fe-folder":"e-fe-icon e-fe-folder e-fe-lock",hasChild:e}];this._treetag._collapse=!1;this._treetag.ejTreeView({loadOnDemand:!0,cssClass:i.model.cssClass,enableRTL:i.model.enableRTL,allowKeyboardNavigation:i.model.allowKeyboardNavigation,fields:{dataSource:i._localData,id:"id",parentId:"pid",text:"name",hasChild:"hasChild",spriteCssClass:"spriteCssClass"},nodeCollapse:function(n){i._refreshTreeScroller(n)},nodeExpand:function(n){i._refreshTreeScroller(n)},nodeClick:function(n){i._treenodeClicked(n)},beforeExpand:function(n){i._treeNodeBeforeExpand(n)},nodeSelect:function(n){i._updateTreePath(n)},beforeCollapse:function(n){i._onBeforeCollapse(n)},beforeDelete:function(n){i._treeBeforeDelete(n)}});this._treeObj=this._treetag.data("ejTreeView");this._rootFolderName=this._treeObj.element.find("li:first > div > .e-text").text();this._changeRootFolderName();this._treeViewEvents("_off");this._treeViewEvents("_on");this._isClicked=!1;this._treetag.ejTreeView("selectNode",n(this._treetag).find("li")[0]);this._isClicked=!0;this._treeScroll=this._treetag.parent(".e-tree-wrapper").ejScroller({height:this._splittag.height(),width:parseInt(this._splittag.find(".e-cont1").width()),buttonSize:0,scrollerSize:this._scrollerSize,thumbStart:function(n){i._onThumbStart(n)}}).data("ejScroller");this._addChild(t)},_treeViewEvents:function(n){this[n](this._treetag,"focus",this._focusTreeView);this[n](this._treetag,"blur",this._blurTreeView);this.model.allowDragAndDrop&&this._treeDragEvents(n)},_treeDragEvents:function(n){var t=this._treetag.parent(".e-tree-wrapper");t&&(this[n](t,"dragover",this._onDragOverHandler),this[n](t,"drop",this._onDropHandler),this[n](t,"dragleave",this._onDragLeave))},_focusTreeView:function(){this._treetag.hasClass("e-focus")||(this._treetag.addClass("e-focus"),this._itemList=[],this._on(this._treetag,"keydown",this._OnKeyUp),this._hidePopup())},_blurTreeView:function(){this._treetag.removeClass("e-focus");this._off(this._treetag,"keydown",this._OnKeyUp)},_treeBeforeDelete:function(n){if(!t.isNullOrUndefined(n.event)){var i=this._getKeyCode(n.event);i==46&&(n.cancel=!0)}},_treeNodeBeforeExpand:function(n){if(!this._nodeExpanded){var t=this._updatePath(n.currentElement,n.value);this._fileExplorer[t]||this._getFileDetails(t,n.currentElement);this._treetag.ejTreeView("hasChildNode",n.currentElement)||this._fileExplorer[t]&&this._addChild(this._fileExplorer[t],n.currentElement)}},_treenodeClicked:function(t){if(t.event.currentTarget&&t.event.currentTarget.focus(),n(t.currentElement).hasClass("e-text")&&t.currentElement!=this._selectedNode.find("> div > .e-text")[0]){this._selectedContent=t.currentElement.text;this._selectedNode=n(t.currentElement).closest("li.e-item");var i=n(this._selectedNode.parents("li.e-item")[0]);this._parentNode=i.length!=0?i:this._selectedNode;this._nodeType="Directory";this._isTreeNode=!0}},_showHideContextMenu:function(){if(this.model.showContextMenu){var i={beforeOpen:"",click:""},r={id:"",targetId:""};this._treeMenuOptions=this._initContextMenuOptions("navbar");r.id=this._ExplorerId+"_treeView";r.targetId="#"+this._ExplorerId+"_treeView";i.beforeOpen=n.proxy(this._beforeOpenContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.close=n.proxy(this._onHideContextMenu,this);i.click=n.proxy(this._contextMenuClick,this);this._treeContextMenutag=this._createContextMenuTag(this._treeMenuOptions,r,i);this._treeMenuObj=this._treeContextMenutag.ejMenu("instance");this._cwdMenuOptions=this._initContextMenuOptions("cwd");this._addSortbyoptions();r.id=this._ExplorerId+"_tileView";r.targetId="#"+this._ExplorerId+"_tileWrapper,#"+this._ExplorerId+"_grid";i.beforeOpen=n.proxy(this._beforeOpenTileContextMenu,this);i.open=n.proxy(this._contextMenuOpen,this);i.click=n.proxy(this._fileContextMenuClick,this);this._tileContextMenutag=this._createContextMenuTag(this._cwdMenuOptions,r,i);this._viewMenuObj=this._tileContextMenutag.ejMenu("instance");(t.isNullOrUndefined(this._fileName)||this._fileName=="")&&this._treeMenuObj.disableItem(this._menuPaste);this._fileMenuOptions=this._initContextMenuOptions("files")}else this._treeContextMenutag&&this._tileContextMenutag&&(this._treeMenuObj.destroy(),this._viewMenuObj.destroy(),n("#"+this._ExplorerId+"_treeViewContextMenu").remove(),n("#"+this._ExplorerId+"_tileViewContextMenu").remove(),this._viewMenuObj=this._treeMenuObj=null)},_addSortbyoptions:function(){var u=this.model.contextMenuSettings.items.cwd.length,r=this.model.contextMenuSettings.items.cwd,t,n,i;if(r.indexOf("SortBy")>-1)for(t=this.model.gridSettings.columns.length,n=0;n<t;n++)i="e-fileexplorer-toolbar-icon "+this.model.gridSettings.columns[n].field,this._cwdMenuOptions.push({id:this._ExplorerId+"_cwd_"+this.model.gridSettings.columns[n].field,text:this.model.gridSettings.columns[n].headerText,parentId:this._ExplorerId+"_cwd_SortBy",sprite:i})},enableMenuItem:function(n){n=this._findCommand(n,this.model.contextMenuSettings.items,!0);for(var t=0;t<this._restrictedMenuOption.length;t++)if(this._restrictedMenuOption[t]==n){this._restrictedMenuOption.splice(t,1);break}this._treeMenuObj&&this._treeMenuObj.enableItem(n);this._viewMenuObj&&this._viewMenuObj.enableItem(n)},disableMenuItem:function(t){t=this._findCommand(t,this.model.contextMenuSettings.items,!0);n.inArray(t,this._restrictedMenuOption)==-1&&this._restrictedMenuOption.push(t);this._treeMenuObj&&this._treeMenuObj.disableItem(t);this._viewMenuObj&&this._viewMenuObj.disableItem(t)},_renderGridView:function(i){for(var r,f,s,o,u=JSON.parse(JSON.stringify(this.model.gridSettings.columns)),h=null,e=0;e<u.length;e++)u[e].template||(u[e].template="<script type='text/x-jsrender'><span title= '{{:"+u[e].field+"}}'>{{:"+u[e].field+"}}<\/span><\/script>");this._suggestionItems.length&&u.push({field:"filterPath",headerText:this._getLocalizedLabels("Folder"),width:"20%"});u.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"<script type='text/x-jsrender'><span class='e-fe-icon {{:cssClass}}' unselectable='on'><\/span><\/script>",textAlign:t.TextAlign.Center,allowResizing:!1});this.model.showCheckbox&&u.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:22,template:"<script type='text/x-jsrender'><input type='checkbox' class='e-grid-row-checkbox'/><\/script>",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1});r=this;f=u[u.length-1];f&&(f.customAttributes?f.customAttributes["class"]?f.customAttributes["class"].search("e-rowcell e-last-rowcell")==-1&&(f.customAttributes["class"]=f.customAttributes["class"]+" e-rowcell e-last-rowcell"):f.customAttributes["class"]=" e-rowcell e-last-rowcell":f.customAttributes={"class":"e-rowcell e-last-rowcell"});this._gridObj?(u.length!=this._gridObj.model.columns.length&&(this._gridObj.model.columns=u,this._gridObj.columns(this._gridObj.model.columns)),h=JSON.parse(JSON.stringify(this._gridObj.model.sortSettings)),this._gridObj.option("dataSource",i),this._gridObj.option("enableRTL",this.model.enableRTL),this._gridObj.option("sortSettings",h)):(this._gridtag.ejGrid({cssClass:r.model.cssClass,enableRTL:r.model.enableRTL,allowKeyboardNavigation:this.model.allowKeyboardNavigation,dataSource:i,selectionType:r.model.allowMultiSelection?"multiple":"single",allowSorting:r.model.gridSettings.allowSorting,columns:u,isResponsive:!0,scrollSettings:{width:186,height:200,buttonSize:0,scrollerSize:r._scrollerSize},allowScrolling:!0,enableResponsiveRow:!1,rowSelected:function(n){r._updatePathFromGrid(n)},recordDoubleClick:function(n){r._openAction(n)},templateRefresh:function(n){r._templateRefresh(n)},create:this.model.showCheckbox?function(n){r._gridCheckboxState(n)}:null,actionBegin:function(n){r._gridActionBegin(n)},actionComplete:function(n){r._gridActionComplete(n)},allowResizing:r.model.gridSettings.allowResizing}),this.model.allowMultiSelection||this._gridtag.find(".e-headercelldiv>span.e-chkbox-wrap").hide());i.length&&i[0].filterPath&&this._setFilteredContent();this._gridObj=this._gridtag.ejGrid("instance");s=this._getFilePermission(this._currentPath);s&&!s.Read?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("ProtectedFolder")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._searchbar&&n.trim(this._searchbar.val())?this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyResult")).addClass("e-fe-center"):this._gridObj.model.dataSource.length==0&&this._gridObj.getContentTable().find(".emptyrecord").html(this._getLocalizedLabels("EmptyFolder")).addClass("e-fe-center");this.gridItems=this._gridObj.getRows();this.model.allowDragAndDrop&&(this._gridtag.children(".e-gridcontent").addClass("e-droppable"),this._drag(n(this.gridItems)),n(this.gridItems).addClass("e-file-draggable"));this._reSizeHandler();o=this._gridObj.getScrollObject();o&&(o.isVScroll()||o.isVScroll())&&o.element.ejScroller({thumbStart:function(n){r._onThumbStart(n)}});this._gridtag.attr("tabindex",-1);this._gridViewEvents("_off");this._gridViewEvents("_on");this._gridupdate(this._prevsortingoption)},_setFilteredContent:function(){for(var t,r=this._gridtag.find(".e-gridcontent tr"),i=0;i<r.length;i++)t=n(r[i]).find("td:last"),n(r[i]).attr("data-parent-path",t.text()),this.model.rootFolderName.length>0?t.attr("title",this._changeName(t.text(),!1)):t.attr("title",t.text()),t.text("/"+t.text().replace(this._rootPath,""))},_templateRefresh:function(n){this._trigger("templateRefresh",n)},_gridActionBegin:function(n){if(n.requestType=="sorting"){n.cancel=!0;var t=this.model.gridSettings.columns.length;for(i=0;i<t;i++)if(n.columnName==this.model.gridSettings.columns[i].field){this._changeActiveSortedoption(this.model.gridSettings.columns[i].headerText);this._sorting(this._prevsortingoption,this._prevsorting);this._sortingActioncomplete();break}this._suggestionItems.length&&n.columnName=="filterPath"&&(this.removeSortingIcons(),this._suggestionitemsSorting("filterPath",this._prevsorting),this._sortingActioncomplete());this._suggestionItems.length&&this._setFilteredContent()}},_gridActionComplete:function(n){this.model.showCheckbox&&this._gridCheckboxState(n);t.isNullOrUndefined(this._gridObj)||this._gridupdate(this._prevsortingoption)},_gridCheckboxState:function(){var n=this;this._gridtag.find(".e-headercelldiv:first").html(" <input type='checkbox' id='headchk' />").addClass("e-col-check");this._headCheckObj=this._gridtag.find("#headchk").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner,change:function(t){n._headCheckChange(t)}}).data("ejCheckBox");this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({showRoundedCorner:n.model.showRoundedCorner});this._gridtag.find(".e-chkbox-wrap").removeAttr("tabindex")},_checkChange:function(t){var i,e;if(t.isInteraction||t.isInteraction==r){var o=this._gridtag.find(".e-grid-row-checkbox"),f=this._gridtag.find(" .e-gridcontent .e-checkbox:checked"),u=[];for(i=0;i<f.length;i++)u.push(n(f[i]).closest("tr").index());for(t&&!t.type&&(e=n.inArray(t.index(),u),t.find(".e-chk-act").length==1?u.splice(e,1):u.push(t.index())),this._changeCheckState=!1,this._gridObj.clearSelection(),u.length==o.length?this._gridtag.find("#headchk").ejCheckBox({checked:!0}):this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._isClicked=!1,i=0;i<u.length;i++)!0&&(this._gridObj.multiSelectCtrlRequest=!0,this._gridObj.selectRows(u[i]));this._isClicked=!0;this.model.checked==!1&&this._gridtag.find("#headchk").ejCheckBox({checked:!1});this._changeCheckState=!0}},_recordClick:function(){for(var r,i=this._gridtag.find(".e-grid-row-checkbox"),t=0;t<i.length;t++)n.inArray(t,this._gridObj.selectedRowsIndexes)<0?(n(i[t]).ejCheckBox({checked:!1}),this._gridtag.find("#headchk").ejCheckBox({checked:!1}),this._gridObj.multiSelectCtrlRequest||this._unselectEvent()):(n(i[t]).ejCheckBox({checked:!0}),r=this._gridtag.find(".e-grid-row-checkbox:checked"),r.length==i.length&&this._gridtag.find("#headchk").ejCheckBox({checked:!0}))},_headCheckChange:function(n){if(n.isInteraction){var i=this,t=this._gridtag.find(".e-grid-row-checkbox");t.ejCheckBox({change:function(n){i._checkChange(n)}})