From 45782b0d7c7f1ce1e178e4b59cdf3db0492bca69 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 23 Jun 2021 14:49:13 +0530 Subject: [PATCH 01/34] init language files --- .../language/en-GB/en-GB.plg_editors-xtd_newmodule.ini | 8 ++++++++ .../en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini create mode 100644 administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini new file mode 100644 index 00000000000..b7a6a70027b --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini @@ -0,0 +1,8 @@ +; Joomla! Project +; (C) 2021 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + +PLG_EDITORS-XTD_NEWMODULE="Button - New Module" +PLG_NEW_MODULE_BUTTON_MODULE="New Module" +PLG_NEW_MODULE_XML_DESCRIPTION="Displays a button to insert a new module into an editor area. Displays a popup allowing you to create the new module." diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini new file mode 100644 index 00000000000..3bea1f60186 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; (C) 2021 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + +PLG_EDITORS-XTD_NEWMODULE="Button - New Module" +PLG_NEW_MODULE_XML_DESCRIPTION="Displays a button to insert a module into an editor area. Displays a popup allowing you to choose the module." From 0da15bd4f620fb2a41afe2af7480da54c898c99b Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 23 Jun 2021 14:49:26 +0530 Subject: [PATCH 02/34] init xml form --- plugins/editors-xtd/newmodule/newmodule.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/editors-xtd/newmodule/newmodule.xml diff --git a/plugins/editors-xtd/newmodule/newmodule.xml b/plugins/editors-xtd/newmodule/newmodule.xml new file mode 100644 index 00000000000..3a7d39f2be1 --- /dev/null +++ b/plugins/editors-xtd/newmodule/newmodule.xml @@ -0,0 +1,19 @@ + + + plg_editors-xtd_newmodule + Joomla! Project + June 2021 + (C) 2021 Open Source Matters, Inc. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + __DEPLOY_VERSION__ + PLG_NEW_MODULE_XML_DESCRIPTION + + newmodule.php + + + en-GB.plg_editors-xtd_newmodule.ini + en-GB.plg_editors-xtd_newmodule.sys.ini + + From 12d56a0a3f963be76df37ed337c0d9c6f69c21db Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 23 Jun 2021 14:50:11 +0530 Subject: [PATCH 03/34] init plugin php file --- plugins/editors-xtd/newmodule/newmodule.php | 76 +++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 plugins/editors-xtd/newmodule/newmodule.php diff --git a/plugins/editors-xtd/newmodule/newmodule.php b/plugins/editors-xtd/newmodule/newmodule.php new file mode 100644 index 00000000000..23c8215d032 --- /dev/null +++ b/plugins/editors-xtd/newmodule/newmodule.php @@ -0,0 +1,76 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +defined('_JEXEC') or die; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Plugin\CMSPlugin; +use Joomla\CMS\Session\Session; + +/** + * Editor Module button + * + * @since __DEPLOY_VERSION__ + */ +class PlgButtonNewModule extends CMSPlugin +{ + /** + * Load the language file on instantiation. + * + * @var boolean + * @since __DEPLOY_VERSION__ + */ + protected $autoloadLanguage = true; + + /** + * Display the button + * + * @param string $name The name of the button to add + * + * @return CMSObject The button options as JObject + * + * @since __DEPLOY_VERSION__ + */ + public function onDisplay($name) + { + /* + * Use the built-in element view to select the module. + * Currently uses blank class. + */ + $user = Factory::getUser(); + + if ($user->authorise('core.create', 'com_modules') + || $user->authorise('core.edit', 'com_modules') + || $user->authorise('core.edit.own', 'com_modules')) + { + $link = 'index.php?option=com_modules&view=select&layout=modal&tmpl=component&editor=' + . $name . '&' . Session::getFormToken() . '=1'; + $button = new CMSObject; + $button->modal = true; + $button->link = $link; + $button->text = Text::_('PLG_NEW_MODULE_BUTTON_MODULE'); + $button->name = $this->_type . '_' . $this->_name; + $button->icon = 'cube'; + $button->iconSVG = ''; + $button->options = [ + 'height' => '300px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + ]; + + return $button; + } + } +} From 431cb804b7fc34ddf78863474e6b588a7f97d0fe Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 23 Jun 2021 18:02:44 +0530 Subject: [PATCH 04/34] language constant for modules tab --- administrator/language/en-GB/com_content.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index 716d1c01a88..0664ab26ab4 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -93,6 +93,7 @@ COM_CONTENT_FIELDS_ARTICLE_FIELD_ADD_TITLE="Articles: New Field" COM_CONTENT_FIELDS_ARTICLE_FIELD_EDIT_TITLE="Articles: Edit Field" COM_CONTENT_FIELDS_ARTICLE_FIELDS_TITLE="Articles: Fields" COM_CONTENT_FIELDS_TYPE_MODAL_ARTICLE="Article" +COM_CONTENT_FIELDSET_MODULES="Imported Modules" COM_CONTENT_FIELDSET_PUBLISHING="Publishing" COM_CONTENT_FIELDSET_RULES="Permissions" COM_CONTENT_FIELDSET_URLS_AND_IMAGES="Images and Links" From 3105800bcb01729daffb9bd7c9f56d6daff70f7d Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 23 Jun 2021 18:02:55 +0530 Subject: [PATCH 05/34] imported modules tab --- .../components/com_content/tmpl/article/edit.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index bf359a97e0f..f3b2544b2c9 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -104,6 +104,15 @@ + + get('show_imported_modules', 1) == 1) : ?> + +
+ +
+ + + get('show_article_options', 1) == 1) : ?> From 8c36d28b8e140082d7048e7c19546af88e53337a Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 24 Jun 2021 13:44:13 +0530 Subject: [PATCH 06/34] installation sql script --- installation/sql/mysql/base.sql | 1 + installation/sql/postgresql/base.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 99199575edf..949c96f4dcd 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -269,6 +269,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), (0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), (0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), +(0, 'plg_editors-xtd_newmodule', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 8cda51c8fee..8a15b44a64c 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -275,6 +275,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), (0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), (0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), +(0, 'plg_editors-xtd_newmodule', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), From 27c23bf73951ece1933f0be618b5f7e89b5ea799 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 25 Jun 2021 20:35:42 +0530 Subject: [PATCH 07/34] add language constants --- administrator/language/en-GB/com_content.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index 0664ab26ab4..20aa2613443 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -32,6 +32,7 @@ COM_CONTENT_CREATE_ARTICLE_ERROR="When default category is enabled, a category s COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_DESC="Select the page the user will be redirected to after a successful article submission and after cancel (if not set differently below). The default is to redirect to the home page." COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_LABEL="Submission/Cancel Redirect" COM_CONTENT_DASHBOARD_TITLE="Content Dashboard" +COM_CONTENT_EDIT_MODULE="Edit" COM_CONTENT_EDIT_ARTICLE="Edit Article" COM_CONTENT_EDIT_CATEGORY="Edit Category" COM_CONTENT_EDITING_LAYOUT="Editing Layout" @@ -108,9 +109,13 @@ COM_CONTENT_HEADING_DATE_CREATED="Date Created" COM_CONTENT_HEADING_DATE_MODIFIED="Date Modified" COM_CONTENT_HEADING_DATE_PUBLISH_DOWN="Finish Publishing" COM_CONTENT_HEADING_DATE_PUBLISH_UP="Start Publishing" +COM_CONTENT_HEADING_IMPORTED_MODULE_EDIT="Edit Module" +COM_CONTENT_HEADING_IMPORTED_MODULE_ID="Imported Module ID" +COM_CONTENT_HEADING_IMPORTED_MODULE_TITLE="Title" COM_CONTENT_ID_LABEL="ID" COM_CONTENT_IMAGE_FULLTEXT_CLASS_LABEL="Full Text Image Class" COM_CONTENT_IMAGE_INTRO_CLASS_LABEL="Intro Image Class" +COM_CONTENT_IMPORTED_MODULES_TABLE_CAPTION="Table for Imported Modules" COM_CONTENT_MODIFIED_ASC="Date Modified ascending" COM_CONTENT_MODIFIED_DESC="Date Modified descending" COM_CONTENT_MONTH="Month" From 3d8b9c6dfdcc269e621db9a13faefc7bf1cffd38 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 25 Jun 2021 20:39:20 +0530 Subject: [PATCH 08/34] show toolbar --- plugins/editors-xtd/newmodule/newmodule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/editors-xtd/newmodule/newmodule.php b/plugins/editors-xtd/newmodule/newmodule.php index 23c8215d032..930b97bbda9 100644 --- a/plugins/editors-xtd/newmodule/newmodule.php +++ b/plugins/editors-xtd/newmodule/newmodule.php @@ -51,7 +51,7 @@ public function onDisplay($name) || $user->authorise('core.edit', 'com_modules') || $user->authorise('core.edit.own', 'com_modules')) { - $link = 'index.php?option=com_modules&view=select&layout=modal&tmpl=component&editor=' + $link = 'index.php?option=com_modules&view=select&layout=modal&editor=' . $name . '&' . Session::getFormToken() . '=1'; $button = new CMSObject; $button->modal = true; From fdf301ad0a8cbb68c55d30a360249f13acd14f45 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 25 Jun 2021 20:40:07 +0530 Subject: [PATCH 09/34] fetch all modules used in the article --- .../com_content/src/Model/ArticleModel.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/administrator/components/com_content/src/Model/ArticleModel.php b/administrator/components/com_content/src/Model/ArticleModel.php index bc9bd82c046..343523b3358 100644 --- a/administrator/components/com_content/src/Model/ArticleModel.php +++ b/administrator/components/com_content/src/Model/ArticleModel.php @@ -469,6 +469,36 @@ public function getItem($pk = null) } } + // Expression to search for(id) + $regexmodid = '/{loadmoduleid\s([1-9][0-9]*)}/i'; + + // Find all instances of loadmoduleid and store it in $matchesmodid + preg_match_all($regexmodid, $item->articletext, $matchesmodid, PREG_SET_ORDER); + $importedModules = []; + + // If no matches, skip this + if ($matchesmodid) + { + foreach ($matchesmodid as $match) + { + $importedModules[] = $match[1]; + } + + $db = $this->getDbo(); + $query = $db->getQuery(true) + ->select( + [ + $db->quoteName('id'), + $db->quoteName('title'), + $db->quoteName('published'), + ] + ) + ->from($db->quoteName('#__modules')); + $query->where($db->quoteName('id') . 'IN (' . implode(',', $query->bindArray(array_values($importedModules))) . ')'); + + $item->importedModules = $db->setQuery($query)->loadObjectList(); + } + return $item; } From 307300aa7c5b8951f190d17dd6ea5c75cdfe5d5d Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 25 Jun 2021 20:41:29 +0530 Subject: [PATCH 10/34] add new tab for imported modules --- .../com_content/tmpl/article/edit.php | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index f3b2544b2c9..08e5b4d0c39 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -105,10 +105,64 @@ - get('show_imported_modules', 1) == 1) : ?> + get('show_imported_modules', 1) == 1 && \count($this->item->importedModules)): ?>
+ + + + + + + + + + + + item->importedModules as $module) : ?> + + + + + + + + +
+ +
+ + + + + + + +
+ escape($module->id); ?> + + escape($module->title); ?> + + published) : ?> + + + + + + + + + + +
From 8da56fe4e2bda8359611afd8d6af5e7506cdb0f3 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 25 Jun 2021 20:59:33 +0530 Subject: [PATCH 11/34] add switcher for toggling the imported modules tab --- administrator/components/com_content/config.xml | 11 +++++++++++ .../components/com_content/forms/article.xml | 12 ++++++++++++ administrator/language/en-GB/com_content.ini | 1 + 3 files changed, 24 insertions(+) diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 3cd59029f78..e9cbd77a9b7 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -441,6 +441,17 @@ + + + + + JNO + + + + +
diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index 20aa2613443..e13c9aaca30 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -170,6 +170,7 @@ COM_CONTENT_SHOW_ASSOCIATIONS_LABEL="Multilingual Associations" COM_CONTENT_SHOW_CONFIGURE_EDIT_LABEL="Edit Screen Options" COM_CONTENT_SHOW_IMAGES_URLS_BACK_LABEL="Administrator Images and Links" COM_CONTENT_SHOW_IMAGES_URLS_FRONT_LABEL="Frontend Images and Links" +COM_CONTENT_SHOW_IMPORTED_MODULES="Show Imported Modules" COM_CONTENT_SHOW_PERMISSIONS_LABEL="Article Permissions" COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL="Publishing Options" COM_CONTENT_SLIDER_EDITOR_CONFIG="Configure Edit Screen" From fde75fad544b66d793c1ab3cf34f519155bda37d Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Tue, 29 Jun 2021 13:06:51 +0530 Subject: [PATCH 12/34] sort sql install script alphabetically --- installation/sql/mysql/base.sql | 6 +++--- installation/sql/postgresql/base.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 949c96f4dcd..529edcee207 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -267,9 +267,9 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_editors-xtd_image', 'plugin', 'image', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 4, 0), (0, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 5, 0), (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), -(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), -(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_editors-xtd_newmodule', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9 0), +(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), +(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), +(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9, 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 8a15b44a64c..90ff9dd4ff9 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -273,9 +273,9 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_editors-xtd_image', 'plugin', 'image', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 4, 0), (0, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 5, 0), (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), -(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), -(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_editors-xtd_newmodule', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9 0), +(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7 0), +(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), +(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9, 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), From 822e5399399ca87a4d87dcdb86c74075c4c93325 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Tue, 29 Jun 2021 13:09:11 +0530 Subject: [PATCH 13/34] add missing comma --- installation/sql/postgresql/base.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 90ff9dd4ff9..3002b9ab208 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -273,7 +273,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_editors-xtd_image', 'plugin', 'image', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 4, 0), (0, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 5, 0), (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), -(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7 0), +(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), (0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), (0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9, 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), From 66f9691a677abbadf1fa880bb3c55d43cf1d618a Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 30 Jun 2021 13:42:20 +0530 Subject: [PATCH 14/34] edit modal script --- .../js/admin-article-edit-modal.es6.js | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 build/media_source/com_content/js/admin-article-edit-modal.es6.js diff --git a/build/media_source/com_content/js/admin-article-edit-modal.es6.js b/build/media_source/com_content/js/admin-article-edit-modal.es6.js new file mode 100644 index 00000000000..284af7eaaf2 --- /dev/null +++ b/build/media_source/com_content/js/admin-article-edit-modal.es6.js @@ -0,0 +1,49 @@ +(function () { + 'use strict'; + + /** + * @copyright (C) 2021 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + Joomla = window.Joomla || {}; + + (function () { + + var baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; + var linkElements = [].slice.call(document.getElementsByClassName('module-edit-link')); + var elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); + + if (linkElements.length) { + linkElements.forEach(function (linkElement) { + linkElement.addEventListener('click', function (_ref) { + var target = _ref.target; + var link = baseLink + target.getAttribute('data-module-id'); + var modal = document.getElementById('moduleEditModal'); + var body = modal.querySelector('.modal-body'); + var iFrame = document.createElement('iframe'); + iFrame.src = link; + iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); + body.innerHTML = ''; + body.appendChild(iFrame); + modal.open(); + }); + }); + } + + if (elements.length) { + elements.forEach(function (element) { + element.addEventListener('click', function (_ref2) { + var target = _ref2.target; + var dataTarget = target.getAttribute('data-bs-target'); + + if (dataTarget) { + var iframe = document.querySelector('#moduleEditModal iframe'); + var iframeDocument = iframe.contentDocument || iframe.contentWindow.document; + iframeDocument.querySelector(dataTarget).click(); + } + }); + }); + } + })(); + +}()); From de3b3a9b88ef8886961993c095480a60fe3d3d71 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 30 Jun 2021 13:44:21 +0530 Subject: [PATCH 15/34] add modal script to assets --- .../com_content/joomla.asset.json | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build/media_source/com_content/joomla.asset.json b/build/media_source/com_content/joomla.asset.json index af995ea1c93..e3daf760fcf 100644 --- a/build/media_source/com_content/joomla.asset.json +++ b/build/media_source/com_content/joomla.asset.json @@ -5,6 +5,30 @@ "description": "Joomla CMS", "license": "GPL-2.0-or-later", "assets": [ + { + "name": "com_content.admin-article-edit-modal.es5", + "type": "script", + "uri": "com_content/admin-article-edit-modal-es5.min.js", + "dependencies": [ + "core" + ], + "attributes": { + "nomodule": true, + "defer": true + } + }, + { + "name": "com_content.admin-article-edit-modal", + "type": "script", + "uri": "com_content/admin-article-edit-modal.min.js", + "dependencies": [ + "com_content.admin-article-edit-modal.es5" + ], + "attributes": { + "type": "module", + "defer": true + } + }, { "name": "com_content.admin-article-pagebreak.es5", "type": "script", From abbcee7c73819137317e7a3bd8a1352342d654e9 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 30 Jun 2021 13:44:36 +0530 Subject: [PATCH 16/34] edit module modal --- .../com_content/tmpl/article/edit.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index 08e5b4d0c39..f0c0698ad61 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -21,6 +21,30 @@ /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); + +$wa + ->useScript('com_content.admin-article-edit-modal'); + +// Set up the bootstrap modal that will be used for all module editors +echo HTMLHelper::_( + 'bootstrap.renderModal', + 'moduleEditModal', + array( + 'title' => Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', + ) +); + $wa->getRegistry()->addExtensionRegistryFile('com_contenthistory'); $wa->useScript('keepalive') ->useScript('form.validate') @@ -155,7 +179,7 @@ class="btn btn-link module-edit-link" title="" id="title-id; ?>" - data-module-id="ad"> + data-module-id="id; ?>"> From e7a0cddf063118f8e807969c997858fa686c549b Mon Sep 17 00:00:00 2001 From: Yatharth Vyas Date: Wed, 30 Jun 2021 13:46:10 +0530 Subject: [PATCH 17/34] Update administrator/components/com_content/tmpl/article/edit.php Co-authored-by: Richard Fath --- administrator/components/com_content/tmpl/article/edit.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index f0c0698ad61..3338afde290 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -22,8 +22,7 @@ /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); -$wa - ->useScript('com_content.admin-article-edit-modal'); +$wa->useScript('com_content.admin-article-edit-modal'); // Set up the bootstrap modal that will be used for all module editors echo HTMLHelper::_( From 6b53d865823f51c30a05e9ac4e52dd4bd1666db3 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 30 Jun 2021 13:51:04 +0530 Subject: [PATCH 18/34] Change heading language constant --- administrator/components/com_content/tmpl/article/edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index f0c0698ad61..65a153e757c 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -30,7 +30,7 @@ 'bootstrap.renderModal', 'moduleEditModal', array( - 'title' => Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'title' => Text::_('COM_CONTENT_HEADING_IMPORTED_MODULE_EDIT'), 'backdrop' => 'static', 'keyboard' => false, 'closeButton' => false, From 89ab3392dfd50ff3265ebbf23f68565a73214b46 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Wed, 30 Jun 2021 14:00:43 +0530 Subject: [PATCH 19/34] js lint --- .../js/admin-article-edit-modal.es6.js | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/build/media_source/com_content/js/admin-article-edit-modal.es6.js b/build/media_source/com_content/js/admin-article-edit-modal.es6.js index 284af7eaaf2..9af3d8e99e1 100644 --- a/build/media_source/com_content/js/admin-article-edit-modal.es6.js +++ b/build/media_source/com_content/js/admin-article-edit-modal.es6.js @@ -1,26 +1,30 @@ -(function () { +/** + * @copyright (C) 2018 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ +(() => { 'use strict'; /** - * @copyright (C) 2021 Open Source Matters, Inc. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - Joomla = window.Joomla || {}; + * Javascript to display the modal when user clicks on the + * module edit button. The modal is initialized by the id + * of the module found using data-module-id attribute of + * the button. + * */ - (function () { - - var baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; - var linkElements = [].slice.call(document.getElementsByClassName('module-edit-link')); - var elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); + document.addEventListener('DOMContentLoaded', () => { + const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; + const linkElements = [].slice.call(document.getElementsByClassName('module-edit-link')); + const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); if (linkElements.length) { - linkElements.forEach(function (linkElement) { - linkElement.addEventListener('click', function (_ref) { - var target = _ref.target; - var link = baseLink + target.getAttribute('data-module-id'); - var modal = document.getElementById('moduleEditModal'); - var body = modal.querySelector('.modal-body'); - var iFrame = document.createElement('iframe'); + linkElements.forEach((linkElement) => { + linkElement.addEventListener('click', (_ref) => { + const { target } = _ref; + const link = baseLink + target.getAttribute('data-module-id'); + const modal = document.getElementById('moduleEditModal'); + const body = modal.querySelector('.modal-body'); + const iFrame = document.createElement('iframe'); iFrame.src = link; iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); body.innerHTML = ''; @@ -31,19 +35,18 @@ } if (elements.length) { - elements.forEach(function (element) { - element.addEventListener('click', function (_ref2) { - var target = _ref2.target; - var dataTarget = target.getAttribute('data-bs-target'); + elements.forEach((element) => { + element.addEventListener('click', (_ref2) => { + const { target } = _ref2; + const dataTarget = target.getAttribute('data-bs-target'); if (dataTarget) { - var iframe = document.querySelector('#moduleEditModal iframe'); - var iframeDocument = iframe.contentDocument || iframe.contentWindow.document; + const iframe = document.querySelector('#moduleEditModal iframe'); + const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; iframeDocument.querySelector(dataTarget).click(); } }); }); } - })(); - -}()); + }); +})(); From fe446f10f23fdadb28db0df8b5dc2462cb0b70fa Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 1 Jul 2021 17:26:34 +0530 Subject: [PATCH 20/34] introduce apply button param for Saving --- layouts/joomla/editors/buttons/modal.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/layouts/joomla/editors/buttons/modal.php b/layouts/joomla/editors/buttons/modal.php index e288d0a818f..e5bb55d2338 100644 --- a/layouts/joomla/editors/buttons/modal.php +++ b/layouts/joomla/editors/buttons/modal.php @@ -28,14 +28,20 @@ $title = ($button->get('title')) ? $button->get('title') : $button->get('text'); $options = is_array($button->get('options')) ? $button->get('options') : array(); -$confirm = ''; +$footer = ''; if (is_array($button->get('options')) && isset($options['confirmText']) && isset($options['confirmCallback'])) { - $confirm = ''; } +if (is_array($button->get('options')) && isset($options['applyText']) && isset($options['applyCallback'])) +{ + $footer .= ''; +} + if (null !== $button->get('id')) { $id = str_replace(' ', '', $button->get('id')); @@ -57,7 +63,7 @@ 'width' => array_key_exists('width', $options) ? $options['width'] : '800px', 'bodyHeight' => array_key_exists('bodyHeight', $options) ? $options['bodyHeight'] : '70', 'modalWidth' => array_key_exists('modalWidth', $options) ? $options['modalWidth'] : '80', - 'footer' => $confirm . '' ) ); From dd61a884fbbac4e79407fa9d09962576f5392d1b Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 1 Jul 2021 17:26:53 +0530 Subject: [PATCH 21/34] Display a save button in the modal --- plugins/editors-xtd/newmodule/newmodule.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/editors-xtd/newmodule/newmodule.php b/plugins/editors-xtd/newmodule/newmodule.php index 930b97bbda9..cc58d544f0a 100644 --- a/plugins/editors-xtd/newmodule/newmodule.php +++ b/plugins/editors-xtd/newmodule/newmodule.php @@ -51,7 +51,7 @@ public function onDisplay($name) || $user->authorise('core.edit', 'com_modules') || $user->authorise('core.edit.own', 'com_modules')) { - $link = 'index.php?option=com_modules&view=select&layout=modal&editor=' + $link = 'index.php?option=com_modules&view=select&layout=modal&tmpl=component&editor=' . $name . '&' . Session::getFormToken() . '=1'; $button = new CMSObject; $button->modal = true; @@ -68,6 +68,8 @@ public function onDisplay($name) 'width' => '800px', 'bodyHeight' => '70', 'modalWidth' => '80', + 'applyCallback' => 'Joomla.iframeButtonClick({iframeSelector: \'#jform_articletext_' . $button->name . '_modal\', buttonSelector: \'#applyBtn\'})', + 'applyText' => Text::_('JAPPLY'), ]; return $button; From 357da3140c236d1478239cb0d8c6a4e0c24d53c1 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:32:56 +0530 Subject: [PATCH 22/34] add remove id language constant --- administrator/language/en-GB/com_content.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index e13c9aaca30..25966ff0429 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -110,7 +110,8 @@ COM_CONTENT_HEADING_DATE_MODIFIED="Date Modified" COM_CONTENT_HEADING_DATE_PUBLISH_DOWN="Finish Publishing" COM_CONTENT_HEADING_DATE_PUBLISH_UP="Start Publishing" COM_CONTENT_HEADING_IMPORTED_MODULE_EDIT="Edit Module" -COM_CONTENT_HEADING_IMPORTED_MODULE_ID="Imported Module ID" +COM_CONTENT_HEADING_IMPORTED_MODULE_ID="ID" +COM_CONTENT_HEADING_IMPORTED_MODULE_REMOVE="Remove from Article" COM_CONTENT_HEADING_IMPORTED_MODULE_TITLE="Title" COM_CONTENT_ID_LABEL="ID" COM_CONTENT_IMAGE_FULLTEXT_CLASS_LABEL="Full Text Image Class" @@ -158,6 +159,7 @@ COM_CONTENT_PUBLISH_DOWN_DESC="Finish Publishing descending" COM_CONTENT_PUBLISH_UP_ASC="Start Publishing ascending" COM_CONTENT_PUBLISH_UP_DESC="Start Publishing descending" COM_CONTENT_PUBLISHED="Published" +COM_CONTENT_REMOVE_MODULE="Remove" COM_CONTENT_RUN_TRANSITIONS="Run Transitions" COM_CONTENT_SAVE_SUCCESS="Article saved." COM_CONTENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the article to customise the alias." From de44fae18fd9432ffe39c6111a1ae873615d3503 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:33:26 +0530 Subject: [PATCH 23/34] rename the js file name in assets --- build/media_source/com_content/joomla.asset.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/media_source/com_content/joomla.asset.json b/build/media_source/com_content/joomla.asset.json index e3daf760fcf..f7a96a92143 100644 --- a/build/media_source/com_content/joomla.asset.json +++ b/build/media_source/com_content/joomla.asset.json @@ -6,9 +6,9 @@ "license": "GPL-2.0-or-later", "assets": [ { - "name": "com_content.admin-article-edit-modal.es5", + "name": "com_content.admin-article-edit.es5", "type": "script", - "uri": "com_content/admin-article-edit-modal-es5.min.js", + "uri": "com_content/admin-article-edit-es5.min.js", "dependencies": [ "core" ], @@ -18,11 +18,11 @@ } }, { - "name": "com_content.admin-article-edit-modal", + "name": "com_content.admin-article-edit", "type": "script", - "uri": "com_content/admin-article-edit-modal.min.js", + "uri": "com_content/admin-article-edit.min.js", "dependencies": [ - "com_content.admin-article-edit-modal.es5" + "com_content.admin-article-edit.es5" ], "attributes": { "type": "module", From ecfc63b6deffe6c06ebb49d47ae86fae33e45dd2 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:34:26 +0530 Subject: [PATCH 24/34] remove old js file --- .../js/admin-article-edit-modal.es6.js | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 build/media_source/com_content/js/admin-article-edit-modal.es6.js diff --git a/build/media_source/com_content/js/admin-article-edit-modal.es6.js b/build/media_source/com_content/js/admin-article-edit-modal.es6.js deleted file mode 100644 index 9af3d8e99e1..00000000000 --- a/build/media_source/com_content/js/admin-article-edit-modal.es6.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @copyright (C) 2018 Open Source Matters, Inc. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -(() => { - 'use strict'; - - /** - * Javascript to display the modal when user clicks on the - * module edit button. The modal is initialized by the id - * of the module found using data-module-id attribute of - * the button. - * */ - - document.addEventListener('DOMContentLoaded', () => { - const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; - const linkElements = [].slice.call(document.getElementsByClassName('module-edit-link')); - const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); - - if (linkElements.length) { - linkElements.forEach((linkElement) => { - linkElement.addEventListener('click', (_ref) => { - const { target } = _ref; - const link = baseLink + target.getAttribute('data-module-id'); - const modal = document.getElementById('moduleEditModal'); - const body = modal.querySelector('.modal-body'); - const iFrame = document.createElement('iframe'); - iFrame.src = link; - iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); - body.innerHTML = ''; - body.appendChild(iFrame); - modal.open(); - }); - }); - } - - if (elements.length) { - elements.forEach((element) => { - element.addEventListener('click', (_ref2) => { - const { target } = _ref2; - const dataTarget = target.getAttribute('data-bs-target'); - - if (dataTarget) { - const iframe = document.querySelector('#moduleEditModal iframe'); - const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; - iframeDocument.querySelector(dataTarget).click(); - } - }); - }); - } - }); -})(); From c096b576e2149c5b52e3a4ab0c86f61b007b6abc Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:34:50 +0530 Subject: [PATCH 25/34] js script for modal and remove function --- .../com_content/js/admin-article-edit.es6.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 build/media_source/com_content/js/admin-article-edit.es6.js diff --git a/build/media_source/com_content/js/admin-article-edit.es6.js b/build/media_source/com_content/js/admin-article-edit.es6.js new file mode 100644 index 00000000000..00acbea7f0a --- /dev/null +++ b/build/media_source/com_content/js/admin-article-edit.es6.js @@ -0,0 +1,66 @@ +/** + * @copyright (C) 2018 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ +(() => { + 'use strict'; + + /** + * Javascript to display the modal when user clicks on the + * module edit button. The modal is initialized by the id + * of the module found using data-module-id attribute of + * the button. + * */ + + document.addEventListener('DOMContentLoaded', () => { + const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; + const modalBtnElements = [].slice.call(document.getElementsByClassName('module-edit-link')); + const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); + const removeModBtnElements = [].slice.call(document.getElementsByClassName('module-remove-link')); + + if (modalBtnElements.length) { + modalBtnElements.forEach((linkElement) => { + linkElement.addEventListener('click', (_ref) => { + const { target } = _ref; + const link = baseLink + target.getAttribute('data-module-id'); + const modal = document.getElementById('moduleEditModal'); + const body = modal.querySelector('.modal-body'); + const iFrame = document.createElement('iframe'); + iFrame.src = link; + iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); + body.innerHTML = ''; + body.appendChild(iFrame); + modal.open(); + }); + }); + } + + if (elements.length) { + elements.forEach((element) => { + element.addEventListener('click', (_ref2) => { + const { target } = _ref2; + const dataTarget = target.getAttribute('data-bs-target'); + + if (dataTarget) { + const iframe = document.querySelector('#moduleEditModal iframe'); + const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; + iframeDocument.querySelector(dataTarget).click(); + } + }); + }); + } + + + if (removeModBtnElements.length) { + removeModBtnElements.forEach((linkElement) => { + linkElement.addEventListener('click', (_ref) => { + const { target } = _ref; + const moduleId = target.getAttribute('data-module-id'); + editorText = Joomla.editors.instances.jform_articletext.getValue(); + editorText = editorText.replace(`loadmodules ${moduleId}`,''); + Joomla.editors.instances.jform_articletext.setValue(editorText) + }); + }); + } + }); +})(); From 92eac8b1de47e980ccc8d5516d8242ab8368f7e1 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:35:14 +0530 Subject: [PATCH 26/34] add column for removing the module from article --- .../com_content/tmpl/article/edit.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index 179d194d670..2d605e565e6 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -22,7 +22,7 @@ /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); -$wa->useScript('com_content.admin-article-edit-modal'); +$wa->useScript('com_content.admin-article-edit'); // Set up the bootstrap modal that will be used for all module editors echo HTMLHelper::_( @@ -138,18 +138,21 @@ - + - + - + + + + @@ -182,6 +185,13 @@ class="btn btn-link module-edit-link" + + + From dcad97f9986bf7f3c66938e977c844b12ff4d714 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:44:02 +0530 Subject: [PATCH 27/34] js lint --- .../js/admin-article-edit-modal.es6.js | 68 +++++++++++++++++++ .../com_content/js/admin-article-edit.es6.js | 5 +- 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 build/media_source/com_content/js/admin-article-edit-modal.es6.js diff --git a/build/media_source/com_content/js/admin-article-edit-modal.es6.js b/build/media_source/com_content/js/admin-article-edit-modal.es6.js new file mode 100644 index 00000000000..159e892391f --- /dev/null +++ b/build/media_source/com_content/js/admin-article-edit-modal.es6.js @@ -0,0 +1,68 @@ +/** + * @copyright (C) 2018 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ +(() => { + 'use strict'; + + /** + * Javascript to display the modal when user clicks on the + * module edit button and to remove the imported module from + * the article. + * */ + + document.addEventListener('DOMContentLoaded', () => { + const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; + const modalBtnElements = [].slice.call(document.getElementsByClassName('module-edit-link')); + const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); + const removeModBtnElements = [].slice.call(document.getElementsByClassName('module-remove-link')); + + if (modalBtnElements.length) { + modalBtnElements.forEach((linkElement) => { + linkElement.addEventListener('click', (_ref) => { + const { target } = _ref; + const link = baseLink + target.getAttribute('data-module-id'); + const modal = document.getElementById('moduleEditModal'); + const body = modal.querySelector('.modal-body'); + const iFrame = document.createElement('iframe'); + iFrame.src = link; + iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); + body.innerHTML = ''; + body.appendChild(iFrame); + modal.open(); + }); + }); + } + + if (elements.length) { + elements.forEach((element) => { + element.addEventListener('click', (_ref2) => { + const { target } = _ref2; + const dataTarget = target.getAttribute('data-bs-target'); + + if (dataTarget) { + const iframe = document.querySelector('#moduleEditModal iframe'); + const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; + iframeDocument.querySelector(dataTarget).click(); + } + }); + }); + } + + // Remove the module + if (removeModBtnElements.length) { + removeModBtnElements.forEach((linkElement) => { + linkElement.addEventListener('click', (_ref) => { + const { target } = _ref; + const moduleId = target.getAttribute('data-module-id'); + let editorText = Joomla.editors.instances.jform_articletext.getValue(); + editorText = editorText.replace(`{loadmoduleid ${moduleId}}`, ''); + Joomla.editors.instances.jform_articletext.setValue(editorText); + + // Save the form and reload + document.querySelectorAll('.button-apply')[0].click(); + }); + }); + } + }); +})(); diff --git a/build/media_source/com_content/js/admin-article-edit.es6.js b/build/media_source/com_content/js/admin-article-edit.es6.js index 00acbea7f0a..a4e2bd67684 100644 --- a/build/media_source/com_content/js/admin-article-edit.es6.js +++ b/build/media_source/com_content/js/admin-article-edit.es6.js @@ -50,15 +50,14 @@ }); } - if (removeModBtnElements.length) { removeModBtnElements.forEach((linkElement) => { linkElement.addEventListener('click', (_ref) => { const { target } = _ref; const moduleId = target.getAttribute('data-module-id'); editorText = Joomla.editors.instances.jform_articletext.getValue(); - editorText = editorText.replace(`loadmodules ${moduleId}`,''); - Joomla.editors.instances.jform_articletext.setValue(editorText) + editorText = editorText.replace(`loadmodules ${moduleId}`, ''); + Joomla.editors.instances.jform_articletext.setValue(editorText); }); }); } From 0b7ad24b6b11fb31a09061f020e3f88453bb9747 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Fri, 2 Jul 2021 15:46:42 +0530 Subject: [PATCH 28/34] js lint --- .../js/admin-article-edit-modal.es6.js | 68 ------------------- .../com_content/js/admin-article-edit.es6.js | 2 +- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 build/media_source/com_content/js/admin-article-edit-modal.es6.js diff --git a/build/media_source/com_content/js/admin-article-edit-modal.es6.js b/build/media_source/com_content/js/admin-article-edit-modal.es6.js deleted file mode 100644 index 159e892391f..00000000000 --- a/build/media_source/com_content/js/admin-article-edit-modal.es6.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @copyright (C) 2018 Open Source Matters, Inc. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -(() => { - 'use strict'; - - /** - * Javascript to display the modal when user clicks on the - * module edit button and to remove the imported module from - * the article. - * */ - - document.addEventListener('DOMContentLoaded', () => { - const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id='; - const modalBtnElements = [].slice.call(document.getElementsByClassName('module-edit-link')); - const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn')); - const removeModBtnElements = [].slice.call(document.getElementsByClassName('module-remove-link')); - - if (modalBtnElements.length) { - modalBtnElements.forEach((linkElement) => { - linkElement.addEventListener('click', (_ref) => { - const { target } = _ref; - const link = baseLink + target.getAttribute('data-module-id'); - const modal = document.getElementById('moduleEditModal'); - const body = modal.querySelector('.modal-body'); - const iFrame = document.createElement('iframe'); - iFrame.src = link; - iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); - body.innerHTML = ''; - body.appendChild(iFrame); - modal.open(); - }); - }); - } - - if (elements.length) { - elements.forEach((element) => { - element.addEventListener('click', (_ref2) => { - const { target } = _ref2; - const dataTarget = target.getAttribute('data-bs-target'); - - if (dataTarget) { - const iframe = document.querySelector('#moduleEditModal iframe'); - const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; - iframeDocument.querySelector(dataTarget).click(); - } - }); - }); - } - - // Remove the module - if (removeModBtnElements.length) { - removeModBtnElements.forEach((linkElement) => { - linkElement.addEventListener('click', (_ref) => { - const { target } = _ref; - const moduleId = target.getAttribute('data-module-id'); - let editorText = Joomla.editors.instances.jform_articletext.getValue(); - editorText = editorText.replace(`{loadmoduleid ${moduleId}}`, ''); - Joomla.editors.instances.jform_articletext.setValue(editorText); - - // Save the form and reload - document.querySelectorAll('.button-apply')[0].click(); - }); - }); - } - }); -})(); diff --git a/build/media_source/com_content/js/admin-article-edit.es6.js b/build/media_source/com_content/js/admin-article-edit.es6.js index a4e2bd67684..94681848900 100644 --- a/build/media_source/com_content/js/admin-article-edit.es6.js +++ b/build/media_source/com_content/js/admin-article-edit.es6.js @@ -55,7 +55,7 @@ linkElement.addEventListener('click', (_ref) => { const { target } = _ref; const moduleId = target.getAttribute('data-module-id'); - editorText = Joomla.editors.instances.jform_articletext.getValue(); + let editorText = Joomla.editors.instances.jform_articletext.getValue(); editorText = editorText.replace(`loadmodules ${moduleId}`, ''); Joomla.editors.instances.jform_articletext.setValue(editorText); }); From 45005fef73a701f277020186d54226c2cc1e82d2 Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Mon, 5 Jul 2021 12:47:15 +0530 Subject: [PATCH 29/34] check imported modules for empty --- administrator/components/com_content/tmpl/article/edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_content/tmpl/article/edit.php b/administrator/components/com_content/tmpl/article/edit.php index 2d605e565e6..dfff16d15e1 100644 --- a/administrator/components/com_content/tmpl/article/edit.php +++ b/administrator/components/com_content/tmpl/article/edit.php @@ -128,7 +128,7 @@ - get('show_imported_modules', 1) == 1 && \count($this->item->importedModules)): ?> + get('show_imported_modules', 1) == 1 && !empty($this->item->importedModules)): ?>
From 7c214e916e4abb1d97ca2306534cc6d9b61594ad Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 8 Jul 2021 18:31:34 +0530 Subject: [PATCH 30/34] New Module button in select module modal --- administrator/components/com_modules/tmpl/modules/modal.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/administrator/components/com_modules/tmpl/modules/modal.php b/administrator/components/com_modules/tmpl/modules/modal.php index 972919a7dd7..4390133d047 100644 --- a/administrator/components/com_modules/tmpl/modules/modal.php +++ b/administrator/components/com_modules/tmpl/modules/modal.php @@ -36,6 +36,10 @@ } ?>
+ + + +
From ba7c8ef81416fc98cec588b14e912d885c79f18a Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 8 Jul 2021 19:04:37 +0530 Subject: [PATCH 31/34] correct the link --- administrator/components/com_modules/tmpl/modules/modal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_modules/tmpl/modules/modal.php b/administrator/components/com_modules/tmpl/modules/modal.php index 4390133d047..c805b9849da 100644 --- a/administrator/components/com_modules/tmpl/modules/modal.php +++ b/administrator/components/com_modules/tmpl/modules/modal.php @@ -36,7 +36,7 @@ } ?>
- + From f816ec95c070a059aa7cc0f9f5fe9396964ebdab Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 8 Jul 2021 20:01:08 +0530 Subject: [PATCH 32/34] revert newmodule xtd editor plugin files --- .../en-GB/en-GB.plg_editors-xtd_newmodule.ini | 8 -- .../en-GB.plg_editors-xtd_newmodule.sys.ini | 7 -- installation/sql/mysql/base.sql | 5 +- installation/sql/postgresql/base.sql | 5 +- layouts/joomla/editors/buttons/modal.php | 14 +--- plugins/editors-xtd/newmodule/newmodule.php | 78 ------------------- plugins/editors-xtd/newmodule/newmodule.xml | 19 ----- 7 files changed, 8 insertions(+), 128 deletions(-) delete mode 100644 administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini delete mode 100644 administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini delete mode 100644 plugins/editors-xtd/newmodule/newmodule.php delete mode 100644 plugins/editors-xtd/newmodule/newmodule.xml diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini deleted file mode 100644 index b7a6a70027b..00000000000 --- a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.ini +++ /dev/null @@ -1,8 +0,0 @@ -; Joomla! Project -; (C) 2021 Open Source Matters, Inc. -; License GNU General Public License version 2 or later; see LICENSE.txt -; Note : All ini files need to be saved as UTF-8 - -PLG_EDITORS-XTD_NEWMODULE="Button - New Module" -PLG_NEW_MODULE_BUTTON_MODULE="New Module" -PLG_NEW_MODULE_XML_DESCRIPTION="Displays a button to insert a new module into an editor area. Displays a popup allowing you to create the new module." diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini deleted file mode 100644 index 3bea1f60186..00000000000 --- a/administrator/language/en-GB/en-GB.plg_editors-xtd_newmodule.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; (C) 2021 Open Source Matters, Inc. -; License GNU General Public License version 2 or later; see LICENSE.txt -; Note : All ini files need to be saved as UTF-8 - -PLG_EDITORS-XTD_NEWMODULE="Button - New Module" -PLG_NEW_MODULE_XML_DESCRIPTION="Displays a button to insert a module into an editor area. Displays a popup allowing you to choose the module." diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 529edcee207..99199575edf 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -267,9 +267,8 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_editors-xtd_image', 'plugin', 'image', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 4, 0), (0, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 5, 0), (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), -(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), -(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9, 0), +(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), +(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 3002b9ab208..8cda51c8fee 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -273,9 +273,8 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_editors-xtd_image', 'plugin', 'image', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 4, 0), (0, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 5, 0), (0, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 6, 0), -(0, 'plg_editors-xtd_newmodule', 'plugin', 'newmodule', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), -(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 9, 0), +(0, 'plg_editors-xtd_pagebreak', 'plugin', 'pagebreak', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 7, 0), +(0, 'plg_editors-xtd_readmore', 'plugin', 'readmore', 'editors-xtd', 0, 1, 1, 0, 1, '', '', '', 8, 0), (0, 'plg_editors_codemirror', 'plugin', 'codemirror', 'editors', 0, 1, 1, 0, 1, '', '{"lineNumbers":"1","lineWrapping":"1","matchTags":"1","matchBrackets":"1","marker-gutter":"1","autoCloseTags":"1","autoCloseBrackets":"1","autoFocus":"1","theme":"default","tabmode":"indent"}', '', 1, 0), (0, 'plg_editors_none', 'plugin', 'none', 'editors', 0, 1, 1, 1, 1, '', '', '', 2, 0), (0, 'plg_editors_tinymce', 'plugin', 'tinymce', 'editors', 0, 1, 1, 0, 1, '', '{"configuration":{"toolbars":{"2":{"toolbar1":["bold","underline","strikethrough","|","undo","redo","|","bullist","numlist","|","pastetext"]},"1":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","formatselect","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","code","|","hr","table","|","subscript","superscript","|","charmap","pastetext","preview"]},"0":{"menu":["edit","insert","view","format","table","tools"],"toolbar1":["bold","italic","underline","strikethrough","|","alignleft","aligncenter","alignright","alignjustify","|","styleselect","|","formatselect","fontselect","fontsizeselect","|","searchreplace","|","bullist","numlist","|","outdent","indent","|","undo","redo","|","link","unlink","anchor","image","|","code","|","forecolor","backcolor","|","fullscreen","|","table","|","subscript","superscript","|","charmap","emoticons","media","hr","ltr","rtl","|","cut","copy","paste","pastetext","|","visualchars","visualblocks","nonbreaking","blockquote","template","|","print","preview","codesample","insertdatetime","removeformat"]}},"setoptions":{"2":{"access":["1"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"1":{"access":["6","2"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"0","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""},"0":{"access":["7","4","8"],"skin":"0","skin_admin":"0","mobile":"0","drag_drop":"1","path":"","entity_encoding":"raw","lang_mode":"1","text_direction":"ltr","content_css":"1","content_css_custom":"","relative_urls":"1","newlines":"0","use_config_textfilters":"0","invalid_elements":"script,applet,iframe","valid_elements":"","extended_elements":"","resizing":"1","resize_horizontal":"1","element_path":"1","wordcount":"1","image_advtab":"1","advlist":"1","autosave":"1","contextmenu":"1","custom_plugin":"","custom_button":""}}},"sets_amount":3,"html_height":"550","html_width":"750"}', '', 3, 0), diff --git a/layouts/joomla/editors/buttons/modal.php b/layouts/joomla/editors/buttons/modal.php index e5bb55d2338..48f6c0a4419 100644 --- a/layouts/joomla/editors/buttons/modal.php +++ b/layouts/joomla/editors/buttons/modal.php @@ -28,20 +28,14 @@ $title = ($button->get('title')) ? $button->get('title') : $button->get('text'); $options = is_array($button->get('options')) ? $button->get('options') : array(); -$footer = ''; +$confirm = ''; if (is_array($button->get('options')) && isset($options['confirmText']) && isset($options['confirmCallback'])) { - $footer = ''; } -if (is_array($button->get('options')) && isset($options['applyText']) && isset($options['applyCallback'])) -{ - $footer .= ''; -} - if (null !== $button->get('id')) { $id = str_replace(' ', '', $button->get('id')); @@ -63,7 +57,7 @@ 'width' => array_key_exists('width', $options) ? $options['width'] : '800px', 'bodyHeight' => array_key_exists('bodyHeight', $options) ? $options['bodyHeight'] : '70', 'modalWidth' => array_key_exists('modalWidth', $options) ? $options['modalWidth'] : '80', - 'footer' => $footer . '' ) -); +); \ No newline at end of file diff --git a/plugins/editors-xtd/newmodule/newmodule.php b/plugins/editors-xtd/newmodule/newmodule.php deleted file mode 100644 index cc58d544f0a..00000000000 --- a/plugins/editors-xtd/newmodule/newmodule.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Factory; -use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; -use Joomla\CMS\Plugin\CMSPlugin; -use Joomla\CMS\Session\Session; - -/** - * Editor Module button - * - * @since __DEPLOY_VERSION__ - */ -class PlgButtonNewModule extends CMSPlugin -{ - /** - * Load the language file on instantiation. - * - * @var boolean - * @since __DEPLOY_VERSION__ - */ - protected $autoloadLanguage = true; - - /** - * Display the button - * - * @param string $name The name of the button to add - * - * @return CMSObject The button options as JObject - * - * @since __DEPLOY_VERSION__ - */ - public function onDisplay($name) - { - /* - * Use the built-in element view to select the module. - * Currently uses blank class. - */ - $user = Factory::getUser(); - - if ($user->authorise('core.create', 'com_modules') - || $user->authorise('core.edit', 'com_modules') - || $user->authorise('core.edit.own', 'com_modules')) - { - $link = 'index.php?option=com_modules&view=select&layout=modal&tmpl=component&editor=' - . $name . '&' . Session::getFormToken() . '=1'; - $button = new CMSObject; - $button->modal = true; - $button->link = $link; - $button->text = Text::_('PLG_NEW_MODULE_BUTTON_MODULE'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'cube'; - $button->iconSVG = ''; - $button->options = [ - 'height' => '300px', - 'width' => '800px', - 'bodyHeight' => '70', - 'modalWidth' => '80', - 'applyCallback' => 'Joomla.iframeButtonClick({iframeSelector: \'#jform_articletext_' . $button->name . '_modal\', buttonSelector: \'#applyBtn\'})', - 'applyText' => Text::_('JAPPLY'), - ]; - - return $button; - } - } -} diff --git a/plugins/editors-xtd/newmodule/newmodule.xml b/plugins/editors-xtd/newmodule/newmodule.xml deleted file mode 100644 index 3a7d39f2be1..00000000000 --- a/plugins/editors-xtd/newmodule/newmodule.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - plg_editors-xtd_newmodule - Joomla! Project - June 2021 - (C) 2021 Open Source Matters, Inc. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - __DEPLOY_VERSION__ - PLG_NEW_MODULE_XML_DESCRIPTION - - newmodule.php - - - en-GB.plg_editors-xtd_newmodule.ini - en-GB.plg_editors-xtd_newmodule.sys.ini - - From 6a539b33244c1870a55d0aa8fb37c9b29cb7f9cc Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Thu, 8 Jul 2021 20:03:29 +0530 Subject: [PATCH 33/34] add newline at the end --- layouts/joomla/editors/buttons/modal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/joomla/editors/buttons/modal.php b/layouts/joomla/editors/buttons/modal.php index 48f6c0a4419..e288d0a818f 100644 --- a/layouts/joomla/editors/buttons/modal.php +++ b/layouts/joomla/editors/buttons/modal.php @@ -60,4 +60,4 @@ 'footer' => $confirm . '' ) -); \ No newline at end of file +); From 8744b8d024a21eb776be3c205dabe5f2a1a2355f Mon Sep 17 00:00:00 2001 From: YatharthVyas Date: Mon, 12 Jul 2021 16:20:01 +0530 Subject: [PATCH 34/34] fix remove module js function --- build/media_source/com_content/js/admin-article-edit.es6.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/media_source/com_content/js/admin-article-edit.es6.js b/build/media_source/com_content/js/admin-article-edit.es6.js index 94681848900..9117083112d 100644 --- a/build/media_source/com_content/js/admin-article-edit.es6.js +++ b/build/media_source/com_content/js/admin-article-edit.es6.js @@ -56,8 +56,9 @@ const { target } = _ref; const moduleId = target.getAttribute('data-module-id'); let editorText = Joomla.editors.instances.jform_articletext.getValue(); - editorText = editorText.replace(`loadmodules ${moduleId}`, ''); + editorText = editorText.replace(`{loadmoduleid ${moduleId}}`, ''); Joomla.editors.instances.jform_articletext.setValue(editorText); + document.querySelector('.button-apply.btn.btn-success').click(); }); }); }