Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/feature/manager.cmb.min.js

define("app/views/commonController",["angular","cjt/filters/wrapFilter","cjt/services/alertService","cjt/directives/alertList","uiBootstrap"],(function(e){var t;try{t=e.module("App")}catch(r){t=e.module("App",["ui.bootstrap","ngSanitize"])}return t.controller("commonController",["$scope","$location","$rootScope","alertService","PAGE",function(e,t,r,a,i){e.isInstalled=i.installed,e.alerts=a.getAlerts(),e.route=null,e.closeAlert=function(e){a.remove(e)},e.isCurrentView=function(t){return!(!e.route||!e.route.$$route)&&e.route.$$route.originalPath===t},r.$on("$routeChangeStart",(function(t,r,a){e.route=r}))}])})),define("app/services/featureListService",["angular","lodash","cjt/io/api","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService"],(function(e,t,r,a,i){var s,n="";try{s=e.module("App")}catch(t){s=e.module("App",["cjt2.services.api"])}s.factory("featureListService",["$q","APIService","PAGE",function(r,s,o){function u(e){var t=[];if(e.status){for(var r=e.data,a=0,i=r.length;a<i;a++)t.push(r[a]);var s=e.meta;return{items:t,totalItems:s.paginate.total_records||r.length,totalPages:s.paginate.total_pages||1,status:e.status}}return{items:[],totalItems:0,totalPages:0,status:e.status}}function c(e){var t=new a.Class;return t.initialize(n,"get_featurelists"),t.addSorting("","asc","lexicographic_caseless"),this.deferred(t,{transformAPISuccess:u},e),e.promise}function l(e,r,i){var s=new a.Class;return s.initialize(n,"update_featurelist"),s.addArgument("featurelist",r+".cpaddons"),t.each(i,(function(e){s.addArgument(e.name,e.value)})),this.deferred(s,{},e),e.promise}var d=function(){};return d.prototype=new s,e.extend(d.prototype,{loadFeatureLists:function(){var e=r.defer();return c.call(this,e)},load:function(e,r){var i=new a.Class;return i.initialize(n,"get_featurelist_data"),i.addArgument("featurelist",e),this.deferred(i,{apiSuccess:function(a,i){a.items=[];var s,n,u,c,l=["bbs","chat","cpanelpro_support","searchsubmit","advguest","guest","cgi","scgiwrap","counter","entropybanner","entropysearch","clock","countdown","randhtml","videotut","getstart"],d=!1,f=!1;t.each(a.data.features,(function(i){if(s=!1,t.includes(l,i.id)){if(!o.legacySupport)return;s=!0}("fantastico"!==i.id||o.fantasticoSupport)&&(u=i.id,n=i.id,i.id in r&&(n=r[i.id].name,d="1"===r[i.id].is_plugin,f="1"===r[i.id].is_cpaddon),c=!1,"disabled"===e?"0"===i.value&&(c=!0):c="1"===i.value,a.items.push({name:u,label:n,value:c,legacy:s,disabled:"1"===i.is_disabled,plugin:d,addon:f}))}),a.data.features),a.items=t.sortBy(a.items,(function(e){return e.label.toLowerCase()})),i.resolve(a)}}).promise},save:function(r,i){var s=new a.Class;s.initialize(n,"update_featurelist"),s.addArgument("featurelist",r);var o=[],u=e.copy(i);t.each(u,(function(e){e.value="disabled"===r?!0===e.value?"0":"1":!0===e.value?"1":"0",e.addon?o.push(e):s.addArgument(e.name,e.value)}));var c=this.deferred(s,{context:this,apiSuccess:function(){l.call(this,c,r,o)}},c);return c.promise},add:function(e){var t=new a.Class;t.initialize(n,"create_featurelist"),t.addArgument("featurelist",e);var r=this.deferred(t,{context:this,apiSuccess:function(e){r.resolve(e)}},r);return r.promise},remove:function(e){var t=new a.Class;t.initialize(n,"delete_featurelist"),t.addArgument("featurelist",e);var r=this.deferred(t,{context:this,apiSuccess:function(){r.notify(),c.call(this,r)}},r);return r.promise},prepareList:function(e){return u(e=i.parse_response(e).parsedResponse)}}),new d}])})),define("app/views/featureListController",["angular","lodash","cjt/util/locale","uiBootstrap","cjt/directives/autoFocus","cjt/filters/wrapFilter","cjt/filters/splitFilter","cjt/filters/htmlFilter","cjt/directives/spinnerDirective","cjt/directives/actionButtonDirective","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/services/alertService","app/services/featureListService","cjt/io/whm-v1-querystring-service"],(function(e,t,r){"use strict";var a=e.module("App");return a.controller("featureListController",["$scope","$location","$anchorScroll","$timeout","featureListService","alertService",function(e,i,s,n,o,u){e.loadingPageData=!0,e.loadingView=!1,e.onlyReseller=!PAGE.hasRoot,e.hasMailOnlyList=PAGE.hasMailOnlyList,e.isEditable=function(e){return void 0!==e&&""!==e},e.isDeletable=function(t){return void 0!==t&&(e.isEditable(t)&&!e.isSystemList(t))},e.isSystemList=function(e){return void 0!==e&&("default"===e||"disabled"===e||"Mail Only"===e)},e.add=function(t){if(e.formAddFeature.$valid){if(!PAGE.hasRoot){var r=new RegExp("^"+PAGE.remoteUser+"_\\w+","i");-1===t.search(r)&&(t=PAGE.remoteUser+"_"+t)}return o.add(t).then((function(){e.loadingView=!0,e.loadView("editFeatureList",{name:t})}),(function(e){u.add({type:"danger",message:e,id:"errorAddingingFeatureList"})}))}var a=e.formAddFeature.txtNewFeatureList.$viewValue;e.formAddFeature.txtNewFeatureList.$setViewValue(a)},e.delete=function(a){return o.remove(a).then((function(t){e.featureLists=t.items,e.selectedFeatureList=e.featureLists[0]}),(function(e){u.add({type:"danger",message:e,id:"errorDeletingFeatureList"})}),(function(){u.add({type:"success",message:r.maketext("You successfully deleted the “[_1]” feature list.",t.escape(a)),id:"alertDeleteSuccess"})}))},e.fetch=function(){return e.loadingPageData=!0,u.removeById("errorFetchFeatureLists"),o.loadFeatureLists().then((function(t){e.featureLists=t.items,e.selectedFeatureList=e.featureLists[0]}),(function(e){throw u.add({type:"danger",message:e,id:"errorFetchFeatureLists"}),e})).finally((function(){e.loadingPageData=!1}))},e.$on("$viewContentLoaded",(function(){if(a.firstLoad.featureList&&PAGE.featureLists){a.firstLoad.featureList=!1,e.loadingPageData=!1;var t=o.prepareList(PAGE.featureLists);e.featureLists=t.items,e.selectedFeatureList=e.featureLists[0],t.status||(e.loadingPageData="error",u.add({type:"danger",message:r.maketext("There was a problem loading the page. The system is reporting the following error: [_1].",PAGE.featureLists.metadata.reason),id:"errorFetchFeatureLists"}))}else e.fetch()}))}])})),define("app/views/editFeatureListController",["angular","lodash","jquery","cjt/util/locale","uiBootstrap","cjt/directives/searchDirective","cjt/directives/spinnerDirective","cjt/services/alertService","app/services/featureListService"],(function(e,t,r,a){return e.module("App").controller("editFeatureListController",["$scope","$location","$anchorScroll","$routeParams","spinnerAPI","alertService","featureListService","$sce","PAGE",function(e,r,i,s,n,o,u,c,l){e.featureListName=s.name,e.featureListHeading=a.maketext("Select all features for: [_1]",e.featureListName),e.toggleAllFeatures=function(){var r=!e.allFeaturesChecked();t.each(e.featureList,(function(e){e.disabled||(e.value=r)}))},e.allFeaturesChecked=function(){if(e.loadingPageData||!e.featureList)return!1;for(var t,r=0,a=e.featureList.length;r<a;r++)if(!1===(t=e.featureList[r]).value&&!t.disabled)return!1;return!0},e.save=function(r){return u.save(e.featureListName,r).then((function(){o.add({type:"success",message:a.maketext("You have successfully updated the “[_1]” feature list.",t.escape(e.featureListName)),id:"alertSaveSuccess",replace:!0}),e.loadView("featureList")}),(function(e){o.add({type:"danger",message:e,id:"errorSaveFeatureList"})}))},e.fetch=function(){return e.loadingPageData=!0,n.start("featureListSpinner"),o.removeById("errorFetchFeatureList"),u.load(e.featureListName,e.featureDescriptions).then((function(t){e.featureList=t.items,e.loadingPageData=!1}),(function(e){throw o.add({type:"danger",message:e,id:"errorFetchFeatureList"}),e})).finally((function(){e.loadingPageData=!1,n.stop("featureListSpinner")}))},e.$on("$viewContentLoaded",(function(){o.clear();var r=u.prepareList(l.featureDescriptions);e.featureDescriptions=t.fromPairs(t.zip(t.map(r.items,"id"),r.items)),r.status?e.fetch():(e.loadingPageData="error",o.add({type:"danger",message:a.maketext("There was a problem loading the page. The system is reporting the following error: [_1].",l.featureDescriptions.metadata.reason),id:"errorFetchFeatureDescriptions"}))}))}])})),define("app/manager",["angular","jquery","lodash","cjt/core","cjt/modules","ngRoute","uiBootstrap"],(function(e,t,r,a){return function(){return e.module("App",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","cjt2.whm"]),require(["cjt/bootstrap","cjt/util/locale","cjt/views/applicationController","cjt/filters/breakFilter","app/views/commonController","app/views/featureListController","app/views/editFeatureListController","cjt/services/whm/breadcrumbService"],(function(t,r){var i=e.module("App");i.value("PAGE",PAGE),i.firstLoad={featureList:!0},i.config(["$routeProvider",function(e){e.when("/featureList",{controller:"featureListController",templateUrl:a.buildFullPath("feature/views/featureListView.ptt"),breadcrumb:r.maketext("Feature Lists"),reloadOnSearch:!1}),e.when("/editFeatureList",{controller:"editFeatureListController",templateUrl:a.buildFullPath("feature/views/editFeatureListView.ptt"),breadcrumb:r.maketext("Edit Feature List"),reloadOnSearch:!1}),e.otherwise({redirectTo:function(e,t,r){return"/featureList?"+window.location.search}})}]),i.run(["breadcrumbService",function(e){e.initialize()}]),t(document)}))}}));
Back to Directory File Manager