Release of v5.1.1-alpha5
Refactor initialization flow to accommodate future scalability and integration with all designated areas. Refactor the Creator Builders class. Refactor the FieldString and FieldXML classes.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
# v5.1.1-alpha4
|
||||
# v5.1.1-alpha5
|
||||
|
||||
- Add all needed Powers to the release package, to speed-up the build of the demo component.
|
||||
- Refactor initialization flow to accommodate future scalability and integration with all designated areas.
|
||||
- Refactor the Creator Builders class.
|
||||
- Refactor the FieldString and FieldXML classes.
|
||||
|
||||
# v5.1.1-alpha
|
||||
|
||||
@ -15,6 +17,7 @@
|
||||
- Resolves the Database Updating issue in the compiler. #1212,#1209
|
||||
- Adds the Component Commands Plugin to the CLI for Import of spreadsheet data-sets.
|
||||
- Add edit and create options to the ModalSelect Field (in Joomla 5)
|
||||
- Add all needed Powers to the release package, to speed-up the build of the demo component.
|
||||
|
||||
# v5.1.0
|
||||
|
||||
|
@ -1516,7 +1516,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
||||
|
||||
|
||||
// Fix the assets table rules column size.
|
||||
$this->setDatabaseAssetsRulesFix(95520, "MEDIUMTEXT");
|
||||
$this->setDatabaseAssetsRulesFix(98560, "MEDIUMTEXT");
|
||||
// Install the global extension params.
|
||||
$this->setExtensionsParams(
|
||||
'{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","subform_layouts":{"subform_layouts0":{"view_field":"default","layout":"repeatablejcbjfive"}},"editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","super_powers_documentation":"0","powers_repository":"0","super_powers_repositories":"0","builder_gif_size":"480-272","compiler_plugin":["componentbuilderactionlogcompiler","componentbuilderfieldorderingcompiler","componentbuilderheaderscompiler","componentbuilderpowersautoloadercompiler","componentbuilderprivacycompiler"],"add_menu_prefix":"1","menu_prefix":"»","namespace_prefix":"JCB","minify":"0","language":"en-GB","percentagelanguageadd":"30","assets_table_fix":"2","compiler_field_builder_type":"2","field_name_builder":"2","type_name_builder":"2","import_guid_only":"1","export_language_strings":"1","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_company":"Vast Development Method","export_owner":"Llewellyn van der Merwe","export_email":"joomla@vdm.io","export_website":"https://dev.vdm.io/","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":"","uikit_style":""}'
|
||||
@ -3292,7 +3292,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
||||
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
|
||||
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
|
||||
</a>
|
||||
<h3>Upgrade to Version 5.1.1-alpha4 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
||||
<h3>Upgrade to Version 5.1.1-alpha5 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
||||
|
||||
// Add/Update component in the action logs extensions table.
|
||||
$this->setActionLogsExtensions();
|
||||
|
14
README.md
14
README.md
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.1.1-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.1.1-alpha5) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,14 +144,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 30th March, 2025
|
||||
+ *Version*: 5.1.1-alpha4
|
||||
+ *Last Build*: 13th May, 2025
|
||||
+ *Version*: 5.1.1-alpha5
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **979081**
|
||||
+ *Field count*: **2098**
|
||||
+ *File count*: **6625**
|
||||
+ *Folder count*: **645**
|
||||
+ *Line count*: **1032893**
|
||||
+ *Field count*: **2099**
|
||||
+ *File count*: **7002**
|
||||
+ *Folder count*: **678**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.1.1-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.1.1-alpha5) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,14 +144,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 30th March, 2025
|
||||
+ *Version*: 5.1.1-alpha4
|
||||
+ *Last Build*: 13th May, 2025
|
||||
+ *Version*: 5.1.1-alpha5
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **979081**
|
||||
+ *Field count*: **2098**
|
||||
+ *File count*: **6625**
|
||||
+ *Folder count*: **645**
|
||||
+ *Line count*: **1032893**
|
||||
+ *Field count*: **2099**
|
||||
+ *File count*: **7002**
|
||||
+ *Folder count*: **678**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -13,6 +13,9 @@
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
||||
<action name="core.edit.created_by" title="COM_COMPONENTBUILDER_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_EDIT_CREATED_BY_DESC" />
|
||||
<action name="core.edit.created" title="COM_COMPONENTBUILDER_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="admin_view.init" title="COM_COMPONENTBUILDER_ADMIN_VIEW_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEW_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="admin_view.push" title="COM_COMPONENTBUILDER_ADMIN_VIEW_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEW_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="admin_view.reset" title="COM_COMPONENTBUILDER_ADMIN_VIEW_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEW_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="admin_view.access" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS_DESC" />
|
||||
<action name="admin_view.batch" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="admin_view.create" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE_DESC" />
|
||||
@ -230,13 +233,17 @@
|
||||
<action name="component_updates.edit.own" title="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_OWN" description="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_OWN_DESC" />
|
||||
<action name="component_updates.edit.state" title="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE" description="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE_DESC" />
|
||||
<action name="component_updates.version" title="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION" description="COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION_DESC" />
|
||||
<action name="custom_admin_view.get_snippets" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.init" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.push" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.reset" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.access" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.batch" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="custom_admin_view.dashboard_list" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST_DESC" />
|
||||
<action name="custom_admin_view.version" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC" />
|
||||
<action name="custom_admin_view.submenu" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_SUBMENU" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_SUBMENU_DESC" />
|
||||
<action name="custom_code.run_expansion" title="COM_COMPONENTBUILDER_CUSTOM_CODE_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_CODE_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_code.init" title="COM_COMPONENTBUILDER_CUSTOM_CODE_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_CODE_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_code.push" title="COM_COMPONENTBUILDER_CUSTOM_CODE_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_CODE_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_code.reset" title="COM_COMPONENTBUILDER_CUSTOM_CODE_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_CODE_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_code.access" title="COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS_DESC" />
|
||||
<action name="custom_code.batch" title="COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE" description="COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE_DESC" />
|
||||
<action name="custom_code.create" title="COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE" description="COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE_DESC" />
|
||||
@ -249,6 +256,9 @@
|
||||
<action name="custom_code.edit.state" title="COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE" description="COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE_DESC" />
|
||||
<action name="custom_code.version" title="COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION" description="COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC" />
|
||||
<action name="custom_code.submenu" title="COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU" description="COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU_DESC" />
|
||||
<action name="dynamic_get.init" title="COM_COMPONENTBUILDER_DYNAMIC_GET_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_DYNAMIC_GET_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="dynamic_get.push" title="COM_COMPONENTBUILDER_DYNAMIC_GET_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_DYNAMIC_GET_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="dynamic_get.reset" title="COM_COMPONENTBUILDER_DYNAMIC_GET_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_DYNAMIC_GET_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="dynamic_get.access" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS_DESC" />
|
||||
<action name="dynamic_get.batch" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE_DESC" />
|
||||
<action name="dynamic_get.create" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE_DESC" />
|
||||
@ -260,6 +270,9 @@
|
||||
<action name="dynamic_get.edit.state" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE_DESC" />
|
||||
<action name="dynamic_get.version" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC" />
|
||||
<action name="dynamic_get.submenu" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU_DESC" />
|
||||
<action name="field.init" title="COM_COMPONENTBUILDER_FIELD_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELD_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="field.push" title="COM_COMPONENTBUILDER_FIELD_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELD_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="field.reset" title="COM_COMPONENTBUILDER_FIELD_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELD_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="field.access" title="COM_COMPONENTBUILDER_FIELDS_ACCESS" description="COM_COMPONENTBUILDER_FIELDS_ACCESS_DESC" />
|
||||
<action name="field.batch" title="COM_COMPONENTBUILDER_FIELDS_BATCH_USE" description="COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC" />
|
||||
<action name="field.create" title="COM_COMPONENTBUILDER_FIELDS_CREATE" description="COM_COMPONENTBUILDER_FIELDS_CREATE_DESC" />
|
||||
@ -284,13 +297,6 @@
|
||||
<action name="fieldtype.edit.state" title="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE" description="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE_DESC" />
|
||||
<action name="fieldtype.version" title="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION" description="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC" />
|
||||
<action name="fieldtype.submenu" title="COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU" description="COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU_DESC" />
|
||||
<action name="get_snippets.access" title="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC" />
|
||||
<action name="get_snippets.custom_admin_views" title="COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.layouts" title="COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.libraries" title="COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.site_views" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.snippets" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.templates" title="COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC" />
|
||||
<action name="help_document.access" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC" />
|
||||
<action name="help_document.batch" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC" />
|
||||
<action name="help_document.create" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC" />
|
||||
@ -302,6 +308,9 @@
|
||||
<action name="help_document.version" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION_DESC" />
|
||||
<action name="help_document.submenu" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU_DESC" />
|
||||
<action name="joomla_component.clear_tmp" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.init" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.push" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.reset" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.access" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC" />
|
||||
<action name="joomla_component.batch" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC" />
|
||||
<action name="joomla_component.create" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC" />
|
||||
@ -419,7 +428,9 @@
|
||||
<action name="language.edit.state" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC" />
|
||||
<action name="language.version" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC" />
|
||||
<action name="language.submenu" title="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU" description="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC" />
|
||||
<action name="layout.get_snippets" title="COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="layout.init" title="COM_COMPONENTBUILDER_LAYOUT_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LAYOUT_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="layout.push" title="COM_COMPONENTBUILDER_LAYOUT_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LAYOUT_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="layout.reset" title="COM_COMPONENTBUILDER_LAYOUT_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LAYOUT_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="layout.access" title="COM_COMPONENTBUILDER_LAYOUTS_ACCESS" description="COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC" />
|
||||
<action name="layout.batch" title="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE" description="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC" />
|
||||
<action name="layout.dashboard_list" title="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST_DESC" />
|
||||
@ -455,7 +466,9 @@
|
||||
<action name="library_files_folders_urls.edit.state" title="COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE" description="COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE_DESC" />
|
||||
<action name="library_files_folders_urls.version" title="COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION" description="COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC" />
|
||||
<action name="library.submenu" title="COM_COMPONENTBUILDER_LIBRARIES_SUBMENU" description="COM_COMPONENTBUILDER_LIBRARIES_SUBMENU_DESC" />
|
||||
<action name="library.get_snippets" title="COM_COMPONENTBUILDER_LIBRARY_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LIBRARY_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="library.init" title="COM_COMPONENTBUILDER_LIBRARY_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LIBRARY_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="library.push" title="COM_COMPONENTBUILDER_LIBRARY_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LIBRARY_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="library.reset" title="COM_COMPONENTBUILDER_LIBRARY_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LIBRARY_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="placeholder.access" title="COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS" description="COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS_DESC" />
|
||||
<action name="placeholder.batch" title="COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE" description="COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE_DESC" />
|
||||
<action name="placeholder.create" title="COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE" description="COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE_DESC" />
|
||||
@ -497,6 +510,7 @@
|
||||
<action name="search.compiler" title="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC" />
|
||||
<action name="search.dashboard_list" title="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC" />
|
||||
<action name="search.submenu" title="COM_COMPONENTBUILDER_SEARCH_SUBMENU" description="COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC" />
|
||||
<action name="initialization_selection.access" title="COM_COMPONENTBUILDER_SELECTION_ACCESS" description="COM_COMPONENTBUILDER_SELECTION_ACCESS_DESC" />
|
||||
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
|
||||
<action name="server.batch" title="COM_COMPONENTBUILDER_SERVERS_BATCH_USE" description="COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC" />
|
||||
<action name="server.create" title="COM_COMPONENTBUILDER_SERVERS_CREATE" description="COM_COMPONENTBUILDER_SERVERS_CREATE_DESC" />
|
||||
@ -509,14 +523,17 @@
|
||||
<action name="server.edit.state" title="COM_COMPONENTBUILDER_SERVERS_EDIT_STATE" description="COM_COMPONENTBUILDER_SERVERS_EDIT_STATE_DESC" />
|
||||
<action name="server.version" title="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC" />
|
||||
<action name="server.submenu" title="COM_COMPONENTBUILDER_SERVERS_SUBMENU" description="COM_COMPONENTBUILDER_SERVERS_SUBMENU_DESC" />
|
||||
<action name="site_view.get_snippets" title="COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="site_view.init" title="COM_COMPONENTBUILDER_SITE_VIEW_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEW_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="site_view.push" title="COM_COMPONENTBUILDER_SITE_VIEW_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEW_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="site_view.reset" title="COM_COMPONENTBUILDER_SITE_VIEW_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEW_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="site_view.access" title="COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS_DESC" />
|
||||
<action name="site_view.batch" title="COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="site_view.dashboard_list" title="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST_DESC" />
|
||||
<action name="site_view.version" title="COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC" />
|
||||
<action name="site_view.submenu" title="COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU" description="COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU_DESC" />
|
||||
<action name="snippet.get_snippets" title="COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet.share_snippets" title="COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet.init" title="COM_COMPONENTBUILDER_SNIPPET_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet.push" title="COM_COMPONENTBUILDER_SNIPPET_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet.reset" title="COM_COMPONENTBUILDER_SNIPPET_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet_type.access" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC" />
|
||||
<action name="snippet_type.batch" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC" />
|
||||
<action name="snippet_type.create" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE_DESC" />
|
||||
@ -530,7 +547,9 @@
|
||||
<action name="snippet.dashboard_list" title="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST_DESC" />
|
||||
<action name="snippet.version" title="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC" />
|
||||
<action name="snippet.submenu" title="COM_COMPONENTBUILDER_SNIPPETS_SUBMENU" description="COM_COMPONENTBUILDER_SNIPPETS_SUBMENU_DESC" />
|
||||
<action name="template.get_snippets" title="COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="template.init" title="COM_COMPONENTBUILDER_TEMPLATE_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_TEMPLATE_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="template.push" title="COM_COMPONENTBUILDER_TEMPLATE_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_TEMPLATE_PUSH_BUTTON_ACCESS_DESC" />
|
||||
<action name="template.reset" title="COM_COMPONENTBUILDER_TEMPLATE_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_TEMPLATE_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="template.access" title="COM_COMPONENTBUILDER_TEMPLATES_ACCESS" description="COM_COMPONENTBUILDER_TEMPLATES_ACCESS_DESC" />
|
||||
<action name="template.batch" title="COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE" description="COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE_DESC" />
|
||||
<action name="template.dashboard_add" title="COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_ADD_DESC" />
|
||||
|
@ -10,4 +10,14 @@
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
html.dark .no-select,
|
||||
html.dark .no-select td {
|
||||
color: #515151;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
html.light .no-select,
|
||||
html.light .no-select td {
|
||||
color: #999;
|
||||
cursor: not-allowed;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB |
@ -1,540 +0,0 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* JS Document */
|
||||
|
||||
// start the moment the document is ready
|
||||
jQuery(document).ready(function () {
|
||||
// just get the available libraries
|
||||
getLibraries(snippetsPath);
|
||||
});
|
||||
|
||||
// add an ajax call tracker
|
||||
var ajaxcall = null;
|
||||
var fromLocal = false;
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('body').on('click','.getreaction',function(){
|
||||
// Ajax request
|
||||
var btn = jQuery(this);
|
||||
btn.prop('disabled', true);
|
||||
setTimeout(function(){
|
||||
btn.prop('disabled', false);
|
||||
}, 3000);
|
||||
var type = btn.data('type');
|
||||
if ('getLibraries' === type) {
|
||||
getLibraries(snippetsPath);
|
||||
} else if ('getSnippets' === type) {
|
||||
var name = btn.data('name');
|
||||
getSnippets(snippetsPath, name);
|
||||
} else if ('all' === type) {
|
||||
var status = btn.data('status');
|
||||
bulkSnippetGithub(status);
|
||||
} else if ('bulk' === type) {
|
||||
checkBulkSnippetGithub();
|
||||
} else if ('get' === type) {
|
||||
var path = btn.data('path');
|
||||
var status = btn.data('status');
|
||||
setSnippetGithub(path, status);
|
||||
} else {
|
||||
var path = btn.data('path');
|
||||
getSnippetModal(path, type);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// load every thing once ready
|
||||
jQuery(document).ajaxStop(function () {
|
||||
if (0 === jQuery.active) {
|
||||
//do something special
|
||||
if ('snippets' === ajaxcall) {
|
||||
setTimeout( function() {
|
||||
jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'</h1>');
|
||||
jQuery('#snippets-display').show();
|
||||
jQuery('#snippets-grid').trigger('display.uk.check');
|
||||
jQuery('#loading').hide();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// get the libraries
|
||||
function getLibraries(path) {
|
||||
var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null);
|
||||
// always hide the snippets display
|
||||
jQuery('#snippets-display').hide();
|
||||
// always reset the grid
|
||||
jQuery('#libraries-grid').html('');
|
||||
// set the ajax scope
|
||||
ajaxcall = 'libraries';
|
||||
if (_paths) {
|
||||
buildLibraries(_paths);
|
||||
} else {
|
||||
jQuery.get(path)
|
||||
.done(function(paths) {
|
||||
// load only this library paths
|
||||
jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire});
|
||||
buildLibraries(paths);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
jQuery('#snippets-github').html(returnError);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// build the ibraries object
|
||||
function buildLibraries(paths) {
|
||||
var _temp = jQuery.jStorage.get('JCB-Libraries', null);
|
||||
if (_temp) {
|
||||
setLibraries(_temp);
|
||||
} else {
|
||||
var temp = {};
|
||||
jQuery.each(paths.tree, function(key,value) {
|
||||
if (value.path.match(".json$")) {
|
||||
var libraryName = value.path.split(/ -(.+)/)[0];
|
||||
libraryName = libraryName.trim()
|
||||
temp[libraryName] = libraryName;
|
||||
}
|
||||
});
|
||||
// load only this library paths
|
||||
jQuery.jStorage.set('JCB-Libraries', temp, {TTL: expire});
|
||||
setLibraries(temp);
|
||||
}
|
||||
}
|
||||
|
||||
// set the libraries
|
||||
function setLibraries(names) {
|
||||
// now load the library buttons
|
||||
jQuery.each(names, function(value) {
|
||||
setLibrary(value);
|
||||
});
|
||||
setTimeout( function() {
|
||||
jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES')+'</h1>');
|
||||
jQuery('#libraries-display').show();
|
||||
jQuery('#libraries-grid').trigger('display.uk.check');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// set the snippets
|
||||
function setLibrary(name) {
|
||||
// get useful ID
|
||||
var keyID = getKeyID(name);
|
||||
// build the library display
|
||||
var html = '<div id="'+keyID+'-panel" class="uk-panel">';
|
||||
html += '<div class="uk-panel uk-panel-box uk-width-1-1">';
|
||||
html += '<h3 class="uk-panel-title">' + name + '</h3>';
|
||||
html += '<hr />';
|
||||
// set the data buttons
|
||||
html += setLibraryButtons(name);
|
||||
// close the box panel
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
// now we have the library
|
||||
jQuery('#libraries-grid').append(html);
|
||||
}
|
||||
|
||||
function setLibraryButtons(name) {
|
||||
return '<button class="uk-button uk-button-small uk-button-success uk-width-1-1 getreaction" data-name="'+name+'" data-type="getSnippets" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION')+'"><i class="uk-icon-thumb-tack"></i><span class="uk-hidden-small"> '+Joomla.JText._('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS')+'</span></button>';
|
||||
}
|
||||
|
||||
// get the snippets
|
||||
function getSnippets(path, libraryName) {
|
||||
jQuery('#loading').show();
|
||||
// get local values if set
|
||||
var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null);
|
||||
// always reset the grid
|
||||
jQuery('#snippets-grid').html('');
|
||||
// always hide libraries
|
||||
jQuery('#libraries-display').hide();
|
||||
// set the ajax scope
|
||||
ajaxcall = 'snippets';
|
||||
fromLocal = false;
|
||||
if (_paths) {
|
||||
setSnippets(_paths, libraryName);
|
||||
jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'</h1>');
|
||||
} else {
|
||||
jQuery.get(path)
|
||||
.done(function(paths) {
|
||||
// load only this library paths
|
||||
jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire});
|
||||
setSnippets(paths, libraryName);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
jQuery('#snippets-github').html(returnError);
|
||||
});
|
||||
}
|
||||
// only use if loading localy
|
||||
if (fromLocal) {
|
||||
jQuery('#snippets-display').show();
|
||||
jQuery('#snippets-grid').trigger('display.uk.check');
|
||||
jQuery('#loading').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// set the snippets
|
||||
function setSnippets(paths, libraryName) {
|
||||
// set the ajax scope
|
||||
ajaxcall = 'snippets';
|
||||
jQuery.each(paths.tree, function(key,value) {
|
||||
if (value.path.match(".json$") && value.path.match("^"+libraryName)) {
|
||||
var _snippet = jQuery.jStorage.get(value.path, null);
|
||||
if (_snippet) {
|
||||
setSnippet(_snippet, value.path);
|
||||
fromLocal = true;
|
||||
} else {
|
||||
jQuery.get(snippetPath+value.path)
|
||||
.done(function(snippet) {
|
||||
// convert the string to json.object
|
||||
snippet = jQuery.parseJSON(snippet);
|
||||
jQuery.jStorage.set(value.path, snippet, {TTL: expire});
|
||||
setSnippet(snippet, value.path);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
// we could do more
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// set the snippets
|
||||
function setSnippet(snippet, key) {
|
||||
// get useful ID
|
||||
var keyID = getKeyID(key);
|
||||
// get the status
|
||||
var status = getSnippetStatus(snippet, key);
|
||||
// add to bulk updater
|
||||
if ('equal' !== status) {
|
||||
bulkItems[status].push(key);
|
||||
}
|
||||
// build the snippet display
|
||||
var html = '<div id="'+keyID+'-panel" class="uk-panel" data-uk-filter="'+status+'" data-snippet-libraries="'+snippet.library+'" data-snippet-types="'+snippet.type+'" data-snippet-name="'+snippet.name+'">';
|
||||
html += '<div class="uk-panel uk-panel-box uk-width-1-1">';
|
||||
html += '<div class="uk-panel-badge uk-badge" ><a id="'+keyID+'-badge" href="#'+status+'-meaning" data-uk-offcanvas class="uk-text-uppercase uk-text-contrast"><i class="uk-icon-info"></i> '+status+'</a></div><br />';
|
||||
html += '<h3 class="uk-panel-title">' + snippet.library+ ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
|
||||
html += snippet.heading + '<hr />';
|
||||
// set the data buttons
|
||||
html += setDataButtons(snippet, key, status);
|
||||
// set the snippet ref button
|
||||
html += setRefButtons(snippet, key, status, keyID);
|
||||
// set the contributor buttons
|
||||
html += setContributorButtons(snippet, key);
|
||||
// close the box panel
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
// now we have the snippet
|
||||
jQuery('#snippets-grid').append(html);
|
||||
}
|
||||
|
||||
// set the snippet status
|
||||
function getSnippetStatus(snippet, key) {
|
||||
// check if JCB already has this snippet
|
||||
if(local_snippets.hasOwnProperty(key)){
|
||||
// first get local time stamp
|
||||
var local_created = strtotime(local_snippets[key].created);
|
||||
var local_modified = strtotime(local_snippets[key].modified);
|
||||
// now get github time stamps
|
||||
var created = strtotime(snippet.created);
|
||||
var modified = strtotime(snippet.modified);
|
||||
// work out the status
|
||||
if (local_created == created) {
|
||||
if (local_modified == modified) {
|
||||
return 'equal';
|
||||
} else if (local_modified > modified) {
|
||||
return 'ahead';
|
||||
} else if (local_modified < modified) {
|
||||
return 'behind';
|
||||
}
|
||||
}
|
||||
return 'diverged';
|
||||
}
|
||||
return 'new';
|
||||
}
|
||||
|
||||
function setDataButtons(snippet, key, status) {
|
||||
var html = '<div class="uk-button-group uk-width-1-1 uk-margin-small-bottom">';
|
||||
html += '<button class="uk-button uk-button-small uk-button-success uk-width-1-3 getreaction" data-status="'+status+'" data-path="'+key+'" data-type="usage" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION')+'"><i class="uk-icon-info"></i><span class="uk-hidden-small"> '+Joomla.JText._('COM_COMPONENTBUILDER_USAGE')+'</span></button>';
|
||||
html += '<button class="uk-button uk-button-small uk-button-success uk-width-1-3 getreaction" data-status="'+status+'" data-path="'+key+'" data-type="description" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION')+'"><i class="uk-icon-sticky-note-o"></i><span class="uk-hidden-small"> '+Joomla.JText._('COM_COMPONENTBUILDER_DESCRIPTION')+'</span></button>';
|
||||
html += '<button class="uk-button uk-button-small uk-button-success uk-width-1-3 getreaction" data-status="'+status+'" data-path="'+key+'" data-type="snippet" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION')+'"><i class="uk-icon-code"></i><span class="uk-hidden-small"> '+Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET')+'</span></button>';
|
||||
html += '</div>';
|
||||
// return data buttons
|
||||
return html;
|
||||
}
|
||||
|
||||
function setRefButtons(snippet, key, status, keyID) {
|
||||
var html = '<div><a class="uk-button uk-button-mini uk-button-success uk-margin-small-bottom uk-width-1-1" href="'+snippet.url+'" target="_blank" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL')+'"><i class="uk-icon-external-link"></i> ' + snippet.name + '</a></div>';
|
||||
// set the update button
|
||||
html += '<div>';
|
||||
if ('equal' !== status) {
|
||||
if ('new' === status) {
|
||||
var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY');
|
||||
} else {
|
||||
var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION');
|
||||
}
|
||||
html += '<button id="'+keyID+'-getbutton" class="uk-button uk-button-small uk-button-primary uk-width-1-1 uk-margin-small-bottom getreaction" data-status="'+status+'" data-path="'+key+'" data-type="get" title="'+tooltip+'"><i class="uk-icon-cloud-download"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_GET_SNIPPET')+'</button>';
|
||||
} else {
|
||||
html += '<button class="uk-button uk-button-small uk-width-1-1 uk-margin-small-bottom" type="button" disabled title="'+Joomla.JText._('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION')+'"><i class="uk-icon-check-square-o"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_LOCAL_SNIPPET')+'</button>';
|
||||
}
|
||||
html += '</div>';
|
||||
// return data buttons
|
||||
return html;
|
||||
}
|
||||
|
||||
function setContributorButtons(snippet, key) {
|
||||
// set the contributor name
|
||||
if (snippet.contributor_company) {
|
||||
var contributor_name = snippet.contributor_company;
|
||||
} else if (snippet.contributor_name) {
|
||||
var contributor_name = snippet.contributor_name;
|
||||
} else {
|
||||
var contributor_name = Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY');
|
||||
}
|
||||
// set the contributor url
|
||||
if (snippet.contributor_website) {
|
||||
var contributor_url = snippet.contributor_website;
|
||||
} else if (snippet.contributor_email) {
|
||||
var contributor_url = 'mailto:'+snippet.contributor_email;
|
||||
} else {
|
||||
var contributor_url = 'https://github.com/vdm-io/Joomla-Component-Builder-Snippets';
|
||||
}
|
||||
var html = '<div class="uk-button-group uk-width-1-1">';
|
||||
html += '<button class="uk-button uk-button-primary uk-width-1-10 uk-button-mini getreaction" data-type="contributor" data-path="'+key+'" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS')+'"><i class="uk-icon-user"></i></button>';
|
||||
html += '<a class="uk-button uk-button-primary uk-width-5-10 uk-button-mini" href="'+contributor_url+'" target="_blank" title="'+Joomla.JText._('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR')+'"><i class="uk-icon-external-link"></i> ' + contributor_name + '</a>';
|
||||
html += '<a class="uk-button uk-button-primary uk-width-4-10 uk-button-mini" href="https://github.com/vdm-io/Joomla-Component-Builder-Snippets/blame/master/'+key+'" target="_blank" title="'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET')+'"><i class="uk-icon-external-link"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_BLAME')+'</a>';
|
||||
html += '</div>';
|
||||
// return contributor buttons
|
||||
return html;
|
||||
}
|
||||
|
||||
// do a bulk update
|
||||
function checkBulkSnippetGithub() {
|
||||
// check if there is new items
|
||||
if (bulkItems.new.length === 0) {
|
||||
jQuery('#bulk-button-new').prop('disabled', true);
|
||||
jQuery('#bulk-button-new').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME'));
|
||||
jQuery('#bulk-notice-new').show();
|
||||
}
|
||||
// check if there is diverged items
|
||||
if (bulkItems.diverged.length === 0) {
|
||||
jQuery('#bulk-button-diverged').prop('disabled', true);
|
||||
jQuery('#bulk-button-diverged').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME'));
|
||||
jQuery('#bulk-notice-diverged').show();
|
||||
}
|
||||
// check if there is ahead items
|
||||
if (bulkItems.ahead.length === 0) {
|
||||
jQuery('#bulk-button-ahead').prop('disabled', true);
|
||||
jQuery('#bulk-button-ahead').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME'));
|
||||
jQuery('#bulk-notice-ahead').show();
|
||||
}
|
||||
// check if there is behind items
|
||||
if (bulkItems.behind.length === 0) {
|
||||
jQuery('#bulk-button-behind').prop('disabled', true);
|
||||
jQuery('#bulk-button-behind').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME'));
|
||||
jQuery('#bulk-notice-behind').show();
|
||||
}
|
||||
// check if all we should close the all button
|
||||
if (bulkItems.behind.length === 0 && bulkItems.new.length === 0 && bulkItems.ahead.length === 0 && bulkItems.diverged.length === 0) {
|
||||
jQuery('#bulk-button-all').prop('disabled', true);
|
||||
jQuery('#bulk-button-all').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME'));
|
||||
jQuery('#bulk-notice-all').show();
|
||||
}
|
||||
}
|
||||
|
||||
// do a bulk update
|
||||
function bulkSnippetGithub(status) {
|
||||
// if all then trigger those with values
|
||||
if ('all' === status) {
|
||||
bulkSnippetGithub('behind');
|
||||
bulkSnippetGithub('new');
|
||||
bulkSnippetGithub('ahead');
|
||||
bulkSnippetGithub('diverged');
|
||||
} else if (bulkItems[status].length > 0) {
|
||||
jQuery.each(bulkItems[status], function(i, key){
|
||||
setTimeout(function(){
|
||||
doBulkUpdate_server(key, status).done(function(result) {
|
||||
if (result.message) {
|
||||
// only show errors
|
||||
if ('error' === result.status || 'warning' === result.status) {
|
||||
UIkit.notify(result.message, {status: result.status});
|
||||
}
|
||||
// update local items
|
||||
if ('success' === result.status) {
|
||||
// get key ID
|
||||
var keyID = getKeyID(key);
|
||||
// update snippet if we can
|
||||
updateSnippetDisplay(keyID, 'equal');
|
||||
}
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'});
|
||||
}
|
||||
});
|
||||
}, 200);
|
||||
});
|
||||
// reset array
|
||||
bulkItems[status].length = 0;
|
||||
// update the buttons (since we only do the bulk update once)
|
||||
checkBulkSnippetGithub();
|
||||
}
|
||||
}
|
||||
|
||||
function doBulkUpdate_server(path, status) {
|
||||
// set the ajax scope
|
||||
ajaxcall = null;
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true");
|
||||
if (token.length > 0 && path.length > 0 && status.length > 0) {
|
||||
var request = token+'=1&path='+path+'&status='+status;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
// set the snippet from gitHub
|
||||
function setSnippetGithub(key, status) {
|
||||
var message = getConfirmUpdate(status);
|
||||
UIkit.modal.confirm(message, function(){
|
||||
// will be executed on confirm.
|
||||
setSnippetGithub_server(key, status).done(function(result) {
|
||||
if (result.message) {
|
||||
UIkit.notify(result.message, {status: result.status});
|
||||
if ('success' === result.status) {
|
||||
// get key ID
|
||||
var keyID = getKeyID(key);
|
||||
// update snippet if we can
|
||||
updateSnippetDisplay(keyID, 'equal');
|
||||
}
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setSnippetGithub_server(path, status) {
|
||||
// set the ajax scope
|
||||
ajaxcall = null;
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true");
|
||||
if (token.length > 0 && path.length > 0 && status.length > 0) {
|
||||
var request = token+'=1&path='+path+'&status='+status;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
// update the snippet display
|
||||
function updateSnippetDisplay(keyID, status) {
|
||||
// update badge
|
||||
jQuery('#'+keyID+'-badge').html('<i class="uk-icon-info"></i> ' +status);
|
||||
jQuery('#'+keyID+'-badge').attr('href' , '#'+status+'-meaning');
|
||||
// update button
|
||||
if ('equal' === status) {
|
||||
// update notice
|
||||
jQuery('#'+keyID+'-getbutton').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION'));
|
||||
jQuery('#'+keyID+'-getbutton').prop('disabled', true);
|
||||
jQuery('#'+keyID+'-getbutton').html('<i class="uk-icon-check-square-o"></i> ' + Joomla.JText._('COM_COMPONENTBUILDER_LOCAL_SNIPPET'));
|
||||
// counter delay just incase
|
||||
setTimeout(function(){
|
||||
jQuery('#'+keyID+'-getbutton').prop('disabled', true);
|
||||
}, 2000);
|
||||
}
|
||||
// update the data filter
|
||||
jQuery('#'+keyID+'-panel').attr('data-uk-filter', status);
|
||||
// tell the grid to update
|
||||
jQuery('#snippets-grid').trigger('display.uk.check');
|
||||
}
|
||||
|
||||
// set the modal
|
||||
function getSnippetModal(key, type) {
|
||||
// set the ajax scope
|
||||
ajaxcall = 'snippets';
|
||||
var _snippet = jQuery.jStorage.get(key, null);
|
||||
if (_snippet) {
|
||||
// show modal
|
||||
showSnippetModal(_snippet, type);
|
||||
} else {
|
||||
jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+key)
|
||||
.done(function(snippet) {
|
||||
// convert the string to json.object
|
||||
snippet = jQuery.parseJSON(snippet);
|
||||
jQuery.jStorage.set(key, snippet, {TTL: expire});
|
||||
// show modal
|
||||
showSnippetModal(snippet, type);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
// we could do more
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// show the modal
|
||||
function showSnippetModal(snippet, type) {
|
||||
var html = '<div class="uk-modal-dialog uk-modal-dialog-lightbox">';
|
||||
html += '<a href="" class="uk-modal-close uk-close uk-close-alt"></a>';
|
||||
html += '<h3>' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
|
||||
if ('contributor' === type) {
|
||||
html += '<dl class="uk-description-list-line">';
|
||||
html += '<dt><i class="uk-icon-institution"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_COMPANY_NAME')+'</dt>';
|
||||
html += '<dd>'+snippet.contributor_company+'</dd>';
|
||||
html += '<dt><i class="uk-icon-user"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_NAME')+'</dt>';
|
||||
html += '<dd>'+snippet.contributor_name+'</dd>';
|
||||
html += '<dt><i class="uk-icon-envelope-o"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_EMAIL')+'</dt>';
|
||||
html += '<dd>'+snippet.contributor_email+'</dd>';
|
||||
html += '<dt><i class="uk-icon-laptop"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_WEBSITE')+'</dt>';
|
||||
html += '<dd>'+snippet.contributor_website+'</dd>';
|
||||
html += '</dl>';
|
||||
} else {
|
||||
html += '<br /><textarea class="uk-width-1-1" rows="15" readonly>'+snippet[type]+'</textarea>';
|
||||
}
|
||||
html += '<br /><small>C: ' + snippet.created + ' | M: ' + snippet.modified + '</small>';
|
||||
html += '</div>';
|
||||
// get current page position
|
||||
var scroll = jQuery(window).scrollTop();
|
||||
// add html to modal
|
||||
var modal = UIkit.modal.blockUI(html, {center:true, bgclose:true}).on({
|
||||
'hide.uk.modal': function(){
|
||||
// scroll fix since the modal pops to the top of the page
|
||||
jQuery(window).scrollTop(scroll);
|
||||
}
|
||||
});
|
||||
// show modal
|
||||
modal.show();
|
||||
}
|
||||
|
||||
// get key ID
|
||||
function getKeyID(key) {
|
||||
// get useful ID
|
||||
var keyID = key.replace('-', '');
|
||||
keyID = keyID.replace('.json', '');
|
||||
keyID = keyID.replace(/\s+/ig, '-');
|
||||
keyID = keyID.replace(/\(/g, '');
|
||||
keyID = keyID.replace(/\)/g, '');
|
||||
// return the id build
|
||||
return keyID;
|
||||
}
|
||||
// get key ID
|
||||
function getKeyID(key) {
|
||||
// get useful ID
|
||||
var keyID = key.replace('-', '');
|
||||
keyID = keyID.replace('.json', '');
|
||||
keyID = keyID.replace(/\s+/ig, '-');
|
||||
keyID = keyID.replace(/\(/g, '');
|
||||
keyID = keyID.replace(/\)/g, '');
|
||||
// return the id build
|
||||
return keyID;
|
||||
}
|
395
admin/assets/js/initialization_selection.js
Normal file
395
admin/assets/js/initialization_selection.js
Normal file
@ -0,0 +1,395 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* JS Document */
|
||||
|
||||
const memoryinitialization = [];
|
||||
|
||||
function setSessionMemory(key, values, merge = true) {
|
||||
if (merge) {
|
||||
values = mergeSessionMemory(key, values);
|
||||
} else {
|
||||
values = JSON.stringify(values);
|
||||
}
|
||||
|
||||
if (typeof Storage !== "undefined") {
|
||||
sessionStorage.setItem(key, values);
|
||||
} else {
|
||||
memoryinitialization[key] = values;
|
||||
}
|
||||
}
|
||||
|
||||
function mergeSessionMemory(key, values) {
|
||||
const oldValues = getSessionMemory(key);
|
||||
|
||||
if (oldValues) {
|
||||
values = { ...oldValues, ...values };
|
||||
}
|
||||
|
||||
return JSON.stringify(values);
|
||||
}
|
||||
|
||||
function getSessionMemory(key, defaultValue = null) {
|
||||
if (typeof Storage !== "undefined") {
|
||||
const localValue = sessionStorage.getItem(key);
|
||||
|
||||
if (isJsonString(localValue)) {
|
||||
defaultValue = JSON.parse(localValue);
|
||||
}
|
||||
} else if (typeof memoryinitialization[key] !== "undefined") {
|
||||
const localValue = memoryinitialization[key];
|
||||
|
||||
if (isJsonString(localValue)) {
|
||||
defaultValue = JSON.parse(localValue);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
function isJsonString(str) {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getArrayFormat(items) {
|
||||
// Check if items is an object and not an array
|
||||
if (typeof items === 'object' && !Array.isArray(items)) {
|
||||
return Object.values(items);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
class InitializationManager {
|
||||
#repoArea = document.getElementById('select-repo-area');
|
||||
#powersArea = document.getElementById('select-powers-area');
|
||||
#initButton = document.getElementById('init-selected-powers');
|
||||
#backButton = document.getElementById('back-to-select-repo');
|
||||
#loadingDiv = window.loadingDiv || null;
|
||||
#buildTable = typeof buildPowerSelectionTable === 'function' ? buildPowerSelectionTable : null;
|
||||
#drawTable = typeof drawPowerSelectionTable === 'function' ? drawPowerSelectionTable : null;
|
||||
|
||||
currentRepo = null;
|
||||
currentArea = null;
|
||||
|
||||
constructor() {
|
||||
this._bindRepoButtons();
|
||||
this._bindInitSelectedPowers();
|
||||
this._updateInitButtonState();
|
||||
}
|
||||
|
||||
/** Getter for selected items using global window reference. */
|
||||
get selectedItems() {
|
||||
if (!Array.isArray(window.selectedPowerItems)) {
|
||||
window.selectedPowerItems = [];
|
||||
}
|
||||
return window.selectedPowerItems;
|
||||
}
|
||||
|
||||
/** Setter for selected items with sync to window and button state update. */
|
||||
set selectedItems(items) {
|
||||
window.selectedPowerItems = items;
|
||||
this._updateInitButtonState();
|
||||
}
|
||||
|
||||
/** Add items to selection if not already selected. */
|
||||
addSelectedItems(data) {
|
||||
if (!data || typeof data.length !== 'number') return;
|
||||
|
||||
const updated = [...this.selectedItems];
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i];
|
||||
if (!updated.some(existing => this.#isSameItem(existing, item))) {
|
||||
updated.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
this.selectedItems = updated;
|
||||
}
|
||||
|
||||
/** Remove items from selection based on identity comparison. */
|
||||
removeSelectedItems(data) {
|
||||
if (!data || typeof data.length !== 'number') return;
|
||||
|
||||
const updated = this.selectedItems.filter(existing => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (this.#isSameItem(existing, data[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
this.selectedItems = updated;
|
||||
}
|
||||
|
||||
/** Check if two items are the same using GUID. */
|
||||
#isSameItem(a, b) {
|
||||
return a?.guid && b?.guid && a.guid === b.guid;
|
||||
}
|
||||
|
||||
/** Enable/disable the init button based on selection state. */
|
||||
_updateInitButtonState() {
|
||||
if (this.#initButton) {
|
||||
this.#initButton.disabled = this.selectedItems.length === 0;
|
||||
}
|
||||
}
|
||||
|
||||
_bindRepoButtons() {
|
||||
document.querySelectorAll('.select-repo-to-initialize').forEach(button => {
|
||||
button.addEventListener('click', (e) => this._handleRepoClick(e));
|
||||
});
|
||||
}
|
||||
|
||||
_bindInitSelectedPowers() {
|
||||
if (this.#initButton) {
|
||||
this.#initButton.addEventListener('click', () => this._handleInitSelectedPowers());
|
||||
}
|
||||
if (this.#backButton) {
|
||||
this.#backButton.addEventListener('click', () => this._handleBackToRepos());
|
||||
}
|
||||
}
|
||||
|
||||
async _handleRepoClick(event) {
|
||||
const button = event.currentTarget;
|
||||
const repo = button?.dataset?.repo;
|
||||
const area = button?.dataset?.area;
|
||||
|
||||
if (!repo || !area) {
|
||||
this._notify(Joomla.Text._("COM_COMPONENTBUILDER_MISSING_REPOSITORY_OR_AREA_DATA"), "danger");
|
||||
return;
|
||||
}
|
||||
|
||||
this._showLoading();
|
||||
clearPowerSelectionTable();
|
||||
|
||||
const url = `${UrlAjax}getRepoIndex&repo=${encodeURIComponent(repo)}&area=${encodeURIComponent(area)}`;
|
||||
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success && data.index && this.#buildTable) {
|
||||
const repoData = data.index[0];
|
||||
|
||||
const repoBase = repoData.base || 'https://git.vdm.dev';
|
||||
const repoPath = repoData.path || 'joomla/super-powers';
|
||||
const repoBranch = repoData.read_branch || 'master';
|
||||
|
||||
window.targetPowerRepoUrl = `${repoBase}/${repoPath}/src/branch/${repoBranch}/`;
|
||||
|
||||
this.#buildTable(repoData.index);
|
||||
|
||||
setTimeout(() => {
|
||||
this._transitionTo(this.#repoArea, this.#powersArea);
|
||||
this._hideLoading();
|
||||
}, 500);
|
||||
|
||||
this.currentRepo = repoData.guid;
|
||||
this.currentArea = area;
|
||||
} else {
|
||||
this._notify(data.message || Joomla.Text._("COM_COMPONENTBUILDER_FAILED_TO_RETRIEVE_REPOSITORY_INDEX"), "danger");
|
||||
this._hideLoading();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fetch error:", error);
|
||||
this._hideLoading();
|
||||
this._notify(Joomla.Text._("COM_COMPONENTBUILDER_NETWORK_OR_SERVER_ERROR_OCCURRED_WHILE_FETCHING_INDEX"), "danger");
|
||||
}
|
||||
}
|
||||
|
||||
_handleBackToRepos() {
|
||||
this._transitionTo(this.#powersArea, this.#repoArea);
|
||||
}
|
||||
|
||||
async _handleInitSelectedPowers() {
|
||||
if (!Array.isArray(this.selectedItems) || this.selectedItems.length === 0) {
|
||||
this._notify(Joomla.Text._("COM_COMPONENTBUILDER_NO_ITEMS_SELECTED"), "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
this._showLoading();
|
||||
|
||||
const area = this.currentArea || 'error';
|
||||
const repo = this.currentRepo || 'error';
|
||||
|
||||
try {
|
||||
// Convert selected items to form data
|
||||
const formData = new FormData();
|
||||
|
||||
// Assuming Joomla expects `selected[]` for multiple values
|
||||
for (const item of this.selectedItems) {
|
||||
formData.append('selected[]', item.guid); // Only sending GUIDs
|
||||
}
|
||||
formData.append('area', area);
|
||||
formData.append('repo', repo);
|
||||
|
||||
const response = await fetch(`${UrlAjax}initSelectedPowers`, {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
this._notify(data.message || Joomla.Text._("COM_COMPONENTBUILDER_FAILED_TO_INITIALIZE_SELECTED_POWERS"), "danger");
|
||||
} else {
|
||||
this._handleResultLog(data.result_log || {});
|
||||
}
|
||||
|
||||
this._hideLoading();
|
||||
this._transitionTo(this.#powersArea, this.#repoArea);
|
||||
} catch (error) {
|
||||
console.error("Submission error:", error);
|
||||
this._notify(Joomla.Text._("COM_COMPONENTBUILDER_ERROR_OCCURRED_WHILE_INITIALIZING_POWERS"), "danger");
|
||||
|
||||
this._hideLoading();
|
||||
this._transitionTo(this.#powersArea, this.#repoArea);
|
||||
}
|
||||
}
|
||||
|
||||
_handleResultLog(resultLog) {
|
||||
const localGuids = this._normalizeGuids(resultLog.local);
|
||||
const notFoundGuids = this._normalizeGuids(resultLog.not_found);
|
||||
const addedGuids = this._normalizeGuids(resultLog.added);
|
||||
|
||||
if (localGuids.length > 0) {
|
||||
this._notify(
|
||||
this._generateResultMessage(localGuids, 'local'),
|
||||
'info'
|
||||
);
|
||||
}
|
||||
|
||||
if (notFoundGuids.length > 0) {
|
||||
this._notify(
|
||||
this._generateResultMessage(notFoundGuids, 'not_found'),
|
||||
'info'
|
||||
);
|
||||
}
|
||||
|
||||
if (addedGuids.length > 0) {
|
||||
this._notify(
|
||||
this._generateResultMessage(addedGuids, 'added'),
|
||||
'success'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_normalizeGuids(value) {
|
||||
if (!value) return [];
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === 'object') {
|
||||
return Object.keys(value);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
_generateResultMessage(guids, type) {
|
||||
const messages = {
|
||||
local: Joomla.Text._('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_ALREADY_PRESENT_LOCALLY_AND_WERE_NOT_INITIALIZED'),
|
||||
not_found: Joomla.Text._('COM_COMPONENTBUILDER_THESE_ITEMS_COULD_NOT_BE_FOUND_IN_THE_REMOTE_REPOSITORY_AND_WERE_NOT_INITIALIZED'),
|
||||
added: Joomla.Text._('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_SUCCESSFULLY_INITIALIZED')
|
||||
};
|
||||
|
||||
const names = [];
|
||||
|
||||
for (const guid of guids) {
|
||||
const item = this.selectedItems.find(i => i.guid === guid);
|
||||
if (item?.name) {
|
||||
names.push(item.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (names.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `${messages[type]}\n<br>- ${names.join('\n<br>- ')}`;
|
||||
}
|
||||
|
||||
_transitionTo(hideEl, showEl) {
|
||||
if (hideEl && showEl) {
|
||||
UIkit.util.ready(() => {
|
||||
UIkit.util.removeClass(hideEl, 'uk-animation-slide-top-small');
|
||||
UIkit.util.removeClass(showEl, 'uk-animation-slide-bottom-small');
|
||||
UIkit.util.addClass(hideEl, 'uk-animation-slide-top-small');
|
||||
|
||||
setTimeout(() => {
|
||||
hideEl.style.display = 'none';
|
||||
showEl.style.display = '';
|
||||
UIkit.util.addClass(showEl, 'uk-animation-slide-bottom-small');
|
||||
if (this.#drawTable) this.#drawTable();
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_showLoading() {
|
||||
if (this.#loadingDiv) this.#loadingDiv.style.display = 'block';
|
||||
}
|
||||
|
||||
_hideLoading() {
|
||||
if (this.#loadingDiv) this.#loadingDiv.style.display = 'none';
|
||||
}
|
||||
|
||||
_notify(message, type = 'info') {
|
||||
const alertTypes = {
|
||||
primary: 'alert-primary',
|
||||
info: 'alert-info',
|
||||
success: 'alert-success',
|
||||
warning: 'alert-warning',
|
||||
danger: 'alert-danger',
|
||||
};
|
||||
|
||||
const alertClass = alertTypes[type] || alertTypes.primary;
|
||||
|
||||
let container = document.getElementById('alert-container');
|
||||
if (!container) {
|
||||
container = document.createElement('div');
|
||||
container.id = 'alert-container';
|
||||
container.className = 'position-fixed top-0 start-50 translate-middle-x p-3';
|
||||
container.style.zIndex = '1060';
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
const alert = document.createElement('div');
|
||||
alert.className = `alert ${alertClass} alert-dismissible fade show`;
|
||||
alert.setAttribute('role', 'alert');
|
||||
alert.innerHTML = `
|
||||
${message}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
`;
|
||||
|
||||
container.appendChild(alert);
|
||||
|
||||
setTimeout(() => {
|
||||
alert.classList.remove('show');
|
||||
alert.classList.add('hide');
|
||||
alert.addEventListener('transitionend', () => {
|
||||
alert.remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ const doSearch = async (signal, tables) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
UIkit.notify(Joomla.Text._('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
@ -116,11 +116,11 @@ const doSearch = async (signal, tables) => {
|
||||
searchProgressBarObject.innerHTML = percent.toFixed(2) + '%';
|
||||
// when complete hide the progress bar
|
||||
if (progress == total) {
|
||||
let total_field_line = ' ' + fieldCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_FIELDS_THAT_HAD') + ' ' + lineCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_LINES') + ' ';
|
||||
let total_field_line = ' ' + fieldCount + ' ' + Joomla.Text._('COM_COMPONENTBUILDER_FIELDS_THAT_HAD') + ' ' + lineCount + ' ' + Joomla.Text._('COM_COMPONENTBUILDER_LINES') + ' ';
|
||||
if (progress == 1) {
|
||||
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + tableName + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
|
||||
searchProgressBarObject.innerHTML = Joomla.Text._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + tableName + total_field_line + Joomla.Text._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.Text._('COM_COMPONENTBUILDER_SECONDS');
|
||||
} else {
|
||||
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + progress + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLES_WITH') + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
|
||||
searchProgressBarObject.innerHTML = Joomla.Text._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + progress + ' ' + Joomla.Text._('COM_COMPONENTBUILDER_TABLES_WITH') + total_field_line + Joomla.Text._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.Text._('COM_COMPONENTBUILDER_SECONDS');
|
||||
}
|
||||
// show the search button
|
||||
startSearchButton.style.display = '';
|
||||
@ -235,11 +235,11 @@ const replaceAllCheck = () => {
|
||||
let searchValue = searchObject.value;
|
||||
let replaceValue = replaceObject.value;
|
||||
// load question
|
||||
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_BALLB_VALUES_THAT_CAN_BE_FOUND_IN_THE_DATABASE') + '<br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_YOU_WILL_REPLACE') + ': [<span class="found_code">' + htmlentities(searchValue) + '</span>] ' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_WITH') + ': [<span class="found_code">' + htmlentities(replaceValue) + '</span>]<br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB') + '<br /><br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
|
||||
let question = Joomla.Text._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_BALLB_VALUES_THAT_CAN_BE_FOUND_IN_THE_DATABASE') + '<br />' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_YOU_WILL_REPLACE') + ': [<span class="found_code">' + htmlentities(searchValue) + '</span>] ' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_WITH') + ': [<span class="found_code">' + htmlentities(replaceValue) + '</span>]<br />' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB') + '<br /><br />' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
|
||||
// do check
|
||||
UIkit.modal.confirm(question, function () {
|
||||
|
||||
@ -258,7 +258,7 @@ const replaceAllCheck = () => {
|
||||
} else {
|
||||
replaceAll(controller_replace.signal, searchTables);
|
||||
}
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES_UPDATE_ALL'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.Text._('COM_COMPONENTBUILDER_YES_UPDATE_ALL'), Cancel: Joomla.Text._('COM_COMPONENTBUILDER_NO') }});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -321,7 +321,7 @@ const replaceAll = async (signal, tables) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
UIkit.notify(Joomla.Text._('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
@ -343,22 +343,22 @@ const replaceAll = async (signal, tables) => {
|
||||
// if not reqex we reverse the search for you so you can see the update was a success
|
||||
if (regexValue == 0) {
|
||||
// set the replace value as the search value
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH'), function(){
|
||||
UIkit.modal.confirm(Joomla.Text._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH'), function(){
|
||||
startNewSearch(replaceValue, searchValue, matchValue, wholeValue, regexValue, 2);
|
||||
}, function () {
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
UIkit.modal.confirm(Joomla.Text._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
startSearch();
|
||||
}, function () {
|
||||
clearSearch();
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.Text._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.Text._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.Text._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.Text._('COM_COMPONENTBUILDER_NO') }});
|
||||
} else {
|
||||
// else we search it again just to prove its changed
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
UIkit.modal.confirm(Joomla.Text._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
startSearch();
|
||||
}, function () {
|
||||
clearSearch();
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.Text._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.Text._('COM_COMPONENTBUILDER_NO') }});
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
@ -381,13 +381,13 @@ const replaceAll = async (signal, tables) => {
|
||||
*/
|
||||
const setValueCheck = (row, field, table) => {
|
||||
// load question
|
||||
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW') + ' (' + row + ') -> (' + field + ') ' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_FIELD_IN_THE') + ' (' + table + ') ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLE') + '.<br /><br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE');
|
||||
let question = Joomla.Text._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW') + ' (' + row + ') -> (' + field + ') ' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_FIELD_IN_THE') + ' (' + table + ') ' + Joomla.Text._('COM_COMPONENTBUILDER_TABLE') + '.<br /><br />' +
|
||||
Joomla.Text._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE');
|
||||
// do check
|
||||
UIkit.modal.confirm(question, function () {
|
||||
setValue(row, field, table);
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.Text._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.Text._('COM_COMPONENTBUILDER_NO') }});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 64 KiB |
BIN
admin/compiler/joomla_4/ajax.gif
Normal file
BIN
admin/compiler/joomla_4/ajax.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
Before Width: | Height: | Size: 65 KiB |
@ -252,8 +252,8 @@
|
||||
"newName": "HeaderCheck.php",
|
||||
"type": "file"
|
||||
},
|
||||
"import.gif": {
|
||||
"naam": "import.gif",
|
||||
"ajax.gif": {
|
||||
"naam": "ajax.gif",
|
||||
"path": "c0mp0n3nt/admin/assets/images",
|
||||
"rename": false,
|
||||
"type": "file"
|
||||
|
@ -332,15 +332,30 @@
|
||||
hint="COM_COMPONENTBUILDER_DYNAMIC_GET_DB_SELECTION_HINT"
|
||||
required="true"
|
||||
/>
|
||||
<!-- View_table_main Field. Type: Adminviews. (custom) -->
|
||||
<!-- View_table_main Field. Type: Modalselect. (custom) -->
|
||||
<field
|
||||
type="adminviews"
|
||||
type="ModalSelect"
|
||||
name="view_table_main"
|
||||
label="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_LABEL"
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_DESCRIPTION"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
sql_title_table="#__componentbuilder_admin_view"
|
||||
sql_title_column="system_name"
|
||||
data-key-name="guid"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=admin_views&layout=modal&tmpl=component&titleKey=guid"
|
||||
urlNew="index.php?option=com_componentbuilder&task=admin_view.add&layout=modal&tmpl=component"
|
||||
urlEdit="index.php?option=com_componentbuilder&task=admin_view.edit&guid={id}&layout=modal&tmpl=component&titleKey=guid"
|
||||
titleSelect="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_TITLESELECT"
|
||||
titleNew="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_TITLENEW"
|
||||
titleEdit="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_TITLEEDIT"
|
||||
iconSelect="icon-stack"
|
||||
select="true"
|
||||
new="true"
|
||||
edit="true"
|
||||
clear="true"
|
||||
required="true"
|
||||
class="input-large"
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_DESCRIPTION"
|
||||
hint="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_HINT"
|
||||
/>
|
||||
<!-- Add_php_getlistquery Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
@ -1235,15 +1250,28 @@
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_VIEW_TABLE_DESCRIPTION"
|
||||
icon="list">
|
||||
<form hidden="true" name="list_join_view_table_modal" repeat="true">
|
||||
<!-- View_table Field. Type: Adminviews. (custom) -->
|
||||
<!-- View_table Field. Type: Modalselect. (custom) -->
|
||||
<field
|
||||
type="adminviews"
|
||||
type="ModalSelect"
|
||||
name="view_table"
|
||||
label="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_DESCRIPTION"
|
||||
multiple="false"
|
||||
sql_title_table="#__componentbuilder_admin_view"
|
||||
sql_title_column="system_name"
|
||||
data-key-name="guid"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=admin_views&layout=modal&tmpl=component&titleKey=guid"
|
||||
urlEdit="index.php?option=com_componentbuilder&task=admin_view.edit&guid={id}&layout=modal&tmpl=component&titleKey=guid"
|
||||
titleSelect="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_TITLESELECT"
|
||||
titleEdit="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_TITLEEDIT"
|
||||
iconSelect="icon-stack"
|
||||
select="true"
|
||||
new="false"
|
||||
edit="true"
|
||||
clear="true"
|
||||
required="true"
|
||||
button="false"
|
||||
class="input-large"
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_DESCRIPTION"
|
||||
hint="COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_HINT"
|
||||
/>
|
||||
<!-- Row_type Field. Type: List. (joomla) -->
|
||||
<field
|
||||
|
@ -31,14 +31,36 @@
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
<field
|
||||
type="snippettype"
|
||||
type="ModalSelect"
|
||||
sql_title_table="#__componentbuilder_snippet_type"
|
||||
sql_title_column="name"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=snippet_types&layout=modal&tmpl=component&titleKey=guid"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_TYPE_HINT"
|
||||
titleSelect="COM_COMPONENTBUILDER_SNIPPET_TYPE_TITLESELECT"
|
||||
iconSelect="icon-copy"
|
||||
select="true"
|
||||
edit="false"
|
||||
clear="true"
|
||||
onchange="form.submit()"
|
||||
name="type"
|
||||
label="COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL"
|
||||
multiple="false"
|
||||
class="js-select-submit-on-change"
|
||||
/>
|
||||
<field
|
||||
type="library"
|
||||
type="ModalSelect"
|
||||
sql_title_table="#__componentbuilder_library"
|
||||
sql_title_column="name"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=libraries&layout=modal&tmpl=component&titleKey=guid"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_HINT"
|
||||
titleSelect="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_TITLESELECT"
|
||||
iconSelect="icon-copy"
|
||||
select="true"
|
||||
edit="false"
|
||||
clear="true"
|
||||
onchange="form.submit()"
|
||||
name="library"
|
||||
label="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL"
|
||||
multiple="false"
|
||||
|
@ -982,7 +982,6 @@
|
||||
class="fieldMedium"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
default=""
|
||||
/>
|
||||
<!-- Spacer_hr_7 Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_7" hr="true" class="spacer_hr_7" />
|
||||
|
@ -111,6 +111,32 @@
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_HINT"
|
||||
/>
|
||||
<!-- Guid Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="guid"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_LABEL"
|
||||
size="40"
|
||||
maxlength="40"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="CMD"
|
||||
validate="guid"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_HINT"
|
||||
/>
|
||||
<!-- Description Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="description"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_LABEL"
|
||||
rows="11"
|
||||
cols="10"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_HINT"
|
||||
/>
|
||||
<!-- Settings Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
@ -161,32 +187,6 @@
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Guid Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="guid"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_LABEL"
|
||||
size="40"
|
||||
maxlength="40"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="CMD"
|
||||
validate="guid"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_HINT"
|
||||
/>
|
||||
<!-- Description Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="description"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_LABEL"
|
||||
rows="11"
|
||||
cols="10"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
|
@ -392,7 +392,7 @@
|
||||
default="一_一"
|
||||
/>
|
||||
<!-- Note_approved_paths Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" showon="approved:1" />
|
||||
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" />
|
||||
<!-- Property_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
|
@ -154,12 +154,16 @@
|
||||
<!-- Option Set. -->
|
||||
<option value="">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER</option>
|
||||
<option value="4">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JCB_PACKAGES</option>
|
||||
<option value="3">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER</option>
|
||||
<option value="5">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_SNIPPETS</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER</option>
|
||||
</field>
|
||||
<!-- Type Field. Type: List. (joomla) -->
|
||||
<field
|
||||
|
@ -129,16 +129,30 @@
|
||||
message="COM_COMPONENTBUILDER_SNIPPET_URL_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_URL_HINT"
|
||||
/>
|
||||
<!-- Type Field. Type: Snippettype. (custom) -->
|
||||
<!-- Type Field. Type: Modalselect. (custom) -->
|
||||
<field
|
||||
type="snippettype"
|
||||
type="ModalSelect"
|
||||
name="type"
|
||||
label="COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION"
|
||||
class="list_class"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
sql_title_table="#__componentbuilder_snippet_type"
|
||||
sql_title_column="name"
|
||||
data-key-name="guid"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=snippet_types&layout=modal&tmpl=component&titleKey=guid"
|
||||
urlNew="index.php?option=com_componentbuilder&task=snippet_type.add&layout=modal&tmpl=component"
|
||||
urlEdit="index.php?option=com_componentbuilder&task=snippet_type.edit&guid={id}&layout=modal&tmpl=component&titleKey=guid"
|
||||
titleSelect="COM_COMPONENTBUILDER_SNIPPET_TYPE_TITLESELECT"
|
||||
titleNew="COM_COMPONENTBUILDER_SNIPPET_TYPE_TITLENEW"
|
||||
titleEdit="COM_COMPONENTBUILDER_SNIPPET_TYPE_TITLEEDIT"
|
||||
iconSelect="icon-copy"
|
||||
select="true"
|
||||
new="true"
|
||||
edit="true"
|
||||
clear="true"
|
||||
required="true"
|
||||
class="input-large"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_TYPE_HINT"
|
||||
/>
|
||||
<!-- Heading Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
@ -154,18 +168,30 @@
|
||||
message="COM_COMPONENTBUILDER_SNIPPET_HEADING_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_HEADING_HINT"
|
||||
/>
|
||||
<!-- Library Field. Type: Library. (custom) -->
|
||||
<!-- Library Field. Type: Modalselect. (custom) -->
|
||||
<field
|
||||
type="library"
|
||||
type="ModalSelect"
|
||||
name="library"
|
||||
label="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_DESCRIPTION"
|
||||
class="list_class"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
default="0"
|
||||
sql_title_table="#__componentbuilder_library"
|
||||
sql_title_column="name"
|
||||
data-key-name="guid"
|
||||
sql_title_key="guid"
|
||||
urlSelect="index.php?option=com_componentbuilder&view=libraries&layout=modal&tmpl=component&titleKey=guid"
|
||||
urlNew="index.php?option=com_componentbuilder&task=library.add&layout=modal&tmpl=component"
|
||||
urlEdit="index.php?option=com_componentbuilder&task=library.edit&guid={id}&layout=modal&tmpl=component&titleKey=guid"
|
||||
titleSelect="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_TITLESELECT"
|
||||
titleNew="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_TITLENEW"
|
||||
titleEdit="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_TITLEEDIT"
|
||||
iconSelect="icon-copy"
|
||||
select="true"
|
||||
new="true"
|
||||
edit="true"
|
||||
clear="true"
|
||||
required="true"
|
||||
button="true"
|
||||
class="input-large"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_DESCRIPTION"
|
||||
hint="COM_COMPONENTBUILDER_SNIPPET_LIBRARY_HINT"
|
||||
/>
|
||||
<!-- Guid Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -103,6 +103,12 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION="Admin Views Edit Version"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admin views"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_SUBMENU="Admin Views Submenu"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_SUBMENU_DESC="Allows the users in this group to submenu of admin view"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_INIT_BUTTON_ACCESS="Admin View Init Button Access"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_PUSH_BUTTON_ACCESS="Admin View Push Button Access"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_RESET_BUTTON_ACCESS="Admin View Reset Button Access"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS="Class Extendings Access"
|
||||
COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS_DESC="Allows the users in this group to access access class extendings"
|
||||
COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE="Class Extendings Batch Use"
|
||||
@ -454,8 +460,12 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION="Custom Admin Views Edit Ve
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom admin views"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_SUBMENU="Custom Admin Views Submenu"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_SUBMENU_DESC="Allows the users in this group to submenu of custom admin view"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS="Custom Admin View Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_INIT_BUTTON_ACCESS="Custom Admin View Init Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PUSH_BUTTON_ACCESS="Custom Admin View Push Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_RESET_BUTTON_ACCESS="Custom Admin View Reset Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS="Custom Codes Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS_DESC="Allows the users in this group to access access custom codes"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE="Custom Codes Batch Use"
|
||||
@ -480,8 +490,12 @@ COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION="Custom Codes Edit Version"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom codes"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU="Custom Codes Submenu"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU_DESC="Allows the users in this group to submenu of custom code"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_RUN_EXPANSION_BUTTON_ACCESS="Custom Code Run Expansion Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_INIT_BUTTON_ACCESS="Custom Code Init Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_PUSH_BUTTON_ACCESS="Custom Code Push Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_RESET_BUTTON_ACCESS="Custom Code Reset Button Access"
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS="Dynamic Gets Access"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS_DESC="Allows the users in this group to access access dynamic gets"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE="Dynamic Gets Batch Use"
|
||||
@ -504,6 +518,12 @@ COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION="Dynamic Gets Edit Version"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version dynamic gets"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU="Dynamic Gets Submenu"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU_DESC="Allows the users in this group to submenu of dynamic get"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_INIT_BUTTON_ACCESS="Dynamic Get Init Button Access"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_PUSH_BUTTON_ACCESS="Dynamic Get Push Button Access"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_RESET_BUTTON_ACCESS="Dynamic Get Reset Button Access"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_EDIT_CREATED_BY="Edit Created By"
|
||||
COM_COMPONENTBUILDER_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by."
|
||||
COM_COMPONENTBUILDER_EDIT_CREATED_DATE="Edit Created Date"
|
||||
@ -558,20 +578,12 @@ COM_COMPONENTBUILDER_FIELDTYPE_PUSH_BUTTON_ACCESS="Fieldtype Push Button Access"
|
||||
COM_COMPONENTBUILDER_FIELDTYPE_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_FIELDTYPE_RESET_BUTTON_ACCESS="Fieldtype Reset Button Access"
|
||||
COM_COMPONENTBUILDER_FIELDTYPE_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC="Allows the users in this group to access get snippets."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS="Get Snippets Custom Admin Views Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC="Allows the users in this group to access the custom admin views button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS="Get Snippets Layouts Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC="Allows the users in this group to access the layouts button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS="Get Snippets Libraries Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the libraries button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS="Get Snippets Site Views Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC="Allows the users in this group to access the site views button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the snippets button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS="Get Snippets Templates Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC="Allows the users in this group to access the templates button."
|
||||
COM_COMPONENTBUILDER_FIELD_INIT_BUTTON_ACCESS="Field Init Button Access"
|
||||
COM_COMPONENTBUILDER_FIELD_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_FIELD_PUSH_BUTTON_ACCESS="Field Push Button Access"
|
||||
COM_COMPONENTBUILDER_FIELD_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_FIELD_RESET_BUTTON_ACCESS="Field Reset Button Access"
|
||||
COM_COMPONENTBUILDER_FIELD_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
|
||||
@ -618,6 +630,12 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU="Joomla Components Submenu"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC="Allows the users in this group to submenu of joomla component"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS="Joomla Component Clear tmp Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS_DESC="Allows the users in this group to access the clear tmp button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INIT_BUTTON_ACCESS="Joomla Component Init Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUSH_BUTTON_ACCESS="Joomla Component Push Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RESET_BUTTON_ACCESS="Joomla Component Reset Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS="Joomla Modules Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS_DESC="Allows the users in this group to access access joomla modules"
|
||||
COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE="Joomla Modules Batch Use"
|
||||
@ -848,8 +866,12 @@ COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION="Layouts Edit Version"
|
||||
COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version layouts"
|
||||
COM_COMPONENTBUILDER_LAYOUTS_SUBMENU="Layouts Submenu"
|
||||
COM_COMPONENTBUILDER_LAYOUTS_SUBMENU_DESC="Allows the users in this group to submenu of layout"
|
||||
COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS="Layout Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_LAYOUT_INIT_BUTTON_ACCESS="Layout Init Button Access"
|
||||
COM_COMPONENTBUILDER_LAYOUT_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_LAYOUT_PUSH_BUTTON_ACCESS="Layout Push Button Access"
|
||||
COM_COMPONENTBUILDER_LAYOUT_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_LAYOUT_RESET_BUTTON_ACCESS="Layout Reset Button Access"
|
||||
COM_COMPONENTBUILDER_LAYOUT_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_LIBRARIES_ACCESS="Libraries Access"
|
||||
COM_COMPONENTBUILDER_LIBRARIES_ACCESS_DESC="Allows the users in this group to access access libraries"
|
||||
COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE="Libraries Batch Use"
|
||||
@ -910,8 +932,12 @@ COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION="Libraries Files
|
||||
COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries files folders urls"
|
||||
COM_COMPONENTBUILDER_LIBRARIES_SUBMENU="Libraries Submenu"
|
||||
COM_COMPONENTBUILDER_LIBRARIES_SUBMENU_DESC="Allows the users in this group to submenu of library"
|
||||
COM_COMPONENTBUILDER_LIBRARY_GET_SNIPPETS_BUTTON_ACCESS="Library Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_LIBRARY_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_LIBRARY_INIT_BUTTON_ACCESS="Library Init Button Access"
|
||||
COM_COMPONENTBUILDER_LIBRARY_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_LIBRARY_PUSH_BUTTON_ACCESS="Library Push Button Access"
|
||||
COM_COMPONENTBUILDER_LIBRARY_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_LIBRARY_RESET_BUTTON_ACCESS="Library Reset Button Access"
|
||||
COM_COMPONENTBUILDER_LIBRARY_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_MENU="✓ Component Builder"
|
||||
COM_COMPONENTBUILDER_MENU_ADMIN_VIEWS="Admin Views"
|
||||
COM_COMPONENTBUILDER_MENU_COMPILER="Compiler"
|
||||
@ -1021,6 +1047,8 @@ COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST="Search Dashboard List"
|
||||
COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Search"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search"
|
||||
COM_COMPONENTBUILDER_SELECTION_ACCESS="Selection Access"
|
||||
COM_COMPONENTBUILDER_SELECTION_ACCESS_DESC="Allows the users in this group to access selection."
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to access access servers"
|
||||
COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use"
|
||||
@ -1065,8 +1093,12 @@ COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION="Site Views Edit Version"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version site views"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU="Site Views Submenu"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU_DESC="Allows the users in this group to submenu of site view"
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS="Site View Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_INIT_BUTTON_ACCESS="Site View Init Button Access"
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_PUSH_BUTTON_ACCESS="Site View Push Button Access"
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_RESET_BUTTON_ACCESS="Site View Reset Button Access"
|
||||
COM_COMPONENTBUILDER_SITE_VIEW_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_SNIPPETS_ACCESS="Snippets Access"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_ACCESS_DESC="Allows the users in this group to access access snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE="Snippets Batch Use"
|
||||
@ -1087,10 +1119,12 @@ COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION="Snippets Edit Version"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_SUBMENU="Snippets Submenu"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_SUBMENU_DESC="Allows the users in this group to submenu of snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS="Snippet Share Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the share snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_INIT_BUTTON_ACCESS="Snippet Init Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_PUSH_BUTTON_ACCESS="Snippet Push Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_RESET_BUTTON_ACCESS="Snippet Reset Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS="Snippet Types Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC="Allows the users in this group to access access snippet types"
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE="Snippet Types Batch Use"
|
||||
@ -1129,8 +1163,12 @@ COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION="Templates Edit Version"
|
||||
COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version templates"
|
||||
COM_COMPONENTBUILDER_TEMPLATES_SUBMENU="Templates Submenu"
|
||||
COM_COMPONENTBUILDER_TEMPLATES_SUBMENU_DESC="Allows the users in this group to submenu of template"
|
||||
COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS="Template Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_TEMPLATE_INIT_BUTTON_ACCESS="Template Init Button Access"
|
||||
COM_COMPONENTBUILDER_TEMPLATE_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_TEMPLATE_PUSH_BUTTON_ACCESS="Template Push Button Access"
|
||||
COM_COMPONENTBUILDER_TEMPLATE_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
|
||||
COM_COMPONENTBUILDER_TEMPLATE_RESET_BUTTON_ACCESS="Template Reset Button Access"
|
||||
COM_COMPONENTBUILDER_TEMPLATE_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
|
||||
COM_COMPONENTBUILDER_USE_BATCH_DESC="Allows users in this group to use batch copy/update method."
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS="Validation Rules Access"
|
||||
|
131
admin/layouts/powerselectiontable.php
Normal file
131
admin/layouts/powerselectiontable.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$table_id = $displayData['id'] ?? 'power_selection_table';
|
||||
$headers = $displayData['headers'] ?? ['error'];
|
||||
$default_items_number = 10;
|
||||
$unique_name = '';
|
||||
|
||||
?>
|
||||
<?php echo LayoutHelper::render(
|
||||
'table',
|
||||
[
|
||||
'id' => $table_id,
|
||||
'table_class' => 'table table-striped',
|
||||
'table_container_class' => 'power-selection-table-container',
|
||||
'name' => Text::_('COM_COMPONENTBUILDER_MAKE_YOUR_SELECTION'),
|
||||
'headers' => $headers,
|
||||
'items' => 10,
|
||||
'default_items_number' => $default_items_number,
|
||||
'init' => false
|
||||
]
|
||||
); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var selectedPowerItems = [];
|
||||
var targetPowerRepoUrl = '';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let <?php echo $table_id; ?> = new DataTable('#<?php echo $table_id; ?>', {
|
||||
responsive: true,
|
||||
paging: false,
|
||||
order: [[ 0, "asc" ]],
|
||||
scrollY: 450,
|
||||
select: {
|
||||
style: 'multi+shift',
|
||||
selector: 'tr:not(.no-select)'
|
||||
},
|
||||
info: false,
|
||||
columnDefs: [
|
||||
{ 'targets': [ -1 ], 'visible': false, 'searchable': false },
|
||||
{ responsivePriority: 1, targets: 1 },
|
||||
{ responsivePriority: 2, targets: -3 }
|
||||
],
|
||||
columns: [<?php foreach($headers as $header): ?><?php if ($header === 'path'): ?>
|
||||
{
|
||||
data: 'path',
|
||||
render: function(data, type) {
|
||||
if (type === 'display') {
|
||||
return '<a href="' + targetPowerRepoUrl + data + '" target="_blank">' + data + '</a>'
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},<?php else: ?>
|
||||
{
|
||||
data: '<?php echo $header; ?>'
|
||||
},<?php endif; ?><?php endforeach; ?>
|
||||
],
|
||||
createdRow: function(row, data, dataIndex) {
|
||||
if (data.local === true) {
|
||||
row.classList.add('no-select');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// start the initialization manager
|
||||
const initManager = new InitializationManager();
|
||||
|
||||
// Add selected rows to global array
|
||||
<?php echo $table_id; ?>.on('select', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.addSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove deselected rows from global array
|
||||
<?php echo $table_id; ?>.on('deselect', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.removeSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
<?php echo $table_id; ?>.on('draw', function () {
|
||||
selectedPowerItems = [];
|
||||
});
|
||||
});
|
||||
|
||||
function drawPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function clearPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
// Clear the table
|
||||
table.clear();
|
||||
// Draw the table
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function buildPowerSelectionTable<?php echo $unique_name; ?>(items) {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
// clear the table
|
||||
table.clear();
|
||||
// load the new items
|
||||
table.rows.add(getArrayFormat(items));
|
||||
// Draw the table
|
||||
table.draw(true);
|
||||
}
|
||||
</script>
|
59
admin/layouts/reposelectioncardbody.php
Normal file
59
admin/layouts/reposelectioncardbody.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$base = $displayData['repo']->base ?? null;
|
||||
$path = $displayData['repo']->path ?? null;
|
||||
$url = "#";
|
||||
if (!empty($base) && !empty($path))
|
||||
{
|
||||
$url = "{$base}/{$path}";
|
||||
}
|
||||
$name = $displayData['name'] ?? 'error';
|
||||
$area = $displayData['area'] ?? 'error';
|
||||
$organisation = $displayData['repo']->organisation ?? 'error';
|
||||
$repository = $displayData['repo']->repository ?? 'error';
|
||||
$read_branch = $displayData['repo']->read_branch ?? 'error';
|
||||
$guid = $displayData['repo']->guid ?? 'error';
|
||||
|
||||
?>
|
||||
<div>
|
||||
<div class="uk-card repo-selection-card">
|
||||
<div class="uk-card-header">
|
||||
<?php echo $name; ?>: <a class="uk-link-heading" href="<?php echo $url; ?>" target="_blank" title="<?php echo Text::sprintf('COM_COMPONENTBUILDER_OPEN_THIS_REMOTE_S_REPOSITORY', $name); ?>"><?php echo $url; ?></a>
|
||||
</div>
|
||||
<div class="uk-card-body">
|
||||
<ul class="uk-list uk-list-disc">
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_ORGANISATION'); ?>: <code><?php echo $organisation; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_REPOSITORY'); ?>: <code><?php echo $repository; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_BRANCH'); ?>: <code><?php echo $read_branch; ?></code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="uk-card-footer">
|
||||
<button type="button"
|
||||
class="uk-button uk-button-primary uk-width-1-1 select-repo-to-initialize"
|
||||
data-repo="<?php echo $guid; ?>"
|
||||
data-area="<?php echo $area; ?>">
|
||||
<?php echo Text::sprintf('COM_COMPONENTBUILDER_LOAD_ITEMS_FROM_THIS_S_REPOSITORY', $name); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
File diff suppressed because one or more lines are too long
@ -125,6 +125,84 @@ class Admin_viewController extends FormController
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the specified Admin View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Admin View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Admin View.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_ADMIN_VIEW_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=admin_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Admin View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Admin View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Admin View.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_ADMIN_VIEW_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=admin_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -51,4 +51,85 @@ class Admin_viewsController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_ADMIN_VIEWS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Admin Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Admin Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Admin Views.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_ADMIN_VIEWS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Admin Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Admin Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Admin Views.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_ADMIN_VIEWS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -54,7 +54,6 @@ class AjaxController extends BaseController
|
||||
$this->registerTask('getWiki', 'ajax');
|
||||
$this->registerTask('getVersion', 'ajax');
|
||||
$this->registerTask('getJCBpackageInfo', 'ajax');
|
||||
$this->registerTask('getCrowdinDetails', 'ajax');
|
||||
$this->registerTask('getModuleCode', 'ajax');
|
||||
$this->registerTask('getClassCode', 'ajax');
|
||||
$this->registerTask('getClassCodeIds', 'ajax');
|
||||
@ -79,7 +78,6 @@ class AjaxController extends BaseController
|
||||
$this->registerTask('placedin', 'ajax');
|
||||
$this->registerTask('checkPlaceholderName', 'ajax');
|
||||
$this->registerTask('snippetDetails', 'ajax');
|
||||
$this->registerTask('setSnippetGithub', 'ajax');
|
||||
$this->registerTask('getSnippets', 'ajax');
|
||||
$this->registerTask('getExistingValidationRuleCode', 'ajax');
|
||||
$this->registerTask('getValidationRulesTable', 'ajax');
|
||||
@ -92,6 +90,8 @@ class AjaxController extends BaseController
|
||||
$this->registerTask('getSearchValue', 'ajax');
|
||||
$this->registerTask('getReplaceValue', 'ajax');
|
||||
$this->registerTask('setValue', 'ajax');
|
||||
$this->registerTask('getRepoIndex', 'ajax');
|
||||
$this->registerTask('initSelectedPowers', 'ajax');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -363,56 +363,6 @@ class AjaxController extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getCrowdinDetails':
|
||||
try
|
||||
{
|
||||
$identifierValue = $jinput->get('identifier', NULL, 'CMD');
|
||||
$keyValue = $jinput->get('key', NULL, 'ALNUM');
|
||||
if($identifierValue && $user->id != 0 && $keyValue)
|
||||
{
|
||||
$ajaxModule = $this->getModel('ajax', 'Administrator');
|
||||
if ($ajaxModule)
|
||||
{
|
||||
$result = $ajaxModule->getCrowdinDetails($identifierValue, $keyValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getModuleCode':
|
||||
try
|
||||
{
|
||||
@ -1606,56 +1556,6 @@ class AjaxController extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'setSnippetGithub':
|
||||
try
|
||||
{
|
||||
$pathValue = $jinput->get('path', NULL, 'STRING');
|
||||
$statusValue = $jinput->get('status', NULL, 'WORD');
|
||||
if($pathValue && $user->id != 0 && $statusValue)
|
||||
{
|
||||
$ajaxModule = $this->getModel('ajax', 'Administrator');
|
||||
if ($ajaxModule)
|
||||
{
|
||||
$result = $ajaxModule->setSnippetGithub($pathValue, $statusValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getSnippets':
|
||||
try
|
||||
{
|
||||
@ -2279,6 +2179,107 @@ class AjaxController extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getRepoIndex':
|
||||
try
|
||||
{
|
||||
$repoValue = $jinput->get('repo', NULL, 'STRING');
|
||||
$areaValue = $jinput->get('area', NULL, 'STRING');
|
||||
if($repoValue && $user->id != 0 && $areaValue)
|
||||
{
|
||||
$ajaxModule = $this->getModel('ajax', 'Administrator');
|
||||
if ($ajaxModule)
|
||||
{
|
||||
$result = $ajaxModule->getRepoIndex($repoValue, $areaValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'initSelectedPowers':
|
||||
try
|
||||
{
|
||||
$repoValue = $jinput->get('repo', NULL, 'STRING');
|
||||
$areaValue = $jinput->get('area', NULL, 'STRING');
|
||||
$selectedValue = $jinput->get('selected', NULL, 'ARRAY');
|
||||
if($repoValue && $user->id != 0 && $areaValue && $selectedValue)
|
||||
{
|
||||
$ajaxModule = $this->getModel('ajax', 'Administrator');
|
||||
if ($ajaxModule)
|
||||
{
|
||||
$result = $ajaxModule->initSelectedPowers($repoValue, $areaValue, $selectedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = ['error' => 'There was an error! [149]'];
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -124,6 +124,84 @@ class Custom_admin_viewController extends FormController
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the specified Custom Admin View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Custom Admin View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Custom Admin View.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_CUSTOM_ADMIN_VIEW_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=custom_admin_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Custom Admin View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Custom Admin View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Custom Admin View.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_CUSTOM_ADMIN_VIEW_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=custom_admin_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -52,12 +52,84 @@ class Custom_admin_viewsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_CUSTOM_ADMIN_VIEWS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Custom Admin Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Custom Admin Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Custom Admin Views.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_CUSTOM_ADMIN_VIEWS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Custom Admin Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Custom Admin Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Custom Admin Views.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_CUSTOM_ADMIN_VIEWS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -78,6 +78,85 @@ class Custom_codeController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Custom Code.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Custom Code.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Custom Code.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_CUSTOM_CODE_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=custom_code'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Custom Code.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Custom Code.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Custom Code.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_CUSTOM_CODE_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=custom_code'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -51,4 +51,85 @@ class Custom_codesController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_CUSTOM_CODES_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Custom Codes.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Custom Codes.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Custom Codes.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_CUSTOM_CODES_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Custom Codes.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Custom Codes.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Custom Codes.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_CUSTOM_CODES_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -78,6 +78,85 @@ class Dynamic_getController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Dynamic Get.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Dynamic Get.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Dynamic Get.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_DYNAMIC_GET_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=dynamic_get'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Dynamic Get.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Dynamic Get.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Dynamic Get.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_DYNAMIC_GET_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=dynamic_get'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -51,4 +51,85 @@ class Dynamic_getsController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_DYNAMIC_GETS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Dynamic Gets.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Dynamic Gets.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Dynamic Gets.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_DYNAMIC_GETS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Dynamic Gets.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Dynamic Gets.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Dynamic Gets.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_DYNAMIC_GETS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -124,6 +124,84 @@ class FieldController extends FormController
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the specified Field.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Field.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Field.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_FIELD_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=field'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Field.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Field.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Field.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_FIELD_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=field'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -51,4 +51,85 @@ class FieldsController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_FIELDS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Fields.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Fields.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Fields.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_FIELDS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Fields.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Fields.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Fields.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_FIELDS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -103,7 +103,7 @@ class FieldtypeController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -128,8 +128,8 @@ class FieldtypeController extends FormController
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -147,7 +147,7 @@ class FieldtypeController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=fieldtype'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
@ -178,7 +178,7 @@ class FieldtypeController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -190,6 +190,8 @@ class FieldtypeController extends FormController
|
||||
$id = $item['id'] ?? null;
|
||||
$guid = $item['guid'] ?? null;
|
||||
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if there is any selections
|
||||
if ($id === null || $guid === null)
|
||||
{
|
||||
@ -203,15 +205,50 @@ class FieldtypeController extends FormController
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = FieldtypeFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPE_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -222,7 +259,7 @@ class FieldtypeController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=fieldtype'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
@ -17,8 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -56,14 +56,7 @@ class FieldtypesController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Initializes all remote Joomla Field Types and syncs them with the local database.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to initialize the Joomla Field Types.
|
||||
* 3. If the user is authorized, it attempts to initialize the remote Joomla Field Types.
|
||||
* 4. Depending on the result of the initialization operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
@ -73,7 +66,7 @@ class FieldtypesController extends AdminController
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -83,29 +76,20 @@ class FieldtypesController extends AdminController
|
||||
|
||||
if($user->authorise('fieldtype.init', 'com_componentbuilder'))
|
||||
{
|
||||
try {
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->init())
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_FIELD_TYPES') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_FIELD_TYPES_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
|
||||
// set success message
|
||||
$message = null;
|
||||
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
$status = null;
|
||||
$success = true;
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=initialization_selection&power=Joomla.Fieldtype&target=Joomla Field Types', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -141,8 +125,8 @@ class FieldtypesController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -153,7 +137,7 @@ class FieldtypesController extends AdminController
|
||||
$success = false;
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('fieldtype.reset', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
|
||||
@ -162,8 +146,8 @@ class FieldtypesController extends AdminController
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -178,7 +162,7 @@ class FieldtypesController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -220,8 +204,8 @@ class FieldtypesController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -230,9 +214,10 @@ class FieldtypesController extends AdminController
|
||||
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('fieldtype.push', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
|
||||
@ -241,15 +226,50 @@ class FieldtypesController extends AdminController
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Set')->items($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_FIELD_TYPES_HAVE_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = FieldtypeFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_FIELD_TYPES_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -257,7 +277,7 @@ class FieldtypesController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
|
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Get_snippets Admin Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Get_snippetsController extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_GET_SNIPPETS';
|
||||
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds option to redirect back to the dashboard.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dashboard(): void
|
||||
{
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder', false));
|
||||
}
|
||||
|
||||
public function openLibraries()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the libraries
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=libraries', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the snippets
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openSiteViews()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the site views
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openCustomAdminViews()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the custom admin views
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openTemplates()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the templates
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openLayouts()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the layouts
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false));
|
||||
return;
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
57
admin/src/Controller/Initialization_selectionController.php
Normal file
57
admin/src/Controller/Initialization_selectionController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Initialization_selection Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Initialization_selectionController extends BaseController
|
||||
{
|
||||
/**
|
||||
* The context for storing internal data, e.g. record.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $context = 'initialization_selection';
|
||||
|
||||
/**
|
||||
* The URL view item variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_item = 'initialization_selection';
|
||||
|
||||
/**
|
||||
* Adds option to redirect back to the dashboard.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dashboard(): void
|
||||
{
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder', false));
|
||||
}
|
||||
}
|
@ -80,6 +80,85 @@ class Joomla_componentController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Joomla Component.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Joomla Component.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Joomla Component.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_JOOMLA_COMPONENT_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=joomla_component'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Joomla Component.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Joomla Component.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Joomla Component.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_JOOMLA_COMPONENT_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=joomla_component'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -17,7 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
@ -161,4 +160,84 @@ class Joomla_componentsController extends AdminController
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_JOOMLA_COMPONENTS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Joomla Components.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Joomla Components.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Joomla Components.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_JOOMLA_COMPONENTS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Joomla Components.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Joomla Components.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Joomla Components.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_JOOMLA_COMPONENTS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -103,7 +103,7 @@ class Joomla_powerController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -128,8 +128,8 @@ class Joomla_powerController extends FormController
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -147,7 +147,7 @@ class Joomla_powerController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=joomla_power'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
@ -178,7 +178,7 @@ class Joomla_powerController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -190,6 +190,8 @@ class Joomla_powerController extends FormController
|
||||
$id = $item['id'] ?? null;
|
||||
$guid = $item['guid'] ?? null;
|
||||
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if there is any selections
|
||||
if ($id === null || $guid === null)
|
||||
{
|
||||
@ -203,15 +205,50 @@ class Joomla_powerController extends FormController
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Set')->items([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = JoomlaPowerFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_POWER_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -222,7 +259,7 @@ class Joomla_powerController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=joomla_power'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
@ -17,8 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -56,14 +56,7 @@ class Joomla_powersController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Initializes all remote Joomla Powers and syncs them with the local database.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to initialize the Joomla Powers.
|
||||
* 3. If the user is authorized, it attempts to initialize the remote Joomla Powers.
|
||||
* 4. Depending on the result of the initialization operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
@ -73,7 +66,7 @@ class Joomla_powersController extends AdminController
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -83,29 +76,20 @@ class Joomla_powersController extends AdminController
|
||||
|
||||
if($user->authorise('joomla_power.init', 'com_componentbuilder'))
|
||||
{
|
||||
try {
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->init())
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
|
||||
// set success message
|
||||
$message = null;
|
||||
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_POWERS_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
$status = null;
|
||||
$success = true;
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=initialization_selection&power=Joomla.Power&target=Joomla Powers', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -141,8 +125,8 @@ class Joomla_powersController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -153,7 +137,7 @@ class Joomla_powersController extends AdminController
|
||||
$success = false;
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('joomla_power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
|
||||
@ -162,8 +146,8 @@ class Joomla_powersController extends AdminController
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->reset($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -178,7 +162,7 @@ class Joomla_powersController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -220,8 +204,8 @@ class Joomla_powersController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -230,9 +214,10 @@ class Joomla_powersController extends AdminController
|
||||
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('joomla_power.push', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
|
||||
@ -241,15 +226,50 @@ class Joomla_powersController extends AdminController
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Set')->items($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = JoomlaPowerFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_POWERS_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_POWERS_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -257,7 +277,7 @@ class Joomla_powersController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
|
@ -78,6 +78,85 @@ class LayoutController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Layout.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Layout.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Layout.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_LAYOUT_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=layout'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Layout.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Layout.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Layout.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_LAYOUT_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=layout'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -52,12 +52,84 @@ class LayoutsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_LAYOUTS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=layouts', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Layouts.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Layouts.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Layouts.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_LAYOUTS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=layouts', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Layouts.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Layouts.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Layouts.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_LAYOUTS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=layouts', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -52,12 +52,84 @@ class LibrariesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_LIBRARIES_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=libraries', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Libraries.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Libraries.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Libraries.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_LIBRARIES_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=libraries', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Libraries.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Libraries.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Libraries.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_LIBRARIES_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=libraries', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -24,8 +24,8 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Data\Factory as DataFactory;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\Data\Factory as DataFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -80,6 +80,129 @@ class LibraryController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Method to edit an existing record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key
|
||||
* (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if access level check and checkout passes, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function edit($key = null, $urlVar = null)
|
||||
{
|
||||
// for modal title key selection (unique key to do mapping)
|
||||
$titleKey = $this->input->get('titleKey', 'id', 'word');
|
||||
$guid = null;
|
||||
$value = null;
|
||||
|
||||
// Determine the name of the primary key for the data.
|
||||
if (empty($key))
|
||||
{
|
||||
$model = $this->getModel();
|
||||
$table = $model->getTable();
|
||||
$key = $table->getKeyName();
|
||||
}
|
||||
|
||||
if ($titleKey === 'guid')
|
||||
{
|
||||
$guid = $this->input->get('guid', null, 'string');
|
||||
}
|
||||
|
||||
if ($guid !== null && GuidHelper::valid($guid))
|
||||
{
|
||||
$value = GuidHelper::item($guid, 'library', 'a.' . $key, 'componentbuilder');
|
||||
}
|
||||
|
||||
if ($value !== null)
|
||||
{
|
||||
$this->input->set($key, $value);
|
||||
}
|
||||
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the specified Library.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Library.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Library.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_LIBRARY_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=library'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Library.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Library.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Library.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_LIBRARY_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=library'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -148,7 +148,7 @@ class PowerController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -173,8 +173,8 @@ class PowerController extends FormController
|
||||
if (PowerFactory::_('Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -192,7 +192,7 @@ class PowerController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
@ -223,7 +223,7 @@ class PowerController extends FormController
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -235,6 +235,8 @@ class PowerController extends FormController
|
||||
$id = $item['id'] ?? null;
|
||||
$guid = $item['guid'] ?? null;
|
||||
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if there is any selections
|
||||
if ($id === null || $guid === null)
|
||||
{
|
||||
@ -248,15 +250,50 @@ class PowerController extends FormController
|
||||
if (PowerFactory::_('Power.Remote.Set')->items([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = PowerFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWER_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWER_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -267,7 +304,7 @@ class PowerController extends FormController
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
@ -17,8 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -56,14 +56,7 @@ class PowersController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Initializes all remote Powers and syncs them with the local database.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to initialize the Powers.
|
||||
* 3. If the user is authorized, it attempts to initialize the remote Powers.
|
||||
* 4. Depending on the result of the initialization operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
@ -73,7 +66,7 @@ class PowersController extends AdminController
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
@ -83,29 +76,20 @@ class PowersController extends AdminController
|
||||
|
||||
if($user->authorise('power.init', 'com_componentbuilder'))
|
||||
{
|
||||
try {
|
||||
if (PowerFactory::_('Power.Remote.Get')->init())
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_POWERS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
|
||||
// set success message
|
||||
$message = null;
|
||||
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_POWERS_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
$status = null;
|
||||
$success = true;
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=initialization_selection&power=Power&target=Powers', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -141,8 +125,8 @@ class PowersController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -153,7 +137,7 @@ class PowersController extends AdminController
|
||||
$success = false;
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
|
||||
@ -162,8 +146,8 @@ class PowersController extends AdminController
|
||||
if (PowerFactory::_('Power.Remote.Get')->reset($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
@ -178,7 +162,7 @@ class PowersController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
@ -220,8 +204,8 @@ class PowersController extends AdminController
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST') . '</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
@ -230,9 +214,10 @@ class PowersController extends AdminController
|
||||
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
$message_bus = ['warning', 'error'];
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
if($user->authorise('power.push', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
|
||||
@ -241,15 +226,50 @@ class PowersController extends AdminController
|
||||
if (PowerFactory::_('Power.Remote.Set')->items($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED') . '</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load any messages from the message bus
|
||||
$message_bucket = [];
|
||||
|
||||
foreach ($message_bus as $message_key)
|
||||
{
|
||||
if (($messages = PowerFactory::_('Power.Message')->get($message_key, null)) !== null)
|
||||
{
|
||||
$message_bucket[$message_key] = $messages;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize base values
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_POWERS_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWERS_HAS_FAILED') . '</p>';
|
||||
$status = 'error';
|
||||
|
||||
// Handle both error and warning
|
||||
if (isset($message_bucket['error'], $message_bucket['warning']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
|
||||
foreach ($message_bucket['warning'] as $warning)
|
||||
{
|
||||
$this->app->enqueueMessage($warning, 'warning');
|
||||
}
|
||||
}
|
||||
elseif (isset($message_bucket['error']))
|
||||
{
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['error']) . '</p>';
|
||||
}
|
||||
elseif (isset($message_bucket['warning']))
|
||||
{
|
||||
$status = 'warning';
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_WAS_UNSUCCESSFUL') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_POWERS_COULD_NOT_BE_COMPLETED') . '</p>';
|
||||
$message .= '<p>' . implode('<br>', $message_bucket['warning']) . '</p>';
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
|
||||
@ -257,7 +277,7 @@ class PowersController extends AdminController
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
|
@ -124,6 +124,84 @@ class Site_viewController extends FormController
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the specified Site View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Site View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Site View.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_SITE_VIEW_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=site_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Site View.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Site View.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Site View.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_SITE_VIEW_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=site_view'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -52,12 +52,84 @@ class Site_viewsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_SITE_VIEWS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=site_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Site Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Site Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Site Views.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_SITE_VIEWS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=site_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Site Views.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Site Views.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Site Views.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_SITE_VIEWS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=site_views', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -78,6 +78,85 @@ class SnippetController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Snippet.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Snippet.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Snippet.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_SNIPPET_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=snippet'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Snippet.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Snippet.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Snippet.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_SNIPPET_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=snippet'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -24,6 +24,7 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -78,6 +79,51 @@ class Snippet_typeController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Method to edit an existing record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key
|
||||
* (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if access level check and checkout passes, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function edit($key = null, $urlVar = null)
|
||||
{
|
||||
// for modal title key selection (unique key to do mapping)
|
||||
$titleKey = $this->input->get('titleKey', 'id', 'word');
|
||||
$guid = null;
|
||||
$value = null;
|
||||
|
||||
// Determine the name of the primary key for the data.
|
||||
if (empty($key))
|
||||
{
|
||||
$model = $this->getModel();
|
||||
$table = $model->getTable();
|
||||
$key = $table->getKeyName();
|
||||
}
|
||||
|
||||
if ($titleKey === 'guid')
|
||||
{
|
||||
$guid = $this->input->get('guid', null, 'string');
|
||||
}
|
||||
|
||||
if ($guid !== null && GuidHelper::valid($guid))
|
||||
{
|
||||
$value = GuidHelper::item($guid, 'snippet_type', 'a.' . $key, 'componentbuilder');
|
||||
}
|
||||
|
||||
if ($value !== null)
|
||||
{
|
||||
$this->input->set($key, $value);
|
||||
}
|
||||
|
||||
return parent::edit($key, $urlVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -17,7 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -53,76 +52,84 @@ class SnippetsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_SNIPPETS_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=snippets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function shareSnippets()
|
||||
/**
|
||||
* Resets the selected Snippets.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Snippets.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Snippets.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// Get the model
|
||||
$model = $this->getModel('snippets');
|
||||
// check if import is allowed for this user.
|
||||
$model->user = Factory::getUser();
|
||||
if ($model->user->authorise('snippet.import', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
// check if there is any selections
|
||||
if (!UtilitiesArrayHelper::check($pks))
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// set auto loader
|
||||
ComponentbuilderHelper::autoLoader('smart');
|
||||
// get the data to export
|
||||
if ($model->shareSnippets($pks))
|
||||
{
|
||||
// Message of successful build
|
||||
if (count($pks) > 1)
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED') . '</h1>';
|
||||
$message .= '<p>' . Text::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY');
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED') . '</h1>';
|
||||
$message .= '<p>' . Text::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THIS_SNIPPET_WITH_THE_REST_OF_THE_JCB_COMMUNITY');
|
||||
}
|
||||
$message .= Text::sprintf('COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB',
|
||||
'<a href="https://try.github.io" target="_blank">git</a>',
|
||||
'<a href="https://github.com/join" target="_blank">github.com</a>') . '</p>';
|
||||
|
||||
$message .= '<h2>' . Text::_('COM_COMPONENTBUILDER_NEED_HELP') . '</h2>';
|
||||
$message .= '<ul>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_GENERAL_OVERVIEW_OF_HOW_THINGS_WORK_BSB', '<a href="https://www.youtube.com/watch?v=qr4I1jeCp7I&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank">https://youtu.be/qr4I1jeCp7I</a>').'</li>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB', '<a href="https://www.udemy.com/git-quick-start/" target="_blank">https://www.udemy.com/git-quick-start/</a>').'</li>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_GET_AN_ACCOUNT_WITH_GITHUB_BSB', '<a href="https://github.com/join" target="_blank">https://github.com/join</a>').'</li>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_TUTORIAL_ON_FORKING_JCB_SNIPPETS_BSB', '<a href="https://www.youtube.com/watch?v=0hgHeQVTLOk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank">https://youtu.be/0hgHeQVTLOk</a>').'</li>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_TUTORIAL_ON_MAKING_A_PULL_REQUEST_BSB', '<a href="https://www.youtube.com/watch?v=vQ-yxVtc-Co&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank">https://youtu.be/vQ-yxVtc-Co</a>').'</li>';
|
||||
$message .= '<li>'.Text::sprintf('COM_COMPONENTBUILDER_REPORT_AN_ISSUE_BSB', '<a href="https://github.com/vdm-io/Joomla-Component-Builder-Snippets/issues" target="_blank">https://github.com/vdm-io/Joomla-Component-Builder-Snippets/issues</a>').'</li>';
|
||||
$message .= '</ul>';
|
||||
$message .= '<h2>' . Text::_('COM_COMPONENTBUILDER_ZIPPED_FILE_LOCATION') . '</h2>';
|
||||
$message .= '<p>' . Text::sprintf('COM_COMPONENTBUILDER_PATH_CODESCODE', $model->zipPath). '</p>';
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_SNIPPETS_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=snippets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Snippets.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Snippets.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Snippets.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_SNIPPETS_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=snippets', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -78,6 +78,85 @@ class TemplateController extends FormController
|
||||
*/
|
||||
protected int $refid;
|
||||
|
||||
|
||||
/**
|
||||
* Resets the specified Template.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to reset the Template.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Template.
|
||||
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_TEMPLATE_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=template'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified Template.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the item data posted by the user.
|
||||
* 3. It checks whether the current user has the necessary permissions to push the Template.
|
||||
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
|
||||
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Template.
|
||||
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 7. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_TEMPLATE_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=template'
|
||||
. $this->getRedirectToItemAppend($id), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -52,12 +52,84 @@ class TemplatesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
|
||||
/**
|
||||
* Redirect the request to the Initialization selection page.
|
||||
*
|
||||
* @return bool True on successful initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PULL_BOTH_DEMO_AND_USERCREATED_TEMPLATES_INTO_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=templates', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected Templates.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected Templates.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Templates.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_TEMPLATES_WITHIN_THIS_JCB_INSTANCE') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=templates', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the selected Templates.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to push the selected Templates.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to push the selected Templates.
|
||||
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful push, false on failure.
|
||||
*/
|
||||
public function pushPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// set default in development message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_TEMPLATES_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
|
||||
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=templates', false);
|
||||
$this->setRedirect($redirect_url, $message, 'success');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Adminviews Form Field class for the Componentbuilder component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class AdminviewsField extends ListField
|
||||
{
|
||||
/**
|
||||
* The adminviews field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'Adminviews';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.guid','a.system_name'),array('guid','view_table_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = Html::_('select.option', $item->guid, $item->view_table_system_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -51,20 +52,21 @@ class DynamicdashboardField extends ListField
|
||||
// get the input from url
|
||||
$jinput = Factory::getApplication()->input;
|
||||
// get the id
|
||||
$ID = $jinput->getInt('id', 0);
|
||||
$id = $jinput->getInt('id', 0);
|
||||
// set the targets
|
||||
$targets = ['adminview' => 'admin_view', 'customadminview' => 'custom_admin_view'];
|
||||
$t = ['adminview' => 'A', 'customadminview' => 'C'];
|
||||
// rest the options
|
||||
$options = [];
|
||||
// reset the custom admin views array
|
||||
$views = false;
|
||||
if (is_numeric($ID) && $ID >= 1)
|
||||
// reset the custom admin & admin views array
|
||||
$views = [];
|
||||
if (is_numeric($id) && $id >= 1)
|
||||
{
|
||||
$guid = GetHelper::var('joomla_component', (int) $id, 'id', 'guid');
|
||||
// get the linked back-end views
|
||||
foreach ($targets as $target => $view)
|
||||
{
|
||||
if ($result = GetHelper::var('component_'.$view.'s', (int) $ID, 'joomla_component', 'add'.$view.'s'))
|
||||
if ($result = GetHelper::var('component_' . $view . 's', $guid, 'joomla_component', 'add' . $view . 's'))
|
||||
{
|
||||
$views[$target] = $result;
|
||||
}
|
||||
@ -75,6 +77,7 @@ class DynamicdashboardField extends ListField
|
||||
// not linked so there is none available
|
||||
return [Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))];
|
||||
}
|
||||
|
||||
// check if we found any values
|
||||
if (ArrayHelper::check($views))
|
||||
{
|
||||
@ -89,12 +92,28 @@ class DynamicdashboardField extends ListField
|
||||
{
|
||||
foreach ($value as $_view)
|
||||
{
|
||||
if (isset($_view[$target]) && is_numeric($_view[$target]))
|
||||
if (!isset($_view[$target]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$key_id = null;
|
||||
$key_value = $_view[$target];
|
||||
if (is_numeric($key_value))
|
||||
{
|
||||
$key_id = 'id';
|
||||
}
|
||||
elseif (GuidHelper::valid($key_value))
|
||||
{
|
||||
$key_id = 'guid';
|
||||
}
|
||||
|
||||
if ($key_id !== null)
|
||||
{
|
||||
// set the view to the selections if found
|
||||
if ($name = GetHelper::var($view, (int) $_view[$target], 'id', 'system_name'))
|
||||
if (($name = GetHelper::var($view, $key_value, $key_id, 'system_name')) !== null)
|
||||
{
|
||||
$options[] = Html::_('select.option', $t[$target].'_'.$_view[$target], $name.' ['.$type.']');
|
||||
$options[] = Html::_('select.option', $t[$target] . '_' . $key_value, $name . ' [' . $type . ']');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,12 +121,14 @@ class DynamicdashboardField extends ListField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return found options
|
||||
if (ArrayHelper::check($options))
|
||||
{
|
||||
array_unshift($options , Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION')));
|
||||
return $options;
|
||||
}
|
||||
|
||||
// not linked so there is none available
|
||||
return [Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))];
|
||||
}
|
||||
|
@ -1,175 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Library Form Field class for the Componentbuilder component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class LibraryField extends ListField
|
||||
{
|
||||
/**
|
||||
* The library field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'Library';
|
||||
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$set_button = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($set_button === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$button_code_name = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = Factory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referral if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
// get the return value.
|
||||
$_uri = (string) Uri::getInstance();
|
||||
$_return = urlencode(base64_encode($_uri));
|
||||
// load return value.
|
||||
$ref .= '&return=' . $_return;
|
||||
$refJ .= '&return=' . $_return;
|
||||
}
|
||||
// get button label
|
||||
$button_label = trim($button_code_name);
|
||||
$button_label = preg_replace('/_+/', ' ', $button_label);
|
||||
$button_label = preg_replace('/\s+/', ' ', $button_label);
|
||||
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
|
||||
$button_label = ucfirst(strtolower($button_label));
|
||||
// get user object
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
// only add if user allowed to create library
|
||||
if ($user->authorise('library.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px;"
|
||||
href="index.php?option=com_componentbuilder&view=library&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit library
|
||||
if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
let ".$button_code_name."Field = document.getElementById('jform_".$button_code_name."');
|
||||
if (!".$button_code_name."Field) { return; }
|
||||
".$button_code_name."Field.addEventListener('change', function(e) {
|
||||
e.preventDefault();
|
||||
let ".$button_code_name."Value = this.value;
|
||||
".$button_code_name."Button(".$button_code_name."Value);
|
||||
});
|
||||
let ".$button_code_name."Value = ".$button_code_name."Field.value;
|
||||
".$button_code_name."Button(".$button_code_name."Value);
|
||||
});
|
||||
function ".$button_code_name."Button(value) {
|
||||
var createButton = document.getElementById('".$button_code_name."Create');
|
||||
var editButton = document.getElementById('".$button_code_name."Edit');
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
createButton.style.display = 'none';
|
||||
// show edit button
|
||||
editButton.style.display = 'block';
|
||||
let url = 'index.php?option=com_componentbuilder&view=libraries&task=library.edit&id='+value+'".$refJ."';
|
||||
editButton.setAttribute('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
createButton.style.display = 'block';
|
||||
// hide edit button
|
||||
editButton.style.display = 'none';
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for library field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = Factory::getApplication()->getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-group">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(['a.guid','a.name'], ['guid','library_name']));
|
||||
$query->from($db->quoteName('#__componentbuilder_library', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->where($db->quoteName('a.type') . ' = 1');
|
||||
$query->order('a.name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = Html::_('select.option', $item->guid, $item->library_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Snippettype Form Field class for the Componentbuilder component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class SnippettypeField extends ListField
|
||||
{
|
||||
/**
|
||||
* The snippettype field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'Snippettype';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the databse object.
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.guid','a.name'),array('guid','type_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet_type', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = [];
|
||||
if ($items)
|
||||
{
|
||||
if ($this->multiple === false)
|
||||
{
|
||||
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = Html::_('select.option', $item->guid, $item->type_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -3407,7 +3407,7 @@ abstract class ComponentbuilderHelper
|
||||
$script['view'][] = self::_t(1) . "var outerDiv = \$('body');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = PHP_EOL . self::_t(1) . "\$('<div id=\"loading\"></div>')";
|
||||
$script['view'][] = self::_t(2) . ".css(\"background\", \"rgba(255, 255, 255, .8) url('components/com_[[[-#-#-component]]]/assets/images/import.gif') 50% 15% no-repeat\")";
|
||||
$script['view'][] = self::_t(2) . ".css(\"background\", \"rgba(255, 255, 255, .8) url('components/com_[[[-#-#-component]]]/assets/images/ajax.gif') 50% 35% no-repeat\")";
|
||||
$script['view'][] = self::_t(2) . ".css(\"top\", outerDiv.position().top - \$(window).scrollTop())";
|
||||
$script['view'][] = self::_t(2) . ".css(\"left\", outerDiv.position().left - \$(window).scrollLeft())";
|
||||
$script['view'][] = self::_t(2) . ".css(\"width\", outerDiv.width())";
|
||||
|
@ -28,7 +28,6 @@ use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Registry\Registry;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Gitea\Factory as GiteaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
@ -41,6 +40,12 @@ use VDM\Joomla\Utilities\Base64Helper;
|
||||
use VDM\Joomla\Componentbuilder\Table\Search;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
|
||||
use VDM\Joomla\Utilities\FormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Componentbuilder\Snippet\Factory as SnippetFactory;
|
||||
use VDM\Joomla\Interfaces\Remote\GetInterface;
|
||||
use Joomla\CMS\Form\FormHelper as FormFormHelper;
|
||||
|
||||
// No direct access to this file
|
||||
@ -87,95 +92,6 @@ class AjaxModel extends ListModel
|
||||
}
|
||||
|
||||
// Used in joomla_component
|
||||
/**
|
||||
* Will be removed since we are going the AI route... instead.
|
||||
*/
|
||||
public function getCrowdinDetails($identifier, $key)
|
||||
{
|
||||
// set the url
|
||||
$url = "https://api.crowdin.com/api/project/$identifier/info?key=$key&json";
|
||||
// get the details
|
||||
if (($details = FileHelper::getContent($url, false)) !== false && JsonHelper::check($details))
|
||||
{
|
||||
$details = json_decode($details, true);
|
||||
// check if there is an error
|
||||
if (isset($details['error']))
|
||||
{
|
||||
return ['error' => '<div class="alert alert-error">' . $details['error']['message'] . '<br /><br /><small>Identifier: ' . $identifier . '</small></div>'];
|
||||
}
|
||||
// build the details html
|
||||
if (isset($details['details']))
|
||||
{
|
||||
$html = '<div class="alert alert-success" id="crowdin_message">';
|
||||
$html .= '<h1>' . Text::_('COM_COMPONENTBUILDER_COMPONENT_SUCCESSFULLY_LINKED') . '</h1>';
|
||||
$html .= '<h3>' . $details['details']['name'] . '</h3>';
|
||||
if (StringHelper::check($details['details']['description']))
|
||||
{
|
||||
$html .= '<p>';
|
||||
$html .= $details['details']['description'];
|
||||
$html .= '</p>';
|
||||
}
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>Number of participants: <b>';
|
||||
$html .= $details['details']['participants_count'];
|
||||
$html .= '</b></li>';
|
||||
$html .= '<li>Total strings count: <b>';
|
||||
$html .= $details['details']['total_strings_count'];
|
||||
$html .= '</b></li>';
|
||||
$html .= '<li>Total words count: <b>';
|
||||
$html .= $details['details']['total_words_count'];
|
||||
$html .= '</b></li>';
|
||||
$html .= '<li>Created: <b>';
|
||||
$html .= ComponentbuilderHelper::fancyDate($details['details']['created']);
|
||||
$html .= '</b></li>';
|
||||
$html .= '<li>Last activity: <b>';
|
||||
$html .= ComponentbuilderHelper::fancyDate($details['details']['last_activity']);
|
||||
$html .= '</b></li>';
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
return ['html' => $html];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be removed since we are moving to the new SuperPowers distribution system.
|
||||
*/
|
||||
public function getJCBpackageInfo($package)
|
||||
{
|
||||
// convert URL
|
||||
$url = base64_decode($package);
|
||||
$url = str_replace('.zip', '.info', $url);
|
||||
|
||||
// check if url exist
|
||||
if ($info = FileHelper::getContent($url, false))
|
||||
{
|
||||
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.legacy');
|
||||
|
||||
// check if we had success
|
||||
if (!JsonHelper::check($_info))
|
||||
{
|
||||
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.fof');
|
||||
}
|
||||
|
||||
// check if we have json
|
||||
if (JsonHelper::check($_info))
|
||||
{
|
||||
$info = json_decode($_info, true);
|
||||
|
||||
return [
|
||||
'owner' => PackageFactory::_('Display.Details')->owner($info, true),
|
||||
'packages' => PackageFactory::_('Display.Details')->components($info)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'error' => Text::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the component details as an HTML display and metadata.
|
||||
*
|
||||
@ -4321,269 +4237,189 @@ class AjaxModel extends ListModel
|
||||
|
||||
// Used in snippet
|
||||
|
||||
/**
|
||||
* Retrieves published snippet GUIDs for valid libraries.
|
||||
*
|
||||
* @param mixed $libraries JSON string or array of library GUIDs.
|
||||
*
|
||||
* @return array|false List of snippet IDs or false on failure.
|
||||
* @since 5.1.1
|
||||
*/
|
||||
public function getSnippets($libraries)
|
||||
{
|
||||
// Decode JSON if required
|
||||
if (JsonHelper::check($libraries))
|
||||
{
|
||||
$libraries = json_decode($libraries, true);
|
||||
}
|
||||
// check if we have an array
|
||||
if (UtilitiesArrayHelper::check($libraries))
|
||||
{
|
||||
// insure we only have int values
|
||||
if ($libraries = $this->checkLibraries($libraries))
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = Factory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName( array('a.id') ));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' = 1');
|
||||
// check for country and region
|
||||
$query->where($db->quoteName('a.library') . ' IN ('. implode(',',$libraries) .')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return $db->loadColumn();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function checkLibraries($libraries)
|
||||
{
|
||||
$bucket = array();
|
||||
$libraries = array_map( function($id) use (&$bucket) {
|
||||
// now get bundled libraries
|
||||
$type = GetHelper::var('library', (int) $id, 'id', 'type');
|
||||
if (2 == $type && $bundled = GetHelper::var('library', (int) $id, 'id', 'libraries'))
|
||||
{
|
||||
// make sure we have an array if it was json
|
||||
if (JsonHelper::check($bundled))
|
||||
{
|
||||
$bundled = json_decode($bundled, true);
|
||||
}
|
||||
// load in the values if we have an array
|
||||
if (UtilitiesArrayHelper::check($bundled))
|
||||
{
|
||||
foreach ($bundled as $lib)
|
||||
{
|
||||
$bucket[$lib] = $lib;
|
||||
}
|
||||
}
|
||||
elseif (is_numeric($bundled))
|
||||
{
|
||||
$bucket[(int) $bundled] = (int) $bundled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $id;
|
||||
}
|
||||
}, $libraries);
|
||||
// check if we have any bundled libraries
|
||||
if (UtilitiesArrayHelper::check($bucket))
|
||||
{
|
||||
foreach ($bucket as $lib)
|
||||
{
|
||||
$libraries[] = (int) $lib;
|
||||
}
|
||||
}
|
||||
// check that we have libraries
|
||||
if (UtilitiesArrayHelper::check($libraries))
|
||||
{
|
||||
$libraries = array_values(array_unique(array_filter($libraries, function($id){return is_int($id);})));
|
||||
// check if we have any libraries remaining
|
||||
if (UtilitiesArrayHelper::check($libraries))
|
||||
{
|
||||
return $libraries;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public function getSnippetDetails($key)
|
||||
{
|
||||
if (GuidHelper::valid($key))
|
||||
{
|
||||
$target = 'guid';
|
||||
}
|
||||
elseif (is_numeric($key))
|
||||
{
|
||||
$target = 'id';
|
||||
}
|
||||
else
|
||||
// Ensure we have a valid array of libraries
|
||||
if (!UtilitiesArrayHelper::check($libraries))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate and expand libraries
|
||||
$validatedLibraries = $this->expandAndValidateLibraries($libraries);
|
||||
|
||||
if (!$validatedLibraries)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get a db connection.
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('a.id'))
|
||||
->from($db->quoteName('#__componentbuilder_snippet', 'a'))
|
||||
->where($db->quoteName('a.published') . ' = 1')
|
||||
->where($db->quoteName('a.library') . ' IN ("' . implode('","', $validatedLibraries) . '")');
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.name', 'a.heading', 'a.usage', 'a.description', 'b.name', 'a.snippet', 'a.url', 'c.name'), array('name', 'heading', 'usage', 'description', 'type', 'snippet', 'url', 'library')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
// From the componentbuilder_snippet_type table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
// From the componentbuilder_library table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->where($db->quoteName('a.' . $target) . ' = ' . $db->quote($key));
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
|
||||
return $db->getNumRows() ? $db->loadColumn() : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates and expands library GUIDs to ensure only integers and valid references remain.
|
||||
*
|
||||
* @param array $libraries The original list of library GUIDs.
|
||||
*
|
||||
* @return array|false Sanitized and validated list of libraries, or false.
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function expandAndValidateLibraries(array $libraries)
|
||||
{
|
||||
$expanded = [];
|
||||
|
||||
foreach ($libraries as $guid)
|
||||
{
|
||||
$guid = (string) $guid;
|
||||
$type = GetHelper::var('library', $guid, 'guid', 'type');
|
||||
|
||||
if ((int) $type === 2)
|
||||
{
|
||||
$bundled = GetHelper::var('library', $guid, 'guid', 'libraries');
|
||||
|
||||
if (JsonHelper::check($bundled))
|
||||
{
|
||||
$bundled = json_decode($bundled, true);
|
||||
}
|
||||
|
||||
if (UtilitiesArrayHelper::check($bundled))
|
||||
{
|
||||
foreach ($bundled as $lib)
|
||||
{
|
||||
$expanded[$lib] = $lib;
|
||||
}
|
||||
}
|
||||
elseif (is_numeric($bundled))
|
||||
{
|
||||
$expanded[$bundled] = bundled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$expanded[$guid] = $guid;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove invalid entries and duplicates
|
||||
$valid = array_filter(array_unique($expanded), function ($guid) {
|
||||
return GuidHelper::valid($guid);
|
||||
});
|
||||
|
||||
return UtilitiesArrayHelper::check($valid) ? array_values($valid) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves snippet details by GUID or ID.
|
||||
*
|
||||
* @param string|int $key The snippet GUID (string) or ID (int).
|
||||
*
|
||||
* @return object|false The snippet data object or false on failure.
|
||||
* @since 5.1.1
|
||||
*/
|
||||
public function getSnippetDetails($key)
|
||||
{
|
||||
$target = $this->resolveSnippetKeyField($key);
|
||||
|
||||
if ($target === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($db->quoteName(
|
||||
[
|
||||
'a.name',
|
||||
'a.heading',
|
||||
'a.usage',
|
||||
'a.description',
|
||||
'b.name',
|
||||
'a.snippet',
|
||||
'a.url',
|
||||
'c.name'
|
||||
],
|
||||
[
|
||||
'name',
|
||||
'heading',
|
||||
'usage',
|
||||
'description',
|
||||
'type',
|
||||
'snippet',
|
||||
'url',
|
||||
'library'
|
||||
]
|
||||
))
|
||||
->from($db->quoteName('#__componentbuilder_snippet', 'a'))
|
||||
->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON ' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.guid'))
|
||||
->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON ' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.guid'))
|
||||
->where($db->quoteName('a.published') . ' >= 1')
|
||||
->where($db->quoteName("a.$target") . ' = ' . $db->quote($key));
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($db->getNumRows() > 0)
|
||||
{
|
||||
$snippet = $db->loadObject();
|
||||
$snippet->snippet = base64_decode($snippet->snippet);
|
||||
// return found snippet settings
|
||||
|
||||
if (isset($snippet->snippet))
|
||||
{
|
||||
$snippet->snippet = base64_decode($snippet->snippet);
|
||||
}
|
||||
|
||||
return $snippet;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setSnippetGithub($path, $status)
|
||||
/**
|
||||
* Resolves whether the given key is a GUID or numeric ID and returns the appropriate field.
|
||||
*
|
||||
* @param mixed $key The value used to identify the snippet.
|
||||
*
|
||||
* @return string|false 'guid', 'id', or false if invalid.
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function resolveSnippetKeyField($key)
|
||||
{
|
||||
// get user
|
||||
$user = Factory::getUser();
|
||||
$access = $user->authorise('snippet.access', 'com_componentbuilder');
|
||||
if ($access)
|
||||
if (GuidHelper::valid($key))
|
||||
{
|
||||
// secure path
|
||||
$path = StringHelper::safe(str_replace('.json','',$path), 'filename', '', false).'.json';
|
||||
// base path
|
||||
$base_path = basename($path);
|
||||
// set url
|
||||
$url = ComponentbuilderHelper::$snippetPath.rawurlencode($base_path);
|
||||
// get the snippets
|
||||
if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url, null, 'array')) !== false)
|
||||
{
|
||||
return $this->saveSnippet($snippet, $status, $user);
|
||||
}
|
||||
// see if we have any errors from github
|
||||
if (UtilitiesArrayHelper::check(ComponentbuilderHelper::$githubRepoDataErrors))
|
||||
{
|
||||
return array('message' => Text::sprintf('COM_COMPONENTBUILDER_ERROR_BR_S', implode('<br />', ComponentbuilderHelper::$githubRepoDataErrors)), 'status' => 'danger');
|
||||
}
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger');
|
||||
return 'guid';
|
||||
}
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger');
|
||||
}
|
||||
|
||||
protected function saveSnippet($item, $status, $user)
|
||||
{
|
||||
// set some defaults
|
||||
$todayDate = Factory::getDate()->toSql();
|
||||
// get the type id
|
||||
$item['type'] = ($id = GetHelper::var('snippet_type', $item['type'], 'name', 'id')) ? $id : $this->createNew($item['type'], 'snippet_type', $user, $todayDate);
|
||||
// get the library id
|
||||
$item['library'] = ($id = GetHelper::var('library', $item['library'], 'name', 'id')) ? $id : $this->createNew($item['library'], 'library', $user, $todayDate);
|
||||
// remove type if zero
|
||||
if ($item['type'] == 0)
|
||||
if (is_numeric($key))
|
||||
{
|
||||
unset($item['type']);
|
||||
return 'id';
|
||||
}
|
||||
// remove library if zero
|
||||
if ($item['library'] == 0)
|
||||
{
|
||||
unset($item['library']);
|
||||
}
|
||||
// get the snippet ID
|
||||
$item['id'] = $this->getSnippetId($item);
|
||||
if ($item['id'] == 0)
|
||||
{
|
||||
$canCreate = $user->authorise('snippet.create', 'com_componentbuilder');
|
||||
if ('new' === $status && !$canCreate)
|
||||
{
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_THE_SNIPPET'), 'status' => 'danger');
|
||||
}
|
||||
}
|
||||
// get the snippet model
|
||||
$model = ComponentbuilderHelper::getModel('snippet', JPATH_COMPONENT_ADMINISTRATOR);
|
||||
// save the snippet
|
||||
if ($model->save($item))
|
||||
{
|
||||
if ($item['id'] == 0)
|
||||
{
|
||||
// get the saved item
|
||||
$updatedItem = $model->getItem();
|
||||
$item['id']= $updatedItem->get('id');
|
||||
}
|
||||
// we have to force modified date since the model does not allow you
|
||||
if ($this->forchDateFix($item))
|
||||
{
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED'), 'status' => 'success');
|
||||
}
|
||||
// return error
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB'), 'status' => 'warning');
|
||||
}
|
||||
// return error
|
||||
return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED'), 'status' => 'danger');
|
||||
}
|
||||
|
||||
protected function forchDateFix($item)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->id = (int) $item['id'];
|
||||
$object->created = $item['created'];
|
||||
$object->modified = $item['modified'];
|
||||
// force update
|
||||
return Factory::getDbo()->updateObject('#__componentbuilder_snippet', $object, 'id');
|
||||
}
|
||||
|
||||
protected function getSnippetId($item)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = Factory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
$query->where($db->quoteName('a.name') . ' = ' . (string) $db->quote($item['name']));
|
||||
if (is_numeric($item['type']))
|
||||
{
|
||||
$query->where($db->quoteName('a.type') . ' = ' . (int) $item['type']);
|
||||
}
|
||||
if (is_numeric($item['library']))
|
||||
{
|
||||
$query->where($db->quoteName('a.library') . ' = ' . (int) $item['library']);
|
||||
}
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function createNew($name, $type, $user, $todayDate)
|
||||
{
|
||||
// verify that we can continue
|
||||
if (ComponentbuilderHelper::getActions($type)->get('core.create'))
|
||||
{
|
||||
// get the snippet model
|
||||
$model = ComponentbuilderHelper::getModel($type, JPATH_COMPONENT_ADMINISTRATOR);
|
||||
// build array to save
|
||||
$item['id'] = 0;
|
||||
$item['name'] = $name;
|
||||
$item['published'] = 1;
|
||||
$item['version'] = 1;
|
||||
$item['created'] = $todayDate;
|
||||
$item['created_by'] = $user->id;
|
||||
// save the new
|
||||
$model->save($item);
|
||||
// get the saved item
|
||||
$item = $model->getItem();
|
||||
return $item->get('id');
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Used in validation_rule
|
||||
@ -5434,4 +5270,150 @@ class AjaxModel extends ListModel
|
||||
return ['error' => Text::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
|
||||
// Used in initialization_selection
|
||||
/**
|
||||
* Method to get the target power
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function getTargetAreaPower($power): ?string
|
||||
{
|
||||
return $this->powers[$power] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the power get class
|
||||
*
|
||||
* @param string $repo The repo to list index
|
||||
* @param string $area The target area
|
||||
*
|
||||
* @return array
|
||||
* @since 5.2.1
|
||||
*/
|
||||
public function getRepoIndex(string $repo, string $area): array
|
||||
{
|
||||
if (!GuidHelper::valid($repo))
|
||||
{
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_INVALID_REPO_SELECTED')];
|
||||
}
|
||||
|
||||
if (($Power = $this->getTargetAreaPower($area)) === null)
|
||||
{
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_INVALID_AREA_SELECTED')];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$class = $this->getPowerClass($Power, "{$area}.Remote.Get");
|
||||
if ($class !== null)
|
||||
{
|
||||
$result = $class->list($repo);
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return ['success' => false, 'message' => $e->getMessage()];
|
||||
}
|
||||
|
||||
if ($result !== null)
|
||||
{
|
||||
return ['success' => true, 'index' => $result];
|
||||
}
|
||||
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_THE_REPO_INDEX_FAILED_TO_LOAD_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to initialize the selected powers
|
||||
*
|
||||
* @param string $repo The repo to list index
|
||||
* @param string $area The target area
|
||||
* @param array $selected The selected powers
|
||||
*
|
||||
* @return array
|
||||
* @since 5.2.1
|
||||
*/
|
||||
public function initSelectedPowers(string $repo, string $area, array $selected): array
|
||||
{
|
||||
if (!GuidHelper::valid($repo))
|
||||
{
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_INVALID_REPO_SELECTED')];
|
||||
}
|
||||
|
||||
if (($Power = $this->getTargetAreaPower($area)) === null)
|
||||
{
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_INVALID_AREA_SELECTED')];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
try
|
||||
{
|
||||
$class = $this->getPowerClass($Power, "{$area}.Remote.Get");
|
||||
if ($class !== null)
|
||||
{
|
||||
$repo_path = $class->path($repo);
|
||||
$result = $class->init($selected, $repo_path);
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return ['success' => false, 'message' => $e->getMessage()];
|
||||
}
|
||||
|
||||
if ($result !== [])
|
||||
{
|
||||
return ['success' => true, 'result_log' => $result];
|
||||
}
|
||||
|
||||
return ['success' => false, 'message' => Text::_('COM_COMPONENTBUILDER_THE_REPO_INDEX_FAILED_TO_LOAD_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
/**
|
||||
* The powers that we can initialize
|
||||
*
|
||||
* @var array
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected array $powers = [
|
||||
'AdminView' => 'PackageFactory',
|
||||
'Component' => 'PackageFactory',
|
||||
'CustomAdminView' => 'PackageFactory',
|
||||
'CustomCode' => 'PackageFactory',
|
||||
'DynamicGet' => 'PackageFactory',
|
||||
'Field' => 'PackageFactory',
|
||||
'Joomla.Fieldtype' => 'FieldtypeFactory',
|
||||
'Joomla.Power' => 'JoomlaPowerFactory',
|
||||
'Layout' => 'PackageFactory',
|
||||
'Library' => 'PackageFactory',
|
||||
'Module' => 'PackageFactory',
|
||||
'Power' => 'PowerFactory',
|
||||
'Plugin' => 'PackageFactory',
|
||||
'SiteView' => 'PackageFactory',
|
||||
'Snippet' => 'SnippetFactory',
|
||||
'Template' => 'PackageFactory'
|
||||
];
|
||||
|
||||
/**
|
||||
* Method to get the power get class
|
||||
*
|
||||
* @param string $factoryName The factory name
|
||||
* @param string $getClass The remote power class name
|
||||
*
|
||||
* @return GetInterface|null
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function getPowerClass(string $factoryName, string $getClass): ?GetInterface
|
||||
{
|
||||
return match ($factoryName) {
|
||||
'PowerFactory' => PowerFactory::_($getClass),
|
||||
'JoomlaPowerFactory' => JoomlaPowerFactory::_($getClass),
|
||||
'FieldtypeFactory' => FieldtypeFactory::_($getClass),
|
||||
'SnippetFactory' => SnippetFactory::_($getClass),
|
||||
'PackageFactory' => PackageFactory::_($getClass),
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ class FieldsModel extends ListModel
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.store LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.')');
|
||||
$query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.store LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.guid LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,283 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder List Model for Get_snippets
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Get_snippetsModel extends ListModel
|
||||
{
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||
'administrator/components/com_componentbuilder/assets/css/get_snippets.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_componentbuilder/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UI Kit components.
|
||||
*
|
||||
* @var mixed Property for storing UI Kit component-related data or objects.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected $uikitComp = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Make sure all records load, since no pagination allowed.
|
||||
$this->setState('list.limit', 0);
|
||||
// Get a db connection.
|
||||
$db = $this->getDatabase();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get from #__componentbuilder_snippet as a
|
||||
$query->select($db->quoteName(
|
||||
array('a.id','a.heading','a.name','a.url','a.created','a.modified'),
|
||||
array('id','heading','name','url','created','modified')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
|
||||
// Get from #__componentbuilder_snippet_type as b
|
||||
$query->select($db->quoteName(
|
||||
array('b.name'),
|
||||
array('type')));
|
||||
$query->join('LEFT', ($db->quoteName('#__componentbuilder_snippet_type', 'b')) . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
|
||||
// Get from #__componentbuilder_library as c
|
||||
$query->select($db->quoteName(
|
||||
array('c.name'),
|
||||
array('library')));
|
||||
$query->join('LEFT', ($db->quoteName('#__componentbuilder_library', 'c')) . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
|
||||
// return the query object
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$user = $this->user;
|
||||
// check if this user has permission to access items
|
||||
if (!$user->authorise('get_snippets.access', 'com_componentbuilder'))
|
||||
{
|
||||
$this->app->enqueueMessage(Text::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct to default view
|
||||
$this->app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Get the global params
|
||||
$globalParams = ComponentHelper::getParams('com_componentbuilder', true);
|
||||
|
||||
// Insure all item fields are adapted where needed.
|
||||
if (UtilitiesArrayHelper::check($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// Always create a slug for sef URL's
|
||||
$item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : '');
|
||||
}
|
||||
}
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp))
|
||||
{
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -22,14 +22,8 @@ use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use Joomla\CMS\Filesystem\Folder as FilesystemFolder;
|
||||
|
||||
|
412
admin/src/Model/Initialization_selectionModel.php
Normal file
412
admin/src/Model/Initialization_selectionModel.php
Normal file
@ -0,0 +1,412 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\MVC\Model\ItemModel;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Componentbuilder\Snippet\Factory as SnippetFactory;
|
||||
use VDM\Joomla\Interfaces\Remote\GetInterface;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Initialization_selection Item Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Initialization_selectionModel extends ItemModel
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $_context = 'com_componentbuilder.initialization_selection';
|
||||
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||
'administrator/components/com_componentbuilder/assets/css/initialization_selection.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_componentbuilder/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UI Kit components.
|
||||
*
|
||||
* @var mixed Property for storing UI Kit component-related data or objects.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected $uikitComp = [];
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
// Get the item main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('initialization_selection.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer $pk The id of the article.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
// check if this user has permission to access item
|
||||
if (!$this->user->authorise('initialization_selection.access', 'com_componentbuilder'))
|
||||
{
|
||||
$this->app->enqueueMessage(Text::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct to cPanel/default view
|
||||
$this->app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('initialization_selection.id');
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = [];
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDatabase();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get data
|
||||
$data = $this->getPaths();
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
// If no data is found redirect to default page and show warning.
|
||||
$app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
|
||||
$app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
|
||||
// set data object to item.
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
throw $e;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp))
|
||||
{
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the target power
|
||||
*
|
||||
* @return array|null
|
||||
*
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function getTargetAreaPower(): ?array
|
||||
{
|
||||
$power = $this->input->getString('power', null) ?? 'error';
|
||||
return $this->powers[$power] ? ['class' => $this->powers[$power], 'area' => $power] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the paths (repos) of this area.
|
||||
*
|
||||
* @return array|null
|
||||
* @throws \Exception
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function getPaths(): ?array
|
||||
{
|
||||
if (($Power = $this->getTargetAreaPower()) !== null)
|
||||
{
|
||||
try
|
||||
{
|
||||
$class = $this->getPowerClass($Power['class'], "{$Power['area']}.Remote.Get");
|
||||
if ($class === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ['repos' => $class->paths(), 'area_class' => $Power['area'], 'headers' => $class->getIndexHeader(), 'area_name' => $class->getArea()];
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
throw $e;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The powers that we can initialize
|
||||
*
|
||||
* @var array
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected array $powers = [
|
||||
'AdminView' => 'PackageFactory',
|
||||
'Component' => 'PackageFactory',
|
||||
'CustomAdminView' => 'PackageFactory',
|
||||
'CustomCode' => 'PackageFactory',
|
||||
'DynamicGet' => 'PackageFactory',
|
||||
'Field' => 'PackageFactory',
|
||||
'Joomla.Fieldtype' => 'FieldtypeFactory',
|
||||
'Joomla.Power' => 'JoomlaPowerFactory',
|
||||
'Layout' => 'PackageFactory',
|
||||
'Library' => 'PackageFactory',
|
||||
'Module' => 'PackageFactory',
|
||||
'Power' => 'PowerFactory',
|
||||
'Plugin' => 'PackageFactory',
|
||||
'SiteView' => 'PackageFactory',
|
||||
'Snippet' => 'SnippetFactory',
|
||||
'Template' => 'PackageFactory'
|
||||
];
|
||||
|
||||
/**
|
||||
* Method to get the power get class
|
||||
*
|
||||
* @param string $factoryName The factory name
|
||||
* @param string $getClass The remote power class name
|
||||
*
|
||||
* @return GetInterface|null
|
||||
* @since 5.2.1
|
||||
*/
|
||||
protected function getPowerClass(string $factoryName, string $getClass): ?GetInterface
|
||||
{
|
||||
return match ($factoryName) {
|
||||
'PowerFactory' => PowerFactory::_($getClass),
|
||||
'JoomlaPowerFactory' => JoomlaPowerFactory::_($getClass),
|
||||
'FieldtypeFactory' => FieldtypeFactory::_($getClass),
|
||||
'SnippetFactory' => SnippetFactory::_($getClass),
|
||||
'PackageFactory' => PackageFactory::_($getClass),
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
@ -257,7 +257,7 @@ class Joomla_powersModel extends ListModel
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.description LIKE '.$search.')');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.description LIKE '.$search.' OR a.settings LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,9 +248,11 @@ class RepositoriesModel extends ListModel
|
||||
{
|
||||
$targetArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION',
|
||||
1 => 'COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER',
|
||||
4 => 'COM_COMPONENTBUILDER_REPOSITORY_JCB_PACKAGES',
|
||||
3 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES',
|
||||
2 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER',
|
||||
3 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES'
|
||||
5 => 'COM_COMPONENTBUILDER_REPOSITORY_SNIPPETS',
|
||||
1 => 'COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value]))
|
||||
|
@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
@ -293,6 +294,14 @@ class SnippetModel extends AdminModel
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only load if new item
|
||||
if (0 == $id)
|
||||
{
|
||||
$form->setValue('contributor_company', null, Helper::getParams('com_componentbuilder')->get('export_company', 'Vast Development Method'));
|
||||
$form->setValue('contributor_name', null, Helper::getParams('com_componentbuilder')->get('export_owner', 'Llewellyn van der Merwe'));
|
||||
$form->setValue('contributor_email', null, Helper::getParams('com_componentbuilder')->get('export_email', 'joomla@vdm.io'));
|
||||
$form->setValue('contributor_website', null, Helper::getParams('com_componentbuilder')->get('export_website', 'https://www.vdm.io/'));
|
||||
}
|
||||
|
||||
// Only load the GUID if new item (or empty)
|
||||
if (0 == $id || !($val = $form->getValue('guid')))
|
||||
@ -905,23 +914,6 @@ class SnippetModel extends AdminModel
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// set the contributor details if not set
|
||||
if (strlen($data['contributor_company']) < 1 || strlen($data['contributor_name']) < 1 || strlen($data['contributor_email']) < 3 || strlen($data['contributor_website']) < 3)
|
||||
{
|
||||
// get the library name
|
||||
$library = ($name = GetHelper::var('library', $item['library'], 'id', 'name')) ? $name:'Common';
|
||||
// get the library name
|
||||
$type = ($name = GetHelper::var('snippet_type', $item['type'], 'id', 'name')) ? $name:'No Library';
|
||||
// build the filename
|
||||
$filename = UtilitiesStringHelper::safe($library . ' - (' . $type . ') ' . $item['name'], 'filename', '', false). '.json';
|
||||
// now get the contributor details (slow)
|
||||
$contributor = ComponentbuilderHelper::getContributorDetails($filename);
|
||||
// now update the local snippet contributor details
|
||||
$data['contributor_company'] = $contributor['contributor_company'];
|
||||
$data['contributor_name'] = $contributor['contributor_name'];
|
||||
$data['contributor_email'] = $contributor['contributor_email'];
|
||||
$data['contributor_website'] = $contributor['contributor_website'];
|
||||
}
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
if (empty($data['guid']) && $data['id'] > 0)
|
||||
|
@ -26,8 +26,6 @@ use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Filesystem\File;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@ -101,120 +99,6 @@ class SnippetsModel extends ListModel
|
||||
$this->app ??= Factory::getApplication();
|
||||
}
|
||||
|
||||
public $user;
|
||||
public $zipPath;
|
||||
|
||||
/**
|
||||
* Method to build the export package
|
||||
*
|
||||
* @return bool on success.
|
||||
*/
|
||||
public function shareSnippets($pks)
|
||||
{
|
||||
// setup the query
|
||||
if (UtilitiesArrayHelper::check($pks))
|
||||
{
|
||||
// Get the user object.
|
||||
if (!ObjectHelper::check($this->user))
|
||||
{
|
||||
$this->user = Factory::getUser();
|
||||
}
|
||||
// Create a new query object.
|
||||
if (!ObjectHelper::check($this->_db))
|
||||
{
|
||||
$this->_db = Factory::getDBO();
|
||||
}
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select($this->_db->quoteName(
|
||||
array('a.name','a.heading','a.description','a.usage','a.snippet','a.url','b.name','c.name','a.created','a.modified','a.contributor_company','a.contributor_name','a.contributor_email','a.contributor_website'),
|
||||
array('name','heading','description','usage','snippet','url','type','library','created','modified','contributor_company','contributor_name','contributor_email','contributor_website')
|
||||
));
|
||||
|
||||
// From the componentbuilder_snippet table
|
||||
$query->from($this->_db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
// From the componentbuilder_snippet_type table.
|
||||
$query->join('LEFT', $this->_db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $this->_db->quoteName('a.type') . ' = ' . $this->_db->quoteName('b.id') . ')');
|
||||
// From the componentbuilder_library table.
|
||||
$query->join('LEFT', $this->_db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $this->_db->quoteName('a.library') . ' = ' . $this->_db->quoteName('c.id') . ')');
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
|
||||
// Implement View Level Access
|
||||
if (!$this->user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $this->user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
||||
// Load the items
|
||||
$this->_db->setQuery($query);
|
||||
$this->_db->execute();
|
||||
if ($this->_db->getNumRows())
|
||||
{
|
||||
// load the items from db
|
||||
$items = $this->_db->loadObjectList();
|
||||
// check if we have items
|
||||
if (UtilitiesArrayHelper::check($items))
|
||||
{
|
||||
// get the shared paths
|
||||
$this->fullPath = rtrim(ComponentbuilderHelper::getFolderPath('path', 'sharepath', Factory::getConfig()->get('tmp_path')), '/') . '/snippets';
|
||||
// remove old folder with the same name
|
||||
if (is_dir($this->fullPath))
|
||||
{
|
||||
// remove if old folder is found
|
||||
ComponentbuilderHelper::removeFolder($this->fullPath);
|
||||
}
|
||||
// create the full path
|
||||
Folder::create($this->fullPath);
|
||||
// set zip path
|
||||
$this->zipPath = $this->fullPath .'.zip';
|
||||
// remove old zip files with the same name
|
||||
if (is_file($this->zipPath))
|
||||
{
|
||||
// remove file if found
|
||||
File::delete($this->zipPath);
|
||||
}
|
||||
// prep the item
|
||||
foreach($items as $item)
|
||||
{
|
||||
// just unlock the snippet
|
||||
$item->snippet = base64_decode($item->snippet);
|
||||
// build filename
|
||||
$fileName = StringHelper::safe($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false) . '.json';
|
||||
// if the snippet has its own contributor details set, then do not change
|
||||
if (!strlen($item->contributor_company) || !strlen($item->contributor_name) || !strlen($item->contributor_email) || !strlen($item->contributor_website))
|
||||
{
|
||||
// load the correct contributor details to each snippet (this is very slow)
|
||||
$_contributor = ComponentbuilderHelper::getContributorDetails($fileName);
|
||||
$item->contributor_company = $_contributor['contributor_company'];
|
||||
$item->contributor_name = $_contributor['contributor_name'];
|
||||
$item->contributor_email = $_contributor['contributor_email'];
|
||||
$item->contributor_website = $_contributor['contributor_website'];
|
||||
}
|
||||
// now store the snippet info
|
||||
ComponentbuilderHelper::writeFile($this->fullPath . '/' . $fileName, json_encode($item, JSON_PRETTY_PRINT));
|
||||
}
|
||||
// zip the folder
|
||||
if (!ComponentbuilderHelper::zip($this->fullPath, $this->zipPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// remove the folder
|
||||
if (!ComponentbuilderHelper::removeFolder($this->fullPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('admin_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('admin_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('admin_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('admin_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('admin_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('admin_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('admin_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('admin_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_views');
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('custom_admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('custom_admin_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_admin_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('custom_admin_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('custom_admin_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('custom_admin_views.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('custom_admin_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_admin_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_admin_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_admin_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('custom_code.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_code.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_code.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('custom_code.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_code.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('custom_code.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_code.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('custom_codes.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('custom_code.run_expansion', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('custom_code.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Run Expansion button.
|
||||
ToolbarHelper::custom('custom_codes.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('custom_codes.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_code.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('custom_codes.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('custom_code.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('custom_codes.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('dynamic_get.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_get.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_get.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('dynamic_get.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_get.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('dynamic_get.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_get.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('dynamic_gets.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('dynamic_gets.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('dynamic_gets.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('dynamic_get.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('dynamic_gets.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_gets');
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('field.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('field.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('field.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('field.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('field.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('field.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('field.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('field.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('field.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('field.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,21 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('fields.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('field.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('fields.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('field.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('fields.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('field.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fields.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('fields');
|
||||
|
@ -292,7 +292,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->canDo->get('fieldtype.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('fieldtype.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
@ -375,7 +375,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->canDo->get('fieldtype.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtype.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('fieldtype.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class HtmlView extends BaseHtmlView
|
||||
if ($this->user->authorise('fieldtype.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('fieldtypes.pushPowers', 'joomla custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
ToolbarHelper::custom('fieldtypes.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -1,397 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Get_snippets;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\HeaderCheck;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\Filesystem\File;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Get_snippets
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* The styles url array
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.0
|
||||
*/
|
||||
protected array $styles;
|
||||
|
||||
/**
|
||||
* The scripts url array
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.0
|
||||
*/
|
||||
protected array $scripts;
|
||||
|
||||
/**
|
||||
* The actions object
|
||||
*
|
||||
* @var object
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public object $canDo;
|
||||
|
||||
/**
|
||||
* The user object.
|
||||
*
|
||||
* @var User
|
||||
* @since 3.10.11
|
||||
*/
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null): void
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('get_snippets');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// Initialise variables.
|
||||
$this->items = $this->get('Items');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode(PHP_EOL, $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
|
||||
// Only load jQuery if needed. (default is true)
|
||||
if ($this->params->get('add_jquery_framework', 1) == 1)
|
||||
{
|
||||
Html::_('jquery.framework');
|
||||
}
|
||||
// Load the header checker class.
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new HeaderCheck();
|
||||
|
||||
// Add View JavaScript File
|
||||
Html::_('script', "administrator/components/com_componentbuilder/assets/js/get_snippets.js", ['version' => 'auto']);
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
||||
}
|
||||
|
||||
// Load the script to find all uikit components needed.
|
||||
if ($uikit != 2)
|
||||
{
|
||||
// Set the default uikit components in this view.
|
||||
$uikitComp = [];
|
||||
$uikitComp[] = 'data-uk-grid';
|
||||
}
|
||||
|
||||
// Load the needed uikit components in this view.
|
||||
if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp))
|
||||
{
|
||||
// loading...
|
||||
foreach ($uikitComp as $class)
|
||||
{
|
||||
foreach (ComponentbuilderHelper::$uk_components[$class] as $name)
|
||||
{
|
||||
// check if the CSS file exists.
|
||||
if (@file_exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css'))
|
||||
{
|
||||
// load the css.
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// check if the JavaScript file exists.
|
||||
if (@file_exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js'))
|
||||
{
|
||||
// load the js.
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the local snippets
|
||||
if (ArrayHelper::check($this->items))
|
||||
{
|
||||
$local_snippets = array();
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$path = StringHelper::safe($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json';
|
||||
$local_snippets[$path] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the JavaScript for JStore
|
||||
Html::_('script', 'media/com_componentbuilder/js/jquery.json.min.js', ['version' => 'auto']);
|
||||
Html::_('script', 'media/com_componentbuilder/js/jstorage.min.js', ['version' => 'auto']);
|
||||
Html::_('script', 'media/com_componentbuilder/js/strtotime.js', ['version' => 'auto']);
|
||||
// check if we should use browser storage
|
||||
$setBrowserStorage = $this->params->get('set_browser_storage', null);
|
||||
if ($setBrowserStorage)
|
||||
{
|
||||
// check what (Time To Live) show we use
|
||||
$storageTimeToLive = $this->params->get('storage_time_to_live', 'global');
|
||||
if ('global' == $storageTimeToLive)
|
||||
{
|
||||
// use the global session time
|
||||
$session = Factory::getSession();
|
||||
// must have itin milliseconds
|
||||
$expire = ($session->getExpire()*60)* 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the Componentbuilder Global setting
|
||||
if (0 != $storageTimeToLive)
|
||||
{
|
||||
// this will convert the time into milliseconds
|
||||
$storageTimeToLive = $storageTimeToLive * 1000;
|
||||
}
|
||||
$expire = $storageTimeToLive;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// set to use no storage
|
||||
$expire = 30000; // only 30 seconds
|
||||
}
|
||||
// Set the Time To Live To JavaScript
|
||||
$this->getDocument()->addScriptDeclaration("var expire = ". (int) $expire.";");
|
||||
// set snippet path
|
||||
$this->getDocument()->addScriptDeclaration("var snippetPath = '". ComponentbuilderHelper::$snippetPath ."';");
|
||||
$this->getDocument()->addScriptDeclaration("var snippetsPath = '". ComponentbuilderHelper::$snippetsPath ."';");
|
||||
// token
|
||||
$this->getDocument()->addScriptDeclaration("var token = '". Session::getFormToken() ."';");
|
||||
// add some global items buckets for bulk updating
|
||||
$this->getDocument()->addScriptDeclaration("var bulkItems = {};");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.new = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.diverged = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.ahead = [];");
|
||||
$this->getDocument()->addScriptDeclaration("bulkItems.behind = [];");
|
||||
// set an error message if needed
|
||||
$this->getDocument()->addScriptDeclaration("var returnError = '<div class=\"uk-alert uk-alert-warning\"><h1>".Text::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!</h1><p>".Text::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".</p></div>';");
|
||||
// need to add some language strings
|
||||
Text::script('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPETS');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_LOCAL_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY');
|
||||
Text::script('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_USAGE');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_DESCRIPTION');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_BLAME');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED');
|
||||
Text::script('COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED');
|
||||
Text::script('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR');
|
||||
Text::script('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS');
|
||||
Text::script('COM_COMPONENTBUILDER_JCB_COMMUNITY');
|
||||
Text::script('COM_COMPONENTBUILDER_COMPANY_NAME');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_NAME');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_EMAIL');
|
||||
Text::script('COM_COMPONENTBUILDER_AUTHOR_WEBSITE');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME');
|
||||
Text::script('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES');
|
||||
Text::script('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS');
|
||||
// add some lang verfy messages
|
||||
$this->getDocument()->addScriptDeclaration("
|
||||
// set the snippet from gitHub
|
||||
function getConfirmUpdate(status) {
|
||||
switch(status) {
|
||||
case 'new':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_ADD_THIS_NEW_JCB_COMMUNITY_SNIPPET_TO_YOUR_LOCAL_SNIPPETS')."';
|
||||
break;
|
||||
case 'behind':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_NEWER_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
case 'ahead':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_OLDER_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
case 'diverged':
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_REPLACE_YOUR_LOCAL_SNIPPET_WITH_THIS_JCB_COMMUNITY_SNIPPET')."';
|
||||
break;
|
||||
default:
|
||||
return '".Text::_('COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_CONTINUE')."';
|
||||
break;
|
||||
}
|
||||
}
|
||||
");
|
||||
// load the local snippets
|
||||
if (ArrayHelper::check($this->items))
|
||||
{
|
||||
// Set the local snippets array
|
||||
$this->getDocument()->addScriptDeclaration("var local_snippets = ". json_encode($local_snippets).";");
|
||||
}
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// add title to the page
|
||||
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search');
|
||||
// add cpanel button
|
||||
ToolbarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
if ($this->canDo->get('get_snippets.custom_admin_views'))
|
||||
{
|
||||
// add Custom Admin Views button.
|
||||
ToolbarHelper::custom('get_snippets.openCustomAdminViews', 'screen custom-button-opencustomadminviews', '', 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.site_views'))
|
||||
{
|
||||
// add Site Views button.
|
||||
ToolbarHelper::custom('get_snippets.openSiteViews', 'palette custom-button-opensiteviews', '', 'COM_COMPONENTBUILDER_SITE_VIEWS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.templates'))
|
||||
{
|
||||
// add Templates button.
|
||||
ToolbarHelper::custom('get_snippets.openTemplates', 'brush custom-button-opentemplates', '', 'COM_COMPONENTBUILDER_TEMPLATES', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.layouts'))
|
||||
{
|
||||
// add Layouts button.
|
||||
ToolbarHelper::custom('get_snippets.openLayouts', 'brush custom-button-openlayouts', '', 'COM_COMPONENTBUILDER_LAYOUTS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.snippets'))
|
||||
{
|
||||
// add Snippets button.
|
||||
ToolbarHelper::custom('get_snippets.openSnippets', 'pin custom-button-opensnippets', '', 'COM_COMPONENTBUILDER_SNIPPETS', false);
|
||||
}
|
||||
if ($this->canDo->get('get_snippets.libraries'))
|
||||
{
|
||||
// add Libraries button.
|
||||
ToolbarHelper::custom('get_snippets.openLibraries', 'puzzle custom-button-openlibraries', '', 'COM_COMPONENTBUILDER_LIBRARIES', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('get_snippets');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
211
admin/src/View/Initialization_selection/HtmlView.php
Normal file
211
admin/src/View/Initialization_selection/HtmlView.php
Normal file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Initialization_selection;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\HeaderCheck;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Initialization_selection
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null): void
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= Factory::getApplication()->getIdentity();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('initialization_selection');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// Initialise variables.
|
||||
$this->item = $this->get('Item');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode(PHP_EOL, $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
|
||||
// Only load jQuery if needed. (default is true)
|
||||
if ($this->params->get('add_jquery_framework', 1) == 1)
|
||||
{
|
||||
Html::_('jquery.framework');
|
||||
}
|
||||
// Load the header checker class.
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new HeaderCheck();
|
||||
|
||||
// always load these files.
|
||||
Html::_('stylesheet', "media/com_componentbuilder/uikit-v3/css/uikit.min.css", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/uikit.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/uikit-icons.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/uikit-v3/js/Uploader.min.js", ['version' => 'auto']);
|
||||
|
||||
// always load these files.
|
||||
Html::_('stylesheet', "media/com_componentbuilder/datatable-bootstrap5/css/datatables.min.css", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/pdfmake.min.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/vfs_fonts.js", ['version' => 'auto']);
|
||||
Html::_('script', "media/com_componentbuilder/datatable-bootstrap5/js/datatables.min.js", ['version' => 'auto']);
|
||||
|
||||
// Add View JavaScript File
|
||||
Html::_('script', "administrator/components/com_componentbuilder/assets/js/initialization_selection.js", ['version' => 'auto']);
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
||||
}
|
||||
// set some language strings for the JS class: [InitializationManager]
|
||||
Text::script("COM_COMPONENTBUILDER_MISSING_REPOSITORY_OR_AREA_DATA");
|
||||
Text::script("COM_COMPONENTBUILDER_FAILED_TO_RETRIEVE_REPOSITORY_INDEX");
|
||||
Text::script("COM_COMPONENTBUILDER_NETWORK_OR_SERVER_ERROR_OCCURRED_WHILE_FETCHING_INDEX");
|
||||
Text::script("COM_COMPONENTBUILDER_NO_ITEMS_SELECTED");
|
||||
Text::script("COM_COMPONENTBUILDER_FAILED_TO_INITIALIZE_SELECTED_POWERS");
|
||||
Text::script("COM_COMPONENTBUILDER_ERROR_OCCURRED_WHILE_INITIALIZING_POWERS");
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_ALREADY_PRESENT_LOCALLY_AND_WERE_NOT_INITIALIZED');
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_COULD_NOT_BE_FOUND_IN_THE_REMOTE_REPOSITORY_AND_WERE_NOT_INITIALIZED');
|
||||
Text::script('COM_COMPONENTBUILDER_THESE_ITEMS_WERE_SUCCESSFULLY_INITIALIZED');
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// set the title
|
||||
if (isset($this->item->name) && $this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
// Check for empty title and add view name if param is set
|
||||
if (empty($title))
|
||||
{
|
||||
$title = Text::_('COM_COMPONENTBUILDER_INITIALIZATION_SELECTION');
|
||||
}
|
||||
// add title to the page
|
||||
ToolbarHelper::title($title,'puzzle');
|
||||
// add cpanel button
|
||||
ToolbarHelper::custom('initialization_selection.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('initialization_selection');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('joomla_component.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_component.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_component.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('joomla_component.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('joomla_component.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('joomla_component.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_component.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_component.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_component.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('joomla_component.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -223,6 +223,21 @@ class HtmlView extends BaseHtmlView
|
||||
// add Clear tmp button.
|
||||
ToolbarHelper::custom('joomla_components.clearTmp', 'purge custom-button-cleartmp', '', 'COM_COMPONENTBUILDER_CLEAR_TMP', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('joomla_components.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_components.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_component.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('joomla_components.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_components');
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('layout.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layout.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layout.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('layout.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('layout.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('layout.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('layout.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layout.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('layout.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layout.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('layout.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('layouts.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('layout.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('layout.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('layouts.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('layouts.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('layout.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('layouts.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('layout.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('layouts.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('libraries.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('library.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('library.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('libraries.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('libraries.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('library.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('libraries.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('library.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('libraries.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('library.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('library.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('library.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('library.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('library.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('library.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('library.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('library.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('library.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('library.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('library.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('library.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('library.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('site_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('site_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('site_view.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('site_view.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('site_view.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_view.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('site_view.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_view.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('site_view.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -218,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('site_views.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('site_view.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('site_view.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('site_views.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('site_views.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('site_view.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('site_views.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('site_view.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('site_views.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('snippet.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippet.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippet.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('snippet.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippet.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('snippet.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippet.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -208,11 +208,6 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::checkin('snippets.checkin');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('snippet.share_snippets', 'com_componentbuilder'))
|
||||
{
|
||||
// add Share Snippets button.
|
||||
ToolbarHelper::custom('snippets.shareSnippets', 'share custom-button-sharesnippets', '', 'COM_COMPONENTBUILDER_SHARE_SNIPPETS', 'true');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
@ -223,10 +218,20 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::trash('snippets.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('snippet.get_snippets', 'com_componentbuilder'))
|
||||
if ($this->user->authorise('snippet.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
ToolbarHelper::custom('snippets.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('snippets.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('snippet.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('snippets.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->user->authorise('snippet.push', 'com_componentbuilder'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('snippets.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
|
@ -281,6 +281,16 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
ToolbarHelper::custom('template.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('template.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('template.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('template.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('template.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
@ -354,6 +364,16 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::apply('template.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('template.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($this->canDo->get('template.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('template.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
if ($this->canDo->get('template.push'))
|
||||
{
|
||||
// add Push button.
|
||||
ToolbarHelper::custom('template.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
|
||||
}
|
||||
ToolbarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user