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

define("app/services/countriesService",["angular","lodash","cjt/io/whm-v1-request","cjt/modules","cjt/io/api","cjt/io/whm-v1","cjt/services/APICatcher"],(function(e,t,r){"use strict";var n="whm.eximBlockCountries.services.countries",o="eximBlockCountries",i=["APICatcher","$q"],c=function(e,n){var o=function(){};return o.prototype=Object.create(e),t.assign(o.prototype,{_apiCall:function(e,t,n){var o=new r.Class;return o.initialize(e,t,n),o},listBlockedIncomingEmailCountries:function(){if(t.isArray(PAGE.blocked_incoming_email_countries))return n.resolve(PAGE.blocked_incoming_email_countries);var e=this._apiCall("","list_blocked_incoming_email_countries");return this._promise(e).then((function(e){return e&&e.data||[]}))},getCountriesWithKnownIPRanges:function(){if(t.isArray(PAGE.countries_with_known_ip_ranges))return n.resolve(PAGE.countries_with_known_ip_ranges);var e=this._apiCall("","get_countries_with_known_ip_ranges");return this._promise(e).then((function(e){return e&&e.data||[]}))},_verifyCountryCodesArray:function(e){if(!t.isArray(e))throw"countryCodes must be an array";var r=t.findIndex(e,(function(e){return"string"!=typeof e}));if(-1!==r){var n="";throw n+="countryCodes must be an array of country code strings. ",n+="“"+r+"” is not a string ("+typeof e[r]+")"}return!0},blockIncomingEmailFromCountries:function(e){this._verifyCountryCodesArray(e);var t=this._apiCall("","block_incoming_email_from_country",{country_code:e});return this._promise(t)},unblockIncomingEmailFromCountries:function(e){this._verifyCountryCodesArray(e);var t=this._apiCall("","unblock_incoming_email_from_country",{country_code:e});return this._promise(t)},_promise:function(){return e.promise.apply(this,arguments)}}),new o};return i.push(c),e.module(n,["cjt2.services.apicatcher"]).factory(o,i),{class:c,serviceName:o,namespace:n}})),define("app/directives/countryCodesTableDirective",["angular","lodash","cjt/util/locale","app/services/countriesService","uiBootstrap","cjt/modules","cjt/directives/toggleSortDirective","cjt/directives/spinnerDirective","cjt/directives/searchDirective","cjt/directives/pageSizeDirective","cjt/filters/startFromFilter","cjt/decorators/paginationDecorator","cjt/directives/quickFiltersDirective","cjt/directives/toggleSwitchDirective"],(function(e,t,r,n){"use strict";var o="directives/countryCodesTable.ptt",i="whm.eximBlockCountries.directives.countryCodesTable",c=["cjt2.services.alert","cjt2.directives.spinner",n.namespace],l=["$scope","$filter",n.serviceName,"alertService"],s=function(e,n,o,i){var c={filter:n("filter"),orderBy:n("orderBy")},l={},s=e.items?e.items:[];s.forEach((function(e){l[e.code]=e,e.searchableCode="("+e.code+")"})),t.assign(e,{filteredList:e.items,selectedAllowed:[],selectedBlocked:[],selectedItems:[],items:s,loading:!1,meta:{filterValue:"",sortBy:"name",sortDirection:"asc",quickFilterValue:"all"},toggleSelect:function(t,r){var n=r.indexOf(t);n>-1?r.splice(n,1):r.push(t),e.updateSelectedBlocked()},updateSelectedBlocked:function(){var t=[],r=[];e.selectedItems.forEach((function(e){l[e].allowed?t.push(e):r.push(e)})),e.selectedBlocked=r,e.selectedAllowed=t},toggleSelectAll:function(){e.allAreSelected()?e.deselectAll():e.selectAll()},selectAll:function(){e.selectedItems=e.filteredList.map((function(e){return e.code})),e.updateSelectedBlocked()},deselectAll:function(){e.selectedItems=[],e.updateSelectedBlocked()},allAreSelected:function(){return e.selectedItems.length&&e.selectedItems.length===e.filteredList.length},exists:function(e,t){return t.indexOf(e)>-1},getCountriesFromCodes:function(e){return e.map((function(e){return l[e]}))},_showBlockSuccessMessage:function(e){var t,n=this.getCountriesFromCodes(e).map((function(e){return e.name}));if(n.length>10){var o=n.slice(0,10),c=r.translatable("Your server will now block messages that originate in “[_1]”, “[_2]”, “[_3]”, “[_4]”, “[_5]”, “[_6]”, “[_7]”, “[_8]”, “[_9]”, “[_10]”, and [quant,_11,other country,other countries].");t=r.makevar.apply(r,[c].concat(o,n.length-o.length))}else t=r.maketext("Your server will now block messages that originate in [list_or_quoted,_1].",n);i.success(t)},_showUnblockSuccessMessage:function(e){var t,n=this.getCountriesFromCodes(e).map((function(e){return e.name}));if(n.length>10){var o=n.slice(0,10),c=r.translatable("Your server will no longer block messages that originate in “[_1]”, “[_2]”, “[_3]”, “[_4]”, “[_5]”, “[_6]”, “[_7]”, “[_8]”, “[_9]”, “[_10]”, and [quant,_11,other country,other countries].");t=r.makevar.apply(r,[c].concat(o,n.length-o.length))}else t=r.maketext("Your server will no longer block messages that originate in [list_or_quoted,_1].",n);i.success(t)},blockCountries:function(t){var r=t.filter((function(e){return l[e].allowed})),n=e.getCountriesFromCodes(r);return o.blockIncomingEmailFromCountries(r).then(e._showBlockSuccessMessage.bind(e,r)).then((function(){n.forEach((function(e){e.allowed=!1}))})).finally(e.deselectAll).finally(e.fetch)},unblockCountries:function(t){var r=t.filter((function(e){return!l[e].allowed})),n=e.getCountriesFromCodes(r);return o.unblockIncomingEmailFromCountries(r).then(e._showUnblockSuccessMessage.bind(e,r)).then((function(){n.forEach((function(e){e.allowed=!0}))})).finally(e.deselectAll).finally(e.fetch)},getToggleSelectTitle:function(e){return this.exists(e.code,this.selectedItems)?r.maketext("Click to deselect “[_1]”.",e.name):r.maketext("Click to select “[_1]”.",e.name)},getSelectAllToggleTitle:function(){return this.allAreSelected()?r.maketext("Click to deselect all countries."):r.maketext("Click to select all countries.")},toggleBlocked:function(t){return t.allowed?o.blockIncomingEmailFromCountries([t.code]).then(e._showBlockSuccessMessage.bind(e,[t.code])).then((function(){t.allowed=!1})).finally(e.deselectAll).finally(e.fetch):o.unblockIncomingEmailFromCountries([t.code]).then(e._showUnblockSuccessMessage.bind(e,[t.code])).then((function(){t.allowed=!0})).finally(e.deselectAll).finally(e.fetch)},getAriaLabel:function(e,t){return t?r.maketext("Block email from “[_1]”.",e):r.maketext("Allow email from “[_1]”.",e)},getTitleLabel:function(e,t){return t?r.maketext("Your server currently accepts messages that originate from servers in [_1].",e):r.maketext("Your server currently blocks messages that originate from servers in [_1].",e)},fetch:function(){var t=[];return t=""!==e.meta.filterValue?c.filter(e.items,e.meta.filterValue,!1):e.items,"all"!==e.meta.quickFilterValue&&(t=c.filter(t,{allowed:e.meta.quickFilterValue},!1)),""!==e.meta.sortDirection&&""!==e.meta.sortBy&&(t=c.orderBy(t,e.meta.sortBy,"asc"!==e.meta.sortDirection)),e.meta.totalItems=t.length,e.filteredList=t,t}}),e.fetch()};return e.module(i,c).directive("countryCodesTable",(function(){return{templateUrl:o,restrict:"EA",scope:{items:"=",onChange:"&onChange"},replace:!0,controller:l.concat(s)}})),{class:s,namespace:i,template:o}})),define("app/views/countriesController",["angular","lodash","cjt/core","app/services/countriesService","app/directives/countryCodesTableDirective"],(function(e,t,r,n,o){"use strict";var i="whm.eximBlockCountries.views.countries",c=[n.namespace,o.namespace],l="COUNTRY_CODES",s="BLOCKED_COUNTRIES",a="CountriesController",u=["$scope",l,s],m=function(e,r,n){var o={},i=r;if(!t.isArray(r))throw"COUNTRY_CODES is not an array";if(!t.isArray(n))throw"BLOCKED_COUNTRIES is not an array";i.forEach((function(e){o[e.code]=e,e.allowed=!0})),n.forEach((function(e){var t=e.country_code;o[t]&&(o[t].allowed=!1)})),e.countries=i};e.module(i,c).controller(a,u.concat(m));var d={};return d[l]=[n.serviceName,function(e){return e.getCountriesWithKnownIPRanges()}],d[s]=[n.serviceName,function(e){return e.listBlockedIncomingEmailCountries()}],{path:"/",controller:a,class:m,template:"views/countries.phtml",namespace:i,resolver:d}})),define("app/index",["angular","jquery","lodash","app/views/countriesController","cjt/modules","cjt/directives/alertList","ngRoute","uiBootstrap","ngSanitize","ngAnimate"],(function(e,t,r,n){"use strict";return function(){var t="whm.eximBlockCountries",r=e.module(t,["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","ngSanitize","ngAnimate","cjt2.whm",n.namespace]);return require(["cjt/bootstrap"],(function(e){r.value("PAGE",PAGE),r.controller("BaseController",["$rootScope","$scope",function(e,t){t.loading=!1,e.$on("$routeChangeStart",(function(){t.loading=!0})),e.$on("$routeChangeSuccess",(function(){t.loading=!1})),e.$on("$routeChangeError",(function(){t.loading=!1}))}]),r.config(["$routeProvider","$animateProvider",function(e,t){t.classNameFilter(/^((?!no-animate).)*$/),e.when(n.path,{controller:n.controller,templateUrl:n.template,resolve:n.resolver}),e.otherwise({redirectTo:n.path})}]),e("#content",t)}))}}));
Back to Directory File Manager