Compare commits

...

34 Commits
v3.2.1 ... 3.x

Author SHA1 Message Date
f8b0a5df54 Release of v3.2.5
Add [AllowDynamicProperties] in the base view class for J5. Move the _prepareDocument  above the display call in the base view class. Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run. Added new import powers for custom import of spreadsheets. Move the setDocument and _prepareDocument above the display in the site view and custom admin view. Update the trashhelper layout to work in Joomla 5. Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues. Fix Save failed issue in dynamicGet. #1148. Move all [TEXT, EDITOR, TEXTAREA] fields from [NOT NULL] to [NULL]. Add the DateHelper class and improve the date methods. Add simple SessionHelper class. Add first classes for the new import engine. Improve the [VDM Registry] to be Joomla Registry Compatible. Move all registries to the [VDM Registry] class. Fix Checked Out to be null and not 0. (#1194). Fix created_by, modified_by, checked_out fields in the compiler of the SQL. (#1194). Update all core date fields in table class. (#1188). Update created_by, modified_by, checked_out fields in table class. Implementation of the decentralized Super-Power CORE repository network. (#1190). Fix the noticeboard to display Llewellyn's Joomla Social feed.
2025-02-14 22:59:16 +02:00
714cb5588a Release of v3.2.4
Add [push] option to Powers area. Fix [Save As Copy] error in library. #1162. Fix error when no components exist. #1164. Fix search page error caused by File class. Fix UserGroupList compiler triggers. #1100. Add Power field type integration: init, reset, push. Fix database default fields to allow NULL. #1169. Fix Power List field to allow searching. #1167. Remove Demo component from JCB v3; add Hello World component as demo. Fix missing working path in ZIP. Fix demo site view to display files. Fix message for Field Type init. Ensure type-agnostic comparisons by casting to CHAR in joins for dynamic retrieval. Fix dynamic download in site area with correct namespace. Fix missing edit button on fields in related views. Fix dashboard display issues. Re-add search option in use field of related views. Fix namespace issue that broke the linker.
2024-09-20 03:17:44 +02:00
c103c93e06 Release of v3.2.4-beta3
Fix the missing edit button on fields in the related views. Fix the dashboard display. Place the search option back in the use field of the related views. Fix the namespace issue that broken the linker.
2024-09-20 02:59:16 +02:00
112961dabf Release of v3.2.4-beta2
Fix the demo site view to also display files. Fix the message of field type init. Fix to ensure type-agnostic comparisons by casting to CHAR in joins in dynamic get. Fix dynamic download for site area to have correct namespace.
2024-09-19 05:47:28 +02:00
9d7ab17df6 Release of v3.2.4-beta1
Fix zip missing working path.
2024-09-18 23:19:46 +02:00
5a1ad16c9e Release of v3.2.4-alpha4
Fix database default fields to allow NULL. #1169. Fix the power list field to allow search. #1167. Remove Demo component from JCB v3 and added Hello Word component as demo in JCB v3.
2024-09-18 04:38:53 +02:00
6c2f52f59f Release of v3.2.4-alpha3
Fix usergrouplist compiler triggers. #1100.
2024-08-23 18:12:51 +02:00
209f625923 Update on v3.2.4-alpha2 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-08-21 22:00:43 +02:00
3ca5548481 Release of v3.2.4-alpha2
Fix library save as copy error. #1162. Fix the error when no components exists. #1164. Fix search page error due to File class.
2024-08-21 21:34:32 +02:00
4bed7a52da Release of v3.2.4-alpha1
Add push option to powers area.
2024-08-20 22:32:57 +02:00
ca7138cb4a Release of v3.2.3
Fix site view form missing classes in J4+. Fix permissions tab in items in J4+. Fix site display controller checkEditId function in J4+. Add class methods to the HtmlView classes in J4+. Fix broken toolbar call in HtmlView in J4+. Fix missing scripts and styles fields and methods in the site admin view model. Update subform field layout across JCB for cleaner look. Remove expansion feature. Fix helper area. Fix database mySql update in J4+. Remove phpspreadsheet completely from Joomla 4+. Add option to use powers in preflight event in the installer class. Fix abstract schema class function check default index warring. Fix dynamicGet so that the table values will load again. #1155. Keep jQuery in dynamicGet area for Joomla 3. Add native plugin builder for Joomla 4 & 5. Add basic API for admin views.
2024-08-16 19:20:22 +02:00
b3ced491d7 Release of v3.2.3-beta4
Add native plugin builder for Joomla 4 & 5.
2024-08-15 01:37:23 +02:00
3aaa91daf7 Release of v3.2.3-beta3
Keep jQuery in dynamicGet area for Joomla 3.
2024-08-01 19:40:49 +02:00
ce13c13f05 Release of v3.2.3-beta2
Fix dynamicGet so that the table values will load again. #1155.
2024-08-01 18:10:19 +02:00
101f0e65ed Release of v3.2.3-beta1
Fix abstract schema class function check default index warring.
2024-08-01 10:04:50 +02:00
51e786a197 Release of v3.2.3-alpha3
Fix database mySql update in J4+. Remove phpspreadsheet completely from Joomla 4+. Add option to use powers in preflight event in the installer class.
2024-07-27 22:48:41 +02:00
c55fc67db4 Release of v3.2.3-alpha2
Fix missing scripts and styles fields and methods in the site admin view model. Update subform field layout across JCB for cleaner look. Remove expansion feature. Fix helper area.
2024-07-26 18:33:01 +02:00
fd08d48baf Release of v3.2.3-alpha1
Fix site view form missing classes in J4+. Fix permissions tab in items in J4+. Fix site display controller checkEditId function in J4+. Add class methods to the HtmlView classes in J4+. Fix broken toolbar call in HtmlView in J4+.
2024-07-26 15:33:16 +02:00
36d0eb98ee Release of v3.2.2
Fix auto build from SQL in Joomla 4 and 5. Fix permission issue for admin views. Add extending options to interfaces. Update the Schema class to also update null mismatching if needed. Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes. Add new subform classes. Fix registry class methods return type. Update all list and custom fields to use the new layouts. Add push options to Joomla Power. Complete the Joomla Power Init and Reset features. Fix Gitea Contents class functions. Fix subform set methods. Improved the Joomla Power Push path. Fix the metadata, metadesc, metakey database issue. Fix function mismatch call in the compiler power class. Fix init feature to only add missing powers. Fix controller postSaveHook function, for correct model class in Joomla 4 and 5. Fix app instances (mismatch) in the install script and schema class when installing from CLI. Add option to use placeholders in Joomla Power namespaces. Fix subform layout of uikit in JCB.
2024-07-20 22:39:19 +02:00
af6649d9ca Release of v3.2.2-rc1
Final testing for stable release!.
2024-07-19 17:29:53 +02:00
15a4678a59 Release of v3.2.2-beta5
Add option to use placeholders in Joomla Power namespaces.
2024-07-19 12:35:06 +02:00
49d2a0bdf4 Update on v3.2.2-beta4 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-18 21:10:14 +02:00
a1705c5360 Release of v3.2.2-beta4
Fix app instances (mismatch) in the install script and schema class when installing from CLI.
2024-07-18 20:48:51 +02:00
b4792c097c Release of v3.2.2-beta3
Fix init feature to only add missing powers. Fix controller postSaveHook function, for correct model class in Joomla 4 and 5.
2024-07-18 17:11:47 +02:00
cab8ffa122 Update on v3.2.2-beta2 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-18 14:57:53 +02:00
421bb93ba4 Release of v3.2.2-beta2
Fix function mismatch call in the compiler power class.
2024-07-17 14:55:57 +02:00
b656269527 Release of v3.2.2-beta1
Fix subform set methods. Improved the Joomla Power Push path. Fix the metadata, metadesc, metakey database issue.
2024-07-17 02:39:35 +02:00
9e59163661 Release of v3.2.2-alpha7
Add push options to Joomla Power. Complete the Joomla Power Init and Reset features. Fix Gitea Contents class functions. Last Alpha release (feature block).
2024-07-08 22:53:46 +02:00
1d417c40f1 Release of v3.2.2-alpha6
Add new subform classes. Fix registry class methods return type. Update all list and custom fields to use the new layouts.
2024-06-28 03:48:57 +02:00
7a680bb734 Release of v3.2.2-alpha5
Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
2024-06-21 01:32:05 +02:00
894d691897 Release of v3.2.2-alpha4
Update the Schema class to also update null mismatching if needed.
2024-06-07 23:03:20 +02:00
b67e534b9f Release of v3.2.2-alpha3
Fix permission issue for admin views. Add extending options to interfaces.
2024-06-05 16:29:28 +02:00
dfaaf15ca9 Release of v3.2.2-alpha2
Fix permission issue for admin views.
2024-05-16 15:13:36 +02:00
f8d6607392 Release of v3.2.2-alpha1
Fix auto build from SQL in Joomla 4 and 5.
2024-05-13 12:23:57 +02:00
1861 changed files with 173741 additions and 61929 deletions

View File

