| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- //replace url wrapper
- var mgUrlParser = {
- oldMgUrlParser: mgUrlParser,
- getCurrentUrl: function(){
- var url = this.oldMgUrlParser.getCurrentUrl();
- return url.replace("action=edit", "action=module-settings").replace("&success=true", "");
- }
- };
- function redirectToPage(tabNumber)
- {
- var windowAddress = String(window.location);
- var hashTab = windowAddress.indexOf('#tab=');
- var andTab = windowAddress.indexOf('&tab=');
- if (hashTab > 0 && andTab > 0) {
- var count = Math.min(hashTab, andTab);
- } else {
- var count = Math.max(hashTab, andTab);
- }
- var redirectTo = (count > 0) ? windowAddress.substring(0, count) : windowAddress;
- window.location = redirectTo + '&tab=' + tabNumber;
- }
- function redirectToConfigurableOptionsTab()
- {
- redirectToPage(5);
- }
- function redirectToCustomFieldsTab()
- {
- redirectToPage(4);
- }
- function productConfigurationSelect(event)
- {
- productConfigurationSettings(event, event.target.value);
- }
- function productConfigurationSettings(event, packageName)
- {
- // const formFields = $(event.target).parents().find('.lu-form-group , .lu-form-check');
- // const protectedFields = ['mgpci[package]','mgpci[dedicated_ip]','mgpci[reseller_ip]','mgpci[suspend_at_limit]'];
- // formFields.each(function(key, item){
- // let name = $(item).find('input')[0].name;
- // if (!name)
- // {
- // name = $(item).find('select')[0].name;
- // }
- // if (protectedFields.indexOf(name) === -1)
- // {
- // if (packageName === 'custom'){
- // $(item).show();
- // }
- // else{
- // $(item).hide();
- // }
- // }
- // });
- }
- function hiddeSections(event)
- {
- /**
- * all sections name
- * @type {string[]}
- */
- var sections = [
- 'calendarFeatures',
- 'classOfServiceFeatures',
- 'contactFeatures',
- 'essentialFeatures',
- 'generalFeatures',
- 'mailServiceFeatures',
- 'mimeFeatures',
- 'searchFeatures',
- ];
- var availableSections = [];
- /**
- * set which section should be displayed
- */
- if(event.target.value == 'customMGzimbra')
- {
- availableSections = [
- 'calendarFeatures',
- 'contactFeatures',
- 'essentialFeatures',
- 'generalFeatures',
- 'mailServiceFeatures',
- 'mimeFeatures',
- 'searchFeatures',
- ];
- }else if(event.target.value == 'zimbraConfigurableOptions'){
- availableSections = [];
- }else if(event.target.value == 'cosQuota'){
- availableSections = [
- 'classOfServiceFeatures'
- ];
- }
- /**
- * hide or show sections
- */
- hideSecction(sections, availableSections);
- }
- /**
- * hide or display section
- * @param sections
- * @param availableSections
- */
- function hideSecction(sections, availableSections)
- {
- sections.forEach(function(entry, key, each){
- if(availableSections.includes(entry) === true)
- {
- document.getElementById(entry).style.display="";
- }else{
- document.getElementById(entry).style.display="none";
- }
- })
- }
- $(document).ready(function(){
- })
- $('#ProductConfigurationPage').ready(function()
- {
- /**
- * trigg change select
- */
- $("[name=cos_name]").trigger("change");
- // var packageName = $('select[name="mgpci[package]"]').val()
- //
- // if(packageName !== "custom")
- // {
- //
- // var protectedArrayFields = ['mgpci[package]','mgpci[dedicated_ip]','mgpci[reseller_ip]','mgpci[suspend_at_limit]'];
- // var fields = $('#layers').find('.lu-form-group , .lu-form-check')
- //
- // fields.each(function(){
- // var fieldName = $(this).find('input').attr('name')
- //
- // if(typeof fieldName === "undefined"){
- // fieldName = $(this).find('select').attr('name')
- // }
- // if (protectedArrayFields.indexOf(fieldName) === -1)
- // {
- // $(this).hide();
- // }
- // })
- //
- //
- // }
- })
|