[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_modules/js/ -> admin-module-edit-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license     GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8    Joomla = window.Joomla || {};
   9  
  10    (function (Joomla) {
  11      Joomla.submitbutton = function (task) {
  12        if (task === 'module.cancel' || document.formvalidator.isValid(document.getElementById('module-form'))) {
  13          Joomla.submitform(task, document.getElementById('module-form'));
  14          var options = Joomla.getOptions('module-edit');
  15  
  16          if (window.self !== window.top) {
  17            if (window.parent.viewLevels) {
  18              var updPosition = document.getElementById('jform_position').value;
  19              var updTitle = document.getElementById('jform_title').value;
  20              var updMenus = document.querySelector('#jform_assignment').value;
  21              var updStatus = document.querySelector('#jform_published').value;
  22              var updAccess = document.querySelector('#jform_access').value;
  23              var tmpMenu = window.parent.document.getElementById("menus-" + options.itemId);
  24              var tmpRow = window.parent.document.getElementById("tr-" + options.itemId);
  25              var tmpStatus = window.parent.document.getElementById("status-" + options.itemId);
  26              window.parent.inMenus = [];
  27              window.parent.numMenus = [].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).length;
  28              [].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).forEach(function (element) {
  29                if (updMenus > 0) {
  30                  if (element.checked) {
  31                    window.parent.inMenus.push(parseInt(element.value, 10));
  32                  }
  33                }
  34  
  35                if (updMenus < 0) {
  36                  if (!element.checked) {
  37                    window.parent.inMenus.push(parseInt(element.value, 10));
  38                  }
  39                }
  40              });
  41  
  42              if (updMenus === '-') {
  43                tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-danger\">" + Joomla.Text._('JNO') + "</span>");
  44  
  45                if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
  46                  tmpRow.classList.add('no');
  47                }
  48              }
  49  
  50              if (parseInt(updMenus, 10) === 0) {
  51                tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-info\">" + Joomla.Text._('JALL') + "</span>");
  52  
  53                if (tmpRow.classList.contains('no')) {
  54                  tmpRow.classList.remove('no');
  55                }
  56              }
  57  
  58              if (parseInt(updMenus, 10) > 0) {
  59                if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
  60                  if (window.parent.numMenus === window.parent.inMenus.length) {
  61                    tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-info\">" + Joomla.Text._('JALL') + "</span>");
  62  
  63                    if (tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
  64                      tmpRow.classList.remove('no');
  65                    }
  66                  } else {
  67                    tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-success\">" + Joomla.Text._('JYES') + "</span>");
  68  
  69                    if (tmpRow.classList.contains('no')) {
  70                      tmpRow.classList.remove('no');
  71                    }
  72                  }
  73                }
  74  
  75                if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
  76                  tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-danger\">" + Joomla.Text._('JNO') + "</span>");
  77  
  78                  if (!tmpRow.classList.contains('no')) {
  79                    tmpRow.classList.add('no');
  80                  }
  81                }
  82              }
  83  
  84              if (parseInt(updMenus, 10) < 0) {
  85                if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
  86                  if (window.parent.numMenus === window.parent.inMenus.length) {
  87                    tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-info\">" + Joomla.Text._('JALL') + "</span>");
  88  
  89                    if (tmpRow.classList.contains('no')) {
  90                      tmpRow.classList.remove('no');
  91                    }
  92                  } else {
  93                    tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-success\">" + Joomla.Text._('JYES') + "</span>");
  94  
  95                    if (tmpRow.classList.contains('no')) {
  96                      tmpRow.classList.remove('no');
  97                    }
  98                  }
  99                }
 100  
 101                if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
 102                  tmpMenu.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-danger\">" + Joomla.Text._('JNO') + "</span>");
 103  
 104                  if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
 105                    tmpRow.classList.add('no');
 106                  }
 107                }
 108              }
 109  
 110              if (parseInt(updStatus, 10) === 1) {
 111                tmpStatus.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-success\">" + Joomla.Text._('JYES') + "</span>");
 112  
 113                if (tmpRow.classList.contains('unpublished')) {
 114                  tmpRow.classList.remove('unpublished');
 115                }
 116              }
 117  
 118              if (parseInt(updStatus, 10) === 0) {
 119                tmpStatus.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-danger\">" + Joomla.Text._('JNO') + "</span>");
 120  
 121                if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) {
 122                  tmpRow.classList.add('unpublished');
 123                }
 124              }
 125  
 126              if (parseInt(updStatus, 10) === -2) {
 127                tmpStatus.innerHTML = Joomla.sanitizeHtml("<span class=\"badge bg-secondary\">" + Joomla.Text._('JTRASHED') + "</span>");
 128  
 129                if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) {
 130                  tmpRow.classList.add('unpublished');
 131                }
 132              }
 133  
 134              if (document.formvalidator.isValid(document.getElementById('module-form'))) {
 135                window.parent.document.querySelector("#title-" + options.itemId).innerText = updTitle;
 136                window.parent.document.querySelector("#position-" + options.itemId).innerText = updPosition;
 137                window.parent.document.querySelector("#access-" + options.itemId).innerHTML = Joomla.sanitizeHtml(window.parent.viewLevels[updAccess]);
 138              }
 139            }
 140  
 141            if (task !== 'module.apply') {
 142              window.parent.Joomla.Modal.getCurrent().close();
 143            }
 144          }
 145        }
 146      };
 147    })(Joomla);
 148  
 149  })();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer