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

define("app/services/configService",["angular","cjt/io/api","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/util/locale","cjt/services/APIService"],(function(e,t,i,n,o){"use strict";function s(e){var t=[];if(e.status){for(var i=e.data,n=0,o=i.length;n<o;n++){var s=i[n];t.push(s)}var r=e.meta;return{items:t,totalItems:r.paginate.total_records||i.length,totalPages:r.paginate.total_pages||1}}return{items:[],totalItems:0,totalPages:0}}e.module("whm.multiPhpIniEditor.configService",[]).factory("configService",["$q",function(e){return{fetchBasicList:function(n){var o=e.defer(),r=new i.Class;return r.initialize("","php_ini_get_directives"),r.addArgument("version",n),t.promise(r.getRunArguments()).done((function(e){if((e=e.parsedResponse).status){var t=s(e);o.resolve(t)}else o.reject(e.error)})),o.promise},applySettings:function(n,o){var r=e.defer(),a=new i.Class;return a.initialize("","php_ini_set_directives"),a.addArgument("version",n),void 0!==o&&o.length>0&&o.forEach((function(e,t){a.addArgument("directive-"+t,e.key+":"+e.value)})),t.promise(a.getRunArguments()).done((function(e){if((e=e.parsedResponse).status){var t=s(e);r.resolve(t)}else r.reject(e.error)})),r.promise},fetchContent:function(n){var o=e.defer(),s=new i.Class;return s.initialize("","php_ini_get_content"),s.addArgument("version",n),t.promise(s.getRunArguments()).done((function(e){(e=e.parsedResponse).status?o.resolve(e.data.content):o.reject(e.error)})),o.promise},saveIniContent:function(n,o){var r=e.defer(),a=new i.Class;return a.initialize("","php_ini_set_content"),a.addArgument("version",n),a.addArgument("content",o),t.promise(a.getRunArguments()).done((function(e){if((e=e.parsedResponse).status){var t=s(e);r.resolve(t)}else r.reject(e.error)})),r.promise},prepareList:function(e){return s(e=n.parse_response(e).parsedResponse)},validateBasicDirective:function(e,t){var i=t||"",n=!0,s="";if("integer"===e){var r="[~!]?\\s*E_(?:(?:(?:CORE_|COMPILE_|USER_)?(?:ERROR|WARNING))|(?:USER_)?(?:NOTICE|DEPRECATED)|PARSE|STRICT|RECOVERABLE_ERROR|ALL)",a=new RegExp("^\\s*"+r+"(?:\\s*[&|^]\\s*"+r+")*$");/^-?\d+[kmg]?$/i.test(i)||a.test(i)?n=!0:(n=!1,s=o.maketext("You must provide either an integer value, a [output,url,_1,shorthand byte,target,blank,title,shorthand byte documentation], or a [output,url,_2,predefined constant,target,blank,title,predefined constant documentation].","http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes","http://php.net/manual/en/errorfunc.constants.php"))}else"float"===e&&(/^-?\d+(?:\.\d*)?$/.test(i)?n=!0:(n=!1,s=o.maketext("You must provide a valid float value.")));return{valid:n,valMsg:s}}}}])})),define("app/views/basicMode",["angular","lodash","cjt/util/locale","uiBootstrap","cjt/directives/alertList","cjt/directives/spinnerDirective","cjt/services/alertService","cjt/decorators/growlDecorator","app/services/configService"],(function(e,t,i){return e.module("App").controller("basicMode",["$scope","$location","$routeParams","$timeout","spinnerAPI","alertService","growl","growlMessages","configService","PAGE",function(t,n,o,s,r,a,c,l,u,d){var p,v=!1;t.selectedVersion="",t.localeIsRTL=!1,t.loadingDirectiveList=!1,t.showEmptyMessage=!1,t.phpVersionsEmpty=!0,t.txtInFirstOption=i.maketext("[comment,used for highlight in select option]-- Not Available --[comment,used for highlight in select option]"),t.knobLabel=" ";t.loadDirectives=function(){if(t.selectedVersion){l.destroyAllMessages(),r.start("loadingSpinner");var e=t.selectedVersion;return t.loadingDirectiveList=!0,v=!1,u.fetchBasicList(e).then((function(e){void 0!==e.items&&e.items.length>0&&(t.directiveList=e.items.map((function(e){e.toggleValue="On"===e.value;var t=e.default_value;return void 0!==e.cpanel_default&&null!==e.cpanel_default&&(t=e.cpanel_default),"boolean"===e.type&&(t="1"===e.default_value?i.maketext("Enabled"):i.maketext("Disabled")),e.defaultText=i.maketext("[asis,PHP] Default: [output,class,_1,defaultValue]",t),e})))}),(function(e){c.error(e),t.showEmptyMessage=!0})).then((function(){t.loadingDirectiveList=!1,r.stop("loadingSpinner")})).finally((function(){r.stop("loadingSpinner"),t.showEmptyMessage=""!==t.selectedVersion&&t.directiveList.length<=0}))}t.directiveList=[],t.showEmptyMessage=!1};var g=function(){v||(v=!0,c.info(i.maketext("You must click “[_1]” to apply the new changes.",i.maketext("Apply")),{onopen:function(){p=this}}))};t.toggle_status=function(e){"On"===e.value?(e.value="Off",e.toggleValue=!1):(e.value="On",e.toggleValue=!0),g()},t.directiveTextChange=function(e){g();var i=u.validateBasicDirective(e.type,e.value);t.basicModeForm["txt"+e.key].$setValidity("pattern",i.valid),e.validationMsg=i.valMsg},t.disableApply=function(){return t.phpVersionsEmpty||!t.selectedVersion||!t.basicModeForm.$valid},t.requiredValidation=function(e){return"string"!==e.type&&"boolean"!==e.type},t.applyPhpSettings=function(){if(t.basicModeForm.$valid)return l.destroyAllMessages(),v=!1,void 0!==p&&p.destroy(),u.applySettings(t.selectedVersion,t.directiveList).then((function(e){void 0!==e&&c.success(i.maketext("Successfully applied the settings to [asis,PHP] version “[_1]”.",t.selectedVersion))}),(function(e){c.error(e)}))};t.$on("$viewContentLoaded",(function(){l.destroyAllMessages(),t.localeIsRTL=!!d.locale_is_RTL;var n=d.php_versions,o=[];n.metadata.result?o=e.copy(n.data.versions):c.error(n.metadata.reason),function(e){void 0!==e&&(t.phpVersions=e),t.phpVersions.length>0?(t.phpVersionsEmpty=!1,t.txtInFirstOption=i.maketext("[comment,used for highlight in select option]-- Select a [asis,PHP] version --[comment,used for highlight in select option]")):t.phpVersionsEmpty=!0}(o)}))}])})),define("app/views/editorMode",["angular","lodash","jquery","cjt/util/locale","ace","uiBootstrap","cjt/directives/alertList","cjt/services/alertService","cjt/decorators/growlDecorator","app/services/configService"],(function(e,t,i,n){"use strict";return e.module("App").controller("editorMode",["$scope","$location","$routeParams","$timeout","spinnerAPI","alertService","growl","growlMessages","configService","PAGE",function(o,s,r,a,c,l,u,d,p,v){var g,f,m=!1;o.processingEditor=!1,o.showEmptyMessage=!1,o.contentIsEmpty=!0,o.txtInFirstOption=n.maketext("[comment,used for highlight in select option]-- Not Available --[comment,used for highlight in select option]"),o.loadContent=function(){if(o.selectedVersion){d.destroyAllMessages(),c.start("loadingSpinner");var e=o.selectedVersion;return m=!1,h(!0),p.fetchContent(e).then((function(e){if(""!==e){o.contentIsEmpty=!1;var t=i("<div/>").html(e).text();void 0===f&&((f=ace.edit("editor")).$blockScrolling=1/0,f.setShowPrintMargin(!1)),f.focus(),f.scrollToRow(0),f.setTheme("ace/theme/chrome");var n=ace.createEditSession(t);f.setSession(n),void 0!==n&&(n.setMode("ace/mode/ini"),f.on("change",o.informUser))}else o.contentIsEmpty=!0}),(function(e){l.add({type:"danger",message:e,id:"errorFetchDirectiveList"})})).then((function(){h(!1)})).finally((function(){c.stop("loadingSpinner"),o.showEmptyMessage=!o.processingEditor&&""!==o.selectedVersion&&o.contentIsEmpty}))}y()},o.informUser=function(){m||(m=!0,u.info(n.maketext("You must click “[_1]” to apply the new changes.",n.maketext("Save")),{onopen:function(){g=this}}))},o.save=function(){d.destroyAllMessages(),m=!1,void 0!==g&&g.destroy(),h(!0);var e=t.escape(f.getSession().getValue());return p.saveIniContent(o.selectedVersion,e).then((function(e){void 0!==e&&u.success(n.maketext("Successfully saved the changes."))}),(function(e){u.error(t.escape(e))})).then((function(){h(!1)}))};var h=function(e){void 0!==f&&f.setReadOnly(e),o.processingEditor=e},y=function(){o.showEmptyMessage=!1,o.contentIsEmpty=!0};o.$on("$viewContentLoaded",(function(){d.destroyAllMessages();var t=v.php_versions,i=[];t.metadata.result?i=e.copy(t.data.versions):u.error(t.metadata.reason),function(e){void 0!==e&&(o.phpVersions=e),o.phpVersions.length>0?(o.phpVersionsEmpty=!1,o.txtInFirstOption=n.maketext("[comment,used for highlight in select option]-- Select a [asis,PHP] version --[comment,used for highlight in select option]")):o.phpVersionsEmpty=!0}(i)}))}])})),define("app/index",["angular","jquery","lodash","cjt/core","cjt/modules","ngRoute","uiBootstrap","ngAnimate"],(function(e,t,i,n){return function(){return e.module("App",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","ngAnimate","angular-growl","cjt2.whm","whm.multiPhpIniEditor.configService"]),require(["cjt/bootstrap","app/views/basicMode","app/views/editorMode","cjt/directives/actionButtonDirective"],(function(t){var i=e.module("App");i.value("PAGE",PAGE),i.config(["$routeProvider",function(e){e.when("/basic",{controller:"basicMode",templateUrl:n.buildFullPath("multiphp_ini_editor/views/basicMode.ptt"),reloadOnSearch:!1}),e.when("/editor",{controller:"editorMode",templateUrl:n.buildFullPath("multiphp_ini_editor/views/editorMode.ptt"),reloadOnSearch:!1}),e.otherwise({redirectTo:"/basic"})}]),i.run(["$rootScope","$location","growlMessages",function(e,t,i){e.$on("$routeChangeStart",(function(){e.currentRoute=t.path(),i.destroyAllMessages()}))}]),t(document)}))}}));
Back to Directory File Manager