File manager - Edit - /usr/local/cpanel/whostmgr/docroot/templates/mod_security/views/massEditRuleController.min.js
Back
define(["angular","lodash","cjt/util/locale","jquery","cjt/jquery/plugins/rangeSelection","uiBootstrap","cjt/directives/autoFocus","cjt/directives/spinnerDirective","cjt/services/alertService","app/services/ruleService"],(function(angular,_,LOCALE){"use strict";var app=angular.module("App");var controller=app.controller("massEditRuleController",["$scope","$location","$anchorScroll","$routeParams","$q","$timeout","ruleService","alertService","spinnerAPI","PAGE",function($scope,$location,$anchorScroll,$routeParams,$q,$timeout,ruleService,alertService,spinnerAPI,PAGE){var ANIMATION_INTER_STEP_DELAY=500;$scope.disableSave=function(form){return $scope.cantEdit||form.txtRules.$pristine||form.$dirty&&form.$invalid};$scope.clearForm=function(){$scope.enabled=true;$scope.rules="";$scope.deploy=false;$scope.clearNotices();$scope.cantEdit=false};$scope.clearNotices=function(){alertService.clear();$scope.notice=""};$scope.cancel=function(){$scope.clearNotices();$scope.loadView("rulesList")};$scope.save=function(form){$scope.clearNotices();if(!form.$valid){return}spinnerAPI.start("loadingSpinner");$scope.progress=0;$scope.cantEdit=true;return ruleService.setCustomConfigText($scope.rules,$scope.deploy).then((function(){spinnerAPI.stop("loadingSpinner");$timeout((function(){$scope.progress=100;$timeout((function(){if($scope.deploy){alertService.add({type:"success",message:LOCALE.maketext("You have successfully saved and deployed your [asis,ModSecurity™] rules."),id:"alertSaveSuccess"})}else{alertService.add({type:"success",message:LOCALE.maketext("You have successfully saved your [asis,ModSecurity™] rules."),id:"alertSaveSuccess"})}$timeout((function(){$scope.loadView("rulesList");$scope.showProgress=false}),2*ANIMATION_INTER_STEP_DELAY)}),2*ANIMATION_INTER_STEP_DELAY)}),2*ANIMATION_INTER_STEP_DELAY)}),(function(error){spinnerAPI.stop("loadingSpinner");$scope.cantEdit=false;if(error){alertService.add({type:"danger",message:_.escape(error),id:"errorFetchRules"})}$timeout((function(){$scope.scrollTo("top");document.getElementById("txtRules").focus()}),2*ANIMATION_INTER_STEP_DELAY)}),(function(data){switch(data.type){case"post":if(data.totalPages>2){$scope.showProgress=true}$scope.progress=Math.floor(data.page/data.totalPages*100);break;case"error":alertService.add({type:"danger",message:_.escape(data.error),id:"errorSaveRules"});break}}))};var fetchRules=function(){spinnerAPI.start("loadingSpinner");$scope.progress=0;$scope.cantEdit=true;return ruleService.getCustomConfigText().then(angular.noop,(function(error){if(error){alertService.add({type:"danger",message:_.escape(error),id:"errorFetchRules"})}}),(function(data){switch(data.type){case"page":if(data.totalPages>2){$scope.showProgress=true}if(data.text){$scope.progress=Math.floor(data.page/data.totalPages*100);$scope.rules+=data.text.join("")}break;case"error":alertService.add({type:"danger",message:_.escape(data.error),id:"errorFetchRules"});break}})).finally((function(){spinnerAPI.stop("loadingSpinner");$timeout((function(){$scope.progress=100;$timeout((function(){$scope.cantEdit=false;$scope.showProgress=false;$timeout((function(){$scope.progress=0;angular.element(document.querySelector("#txtRules")).selectRange(0)}),ANIMATION_INTER_STEP_DELAY)}),ANIMATION_INTER_STEP_DELAY)}),ANIMATION_INTER_STEP_DELAY)}))};$scope.isInstalled=PAGE.installed;if(!$scope.isInstalled){$scope.loadView("hitList")}$scope.showProgress=false;$scope.cantEdit=true;$scope.clearForm();fetchRules()}]);return controller}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings