Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/file_and_directory_restore/index.cmb.min.js

define("app/services/backup_API",["angular","cjt/io/uapi-request","cjt/io/api","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService"],function(e,r,t,n){var i;try{i=e.module("whm.fileAndDirectoryRestore")}catch(o){i=e.module("whm.fileAndDirectoryRestore",[])}i.factory("backupAPIService",["APIService",function(r){var t=function(){};return t.prototype=new r,e.extend(t.prototype,{listDirectory:function(e,r){var t=new n.Class;t.initialize("","cpanel"),t.addArgument("cpanel_jsonapi_user",r),t.addArgument("cpanel_jsonapi_module","Restore"),t.addArgument("cpanel_jsonapi_func","directory_listing"),t.addArgument("cpanel_jsonapi_apiversion","3"),t.addArgument("path",e);var i=this.deferred(t,{transformAPISuccess:function(e){return e.data},transformAPIFailure:function(e){return e.error}});return i.promise},listUsers:function(){var e=new n.Class;e.initialize("Accounts","listaccts");var r=this.deferred(e,{transformAPISuccess:function(e){return e.data},transformAPIFailure:function(e){return e.error}});return r.promise},listFileBackups:function(e,r){var t=new n.Class;t.initialize("","cpanel"),t.addArgument("cpanel_jsonapi_user",r),t.addArgument("cpanel_jsonapi_module","Restore"),t.addArgument("cpanel_jsonapi_func","query_file_info"),t.addArgument("cpanel_jsonapi_apiversion","3"),t.addArgument("fullpath",e);var i=this.deferred(t,{transformAPISuccess:function(e){return e.data},transformAPIFailure:function(e){return e.error}});return i.promise},restore:function(e,r,t){var i=new n.Class;i.initialize("","cpanel"),i.addArgument("cpanel_jsonapi_user",t),i.addArgument("cpanel_jsonapi_module","Restore"),i.addArgument("cpanel_jsonapi_func","restore_file"),i.addArgument("cpanel_jsonapi_apiversion","3"),i.addArgument("backupID",r),i.addArgument("fullpath",e),i.addArgument("overwrite",1);var o=this.deferred(i,{transformAPISuccess:function(e){return e.data},transformAPIFailure:function(e){return e.error}});return o.promise}}),new t}])}),define("app/views/backup_restore",["angular","cjt/util/locale","app/services/backup_API","uiBootstrap"],function(e,r){var t=e.module("whm.fileAndDirectoryRestore"),n=t.controller("listController",["$scope","growl","backupAPIService","$uibModal",function(e,t,n,i){e.buildBreadcrumb=function(){if(e.directoryBreadcrumb=[],"/"===e.currentPath)e.directoryBreadcrumb=[{folder:e.currentPath,path:e.currentPath}];else for(var r=e.currentPath.split("/"),t=0,n=r.length;n>t;t++)e.directoryBreadcrumb.push({folder:r[t],path:e.currentPath.split(r[t])[0]+r[t]})},e.changeDirectory=function(r){e.loadingData=!0,e.fileBackupList=[],".."===r&&(r=e.directoryBreadcrumb[e.directoryBreadcrumb.length-3].path),"/"!==r.charAt(r.length-1)&&(r+="/"),n.listDirectory(r,e.accountName).then(function(t){e.currentPath=r,e.buildBreadcrumb(),e.addPaths(t),e.loadingData=!1},function(e){t.error(e)})},e.selectItem=function(r){-1!==r.type.indexOf("dir")?e.changeDirectory(r.fullPath):(e.selectedItemName=r.name,e.selectedItemExists=r.exists,e.loadingData=!0,n.listFileBackups(r.fullPath,e.accountName).then(function(r){e.fileBackupList=r,e.loadingData=!1},function(e){t.error(e)}))},e.addPaths=function(r){e.currentDirectoryContent=[];for(var t=0,n=r.length;n>t;t++)r[t].path=e.currentPath,r[t].fullPath=e.currentPath+r[t].name,e.currentDirectoryContent.push(r[t])},e.restore=function(o){e.selectedFilePath=o.fullpath,e.selectedBackupID=o.backupID;var a=i.open({templateUrl:"restoreModalContent.tmpl",controller:"restoreModalController",resolve:{fileExists:e.selectedItemExists}});a.result.then(function(i){i&&n.restore(e.selectedFilePath,e.selectedBackupID,e.accountName).then(function(e){e.success&&t.success(r.maketext("File restored successfully."))},function(e){t.error(r.maketext("File restoration failure: [_1]",e))})})},e.getAccounts=function(){n.listUsers().then(function(r){e.inCpanel=!1,e.initialDataLoaded=!0,e.accounts=r,e.currentDirectoryContent=[],e.fileBackupList=[]},function(e){t.error(e)})},e.getAccount=function(r){e.loadingData=!0,n.listDirectory("/",r).then(function(t){e.inCpanel=!0,e.accountName=r,e.currentPath="/",e.loadingData=!1,e.buildBreadcrumb(),e.addPaths(t)},function(e){t.error(e)})},e.init=function(){e.initialDataLoaded=!1,e.getAccounts()},e.init()}]);return n}),define("app/views/restore_confirmation",["angular","cjt/util/locale","uiBootstrap"],function(e){var r=e.module("whm.fileAndDirectoryRestore");r.controller("restoreModalController",["$scope","$uibModalInstance","fileExists",function(e,r,t){e.fileExists=t,e.closeModal=function(){r.close()},e.runIt=function(){r.close(!0)}}])}),define("app/filters/file_size_filter",["angular","cjt/util/locale"],function(e,r){var t;try{t=e.module("whm.fileAndDirectoryRestore")}catch(n){t=e.module("whm.fileAndDirectoryRestore",[])}t.filter("convertedSize",function(){return function(e){return r.format_bytes(e)}})}),define("app/index",["angular","cjt/core","cjt/modules","ngRoute","uiBootstrap"],function(e){return function(){e.module("whm.fileAndDirectoryRestore",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","angular-growl","cjt2.whm"]);var r=require(["cjt/bootstrap","cjt/views/applicationController","app/views/backup_restore","app/views/restore_confirmation","app/filters/file_size_filter"],function(r){var t=e.module("whm.fileAndDirectoryRestore");t.config(["$routeProvider",function(e){e.when("/backup_restore",{controller:"listController",templateUrl:"file_and_directory_restore/views/backup_restore.ptt"}),e.otherwise({redirectTo:"/backup_restore"})}]),r(document,"whm.fileAndDirectoryRestore")});return r}});
Back to Directory File Manager