Source: layout_exporter.es.js

  1. /**
  2. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. /**
  15. * Hides layout pane
  16. * @param {Object} options
  17. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  18. */
  19. export function hideLayoutPane(options) {
  20. options = options || {};
  21. var obj = options.obj;
  22. var pane = options.pane;
  23. if (obj && obj.checked) {
  24. pane = document.querySelector(pane);
  25. if (pane) {
  26. pane.classList.add('hide');
  27. }
  28. }
  29. }
  30. /**
  31. * Gets layout icons
  32. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  33. */
  34. export function getLayoutIcons() {
  35. return {
  36. minus: themeDisplay.getPathThemeImages() + '/arrows/01_minus.png',
  37. plus: themeDisplay.getPathThemeImages() + '/arrows/01_plus.png',
  38. };
  39. }
  40. /**
  41. * Proposes layout
  42. * @param {Object} options
  43. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  44. */
  45. export function proposeLayout(options) {
  46. options = options || {};
  47. var namespace = options.namespace;
  48. var reviewers = options.reviewers;
  49. var contents = '<div><form action="' + options.url + '" method="post">';
  50. if (reviewers.length > 0) {
  51. contents +=
  52. '<textarea name="' +
  53. namespace +
  54. 'description" style="height: 100px; width: 284px;"></textarea><br /><br />' +
  55. Liferay.Language.get('reviewer') +
  56. ' <select name="' +
  57. namespace +
  58. 'reviewUserId">';
  59. for (var i = 0; i < reviewers.length; i++) {
  60. contents +=
  61. '<option value="' +
  62. reviewers[i].userId +
  63. '">' +
  64. reviewers[i].fullName +
  65. '</option>';
  66. }
  67. contents +=
  68. '</select><br /><br />' +
  69. '<input type="submit" value="' +
  70. Liferay.Language.get('proceed') +
  71. '" />';
  72. }
  73. else {
  74. contents +=
  75. Liferay.Language.get('no-reviewers-were-found') +
  76. '<br />' +
  77. Liferay.Language.get(
  78. 'please-contact-the-administrator-to-assign-reviewers'
  79. ) +
  80. '<br /><br />';
  81. }
  82. contents += '</form></div>';
  83. Liferay.Util.openWindow({
  84. dialog: {
  85. destroyOnHide: true,
  86. },
  87. title: contents,
  88. });
  89. }
  90. /**
  91. * Publishes to live
  92. * @param {Object} options
  93. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  94. */
  95. export function publishToLive(options) {
  96. options = options || {};
  97. Liferay.Util.openWindow({
  98. dialog: {
  99. constrain: true,
  100. modal: true,
  101. on: {
  102. visibleChange(event) {
  103. var instance = this;
  104. if (!event.newVal) {
  105. instance.destroy();
  106. }
  107. },
  108. },
  109. },
  110. title: options.title,
  111. uri: options.url,
  112. });
  113. }
  114. /**
  115. * Shows layout pane
  116. * @param {Object} options
  117. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  118. */
  119. export function showLayoutPane(options) {
  120. options = options || {};
  121. var obj = options.obj;
  122. var pane = options.pane;
  123. if (obj && obj.checked) {
  124. pane = document.querySelector(pane);
  125. if (pane) {
  126. pane.classList.remove('hide');
  127. }
  128. }
  129. }
  130. /**
  131. * Toggles layout details
  132. * @param {Object} options
  133. * @deprecated As of Athanasius (7.3.x), with no direct replacement
  134. */
  135. export function toggleLayoutDetails(options) {
  136. options = options || {};
  137. var detail = document.querySelector(options.detail);
  138. var img = document.querySelector(options.toggle);
  139. if (detail && img) {
  140. var icon = themeDisplay.getPathThemeImages() + '/arrows/01_plus.png';
  141. if (detail.classList.contains('hide')) {
  142. detail.classList.remove('hide');
  143. icon = themeDisplay.getPathThemeImages() + '/arrows/01_minus.png';
  144. }
  145. else {
  146. detail.classList.add('hide');
  147. }
  148. img.setAttribute('src', icon);
  149. }
  150. }