@ -1,3 +1,93 @@
# v3.2.5
- Add [AllowDynamicProperties] in the base view class for J5
- Move the _prepareDocument above the display call in the base view class
- Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run.
- Added new import powers for custom import of spreadsheets.
- Move the setDocument and _prepareDocument above the display in the site view and custom admin view.
- Update the trashhelper layout to work in Joomla 5.
- Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues.
- Fix Save failed issue in dynamicGet. #1148
- Move all [TEXT, EDITOR, TEXTAREA] fields from [NOT NULL] to [NULL]
- Add the DateHelper class and improve the date methods.
- Add simple SessionHelper class.
- Add first classes for the new import engine.
- Improve the [VDM Registry] to be Joomla Registry Compatible
- Move all registries to the [VDM Registry] class
- Fix Checked Out to be null and not 0. (#1194)
- Fix created_by, modified_by, checked_out fields in the compiler of the SQL. (#1194)
- Update all core date fields in table class. (#1188)
- Update created_by, modified_by, checked_out fields in table class.
- Implementation of the decentralized Super-Power CORE repository network. (#1190)
- Fix the noticeboard to display Llewellyn's Joomla Social feed
# v3.2.4
- Add [push] option to Powers area.
- Fix [Save As Copy] error in library. #1162
- Fix error when no components exist. #1164
- Fix search page error caused by File class.
- Fix UserGroupList compiler triggers. #1100
- Add Power field type integration: init, reset, push.
- Fix database default fields to allow NULL. #1169
- Fix Power List field to allow searching. #1167
- Remove Demo component from JCB v3; add Hello World component as demo.
- Fix missing working path in ZIP.
- Fix demo site view to display files.
- Fix message for Field Type init.
- Ensure type-agnostic comparisons by casting to CHAR in joins for dynamic retrieval.
- Fix dynamic download in site area with correct namespace.
- Fix missing edit button on fields in related views.
- Fix dashboard display issues.
- Re-add search option in use field of related views.
- Fix namespace issue that broke the linker.
# v3.2.3
- Fix site view form missing classes in J4+
- Fix permissions tab in items in J4+
- Fix site display controller checkEditId function in J4+
- Add class methods to the HtmlView classes in J4+
- Fix broken toolbar call in HtmlView in J4+
- Fix missing scripts and styles fields and methods in the site admin view model
- Update subform field layout across JCB for cleaner look
- Remove expansion feature
- Fix helper area
- Fix database mySql update in J4+
- Remove phpspreadsheet completely from Joomla 4+
- Add option to use powers in preflight event in the installer class
- Fix abstract schema class function check default index warring
- Fix dynamicGet so that the table values will load again. #1155
- Keep jQuery in dynamicGet area for Joomla 3
- Add native plugin builder for Joomla 4 & 5
- Add basic API for admin views
# v3.2.2
- Fix auto build from SQL in Joomla 4 and 5.
- Fix permission issue for admin views.
- Add extending options to interfaces.
- Update the Schema class to also update null mismatching if needed
- Add repositories for better integration with gitea
- Refactored the Data classes
- Add new Data classes
- Add new subform classes
- Fix registry class methods return type
- Update all list and custom fields to use the new layouts
- Add push options to Joomla Power
- Complete the Joomla Power Init and Reset features
- Fix Gitea Contents class functions
- Fix subform set methods
- Improved the Joomla Power Push path
- Fix the metadata, metadesc, metakey database issue
- Fix function mismatch call in the compiler power class.
- Fix init feature to only add missing powers
- Fix controller postSaveHook function, for correct model class in Joomla 4 and 5
- Fix app instances (mismatch) in the install script and schema class when installing from CLI
- Add option to use placeholders in Joomla Power namespaces.
- Fix subform layout of uikit in JCB
# v3.2.1
- Add power path override option on component level.

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/5.x/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
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 (3.2.1) 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 (3.2.5) 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*: 10th May, 2024
+ *Version*: 3.2.1
+ *Last Build*: 14th February, 2025
+ *Version*: 3.2.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **761616**
+ *Field count*: **2097**
+ *File count*: **5292**
+ *Folder count*: **471**
+ *Line count*: **885901**
+ *Field count*: **2098**
+ *File count*: **5977**
+ *Folder count*: **507**
> 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)

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/5.x/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
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 (3.2.1) 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 (3.2.5) 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*: 10th May, 2024
+ *Version*: 3.2.1
+ *Last Build*: 14th February, 2025
+ *Version*: 3.2.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **761616**
+ *Field count*: **2097**
+ *File count*: **5292**
+ *Folder count*: **471**
+ *Line count*: **885901**
+ *Field count*: **2098**
+ *File count*: **5977**
+ *Folder count*: **507**
> 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)

View File

@ -15,7 +15,6 @@
<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.run_expansion" title="COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_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" />
@ -108,7 +107,6 @@
<action name="compiler.clear_tmp" title="COM_COMPONENTBUILDER_COMPILER_CLEAR_TMP_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_COMPILER_CLEAR_TMP_BUTTON_ACCESS_DESC" />
<action name="compiler.compiler_animations" title="COM_COMPONENTBUILDER_COMPILER_COMPILER_ANIMATIONS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_COMPILER_COMPILER_ANIMATIONS_BUTTON_ACCESS_DESC" />
<action name="compiler.dashboard_list" title="COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST_DESC" />
<action name="compiler.run_expansion" title="COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="compiler.submenu" title="COM_COMPONENTBUILDER_COMPILER_SUBMENU" description="COM_COMPONENTBUILDER_COMPILER_SUBMENU_DESC" />
<action name="compiler.translate" title="COM_COMPONENTBUILDER_COMPILER_TRANSLATE_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_COMPILER_TRANSLATE_BUTTON_ACCESS_DESC" />
<action name="component_admin_views.access" title="COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_ACCESS_DESC" />
@ -264,7 +262,6 @@
<action name="custom_code.export" title="COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT" description="COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT_DESC" />
<action name="custom_code.import" title="COM_COMPONENTBUILDER_CUSTOM_CODES_IMPORT" description="COM_COMPONENTBUILDER_CUSTOM_CODES_IMPORT_DESC" />
<action name="custom_code.submenu" title="COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU" description="COM_COMPONENTBUILDER_CUSTOM_CODES_SUBMENU_DESC" />
<action name="dynamic_get.run_expansion" title="COM_COMPONENTBUILDER_DYNAMIC_GET_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_DYNAMIC_GET_RUN_EXPANSION_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" />
@ -278,7 +275,6 @@
<action name="dynamic_get.export" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT_DESC" />
<action name="dynamic_get.import" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT_DESC" />
<action name="dynamic_get.submenu" title="COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU" description="COM_COMPONENTBUILDER_DYNAMIC_GETS_SUBMENU_DESC" />
<action name="field.run_expansion" title="COM_COMPONENTBUILDER_FIELD_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELD_RUN_EXPANSION_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" />
@ -292,6 +288,9 @@
<action name="field.export" title="COM_COMPONENTBUILDER_FIELDS_EXPORT" description="COM_COMPONENTBUILDER_FIELDS_EXPORT_DESC" />
<action name="field.import" title="COM_COMPONENTBUILDER_FIELDS_IMPORT" description="COM_COMPONENTBUILDER_FIELDS_IMPORT_DESC" />
<action name="field.submenu" title="COM_COMPONENTBUILDER_FIELDS_SUBMENU" description="COM_COMPONENTBUILDER_FIELDS_SUBMENU_DESC" />
<action name="fieldtype.init" title="COM_COMPONENTBUILDER_FIELDTYPE_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPE_INIT_BUTTON_ACCESS_DESC" />
<action name="fieldtype.push" title="COM_COMPONENTBUILDER_FIELDTYPE_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPE_PUSH_BUTTON_ACCESS_DESC" />
<action name="fieldtype.reset" title="COM_COMPONENTBUILDER_FIELDTYPE_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPE_RESET_BUTTON_ACCESS_DESC" />
<action name="fieldtype.access" title="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS_DESC" />
<action name="fieldtype.batch" title="COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE" description="COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE_DESC" />
<action name="fieldtype.create" title="COM_COMPONENTBUILDER_FIELDTYPES_CREATE" description="COM_COMPONENTBUILDER_FIELDTYPES_CREATE_DESC" />
@ -330,7 +329,6 @@
<action name="joomla_component.clone" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS_DESC" />
<action name="joomla_component.export_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
<action name="joomla_component.import_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
<action name="joomla_component.run_expansion" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_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" />
@ -344,7 +342,6 @@
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
<action name="joomla_module.get_snippets" title="COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
<action name="joomla_module.run_expansion" title="COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="joomla_module.access" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS_DESC" />
<action name="joomla_module.batch" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC" />
<action name="joomla_module.create" title="COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE_DESC" />
@ -385,7 +382,6 @@
<action name="joomla_plugin_group.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC" />
<action name="joomla_plugin.methods" title="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS_DESC" />
<action name="joomla_plugin.properties" title="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC" />
<action name="joomla_plugin.run_expansion" title="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="joomla_plugin.access" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC" />
<action name="joomla_plugin.batch" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC" />
<action name="joomla_plugin.create" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE_DESC" />
@ -419,6 +415,7 @@
<action name="joomla_plugin_updates.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC" />
<action name="joomla_plugin_updates.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC" />
<action name="joomla_power.init" title="COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC" />
<action name="joomla_power.push" title="COM_COMPONENTBUILDER_JOOMLA_POWER_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWER_PUSH_BUTTON_ACCESS_DESC" />
<action name="joomla_power.reset" title="COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC" />
<action name="joomla_power.access" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC" />
<action name="joomla_power.batch" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE_DESC" />
@ -507,8 +504,8 @@
<action name="placeholder.import" title="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT" description="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT_DESC" />
<action name="placeholder.submenu" title="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU" description="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU_DESC" />
<action name="power.init" title="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC" />
<action name="power.push" title="COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS_DESC" />
<action name="power.reset" title="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC" />
<action name="power.run_expansion" title="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="power.access" title="COM_COMPONENTBUILDER_POWERS_ACCESS" description="COM_COMPONENTBUILDER_POWERS_ACCESS_DESC" />
<action name="power.batch" title="COM_COMPONENTBUILDER_POWERS_BATCH_USE" description="COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC" />
<action name="power.create" title="COM_COMPONENTBUILDER_POWERS_CREATE" description="COM_COMPONENTBUILDER_POWERS_CREATE_DESC" />
@ -521,6 +518,18 @@
<action name="power.edit.state" title="COM_COMPONENTBUILDER_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC" />
<action name="power.version" title="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION_DESC" />
<action name="power.submenu" title="COM_COMPONENTBUILDER_POWERS_SUBMENU" description="COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC" />
<action name="repository.access" title="COM_COMPONENTBUILDER_REPOSITORIES_ACCESS" description="COM_COMPONENTBUILDER_REPOSITORIES_ACCESS_DESC" />
<action name="repository.batch" title="COM_COMPONENTBUILDER_REPOSITORIES_BATCH_USE" description="COM_COMPONENTBUILDER_REPOSITORIES_BATCH_USE_DESC" />
<action name="repository.create" title="COM_COMPONENTBUILDER_REPOSITORIES_CREATE" description="COM_COMPONENTBUILDER_REPOSITORIES_CREATE_DESC" />
<action name="repository.dashboard_list" title="COM_COMPONENTBUILDER_REPOSITORIES_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_REPOSITORIES_DASHBOARD_LIST_DESC" />
<action name="repository.delete" title="COM_COMPONENTBUILDER_REPOSITORIES_DELETE" description="COM_COMPONENTBUILDER_REPOSITORIES_DELETE_DESC" />
<action name="repository.edit" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_DESC" />
<action name="repository.edit.created_by" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY_DESC" />
<action name="repository.edit.created" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE_DESC" />
<action name="repository.edit.own" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN_DESC" />
<action name="repository.edit.state" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE_DESC" />
<action name="repository.version" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION_DESC" />
<action name="repository.submenu" title="COM_COMPONENTBUILDER_REPOSITORIES_SUBMENU" description="COM_COMPONENTBUILDER_REPOSITORIES_SUBMENU_DESC" />
<action name="search.access" title="COM_COMPONENTBUILDER_SEARCH_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC" />
<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" />
@ -573,7 +582,6 @@
<action name="template.export" title="COM_COMPONENTBUILDER_TEMPLATES_EXPORT" description="COM_COMPONENTBUILDER_TEMPLATES_EXPORT_DESC" />
<action name="template.import" title="COM_COMPONENTBUILDER_TEMPLATES_IMPORT" description="COM_COMPONENTBUILDER_TEMPLATES_IMPORT_DESC" />
<action name="template.submenu" title="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU" description="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU_DESC" />
<action name="validation_rule.run_expansion" title="COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="validation_rule.access" title="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS" description="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC" />
<action name="validation_rule.batch" title="COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC" />
<action name="validation_rule.create" title="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC" />
@ -814,6 +822,17 @@
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
<action name="server.version" title="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC" />
</section>
<section name="repository">
<action name="repository.edit" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_DESC" />
<action name="repository.edit.own" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN_DESC" />
<action name="repository.edit.state" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE_DESC" />
<action name="repository.edit.created_by" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY_DESC" />
<action name="repository.edit.created" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE_DESC" />
<action name="repository.create" title="COM_COMPONENTBUILDER_REPOSITORIES_CREATE" description="COM_COMPONENTBUILDER_REPOSITORIES_CREATE_DESC" />
<action name="repository.delete" title="COM_COMPONENTBUILDER_REPOSITORIES_DELETE" description="COM_COMPONENTBUILDER_REPOSITORIES_DELETE_DESC" />
<action name="repository.access" title="COM_COMPONENTBUILDER_REPOSITORIES_ACCESS" description="COM_COMPONENTBUILDER_REPOSITORIES_ACCESS_DESC" />
<action name="repository.version" title="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION" description="COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION_DESC" />
</section>
<section name="help_document">
<action name="help_document.edit" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_DESC" />
<action name="help_document.edit.own" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC" />

View File

@ -16,4 +16,97 @@ html, body {
.jcb-sponsor-banner {
-webkit-box-shadow: 0 0 7px 1px #f0f0f0;
box-shadow: 0 0 7px 1px #f0f0f0;
}
/* Spinning effect within the mastadon-display-block */
.mastadon-display-block .spinning i {
animation: spin 1s linear infinite;
}
.mastadon-display-block .enlarge-and-disappear {
animation: enlarge-fade-out 1s forwards;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes enlarge-fade-out {
0% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(2);
opacity: 0;
}
}
/* Placeholder container scoped to mastadon-display-block */
.mastadon-display-block .placeholder {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 16px;
padding: 16px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
.mastadon-display-block .placeholder-line {
height: 12px;
background-color: #f0f0f0;
border-radius: 4px;
animation: pulse 1.5s infinite;
}
.mastadon-display-block .placeholder-line:nth-child(1) {
width: 80%;
}
.mastadon-display-block .placeholder-line:nth-child(2) {
width: 60%;
}
.mastadon-display-block .placeholder-line:nth-child(3) {
width: 40%;
}
.mastadon-display-block .placeholder-circle {
width: 50px;
height: 50px;
background-color: #f0f0f0;
border-radius: 50%;
animation: pulse 1.5s infinite;
margin-top: 10px;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
.mastadon-display-block .loading {
visibility: visible;
position: relative;
}
.social-icon-details {
min-height: 50px;
width: 100%;
padding: 5px;
box-sizing: border-box;
font-size: 10px;
text-align: right;
}

View File

@ -0,0 +1,13 @@
/**
* @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
*/
/* CSS Document */

View File

@ -0,0 +1,13 @@
/**
* @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
*/
/* CSS Document */

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

302
admin/assets/js/compiler.js Normal file
View File

@ -0,0 +1,302 @@
/**
* @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 */
class MastodonFeed {
constructor(containerId, refreshButtonId) {
this.container = document.getElementById(containerId);
this.refreshButton = document.getElementById(refreshButtonId);
// Get settings from data attributes
this.mastodonInstance = this.container.dataset.instance;
this.accountId = this.container.dataset.accountId;
this.postCount = parseInt(this.container.dataset.postCount) || 5;
this.cacheKey = "mastodon-feed-cache";
this.cacheExpiration = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
// Initialize the feed
this.initFeed();
// Attach event listener for the refresh button
this.refreshButton.addEventListener("click", () => this.clearCacheAndReload());
}
async initFeed() {
const cachedData = this.getCachedData();
if (cachedData) {
this.renderFeed(cachedData);
} else {
await this.loadFeed();
}
}
getCachedData() {
const cache = localStorage.getItem(this.cacheKey);
if (!cache) return null;
const parsedCache = JSON.parse(cache);
const now = new Date().getTime();
if (now - parsedCache.timestamp > this.cacheExpiration) {
// Cache is expired
this.clearCache();
return null;
}
return parsedCache.data;
}
setCachedData(data) {
const cache = {
timestamp: new Date().getTime(),
data: data,
};
localStorage.setItem(this.cacheKey, JSON.stringify(cache));
}
clearCache() {
localStorage.removeItem(this.cacheKey);
}
async loadFeed() {
try {
const response = await fetch(`${this.mastodonInstance}/api/v1/accounts/${this.accountId}/statuses?limit=${this.postCount}`);
if (!response.ok) {
throw new Error(`Failed to fetch Mastodon feed: ${response.statusText}`);
}
const posts = await response.json();
this.setCachedData(posts); // Cache the data
this.renderFeed(posts);
} catch (error) {
console.error("Error loading Mastodon feed:", error);
this.container.innerHTML = `<div class="alert alert-danger">Error loading feed. Please try again later.</div>`;
}
}
renderFeed(posts) {
// Clear existing content
this.container.innerHTML = "";
posts.forEach(post => {
if (!post.content) return; // Ignore posts with no content
// Create post element
const listItem = document.createElement("div");
listItem.className = "well well-small";
const postContent = document.createElement("div");
const user = post.account;
const avatar = user.avatar_static;
const displayName = user.display_name || user.username;
// User header
const header = document.createElement("div");
header.className = "media";
const avatarLink = document.createElement("a");
avatarLink.href = user.url;
avatarLink.className = "pull-left";
const avatarImg = document.createElement("img");
avatarImg.src = avatar;
avatarImg.alt = displayName;
avatarImg.className = "img-circle";
avatarImg.style.width = "40px";
avatarLink.appendChild(avatarImg);
const userInfo = document.createElement("div");
userInfo.className = "media-body";
const nameLink = document.createElement("a");
nameLink.href = user.url;
nameLink.className = "muted";
nameLink.textContent = displayName;
const username = document.createElement("span");
username.className = "small muted";
username.textContent = ` (@${user.username})`;
const userHeader = document.createElement("h5");
userHeader.appendChild(nameLink);
userHeader.appendChild(username);
userInfo.appendChild(userHeader);
header.appendChild(avatarLink);
header.appendChild(userInfo);
// Post content
const content = document.createElement("p");
content.innerHTML = post.content;
// Interactions
const interactions = document.createElement("div");
interactions.className = "btn-group";
// View Post link
const viewPost = document.createElement("a");
viewPost.href = post.url;
viewPost.className = "btn btn-small btn-primary";
viewPost.innerHTML = `View Post&nbsp;&nbsp;
&nbsp;&nbsp;<i class="icon-comments"></i> ${post.replies_count}&nbsp;
&nbsp;&nbsp;<i class="icon-thumbs-up"></i> ${post.favourites_count}&nbsp;
<i class="icon-loop"></i> ${post.reblogs_count}`;
interactions.appendChild(viewPost);
// Join Me link
const joinLink = document.createElement("a");
joinLink.href = "https://joomla.social/invite/gzAvC48K";
joinLink.className = "btn btn-small btn-success";
joinLink.textContent = "Join Me";
interactions.appendChild(joinLink);
// Assemble post
postContent.appendChild(header);
postContent.appendChild(content);
postContent.appendChild(interactions);
listItem.appendChild(postContent);
this.container.appendChild(listItem);
this.container.classList.remove('loading');
});
}
clearCacheAndReload() {
// Add spinning effect to the refresh button
this.refreshButton.classList.add('spinning');
// Show placeholder content
this.container.classList.add('loading');
this.container.innerHTML = this.generatePlaceholder();
// Clear cache and reload feed
this.clearCache();
// Wait for 3 seconds
setTimeout(() => {
// Enlarge and fade out the refresh button
this.refreshButton.classList.add('enlarge-and-disappear');
// After the animation, reset the button and content
setTimeout(() => {
this.refreshButton.classList.remove('spinning', 'enlarge-and-disappear');
this.refreshButton.style.display = '';
// Remove placeholder and restore actual content
this.loadFeed();
}, 1000); // Animation time for fade-out
}, 3000); // Spinning duration
}
generatePlaceholder() {
let placeholders = '';
for (let i = 0; i < this.postCount; i++) {
placeholders += `
<div class="placeholder">
<div class="placeholder-circle"></div>
<div class="placeholder-line"></div>
<div class="placeholder-line"></div>
<div class="placeholder-line"></div>
<div class="placeholder-line"></div>
</div>
`;
}
return placeholders;
}
}
class IconWaveAnimator {
constructor(containerId, detailsId) {
this.details = document.getElementById(detailsId);
this.container = document.getElementById(containerId);
this.icons = this.container.querySelectorAll("i");
this.links = this.container.querySelectorAll("a");
this.init();
}
init() {
// set the icon hover events
this.setupHoverEvents();
// Random chance to do nothing (1 out of 10)
if (Math.random() < 0.1) return;
// Randomize the initial delay before starting
const initialDelay = Math.random() * 2000 + 2000; // 24 seconds
setTimeout(() => {
this.randomBehavior();
}, initialDelay);
// Occasionally trigger a second wave after 10 seconds
if (Math.random() > 0.5) {
setTimeout(() => {
this.mexicanWave(false); // Reverse wave
}, 10000);
}
}
mexicanWave(forward = true) {
let delay = 0;
const iconsArray = Array.from(this.icons);
(forward ? iconsArray : iconsArray.reverse()).forEach((icon) => {
setTimeout(() => {
icon.style.transition = "transform 0.3s ease-in-out";
icon.style.transform = "scale(1.3)";
setTimeout(() => {
icon.style.transform = "scale(1)";
}, 300);
}, delay);
delay += 150; // Stagger the effect for the wave
});
}
randomBehavior() {
const waveDirection = Math.random() > 0.5 ? "forward" : "backward";
const waveCount = Math.floor(Math.random() * 10) + 1; // 1 to 5 waves
const interval = Math.random() * 2000 + 3000; // 3 to 5 seconds
let executedCount = 0;
const intervalId = setInterval(() => {
if (executedCount >= waveCount) {
clearInterval(intervalId);
return;
}
this.mexicanWave(waveDirection === "forward");
executedCount++;
}, interval);
}
setupHoverEvents() {
this.links.forEach((link) => {
link.addEventListener("mouseenter", () => this.showDetails(link));
link.addEventListener("mouseleave", () => this.clearDetails());
});
}
showDetails(link) {
const description = link.dataset.description;
if (this.details && description) {
this.details.textContent = description;
}
}
clearDetails() {
if (this.details) {
this.details.textContent = "";
}
}
}

View File

@ -426,7 +426,7 @@ class ###Component###Model###View### extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
###ADMIN_HELPER_CLASS_HEADER###

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
###SITE_CUSTOM_POWER_AUTOLOADER###
###SITE_POWER_AUTOLOADER###
###SITE_HELPER_CLASS_HEADER###

View File

@ -35,6 +35,9 @@ class ###Component###View###SView### extends HtmlView
$this->user = Factory::getUser();
// get global action permissions
$this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD###
// Display the template
parent::display($tpl);
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
/**
@ -96,7 +99,7 @@ class ###Component###View###SView### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -72,11 +72,11 @@ class ###Component###View###View### extends HtmlView
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
// Display the template
parent::display($tpl);
}
@ -113,6 +113,11 @@ class ###Component###View###View### extends HtmlView
*/
protected function setDocument()
{
// Load Core
Html::_('behavior.core');
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
Html::_('stylesheet', "administrator/components/com_###component###/assets/css/###view###.css", ['version' => 'auto']);###AJAXTOKE######LINKEDVIEWTABLESCRIPTS###
@ -126,7 +131,7 @@ class ###Component###View###View### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -72,11 +72,11 @@ class ###Component###View###View### extends HtmlView
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
// Display the template
parent::display($tpl);
}
@ -114,6 +114,11 @@ class ###Component###View###View### extends HtmlView
*/
protected function setDocument()
{
// Load Core
Html::_('behavior.core');
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
// only add the ISIS template css & js if needed (default is 1 = true)
@ -139,7 +144,7 @@ class ###Component###View###View### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -100,4 +100,14 @@ class ###Component###ViewImport extends HtmlView
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Get the Document (helper method toward Joomla 4 and 5)
*/
public function getDocument()
{
$this->document ??= Factory::getDocument();
return $this->document;
}
}

View File

@ -51,4 +51,14 @@ class ###Component###View###View### extends HtmlView
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Get the Document (helper method toward Joomla 4 and 5)
*/
public function getDocument()
{
$this->document ??= Factory::getDocument();
return $this->document;
}
}

View File

@ -65,11 +65,11 @@ class ###Component###View###Views### extends HtmlView
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
// Display the template
parent::display($tpl);
}
/**
@ -151,6 +151,11 @@ class ###Component###View###Views### extends HtmlView
*/
protected function setDocument()
{
// Load Core
Html::_('behavior.core');
// Load jQuery
Html::_('jquery.framework');
if (!isset($this->document))
{
$this->document = Factory::getDocument();
@ -192,7 +197,7 @@ class ###Component###View###Views### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}###FILTERFUNCTIONS###

View File

@ -35,6 +35,9 @@ class ###Component###View###SViews### extends HtmlView
$this->user = Factory::getUser();
// get global action permissions
$this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD###
// Display the template
parent::display($tpl);
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
/**
@ -86,7 +89,7 @@ class ###Component###View###SViews### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -33,6 +33,9 @@ class ###Component###View###SViews### extends HtmlView
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = Factory::getUser();###SITE_DIPLAY_METHOD###
// Display the template
parent::display($tpl);
}###SITE_EXTRA_DIPLAY_METHODS###
/**
@ -78,7 +81,7 @@ class ###Component###View###SViews### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -33,6 +33,9 @@ class ###Component###View###SView### extends HtmlView
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = Factory::getUser();###SITE_DIPLAY_METHOD###
// Display the template
parent::display($tpl);
}###SITE_EXTRA_DIPLAY_METHODS###
/**
@ -78,7 +81,7 @@ class ###Component###View###SView### extends HtmlView
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
$this->document ??= Factory::getDocument();
return $this->document;
}

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
###ADMIN_COMPONENT_HEADER###

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
###SITE_CUSTOM_POWER_AUTOLOADER###
###SITE_POWER_AUTOLOADER###
###SITE_COMPONENT_HEADER###

View File

@ -28,6 +28,8 @@ HTML::_('bootstrap.renderModal');
/**
* Script File of ###Component### Component
*
* @since 1.5.0
*/
class Com_###Component###InstallerScript
{
@ -35,6 +37,7 @@ class Com_###Component###InstallerScript
* Constructor
*
* @param ComponentAdapter $parent The object responsible for running this script
* @since 1.5.0
*/
public function __construct(ComponentAdapter $parent) {}
@ -44,6 +47,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function install(ComponentAdapter $parent) {}
@ -51,6 +55,8 @@ class Com_###Component###InstallerScript
* Called on uninstallation
*
* @param ComponentAdapter $parent The object responsible for running this script
*
* @since 1.5.0
*/
public function uninstall(ComponentAdapter $parent)
{###UNINSTALLSCRIPT###
@ -68,6 +74,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function update(ComponentAdapter $parent){}
@ -78,6 +85,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function preflight($type, ComponentAdapter $parent)
{
@ -121,6 +129,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function postflight($type, ComponentAdapter $parent)
{
@ -138,76 +147,77 @@ class Com_###Component###InstallerScript
}
/**
* Remove folders with files
* Remove folders with files (with ignore options)
*
* @param string $dir The path to folder to remove
* @param boolean $ignore The folders and files to ignore and not remove
*
* @return boolean True in all is removed
* @param string $dir The path to the folder to remove.
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
*/
protected function removeFolder($dir, $ignore = false)
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
if (Folder::exists($dir))
if (!is_dir($dir))
{
$it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
// remove ending /
$dir = rtrim($dir, '/');
// now loop the files & folders
foreach ($it as $file)
{
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
// set file dir
$file_dir = $file->getPathname();
// check if this is a dir or a file
if ($file->isDir())
{
$keeper = false;
if ($this->checkArray($ignore))
{
foreach ($ignore as $keep)
{
if (strpos($file_dir, $dir.'/'.$keep) !== false)
{
$keeper = true;
}
}
}
if ($keeper)
{
continue;
}
Folder::delete($file_dir);
}
else
{
$keeper = false;
if ($this->checkArray($ignore))
{
foreach ($ignore as $keep)
{
if (strpos($file_dir, $dir.'/'.$keep) !== false)
{
$keeper = true;
}
}
}
if ($keeper)
{
continue;
}
File::delete($file_dir);
}
}
// delete the root folder if not ignore found
if (!$this->checkArray($ignore))
{
return Folder::delete($dir);
}
return true;
return false;
}
return false;
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
// Remove trailing slash
$dir = rtrim($dir, '/');
foreach ($it as $file)
{
$filePath = $file->getPathname();
$relativePath = str_replace($dir . '/', '', $filePath);
if ($ignore !== null && in_array($relativePath, $ignore, true))
{
continue;
}
if ($file->isDir())
{
Folder::delete($filePath);
}
else
{
File::delete($filePath);
}
}
// Delete the root folder if there are no ignored files/folders left
if ($ignore === null || $this->isDirEmpty($dir, $ignore))
{
return Folder::delete($dir);
}
return true;
}
/**
* Check if a directory is empty considering ignored files/folders.
*
* @param string $dir The path to the folder to check.
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
foreach ($it as $file)
{
$relativePath = str_replace($dir . '/', '', $file->getPathname());
if (!in_array($relativePath, $ignore, true))
{
return false;
}
}
return true;
}
/**
@ -216,6 +226,7 @@ class Com_###Component###InstallerScript
* @input array The array to check
*
* @returns bool/int number of items in array on success
* @since 3.2.2
*/
protected function checkArray($array, $removeEmptyString = false)
{
@ -235,6 +246,41 @@ class Com_###Component###InstallerScript
}
return $nr;
}
return false;
}
/**
* Ensures that a class in the namespace is available.
* If the class is not already loaded, it attempts to load it via the specified autoloader.
*
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 3.2.2
*/
protected function classExists(string $className): bool
{
if (class_exists($className, true))
{
return true;
}
// Autoloaders to check
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return false;
}###INSTALLERMETHODS###
}

View File

@ -0,0 +1,18 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###

View File

@ -184,6 +184,12 @@
"rename": false,
"type": "file"
},
"script_powerloader.php": {
"naam": "script_powerloader.php",
"path": "c0mp0n3nt/",
"rename": false,
"type": "file"
},
"install.mysql.utf8.sql": {
"naam": "install.mysql.utf8.sql",
"path": "c0mp0n3nt/admin/sql",

View File

@ -15,7 +15,7 @@ defined('_JCB_TEMPLATE') or die;
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper;
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
###ADMIN_HELPER_CLASS_HEADER###

View File

@ -14,7 +14,7 @@ defined('_JCB_TEMPLATE') or die;
?>
###BOM###
###CUSTOM_POWER_AUTOLOADER###
###POWER_AUTOLOADER###
// (soon) use Joomla\CMS\Association\AssociationExtensionInterface;
use Joomla\CMS\Categories\CategoryFactoryInterface;
@ -55,10 +55,10 @@ return new class () implements ServiceProviderInterface
{
// (soon) $container->set(AssociationExtensionInterface::class, new AssociationsHelper());
$container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
$container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###ComponentNamespace###'));
$container->set(
ComponentInterface::class,

View File

@ -25,17 +25,75 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*
* @since 1.6
*/
#[\AllowDynamicProperties]
class HtmlView extends BaseHtmlView
{
/**
* The items from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $items;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* 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 return here base64 url
*
* @var string
* @since 3.10.11
*/
public string $return_here;
/**
* The user object.
*
* @var Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
* @since 3.10.11
*/
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $user;
/**
* ###Views### view display method
*
* @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)
public function display($tpl = null): void
{
// Assign data to the view
$this->items = $this->get('Items');
@ -43,7 +101,7 @@ class HtmlView extends BaseHtmlView
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();###ADMIN_DIPLAY_METHOD###
$this->user ??= $this->getCurrentUser();###ADMIN_DIPLAY_METHOD###
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));

View File

@ -52,7 +52,23 @@ class ###View###Controller extends FormController
* @var string
* @since 1.6
*/
protected $view_list = '###views###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
protected $view_list = '###views###';
/**
* Referral value
*
* @var string
* @since 5.0
*/
protected string $ref;
/**
* Referral ID value
*
* @var int
* @since 5.0
*/
protected int $refid;###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
/**
* Method override to check if you can add a new record.
@ -261,7 +277,7 @@ class ###View###Controller extends FormController
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param BaseDatabaseModel $model The data model object.
* @param array $validData The validated data.
*
* @return void

View File

@ -25,23 +25,105 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*
* @since 1.6
*/
#[\AllowDynamicProperties]
class HtmlView extends BaseHtmlView
{
/**
* The item from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $item;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The form from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $form;
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* 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 origin referral view name
*
* @var string
* @since 3.10.11
*/
public string $ref;
/**
* The origin referral item id
*
* @var int
* @since 3.10.11
*/
public int $refid;
/**
* The referral url suffix values
*
* @var string
* @since 3.10.11
*/
public string $referral;
/**
* ###View### view display method
*
* @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)
public function display($tpl = null): void
{
// set params
$this->params = ComponentHelper::getParams('com_###component###');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->form ??= $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @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
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\Controller;
###API_VIEWS_CONTROLLER_HEADER###
// No direct access to this file
\defined('_JEXEC') or die;
/**
* ###Views### Api Controller
*
* @since 4.0.0
*/
class ###Views###Controller extends ApiController
{
/**
* The content type of the item.
*
* @var string
* @since 4.0.0
*/
protected $contentType = '###views###';
/**
* The default view for the display method.
*
* @var string
* @since 3.0
*/
protected $default_view = '###views###';
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @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
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\View\###Views###;
###API_VIEWS_JSON_HEADER###
// No direct access to this file
\defined('_JEXEC') or die;
/**
* ###Component### Json View class for the ###Views###
*
* @since 4.0.0
*/
class JsonapiView extends BaseApiView
{
}

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @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
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\Controller;
###API_VIEW_CONTROLLER_HEADER###
// No direct access to this file
\defined('_JEXEC') or die;
/**
* ###View### Api Controller
*
* @since 4.0.0
*/
class ###View###Controller extends ApiController
{
/**
* The content type of the item.
*
* @var string
* @since 4.0.0
*/
protected $contentType = '###view###';
/**
* The default view for the display method.
*
* @var string
* @since 3.0
*/
protected $default_view = '###view###';
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = [])
{###JCONTROLLERFORM_ALLOWADD###
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = [], $key = 'id')
{###JCONTROLLERFORM_ALLOWEDIT###
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @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
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\View\###View###;
###API_VIEW_JSON_HEADER###
// No direct access to this file
\defined('_JEXEC') or die;
/**
* ###View### Json View class
*
* @since 4.0.0
*/
class JsonapiView extends BaseApiView
{
}

View File

@ -25,31 +25,67 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*
* @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 Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
* @since 3.10.11
*/
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $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)
public function display($tpl = null): void
{
// get component params
$this->params = ComponentHelper::getParams('com_###component###');
// get the application
$this->app ??= Factory::getApplication();
// get the user object
$this->user ??= $this->app->getIdentity();
$this->user ??= $this->getCurrentUser();
// get global action permissions
$this->canDo = ###Component###Helper::getActions('###sview###');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD###
$this->styles = $this->get('Styles') ?? [];
$this->scripts = $this->get('Scripts') ?? [];###CUSTOM_ADMIN_DIPLAY_METHOD###
// Set the html view document stuff
$this->_prepareDocument();
parent::display($tpl);
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
/**

View File

@ -105,9 +105,12 @@ class ###SViews###Model extends ListModel
];
/**
* A custom property for UIKit components. (not used unless you load v2)
* 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;
protected $uikitComp = [];
/**
* Constructor

View File

@ -25,6 +25,7 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*
* @since 1.6
*/
#[\AllowDynamicProperties]
class HtmlView extends BaseHtmlView
{
/**
@ -33,9 +34,10 @@ class HtmlView extends BaseHtmlView
* @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)
public function display($tpl = null): void
{
// get component params
$this->params = ComponentHelper::getParams('com_###component###');
@ -50,6 +52,8 @@ class HtmlView extends BaseHtmlView
// Set the html view document stuff
$this->_prepareDocument();
parent::display($tpl);
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
/**

View File

@ -115,10 +115,10 @@ class ###SView###Model extends ItemModel
/**
* A custom property for UI Kit components.
*
* @var array|null Property for storing UI Kit component-related data or objects.
* @var mixed Property for storing UI Kit component-related data or objects.
* @since 3.2.0
*/
protected ?array $uikitComp;
protected $uikitComp = [];
/**
* @var object item

View File

@ -25,13 +25,17 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*
* @since 1.6
*/
#[\AllowDynamicProperties]
class HtmlView extends BaseHtmlView
{
/**
* View display method
*
* @return void
* @throws \Exception
* @since 1.6
*/
function display($tpl = null)
function display($tpl = null): void
{
// Assign data to the view
$this->icons = $this->get('Icons');

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @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
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###

View File

@ -19,7 +19,6 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
@ -39,7 +38,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The CMS Application.
*
* @var CMSApplication
* @since 4.4.2
*/
protected $app;
@ -54,7 +52,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The version number of the extension.
*
* @var string
* @var string
* @since 3.6
*/
protected $release;
@ -62,7 +60,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The table the parameters are stored in.
*
* @var string
* @var string
* @since 3.6
*/
protected $paramTable;
@ -70,7 +68,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The extension name. This should be set in the installer script.
*
* @var string
* @var string
* @since 3.6
*/
protected $extension;
@ -78,7 +76,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of files to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFiles = [];
@ -86,7 +84,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of folders to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFolders = [];
@ -94,7 +92,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of CLI script files to be copied to the cli directory
*
* @var array
* @var array
* @since 3.6
*/
protected $cliScriptFiles = [];
@ -102,7 +100,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* Minimum PHP version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumPhp;
@ -110,7 +108,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumJoomla;
@ -164,7 +162,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function install(InstallerAdapter $adapter): bool {return true;}
@ -186,7 +183,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function uninstall(InstallerAdapter $adapter): bool
@ -209,7 +205,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function preflight(string $type, InstallerAdapter $adapter): bool
@ -254,7 +249,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function postflight(string $type, InstallerAdapter $adapter): bool
@ -279,11 +273,84 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
return true;
}
/**
* Remove folders with files (with ignore options)
*
* @param string $dir The path to the folder to remove.
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
if (!is_dir($dir))
{
return false;
}
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
// Remove trailing slash
$dir = rtrim($dir, '/');
foreach ($it as $file)
{
$filePath = $file->getPathname();
$relativePath = str_replace($dir . '/', '', $filePath);
if ($ignore !== null && in_array($relativePath, $ignore, true))
{
continue;
}
if ($file->isDir())
{
Folder::delete($filePath);
}
else
{
File::delete($filePath);
}
}
// Delete the root folder if there are no ignored files/folders left
if ($ignore === null || $this->isDirEmpty($dir, $ignore))
{
return Folder::delete($dir);
}
return true;
}
/**
* Check if a directory is empty considering ignored files/folders.
*
* @param string $dir The path to the folder to check.
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
foreach ($it as $file)
{
$relativePath = str_replace($dir . '/', '', $file->getPathname());
if (!in_array($relativePath, $ignore, true))
{
return false;
}
}
return true;
}
/**
* Remove the files and folders in the given array from
*
* @return void
*
* @since 3.6
*/
protected function removeFiles()
@ -315,7 +382,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Moves the CLI scripts into the CLI folder in the CMS
*
* @return void
*
* @since 3.6
*/
protected function moveCliFiles()
@ -346,7 +412,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $contentHistoryOptions
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setContentType(
string $typeTitle,
@ -408,7 +474,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $textPrefix
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogConfig(
string $typeTitle,
@ -461,7 +527,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Set action logs extensions integration
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogsExtensions(): void
{
@ -502,7 +568,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $rules The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setAssetsRules(string $rules): void
{
@ -540,7 +606,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $params The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setExtensionsParams(string $params): void
{
@ -583,7 +649,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $dataType This datatype we will change the rules column to if it to small.
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void
{
@ -618,7 +684,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param bool $fields The switch to also remove related field data
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewData(string $context, bool $fields = false): void
{
@ -641,7 +707,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentTypes(string $context): void
{
@ -698,7 +764,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFields(string $context): void
{
@ -760,7 +826,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array $ids The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsValues(string $context, array $ids): void
{
@ -791,7 +857,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsGroups(string $context): void
{
@ -846,7 +912,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewHistory(string $context): void
{
@ -878,7 +944,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array $ids The type ids
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmBase(array $ids): void
{
@ -911,7 +977,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmContent(string $context): void
{
@ -943,7 +1009,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentItemTagMap(string $context): void
{
@ -978,7 +1044,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogConfig(string $context): void
{
@ -1008,7 +1074,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove Asset Table Integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeAssetData(): void
{
@ -1036,7 +1102,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove action logs extensions integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogsExtensions(): void
{
@ -1066,7 +1132,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove remove database fix (if possible)
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeDatabaseAssetsRulesFix(): void
{
@ -1095,5 +1161,40 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
);
}
}
}
/**
* Ensures that a class in the namespace is available.
* If the class is not already loaded, it attempts to load it via the specified autoloader.
*
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 4.0.1
*/
protected function classExists(string $className): bool
{
if (class_exists($className, true))
{
return true;
}
// Autoloaders to check
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return false;
}###INSTALLERMETHODS###
}

View File

@ -277,7 +277,7 @@ class ###View###Controller extends FormController
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param BaseDatabaseModel $model The data model object.
* @param array $validData The validated data.
*
* @return void

View File

@ -27,6 +27,86 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
*/
class HtmlView extends BaseHtmlView
{
/**
* The item from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $item;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The form from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $form;
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* 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 origin referral view name
*
* @var string
* @since 3.10.11
*/
public string $ref;
/**
* The origin referral view item id
*
* @var int
* @since 3.10.11
*/
public int $refid;
/**
* The referral url suffix values
*
* @var string
* @since 3.10.11
*/
public string $referral;
/**
* ###View### view display method
*
@ -41,11 +121,11 @@ class HtmlView extends BaseHtmlView
$this->params = ComponentHelper::getParams('com_###component###');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->form ??= $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->styles = $this->get('Styles') ?? [];
$this->scripts = $this->get('Scripts') ?? [];
// get action permissions
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
// get input
@ -97,6 +177,9 @@ class HtmlView extends BaseHtmlView
protected function addToolbar(): void
{
###ADDTOOLBAR###
// now initiate the toolbar
$this->toolbar ??= Toolbar::getInstance();
}
/**

View File

@ -36,6 +36,28 @@ class ###View###Model extends AdminModel
*/
protected $tabLayoutFields = ###TABLAYOUTFIELDSARRAY###;
/**
* The styles array.
*
* @var array
* @since 4.3
*/
protected array $styles = [
'components/com_###component###/assets/css/site.css',
'components/com_###component###/assets/css/###view###.css'
];
/**
* The scripts array.
*
* @var array
* @since 4.3
*/
protected array $scripts = [
'components/com_###component###/assets/js/site.js',
'media/com_###component###/js/###view###.js'
];
/**
* @var string The prefix to use with controller messages.
* @since 1.6
@ -119,13 +141,47 @@ class ###View###Model extends AdminModel
}
/**
* Method to get the script that have to be included on the form
* Method to get the styles that have to be included on the view
*
* @return string script files
* @return array styles files
* @since 4.3
*/
public function getScript()
public function getStyles(): array
{
return 'media/com_###component###/js/###view###.js';
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;
}
/**

View File

@ -15,9 +15,13 @@ defined('_JCB_TEMPLATE') or die;
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller;
use Joomla\Input\Input;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Router\Route;
use Joomla\CMS\User\User;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
@ -31,13 +35,50 @@ use Joomla\CMS\Language\Text;
*/
class DisplayController extends BaseController
{
/**
* The allowed edit views.
*
* @var array
* @since 4.0.0
*/
protected array $allowed_edit_views = [###SITE_ALLOW_EDIT_VIEWS_ARRAY###
];
/**
* The application identity object.
*
* @var User
* @since 4.0.0
*/
protected $identity;
/**
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface|null $factory The factory.
* @param CMSApplication|null $app The Application for the dispatcher
* @param Input|null $input The Input object for the request
*
* @throws \Exception
* @since 3.0.1
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
{
$app ??= Factory::getApplication();
$this->identity ??= $app->getIdentity();
parent::__construct($config, $factory, $app, $input);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}.
* @param boolean $cachable If true, the view output will be cached.
* @param boolean|array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}.
*
* @return DisplayController This object to support chaining.
* @throws \Exception
* @since 1.5
*/
function display($cachable = false, $urlparams = false)
@ -51,14 +92,13 @@ class DisplayController extends BaseController
$cachable = true;
// ensure that the view is not cashable if edit view or if user is logged in
$user = $this->app->getIdentity();
if ($user->get('id') || $this->input->getMethod() === 'POST' || $isEdit)
if ($this->identity->get('id') || $this->input->getMethod() === 'POST' || $isEdit)
{
$cachable = false;
}
// Check for edit form.
if ($isEdit && !$this->checkEditId('com_###component###.edit.'.$view, $id))
if ($isEdit && !$this->checkEditId($view, $id))
{
// check if item was opened from other than its own list view
$ref = $this->input->getCmd('ref', 0);
@ -68,12 +108,12 @@ class DisplayController extends BaseController
if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
{
// redirect to item of ref
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
$this->setRedirect(Route::_('index.php?option=com_###component###&view=' . (string) $ref . '&layout=edit&id=' . (int) $refid, false));
}
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
{
// redirect to ref
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false));
$this->setRedirect(Route::_('index.php?option=com_###component###&view=' . (string) $ref, false));
}
else
{
@ -115,18 +155,133 @@ class DisplayController extends BaseController
return $this;
}
protected function checkEditView($view)
/**
* Method to check whether an ID is in the edit list.
*
* @param string $context The view name.
* @param integer $id The ID of the record to add to the edit list.
*
* @return boolean True if the ID is in the edit list.
*
* @throws \Exception
* @since 3.0
*/
protected function checkEditId($context, $id)
{
if (parent::checkEditId("com_###component###.edit.{$context}", $id))
{
return true;
}
// check user edit access
if ($this->canEditId($context, $id))
{
$this->holdEditId("com_###component###.edit.{$context}", $id);
return true;
}
return false;
}
/**
* Method to check whether an ID is allowed to be edited by the active user.
*
* @param string $view The view name.
* @param integer $id The ID of the record to add to the edit list.
*
* @return boolean True if the ID is in the edit list.
*
* @since 5.0.2
*/
protected function canEditId($view, $id): bool
{
// check that this view is even allowed
$allowed = $this->getAllowedEditView($view);
if ($allowed === null)
{
return false;
}
// check if this item has custom function set for canEditId
if (isset($allowed['function'])
&& method_exists($this, $allowed['function'])
&& $this->{$allowed['function']}(['id' => $id], 'id'))
{
return true;
}
// check if this item can be accessed (and has access)
$access = true;
if (isset($allowed['access']))
{
$access = ($this->identity->authorise($allowed['access'], "com_###component###.{$view}." . (int) $id)
&& $this->identity->authorise($allowed['access'], 'com_###component###'));
}
// check if this item can be edited
$edit = false;
if ($access && isset($allowed['edit']))
{
$edit = ($this->identity->authorise($allowed['edit'], "com_###component###.{$view}." . (int) $id)
&& $this->identity->authorise($allowed['edit'], 'com_###component###'));
}
// check if this item can be edited by owner
if ($access && !$edit && isset($allowed['edit.own']))
{
$edit = ($this->identity->authorise($allowed['edit.own'], "com_###component###.{$view}." . (int) $id)
&& $this->identity->authorise($allowed['edit.own'], 'com_###component###'));
}
return $edit;
}
/**
* Checks if the provided view is an edit view.
*
* This method verifies whether the given view name is recognized as an edit view.
* It uses the StringHelper::check() method to validate the input and then checks
* against a predefined list of edit views.
*
* @param string|null $view The name of the view to check.
*
* @return bool True if the view is an edit view, false otherwise.
* @since 4.0.0
*/
protected function checkEditView(?string $view): bool
{
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view))
{
$views = [###SITE_EDIT_VIEW_ARRAY###
];
// check if this is a edit view
if (in_array($view,$views))
// check if this is an edit view
if (isset($this->allowed_edit_views[$view]))
{
return true;
}
}
return false;
}
/**
* Get the allowed edit view permission map
*
* @param string|null $view The name of the view to check.
*
* @return array|null The permissions map
* @since 5.0.2
*/
protected function getAllowedEditView(?string $view): ?array
{
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view))
{
// check if this is an edit view
if (isset($this->allowed_edit_views[$view]))
{
return $this->allowed_edit_views[$view];
}
}
return null;
}###SITE_ALLOW_EDIT_VIEWS_FUNCTIONS###
}

View File

@ -15,7 +15,7 @@ defined('_JCB_TEMPLATE') or die;
###BOM###
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper;
###SITE_CUSTOM_POWER_AUTOLOADER###
###SITE_POWER_AUTOLOADER###
###SITE_HELPER_CLASS_HEADER###

View File

@ -27,15 +27,64 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
*/
class HtmlView extends BaseHtmlView
{
/**
* The items from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $items;
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* 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 Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
* @since 3.10.11
*/
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $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)
public function display($tpl = null): void
{
// get combined params of both component and menu
$this->app ??= Factory::getApplication();
@ -45,6 +94,8 @@ class HtmlView extends BaseHtmlView
$this->scripts = $this->get('Scripts');
// get the user object
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
parent::display($tpl);
}###SITE_EXTRA_DIPLAY_METHODS###
/**
@ -82,6 +133,7 @@ class HtmlView extends BaseHtmlView
{
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
}
// now initiate the toolbar
$this->toolbar = Toolbar::getInstance();
}###SITE_GET_MODULE###

View File

@ -25,7 +25,7 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controll
*
* @since 1.6
*/
class ###SView###Controller extends FormController
class ###SView###Controller extends Joomla___907ccae5_57a9_44b9_a8aa_5b905d1cd70f___Power
{
/**
* The prefix to use with controller messages.
@ -107,14 +107,14 @@ class ###SView###Controller extends FormController
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
* @param Joomla___6dce7a1b_cfc3_4c2a_837d_be9cbc902446___Power $model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 12.2
*/
protected function postSaveHook(JModelLegacy $model, $validData = [])
protected function postSaveHook(Joomla___6dce7a1b_cfc3_4c2a_837d_be9cbc902446___Power $model, $validData = [])
{
}
}

View File

@ -27,24 +27,59 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###
*/
class HtmlView extends BaseHtmlView
{
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* The styles url array
*
* @var array
* @since 3.10.11
*/
protected array $styles;
/**
* The scripts url array
*
* @var array
* @since 3.10.11
*/
protected array $scripts;
/**
* The user object.
*
* @var Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power
* @since 3.10.11
*/
public Joomla___effdaf6d_2275_425d_9f52_d4952e564d34___Power $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)
public function display($tpl = null): void
{
// get combined params of both component and menu
$this->app ??= Factory::getApplication();
$this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive();
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->styles = $this->get('Styles') ?? [];
$this->scripts = $this->get('Scripts') ?? [];
// get the user object
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
$this->user ??= $this->getCurrentUser();###SITE_DIPLAY_METHOD###
parent::display($tpl);
}###SITE_EXTRA_DIPLAY_METHODS###
/**
@ -82,8 +117,9 @@ class HtmlView extends BaseHtmlView
{
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
}
// now initiate the toolbar
$this->toolbar = Toolbar::getInstance();
$this->toolbar ??= Toolbar::getInstance();
}###SITE_GET_MODULE###
/**

View File

@ -33,6 +33,12 @@
},
"tmpl": "tmpl"
},
"api": {
"src": {
"Controller": "Controller",
"View": "View"
}
},
"site": {
"assets": {
"css": "css",
@ -182,6 +188,13 @@
"newName": "[[[Component]]]InstallerScript.php",
"type": "file"
},
"INSTALLER_AUTOLOADER_CLASS.php": {
"naam": "INSTALLER_AUTOLOADER_CLASS.php",
"path": "c0mp0n3nt/",
"rename": "new",
"newName": "[[[Component]]]InstallerPowerloader.php",
"type": "file"
},
"SITE_DISPATCHER.php": {
"naam": "SITE_DISPATCHER.php",
"path": "c0mp0n3nt/site/src/Dispatcher",
@ -557,6 +570,32 @@
"type": "javascript_file"
}
},
"api": {
"API_VIEW_CONTROLLER.php": {
"path": "c0mp0n3nt/api/src/Controller",
"rename": "new",
"newName": "[[[Name]]]Controller.php",
"type": "single"
},
"API_VIEW_JSON.php": {
"path": "c0mp0n3nt/api/src/View/[[[Name]]]",
"rename": "new",
"newName": "JsonapiView.php",
"type": "single"
},
"API_VIEWS_CONTROLLER.php": {
"path": "c0mp0n3nt/api/src/Controller",
"rename": "new",
"newName": "[[[Name]]]Controller.php",
"type": "list"
},
"API_VIEWS_JSON.php": {
"path": "c0mp0n3nt/api/src/View/[[[Name]]]",
"rename": "new",
"newName": "JsonapiView.php",
"type": "list"
}
},
"site": {
"SITE_VIEWS_HTML.php": {
"path": "c0mp0n3nt/site/src/View/[[[Name]]]",

View File

@ -57,7 +57,7 @@
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_CONFIG_SUBFORM_LAYOUTS_DESCRIPTION"
icon="list"
max="9"
max="10"
min="1">
<form hidden="true" name="list_subform_layouts_modal" repeat="true">
<!-- View_field Field. Type: List. (joomla) -->
@ -73,6 +73,8 @@
<!-- Option Set. -->
<option value="default">
COM_COMPONENTBUILDER_CONFIG_DEFAULT</option>
<option value="admin_view.ajax_input">
COM_COMPONENTBUILDER_CONFIG_ADMIN_VIEWS_AJAX_INPUT</option>
<option value="admin_custom_tabs.tabs">
COM_COMPONENTBUILDER_CONFIG_ADMIN_CUSTOM_TABS_TABS</option>
<option value="admin_fields.addfields">
@ -93,6 +95,8 @@
COM_COMPONENTBUILDER_CONFIG_COMPONENT_CUSTOM_ADMIN_MENUS_ADDCUSTOMMENUS</option>
<option value="component_site_views.addsite_views">
COM_COMPONENTBUILDER_CONFIG_COMPONENT_SITE_VIEWS_ADDSITE_VIEWS</option>
<option value="custom_admin_view.ajax_input">
COM_COMPONENTBUILDER_CONFIG_CUSTOM_ADMIN_VIEWS_AJAX_INPUT</option>
<option value="dynamic_get.join_db_table">
COM_COMPONENTBUILDER_CONFIG_DYNAMIC_GET_JOIN_DB_TABLE</option>
<option value="dynamic_get.join_view_table">
@ -103,6 +107,8 @@
COM_COMPONENTBUILDER_CONFIG_JOOMLA_MODULE_UPDATES_VERSION_UPDATE</option>
<option value="joomla_plugin_updates.version_update">
COM_COMPONENTBUILDER_CONFIG_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE</option>
<option value="site_view.ajax_input">
COM_COMPONENTBUILDER_CONFIG_SITE_VIEWS_AJAX_INPUT</option>
</field>
<!-- Layout Field. Type: List. (joomla) -->
<field
@ -113,7 +119,7 @@
multiple="false"
filter="CMD"
required="true"
default="joomla.form.field.subform.repeatable-table">
default="repeatablejcb">
<!-- Option Set. -->
<option value="joomla.form.field.subform.repeatable-table">
COM_COMPONENTBUILDER_CONFIG_REPEATABLETABLE_JOOMLA</option>
@ -134,6 +140,19 @@
folder="editors"
filter="cmd"
/>
<!-- Gitea_username Field. Type: Text. (joomla) -->
<field
type="text"
name="gitea_username"
label="COM_COMPONENTBUILDER_CONFIG_GITEA_USERNAME_LABEL"
size="128"
maxlength="50"
description="COM_COMPONENTBUILDER_CONFIG_GITEA_USERNAME_DESCRIPTION"
class="text_area"
filter="STRING"
message="COM_COMPONENTBUILDER_CONFIG_GITEA_USERNAME_MESSAGE"
hint="COM_COMPONENTBUILDER_CONFIG_GITEA_USERNAME_HINT"
/>
<!-- Gitea_token Field. Type: Password. (joomla) -->
<field
type="password"
@ -189,6 +208,7 @@
label="COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="true"
default=""
showon="manage_jcb_package_directories:1">
@ -222,6 +242,7 @@
label="COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="global"
showon="set_browser_storage:1">
@ -743,62 +764,7 @@
COM_COMPONENTBUILDER_CONFIG_NO</option>
</field>
<!-- Note_super_powers_repositories Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_super_powers_repositories" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_DESCRIPTION" heading="h4" class="alert alert-info note_super_powers_repositories" showon="powers_repository:1[AND]super_powers_repositories:1" />
<!-- Approved_paths Field. Type: Subform. (joomla) -->
<field
type="subform"
name="approved_paths"
label="COM_COMPONENTBUILDER_CONFIG_APPROVED_PATHS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
icon="list"
max="30"
min="1"
showon="powers_repository:1[AND]super_powers_repositories:1">
<form hidden="true" name="list_approved_paths_modal" repeat="true">
<!-- Owner Field. Type: Text. (joomla) -->
<field
type="text"
name="owner"
label="COM_COMPONENTBUILDER_CONFIG_OWNER_LABEL"
size="70"
maxlength="150"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_OWNER_HINT"
autocomplete="on"
/>
<!-- Repo Field. Type: Text. (joomla) -->
<field
type="text"
name="repo"
label="COM_COMPONENTBUILDER_CONFIG_REPO_LABEL"
size="70"
maxlength="150"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_REPO_HINT"
autocomplete="on"
/>
<!-- Branch Field. Type: Text. (joomla) -->
<field
type="text"
name="branch"
label="COM_COMPONENTBUILDER_CONFIG_BRANCH_LABEL"
size="70"
maxlength="150"
default="default"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_BRANCH_HINT"
autocomplete="on"
/>
</form>
</field>
<field type="note" name="note_super_powers_repositories" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_DESCRIPTION" heading="h4" class="alert alert-error note_super_powers_repositories" showon="powers_repository:1[AND]super_powers_repositories:1" />
<!-- Note_powers_repository_path Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_powers_repository_path" label="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_DESCRIPTION" heading="h4" class="alert alert-info note_powers_repository_path" showon="powers_repository:1" />
<!-- Local_powers_repository_path Field. Type: Text. (joomla) -->
@ -819,88 +785,6 @@
autocomplete="on"
showon="powers_repository:1"
/>
<!-- Add_custom_gitea_url Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_gitea_url"
label="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_GITVDMDEV</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_CUSTOMGITEA</option>
</field>
<!-- Note_custom_gitea_url Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_custom_gitea_url" label="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_DESCRIPTION" heading="h3" class="alert alert-success note_custom_gitea_url" showon="add_custom_gitea_url:2" />
<!-- Custom_gitea_url Field. Type: Url. (joomla) -->
<field
type="url"
name="custom_gitea_url"
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_LABEL"
size="70"
maxlength="150"
default="https://git.vdm.dev"
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_DESCRIPTION"
class="text_area"
filter="url"
validated="url"
scheme="http,https"
message="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_MESSAGE"
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_HINT"
autocomplete="on"
showon="add_custom_gitea_url:2"
/>
<!-- Custom_gitea_token Field. Type: Password. (joomla) -->
<field
type="password"
name="custom_gitea_token"
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_LABEL"
size="128"
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_DESCRIPTION"
message="Error! Please add token here."
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="STRING"
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_HINT"
autocomplete="off"
showon="add_custom_gitea_url:2"
/>
<!-- Super_powers_core_organisation_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="super_powers_core_organisation_note" label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_NOTE_DESCRIPTION" heading="h4" class="alert alert-success super_powers_core_organisation_note" showon="add_custom_gitea_url:2" />
<!-- Super_powers_core_organisation Field. Type: Text. (joomla) -->
<field
type="text"
name="super_powers_core_organisation"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_LABEL"
size="70"
maxlength="150"
default="joomla"
description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_DESCRIPTION"
class="text_area"
filter="WORD"
hint="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_HINT"
autocomplete="on"
showon="add_custom_gitea_url:2"
/>
<!-- Super_powers_core Field. Type: Text. (joomla) -->
<field
type="text"
name="super_powers_core"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_LABEL"
size="70"
maxlength="150"
default="joomla/super-powers"
class="text_area"
filter="PATH"
hint="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_HINT"
autocomplete="on"
showon="add_custom_gitea_url:2"
/>
</fieldset>
<fieldset
name="compiler_custom_config"
@ -913,6 +797,7 @@
label="COM_COMPONENTBUILDER_CONFIG_BUILDER_GIF_SIZE_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_BUILDER_GIF_SIZE_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
default="480-272">
@ -1038,6 +923,7 @@
label="COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="2">
<!-- Option Set. -->
@ -1055,6 +941,7 @@
label="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
filter="INT"
required="true"
default="2">
@ -1126,115 +1013,6 @@
COM_COMPONENTBUILDER_CONFIG_NO</option>
</field>
</fieldset>
<fieldset
name="development_method_custom_config"
label="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD">
<!-- Development_method Field. Type: Radio. (joomla) -->
<field
type="radio"
name="development_method"
label="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_DEFAULT</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_EXPANSION</option>
</field>
<!-- Note_development_method_default Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_development_method_default" label="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION" heading="h2" class="alert alert-info note_development_method_default" showon="development_method:1" />
<!-- Note_development_method_expansion Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_development_method_expansion" label="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION" heading="h2" class="alert alert-info note_development_method_expansion" showon="development_method:2" />
<!-- Expansion Field. Type: Subform. (joomla) -->
<field
type="subform"
name="expansion"
label="COM_COMPONENTBUILDER_CONFIG_EXPANSION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_CONFIG_EXPANSION_DESCRIPTION"
icon="list"
max="50"
min="1"
showon="development_method:2">
<form hidden="true" name="list_expansion_modal" repeat="true">
<!-- Component_id Field. Type: Joomlacomponent. (custom) -->
<field
type="joomlacomponent"
name="component_id"
label="COM_COMPONENTBUILDER_CONFIG_COMPONENT_ID_LABEL"
class="list_class"
multiple="false"
default="0"
button="false"
/>
<!-- Install Field. Type: List. (joomla) -->
<field
type="list"
name="install"
label="COM_COMPONENTBUILDER_CONFIG_INSTALL_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_INSTALL_DESCRIPTION"
class="list_class"
multiple="false"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_TRUE</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_FALSE</option>
</field>
<!-- Backup Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="backup"
label="COM_COMPONENTBUILDER_CONFIG_BACKUP_LABEL"
value="1"
description="COM_COMPONENTBUILDER_CONFIG_BACKUP_DESCRIPTION"
class="inputbox"
/>
<!-- Repository Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="repository"
label="COM_COMPONENTBUILDER_CONFIG_REPOSITORY_LABEL"
value="1"
description="COM_COMPONENTBUILDER_CONFIG_REPOSITORY_DESCRIPTION"
class="inputbox"
/>
<!-- Add_placeholders Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="add_placeholders"
label="COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_LABEL"
value="1"
default=""
description="COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_DESCRIPTION"
class="inputbox"
/>
</form>
</field>
<!-- Return_options_build Field. Type: Radio. (joomla) -->
<field
type="radio"
name="return_options_build"
label="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_DESCRIPTION"
class="btn-group btn-group-yesno"
default="2"
showon="development_method:2">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_DISPLAY_MESSAGE</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_ONLY_BOOLEAN</option>
</field>
<!-- Expansioncronjob_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="expansioncronjob_note" label="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_DESCRIPTION" heading="h4" class="expansioncronjob_note" showon="development_method:2" />
</fieldset>
<fieldset
name="auto_backup_custom_config"
label="COM_COMPONENTBUILDER_CONFIG_AUTO_BACKUP">
@ -1255,13 +1033,14 @@
<option value="2">
COM_COMPONENTBUILDER_CONFIG_REMOTE_SERVER</option>
</field>
<!-- Cronjob_backup_server Field. Type: Servers. (custom) -->
<!-- Cronjob_backup_server Field. Type: Cron_servers. (custom) -->
<field
type="servers"
type="cron_servers"
name="cronjob_backup_server"
label="COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
showon="cronjob_backup_type:2"
@ -1424,6 +1203,7 @@
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_LABEL"
size="40"
maxlength="150"
default="Vast Development Method"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_DESCRIPTION"
class="text_area"
required="true"
@ -1439,6 +1219,7 @@
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_LABEL"
size="10"
maxlength="120"
default="Llewellyn van der Merwe"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_DESCRIPTION"
class="text_area"
required="true"
@ -1454,6 +1235,7 @@
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_LABEL"
size="40"
maxlength="150"
default="joomla@vdm.io"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_DESCRIPTION"
class="text_area"
required="true"
@ -1470,6 +1252,7 @@
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_LABEL"
size="60"
maxlength="150"
default="https://dev.vdm.io/"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_DESCRIPTION"
class="text_area"
required="true"

View File

@ -120,6 +120,7 @@ class ComponentbuilderController extends BaseController
'language_translation' => 'language_translations',
'language' => 'languages',
'server' => 'servers',
'repository' => 'repositories',
'help_document' => 'help_documents',
'admin_fields' => 'admins_fields',
'admin_fields_conditions' => 'admins_fields_conditions',

View File

@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Admin_views Admin Controller
@ -114,45 +112,4 @@ class ComponentbuilderControllerAdmin_views extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error');
return;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('admin_views.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
}

View File

@ -521,46 +521,6 @@ class ComponentbuilderControllerCompiler extends AdminController
return false;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('compiler.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* Clear tmp folder
*
@ -584,7 +544,7 @@ class ComponentbuilderControllerCompiler extends AdminController
$tmp = $comConfig->get('tmp_path');
if ($model->emptyFolder($tmp))
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB');
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEARED_SUCCESSFULLYB');
$this->setRedirect($redirect_url, $message, 'message');
// get application
$app = Factory::getApplication();

View File

@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Custom_codes Admin Controller
@ -114,45 +112,4 @@ class ComponentbuilderControllerCustom_codes extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error');
return;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('custom_codes.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
}

View File

@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Dynamic_gets Admin Controller
@ -114,45 +112,4 @@ class ComponentbuilderControllerDynamic_gets extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error');
return;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('dynamic_gets.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
}

View File

@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Fields Admin Controller
@ -114,45 +112,4 @@ class ComponentbuilderControllerFields extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error');
return;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('fields.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
}

View File

@ -20,6 +20,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
/**
* Fieldtype Form Controller
@ -48,6 +49,157 @@ class ComponentbuilderControllerFieldtype extends FormController
parent::__construct($config);
}
/**
* Resets the specified Joomla Field Type.
*
* 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 Field Type.
* 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 Field Type.
* 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');
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Pushes the specified Joomla Field Type.
*
* 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 Field Type.
* 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 Field Type.
* 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');
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_JOOMLA_FIELD_TYPE') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_FIELD_TYPE_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=fieldtype'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Method override to check if you can add a new record.
*

View File

@ -20,6 +20,8 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Componentbuilder\Fieldtype\Factory as FieldtypeFactory;
use VDM\Joomla\Utilities\GetHelper;
/**
* Fieldtypes Admin Controller
@ -112,4 +114,219 @@ class ComponentbuilderControllerFieldtypes extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error');
return;
}
/**
* 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.
*
* @return bool True on successful initialization, false on failure.
*/
public function initPowers()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_FIELD_TYPES') . '</p>';
$status = 'error';
$success = false;
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>';
$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>';
}
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Resets the selected Joomla Field Types.
*
* 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 Field Types.
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Joomla Field Types.
* 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 IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
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>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.reset', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the selected Joomla Field Types.
*
* 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 Field Types.
* 6. If the user is authorized and powers are selected, it attempts to push the selected Joomla Field Types.
* 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'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
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>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('fieldtype.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('fieldtype', $pks, 'id', 'guid');
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_FIELD_TYPES_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false);
$this->setRedirect($redirect_url);
return $success;
}
}

View File

@ -22,7 +22,6 @@ use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Joomla_components Admin Controller
@ -117,46 +116,6 @@ class ComponentbuilderControllerJoomla_components extends AdminController
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('joomla_components.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* Clear tmp folder
*
@ -180,7 +139,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
$tmp = $comConfig->get('tmp_path');
if ($model->emptyFolder($tmp))
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB');
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEARED_SUCCESSFULLYB');
$this->setRedirect($redirect_url, $message, 'message');
// get application
$app = Factory::getApplication();
@ -233,7 +192,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if (!JCBArrayHelper::check($pks))
if (!UtilitiesArrayHelper::check($pks))
{
// Redirect to the list screen with error.
$message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
@ -472,7 +431,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if (!JCBArrayHelper::check($pks))
if (!UtilitiesArrayHelper::check($pks))
{
// Redirect to the list screen with error.
$message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN');

View File

@ -18,8 +18,6 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Joomla_plugins Admin Controller
@ -51,46 +49,6 @@ class ComponentbuilderControllerJoomla_plugins extends AdminController
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('joomla_plugins.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* get Boilerplate
*

View File

@ -49,6 +49,21 @@ class ComponentbuilderControllerJoomla_power extends FormController
parent::__construct($config);
}
/**
* Resets the specified Joomla Power.
*
* 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 Power.
* 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 Power.
* 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
@ -77,20 +92,100 @@ class ComponentbuilderControllerJoomla_power extends FormController
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('power.reset', 'com_componentbuilder'))
elseif($user->authorise('joomla_power.reset', 'com_componentbuilder'))
{
if (JoomlaPowerFactory::_('Joomlapower')->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>';
$status = 'success';
$success = true;
}
else
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=joomla_power'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Pushes the specified Joomla Power.
*
* 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 Power.
* 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 Power.
* 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');
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_JOOMLA_POWER') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('joomla_power.push', 'com_componentbuilder'))
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}

View File

@ -50,6 +50,19 @@ class ComponentbuilderControllerJoomla_powers extends AdminController
return parent::getModel($name, $prefix, $config);
}
/**
* 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.
*
* @return bool True on successful initialization, false on failure.
*/
public function initPowers()
{
// Check for request forgeries
@ -64,21 +77,26 @@ class ComponentbuilderControllerJoomla_powers extends AdminController
$status = 'error';
$success = false;
if($user->authorise('power.init', 'com_componentbuilder'))
if($user->authorise('joomla_power.init', 'com_componentbuilder'))
{
if (JoomlaPowerFactory::_('Joomlapower')->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>';
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>';
$status = 'success';
$success = true;
}
else
{
$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>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_POWERS_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
@ -89,6 +107,21 @@ class ComponentbuilderControllerJoomla_powers extends AdminController
return $success;
}
/**
* Resets the selected Joomla Powers.
*
* 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 Powers.
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Joomla Powers.
* 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
@ -117,22 +150,106 @@ class ComponentbuilderControllerJoomla_powers extends AdminController
// check if user has the right
$user = Factory::getUser();
if($user->authorise('power.reset', 'com_componentbuilder'))
if($user->authorise('joomla_power.reset', 'com_componentbuilder'))
{
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
if (JoomlaPowerFactory::_('Joomlapower')->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>';
$status = 'success';
$success = true;
}
else
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the selected Joomla Powers.
*
* 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 Powers.
* 6. If the user is authorized and powers are selected, it attempts to push the selected Joomla Powers.
* 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'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
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>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('joomla_power.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect

View File

@ -49,6 +49,21 @@ class ComponentbuilderControllerPower extends FormController
parent::__construct($config);
}
/**
* Resets the specified power.
*
* 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 power.
* 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 power.
* 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
@ -79,18 +94,98 @@ class ComponentbuilderControllerPower extends FormController
}
elseif($user->authorise('power.reset', 'com_componentbuilder'))
{
if (PowerFactory::_('Superpower')->reset([$guid]))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
$status = 'success';
$success = true;
}
else
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Pushes the specified power.
*
* 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 power.
* 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 power.
* 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');
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_POWER') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('power.push', 'com_componentbuilder'))
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWER_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}

View File

@ -18,10 +18,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
use VDM\Joomla\Utilities\GetHelper;
use Joomla\CMS\Uri\Uri;
/**
* Powers Admin Controller
@ -54,44 +52,17 @@ class ComponentbuilderControllerPowers extends AdminController
/**
* Run the Expansion
* Initializes all remote Powers and syncs them with the local database.
*
* @return void
* 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.
*
* @return bool True on successful initialization, false on failure.
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('powers.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
public function initPowers()
{
// Check for request forgeries
@ -108,19 +79,24 @@ class ComponentbuilderControllerPowers extends AdminController
if($user->authorise('power.init', 'com_componentbuilder'))
{
if (PowerFactory::_('Superpower')->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>';
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>';
$status = 'success';
$success = true;
}
else
{
$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>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_POWERS_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
@ -131,6 +107,21 @@ class ComponentbuilderControllerPowers extends AdminController
return $success;
}
/**
* Resets the selected Powers.
*
* 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 Powers.
* 6. If the user is authorized and powers are selected, it attempts to reset the selected Powers.
* 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
@ -163,18 +154,102 @@ class ComponentbuilderControllerPowers extends AdminController
{
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
if (PowerFactory::_('Superpower')->reset($guids))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
$status = 'success';
$success = true;
}
else
{
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_POWERS_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_POWERS_HAS_FAILED') . '</p>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the selected Powers.
*
* 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 Powers.
* 6. If the user is authorized and powers are selected, it attempts to push the selected Powers.
* 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'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
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>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('power.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
try {
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>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_POWERS_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect

View File

@ -0,0 +1,50 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
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;
/**
* Repositories Admin Controller
*/
class ComponentbuilderControllerRepositories extends AdminController
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_COMPONENTBUILDER_REPOSITORIES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Repository', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
}

View File

@ -0,0 +1,329 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
/**
* Repository Form Controller
*/
class ComponentbuilderControllerRepository extends FormController
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = [])
{
$this->view_list = 'Repositories'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = [])
{
// Get user object.
$user = Factory::getUser();
// Access check.
$access = $user->authorise('repository.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
// In the absence of better information, revert to the component permissions.
return $user->authorise('repository.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = [], $key = 'id')
{
// get user object.
$user = Factory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = ($user->authorise('repository.access', 'com_componentbuilder.repository.' . (int) $recordId) && $user->authorise('repository.access', 'com_componentbuilder'));
if (!$access)
{
return false;
}
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('repository.edit', 'com_componentbuilder.repository.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('repository.edit.own', 'com_componentbuilder.repository.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('repository.edit.own', 'com_componentbuilder'))
{
return true;
}
}
}
return false;
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('repository.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string) $ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Repository', '', []);
// Preset the redirect
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=repositories' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && Uri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
Route::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a 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 successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
Route::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid;
// Redirect to the item screen.
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string) $this->ref;
// Redirect to the list screen.
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
{
return;
}
}

View File

@ -136,7 +136,7 @@ class ComponentbuilderControllerSnippets extends AdminController
$input = Factory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
ArrayHelper::toInteger($pks);
// check if there is any selections
if (!UtilitiesArrayHelper::check($pks))
{

View File

@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
/**
* Validation_rules Admin Controller
@ -114,45 +112,4 @@ class ComponentbuilderControllerValidation_rules extends AdminController
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
return;
}
/**
* Run the Expansion
*
* @return void
*/
public function runExpansion()
{
// Check for request forgeries
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
// check if user has the right
$user = Factory::getUser();
// set page redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=validation_rules', false);
// set massage
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
// check if this user has the right to run expansion
if($user->authorise('validation_rules.run_expansion', 'com_componentbuilder'))
{
// set massage
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
}
elseif (is_numeric($result) && 1 == $result)
{
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
}

View File

@ -0,0 +1,16 @@
<?php
/**
*
* @version 2.0.0 - September 03, 2014
* @package Component Builder
* @author Llewellyn van de Merwe <http://www.vdm.io>
* @copyright Copyright (C) 2014. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
[CUSTOMCODE=dynamicDownloadController+Administrator]

View File

@ -0,0 +1,16 @@
<?php
/**
*
* @version 2.0.0 - September 03, 2014
* @package Component Builder
* @author Llewellyn van de Merwe <http://www.vdm.io>
* @copyright Copyright (C) 2014. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
[CUSTOMCODE=dynamicDownloadController+Site]

View File

@ -52,6 +52,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\DateHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\FieldHelper as StringFieldHelper;
use VDM\Joomla\Utilities\String\TypeHelper;
@ -2164,7 +2165,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// set the defaults
self::setSessionDefaults();
@ -2177,7 +2178,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// set to local memory to speed up program
self::$localSession[$key] = $value;
@ -2192,7 +2193,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// check if in local memory
if (!isset(self::$localSession[$key]))
@ -3513,12 +3514,12 @@ abstract class ComponentbuilderHelper
'editor', 'editors', 'email', 'file', 'file', 'filelist', 'folderlist', 'groupedlist', 'headertag', 'helpsite', 'hidden', 'imagelist',
'integer', 'language', 'list', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition',
'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules',
'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup', 'usergrouplist'
),
'plain' => array(
'cachehandler', 'calendar', 'checkbox', 'chromestyle', 'color', 'componentlayout', 'contenttype', 'editor', 'editors', 'captcha',
'email', 'file', 'headertag', 'helpsite', 'hidden', 'integer', 'language', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'templatestyle',
'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup', 'usergrouplist'
),
'option' => array(
'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', 'components',
@ -5228,195 +5229,246 @@ abstract class ComponentbuilderHelper
/**
* Change to nice fancy date
* Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDate($date, $checkStamp);
*/
public static function fancyDate($date, $check_stamp = true)
public static function fancyDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS \o\f F Y',$date);
return DateHelper::fancyDate($date, $checkStamp);
}
/**
* get date based in period past
* Get a formatted date based on the time period (dynamic format based on age of the date).
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDynamicDate($date, $checkStamp);
*/
public static function fancyDynamicDate($date, $check_stamp = true)
public static function fancyDynamicDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
// older then year
$lastyear = date("Y", strtotime("-1 year"));
$tragetyear = date("Y", $date);
if ($tragetyear <= $lastyear)
{
return date('m/d/y', $date);
}
// same day
$yesterday = strtotime("-1 day");
if ($date > $yesterday)
{
return date('g:i A', $date);
}
// just month day
return date('M j', $date);
return DateHelper::fancyDynamicDate($date, $checkStamp);
}
/**
* Change to nice fancy day time and date
* Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted day, time, and date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDayTimeDate($date, $checkStamp);
*/
public static function fancyDayTimeDate($time, $check_stamp = true)
public static function fancyDayTimeDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('D ga jS \o\f F Y',$time);
return DateHelper::fancyDayTimeDate($date, $checkStamp);
}
/**
* Change to nice fancy time and date
* Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time and date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDateTime($date, $checkStamp);
*/
public static function fancyDateTime($time, $check_stamp = true)
public static function fancyDateTime($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('(G:i) jS \o\f F Y',$time);
return DateHelper::fancyDateTime($date, $checkStamp);
}
/**
* Change to nice hour:minutes time
* Convert a time to a human-readable format (e.g., "12:00").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyTime($date, $checkStamp);
*/
public static function fancyTime($time, $check_stamp = true)
public static function fancyTime($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('G:i',$time);
return DateHelper::fancyTime($date, $checkStamp);
}
/**
* set the date day as Sunday through Saturday
* Convert a date to the day name (e.g., "Sunday").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day name.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDayName($date, $checkStamp);
*/
public static function setDayName($date, $check_stamp = true)
public static function setDayName($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('l', $date);
return DateHelper::setDayName($date, $checkStamp);
}
/**
* set the date month as January through December
* Convert a date to the month name (e.g., "January").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Month name.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setMonthName($date, $checkStamp);
*/
public static function setMonthName($date, $check_stamp = true)
public static function setMonthName($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('F', $date);
return DateHelper::setMonthName($date, $checkStamp);
}
/**
* set the date day as 1st
* Convert a date to the day with suffix (e.g., "1st").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day with suffix.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDay($date, $checkStamp);
*/
public static function setDay($date, $check_stamp = true)
public static function setDay($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS', $date);
return DateHelper::setDay($date, $checkStamp);
}
/**
* set the date month as 5
* Convert a date to the numeric month (e.g., "5").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Numeric month.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setMonth($date, $checkStamp);
*/
public static function setMonth($date, $check_stamp = true)
public static function setMonth($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('n', $date);
return DateHelper::setMonth($date, $checkStamp);
}
/**
* set the date year as 2004 (for charts)
* Convert a date to the full year (e.g., "2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Full year.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYear($date, $checkStamp);
*/
public static function setYear($date, $check_stamp = true)
public static function setYear($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y', $date);
return DateHelper::setYear($date, $checkStamp);
}
/**
* set the date as 2004/05 (for charts)
* Convert a date to a year/month format (e.g., "2024/05").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYearMonth($date, $spacer, $checkStamp);
*/
public static function setYearMonth($date, $spacer = '/', $check_stamp = true)
public static function setYearMonth($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm', $date);
return DateHelper::setYearMonth($date, $spacer, $checkStamp);
}
/**
* set the date as 2004/05/03 (for charts)
* Convert a date to a year/month/day format (e.g., "2024/05/03").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month/Day format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYearMonthDay($date, $spacer, $checkStamp);
*/
public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true)
public static function setYearMonthDay($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
return DateHelper::setYearMonthDay($date, $spacer, $checkStamp);
}
/**
* set the date as 03/05/2004
* Convert a date to a day/month/year format (e.g., "03/05/2024").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day/Month/Year format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDayMonthYear($date, $spacer, $checkStamp);
*/
public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true)
public static function setDayMonthYear($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
return DateHelper::setDayMonthYear($date, $spacer, $checkStamp);
}
/**
* Check if string is a valid time stamp
* Convert a date string to a valid timestamp.
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return int The valid timestamp.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::getValidTimestamp($date, $checkStamp);
*/
public static function isValidTimeStamp($timestamp)
public static function getValidTimestamp($date, bool $checkStamp): int
{
return ((int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
return DateHelper::getValidTimestamp($date, $checkStamp);
}
/**
* Check if string is a valid date
* https://www.php.net/manual/en/function.checkdate.php#113205
* Check if the input is a valid Unix timestamp.
*
* @param mixed $timestamp The timestamp to validate.
*
* @return bool True if valid timestamp, false otherwise.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::isValidTimeStamp($timestamp);
*/
public static function isValidateDate($date, $format = 'Y-m-d H:i:s')
public static function isValidTimeStamp($timestamp): bool
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
return DateHelper::isValidTimeStamp($timestamp);
}
/**
* Check if a string is a valid date according to the specified format.
*
* @param string $date The date string to validate.
* @param string $format The format to check against (default is 'Y-m-d H:i:s').
*
* @return bool True if valid date, false otherwise.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::isValidateDate($date, $format);
*/
public static function isValidateDate($date, string $format = 'Y-m-d H:i:s'): bool
{
return DateHelper::isValidateDate($date, $format);
}
/**
* The subform layouts
@ -5673,8 +5725,8 @@ abstract class ComponentbuilderHelper
return MathHelper::sum($array, $scale);
}
/**
* create plugin class name
/**
* create plugin class name
*
* @input string The group name
* @input string The name
@ -5683,7 +5735,7 @@ abstract class ComponentbuilderHelper
*
* @since 3.0.9
*
* @deprecated 4.0 - Use PluginHelper::safe($name, $group);
* @deprecated 4.0 - Use PluginHelper::safeClassName($name, $group);
*/
public static function createPluginClassName($group, $name)
{
@ -6173,6 +6225,10 @@ abstract class ComponentbuilderHelper
{
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_SERVERS'), 'index.php?option=com_componentbuilder&view=servers', $submenu === 'servers');
}
if ($user->authorise('repository.access', 'com_componentbuilder') && $user->authorise('repository.submenu', 'com_componentbuilder'))
{
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_REPOSITORIES'), 'index.php?option=com_componentbuilder&view=repositories', $submenu === 'repositories');
}
if ($user->authorise('help_document.access', 'com_componentbuilder') && $user->authorise('help_document.submenu', 'com_componentbuilder'))
{
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents');

File diff suppressed because one or more lines are too long

View File

@ -107,8 +107,6 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_IMPORT="Admin Views Import"
COM_COMPONENTBUILDER_ADMIN_VIEWS_IMPORT_DESC="Allows the users in this group to import import 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_RUN_EXPANSION_BUTTON_ACCESS="Admin View Run Expansion Button Access"
COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion 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"
@ -185,8 +183,6 @@ COM_COMPONENTBUILDER_COMPILER_COMPILER_ANIMATIONS_BUTTON_ACCESS="Compiler Compil
COM_COMPONENTBUILDER_COMPILER_COMPILER_ANIMATIONS_BUTTON_ACCESS_DESC="Allows the users in this group to access the compiler animations button."
COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST="Compiler Dashboard List"
COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Compiler"
COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS="Compiler Run Expansion Button Access"
COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_COMPILER_SUBMENU="Compiler Submenu"
COM_COMPONENTBUILDER_COMPILER_SUBMENU_DESC="Allows the users in this group to submenu of Compiler"
COM_COMPONENTBUILDER_COMPILER_TRANSLATE_BUTTON_ACCESS="Compiler Translate Button Access"
@ -534,8 +530,6 @@ COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT="Dynamic Gets Import"
COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT_DESC="Allows the users in this group to import import 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_RUN_EXPANSION_BUTTON_ACCESS="Dynamic Get Run Expansion Button Access"
COM_COMPONENTBUILDER_DYNAMIC_GET_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion 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"
@ -594,8 +588,12 @@ COM_COMPONENTBUILDER_FIELDTYPES_IMPORT="Fieldtypes Import"
COM_COMPONENTBUILDER_FIELDTYPES_IMPORT_DESC="Allows the users in this group to import import fieldtypes"
COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU="Fieldtypes Submenu"
COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU_DESC="Allows the users in this group to submenu of fieldtype"
COM_COMPONENTBUILDER_FIELD_RUN_EXPANSION_BUTTON_ACCESS="Field Run Expansion Button Access"
COM_COMPONENTBUILDER_FIELD_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_FIELDTYPE_INIT_BUTTON_ACCESS="Fieldtype Init Button Access"
COM_COMPONENTBUILDER_FIELDTYPE_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
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"
@ -674,8 +672,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC="Allows the users in this group to access the export jcb packages button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Import JCB Packages Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC="Allows the users in this group to access the import jcb packages button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS="Joomla Component Run Expansion Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion 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"
@ -746,8 +742,6 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION="Joomla Modules Updates
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules updates"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS="Joomla Module Get Snippets Button Access"
COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button."
COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS="Joomla Module Run Expansion Button Access"
COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS="Joomla Plugins Access"
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC="Allows the users in this group to access access joomla plugins"
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE="Joomla Plugins Batch Use"
@ -824,8 +818,6 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS="Joomla Plugin Methods
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS_DESC="Allows the users in this group to access the methods button."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS="Joomla Plugin Properties Button Access"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the properties button."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS="Joomla Plugin Run Expansion Button Access"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS="Joomla Powers Access"
COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC="Allows the users in this group to access access joomla powers"
COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE="Joomla Powers Batch Use"
@ -850,6 +842,8 @@ COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU="Joomla Powers Submenu"
COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of joomla power"
COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS="Joomla Power Init Button Access"
COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
COM_COMPONENTBUILDER_JOOMLA_POWER_PUSH_BUTTON_ACCESS="Joomla Power Push Button Access"
COM_COMPONENTBUILDER_JOOMLA_POWER_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS="Joomla Power Reset Button Access"
COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access"
@ -1061,10 +1055,34 @@ COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu"
COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS="Power Init Button Access"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS="Power Push Button Access"
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS="Power Reset Button Access"
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS="Power Run Expansion Button Access"
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_REPOSITORIES_ACCESS="Repositories Access"
COM_COMPONENTBUILDER_REPOSITORIES_ACCESS_DESC="Allows the users in this group to access access repositories"
COM_COMPONENTBUILDER_REPOSITORIES_BATCH_USE="Repositories Batch Use"
COM_COMPONENTBUILDER_REPOSITORIES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch repositories"
COM_COMPONENTBUILDER_REPOSITORIES_CREATE="Repositories Create"
COM_COMPONENTBUILDER_REPOSITORIES_CREATE_DESC="Allows the users in this group to create create repositories"
COM_COMPONENTBUILDER_REPOSITORIES_DASHBOARD_LIST="Repositories Dashboard List"
COM_COMPONENTBUILDER_REPOSITORIES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of repository"
COM_COMPONENTBUILDER_REPOSITORIES_DELETE="Repositories Delete"
COM_COMPONENTBUILDER_REPOSITORIES_DELETE_DESC="Allows the users in this group to delete delete repositories"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT="Repositories Edit"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY="Repositories Edit Created By"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by repositories"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE="Repositories Edit Created Date"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created repositories"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_DESC="Allows the users in this group to edit the repository"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN="Repositories Edit Own"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own repositories created by them"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE="Repositories Edit State"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the repository"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION="Repositories Edit Version"
COM_COMPONENTBUILDER_REPOSITORIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version repositories"
COM_COMPONENTBUILDER_REPOSITORIES_SUBMENU="Repositories Submenu"
COM_COMPONENTBUILDER_REPOSITORIES_SUBMENU_DESC="Allows the users in this group to submenu of repository"
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
@ -1224,6 +1242,4 @@ COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this grou
COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import"
COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC="Allows the users in this group to import import validation rules"
COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU="Validation Rules Submenu"
COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to submenu of validation rule"
COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS="Validation Rule Run Expansion Button Access"
COM_COMPONENTBUILDER_VALIDATION_RULE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to submenu of validation rule"

View File

@ -31,7 +31,6 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'store',
'medium_encryption_note',
'basic_encryption_note',
'note_whmcs_encryption',
'note_expert_field_save_mode',
'initiator_on_save_model',
'initiator_on_get_model',

View File

@ -19,7 +19,7 @@ use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
// set the defaults
$items = $displayData->vxtfields;
$items = $displayData->vxsfields;
$user = Factory::getUser();
$id = $displayData->item->id;
// set the edit URL

View File

@ -20,8 +20,8 @@ use Joomla\CMS\Layout\LayoutHelper;
?>
<div class="well well-small">
<h2 class="module-title nav-header"><?= Text::_('COM_COMPONENTBUILDER_JCB_PRO_NOTICE_BOARD') ?></h2>
<div class="proboard-md"><small><?= Text::_('COM_COMPONENTBUILDER_THE_PRO_BOARD_IS_LOADING') ?><span class="loading-dots">.</span></small></div>
<div style="text-align:right;"><small><a href="https://vdm.bz/get-jcb-pro-membership" target="_blank" style="color:gray">JCB PRO</a></small></div>
</div>
<div id="noticeboard">
<?php echo LayoutHelper::render('mastodon', $displayData ?? []); ?>
</div>
<?php echo LayoutHelper::render('socialnetworking', null); ?>
<div><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>

View File

@ -1,34 +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
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
?>
<div id="<?php echo $displayData['id']; ?>">
<?php echo Html::_('bootstrap.startTabSet', $displayData['id'] . '_tab', array('active' => $displayData['active'] . '-noticeboard')); ?>
<?php echo Html::_('bootstrap.addTab', $displayData['id'] . '_tab', 'vdm-noticeboard', Text::_('COM_COMPONENTBUILDER_VDM_BOARD', true)); ?>
<?php echo LayoutHelper::render('jcbnoticeboardvdm', null); ?>
<div class="p-md-3"><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>
<?php echo Html::_('bootstrap.endTab'); ?>
<?php echo Html::_('bootstrap.addTab', $displayData['id'] . '_tab', 'pro-noticeboard', Text::_('COM_COMPONENTBUILDER_JCB_PRO_BOARD', true)); ?>
<?php echo LayoutHelper::render('jcbnoticeboardpro', null); ?>
<div class="p-md-3"><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>
<?php echo Html::_('bootstrap.endTab'); ?>
<?php echo Html::_('bootstrap.endTabSet'); ?>
</div>

View File

@ -1,27 +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
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
?>
<div class="well well-small">
<h2 class="module-title nav-header"><?= Text::_('COM_COMPONENTBUILDER_VDM_NOTICE_BOARD') ?><span class="vdm-new-notice" style="display:none; color:red;"> (<?= Text::_('COM_COMPONENTBUILDER_NEW_NOTICE') ?>)</span></h2>
<div class="noticeboard-md"><small><?= Text::_('COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING') ?><span class="loading-dots">.</span></small></div>
<div style="text-align:right;"><small><a href="https://github.com/Llewellynvdm" target="_blank" style="color:gray">&lt;&lt;ewe&gt;&gt;yn</a></small></div>
</div>

View File

@ -30,12 +30,6 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'author',
'email',
'website',
'add_license',
'license_type',
'note_whmcs_lisencing_note',
'whmcs_key',
'whmcs_url',
'whmcs_buy_link',
'license',
'bom',
'image',

View File

@ -26,8 +26,8 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'description',
'settings'
'settings',
'description'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];

View File

@ -0,0 +1,71 @@
<?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
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
// Extract all keys from $displayData as individual variables.
extract($displayData ?? []);
// The 'id' parameter, defaulting to mastodon-feed.
$id ??= 'mastodon-feed';
// The button 'id' parameter, defaulting to refresh-feed.
$button_id ??= 'refresh-feed';
// The mastodon instance URL
$instance ??= 'https://joomla.social';
// The user account ID
$account ??= '112766899254600077';
// The number of post to load
$posts ??= 5;
// The 'invite_url' parameter, defaulting to https://joomla.social/invite/gzAvC48K.
$invite_url ??= 'https://joomla.social/invite/gzAvC48K';
// The 'invite_heading' parameter.
$invite_heading ??= Text::_("COM_COMPONENTBUILDER_LLEWELLYNS_JOOMLA_SOCIAL_FEED");
// The 'invite_title' parameter.
$invite_title ??= Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_LEAD_DEVELOPER_ON_JOOMLA_SOCIAL_A_MASTODON_INSTANCE");
?>
<div class="well well-small mastadon-display-block">
<h2>
<a
href="<?php echo $invite_url; ?>"
title="<?php echo $invite_title; ?>">
<?php echo $invite_heading; ?>
</a>&nbsp;&nbsp;
<a
type="button"
id="<?php echo $button_id; ?>"
href="#"
title="<?php echo Text::_('COM_COMPONENTBUILDER_REFRESH_FEED'); ?>">
<i class="icon-loop"></i>
</a>
</h2>
<div id="<?php echo $id; ?>"
data-instance="<?php echo $instance; ?>"
data-account-id="<?php echo $account; ?>"
data-post-count="<?php echo $posts; ?>">
</div>
<script>
new MastodonFeed("<?php echo $id; ?>", "<?php echo $button_id; ?>");
</script>
</div>

View File

@ -30,6 +30,8 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'description',
'extends',
'extends_custom',
'extendsinterfaces',
'extendsinterfaces_custom',
'implements',
'implements_custom',
'namespace',

View File

@ -0,0 +1,46 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'system_name',
'target',
'access_repo'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,45 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'type',
'base',
'username',
'token'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -0,0 +1,45 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'organisation',
'repository',
'read_branch',
'write_branch'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -0,0 +1,45 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'placeholder_note',
'addplaceholders'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,47 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'guid',
'title',
'created',
'created_by',
'modified',
'modified_by'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -0,0 +1,47 @@
<?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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'published',
'ordering',
'access',
'version',
'hits',
'id'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -0,0 +1,61 @@
<?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
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
?>
<div id="llewellyns-social-icons" class="social-icons" style="float: right;">
<a href="https://volunteers.joomla.org/joomlers/1396-llewellyn-van-der-merwe" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_JOIN_LLEWELLYN_ON_THE_JOOMLA_VOLUNTEER_PORTAL_SHAPING_THE_FUTURE_TOGETHER'); ?>">
<i class="icon-joomla"></i>
</a>
<a href="https://git.vdm.dev/octoleo" class="text-decoration-none me-2" data-description="--quiet">
<i class="icon-shield"></i>
</a>
<a href="https://git.vdm.dev/Llewellyn" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_COLLABORATE_AND_INNOVATE_WITH_LLEWELLYN_ON_GIT_BUILDING_A_BETTER_CODE_FUTURE'); ?>">
<i class="icon-tree"></i>
</a>
<a href="https://joomla.social/@llewellyn" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_CONNECT_AND_ENGAGE_WITH_LLEWELLYN_ON_JOOMLA_SOCIAL_EMPOWERING_COMMUNITIES_ONE_POST_AT_A_TIME'); ?>">
<i class="icon-puzzle"></i>
</a>
<a href="https://x.com/llewellynvdm" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_JOIN_THE_CONVERSATION_WITH_LLEWELLYN_ON_X_WHERE_IDEAS_TAKE_FLIGHT'); ?>">
<i class="icon-signup"></i>
</a>
<a href="https://github.com/Llewellynvdm" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_BUILD_INNOVATE_AND_THRIVE_WITH_LLEWELLYN_ON_GITHUB_TURNING_IDEAS_INTO_IMPACT'); ?>">
<i class="icon-cog"></i>
</a>
<a href="https://www.youtube.com/@OctoYou" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_EXPLORE_LEARN_AND_CREATE_WITH_LLEWELLYN_ON_YOUTUBE_YOUR_GATEWAY_TO_INSPIRATION'); ?>">
<i class="icon-youtube"></i>
</a>
<a href="https://hub.docker.com/u/llewellyn" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_LLEWELLYN_ON_DOCKER_CONTAINERIZE_YOUR_CREATIVITY'); ?>">
<i class="icon-box-add"></i>
</a>
<a href="https://opencollective.com/joomla-component-builder" class="text-decoration-none me-2" data-description="<?php echo Text::_('COM_COMPONENTBUILDER_DONATE_TOWARDS_JCB_HELP_LLEWELLYN_FINANCIALLY_SO_HE_CAN_CONTINUE_DEVELOPING_THIS_GREAT_TOOL'); ?>">
<i class="icon-heart"></i>
</a>
<a href="https://git.vdm.dev/Llewellyn/gpg" class="text-decoration-none" data-description="<?php echo Text::_("COM_COMPONENTBUILDER_UNLOCK_TRUST_AND_SECURITY_WITH_LLEWELLYNS_GPG_KEY_YOUR_GATEWAY_TO_VERIFIED_CONNECTIONS"); ?>">
<i class="icon-key"></i>
</a>
</div>
<br>
<div id="llewellyns-social-icon-details" class="social-icon-details" style="float: right;"></div>
<script>
document.addEventListener("DOMContentLoaded", () => {
new IconWaveAnimator("llewellyns-social-icons", "llewellyns-social-icon-details");
});
</script>

View File

@ -18,15 +18,31 @@ use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use VDM\Joomla\Utilities\StringHelper;
$table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7);
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
$table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table';
$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto';
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
// Extract all keys from $displayData as individual variables.
extract($displayData);
// Assign default values for variables that might not be present in $displayData.
// The 'table_id' parameter, defaulting to a randomly generated value if not set or is null.
$table_id = $id ?? StringHelper::random(7);
// The 'name' parameter, defaulting to false if not set or is null.
$name ??= false;
// The 'table_class' parameter, defaulting to 'uk-table' if not set or is null.
$table_class ??= 'uk-table';
// The 'table_container_class' parameter, defaulting to 'uk-overflow-auto' if not set or is null.
$table_container_class ??= 'uk-overflow-auto';
// The 'headers' parameter, defaulting to an array of default header values if not set or is null.
$headers ??= [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
// The 'items' parameter, defaulting to 6 if not set or is null.
$items ??= 6;
?>
<div class="<?php echo $$table_container_class; ?>">
<div class="<?php echo $table_container_class; ?>">
<table id="<?php echo $table_id; ?>" class="<?php echo $table_class; ?>">
<thead>
<?php if (is_array($headers)): ?>

View File

@ -31,16 +31,16 @@ use Joomla\CMS\Layout\LayoutHelper;
document.adminForm.elements['checkall-toggle'].checked=1;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
// check to confirm the deletion
if(confirm('<?= Text::_("COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
if(confirm('<?php echo Text::_("COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?php echo $displayData->getName(); ?>.delete');
} else {
document.adminForm.elements['checkall-toggle'].checked=0;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
}
} else {
// confirm deletion of those selected
if (confirm('<?= Text::_("COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
if (confirm('<?php echo Text::_("COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?php echo $displayData->getName(); ?>.delete');
};
}
return false;
@ -56,23 +56,23 @@ use Joomla\CMS\Layout\LayoutHelper;
<?php if (empty($displayData->items)): ?>
<h4 class="alert-heading">
<span class="icon-trash"></span>
<?= Text::_("COM_COMPONENTBUILDER_TRASH_AREA") ?>
<?php echo Text::_("COM_COMPONENTBUILDER_TRASH_AREA") ?>
</h4>
<p><?= Text::_("COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?></p>
<p><?php echo Text::_("COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?></p>
<?php else: ?>
<h4 class="alert-heading">
<span class="icon-trash"></span>
<?= Text::_("COM_COMPONENTBUILDER_TRASHED_ITEMS") ?>
<?php echo Text::_("COM_COMPONENTBUILDER_TRASHED_ITEMS") ?>
</h4>
<p><?= Text::_("COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?></p>
<p><?php echo Text::_("COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?></p>
<button onclick="emptyTrash();" class="btn btn-small btn-danger">
<span class="icon-delete" aria-hidden="true"></span>
<?= Text::_("COM_COMPONENTBUILDER_EMPTY_TRASH") ?>
<?php echo Text::_("COM_COMPONENTBUILDER_EMPTY_TRASH") ?>
</button>
<?php endif; ?>
<button onclick="exitTrash();" class="btn btn-small">
<span class="icon-back" aria-hidden="true"></span>
<?= Text::_("COM_COMPONENTBUILDER_EXIT_TRASH") ?>
<?php echo Text::_("COM_COMPONENTBUILDER_EXIT_TRASH") ?>
</button>
</div>
<?php endif; ?>

View File

@ -868,7 +868,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -899,7 +899,7 @@ class ComponentbuilderModelAdmin_fields extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -889,7 +889,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -24,6 +24,7 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -86,10 +87,18 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
/**
* get VDM internal session key
* Retrieves or generates a Vast Development Method (VDM) key for the current item.
*
* @return string the session key
* This function performs the following operations:
* 1. Checks if the VDM key is already set. If not, it proceeds to generate or retrieve one.
* 2. Determines the item ID based on the presence of a specific argument.
* 3. Attempts to retrieve an existing VDM key from a helper method using the item ID.
* 4. If a VDM key is not found, it generates a new random VDM key.
* 5. Stores the VDM key and associates it with the item ID in a helper method.
* 6. Optionally, stores return and GUID values if available.
* 7. Returns the VDM key.
*
* @return string The VDM key for the current item.
*/
public function getVDM()
{
@ -106,7 +115,7 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
if (($vdm = SessionHelper::get('admin_fields_relations__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -114,17 +123,17 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
SessionHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -179,7 +188,7 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
if (($vdm = SessionHelper::get('admin_fields_relations__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -187,17 +196,17 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
SessionHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -951,7 +960,7 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -24,6 +24,7 @@ use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -235,10 +236,18 @@ class ComponentbuilderModelAdmin_view extends AdminModel
/**
* get VDM internal session key
* Retrieves or generates a Vast Development Method (VDM) key for the current item.
*
* @return string the session key
* This function performs the following operations:
* 1. Checks if the VDM key is already set. If not, it proceeds to generate or retrieve one.
* 2. Determines the item ID based on the presence of a specific argument.
* 3. Attempts to retrieve an existing VDM key from a helper method using the item ID.
* 4. If a VDM key is not found, it generates a new random VDM key.
* 5. Stores the VDM key and associates it with the item ID in a helper method.
* 6. Optionally, stores return and GUID values if available.
* 7. Returns the VDM key.
*
* @return string The VDM key for the current item.
*/
public function getVDM()
{
@ -255,7 +264,7 @@ class ComponentbuilderModelAdmin_view extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
if (($vdm = SessionHelper::get('admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -263,17 +272,17 @@ class ComponentbuilderModelAdmin_view extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id);
ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_view__'.$id);
SessionHelper::set('admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -604,7 +613,7 @@ class ComponentbuilderModelAdmin_view extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
if (($vdm = SessionHelper::get('admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -612,17 +621,17 @@ class ComponentbuilderModelAdmin_view extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id);
ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_view__'.$id);
SessionHelper::set('admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields
@ -791,6 +800,9 @@ class ComponentbuilderModelAdmin_view extends AdminModel
}
}
// update the ajax_input (sub form) layout
$form->setFieldAttribute('ajax_input', 'layout', ComponentbuilderHelper::getSubformLayout('admin_view', 'ajax_input'));
// update all editors to use this components global editor
$global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none');
// now get all the editor fields
@ -1005,7 +1017,7 @@ class ComponentbuilderModelAdmin_view extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}
@ -1875,7 +1887,7 @@ class ComponentbuilderModelAdmin_view extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@ -28,6 +28,7 @@ use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use Joomla\CMS\Uri\Uri;
@ -164,35 +165,73 @@ class ComponentbuilderModelAjax extends ListModel
}
/**
* set the component display
**/
* Generate the component details display in HTML.
*
* @param object $object The component object containing details.
* @return string The HTML string for displaying component details.
*/
protected function componentDetailsDisplay($object)
{
// set some vars
$image = (StringHelper::check($object->image)) ? '<img alt="Joomla Component Image" src="'. Uri::root() . $object->image . '" style="float: right;">': '';
$desc = (StringHelper::check($object->description)) ? $object->description : $object->short_description;
$placeholder = ($object->add_placeholders == 1) ? '<span class="btn btn-small btn-success"> ' . Text::_('COM_COMPONENTBUILDER_YES') . ' </span>' : '<span class="btn btn-small btn-danger"> ' .Text::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$debug = ($object->debug_linenr == 1) ? '<span class="btn btn-small btn-success"> ' .Text::_('COM_COMPONENTBUILDER_YES') . '</span>' : ' <span class="btn btn-small btn-danger"> ' .Text::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$html = array();
$html[] = '<h3>' . $object->name . ' (v' . $object->component_version . ')</h3>';
$html[] = '<p>' . $desc . $image . '</p>';
$html[] = '<ul>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_COMPANY') . ': <b>' . $object->companyname . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_AUTHOR') . ': <b>' . $object->author . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_EMAIL') . ': <b>' . $object->email . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_WEBSITE') . ': <b>' . $object->website . '</b></li>';
$html[] = '</ul>';
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS') . '</h4>';
// Helper variables with null coalescing to ensure robust value assignment
$imageSrc = !empty($object->image) ? htmlspecialchars($object->image, ENT_QUOTES) : null;
$image = $imageSrc
? '<img alt="' . Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE') . '" src="' . Uri::root() . $imageSrc . '" style="float: right; max-width: 250px; margin-left: 15px;">'
: '';
$description = htmlspecialchars(!empty($object->description) ? $object->description : $object->short_description, ENT_QUOTES);
$placeholderStatus = $object->add_placeholders
? '<span class="badge badge-success">' . Text::_('COM_COMPONENTBUILDER_YES') . '</span>'
: '<span class="badge badge-danger">' . Text::_('COM_COMPONENTBUILDER_NO') . '</span>';
$debugStatus = $object->debug_linenr
? '<span class="badge badge-success">' . Text::_('COM_COMPONENTBUILDER_YES') . '</span>'
: '<span class="badge badge-danger">' . Text::_('COM_COMPONENTBUILDER_NO') . '</span>';
// Author and company details
$company = '<ul>';
$company .= '<li><strong>' . Text::_('COM_COMPONENTBUILDER_COMPANY') . ':</strong> ' . htmlspecialchars($object->companyname, ENT_QUOTES) . '</li>';
$company .= '<li><strong>' . Text::_('COM_COMPONENTBUILDER_AUTHOR') . ':</strong> ' . htmlspecialchars($object->author, ENT_QUOTES) . '</li>';
$company .= '<li><strong>' . Text::_('COM_COMPONENTBUILDER_EMAIL') . ':</strong> <a href="mailto:' . htmlspecialchars($object->email, ENT_QUOTES) . '">' . htmlspecialchars($object->email, ENT_QUOTES) . '</a></li>';
$company .= '<li><strong>' . Text::_('COM_COMPONENTBUILDER_WEBSITE') . ':</strong> <a href="' . htmlspecialchars($object->website, ENT_QUOTES) . '" target="_blank" rel="noopener">' . htmlspecialchars($object->website, ENT_QUOTES) . '</a></li>';
$company .= '</ul>';
// Build HTML output
$html = [];
// Header with component name and version
$html[] = '<div class="component-details">';
$html[] = '<h3>' . htmlspecialchars($object->name, ENT_QUOTES) . ' (v' . htmlspecialchars($object->component_version, ENT_QUOTES) . ')</h3>';
// Description with optional image
$html[] = '<div class="description" style="overflow: hidden;">';
$html[] = '<p>' . $image . $description . $company . '</p>';
$html[] = '</div>';
// Component settings
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_COMPONENT_SETTINGS') . '</h4>';
$html[] = '<p>';
$html[] = Text::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . '<br />' . $placeholder . '<br />';
$html[] = Text::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . '<br />' . $debug ;
$html[] = Text::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . ': ' . $placeholderStatus . '<br>';
$html[] = Text::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . ': ' . $debugStatus;
$html[] = '</p>';
// License details
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_LICENSE') . '</h4>';
$html[] = '<p>' . $object->license . '</p>';
$html[] = '<p>' . nl2br(htmlspecialchars($object->license, ENT_QUOTES)) . '</p>';
// Copyright
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_COPYRIGHT') . '</h4>';
$html[] = '<p>' . $object->copyright . '<br /><br />';
$html[] = '<a href="index.php?option=com_componentbuilder&ref=compiler&view=joomla_components&task=joomla_component.edit&id=' . (int) $object->id . '" class="btn btn-small span12"><span class="icon-edit"></span> ' . Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' .$object->system_name . '</a></p>';
// now return the diplay
$html[] = '<p>' . nl2br(htmlspecialchars($object->copyright, ENT_QUOTES)) . '</p>';
// Edit button
$html[] = '<p>';
$html[] = '<a href="index.php?option=com_componentbuilder&ref=compiler&view=joomla_components&task=joomla_component.edit&id=' . (int) $object->id . '" class="btn btn-primary btn-block">';
$html[] = '<span class="icon-edit"></span> ' . Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' . htmlspecialchars($object->system_name, ENT_QUOTES);
$html[] = '</a>';
$html[] = '</p>';
$html[] = '</div>'; // Close component-details
return implode("\n", $html);
}
@ -1259,7 +1298,7 @@ class ComponentbuilderModelAjax extends ListModel
array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'fields' => array('params' => 'custom_admin_view_headers:power_:power', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW'),
array('table' => 'joomla_component', 'tables' => 'joomla_components', 'fields' => array('params' => 'joomla_component_headers:power_:power', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT'),
array('table' => 'component_dashboard', 'tables' => 'components_dashboard', 'fields' => array('params' => 'component_dashboard_headers:power_:power', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD', 'linked_name' => 'system_name'),
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'GUID', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'GUID', 'extendsinterfaces' => 'ARRAY', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
)
);
@ -1595,7 +1634,7 @@ class ComponentbuilderModelAjax extends ListModel
* @var array
* @since 3.0.13
*/
protected $viewid = [];
protected array $viewid = [];
/**
* Get the view details via the session
@ -1615,7 +1654,7 @@ class ComponentbuilderModelAjax extends ListModel
if ($vdm)
{
// set view and id
if ($view = ComponentbuilderHelper::get($vdm))
if (($view = SessionHelper::get($vdm)) !== null)
{
$current = (array) explode('__', $view);
if (StringHelper::check($current[0]) && isset($current[1]) && is_numeric($current[1]))
@ -1628,7 +1667,7 @@ class ComponentbuilderModelAjax extends ListModel
}
}
// set GUID if found
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false)
if (($guid = SessionHelper::get($vdm . '__guid')) !== null)
{
if (GuidHelper::valid($guid))
{
@ -1636,7 +1675,7 @@ class ComponentbuilderModelAjax extends ListModel
}
}
// set return if found
if (($return = ComponentbuilderHelper::get($vdm . '__return')) !== false)
if (($return = SessionHelper::get($vdm . '__return')) !== null)
{
if (StringHelper::check($return))
{
@ -1948,15 +1987,15 @@ class ComponentbuilderModelAjax extends ListModel
{
// check if we have GUID setup
$validGUID = function ($guid) {
if (method_exists('ComponentbuilderHelper', 'validGUID') && ComponentbuilderHelper::validGUID($guid))
if (method_exists(ComponentbuilderHelper::class, 'validGUID') && ComponentbuilderHelper::validGUID($guid))
{
return true;
}
return false;
};
// check if functions exists
$guidEdit = method_exists('ComponentbuilderHelper', 'getEditButtonGUID');
$getEdit = method_exists('ComponentbuilderHelper', 'getEditButton');
$guidEdit = method_exists(ComponentbuilderHelper::class, 'getEditButtonGUID');
$getEdit = method_exists(ComponentbuilderHelper::class, 'getEditButton');
// reset bucket
$bucket = array();
if (UtilitiesArrayHelper::check($value))

Some files were not shown because too many files have changed in this diff Show More