CoreFiles by mySites.guru
admin-module-edit.js132 lines, 6,275 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
f4527e48ff4a744297b139bca026c36a
sha1
1f75343be98faca5f4cd4feb9b15060aa5a0ef6e
sha256
ceec1cb01ad1de151af1f94aab8128497b633cc14c9a7969a024e95727553393
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
Joomla = window.Joomla || {};

(function (Joomla) {
  'use strict';

  Joomla.submitbutton = function (task) {
    if (task === 'module.cancel' || document.formvalidator.isValid(document.getElementById('module-form'))) {
      Joomla.submitform(task, document.getElementById('module-form'));

      var options = Joomla.getOptions('module-edit');

      if (window.self !== window.top) {
        if (window.parent.viewLevels) {
          // @todo remove the chosen!!!
          var updPosition = window.jQuery('#jform_position').chosen().val();
          var updTitle = document.getElementById('jform_title').value;
          var updMenus = document.querySelector('#jform_assignment').value;
          var updStatus = document.querySelector('#jform_published').value;
          var updAccess = document.querySelector('#jform_access').value;
          var tmpMenu = window.parent.document.getElementById('menus-' + options.itemId);
          var tmpRow = window.parent.document.getElementById('tr-' + options.itemId);
          var tmpStatus = window.parent.document.getElementById('status-' + options.itemId);
          window.parent.inMenus = [];
          window.parent.numMenus = [].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).length;

          [].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).forEach(function (element) {
            if (updMenus > 0) {
              if (element.checked) {
                window.parent.inMenus.push(parseInt(element.value, 10));
              }
            }
            if (updMenus < 0) {
              if (!element.checked) {
                window.parent.inMenus.push(parseInt(element.value, 10));
              }
            }
          });
          if (updMenus === '-') {
            tmpMenu.innerHTML = '<span class="badge badge-danger">' + Joomla.JText._('JNO') + '</span>';
            if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
              tmpRow.classList.add('no');
            }
          }
          if (parseInt(updMenus, 10) === 0) {
            tmpMenu.innerHTML = '<span class="badge badge-info">' + Joomla.JText._('JALL') + '</span>';
            if (tmpRow.classList.contains('no')) {
              tmpRow.classList.remove('no');
            }
          }
          if (parseInt(updMenus, 10) > 0) {
            if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
              if (window.parent.numMenus === window.parent.inMenus.length) {
                tmpMenu.innerHTML = '<span class="badge badge-info">' + Joomla.JText._('JALL') + '</span>';
                if (tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
                  tmpRow.classList.remove('no');
                }
              } else {
                tmpMenu.innerHTML = '<span class="badge badge-success">' + Joomla.JText._('JYES') + '</span>';
                if (tmpRow.classList.contains('no')) {
                  tmpRow.classList.remove('no');
                }
              }
            }
            if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
              tmpMenu.innerHTML = '<span class="badge badge-danger">' + Joomla.JText._('JNO') + '</span>';
              if (!tmpRow.classList.contains('no')) {
                tmpRow.classList.add('no');
              }
            }
          }
          if (parseInt(updMenus, 10) < 0) {
            if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
              if (window.parent.numMenus === window.parent.inMenus.length) {
                tmpMenu.innerHTML = '<span class="badge badge-info">' + Joomla.JText._('JALL') + '</span>';
                if (tmpRow.classList.contains('no')) {
                  tmpRow.classList.remove('no');
                }
              } else {
                tmpMenu.innerHTML = '<span class="badge badge-success">' + Joomla.JText._('JYES') + '</span>';
                if (tmpRow.classList.contains('no')) {
                  tmpRow.classList.remove('no');
                }
              }
            }
            if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
              tmpMenu.innerHTML = '<span class="badge badge-danger">' + Joomla.JText._('JNO') + '</span>';
              if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) {
                tmpRow.classList.add('no');
              }
            }
          }
          if (parseInt(updStatus, 10) === 1) {
            tmpStatus.innerHTML = '<span class="badge badge-success">' + Joomla.JText._('JYES') + '</span>';
            if (tmpRow.classList.contains('unpublished')) {
              tmpRow.classList.remove('unpublished');
            }
          }
          if (parseInt(updStatus, 10) === 0) {
            tmpStatus.innerHTML = '<span class="badge badge-danger">' + Joomla.JText._('JNO') + '</span>';
            if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) {
              tmpRow.classList.add('unpublished');
            }
          }
          if (parseInt(updStatus, 10) === -2) {
            tmpStatus.innerHTML = '<span class="badge badge-default">' + Joomla.JText._('JTRASHED') + '</span>';
            if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) {
              tmpRow.classList.add('unpublished');
            }
          }
          if (document.formvalidator.isValid(document.getElementById('module-form'))) {
            window.parent.document.querySelector('#title-' + options.itemId).innerText = updTitle;
            window.parent.document.querySelector('#position-' + options.itemId).innerText = updPosition;
            window.parent.document.querySelector('#access-' + options.itemId).innerHTML = window.parent.viewLevels[updAccess];
          }
        }
      }

      if (task !== 'module.apply') {
        window.parent.Joomla.Modal.getCurrent().close();
      }
    }
  };
})(Joomla);

No other release has this exact content. See every version of this file.