forked from joomla/Component-Builder
Release of v5.0.1-alpha5
Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
parent
fc6b04cb5c
commit
c51ef999a9
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,14 +1,17 @@
|
|||||||
# v5.0.1-alpha4
|
# v5.0.1-alpha5
|
||||||
|
|
||||||
- Change the extendsinterfaces field to allow null, #1139
|
- Add repositories for better integration with gitea
|
||||||
- Update the Schema class to also update null mismatching if needed
|
- Refactored the Data classes
|
||||||
|
- Add new Data classes
|
||||||
|
|
||||||
# v5.0.1-alpha
|
# v5.0.1-alpha
|
||||||
|
|
||||||
- Fix auto build from SQL in Joomla 5.
|
- Fix auto build from SQL in Joomla 5.
|
||||||
- Fix permission issue for admin views.
|
- Fix permission issue for admin views.
|
||||||
- Add in JCB gitea push feature to help maintain JCB core features.
|
- Add in JCB gitea push feature to help maintain JCB core features.
|
||||||
- Add extending options to interfaces.
|
- Add extending options to interfaces.
|
||||||
|
- Change the extendsinterfaces field to allow null, #1139
|
||||||
|
- Update the Schema class to also update null mismatching if needed
|
||||||
|
|
||||||
# v5.0.0
|
# v5.0.0
|
||||||
|
|
||||||
|
@ -264,6 +264,9 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// Remove Server Data
|
// Remove Server Data
|
||||||
$this->removeViewData("com_componentbuilder.server");
|
$this->removeViewData("com_componentbuilder.server");
|
||||||
|
|
||||||
|
// Remove Repository Data
|
||||||
|
$this->removeViewData("com_componentbuilder.repository");
|
||||||
|
|
||||||
// Remove Help document Data
|
// Remove Help document Data
|
||||||
$this->removeViewData("com_componentbuilder.help_document");
|
$this->removeViewData("com_componentbuilder.help_document");
|
||||||
|
|
||||||
@ -423,6 +426,9 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// Remove Server from action logs config table.
|
// Remove Server from action logs config table.
|
||||||
$this->removeActionLogConfig('com_componentbuilder.server');
|
$this->removeActionLogConfig('com_componentbuilder.server');
|
||||||
|
|
||||||
|
// Remove Repository from action logs config table.
|
||||||
|
$this->removeActionLogConfig('com_componentbuilder.repository');
|
||||||
|
|
||||||
// Remove Help_document from action logs config table.
|
// Remove Help_document from action logs config table.
|
||||||
$this->removeActionLogConfig('com_componentbuilder.help_document');
|
$this->removeActionLogConfig('com_componentbuilder.help_document');
|
||||||
|
|
||||||
@ -617,11 +623,11 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// rules
|
// rules
|
||||||
'',
|
'',
|
||||||
// fieldMappings
|
// fieldMappings
|
||||||
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_site_event":"php_site_event","component_version":"component_version","php_admin_event":"php_admin_event","crowdin_username":"crowdin_username","php_preflight_install":"php_preflight_install","remove_line_breaks":"remove_line_breaks","description":"description","php_method_uninstall":"php_method_uninstall","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","css_admin":"css_admin","addreadme":"addreadme","php_postflight_install":"php_postflight_install","add_placeholders":"add_placeholders","sql":"sql","author":"author","update_server_url":"update_server_url","email":"email","add_backup_folder_path":"add_backup_folder_path","website":"website","translation_tool":"translation_tool","add_license":"add_license","buildcompsql":"buildcompsql","license_type":"license_type","php_helper_admin":"php_helper_admin","php_helper_site":"php_helper_site","whmcs_key":"whmcs_key","javascript":"javascript","whmcs_url":"whmcs_url","css_site":"css_site","whmcs_buy_link":"whmcs_buy_link","license":"license","php_preflight_update":"php_preflight_update","bom":"bom","php_postflight_update":"php_postflight_update","image":"image","php_method_install":"php_method_install","copyright":"copyright","sql_uninstall":"sql_uninstall","preferred_joomla_version":"preferred_joomla_version","add_powers":"add_powers","add_sales_server":"add_sales_server","backup_folder_path":"backup_folder_path","add_jcb_powers_path":"add_jcb_powers_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_php_method_install":"add_php_method_install","joomla_source_link":"joomla_source_link","add_sql":"add_sql","export_buy_link":"export_buy_link","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","emptycontributors":"emptycontributors","update_server_target":"update_server_target","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","jcb_powers_path":"jcb_powers_path","creatuserhelper":"creatuserhelper","adduikit":"adduikit","crowdin_project_api_key":"crowdin_project_api_key","addfootable":"addfootable","crowdin_account_api_key":"crowdin_account_api_key","add_email_helper":"add_email_helper","buildcomp":"buildcomp","add_php_helper_both":"add_php_helper_both","guid":"guid","php_helper_both":"php_helper_both","name":"name"}}',
|
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_postflight_update","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","crowdin_project_identifier":"crowdin_project_identifier","backup_folder_path":"backup_folder_path","sql_uninstall":"sql_uninstall","php_postflight_update":"php_postflight_update","css_site":"css_site","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","php_helper_site":"php_helper_site","javascript":"javascript","description":"description","debug_linenr":"debug_linenr","author":"author","php_method_install":"php_method_install","email":"email","website":"website","add_sales_server":"add_sales_server","license":"license","add_jcb_powers_path":"add_jcb_powers_path","bom":"bom","image":"image","php_admin_event":"php_admin_event","copyright":"copyright","php_site_event":"php_site_event","css_admin":"css_admin","php_preflight_update":"php_preflight_update","component_version":"component_version","php_preflight_install":"php_preflight_install","preferred_joomla_version":"preferred_joomla_version","php_postflight_install":"php_postflight_install","add_powers":"add_powers","php_method_uninstall":"php_method_uninstall","sql":"sql","addreadme":"addreadme","update_server_url":"update_server_url","add_backup_folder_path":"add_backup_folder_path","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","add_namespace_prefix":"add_namespace_prefix","namespace_prefix":"namespace_prefix","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_menu_prefix":"add_menu_prefix","add_javascript":"add_javascript","menu_prefix":"menu_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","dashboard_type":"dashboard_type","toignore":"toignore","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","export_key":"export_key","add_php_postflight_install":"add_php_postflight_install","joomla_source_link":"joomla_source_link","add_php_postflight_update":"add_php_postflight_update","export_buy_link":"export_buy_link","add_php_method_uninstall":"add_php_method_uninstall","add_php_method_install":"add_php_method_install","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","emptycontributors":"emptycontributors","assets_table_fix":"assets_table_fix","number":"number","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","creatuserhelper":"creatuserhelper","add_git_folder_path":"add_git_folder_path","adduikit":"adduikit","git_folder_path":"git_folder_path","addfootable":"addfootable","jcb_powers_path":"jcb_powers_path","add_email_helper":"add_email_helper","add_php_helper_both":"add_php_helper_both","crowdin_project_api_key":"crowdin_project_api_key","php_helper_both":"php_helper_both","crowdin_account_api_key":"crowdin_account_api_key","add_php_helper_admin":"add_php_helper_admin","buildcomp":"buildcomp","php_helper_admin":"php_helper_admin","guid":"guid","add_admin_event":"add_admin_event","name":"name"}}',
|
||||||
// router
|
// router
|
||||||
'',
|
'',
|
||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
'{"formFile": "administrator/components/com_componentbuilder/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","remove_line_breaks","debug_linenr","mvc_versiondate","addreadme","add_placeholders","add_backup_folder_path","translation_tool","add_license","license_type","preferred_joomla_version","add_powers","add_sales_server","add_jcb_powers_path","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_method_install","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","emptycontributors","update_server_target","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","addfootable","add_email_helper","buildcomp","add_php_helper_both"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'
|
'{"formFile": "administrator/components/com_componentbuilder/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_sales_server","add_jcb_powers_path","preferred_joomla_version","add_powers","addreadme","add_backup_folder_path","translation_tool","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_method_install","add_sql","add_sql_uninstall","emptycontributors","assets_table_fix","number","add_update_server","update_server_target","update_server","sales_server","creatuserhelper","add_git_folder_path","adduikit","addfootable","add_email_helper","add_php_helper_both","add_php_helper_admin","buildcomp","add_admin_event"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
);
|
);
|
||||||
// Install Joomla module Content Types.
|
// Install Joomla module Content Types.
|
||||||
$this->setContentType(
|
$this->setContentType(
|
||||||
@ -923,7 +929,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// rules
|
// rules
|
||||||
'',
|
'',
|
||||||
// fieldMappings
|
// fieldMappings
|
||||||
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "css_views","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","store":"store","on_save_model_field":"on_save_model_field","initiator_on_get_model":"initiator_on_get_model","initiator_on_save_model":"initiator_on_save_model","xml":"xml","datalenght":"datalenght","css_views":"css_views","css_view":"css_view","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","on_get_model_field":"on_get_model_field","javascript_view_footer":"javascript_view_footer","javascript_views_footer":"javascript_views_footer","add_css_view":"add_css_view","add_css_views":"add_css_views","add_javascript_view_footer":"add_javascript_view_footer","add_javascript_views_footer":"add_javascript_views_footer","guid":"guid"}}',
|
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "javascript_view_footer","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","store":"store","on_get_model_field":"on_get_model_field","on_save_model_field":"on_save_model_field","initiator_on_get_model":"initiator_on_get_model","xml":"xml","datalenght":"datalenght","javascript_view_footer":"javascript_view_footer","css_views":"css_views","css_view":"css_view","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","javascript_views_footer":"javascript_views_footer","add_css_view":"add_css_view","add_css_views":"add_css_views","add_javascript_view_footer":"add_javascript_view_footer","add_javascript_views_footer":"add_javascript_views_footer","initiator_on_save_model":"initiator_on_save_model","guid":"guid"}}',
|
||||||
// router
|
// router
|
||||||
'',
|
'',
|
||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
@ -1031,6 +1037,23 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
'{"formFile": "administrator/components/com_componentbuilder/forms/server.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","protocol","authentication"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
'{"formFile": "administrator/components/com_componentbuilder/forms/server.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","protocol","authentication"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
);
|
);
|
||||||
|
// Install Repository Content Types.
|
||||||
|
$this->setContentType(
|
||||||
|
// typeTitle
|
||||||
|
'Componentbuilder Repository',
|
||||||
|
// typeAlias
|
||||||
|
'com_componentbuilder.repository',
|
||||||
|
// table
|
||||||
|
'{"special": {"dbtable": "#__componentbuilder_repository","key": "id","type": "RepositoryTable","prefix": "VDM\Component\Componentbuilder\Administrator\Table"}}',
|
||||||
|
// rules
|
||||||
|
'',
|
||||||
|
// fieldMappings
|
||||||
|
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","organisation":"organisation","repository":"repository","target":"target","type":"type","base":"base","guid":"guid","access_repo":"access_repo","write_branch":"write_branch","read_branch":"read_branch","token":"token","username":"username"}}',
|
||||||
|
// router
|
||||||
|
'',
|
||||||
|
// contentHistoryOptions
|
||||||
|
'{"formFile": "administrator/components/com_componentbuilder/forms/repository.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","target","type","access_repo"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
|
);
|
||||||
// Install Help document Content Types.
|
// Install Help document Content Types.
|
||||||
$this->setContentType(
|
$this->setContentType(
|
||||||
// typeTitle
|
// typeTitle
|
||||||
@ -1493,10 +1516,10 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
|
|
||||||
|
|
||||||
// Fix the assets table rules column size.
|
// Fix the assets table rules column size.
|
||||||
$this->setDatabaseAssetsRulesFix(93920, "MEDIUMTEXT");
|
$this->setDatabaseAssetsRulesFix(96000, "MEDIUMTEXT");
|
||||||
// Install the global extension params.
|
// Install the global extension params.
|
||||||
$this->setExtensionsParams(
|
$this->setExtensionsParams(
|
||||||
'{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","super_powers_documentation":"0","powers_repository":"0","super_powers_repositories":"0","approved_paths":"default","add_custom_gitea_url":"1","custom_gitea_url":"https://git.vdm.dev","super_powers_core_organisation":"joomla","super_powers_core":"joomla/super-powers","builder_gif_size":"480-272","compiler_plugin":["componentbuilderactionlogcompiler","componentbuilderfieldorderingcompiler","componentbuilderheaderscompiler","componentbuilderpowersautoloadercompiler","componentbuilderprivacycompiler"],"add_menu_prefix":"1","menu_prefix":"»","namespace_prefix":"JCB","minify":"0","language":"en-GB","percentagelanguageadd":"30","assets_table_fix":"2","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","import_guid_only":"1","export_language_strings":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":"","uikit_style":""}'
|
'{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","super_powers_documentation":"0","powers_repository":"0","super_powers_repositories":"0","builder_gif_size":"480-272","compiler_plugin":["componentbuilderactionlogcompiler","componentbuilderfieldorderingcompiler","componentbuilderheaderscompiler","componentbuilderpowersautoloadercompiler","componentbuilderprivacycompiler"],"add_menu_prefix":"1","menu_prefix":"»","namespace_prefix":"JCB","minify":"0","language":"en-GB","percentagelanguageadd":"30","assets_table_fix":"2","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","import_guid_only":"1","export_language_strings":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":"","uikit_style":""}'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1879,6 +1902,22 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
'COM_COMPONENTBUILDER'
|
'COM_COMPONENTBUILDER'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add Repository to the action logs config table.
|
||||||
|
$this->setActionLogConfig(
|
||||||
|
// typeTitle
|
||||||
|
'REPOSITORY',
|
||||||
|
// typeAlias
|
||||||
|
'com_componentbuilder.repository',
|
||||||
|
// idHolder
|
||||||
|
'id',
|
||||||
|
// titleHolder
|
||||||
|
'system_name',
|
||||||
|
// tableName
|
||||||
|
'#__componentbuilder_repository',
|
||||||
|
// textPrefix
|
||||||
|
'COM_COMPONENTBUILDER'
|
||||||
|
);
|
||||||
|
|
||||||
// Add Help_document to the action logs config table.
|
// Add Help_document to the action logs config table.
|
||||||
$this->setActionLogConfig(
|
$this->setActionLogConfig(
|
||||||
// typeTitle
|
// typeTitle
|
||||||
@ -2327,11 +2366,11 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// rules
|
// rules
|
||||||
'',
|
'',
|
||||||
// fieldMappings
|
// fieldMappings
|
||||||
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_site_event":"php_site_event","component_version":"component_version","php_admin_event":"php_admin_event","crowdin_username":"crowdin_username","php_preflight_install":"php_preflight_install","remove_line_breaks":"remove_line_breaks","description":"description","php_method_uninstall":"php_method_uninstall","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","css_admin":"css_admin","addreadme":"addreadme","php_postflight_install":"php_postflight_install","add_placeholders":"add_placeholders","sql":"sql","author":"author","update_server_url":"update_server_url","email":"email","add_backup_folder_path":"add_backup_folder_path","website":"website","translation_tool":"translation_tool","add_license":"add_license","buildcompsql":"buildcompsql","license_type":"license_type","php_helper_admin":"php_helper_admin","php_helper_site":"php_helper_site","whmcs_key":"whmcs_key","javascript":"javascript","whmcs_url":"whmcs_url","css_site":"css_site","whmcs_buy_link":"whmcs_buy_link","license":"license","php_preflight_update":"php_preflight_update","bom":"bom","php_postflight_update":"php_postflight_update","image":"image","php_method_install":"php_method_install","copyright":"copyright","sql_uninstall":"sql_uninstall","preferred_joomla_version":"preferred_joomla_version","add_powers":"add_powers","add_sales_server":"add_sales_server","backup_folder_path":"backup_folder_path","add_jcb_powers_path":"add_jcb_powers_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_php_method_install":"add_php_method_install","joomla_source_link":"joomla_source_link","add_sql":"add_sql","export_buy_link":"export_buy_link","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","emptycontributors":"emptycontributors","update_server_target":"update_server_target","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","jcb_powers_path":"jcb_powers_path","creatuserhelper":"creatuserhelper","adduikit":"adduikit","crowdin_project_api_key":"crowdin_project_api_key","addfootable":"addfootable","crowdin_account_api_key":"crowdin_account_api_key","add_email_helper":"add_email_helper","buildcomp":"buildcomp","add_php_helper_both":"add_php_helper_both","guid":"guid","php_helper_both":"php_helper_both","name":"name"}}',
|
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_postflight_update","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","crowdin_project_identifier":"crowdin_project_identifier","backup_folder_path":"backup_folder_path","sql_uninstall":"sql_uninstall","php_postflight_update":"php_postflight_update","css_site":"css_site","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","php_helper_site":"php_helper_site","javascript":"javascript","description":"description","debug_linenr":"debug_linenr","author":"author","php_method_install":"php_method_install","email":"email","website":"website","add_sales_server":"add_sales_server","license":"license","add_jcb_powers_path":"add_jcb_powers_path","bom":"bom","image":"image","php_admin_event":"php_admin_event","copyright":"copyright","php_site_event":"php_site_event","css_admin":"css_admin","php_preflight_update":"php_preflight_update","component_version":"component_version","php_preflight_install":"php_preflight_install","preferred_joomla_version":"preferred_joomla_version","php_postflight_install":"php_postflight_install","add_powers":"add_powers","php_method_uninstall":"php_method_uninstall","sql":"sql","addreadme":"addreadme","update_server_url":"update_server_url","add_backup_folder_path":"add_backup_folder_path","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","add_namespace_prefix":"add_namespace_prefix","namespace_prefix":"namespace_prefix","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_menu_prefix":"add_menu_prefix","add_javascript":"add_javascript","menu_prefix":"menu_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","dashboard_type":"dashboard_type","toignore":"toignore","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","export_key":"export_key","add_php_postflight_install":"add_php_postflight_install","joomla_source_link":"joomla_source_link","add_php_postflight_update":"add_php_postflight_update","export_buy_link":"export_buy_link","add_php_method_uninstall":"add_php_method_uninstall","add_php_method_install":"add_php_method_install","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","emptycontributors":"emptycontributors","assets_table_fix":"assets_table_fix","number":"number","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","creatuserhelper":"creatuserhelper","add_git_folder_path":"add_git_folder_path","adduikit":"adduikit","git_folder_path":"git_folder_path","addfootable":"addfootable","jcb_powers_path":"jcb_powers_path","add_email_helper":"add_email_helper","add_php_helper_both":"add_php_helper_both","crowdin_project_api_key":"crowdin_project_api_key","php_helper_both":"php_helper_both","crowdin_account_api_key":"crowdin_account_api_key","add_php_helper_admin":"add_php_helper_admin","buildcomp":"buildcomp","php_helper_admin":"php_helper_admin","guid":"guid","add_admin_event":"add_admin_event","name":"name"}}',
|
||||||
// router
|
// router
|
||||||
'',
|
'',
|
||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
'{"formFile": "administrator/components/com_componentbuilder/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","remove_line_breaks","debug_linenr","mvc_versiondate","addreadme","add_placeholders","add_backup_folder_path","translation_tool","add_license","license_type","preferred_joomla_version","add_powers","add_sales_server","add_jcb_powers_path","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_method_install","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","emptycontributors","update_server_target","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","addfootable","add_email_helper","buildcomp","add_php_helper_both"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'
|
'{"formFile": "administrator/components/com_componentbuilder/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_sales_server","add_jcb_powers_path","preferred_joomla_version","add_powers","addreadme","add_backup_folder_path","translation_tool","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_php_method_install","add_sql","add_sql_uninstall","emptycontributors","assets_table_fix","number","add_update_server","update_server_target","update_server","sales_server","creatuserhelper","add_git_folder_path","adduikit","addfootable","add_email_helper","add_php_helper_both","add_php_helper_admin","buildcomp","add_admin_event"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
);
|
);
|
||||||
// Update Joomla module Content Types.
|
// Update Joomla module Content Types.
|
||||||
$this->setContentType(
|
$this->setContentType(
|
||||||
@ -2633,7 +2672,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// rules
|
// rules
|
||||||
'',
|
'',
|
||||||
// fieldMappings
|
// fieldMappings
|
||||||
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "css_views","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","store":"store","on_save_model_field":"on_save_model_field","initiator_on_get_model":"initiator_on_get_model","initiator_on_save_model":"initiator_on_save_model","xml":"xml","datalenght":"datalenght","css_views":"css_views","css_view":"css_view","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","on_get_model_field":"on_get_model_field","javascript_view_footer":"javascript_view_footer","javascript_views_footer":"javascript_views_footer","add_css_view":"add_css_view","add_css_views":"add_css_views","add_javascript_view_footer":"add_javascript_view_footer","add_javascript_views_footer":"add_javascript_views_footer","guid":"guid"}}',
|
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "javascript_view_footer","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","store":"store","on_get_model_field":"on_get_model_field","on_save_model_field":"on_save_model_field","initiator_on_get_model":"initiator_on_get_model","xml":"xml","datalenght":"datalenght","javascript_view_footer":"javascript_view_footer","css_views":"css_views","css_view":"css_view","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","javascript_views_footer":"javascript_views_footer","add_css_view":"add_css_view","add_css_views":"add_css_views","add_javascript_view_footer":"add_javascript_view_footer","add_javascript_views_footer":"add_javascript_views_footer","initiator_on_save_model":"initiator_on_save_model","guid":"guid"}}',
|
||||||
// router
|
// router
|
||||||
'',
|
'',
|
||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
@ -2741,6 +2780,23 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
// contentHistoryOptions
|
// contentHistoryOptions
|
||||||
'{"formFile": "administrator/components/com_componentbuilder/forms/server.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","protocol","authentication"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
'{"formFile": "administrator/components/com_componentbuilder/forms/server.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","protocol","authentication"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
);
|
);
|
||||||
|
// Update Repository Content Types.
|
||||||
|
$this->setContentType(
|
||||||
|
// typeTitle
|
||||||
|
'Componentbuilder Repository',
|
||||||
|
// typeAlias
|
||||||
|
'com_componentbuilder.repository',
|
||||||
|
// table
|
||||||
|
'{"special": {"dbtable": "#__componentbuilder_repository","key": "id","type": "RepositoryTable","prefix": "VDM\Component\Componentbuilder\Administrator\Table"}}',
|
||||||
|
// rules
|
||||||
|
'',
|
||||||
|
// fieldMappings
|
||||||
|
'{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","organisation":"organisation","repository":"repository","target":"target","type":"type","base":"base","guid":"guid","access_repo":"access_repo","write_branch":"write_branch","read_branch":"read_branch","token":"token","username":"username"}}',
|
||||||
|
// router
|
||||||
|
'',
|
||||||
|
// contentHistoryOptions
|
||||||
|
'{"formFile": "administrator/components/com_componentbuilder/forms/repository.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","target","type","access_repo"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'
|
||||||
|
);
|
||||||
// Update Help document Content Types.
|
// Update Help document Content Types.
|
||||||
$this->setContentType(
|
$this->setContentType(
|
||||||
// typeTitle
|
// typeTitle
|
||||||
@ -3210,7 +3266,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
|
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
|
||||||
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
|
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
|
||||||
</a>
|
</a>
|
||||||
<h3>Upgrade to Version 5.0.1-alpha4 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
<h3>Upgrade to Version 5.0.1-alpha5 Was Successful! Let us know if anything is not working as expected.</h3></div>';
|
||||||
|
|
||||||
// Add/Update component in the action logs extensions table.
|
// Add/Update component in the action logs extensions table.
|
||||||
$this->setActionLogsExtensions();
|
$this->setActionLogsExtensions();
|
||||||
@ -3583,6 +3639,22 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
|
|||||||
'COM_COMPONENTBUILDER'
|
'COM_COMPONENTBUILDER'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add/Update Repository in the action logs config table.
|
||||||
|
$this->setActionLogConfig(
|
||||||
|
// typeTitle
|
||||||
|
'REPOSITORY',
|
||||||
|
// typeAlias
|
||||||
|
'com_componentbuilder.repository',
|
||||||
|
// idHolder
|
||||||
|
'id',
|
||||||
|
// titleHolder
|
||||||
|
'system_name',
|
||||||
|
// tableName
|
||||||
|
'#__componentbuilder_repository',
|
||||||
|
// textPrefix
|
||||||
|
'COM_COMPONENTBUILDER'
|
||||||
|
);
|
||||||
|
|
||||||
// Add/Update Help_document in the action logs config table.
|
// Add/Update Help_document in the action logs config table.
|
||||||
$this->setActionLogConfig(
|
$this->setActionLogConfig(
|
||||||
// typeTitle
|
// typeTitle
|
||||||
|
14
README.md
14
README.md
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
|||||||
|
|
||||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||||
|
|
||||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.1-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
|
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.1-alpha5) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||||
|
|
||||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
> 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)
|
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 7th June, 2024
|
+ *Last Build*: 21st June, 2024
|
||||||
+ *Version*: 5.0.1-alpha4
|
+ *Version*: 5.0.1-alpha5
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **750452**
|
+ *Line count*: **758868**
|
||||||
+ *Field count*: **2106**
|
+ *Field count*: **2110**
|
||||||
+ *File count*: **5319**
|
+ *File count*: **5376**
|
||||||
+ *Folder count*: **540**
|
+ *Folder count*: **544**
|
||||||
|
|
||||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
> 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)
|
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||||
|
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
|||||||
|
|
||||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||||
|
|
||||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.1-alpha4) with **ALL** its features and **ALL** concepts totally open-source and free!
|
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.1-alpha5) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||||
|
|
||||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
> 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)
|
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 7th June, 2024
|
+ *Last Build*: 21st June, 2024
|
||||||
+ *Version*: 5.0.1-alpha4
|
+ *Version*: 5.0.1-alpha5
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **750452**
|
+ *Line count*: **758868**
|
||||||
+ *Field count*: **2106**
|
+ *Field count*: **2110**
|
||||||
+ *File count*: **5319**
|
+ *File count*: **5376**
|
||||||
+ *Folder count*: **540**
|
+ *Folder count*: **544**
|
||||||
|
|
||||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
> 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)
|
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||||
|
@ -483,6 +483,18 @@
|
|||||||
<action name="power.edit.state" title="COM_COMPONENTBUILDER_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC" />
|
<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.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="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.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.compiler" title="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC" />
|
||||||
<action name="search.dashboard_list" title="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC" />
|
<action name="search.dashboard_list" title="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC" />
|
||||||
@ -766,6 +778,17 @@
|
|||||||
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
|
<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" />
|
<action name="server.version" title="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC" />
|
||||||
</section>
|
</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">
|
<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" 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" />
|
<action name="help_document.edit.own" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC" />
|
||||||
|
13
admin/assets/css/repositories.css
Normal file
13
admin/assets/css/repositories.css
Normal 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 */
|
||||||
|
|
||||||
|
|
13
admin/assets/css/repository.css
Normal file
13
admin/assets/css/repository.css
Normal 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 */
|
||||||
|
|
||||||
|
|
BIN
admin/assets/images/icons/repositories.png
Normal file
BIN
admin/assets/images/icons/repositories.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
139
admin/config.xml
139
admin/config.xml
@ -756,62 +756,7 @@
|
|||||||
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
||||||
</field>
|
</field>
|
||||||
<!-- Note_super_powers_repositories Field. Type: Note. A None Database Field. (joomla) -->
|
<!-- 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" />
|
<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" />
|
||||||
<!-- 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>
|
|
||||||
<!-- Note_powers_repository_path Field. Type: Note. A None Database Field. (joomla) -->
|
<!-- 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" />
|
<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) -->
|
<!-- Local_powers_repository_path Field. Type: Text. (joomla) -->
|
||||||
@ -832,88 +777,6 @@
|
|||||||
autocomplete="on"
|
autocomplete="on"
|
||||||
showon="powers_repository:1"
|
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>
|
||||||
<fieldset
|
<fieldset
|
||||||
name="compiler_custom_config"
|
name="compiler_custom_config"
|
||||||
|
@ -229,8 +229,6 @@
|
|||||||
COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY</option>
|
COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY</option>
|
||||||
<option value="5">
|
<option value="5">
|
||||||
COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY</option>
|
COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY</option>
|
||||||
<option value="4">
|
|
||||||
COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION</option>
|
|
||||||
<option value="6">
|
<option value="6">
|
||||||
COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM</option>
|
COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM</option>
|
||||||
</field>
|
</field>
|
||||||
@ -243,6 +241,21 @@
|
|||||||
description="COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION"
|
description="COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION"
|
||||||
class="inputbox"
|
class="inputbox"
|
||||||
/>
|
/>
|
||||||
|
<!-- Note_no_database_settings_needed Field. Type: Note. A None Database Field. (joomla) -->
|
||||||
|
<field type="note" name="note_no_database_settings_needed" label="COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_DESCRIPTION" heading="h4" class="alert alert-info note_no_database_settings_needed" />
|
||||||
|
<!-- On_get_model_field Field. Type: Textarea. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="textarea"
|
||||||
|
name="on_get_model_field"
|
||||||
|
label="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_LABEL"
|
||||||
|
rows="5"
|
||||||
|
cols="10"
|
||||||
|
description="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_DESCRIPTION"
|
||||||
|
class="text_area span12"
|
||||||
|
filter="raw"
|
||||||
|
hint="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_HINT"
|
||||||
|
required="true"
|
||||||
|
/>
|
||||||
<!-- On_save_model_field Field. Type: Textarea. (joomla) -->
|
<!-- On_save_model_field Field. Type: Textarea. (joomla) -->
|
||||||
<field
|
<field
|
||||||
type="textarea"
|
type="textarea"
|
||||||
@ -269,19 +282,6 @@
|
|||||||
hint="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_HINT"
|
hint="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_HINT"
|
||||||
required="false"
|
required="false"
|
||||||
/>
|
/>
|
||||||
<!-- Initiator_on_save_model Field. Type: Textarea. (joomla) -->
|
|
||||||
<field
|
|
||||||
type="textarea"
|
|
||||||
name="initiator_on_save_model"
|
|
||||||
label="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL"
|
|
||||||
rows="5"
|
|
||||||
cols="10"
|
|
||||||
description="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_DESCRIPTION"
|
|
||||||
class="text_area span12"
|
|
||||||
filter="raw"
|
|
||||||
hint="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_HINT"
|
|
||||||
required="false"
|
|
||||||
/>
|
|
||||||
<!-- Note_filter_information Field. Type: Note. A None Database Field. (joomla) -->
|
<!-- Note_filter_information Field. Type: Note. A None Database Field. (joomla) -->
|
||||||
<field type="note" name="note_filter_information" description="COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION" class="note_filter_information" />
|
<field type="note" name="note_filter_information" description="COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION" class="note_filter_information" />
|
||||||
<!-- Xml Field. Type: Hidden. (joomla) -->
|
<!-- Xml Field. Type: Hidden. (joomla) -->
|
||||||
@ -327,8 +327,22 @@
|
|||||||
<option value="Other">
|
<option value="Other">
|
||||||
COM_COMPONENTBUILDER_FIELD_OTHER</option>
|
COM_COMPONENTBUILDER_FIELD_OTHER</option>
|
||||||
</field>
|
</field>
|
||||||
<!-- Note_database_settings_needed Field. Type: Note. A None Database Field. (joomla) -->
|
<!-- Javascript_view_footer Field. Type: Editor. (joomla) -->
|
||||||
<field type="note" name="note_database_settings_needed" label="COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_DESCRIPTION" heading="h4" class="alert alert-info note_database_settings_needed" />
|
<field
|
||||||
|
type="editor"
|
||||||
|
name="javascript_view_footer"
|
||||||
|
label="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION"
|
||||||
|
width="100%"
|
||||||
|
height="450px"
|
||||||
|
cols="15"
|
||||||
|
rows="30"
|
||||||
|
buttons="no"
|
||||||
|
syntax="javascript"
|
||||||
|
editor="codemirror|none"
|
||||||
|
filter="raw"
|
||||||
|
validate="code"
|
||||||
|
/>
|
||||||
<!-- Css_views Field. Type: Editor. (joomla) -->
|
<!-- Css_views Field. Type: Editor. (joomla) -->
|
||||||
<field
|
<field
|
||||||
type="editor"
|
type="editor"
|
||||||
@ -414,37 +428,8 @@
|
|||||||
message="COM_COMPONENTBUILDER_FIELD_DATALENGHT_OTHER_MESSAGE"
|
message="COM_COMPONENTBUILDER_FIELD_DATALENGHT_OTHER_MESSAGE"
|
||||||
hint="COM_COMPONENTBUILDER_FIELD_DATALENGHT_OTHER_HINT"
|
hint="COM_COMPONENTBUILDER_FIELD_DATALENGHT_OTHER_HINT"
|
||||||
/>
|
/>
|
||||||
<!-- On_get_model_field Field. Type: Textarea. (joomla) -->
|
<!-- Note_database_settings_needed Field. Type: Note. A None Database Field. (joomla) -->
|
||||||
<field
|
<field type="note" name="note_database_settings_needed" label="COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_DESCRIPTION" heading="h4" class="alert alert-info note_database_settings_needed" />
|
||||||
type="textarea"
|
|
||||||
name="on_get_model_field"
|
|
||||||
label="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_LABEL"
|
|
||||||
rows="5"
|
|
||||||
cols="10"
|
|
||||||
description="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_DESCRIPTION"
|
|
||||||
class="text_area span12"
|
|
||||||
filter="raw"
|
|
||||||
hint="COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_HINT"
|
|
||||||
required="true"
|
|
||||||
/>
|
|
||||||
<!-- Javascript_view_footer Field. Type: Editor. (joomla) -->
|
|
||||||
<field
|
|
||||||
type="editor"
|
|
||||||
name="javascript_view_footer"
|
|
||||||
label="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL"
|
|
||||||
description="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION"
|
|
||||||
width="100%"
|
|
||||||
height="450px"
|
|
||||||
cols="15"
|
|
||||||
rows="30"
|
|
||||||
buttons="no"
|
|
||||||
syntax="javascript"
|
|
||||||
editor="codemirror|none"
|
|
||||||
filter="raw"
|
|
||||||
validate="code"
|
|
||||||
/>
|
|
||||||
<!-- Note_no_database_settings_needed Field. Type: Note. A None Database Field. (joomla) -->
|
|
||||||
<field type="note" name="note_no_database_settings_needed" label="COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_DESCRIPTION" heading="h4" class="alert alert-info note_no_database_settings_needed" />
|
|
||||||
<!-- Javascript_views_footer Field. Type: Editor. (joomla) -->
|
<!-- Javascript_views_footer Field. Type: Editor. (joomla) -->
|
||||||
<field
|
<field
|
||||||
type="editor"
|
type="editor"
|
||||||
@ -527,12 +512,23 @@
|
|||||||
<option value="0">
|
<option value="0">
|
||||||
COM_COMPONENTBUILDER_FIELD_NO</option>
|
COM_COMPONENTBUILDER_FIELD_NO</option>
|
||||||
</field>
|
</field>
|
||||||
<!-- Note_whmcs_encryption Field. Type: Note. A None Database Field. (joomla) -->
|
|
||||||
<field type="note" name="note_whmcs_encryption" label="COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_DESCRIPTION" heading="h4" class="alert alert-success note_whmcs_encryption" />
|
|
||||||
<!-- Helpnote Field. Type: Note. A None Database Field. (joomla) -->
|
|
||||||
<field type="note" name="helpnote" label="COM_COMPONENTBUILDER_FIELD_HELPNOTE_LABEL" class="helpNote helpnote" />
|
|
||||||
<!-- Note_expert_field_save_mode Field. Type: Note. A None Database Field. (joomla) -->
|
<!-- Note_expert_field_save_mode Field. Type: Note. A None Database Field. (joomla) -->
|
||||||
<field type="note" name="note_expert_field_save_mode" label="COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_DESCRIPTION" heading="h4" class="alert alert-success note_expert_encryption note_expert_field_save_mode" />
|
<field type="note" name="note_expert_field_save_mode" label="COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_LABEL" description="COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_DESCRIPTION" heading="h4" class="alert alert-success note_expert_encryption note_expert_field_save_mode" />
|
||||||
|
<!-- Helpnote Field. Type: Note. A None Database Field. (joomla) -->
|
||||||
|
<field type="note" name="helpnote" label="COM_COMPONENTBUILDER_FIELD_HELPNOTE_LABEL" class="helpNote helpnote" />
|
||||||
|
<!-- Initiator_on_save_model Field. Type: Textarea. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="textarea"
|
||||||
|
name="initiator_on_save_model"
|
||||||
|
label="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL"
|
||||||
|
rows="5"
|
||||||
|
cols="10"
|
||||||
|
description="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_DESCRIPTION"
|
||||||
|
class="text_area span12"
|
||||||
|
filter="raw"
|
||||||
|
hint="COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_HINT"
|
||||||
|
required="false"
|
||||||
|
/>
|
||||||
<!-- Guid Field. Type: Text. (joomla) -->
|
<!-- Guid Field. Type: Text. (joomla) -->
|
||||||
<field
|
<field
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -135,8 +135,6 @@
|
|||||||
COM_COMPONENTBUILDER_FIELDTYPE_BASIC_ENCRYPTION_LOCALDBKEY</option>
|
COM_COMPONENTBUILDER_FIELDTYPE_BASIC_ENCRYPTION_LOCALDBKEY</option>
|
||||||
<option value="5">
|
<option value="5">
|
||||||
COM_COMPONENTBUILDER_FIELDTYPE_MEDIUM_ENCRYPTION_LOCALFILEKEY</option>
|
COM_COMPONENTBUILDER_FIELDTYPE_MEDIUM_ENCRYPTION_LOCALFILEKEY</option>
|
||||||
<option value="4">
|
|
||||||
COM_COMPONENTBUILDER_FIELDTYPE_WHMCSKEY_ENCRYPTION</option>
|
|
||||||
<option value="6">
|
<option value="6">
|
||||||
COM_COMPONENTBUILDER_FIELDTYPE_EXPERT_MODE_CUSTOM</option>
|
COM_COMPONENTBUILDER_FIELDTYPE_EXPERT_MODE_CUSTOM</option>
|
||||||
</field>
|
</field>
|
||||||
|
100
admin/forms/filter_repositories.xml
Normal file
100
admin/forms/filter_repositories.xml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form
|
||||||
|
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||||
|
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"
|
||||||
|
>
|
||||||
|
<fields name="filter">
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="search"
|
||||||
|
inputmode="search"
|
||||||
|
label="COM_COMPONENTBUILDER_FILTER_SEARCH"
|
||||||
|
description="COM_COMPONENTBUILDER_FILTER_SEARCH_REPOSITORIES"
|
||||||
|
hint="JSEARCH_FILTER"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
type="status"
|
||||||
|
name="published"
|
||||||
|
label="COM_COMPONENTBUILDER_FILTER_PUBLISHED"
|
||||||
|
description="COM_COMPONENTBUILDER_FILTER_PUBLISHED_REPOSITORIES"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
>
|
||||||
|
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
type="accesslevel"
|
||||||
|
name="access"
|
||||||
|
label="JGRID_HEADING_ACCESS"
|
||||||
|
hint="JOPTION_SELECT_ACCESS"
|
||||||
|
multiple="true"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
layout="joomla.form.field.list-fancy-select"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
type="repositoriesfilterorganisation"
|
||||||
|
name="organisation"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_LABEL"
|
||||||
|
multiple="false"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
type="repositoriesfilterrepository"
|
||||||
|
name="repository"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_REPOSITORY_LABEL"
|
||||||
|
multiple="false"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
type="repositoriesfiltertarget"
|
||||||
|
name="target"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL"
|
||||||
|
multiple="false"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
type="repositoriesfilterbase"
|
||||||
|
name="base"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_BASE_LABEL"
|
||||||
|
multiple="false"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
/>
|
||||||
|
<input type="hidden" name="form_submited" value="1"/>
|
||||||
|
</fields>
|
||||||
|
|
||||||
|
<fields name="list">
|
||||||
|
<field
|
||||||
|
name="fullordering"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SORT_BY"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
default="a.id DESC"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="">JGLOBAL_SORT_BY</option>
|
||||||
|
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||||
|
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||||
|
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||||
|
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||||
|
<option value="a.organisation ASC">COM_COMPONENTBUILDER_FILTER_ORGANISATION_ASCENDING</option>
|
||||||
|
<option value="a.organisation DESC">COM_COMPONENTBUILDER_FILTER_ORGANISATION_DESCENDING</option>
|
||||||
|
<option value="a.repository ASC">COM_COMPONENTBUILDER_FILTER_REPOSITORY_ASCENDING</option>
|
||||||
|
<option value="a.repository DESC">COM_COMPONENTBUILDER_FILTER_REPOSITORY_DESCENDING</option>
|
||||||
|
<option value="a.target ASC">COM_COMPONENTBUILDER_FILTER_TARGET_CONTENT_ASCENDING</option>
|
||||||
|
<option value="a.target DESC">COM_COMPONENTBUILDER_FILTER_TARGET_CONTENT_DESCENDING</option>
|
||||||
|
<option value="a.type ASC">COM_COMPONENTBUILDER_FILTER_TYPE_ASCENDING</option>
|
||||||
|
<option value="a.type DESC">COM_COMPONENTBUILDER_FILTER_TYPE_DESCENDING</option>
|
||||||
|
<option value="a.base ASC">COM_COMPONENTBUILDER_FILTER_BASE_URL_ASCENDING</option>
|
||||||
|
<option value="a.base DESC">COM_COMPONENTBUILDER_FILTER_BASE_URL_DESCENDING</option>
|
||||||
|
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||||
|
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="limit"
|
||||||
|
type="limitbox"
|
||||||
|
label="JGLOBAL_LIST_LIMIT"
|
||||||
|
default="25"
|
||||||
|
class="js-select-submit-on-change"
|
||||||
|
/>
|
||||||
|
</fields>
|
||||||
|
</form>
|
File diff suppressed because it is too large
Load Diff
305
admin/forms/repository.xml
Normal file
305
admin/forms/repository.xml
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form
|
||||||
|
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||||
|
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"
|
||||||
|
>
|
||||||
|
<config>
|
||||||
|
<inlinehelp button="show"/>
|
||||||
|
</config>
|
||||||
|
<fieldset name="details">
|
||||||
|
<!-- Default Fields. -->
|
||||||
|
<!-- Id Field. Type: Text (joomla) -->
|
||||||
|
<field
|
||||||
|
name="id"
|
||||||
|
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
|
||||||
|
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
|
||||||
|
readonly="true"
|
||||||
|
/>
|
||||||
|
<!-- Date Created Field. Type: Calendar (joomla) -->
|
||||||
|
<field
|
||||||
|
name="created"
|
||||||
|
type="calendar"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_CREATED_DATE_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_CREATED_DATE_DESC"
|
||||||
|
size="22"
|
||||||
|
format="%Y-%m-%d %H:%M:%S"
|
||||||
|
filter="user_utc"
|
||||||
|
/>
|
||||||
|
<!-- User Created Field. Type: User (joomla) -->
|
||||||
|
<field
|
||||||
|
name="created_by"
|
||||||
|
type="user"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_CREATED_BY_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_CREATED_BY_DESC"
|
||||||
|
/>
|
||||||
|
<!-- Published Field. Type: List (joomla) -->
|
||||||
|
<field name="published" type="list" label="JSTATUS"
|
||||||
|
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
|
||||||
|
filter="intval" size="1" default="1" >
|
||||||
|
<option value="1">
|
||||||
|
JPUBLISHED</option>
|
||||||
|
<option value="0">
|
||||||
|
JUNPUBLISHED</option>
|
||||||
|
<option value="2">
|
||||||
|
JARCHIVED</option>
|
||||||
|
<option value="-2">
|
||||||
|
JTRASHED</option>
|
||||||
|
</field>
|
||||||
|
<!-- Date Modified Field. Type: Calendar (joomla) -->
|
||||||
|
<field name="modified" type="calendar" class="readonly"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_DATE_DESC"
|
||||||
|
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||||
|
<!-- User Modified Field. Type: User (joomla) -->
|
||||||
|
<field name="modified_by" type="user"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_BY_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_BY_DESC"
|
||||||
|
class="readonly"
|
||||||
|
readonly="true"
|
||||||
|
filter="unset"
|
||||||
|
/>
|
||||||
|
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||||
|
<field name="access"
|
||||||
|
type="accesslevel"
|
||||||
|
label="JFIELD_ACCESS_LABEL"
|
||||||
|
description="JFIELD_ACCESS_DESC"
|
||||||
|
default="1"
|
||||||
|
required="false"
|
||||||
|
/>
|
||||||
|
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||||
|
<field
|
||||||
|
name="ordering"
|
||||||
|
type="number"
|
||||||
|
class="inputbox validate-ordering"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_ORDERING_LABEL"
|
||||||
|
description=""
|
||||||
|
default="0"
|
||||||
|
size="6"
|
||||||
|
required="false"
|
||||||
|
/>
|
||||||
|
<!-- Version Field. Type: Text (joomla) -->
|
||||||
|
<field
|
||||||
|
name="version"
|
||||||
|
type="text"
|
||||||
|
class="readonly"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_VERSION_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_VERSION_DESC"
|
||||||
|
size="6"
|
||||||
|
default="1"
|
||||||
|
readonly="true"
|
||||||
|
filter="unset"
|
||||||
|
/>
|
||||||
|
<!-- Was added due to Permissions JS needing a Title field -->
|
||||||
|
<!-- Let us know at gh-629 should this change -->
|
||||||
|
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||||
|
<field
|
||||||
|
name="title"
|
||||||
|
type="hidden"
|
||||||
|
default="componentbuilder repository"
|
||||||
|
/>
|
||||||
|
<!-- Dynamic Fields. -->
|
||||||
|
<!-- System_name Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="system_name"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_LABEL"
|
||||||
|
size="10"
|
||||||
|
maxlength="50"
|
||||||
|
default=""
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
filter="STRING"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_HINT"
|
||||||
|
/>
|
||||||
|
<!-- Organisation Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="organisation"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_LABEL"
|
||||||
|
size="60"
|
||||||
|
maxlength="150"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
required="true"
|
||||||
|
filter="STRING"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_HINT"
|
||||||
|
/>
|
||||||
|
<!-- Repository Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="repository"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_REPOSITORY_LABEL"
|
||||||
|
size="70"
|
||||||
|
maxlength="150"
|
||||||
|
class="text_area"
|
||||||
|
readonly="false"
|
||||||
|
required="true"
|
||||||
|
filter="CMD"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_REPOSITORY_HINT"
|
||||||
|
autocomplete="on"
|
||||||
|
/>
|
||||||
|
<!-- Target Field. Type: List. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="list"
|
||||||
|
name="target"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_TARGET_DESCRIPTION"
|
||||||
|
class="list_class"
|
||||||
|
layout="joomla.form.field.list-fancy-select"
|
||||||
|
multiple="false"
|
||||||
|
filter="INT"
|
||||||
|
required="true"
|
||||||
|
validate="int">
|
||||||
|
<!-- Option Set. -->
|
||||||
|
<option value="">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION</option>
|
||||||
|
<option value="1">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER</option>
|
||||||
|
<option value="2">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER</option>
|
||||||
|
</field>
|
||||||
|
<!-- Type Field. Type: List. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="list"
|
||||||
|
name="type"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_TYPE_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_TYPE_DESCRIPTION"
|
||||||
|
class="list_class"
|
||||||
|
layout="joomla.form.field.list-fancy-select"
|
||||||
|
multiple="false"
|
||||||
|
filter="INT"
|
||||||
|
required="true"
|
||||||
|
validate="int">
|
||||||
|
<!-- Option Set. -->
|
||||||
|
<option value="">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION</option>
|
||||||
|
<option value="1">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_GITEA</option>
|
||||||
|
</field>
|
||||||
|
<!-- Base Field. Type: Url. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="url"
|
||||||
|
name="base"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_BASE_LABEL"
|
||||||
|
size="70"
|
||||||
|
maxlength="150"
|
||||||
|
default="https://git.vdm.dev"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_BASE_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
required="true"
|
||||||
|
filter="url"
|
||||||
|
validated="url"
|
||||||
|
scheme="http,https"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_BASE_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_BASE_HINT"
|
||||||
|
autocomplete="on"
|
||||||
|
showon="type:1"
|
||||||
|
/>
|
||||||
|
<!-- Guid Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="guid"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_GUID_LABEL"
|
||||||
|
size="40"
|
||||||
|
maxlength="40"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_GUID_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
readonly="true"
|
||||||
|
filter="CMD"
|
||||||
|
validate="guid"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_GUID_HINT"
|
||||||
|
/>
|
||||||
|
<!-- Access_repo Field. Type: Radio. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="radio"
|
||||||
|
name="access_repo"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_LABEL"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_DESCRIPTION"
|
||||||
|
class="btn-group btn-group-yesno"
|
||||||
|
default="">
|
||||||
|
<!-- Option Set. -->
|
||||||
|
<option value="">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_GLOBAL</option>
|
||||||
|
<option value="1">
|
||||||
|
COM_COMPONENTBUILDER_REPOSITORY_OVERRIDE</option>
|
||||||
|
</field>
|
||||||
|
<!-- Write_branch Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="write_branch"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_WRITE_BRANCH_LABEL"
|
||||||
|
size="128"
|
||||||
|
maxlength="50"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_WRITE_BRANCH_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
filter="STRING"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_WRITE_BRANCH_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_WRITE_BRANCH_HINT"
|
||||||
|
/>
|
||||||
|
<!-- Read_branch Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="read_branch"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_LABEL"
|
||||||
|
size="128"
|
||||||
|
maxlength="50"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
filter="STRING"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_HINT"
|
||||||
|
/>
|
||||||
|
<!-- Token Field. Type: Password. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="password"
|
||||||
|
name="token"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_TOKEN_LABEL"
|
||||||
|
size="128"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_TOKEN_DESCRIPTION"
|
||||||
|
message="Error! Please add token here."
|
||||||
|
class="text_area"
|
||||||
|
filter="STRING"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_TOKEN_HINT"
|
||||||
|
autocomplete="off"
|
||||||
|
showon="type:1[AND]access_repo:1"
|
||||||
|
/>
|
||||||
|
<!-- Username Field. Type: Text. (joomla) -->
|
||||||
|
<field
|
||||||
|
type="text"
|
||||||
|
name="username"
|
||||||
|
label="COM_COMPONENTBUILDER_REPOSITORY_USERNAME_LABEL"
|
||||||
|
size="128"
|
||||||
|
maxlength="50"
|
||||||
|
description="COM_COMPONENTBUILDER_REPOSITORY_USERNAME_DESCRIPTION"
|
||||||
|
class="text_area"
|
||||||
|
filter="STRING"
|
||||||
|
message="COM_COMPONENTBUILDER_REPOSITORY_USERNAME_MESSAGE"
|
||||||
|
hint="COM_COMPONENTBUILDER_REPOSITORY_USERNAME_HINT"
|
||||||
|
autocomplete="on"
|
||||||
|
showon="type:1[AND]access_repo:1"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<!-- Access Control Fields. -->
|
||||||
|
<fieldset name="accesscontrol">
|
||||||
|
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||||
|
<field
|
||||||
|
name="asset_id"
|
||||||
|
type="hidden"
|
||||||
|
filter="unset"
|
||||||
|
/>
|
||||||
|
<!-- Rules Field. Type: Rules (joomla) -->
|
||||||
|
<field
|
||||||
|
name="rules"
|
||||||
|
type="rules"
|
||||||
|
label="Permissions in relation to this repository"
|
||||||
|
translate_label="false"
|
||||||
|
filter="rules"
|
||||||
|
validate="rules"
|
||||||
|
class="inputbox"
|
||||||
|
component="com_componentbuilder"
|
||||||
|
section="repository"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
File diff suppressed because one or more lines are too long
@ -936,6 +936,7 @@ COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts"
|
|||||||
COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
|
COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
|
||||||
COM_COMPONENTBUILDER_MENU_PLACEHOLDERS="Placeholders"
|
COM_COMPONENTBUILDER_MENU_PLACEHOLDERS="Placeholders"
|
||||||
COM_COMPONENTBUILDER_MENU_POWERS="Powers"
|
COM_COMPONENTBUILDER_MENU_POWERS="Powers"
|
||||||
|
COM_COMPONENTBUILDER_MENU_REPOSITORIES="Repositories"
|
||||||
COM_COMPONENTBUILDER_MENU_SEARCH="Search"
|
COM_COMPONENTBUILDER_MENU_SEARCH="Search"
|
||||||
COM_COMPONENTBUILDER_MENU_SERVERS="Servers"
|
COM_COMPONENTBUILDER_MENU_SERVERS="Servers"
|
||||||
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
|
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
|
||||||
@ -992,6 +993,30 @@ 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_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="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_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="Search Access"
|
||||||
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
|
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
|
||||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
|
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
|
||||||
|
@ -31,7 +31,6 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
|
|||||||
'store',
|
'store',
|
||||||
'medium_encryption_note',
|
'medium_encryption_note',
|
||||||
'basic_encryption_note',
|
'basic_encryption_note',
|
||||||
'note_whmcs_encryption',
|
|
||||||
'note_expert_field_save_mode',
|
'note_expert_field_save_mode',
|
||||||
'initiator_on_save_model',
|
'initiator_on_save_model',
|
||||||
'initiator_on_get_model',
|
'initiator_on_get_model',
|
||||||
|
@ -30,12 +30,6 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
|
|||||||
'author',
|
'author',
|
||||||
'email',
|
'email',
|
||||||
'website',
|
'website',
|
||||||
'add_license',
|
|
||||||
'license_type',
|
|
||||||
'note_whmcs_lisencing_note',
|
|
||||||
'whmcs_key',
|
|
||||||
'whmcs_url',
|
|
||||||
'whmcs_buy_link',
|
|
||||||
'license',
|
'license',
|
||||||
'bom',
|
'bom',
|
||||||
'image',
|
'image',
|
||||||
|
54
admin/layouts/repository/details_above.php
Normal file
54
admin/layouts/repository/details_above.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
// 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) ?: [
|
||||||
|
'system_name',
|
||||||
|
'target',
|
||||||
|
'access_repo'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Ensure $fields is treated as an array and count its size.
|
||||||
|
$size = count((array) $fields);
|
||||||
|
|
||||||
|
// Use a ternary operator to determine the class.
|
||||||
|
// If there are 1 to 4 fields, set the class to divide the 12-grid column equally among the fields.
|
||||||
|
// For more than 4 fields, default to four columns (3-grid each) for medium and larger screens.
|
||||||
|
$css_class = ($size > 0 && $size <= 4) ? 'col-12 col-md-' . round(12 / $size) : 'col-12 col-md-3';
|
||||||
|
|
||||||
|
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ($fields && count((array) $fields)) :?>
|
||||||
|
<div class="row title-alias form-vertical mb-3">
|
||||||
|
<?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, ['class' => $css_class . ' control-wrapper-' . $field]); ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
45
admin/layouts/repository/details_left.php
Normal file
45
admin/layouts/repository/details_left.php
Normal 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;
|
||||||
|
|
||||||
|
// 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; ?>
|
45
admin/layouts/repository/details_right.php
Normal file
45
admin/layouts/repository/details_right.php
Normal 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;
|
||||||
|
|
||||||
|
// 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; ?>
|
47
admin/layouts/repository/publishing.php
Normal file
47
admin/layouts/repository/publishing.php
Normal 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;
|
||||||
|
|
||||||
|
// 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; ?>
|
47
admin/layouts/repository/publlshing.php
Normal file
47
admin/layouts/repository/publlshing.php
Normal 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;
|
||||||
|
|
||||||
|
// 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; ?>
|
File diff suppressed because one or more lines are too long
@ -21,6 +21,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_fieldtype`;
|
|||||||
DROP TABLE IF EXISTS `#__componentbuilder_language_translation`;
|
DROP TABLE IF EXISTS `#__componentbuilder_language_translation`;
|
||||||
DROP TABLE IF EXISTS `#__componentbuilder_language`;
|
DROP TABLE IF EXISTS `#__componentbuilder_language`;
|
||||||
DROP TABLE IF EXISTS `#__componentbuilder_server`;
|
DROP TABLE IF EXISTS `#__componentbuilder_server`;
|
||||||
|
DROP TABLE IF EXISTS `#__componentbuilder_repository`;
|
||||||
DROP TABLE IF EXISTS `#__componentbuilder_help_document`;
|
DROP TABLE IF EXISTS `#__componentbuilder_help_document`;
|
||||||
DROP TABLE IF EXISTS `#__componentbuilder_admin_fields`;
|
DROP TABLE IF EXISTS `#__componentbuilder_admin_fields`;
|
||||||
DROP TABLE IF EXISTS `#__componentbuilder_admin_fields_conditions`;
|
DROP TABLE IF EXISTS `#__componentbuilder_admin_fields_conditions`;
|
||||||
|
54
admin/src/Controller/RepositoriesController.php
Normal file
54
admin/src/Controller/RepositoriesController.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\Controller\AdminController;
|
||||||
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositories Admin Controller
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesController extends AdminController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The prefix to use with controller messages.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $text_prefix = 'COM_COMPONENTBUILDER_REPOSITORIES';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
*
|
||||||
|
* @param string $name The model name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Repository', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||||
|
{
|
||||||
|
return parent::getModel($name, $prefix, $config);
|
||||||
|
}
|
||||||
|
}
|
343
admin/src/Controller/RepositoryController.php
Normal file
343
admin/src/Controller/RepositoryController.php
Normal file
@ -0,0 +1,343 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Form\FormFactoryInterface;
|
||||||
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
|
use Joomla\Input\Input;
|
||||||
|
use Joomla\CMS\Versioning\VersionableControllerTrait;
|
||||||
|
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;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository Form Controller
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoryController extends FormController
|
||||||
|
{
|
||||||
|
use VersionableControllerTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The prefix to use with controller messages.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $text_prefix = 'COM_COMPONENTBUILDER_REPOSITORY';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL view list variable.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $view_list = 'repositories';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = $this->app->getIdentity();
|
||||||
|
// 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 = $this->app->getIdentity();
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
74
admin/src/Field/RepositoriesfilterbaseField.php
Normal file
74
admin/src/Field/RepositoriesfilterbaseField.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Form\Field\ListField;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositoriesfilterbase Form Field class for the Componentbuilder component
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesfilterbaseField extends ListField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The repositoriesfilterbase field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'Repositoriesfilterbase';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a list of options for a list input.
|
||||||
|
*
|
||||||
|
* @return array An array of Html options.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
// Get a db connection.
|
||||||
|
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
||||||
|
|
||||||
|
// Create a new query object.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the text.
|
||||||
|
$query->select($db->quoteName('base'));
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
$query->order($db->quoteName('base') . ' ASC');
|
||||||
|
|
||||||
|
// Reset the query using our newly populated query object.
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$_results = $db->loadColumn();
|
||||||
|
$_filter = [];
|
||||||
|
$_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_BASE_URL') . ' -');
|
||||||
|
|
||||||
|
if ($_results)
|
||||||
|
{
|
||||||
|
$_results = array_unique($_results);
|
||||||
|
foreach ($_results as $base)
|
||||||
|
{
|
||||||
|
// Now add the base and its text to the options array
|
||||||
|
$_filter[] = Html::_('select.option', $base, $base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $_filter;
|
||||||
|
}
|
||||||
|
}
|
74
admin/src/Field/RepositoriesfilterorganisationField.php
Normal file
74
admin/src/Field/RepositoriesfilterorganisationField.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Form\Field\ListField;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositoriesfilterorganisation Form Field class for the Componentbuilder component
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesfilterorganisationField extends ListField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The repositoriesfilterorganisation field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'Repositoriesfilterorganisation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a list of options for a list input.
|
||||||
|
*
|
||||||
|
* @return array An array of Html options.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
// Get a db connection.
|
||||||
|
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
||||||
|
|
||||||
|
// Create a new query object.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the text.
|
||||||
|
$query->select($db->quoteName('organisation'));
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
$query->order($db->quoteName('organisation') . ' ASC');
|
||||||
|
|
||||||
|
// Reset the query using our newly populated query object.
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$_results = $db->loadColumn();
|
||||||
|
$_filter = [];
|
||||||
|
$_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ORGANISATION') . ' -');
|
||||||
|
|
||||||
|
if ($_results)
|
||||||
|
{
|
||||||
|
$_results = array_unique($_results);
|
||||||
|
foreach ($_results as $organisation)
|
||||||
|
{
|
||||||
|
// Now add the organisation and its text to the options array
|
||||||
|
$_filter[] = Html::_('select.option', $organisation, $organisation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $_filter;
|
||||||
|
}
|
||||||
|
}
|
74
admin/src/Field/RepositoriesfilterrepositoryField.php
Normal file
74
admin/src/Field/RepositoriesfilterrepositoryField.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Form\Field\ListField;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositoriesfilterrepository Form Field class for the Componentbuilder component
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesfilterrepositoryField extends ListField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The repositoriesfilterrepository field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'Repositoriesfilterrepository';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a list of options for a list input.
|
||||||
|
*
|
||||||
|
* @return array An array of Html options.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
// Get a db connection.
|
||||||
|
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
||||||
|
|
||||||
|
// Create a new query object.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the text.
|
||||||
|
$query->select($db->quoteName('repository'));
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
$query->order($db->quoteName('repository') . ' ASC');
|
||||||
|
|
||||||
|
// Reset the query using our newly populated query object.
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$_results = $db->loadColumn();
|
||||||
|
$_filter = [];
|
||||||
|
$_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_REPOSITORY') . ' -');
|
||||||
|
|
||||||
|
if ($_results)
|
||||||
|
{
|
||||||
|
$_results = array_unique($_results);
|
||||||
|
foreach ($_results as $repository)
|
||||||
|
{
|
||||||
|
// Now add the repository and its text to the options array
|
||||||
|
$_filter[] = Html::_('select.option', $repository, $repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $_filter;
|
||||||
|
}
|
||||||
|
}
|
78
admin/src/Field/RepositoriesfiltertargetField.php
Normal file
78
admin/src/Field/RepositoriesfiltertargetField.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Field;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Form\Field\ListField;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositoriesfiltertarget Form Field class for the Componentbuilder component
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesfiltertargetField extends ListField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The repositoriesfiltertarget field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'Repositoriesfiltertarget';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a list of options for a list input.
|
||||||
|
*
|
||||||
|
* @return array An array of Html options.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
// Get a db connection.
|
||||||
|
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
||||||
|
|
||||||
|
// Create a new query object.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the text.
|
||||||
|
$query->select($db->quoteName('target'));
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
$query->order($db->quoteName('target') . ' ASC');
|
||||||
|
|
||||||
|
// Reset the query using our newly populated query object.
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$_results = $db->loadColumn();
|
||||||
|
$_filter = [];
|
||||||
|
$_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_CONTENT') . ' -');
|
||||||
|
|
||||||
|
if ($_results)
|
||||||
|
{
|
||||||
|
// get repositoriesmodel
|
||||||
|
$_model = ComponentbuilderHelper::getModel('repositories');
|
||||||
|
$_results = array_unique($_results);
|
||||||
|
foreach ($_results as $target)
|
||||||
|
{
|
||||||
|
// Translate the target selection
|
||||||
|
$_text = $_model->selectionTranslation($target,'target');
|
||||||
|
// Now add the target and its text to the options array
|
||||||
|
$_filter[] = Html::_('select.option', $target, Text::_($_text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $_filter;
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,6 @@ use Joomla\CMS\HTML\HTMLHelper as Html;
|
|||||||
use Joomla\CMS\Component\ComponentHelper;
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use Joomla\CMS\Form\Field\CheckboxesField;
|
use Joomla\CMS\Form\Field\CheckboxesField;
|
||||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
use VDM\Joomla\Utilities\Component\Helper;
|
|
||||||
|
|
||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
\defined('_JEXEC') or die;
|
\defined('_JEXEC') or die;
|
||||||
@ -37,69 +36,41 @@ class SuperpowerpathsField extends CheckboxesField
|
|||||||
|
|
||||||
// A DynamicCheckboxes@ Field
|
// A DynamicCheckboxes@ Field
|
||||||
/**
|
/**
|
||||||
* Method to get the data to be passed to the layout for rendering.
|
* Method to get the field options.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array The field option objects.
|
||||||
*
|
*
|
||||||
* @since 3.5
|
* @since 3.7.0
|
||||||
*/
|
*/
|
||||||
protected function getLayoutData()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
$data = parent::getLayoutData();
|
// Get the databse object.
|
||||||
|
$db = Factory::getDBO();
|
||||||
// True if the field has 'value' set. In other words, it has been stored, don't use the default values.
|
$query = $db->getQuery(true);
|
||||||
$hasValue = (isset($this->value) && !empty($this->value));
|
$query->select($db->quoteName(array('a.repository', 'a.organisation')))
|
||||||
|
->from($db->quoteName('#__componentbuilder_repository', 'a'))
|
||||||
// If a value has been stored, use it. Otherwise, use the defaults.
|
->where($db->quoteName('a.published') . ' >= 1')
|
||||||
$checkedOptions = $hasValue ? $this->value : $this->checkedOptions;
|
->where($db->quoteName('a.target') . ' = 1') // super powers
|
||||||
|
->order($db->quoteName('a.ordering') . ' ASC');
|
||||||
// get the form options
|
$db->setQuery((string)$query);
|
||||||
|
$items = $db->loadObjectList();
|
||||||
$options = [];
|
$options = [];
|
||||||
|
if ($items)
|
||||||
// get the component params
|
|
||||||
$params = Helper::getParams();
|
|
||||||
$activate = $params->get('super_powers_repositories', 0);
|
|
||||||
|
|
||||||
// set the default
|
|
||||||
$default = $params->get('super_powers_core', 'joomla/super-powers');
|
|
||||||
|
|
||||||
// must have one / in the path
|
|
||||||
if (strpos($default, '/') !== false)
|
|
||||||
{
|
{
|
||||||
$tmp = new \stdClass;
|
if ($this->multiple === false)
|
||||||
$tmp->text = $tmp->value = trim($default);
|
|
||||||
$tmp->checked = false;
|
|
||||||
$options[$tmp->value] = $tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($activate == 1)
|
|
||||||
{
|
|
||||||
$subform = $params->get($this->fieldname);
|
|
||||||
|
|
||||||
// add the paths found in global settings
|
|
||||||
if (is_object($subform))
|
|
||||||
{
|
{
|
||||||
foreach ($subform as $value)
|
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
|
||||||
{
|
}
|
||||||
if (isset($value->owner) && strlen($value->owner) > 1 &&
|
foreach($items as $item)
|
||||||
isset($value->repo) && strlen($value->repo) > 1)
|
{
|
||||||
{
|
$path = $item->organisation . '/' . $item->repository;
|
||||||
$tmp = new \stdClass;
|
$options[] = Html::_('select.option', $path, $path);
|
||||||
$tmp->text = $tmp->value = trim($value->owner) . '/' . trim($value->repo);
|
|
||||||
$tmp->checked = false;
|
|
||||||
|
|
||||||
$options[$tmp->value] = $tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$extraData = array(
|
{
|
||||||
'checkedOptions' => is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions),
|
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_NO_ACTIVE_REPOSITORIES_FOUND'));
|
||||||
'hasValue' => $hasValue,
|
}
|
||||||
'options' => array_values($options)
|
return $options;
|
||||||
);
|
|
||||||
|
|
||||||
return array_merge($data, $extraData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6169,6 +6169,10 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_SERVERS'), 'index.php?option=com_componentbuilder&view=servers', $submenu === 'servers');
|
\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'))
|
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');
|
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents');
|
||||||
|
@ -67,7 +67,7 @@ class ComponentbuilderModel extends ListModel
|
|||||||
$icons = [];
|
$icons = [];
|
||||||
// view groups array
|
// view groups array
|
||||||
$viewGroups = array(
|
$viewGroups = array(
|
||||||
'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png.powers', 'png.search', 'png.admin_views', 'png.custom_admin_views', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.languages', 'png.servers', 'png.help_documents')
|
'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png.powers', 'png.search', 'png.admin_views', 'png.custom_admin_views', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.languages', 'png.servers', 'png.repositories', 'png.help_documents')
|
||||||
);
|
);
|
||||||
// view access array
|
// view access array
|
||||||
$viewAccess = [
|
$viewAccess = [
|
||||||
@ -184,6 +184,11 @@ class ComponentbuilderModel extends ListModel
|
|||||||
'server.access' => 'server.access',
|
'server.access' => 'server.access',
|
||||||
'servers.submenu' => 'server.submenu',
|
'servers.submenu' => 'server.submenu',
|
||||||
'servers.dashboard_list' => 'server.dashboard_list',
|
'servers.dashboard_list' => 'server.dashboard_list',
|
||||||
|
'repository.create' => 'repository.create',
|
||||||
|
'repositories.access' => 'repository.access',
|
||||||
|
'repository.access' => 'repository.access',
|
||||||
|
'repositories.submenu' => 'repository.submenu',
|
||||||
|
'repositories.dashboard_list' => 'repository.dashboard_list',
|
||||||
'help_document.create' => 'help_document.create',
|
'help_document.create' => 'help_document.create',
|
||||||
'help_documents.access' => 'help_document.access',
|
'help_documents.access' => 'help_document.access',
|
||||||
'help_document.access' => 'help_document.access',
|
'help_document.access' => 'help_document.access',
|
||||||
|
@ -84,7 +84,6 @@ class FieldModel extends AdminModel
|
|||||||
'store',
|
'store',
|
||||||
'medium_encryption_note',
|
'medium_encryption_note',
|
||||||
'basic_encryption_note',
|
'basic_encryption_note',
|
||||||
'note_whmcs_encryption',
|
|
||||||
'note_expert_field_save_mode',
|
'note_expert_field_save_mode',
|
||||||
'initiator_on_save_model',
|
'initiator_on_save_model',
|
||||||
'initiator_on_get_model',
|
'initiator_on_get_model',
|
||||||
@ -247,6 +246,12 @@ class FieldModel extends AdminModel
|
|||||||
$item->metadata = $registry->toArray();
|
$item->metadata = $registry->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($item->on_get_model_field))
|
||||||
|
{
|
||||||
|
// base64 Decode on_get_model_field.
|
||||||
|
$item->on_get_model_field = base64_decode($item->on_get_model_field);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($item->on_save_model_field))
|
if (!empty($item->on_save_model_field))
|
||||||
{
|
{
|
||||||
// base64 Decode on_save_model_field.
|
// base64 Decode on_save_model_field.
|
||||||
@ -259,10 +264,10 @@ class FieldModel extends AdminModel
|
|||||||
$item->initiator_on_get_model = base64_decode($item->initiator_on_get_model);
|
$item->initiator_on_get_model = base64_decode($item->initiator_on_get_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->initiator_on_save_model))
|
if (!empty($item->javascript_view_footer))
|
||||||
{
|
{
|
||||||
// base64 Decode initiator_on_save_model.
|
// base64 Decode javascript_view_footer.
|
||||||
$item->initiator_on_save_model = base64_decode($item->initiator_on_save_model);
|
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->css_views))
|
if (!empty($item->css_views))
|
||||||
@ -277,24 +282,18 @@ class FieldModel extends AdminModel
|
|||||||
$item->css_view = base64_decode($item->css_view);
|
$item->css_view = base64_decode($item->css_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->on_get_model_field))
|
|
||||||
{
|
|
||||||
// base64 Decode on_get_model_field.
|
|
||||||
$item->on_get_model_field = base64_decode($item->on_get_model_field);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->javascript_view_footer))
|
|
||||||
{
|
|
||||||
// base64 Decode javascript_view_footer.
|
|
||||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->javascript_views_footer))
|
if (!empty($item->javascript_views_footer))
|
||||||
{
|
{
|
||||||
// base64 Decode javascript_views_footer.
|
// base64 Decode javascript_views_footer.
|
||||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($item->initiator_on_save_model))
|
||||||
|
{
|
||||||
|
// base64 Decode initiator_on_save_model.
|
||||||
|
$item->initiator_on_save_model = base64_decode($item->initiator_on_save_model);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($item->xml))
|
if (!empty($item->xml))
|
||||||
{
|
{
|
||||||
// JSON Decode xml.
|
// JSON Decode xml.
|
||||||
@ -1225,6 +1224,12 @@ class FieldModel extends AdminModel
|
|||||||
$data['xml'] = (string) json_encode($data['xml']);
|
$data['xml'] = (string) json_encode($data['xml']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the on_get_model_field string to base64 string.
|
||||||
|
if (isset($data['on_get_model_field']))
|
||||||
|
{
|
||||||
|
$data['on_get_model_field'] = base64_encode($data['on_get_model_field']);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the on_save_model_field string to base64 string.
|
// Set the on_save_model_field string to base64 string.
|
||||||
if (isset($data['on_save_model_field']))
|
if (isset($data['on_save_model_field']))
|
||||||
{
|
{
|
||||||
@ -1237,10 +1242,10 @@ class FieldModel extends AdminModel
|
|||||||
$data['initiator_on_get_model'] = base64_encode($data['initiator_on_get_model']);
|
$data['initiator_on_get_model'] = base64_encode($data['initiator_on_get_model']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the initiator_on_save_model string to base64 string.
|
// Set the javascript_view_footer string to base64 string.
|
||||||
if (isset($data['initiator_on_save_model']))
|
if (isset($data['javascript_view_footer']))
|
||||||
{
|
{
|
||||||
$data['initiator_on_save_model'] = base64_encode($data['initiator_on_save_model']);
|
$data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the css_views string to base64 string.
|
// Set the css_views string to base64 string.
|
||||||
@ -1255,24 +1260,18 @@ class FieldModel extends AdminModel
|
|||||||
$data['css_view'] = base64_encode($data['css_view']);
|
$data['css_view'] = base64_encode($data['css_view']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the on_get_model_field string to base64 string.
|
|
||||||
if (isset($data['on_get_model_field']))
|
|
||||||
{
|
|
||||||
$data['on_get_model_field'] = base64_encode($data['on_get_model_field']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the javascript_view_footer string to base64 string.
|
|
||||||
if (isset($data['javascript_view_footer']))
|
|
||||||
{
|
|
||||||
$data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the javascript_views_footer string to base64 string.
|
// Set the javascript_views_footer string to base64 string.
|
||||||
if (isset($data['javascript_views_footer']))
|
if (isset($data['javascript_views_footer']))
|
||||||
{
|
{
|
||||||
$data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']);
|
$data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the initiator_on_save_model string to base64 string.
|
||||||
|
if (isset($data['initiator_on_save_model']))
|
||||||
|
{
|
||||||
|
$data['initiator_on_save_model'] = base64_encode($data['initiator_on_save_model']);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the Params Items to data
|
// Set the Params Items to data
|
||||||
if (isset($data['params']) && is_array($data['params']))
|
if (isset($data['params']) && is_array($data['params']))
|
||||||
{
|
{
|
||||||
|
@ -396,7 +396,6 @@ class FieldsModel extends ListModel
|
|||||||
2 => 'COM_COMPONENTBUILDER_FIELD_BASE64',
|
2 => 'COM_COMPONENTBUILDER_FIELD_BASE64',
|
||||||
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
|
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
|
||||||
5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
|
5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
|
||||||
4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION',
|
|
||||||
6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM'
|
6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM'
|
||||||
);
|
);
|
||||||
// Now check if value is found in this array
|
// Now check if value is found in this array
|
||||||
|
@ -519,7 +519,6 @@ class FieldtypeModel extends AdminModel
|
|||||||
2 => 'COM_COMPONENTBUILDER_FIELD_BASE64',
|
2 => 'COM_COMPONENTBUILDER_FIELD_BASE64',
|
||||||
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
|
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
|
||||||
5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
|
5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
|
||||||
4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION',
|
|
||||||
6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM'
|
6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM'
|
||||||
);
|
);
|
||||||
// Now check if value is found in this array
|
// Now check if value is found in this array
|
||||||
|
@ -77,12 +77,6 @@ class Joomla_componentModel extends AdminModel
|
|||||||
'author',
|
'author',
|
||||||
'email',
|
'email',
|
||||||
'website',
|
'website',
|
||||||
'add_license',
|
|
||||||
'license_type',
|
|
||||||
'note_whmcs_lisencing_note',
|
|
||||||
'whmcs_key',
|
|
||||||
'whmcs_url',
|
|
||||||
'whmcs_buy_link',
|
|
||||||
'license',
|
'license',
|
||||||
'bom',
|
'bom',
|
||||||
'image',
|
'image',
|
||||||
@ -97,30 +91,6 @@ class Joomla_componentModel extends AdminModel
|
|||||||
'not_required'
|
'not_required'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'libs_helpers' => array(
|
|
||||||
'fullwidth' => array(
|
|
||||||
'creatuserhelper',
|
|
||||||
'adduikit',
|
|
||||||
'addfootable',
|
|
||||||
'add_email_helper',
|
|
||||||
'add_php_helper_both',
|
|
||||||
'php_helper_both',
|
|
||||||
'add_php_helper_admin',
|
|
||||||
'php_helper_admin',
|
|
||||||
'add_admin_event',
|
|
||||||
'php_admin_event',
|
|
||||||
'add_php_helper_site',
|
|
||||||
'php_helper_site',
|
|
||||||
'add_site_event',
|
|
||||||
'php_site_event',
|
|
||||||
'add_javascript',
|
|
||||||
'javascript',
|
|
||||||
'add_css_admin',
|
|
||||||
'css_admin',
|
|
||||||
'add_css_site',
|
|
||||||
'css_site'
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'dynamic_integration' => array(
|
'dynamic_integration' => array(
|
||||||
'left' => array(
|
'left' => array(
|
||||||
'add_update_server',
|
'add_update_server',
|
||||||
@ -150,6 +120,15 @@ class Joomla_componentModel extends AdminModel
|
|||||||
'crowdin_account_api_key'
|
'crowdin_account_api_key'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'mysql' => array(
|
||||||
|
'fullwidth' => array(
|
||||||
|
'add_sql',
|
||||||
|
'sql',
|
||||||
|
'add_sql_uninstall',
|
||||||
|
'sql_uninstall',
|
||||||
|
'assets_table_fix'
|
||||||
|
)
|
||||||
|
),
|
||||||
'dash_install' => array(
|
'dash_install' => array(
|
||||||
'left' => array(
|
'left' => array(
|
||||||
'dashboard_type'
|
'dashboard_type'
|
||||||
@ -174,6 +153,30 @@ class Joomla_componentModel extends AdminModel
|
|||||||
'php_method_install'
|
'php_method_install'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'libs_helpers' => array(
|
||||||
|
'fullwidth' => array(
|
||||||
|
'creatuserhelper',
|
||||||
|
'adduikit',
|
||||||
|
'addfootable',
|
||||||
|
'add_email_helper',
|
||||||
|
'add_php_helper_both',
|
||||||
|
'php_helper_both',
|
||||||
|
'add_php_helper_admin',
|
||||||
|
'php_helper_admin',
|
||||||
|
'add_admin_event',
|
||||||
|
'php_admin_event',
|
||||||
|
'add_php_helper_site',
|
||||||
|
'php_helper_site',
|
||||||
|
'add_site_event',
|
||||||
|
'php_site_event',
|
||||||
|
'add_javascript',
|
||||||
|
'javascript',
|
||||||
|
'add_css_admin',
|
||||||
|
'css_admin',
|
||||||
|
'add_css_site',
|
||||||
|
'css_site'
|
||||||
|
)
|
||||||
|
),
|
||||||
'readme' => array(
|
'readme' => array(
|
||||||
'left' => array(
|
'left' => array(
|
||||||
'addreadme',
|
'addreadme',
|
||||||
@ -183,15 +186,6 @@ class Joomla_componentModel extends AdminModel
|
|||||||
'note_readme'
|
'note_readme'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'mysql' => array(
|
|
||||||
'fullwidth' => array(
|
|
||||||
'add_sql',
|
|
||||||
'sql',
|
|
||||||
'add_sql_uninstall',
|
|
||||||
'sql_uninstall',
|
|
||||||
'assets_table_fix'
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'dynamic_build' => array(
|
'dynamic_build' => array(
|
||||||
'fullwidth' => array(
|
'fullwidth' => array(
|
||||||
'note_buildcomp_dynamic_mysql',
|
'note_buildcomp_dynamic_mysql',
|
||||||
@ -403,58 +397,22 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$item->metadata = $registry->toArray();
|
$item->metadata = $registry->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_site_event))
|
if (!empty($item->sql_uninstall))
|
||||||
{
|
{
|
||||||
// base64 Decode php_site_event.
|
// base64 Decode sql_uninstall.
|
||||||
$item->php_site_event = base64_decode($item->php_site_event);
|
$item->sql_uninstall = base64_decode($item->sql_uninstall);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_admin_event))
|
if (!empty($item->php_postflight_update))
|
||||||
{
|
{
|
||||||
// base64 Decode php_admin_event.
|
// base64 Decode php_postflight_update.
|
||||||
$item->php_admin_event = base64_decode($item->php_admin_event);
|
$item->php_postflight_update = base64_decode($item->php_postflight_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_preflight_install))
|
if (!empty($item->css_site))
|
||||||
{
|
{
|
||||||
// base64 Decode php_preflight_install.
|
// base64 Decode css_site.
|
||||||
$item->php_preflight_install = base64_decode($item->php_preflight_install);
|
$item->css_site = base64_decode($item->css_site);
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->php_method_uninstall))
|
|
||||||
{
|
|
||||||
// base64 Decode php_method_uninstall.
|
|
||||||
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->css_admin))
|
|
||||||
{
|
|
||||||
// base64 Decode css_admin.
|
|
||||||
$item->css_admin = base64_decode($item->css_admin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->php_postflight_install))
|
|
||||||
{
|
|
||||||
// base64 Decode php_postflight_install.
|
|
||||||
$item->php_postflight_install = base64_decode($item->php_postflight_install);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->sql))
|
|
||||||
{
|
|
||||||
// base64 Decode sql.
|
|
||||||
$item->sql = base64_decode($item->sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->buildcompsql))
|
|
||||||
{
|
|
||||||
// base64 Decode buildcompsql.
|
|
||||||
$item->buildcompsql = base64_decode($item->buildcompsql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->php_helper_admin))
|
|
||||||
{
|
|
||||||
// base64 Decode php_helper_admin.
|
|
||||||
$item->php_helper_admin = base64_decode($item->php_helper_admin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_helper_site))
|
if (!empty($item->php_helper_site))
|
||||||
@ -469,10 +427,28 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$item->javascript = base64_decode($item->javascript);
|
$item->javascript = base64_decode($item->javascript);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->css_site))
|
if (!empty($item->php_method_install))
|
||||||
{
|
{
|
||||||
// base64 Decode css_site.
|
// base64 Decode php_method_install.
|
||||||
$item->css_site = base64_decode($item->css_site);
|
$item->php_method_install = base64_decode($item->php_method_install);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->php_admin_event))
|
||||||
|
{
|
||||||
|
// base64 Decode php_admin_event.
|
||||||
|
$item->php_admin_event = base64_decode($item->php_admin_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->php_site_event))
|
||||||
|
{
|
||||||
|
// base64 Decode php_site_event.
|
||||||
|
$item->php_site_event = base64_decode($item->php_site_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->css_admin))
|
||||||
|
{
|
||||||
|
// base64 Decode css_admin.
|
||||||
|
$item->css_admin = base64_decode($item->css_admin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_preflight_update))
|
if (!empty($item->php_preflight_update))
|
||||||
@ -481,22 +457,34 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$item->php_preflight_update = base64_decode($item->php_preflight_update);
|
$item->php_preflight_update = base64_decode($item->php_preflight_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_postflight_update))
|
if (!empty($item->php_preflight_install))
|
||||||
{
|
{
|
||||||
// base64 Decode php_postflight_update.
|
// base64 Decode php_preflight_install.
|
||||||
$item->php_postflight_update = base64_decode($item->php_postflight_update);
|
$item->php_preflight_install = base64_decode($item->php_preflight_install);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->php_method_install))
|
if (!empty($item->php_postflight_install))
|
||||||
{
|
{
|
||||||
// base64 Decode php_method_install.
|
// base64 Decode php_postflight_install.
|
||||||
$item->php_method_install = base64_decode($item->php_method_install);
|
$item->php_postflight_install = base64_decode($item->php_postflight_install);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->sql_uninstall))
|
if (!empty($item->php_method_uninstall))
|
||||||
{
|
{
|
||||||
// base64 Decode sql_uninstall.
|
// base64 Decode php_method_uninstall.
|
||||||
$item->sql_uninstall = base64_decode($item->sql_uninstall);
|
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->sql))
|
||||||
|
{
|
||||||
|
// base64 Decode sql.
|
||||||
|
$item->sql = base64_decode($item->sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->buildcompsql))
|
||||||
|
{
|
||||||
|
// base64 Decode buildcompsql.
|
||||||
|
$item->buildcompsql = base64_decode($item->buildcompsql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->readme))
|
if (!empty($item->readme))
|
||||||
@ -511,6 +499,12 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$item->php_helper_both = base64_decode($item->php_helper_both);
|
$item->php_helper_both = base64_decode($item->php_helper_both);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($item->php_helper_admin))
|
||||||
|
{
|
||||||
|
// base64 Decode php_helper_admin.
|
||||||
|
$item->php_helper_admin = base64_decode($item->php_helper_admin);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the basic encryption.
|
// Get the basic encryption.
|
||||||
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
||||||
// Get the encryption object.
|
// Get the encryption object.
|
||||||
@ -522,12 +516,6 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0");
|
$item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
|
|
||||||
{
|
|
||||||
// basic decrypt data whmcs_key.
|
|
||||||
$item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
|
if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
|
||||||
{
|
{
|
||||||
// basic decrypt data export_key.
|
// basic decrypt data export_key.
|
||||||
@ -1500,58 +1488,22 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$data['addcontributors'] = '';
|
$data['addcontributors'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_site_event string to base64 string.
|
// Set the sql_uninstall string to base64 string.
|
||||||
if (isset($data['php_site_event']))
|
if (isset($data['sql_uninstall']))
|
||||||
{
|
{
|
||||||
$data['php_site_event'] = base64_encode($data['php_site_event']);
|
$data['sql_uninstall'] = base64_encode($data['sql_uninstall']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_admin_event string to base64 string.
|
// Set the php_postflight_update string to base64 string.
|
||||||
if (isset($data['php_admin_event']))
|
if (isset($data['php_postflight_update']))
|
||||||
{
|
{
|
||||||
$data['php_admin_event'] = base64_encode($data['php_admin_event']);
|
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_preflight_install string to base64 string.
|
// Set the css_site string to base64 string.
|
||||||
if (isset($data['php_preflight_install']))
|
if (isset($data['css_site']))
|
||||||
{
|
{
|
||||||
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
|
$data['css_site'] = base64_encode($data['css_site']);
|
||||||
}
|
|
||||||
|
|
||||||
// Set the php_method_uninstall string to base64 string.
|
|
||||||
if (isset($data['php_method_uninstall']))
|
|
||||||
{
|
|
||||||
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the css_admin string to base64 string.
|
|
||||||
if (isset($data['css_admin']))
|
|
||||||
{
|
|
||||||
$data['css_admin'] = base64_encode($data['css_admin']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the php_postflight_install string to base64 string.
|
|
||||||
if (isset($data['php_postflight_install']))
|
|
||||||
{
|
|
||||||
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the sql string to base64 string.
|
|
||||||
if (isset($data['sql']))
|
|
||||||
{
|
|
||||||
$data['sql'] = base64_encode($data['sql']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the buildcompsql string to base64 string.
|
|
||||||
if (isset($data['buildcompsql']))
|
|
||||||
{
|
|
||||||
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the php_helper_admin string to base64 string.
|
|
||||||
if (isset($data['php_helper_admin']))
|
|
||||||
{
|
|
||||||
$data['php_helper_admin'] = base64_encode($data['php_helper_admin']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_helper_site string to base64 string.
|
// Set the php_helper_site string to base64 string.
|
||||||
@ -1566,10 +1518,28 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$data['javascript'] = base64_encode($data['javascript']);
|
$data['javascript'] = base64_encode($data['javascript']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the css_site string to base64 string.
|
// Set the php_method_install string to base64 string.
|
||||||
if (isset($data['css_site']))
|
if (isset($data['php_method_install']))
|
||||||
{
|
{
|
||||||
$data['css_site'] = base64_encode($data['css_site']);
|
$data['php_method_install'] = base64_encode($data['php_method_install']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the php_admin_event string to base64 string.
|
||||||
|
if (isset($data['php_admin_event']))
|
||||||
|
{
|
||||||
|
$data['php_admin_event'] = base64_encode($data['php_admin_event']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the php_site_event string to base64 string.
|
||||||
|
if (isset($data['php_site_event']))
|
||||||
|
{
|
||||||
|
$data['php_site_event'] = base64_encode($data['php_site_event']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the css_admin string to base64 string.
|
||||||
|
if (isset($data['css_admin']))
|
||||||
|
{
|
||||||
|
$data['css_admin'] = base64_encode($data['css_admin']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_preflight_update string to base64 string.
|
// Set the php_preflight_update string to base64 string.
|
||||||
@ -1578,22 +1548,34 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
|
$data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_postflight_update string to base64 string.
|
// Set the php_preflight_install string to base64 string.
|
||||||
if (isset($data['php_postflight_update']))
|
if (isset($data['php_preflight_install']))
|
||||||
{
|
{
|
||||||
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
|
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the php_method_install string to base64 string.
|
// Set the php_postflight_install string to base64 string.
|
||||||
if (isset($data['php_method_install']))
|
if (isset($data['php_postflight_install']))
|
||||||
{
|
{
|
||||||
$data['php_method_install'] = base64_encode($data['php_method_install']);
|
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the sql_uninstall string to base64 string.
|
// Set the php_method_uninstall string to base64 string.
|
||||||
if (isset($data['sql_uninstall']))
|
if (isset($data['php_method_uninstall']))
|
||||||
{
|
{
|
||||||
$data['sql_uninstall'] = base64_encode($data['sql_uninstall']);
|
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the sql string to base64 string.
|
||||||
|
if (isset($data['sql']))
|
||||||
|
{
|
||||||
|
$data['sql'] = base64_encode($data['sql']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the buildcompsql string to base64 string.
|
||||||
|
if (isset($data['buildcompsql']))
|
||||||
|
{
|
||||||
|
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the readme string to base64 string.
|
// Set the readme string to base64 string.
|
||||||
@ -1608,6 +1590,12 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$data['php_helper_both'] = base64_encode($data['php_helper_both']);
|
$data['php_helper_both'] = base64_encode($data['php_helper_both']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the php_helper_admin string to base64 string.
|
||||||
|
if (isset($data['php_helper_admin']))
|
||||||
|
{
|
||||||
|
$data['php_helper_admin'] = base64_encode($data['php_helper_admin']);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the basic encryption key.
|
// Get the basic encryption key.
|
||||||
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
||||||
// Get the encryption object
|
// Get the encryption object
|
||||||
@ -1619,12 +1607,6 @@ class Joomla_componentModel extends AdminModel
|
|||||||
$data['crowdin_username'] = $basic->encryptString($data['crowdin_username']);
|
$data['crowdin_username'] = $basic->encryptString($data['crowdin_username']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypt data whmcs_key.
|
|
||||||
if (isset($data['whmcs_key']) && $basickey)
|
|
||||||
{
|
|
||||||
$data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encrypt data export_key.
|
// Encrypt data export_key.
|
||||||
if (isset($data['export_key']) && $basickey)
|
if (isset($data['export_key']) && $basickey)
|
||||||
{
|
{
|
||||||
|
@ -2745,48 +2745,41 @@ class Joomla_componentsModel extends ListModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// decode php_site_event
|
// decode sql_uninstall
|
||||||
$item->php_site_event = base64_decode($item->php_site_event);
|
$item->sql_uninstall = base64_decode($item->sql_uninstall);
|
||||||
|
// decode php_postflight_update
|
||||||
|
$item->php_postflight_update = base64_decode($item->php_postflight_update);
|
||||||
|
// decode css_site
|
||||||
|
$item->css_site = base64_decode($item->css_site);
|
||||||
|
// decode php_helper_site
|
||||||
|
$item->php_helper_site = base64_decode($item->php_helper_site);
|
||||||
|
// decode javascript
|
||||||
|
$item->javascript = base64_decode($item->javascript);
|
||||||
|
// decode php_method_install
|
||||||
|
$item->php_method_install = base64_decode($item->php_method_install);
|
||||||
// decode php_admin_event
|
// decode php_admin_event
|
||||||
$item->php_admin_event = base64_decode($item->php_admin_event);
|
$item->php_admin_event = base64_decode($item->php_admin_event);
|
||||||
|
// decode php_site_event
|
||||||
|
$item->php_site_event = base64_decode($item->php_site_event);
|
||||||
|
// decode css_admin
|
||||||
|
$item->css_admin = base64_decode($item->css_admin);
|
||||||
|
// decode php_preflight_update
|
||||||
|
$item->php_preflight_update = base64_decode($item->php_preflight_update);
|
||||||
|
// decode php_preflight_install
|
||||||
|
$item->php_preflight_install = base64_decode($item->php_preflight_install);
|
||||||
|
// decode php_postflight_install
|
||||||
|
$item->php_postflight_install = base64_decode($item->php_postflight_install);
|
||||||
|
// decode php_method_uninstall
|
||||||
|
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
|
||||||
|
// decode sql
|
||||||
|
$item->sql = base64_decode($item->sql);
|
||||||
if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true)))
|
if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true)))
|
||||||
{
|
{
|
||||||
// decrypt crowdin_username
|
// decrypt crowdin_username
|
||||||
$item->crowdin_username = $basic->decryptString($item->crowdin_username);
|
$item->crowdin_username = $basic->decryptString($item->crowdin_username);
|
||||||
}
|
}
|
||||||
// decode php_preflight_install
|
|
||||||
$item->php_preflight_install = base64_decode($item->php_preflight_install);
|
|
||||||
// decode php_method_uninstall
|
|
||||||
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
|
|
||||||
// decode css_admin
|
|
||||||
$item->css_admin = base64_decode($item->css_admin);
|
|
||||||
// decode php_postflight_install
|
|
||||||
$item->php_postflight_install = base64_decode($item->php_postflight_install);
|
|
||||||
// decode sql
|
|
||||||
$item->sql = base64_decode($item->sql);
|
|
||||||
// decode buildcompsql
|
// decode buildcompsql
|
||||||
$item->buildcompsql = base64_decode($item->buildcompsql);
|
$item->buildcompsql = base64_decode($item->buildcompsql);
|
||||||
// decode php_helper_admin
|
|
||||||
$item->php_helper_admin = base64_decode($item->php_helper_admin);
|
|
||||||
// decode php_helper_site
|
|
||||||
$item->php_helper_site = base64_decode($item->php_helper_site);
|
|
||||||
if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
|
|
||||||
{
|
|
||||||
// decrypt whmcs_key
|
|
||||||
$item->whmcs_key = $basic->decryptString($item->whmcs_key);
|
|
||||||
}
|
|
||||||
// decode javascript
|
|
||||||
$item->javascript = base64_decode($item->javascript);
|
|
||||||
// decode css_site
|
|
||||||
$item->css_site = base64_decode($item->css_site);
|
|
||||||
// decode php_preflight_update
|
|
||||||
$item->php_preflight_update = base64_decode($item->php_preflight_update);
|
|
||||||
// decode php_postflight_update
|
|
||||||
$item->php_postflight_update = base64_decode($item->php_postflight_update);
|
|
||||||
// decode php_method_install
|
|
||||||
$item->php_method_install = base64_decode($item->php_method_install);
|
|
||||||
// decode sql_uninstall
|
|
||||||
$item->sql_uninstall = base64_decode($item->sql_uninstall);
|
|
||||||
if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
|
if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
|
||||||
{
|
{
|
||||||
// decrypt export_key
|
// decrypt export_key
|
||||||
@ -2799,13 +2792,15 @@ class Joomla_componentsModel extends ListModel
|
|||||||
// decrypt crowdin_project_api_key
|
// decrypt crowdin_project_api_key
|
||||||
$item->crowdin_project_api_key = $basic->decryptString($item->crowdin_project_api_key);
|
$item->crowdin_project_api_key = $basic->decryptString($item->crowdin_project_api_key);
|
||||||
}
|
}
|
||||||
|
// decode php_helper_both
|
||||||
|
$item->php_helper_both = base64_decode($item->php_helper_both);
|
||||||
if ($basickey && !is_numeric($item->crowdin_account_api_key) && $item->crowdin_account_api_key === base64_encode(base64_decode($item->crowdin_account_api_key, true)))
|
if ($basickey && !is_numeric($item->crowdin_account_api_key) && $item->crowdin_account_api_key === base64_encode(base64_decode($item->crowdin_account_api_key, true)))
|
||||||
{
|
{
|
||||||
// decrypt crowdin_account_api_key
|
// decrypt crowdin_account_api_key
|
||||||
$item->crowdin_account_api_key = $basic->decryptString($item->crowdin_account_api_key);
|
$item->crowdin_account_api_key = $basic->decryptString($item->crowdin_account_api_key);
|
||||||
}
|
}
|
||||||
// decode php_helper_both
|
// decode php_helper_admin
|
||||||
$item->php_helper_both = base64_decode($item->php_helper_both);
|
$item->php_helper_admin = base64_decode($item->php_helper_admin);
|
||||||
// unset the values we don't want exported.
|
// unset the values we don't want exported.
|
||||||
unset($item->asset_id);
|
unset($item->asset_id);
|
||||||
unset($item->checked_out);
|
unset($item->checked_out);
|
||||||
|
@ -23,7 +23,6 @@ use Joomla\Utilities\ArrayHelper;
|
|||||||
use Joomla\Input\Input;
|
use Joomla\Input\Input;
|
||||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
use Joomla\CMS\Helper\TagsHelper;
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
use VDM\Joomla\Utilities\Component\Helper as JCBHelper;
|
|
||||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||||
use VDM\Joomla\Utilities\FormHelper as JCBFormHelper;
|
use VDM\Joomla\Utilities\FormHelper as JCBFormHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||||
@ -117,7 +116,7 @@ class PowersModel extends ListModel
|
|||||||
// load form from the parent class
|
// load form from the parent class
|
||||||
$form = parent::getFilterForm($data, $loadData);
|
$form = parent::getFilterForm($data, $loadData);
|
||||||
|
|
||||||
// Create the "admin_view" filter
|
// Create the "namegroup" filter
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name' => 'namegroup',
|
'name' => 'namegroup',
|
||||||
'type' => 'list',
|
'type' => 'list',
|
||||||
@ -126,7 +125,7 @@ class PowersModel extends ListModel
|
|||||||
$options = array(
|
$options = array(
|
||||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_NAMESPACE_FOUND') . ' -'
|
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_NAMESPACE_FOUND') . ' -'
|
||||||
);
|
);
|
||||||
// check if we have namespace (and limit to an extension if it is set)
|
// check if we have namespace
|
||||||
if (($namespaces = JCBFilterHelper::namespaces()) !== null)
|
if (($namespaces = JCBFilterHelper::namespaces()) !== null)
|
||||||
{
|
{
|
||||||
$options = array(
|
$options = array(
|
||||||
@ -144,54 +143,33 @@ class PowersModel extends ListModel
|
|||||||
);
|
);
|
||||||
array_push($this->filter_fields, 'namegroup');
|
array_push($this->filter_fields, 'namegroup');
|
||||||
|
|
||||||
// get the component params
|
// Create the "approved_paths" filter
|
||||||
$params = JCBHelper::getParams();
|
$attributes = array(
|
||||||
$activate = $params->get('super_powers_repositories', 0);
|
'name' => 'approved_paths',
|
||||||
if ($activate == 1)
|
'type' => 'list',
|
||||||
|
'onchange' => 'this.form.submit();',
|
||||||
|
);
|
||||||
|
$options = array(
|
||||||
|
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_PATHS_FOUND') . ' -'
|
||||||
|
);
|
||||||
|
// check if we have approved_paths = 1
|
||||||
|
if (($approvedpaths = JCBFilterHelper::repositories(1)) !== null)
|
||||||
{
|
{
|
||||||
$subform = $params->get('approved_paths', null);
|
|
||||||
|
|
||||||
// create approved paths filter
|
|
||||||
$attributes = array(
|
|
||||||
'name' => 'approved_paths',
|
|
||||||
'type' => 'list',
|
|
||||||
'onchange' => 'this.form.submit();',
|
|
||||||
);
|
|
||||||
$options = array(
|
$options = array(
|
||||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_PATHS_FOUND') . ' -'
|
'' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_APPROVED_PATH') . ' -'
|
||||||
);
|
);
|
||||||
|
// make sure we do not lose the key values in normal merge
|
||||||
// add the paths found in global settings
|
$options = $options + $approvedpaths;
|
||||||
if (is_object($subform))
|
|
||||||
{
|
|
||||||
$core = $params->get('super_powers_core', 'joomla/super-powers');
|
|
||||||
|
|
||||||
$options = array(
|
|
||||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_APPROVED_PATH') . ' -',
|
|
||||||
$core => $core
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($subform as $value)
|
|
||||||
{
|
|
||||||
if (isset($value->owner) && strlen($value->owner) > 1 &&
|
|
||||||
isset($value->repo) && strlen($value->repo) > 1)
|
|
||||||
{
|
|
||||||
$value = trim($value->owner) . '/' . trim($value->repo);
|
|
||||||
|
|
||||||
$options[$value] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->setField(JCBFormHelper::xml($attributes, $options), 'filter');
|
|
||||||
$form->setValue(
|
|
||||||
'approved_paths',
|
|
||||||
'filter',
|
|
||||||
$this->state->get("filter.approved_paths")
|
|
||||||
);
|
|
||||||
array_push($this->filter_fields, 'approved_paths');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||||
|
$form->setValue(
|
||||||
|
'approved_paths',
|
||||||
|
'filter',
|
||||||
|
$this->state->get("filter.approved_paths")
|
||||||
|
);
|
||||||
|
array_push($this->filter_fields, 'approved_paths');
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
559
admin/src/Model/RepositoriesModel.php
Normal file
559
admin/src/Model/RepositoriesModel.php
Normal file
@ -0,0 +1,559 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\MVC\Model\ListModel;
|
||||||
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\CMS\User\User;
|
||||||
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
use Joomla\Input\Input;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
|
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||||
|
use VDM\Joomla\Utilities\ObjectHelper;
|
||||||
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositories List Model
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoriesModel extends ListModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application object.
|
||||||
|
*
|
||||||
|
* @var CMSApplicationInterface The application instance.
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected CMSApplicationInterface $app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The styles array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
protected array $styles = [
|
||||||
|
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||||
|
'administrator/components/com_componentbuilder/assets/css/repositories.css'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scripts array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
protected array $scripts = [
|
||||||
|
'administrator/components/com_componentbuilder/assets/js/admin.js'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||||
|
* @param ?MVCFactoryInterface $factory The factory.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||||
|
{
|
||||||
|
if (empty($config['filter_fields']))
|
||||||
|
{
|
||||||
|
$config['filter_fields'] = array(
|
||||||
|
'a.id','id',
|
||||||
|
'a.published','published',
|
||||||
|
'a.access','access',
|
||||||
|
'a.ordering','ordering',
|
||||||
|
'a.created_by','created_by',
|
||||||
|
'a.modified_by','modified_by',
|
||||||
|
'a.organisation','organisation',
|
||||||
|
'a.repository','repository',
|
||||||
|
'a.target','target',
|
||||||
|
'a.base','base',
|
||||||
|
'a.type','type'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct($config, $factory);
|
||||||
|
|
||||||
|
$this->app ??= Factory::getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to auto-populate the model state.
|
||||||
|
*
|
||||||
|
* Note. Calling getState in this method will result in recursion.
|
||||||
|
*
|
||||||
|
* @param string $ordering An optional ordering field.
|
||||||
|
* @param string $direction An optional direction (asc|desc).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.7.0
|
||||||
|
*/
|
||||||
|
protected function populateState($ordering = null, $direction = null)
|
||||||
|
{
|
||||||
|
$app = $this->app;
|
||||||
|
|
||||||
|
// Adjust the context to support modal layouts.
|
||||||
|
if ($layout = $app->input->get('layout'))
|
||||||
|
{
|
||||||
|
$this->context .= '.' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the form was submitted
|
||||||
|
$formSubmited = $app->input->post->get('form_submited');
|
||||||
|
|
||||||
|
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$access = $app->input->post->get('access');
|
||||||
|
$this->setState('filter.access', $access);
|
||||||
|
}
|
||||||
|
|
||||||
|
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||||
|
$this->setState('filter.published', $published);
|
||||||
|
|
||||||
|
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||||
|
$this->setState('filter.created_by', $created_by);
|
||||||
|
|
||||||
|
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||||
|
$this->setState('filter.created', $created);
|
||||||
|
|
||||||
|
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||||
|
$this->setState('filter.sorting', $sorting);
|
||||||
|
|
||||||
|
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||||
|
$this->setState('filter.search', $search);
|
||||||
|
|
||||||
|
$organisation = $this->getUserStateFromRequest($this->context . '.filter.organisation', 'filter_organisation');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$organisation = $app->input->post->get('organisation');
|
||||||
|
$this->setState('filter.organisation', $organisation);
|
||||||
|
}
|
||||||
|
|
||||||
|
$repository = $this->getUserStateFromRequest($this->context . '.filter.repository', 'filter_repository');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$repository = $app->input->post->get('repository');
|
||||||
|
$this->setState('filter.repository', $repository);
|
||||||
|
}
|
||||||
|
|
||||||
|
$target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$target = $app->input->post->get('target');
|
||||||
|
$this->setState('filter.target', $target);
|
||||||
|
}
|
||||||
|
|
||||||
|
$base = $this->getUserStateFromRequest($this->context . '.filter.base', 'filter_base');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$base = $app->input->post->get('base');
|
||||||
|
$this->setState('filter.base', $base);
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type');
|
||||||
|
if ($formSubmited)
|
||||||
|
{
|
||||||
|
$type = $app->input->post->get('type');
|
||||||
|
$this->setState('filter.type', $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// List state information.
|
||||||
|
parent::populateState($ordering, $direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get an array of data items.
|
||||||
|
*
|
||||||
|
* @return mixed An array of data items on success, false on failure.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getItems()
|
||||||
|
{
|
||||||
|
// Check in items
|
||||||
|
$this->checkInNow();
|
||||||
|
|
||||||
|
// load parent items
|
||||||
|
$items = parent::getItems();
|
||||||
|
|
||||||
|
// Set values to display correctly.
|
||||||
|
if (UtilitiesArrayHelper::check($items))
|
||||||
|
{
|
||||||
|
// Get the user object if not set.
|
||||||
|
if (!isset($user) || !ObjectHelper::check($user))
|
||||||
|
{
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
}
|
||||||
|
foreach ($items as $nr => &$item)
|
||||||
|
{
|
||||||
|
// Remove items the user can't access.
|
||||||
|
$access = ($user->authorise('repository.access', 'com_componentbuilder.repository.' . (int) $item->id) && $user->authorise('repository.access', 'com_componentbuilder'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
unset($items[$nr]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set selection value to a translatable value
|
||||||
|
if (UtilitiesArrayHelper::check($items))
|
||||||
|
{
|
||||||
|
foreach ($items as $nr => &$item)
|
||||||
|
{
|
||||||
|
// convert target
|
||||||
|
$item->target = $this->selectionTranslation($item->target, 'target');
|
||||||
|
// convert type
|
||||||
|
$item->type = $this->selectionTranslation($item->type, 'type');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// return items
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to convert selection values to translatable string.
|
||||||
|
*
|
||||||
|
* @return string The translatable string.
|
||||||
|
*/
|
||||||
|
public function selectionTranslation($value,$name)
|
||||||
|
{
|
||||||
|
// Array of target language strings
|
||||||
|
if ($name === 'target')
|
||||||
|
{
|
||||||
|
$targetArray = array(
|
||||||
|
0 => 'COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION',
|
||||||
|
1 => 'COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER',
|
||||||
|
2 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER'
|
||||||
|
);
|
||||||
|
// Now check if value is found in this array
|
||||||
|
if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value]))
|
||||||
|
{
|
||||||
|
return $targetArray[$value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Array of type language strings
|
||||||
|
if ($name === 'type')
|
||||||
|
{
|
||||||
|
$typeArray = array(
|
||||||
|
0 => 'COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION',
|
||||||
|
1 => 'COM_COMPONENTBUILDER_REPOSITORY_GITEA'
|
||||||
|
);
|
||||||
|
// Now check if value is found in this array
|
||||||
|
if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value]))
|
||||||
|
{
|
||||||
|
return $typeArray[$value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to build an SQL query to load the list data.
|
||||||
|
*
|
||||||
|
* @return string An SQL query
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getListQuery()
|
||||||
|
{
|
||||||
|
// Get the user object.
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
// Create a new query object.
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select some fields
|
||||||
|
$query->select('a.*');
|
||||||
|
|
||||||
|
// From the componentbuilder_item table
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository', 'a'));
|
||||||
|
|
||||||
|
// Filter by published state
|
||||||
|
$published = $this->getState('filter.published');
|
||||||
|
if (is_numeric($published))
|
||||||
|
{
|
||||||
|
$query->where('a.published = ' . (int) $published);
|
||||||
|
}
|
||||||
|
elseif ($published === '')
|
||||||
|
{
|
||||||
|
$query->where('(a.published = 0 OR a.published = 1)');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join over the asset groups.
|
||||||
|
$query->select('ag.title AS access_level');
|
||||||
|
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||||
|
// Filter by access level.
|
||||||
|
$_access = $this->getState('filter.access');
|
||||||
|
if ($_access && is_numeric($_access))
|
||||||
|
{
|
||||||
|
$query->where('a.access = ' . (int) $_access);
|
||||||
|
}
|
||||||
|
elseif (UtilitiesArrayHelper::check($_access))
|
||||||
|
{
|
||||||
|
// Secure the array for the query
|
||||||
|
$_access = ArrayHelper::toInteger($_access);
|
||||||
|
// Filter by the Access Array.
|
||||||
|
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||||
|
}
|
||||||
|
// Implement View Level Access
|
||||||
|
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||||
|
{
|
||||||
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||||
|
$query->where('a.access IN (' . $groups . ')');
|
||||||
|
}
|
||||||
|
// Filter by search.
|
||||||
|
$search = $this->getState('filter.search');
|
||||||
|
if (!empty($search))
|
||||||
|
{
|
||||||
|
if (stripos($search, 'id:') === 0)
|
||||||
|
{
|
||||||
|
$query->where('a.id = ' . (int) substr($search, 3));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||||
|
$query->where('(a.organisation LIKE '.$search.' OR a.repository LIKE '.$search.' OR a.target LIKE '.$search.' OR a.type LIKE '.$search.' OR a.base LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.username LIKE '.$search.')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by Organisation.
|
||||||
|
$_organisation = $this->getState('filter.organisation');
|
||||||
|
if (is_numeric($_organisation))
|
||||||
|
{
|
||||||
|
if (is_float($_organisation))
|
||||||
|
{
|
||||||
|
$query->where('a.organisation = ' . (float) $_organisation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('a.organisation = ' . (int) $_organisation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (StringHelper::check($_organisation))
|
||||||
|
{
|
||||||
|
$query->where('a.organisation = ' . $db->quote($db->escape($_organisation)));
|
||||||
|
}
|
||||||
|
// Filter by Repository.
|
||||||
|
$_repository = $this->getState('filter.repository');
|
||||||
|
if (is_numeric($_repository))
|
||||||
|
{
|
||||||
|
if (is_float($_repository))
|
||||||
|
{
|
||||||
|
$query->where('a.repository = ' . (float) $_repository);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('a.repository = ' . (int) $_repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (StringHelper::check($_repository))
|
||||||
|
{
|
||||||
|
$query->where('a.repository = ' . $db->quote($db->escape($_repository)));
|
||||||
|
}
|
||||||
|
// Filter by Target.
|
||||||
|
$_target = $this->getState('filter.target');
|
||||||
|
if (is_numeric($_target))
|
||||||
|
{
|
||||||
|
if (is_float($_target))
|
||||||
|
{
|
||||||
|
$query->where('a.target = ' . (float) $_target);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('a.target = ' . (int) $_target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (StringHelper::check($_target))
|
||||||
|
{
|
||||||
|
$query->where('a.target = ' . $db->quote($db->escape($_target)));
|
||||||
|
}
|
||||||
|
// Filter by Base.
|
||||||
|
$_base = $this->getState('filter.base');
|
||||||
|
if (is_numeric($_base))
|
||||||
|
{
|
||||||
|
if (is_float($_base))
|
||||||
|
{
|
||||||
|
$query->where('a.base = ' . (float) $_base);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('a.base = ' . (int) $_base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (StringHelper::check($_base))
|
||||||
|
{
|
||||||
|
$query->where('a.base = ' . $db->quote($db->escape($_base)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the list ordering clause.
|
||||||
|
$orderCol = $this->getState('list.ordering', 'a.id');
|
||||||
|
$orderDirn = $this->getState('list.direction', 'desc');
|
||||||
|
if ($orderCol != '')
|
||||||
|
{
|
||||||
|
// Check that the order direction is valid encase we have a field called direction as part of filers.
|
||||||
|
$orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc';
|
||||||
|
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a store id based on model configuration state.
|
||||||
|
*
|
||||||
|
* @return string A store id.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getStoreId($id = '')
|
||||||
|
{
|
||||||
|
// Compile the store id.
|
||||||
|
$id .= ':' . $this->getState('filter.id');
|
||||||
|
$id .= ':' . $this->getState('filter.search');
|
||||||
|
$id .= ':' . $this->getState('filter.published');
|
||||||
|
// Check if the value is an array
|
||||||
|
$_access = $this->getState('filter.access');
|
||||||
|
if (UtilitiesArrayHelper::check($_access))
|
||||||
|
{
|
||||||
|
$id .= ':' . implode(':', $_access);
|
||||||
|
}
|
||||||
|
// Check if this is only an number or string
|
||||||
|
elseif (is_numeric($_access)
|
||||||
|
|| StringHelper::check($_access))
|
||||||
|
{
|
||||||
|
$id .= ':' . $_access;
|
||||||
|
}
|
||||||
|
$id .= ':' . $this->getState('filter.ordering');
|
||||||
|
$id .= ':' . $this->getState('filter.created_by');
|
||||||
|
$id .= ':' . $this->getState('filter.modified_by');
|
||||||
|
$id .= ':' . $this->getState('filter.organisation');
|
||||||
|
$id .= ':' . $this->getState('filter.repository');
|
||||||
|
$id .= ':' . $this->getState('filter.target');
|
||||||
|
$id .= ':' . $this->getState('filter.base');
|
||||||
|
$id .= ':' . $this->getState('filter.type');
|
||||||
|
|
||||||
|
return parent::getStoreId($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the styles that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return array styles files
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function getStyles(): array
|
||||||
|
{
|
||||||
|
return $this->styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to set the styles that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function setStyles(string $path): void
|
||||||
|
{
|
||||||
|
$this->styles[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the script that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return array script files
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function getScripts(): array
|
||||||
|
{
|
||||||
|
return $this->scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to set the script that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function setScript(string $path): void
|
||||||
|
{
|
||||||
|
$this->scripts[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected function checkInNow(): bool
|
||||||
|
{
|
||||||
|
// Get set check in time
|
||||||
|
$time = ComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||||
|
|
||||||
|
if ($time)
|
||||||
|
{
|
||||||
|
// Get a db connection.
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
// Reset query.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('*');
|
||||||
|
$query->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
// Only select items that are checked out.
|
||||||
|
$query->where($db->quoteName('checked_out') . '!=0');
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$db->execute();
|
||||||
|
if ($db->getNumRows())
|
||||||
|
{
|
||||||
|
// Get Yesterdays date.
|
||||||
|
$date = Factory::getDate()->modify($time)->toSql();
|
||||||
|
// Reset query.
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Fields to update.
|
||||||
|
$fields = array(
|
||||||
|
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
|
||||||
|
$db->quoteName('checked_out') . '=0'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Conditions for which records should be updated.
|
||||||
|
$conditions = array(
|
||||||
|
$db->quoteName('checked_out') . '!=0',
|
||||||
|
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check table.
|
||||||
|
$query->update($db->quoteName('#__componentbuilder_repository'))->set($fields)->where($conditions);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
return $db->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
968
admin/src/Model/RepositoryModel.php
Normal file
968
admin/src/Model/RepositoryModel.php
Normal file
@ -0,0 +1,968 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\Form\Form;
|
||||||
|
use Joomla\CMS\Filter\InputFilter;
|
||||||
|
use Joomla\CMS\Filter\OutputFilter;
|
||||||
|
use Joomla\CMS\MVC\Model\AdminModel;
|
||||||
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\CMS\UCM\UCMType;
|
||||||
|
use Joomla\CMS\Versioning\VersionableModelTrait;
|
||||||
|
use Joomla\CMS\User\User;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
use Joomla\String\StringHelper;
|
||||||
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
use Joomla\Input\Input;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
|
use VDM\Joomla\Utilities\GuidHelper;
|
||||||
|
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||||
|
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||||
|
use VDM\Joomla\Utilities\GetHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Componentbuilder Repository Admin Model
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoryModel extends AdminModel
|
||||||
|
{
|
||||||
|
use VersionableModelTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tab layout fields array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 3.0.0
|
||||||
|
*/
|
||||||
|
protected $tabLayoutFields = array(
|
||||||
|
'details' => array(
|
||||||
|
'left' => array(
|
||||||
|
'type',
|
||||||
|
'base',
|
||||||
|
'username',
|
||||||
|
'token'
|
||||||
|
),
|
||||||
|
'right' => array(
|
||||||
|
'organisation',
|
||||||
|
'repository',
|
||||||
|
'read_branch',
|
||||||
|
'write_branch'
|
||||||
|
),
|
||||||
|
'above' => array(
|
||||||
|
'system_name',
|
||||||
|
'target',
|
||||||
|
'access_repo'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The styles array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
protected array $styles = [
|
||||||
|
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||||
|
'administrator/components/com_componentbuilder/assets/css/repository.css'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scripts array.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
protected array $scripts = [
|
||||||
|
'administrator/components/com_componentbuilder/assets/js/admin.js',
|
||||||
|
'media/com_componentbuilder/js/repository.js'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The prefix to use with controller messages.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $text_prefix = 'COM_COMPONENTBUILDER';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type alias for this content type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public $typeAlias = 'com_componentbuilder.repository';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Table object, always creating it
|
||||||
|
*
|
||||||
|
* @param type $type The table type to instantiate
|
||||||
|
* @param string $prefix A prefix for the table class name. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return Table A database object
|
||||||
|
* @since 3.0
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function getTable($type = 'repository', $prefix = 'Administrator', $config = [])
|
||||||
|
{
|
||||||
|
// get instance of the table
|
||||||
|
return parent::getTable($type, $prefix, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a single record.
|
||||||
|
*
|
||||||
|
* @param integer $pk The id of the primary key.
|
||||||
|
*
|
||||||
|
* @return mixed Object on success, false on failure.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getItem($pk = null)
|
||||||
|
{
|
||||||
|
if ($item = parent::getItem($pk))
|
||||||
|
{
|
||||||
|
if (!empty($item->params) && !is_array($item->params))
|
||||||
|
{
|
||||||
|
// Convert the params field to an array.
|
||||||
|
$registry = new Registry;
|
||||||
|
$registry->loadString($item->params);
|
||||||
|
$item->params = $registry->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item->metadata))
|
||||||
|
{
|
||||||
|
// Convert the metadata field to an array.
|
||||||
|
$registry = new Registry;
|
||||||
|
$registry->loadString($item->metadata);
|
||||||
|
$item->metadata = $registry->toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the record form.
|
||||||
|
*
|
||||||
|
* @param array $data Data for the form.
|
||||||
|
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||||
|
* @param array $options Optional array of options for the form creation.
|
||||||
|
*
|
||||||
|
* @return Form|boolean A Form object on success, false on failure
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getForm($data = [], $loadData = true, $options = ['control' => 'jform'])
|
||||||
|
{
|
||||||
|
// set load data option
|
||||||
|
$options['load_data'] = $loadData;
|
||||||
|
// check if xpath was set in options
|
||||||
|
$xpath = false;
|
||||||
|
if (isset($options['xpath']))
|
||||||
|
{
|
||||||
|
$xpath = $options['xpath'];
|
||||||
|
unset($options['xpath']);
|
||||||
|
}
|
||||||
|
// check if clear form was set in options
|
||||||
|
$clear = false;
|
||||||
|
if (isset($options['clear']))
|
||||||
|
{
|
||||||
|
$clear = $options['clear'];
|
||||||
|
unset($options['clear']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the form.
|
||||||
|
$form = $this->loadForm('com_componentbuilder.repository', 'repository', $options, $clear, $xpath);
|
||||||
|
|
||||||
|
if (empty($form))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jinput = Factory::getApplication()->input;
|
||||||
|
|
||||||
|
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
||||||
|
if ($jinput->get('a_id'))
|
||||||
|
{
|
||||||
|
$id = $jinput->get('a_id', 0, 'INT');
|
||||||
|
}
|
||||||
|
// The back end uses id so we use that the rest of the time and set it to 0 by default.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$id = $jinput->get('id', 0, 'INT');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
// Check for existing item.
|
||||||
|
// Modify the form based on Edit State access controls.
|
||||||
|
if ($id != 0 && (!$user->authorise('repository.edit.state', 'com_componentbuilder.repository.' . (int) $id))
|
||||||
|
|| ($id == 0 && !$user->authorise('repository.edit.state', 'com_componentbuilder')))
|
||||||
|
{
|
||||||
|
// Disable fields for display.
|
||||||
|
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||||
|
$form->setFieldAttribute('published', 'disabled', 'true');
|
||||||
|
// Disable fields while saving.
|
||||||
|
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||||
|
$form->setFieldAttribute('published', 'filter', 'unset');
|
||||||
|
}
|
||||||
|
// If this is a new item insure the greated by is set.
|
||||||
|
if (0 == $id)
|
||||||
|
{
|
||||||
|
// Set the created_by to this user
|
||||||
|
$form->setValue('created_by', null, $user->id);
|
||||||
|
}
|
||||||
|
// Modify the form based on Edit Creaded By access controls.
|
||||||
|
if ($id != 0 && (!$user->authorise('repository.edit.created_by', 'com_componentbuilder.repository.' . (int) $id))
|
||||||
|
|| ($id == 0 && !$user->authorise('repository.edit.created_by', 'com_componentbuilder')))
|
||||||
|
{
|
||||||
|
// Disable fields for display.
|
||||||
|
$form->setFieldAttribute('created_by', 'disabled', 'true');
|
||||||
|
// Disable fields for display.
|
||||||
|
$form->setFieldAttribute('created_by', 'readonly', 'true');
|
||||||
|
// Disable fields while saving.
|
||||||
|
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
||||||
|
}
|
||||||
|
// Modify the form based on Edit Creaded Date access controls.
|
||||||
|
if ($id != 0 && (!$user->authorise('repository.edit.created', 'com_componentbuilder.repository.' . (int) $id))
|
||||||
|
|| ($id == 0 && !$user->authorise('repository.edit.created', 'com_componentbuilder')))
|
||||||
|
{
|
||||||
|
// Disable fields for display.
|
||||||
|
$form->setFieldAttribute('created', 'disabled', 'true');
|
||||||
|
// Disable fields while saving.
|
||||||
|
$form->setFieldAttribute('created', 'filter', 'unset');
|
||||||
|
}
|
||||||
|
// Only load these values if no id is found
|
||||||
|
if (0 == $id)
|
||||||
|
{
|
||||||
|
// Set redirected view name
|
||||||
|
$redirectedView = $jinput->get('ref', null, 'STRING');
|
||||||
|
// Set field name (or fall back to view name)
|
||||||
|
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
|
||||||
|
// Set redirected view id
|
||||||
|
$redirectedId = $jinput->get('refid', 0, 'INT');
|
||||||
|
// Set field id (or fall back to redirected view id)
|
||||||
|
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
|
||||||
|
if (0 != $redirectedValue && $redirectedField)
|
||||||
|
{
|
||||||
|
// Now set the local-redirected field default value
|
||||||
|
$form->setValue($redirectedField, null, $redirectedValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only load the GUID if new item (or empty)
|
||||||
|
if (0 == $id || !($val = $form->getValue('guid')))
|
||||||
|
{
|
||||||
|
$form->setValue('guid', null, GuidHelper::get());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the styles that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return array styles files
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function getStyles(): array
|
||||||
|
{
|
||||||
|
return $this->styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to set the styles that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function setStyles(string $path): void
|
||||||
|
{
|
||||||
|
$this->styles[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the script that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return array script files
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function getScripts(): array
|
||||||
|
{
|
||||||
|
return $this->scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to set the script that have to be included on the view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public function setScript(string $path): void
|
||||||
|
{
|
||||||
|
$this->scripts[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to test whether a record can be deleted.
|
||||||
|
*
|
||||||
|
* @param object $record A record object.
|
||||||
|
*
|
||||||
|
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function canDelete($record)
|
||||||
|
{
|
||||||
|
if (empty($record->id) || ($record->published != -2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The record has been set. Check the record permissions.
|
||||||
|
return $this->getCurrentUser()->authorise('repository.delete', 'com_componentbuilder.repository.' . (int) $record->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to test whether a record can have its state edited.
|
||||||
|
*
|
||||||
|
* @param object $record A record object.
|
||||||
|
*
|
||||||
|
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function canEditState($record)
|
||||||
|
{
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
$recordId = $record->id ?? 0;
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('repository.edit.state', 'com_componentbuilder.repository.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// In the absence of better information, revert to the component permissions.
|
||||||
|
return $user->authorise('repository.edit.state', 'com_componentbuilder');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 2.5
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = [], $key = 'id')
|
||||||
|
{
|
||||||
|
// Check specific edit permission then general edit permission.
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
return $user->authorise('repository.edit', 'com_componentbuilder.repository.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('repository.edit', 'com_componentbuilder');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare and sanitise the table data prior to saving.
|
||||||
|
*
|
||||||
|
* @param Table $table A Table object.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function prepareTable($table)
|
||||||
|
{
|
||||||
|
$date = Factory::getDate();
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
|
||||||
|
if (isset($table->name))
|
||||||
|
{
|
||||||
|
$table->name = \htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($table->alias) && empty($table->alias))
|
||||||
|
{
|
||||||
|
$table->generateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($table->id))
|
||||||
|
{
|
||||||
|
$table->created = $date->toSql();
|
||||||
|
// set the user
|
||||||
|
if ($table->created_by == 0 || empty($table->created_by))
|
||||||
|
{
|
||||||
|
$table->created_by = $user->id;
|
||||||
|
}
|
||||||
|
// Set ordering to the last item if not set
|
||||||
|
if (empty($table->ordering))
|
||||||
|
{
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select('MAX(ordering)')
|
||||||
|
->from($db->quoteName('#__componentbuilder_repository'));
|
||||||
|
$db->setQuery($query);
|
||||||
|
$max = $db->loadResult();
|
||||||
|
|
||||||
|
$table->ordering = $max + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$table->modified = $date->toSql();
|
||||||
|
$table->modified_by = $user->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($table->id))
|
||||||
|
{
|
||||||
|
// Increment the items version number.
|
||||||
|
$table->version++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the data that should be injected in the form.
|
||||||
|
*
|
||||||
|
* @return mixed The data for the form.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function loadFormData()
|
||||||
|
{
|
||||||
|
// Check the session for previously entered form data.
|
||||||
|
$data = Factory::getApplication()->getUserState('com_componentbuilder.edit.repository.data', []);
|
||||||
|
|
||||||
|
if (empty($data))
|
||||||
|
{
|
||||||
|
$data = $this->getItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
// run the perprocess of the data
|
||||||
|
$this->preprocessData('com_componentbuilder.repository', $data);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the unique fields of this table.
|
||||||
|
*
|
||||||
|
* @return mixed An array of field names, boolean false if none is set.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
protected function getUniqueFields()
|
||||||
|
{
|
||||||
|
return array('guid');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to delete one or more records.
|
||||||
|
*
|
||||||
|
* @param array &$pks An array of record primary keys.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false if an error occurs
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function delete(&$pks)
|
||||||
|
{
|
||||||
|
if (!parent::delete($pks))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to change the published state of one or more records.
|
||||||
|
*
|
||||||
|
* @param array &$pks A list of the primary keys to change.
|
||||||
|
* @param integer $value The value of the published state.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function publish(&$pks, $value = 1)
|
||||||
|
{
|
||||||
|
if (!parent::publish($pks, $value))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to perform batch operations on an item or a set of items.
|
||||||
|
*
|
||||||
|
* @param array $commands An array of commands to perform.
|
||||||
|
* @param array $pks An array of item ids.
|
||||||
|
* @param array $contexts An array of item contexts.
|
||||||
|
*
|
||||||
|
* @return boolean Returns true on success, false on failure.
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function batch($commands, $pks, $contexts)
|
||||||
|
{
|
||||||
|
// Sanitize ids.
|
||||||
|
$pks = array_unique($pks);
|
||||||
|
ArrayHelper::toInteger($pks);
|
||||||
|
|
||||||
|
// Remove any values of zero.
|
||||||
|
if (array_search(0, $pks, true))
|
||||||
|
{
|
||||||
|
unset($pks[array_search(0, $pks, true)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($pks))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$done = false;
|
||||||
|
|
||||||
|
// Set some needed variables.
|
||||||
|
$this->user ??= $this->getCurrentUser();
|
||||||
|
$this->table = $this->getTable();
|
||||||
|
$this->tableClassName = get_class($this->table);
|
||||||
|
$this->contentType = new UCMType;
|
||||||
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||||
|
$this->canDo = ComponentbuilderHelper::getActions('repository');
|
||||||
|
$this->batchSet = true;
|
||||||
|
|
||||||
|
if (!$this->canDo->get('core.batch'))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->type == false)
|
||||||
|
{
|
||||||
|
$type = new UCMType;
|
||||||
|
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||||
|
|
||||||
|
if (!empty($commands['move_copy']))
|
||||||
|
{
|
||||||
|
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||||
|
|
||||||
|
if ($cmd == 'c')
|
||||||
|
{
|
||||||
|
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||||
|
|
||||||
|
if (is_array($result))
|
||||||
|
{
|
||||||
|
foreach ($result as $old => $new)
|
||||||
|
{
|
||||||
|
$contexts[$new] = $contexts[$old];
|
||||||
|
}
|
||||||
|
$pks = array_values($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$done)
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch copy items to a new category or current.
|
||||||
|
*
|
||||||
|
* @param integer $values The new values.
|
||||||
|
* @param array $pks An array of row IDs.
|
||||||
|
* @param array $contexts An array of item contexts.
|
||||||
|
*
|
||||||
|
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function batchCopy($values, $pks, $contexts)
|
||||||
|
{
|
||||||
|
if (empty($this->batchSet))
|
||||||
|
{
|
||||||
|
// Set some needed variables.
|
||||||
|
$this->user = Factory::getApplication()->getIdentity();
|
||||||
|
$this->table = $this->getTable();
|
||||||
|
$this->tableClassName = get_class($this->table);
|
||||||
|
$this->canDo = ComponentbuilderHelper::getActions('repository');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->canDo->get('repository.create') && !$this->canDo->get('repository.batch'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get list of unique fields
|
||||||
|
$uniqueFields = $this->getUniqueFields();
|
||||||
|
// remove move_copy from array
|
||||||
|
unset($values['move_copy']);
|
||||||
|
|
||||||
|
// make sure published is set
|
||||||
|
if (!isset($values['published']))
|
||||||
|
{
|
||||||
|
$values['published'] = 0;
|
||||||
|
}
|
||||||
|
elseif (isset($values['published']) && !$this->canDo->get('repository.edit.state'))
|
||||||
|
{
|
||||||
|
$values['published'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newIds = [];
|
||||||
|
// Parent exists so let's proceed
|
||||||
|
while (!empty($pks))
|
||||||
|
{
|
||||||
|
// Pop the first ID off the stack
|
||||||
|
$pk = array_shift($pks);
|
||||||
|
|
||||||
|
$this->table->reset();
|
||||||
|
|
||||||
|
// only allow copy if user may edit this item.
|
||||||
|
if (!$this->user->authorise('repository.edit', $contexts[$pk]))
|
||||||
|
{
|
||||||
|
// Not fatal error
|
||||||
|
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the row actually exists
|
||||||
|
if (!$this->table->load($pk))
|
||||||
|
{
|
||||||
|
if ($error = $this->table->getError())
|
||||||
|
{
|
||||||
|
// Fatal error
|
||||||
|
$this->setError($error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not fatal error
|
||||||
|
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only for strings
|
||||||
|
if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name))
|
||||||
|
{
|
||||||
|
$this->table->system_name = $this->generateUnique('system_name',$this->table->system_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert all set values
|
||||||
|
if (UtilitiesArrayHelper::check($values))
|
||||||
|
{
|
||||||
|
foreach ($values as $key => $value)
|
||||||
|
{
|
||||||
|
if (strlen($value) > 0 && isset($this->table->$key))
|
||||||
|
{
|
||||||
|
$this->table->$key = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update all unique fields
|
||||||
|
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||||
|
{
|
||||||
|
foreach ($uniqueFields as $uniqueField)
|
||||||
|
{
|
||||||
|
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the ID because we are making a copy
|
||||||
|
$this->table->id = 0;
|
||||||
|
|
||||||
|
// TODO: Deal with ordering?
|
||||||
|
// $this->table->ordering = 1;
|
||||||
|
|
||||||
|
// Check the row.
|
||||||
|
if (!$this->table->check())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->type))
|
||||||
|
{
|
||||||
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the row.
|
||||||
|
if (!$this->table->store())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the new item ID
|
||||||
|
$newId = $this->table->get('id');
|
||||||
|
|
||||||
|
// Add the new ID to the array
|
||||||
|
$newIds[$pk] = $newId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return $newIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch move items to a new category
|
||||||
|
*
|
||||||
|
* @param integer $value The new category ID.
|
||||||
|
* @param array $pks An array of row IDs.
|
||||||
|
* @param array $contexts An array of item contexts.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function batchMove($values, $pks, $contexts)
|
||||||
|
{
|
||||||
|
if (empty($this->batchSet))
|
||||||
|
{
|
||||||
|
// Set some needed variables.
|
||||||
|
$this->user = Factory::getApplication()->getIdentity();
|
||||||
|
$this->table = $this->getTable();
|
||||||
|
$this->tableClassName = get_class($this->table);
|
||||||
|
$this->canDo = ComponentbuilderHelper::getActions('repository');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->canDo->get('repository.edit') && !$this->canDo->get('repository.batch'))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure published only updates if user has the permission.
|
||||||
|
if (isset($values['published']) && !$this->canDo->get('repository.edit.state'))
|
||||||
|
{
|
||||||
|
unset($values['published']);
|
||||||
|
}
|
||||||
|
// remove move_copy from array
|
||||||
|
unset($values['move_copy']);
|
||||||
|
|
||||||
|
// Parent exists so we proceed
|
||||||
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
|
if (!$this->user->authorise('repository.edit', $contexts[$pk]))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the row actually exists
|
||||||
|
if (!$this->table->load($pk))
|
||||||
|
{
|
||||||
|
if ($error = $this->table->getError())
|
||||||
|
{
|
||||||
|
// Fatal error
|
||||||
|
$this->setError($error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not fatal error
|
||||||
|
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert all set values.
|
||||||
|
if (UtilitiesArrayHelper::check($values))
|
||||||
|
{
|
||||||
|
foreach ($values as $key => $value)
|
||||||
|
{
|
||||||
|
// Do special action for access.
|
||||||
|
if ('access' === $key && strlen($value) > 0)
|
||||||
|
{
|
||||||
|
$this->table->$key = $value;
|
||||||
|
}
|
||||||
|
elseif (strlen($value) > 0 && isset($this->table->$key))
|
||||||
|
{
|
||||||
|
$this->table->$key = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check the row.
|
||||||
|
if (!$this->table->check())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->type))
|
||||||
|
{
|
||||||
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the row.
|
||||||
|
if (!$this->table->store())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save the form data.
|
||||||
|
*
|
||||||
|
* @param array $data The form data.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function save($data)
|
||||||
|
{
|
||||||
|
$input = Factory::getApplication()->getInput();
|
||||||
|
$filter = InputFilter::getInstance();
|
||||||
|
|
||||||
|
// set the metadata to the Item Data
|
||||||
|
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||||
|
{
|
||||||
|
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||||
|
|
||||||
|
$metadata = new Registry;
|
||||||
|
$metadata->loadArray($data['metadata']);
|
||||||
|
$data['metadata'] = (string) $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the GUID if empty or not valid
|
||||||
|
if (empty($data['guid']) && $data['id'] > 0)
|
||||||
|
{
|
||||||
|
// get the existing one
|
||||||
|
$data['guid'] = (string) GetHelper::var('repository', $data['id'], 'id', 'guid');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the GUID if empty or not valid
|
||||||
|
while (!GuidHelper::valid($data['guid'], "repository", $data['id']))
|
||||||
|
{
|
||||||
|
// must always be set
|
||||||
|
$data['guid'] = (string) GuidHelper::get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the Params Items to data
|
||||||
|
if (isset($data['params']) && is_array($data['params']))
|
||||||
|
{
|
||||||
|
$params = new Registry;
|
||||||
|
$params->loadArray($data['params']);
|
||||||
|
$data['params'] = (string) $params;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alter the unique field for save as copy
|
||||||
|
if ($input->get('task') === 'save2copy')
|
||||||
|
{
|
||||||
|
// Automatic handling of other unique fields
|
||||||
|
$uniqueFields = $this->getUniqueFields();
|
||||||
|
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||||
|
{
|
||||||
|
foreach ($uniqueFields as $uniqueField)
|
||||||
|
{
|
||||||
|
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent::save($data))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to generate a unique value.
|
||||||
|
*
|
||||||
|
* @param string $field name.
|
||||||
|
* @param string $value data.
|
||||||
|
*
|
||||||
|
* @return string New value.
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
protected function generateUnique($field, $value)
|
||||||
|
{
|
||||||
|
// set field value unique
|
||||||
|
$table = $this->getTable();
|
||||||
|
|
||||||
|
while ($table->load([$field => $value]))
|
||||||
|
{
|
||||||
|
$value = StringHelper::increment($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to change the title
|
||||||
|
*
|
||||||
|
* @param string $title The title.
|
||||||
|
*
|
||||||
|
* @return array Contains the modified title and alias.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function _generateNewTitle($title)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Alter the title
|
||||||
|
$table = $this->getTable();
|
||||||
|
|
||||||
|
while ($table->load(['title' => $title]))
|
||||||
|
{
|
||||||
|
$title = StringHelper::increment($title);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
}
|
377
admin/src/Table/RepositoryTable.php
Normal file
377
admin/src/Table/RepositoryTable.php
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\Table;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\String\PunycodeHelper;
|
||||||
|
use Joomla\CMS\Access\Access as AccessRules;
|
||||||
|
use Joomla\CMS\Access\Rules;
|
||||||
|
use Joomla\CMS\Tag\TaggableTableInterface;
|
||||||
|
use Joomla\CMS\Tag\TaggableTableTrait;
|
||||||
|
use Joomla\CMS\User\CurrentUserInterface;
|
||||||
|
use Joomla\CMS\User\CurrentUserTrait;
|
||||||
|
use Joomla\CMS\Versioning\VersionableTableInterface;
|
||||||
|
use Joomla\CMS\Application\ApplicationHelper;
|
||||||
|
use Joomla\Database\DatabaseInterface;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
use Joomla\Database\DatabaseDriver;
|
||||||
|
use Joomla\Event\DispatcherInterface;
|
||||||
|
use Joomla\String\StringHelper;
|
||||||
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositories Table class
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class RepositoryTable extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface
|
||||||
|
{
|
||||||
|
use TaggableTableTrait;
|
||||||
|
use CurrentUserTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DatabaseDriver $db Database connector object
|
||||||
|
* @param ?DispatcherInterface $dispatcher Event dispatcher for this table
|
||||||
|
*
|
||||||
|
* @param object Database connector object
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
|
||||||
|
{
|
||||||
|
// The type alias generally is the internal component name with the
|
||||||
|
// content type. Ex.: com_content.article
|
||||||
|
$this->typeAlias = 'com_componentbuilder.repository';
|
||||||
|
|
||||||
|
// Ensure the params and metadata in json encoded in the bind method
|
||||||
|
$this->_jsonEncode = ['params', 'metadata'];
|
||||||
|
|
||||||
|
// Indicates that columns fully support the NULL value in the database
|
||||||
|
// $this->_supportNullValue = true; // hmmm will keep an eye on this ;)
|
||||||
|
|
||||||
|
parent::__construct('#__componentbuilder_repository', 'id', $db, $dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to bind an associative array or object to the Table instance.This
|
||||||
|
* method only binds properties that are publicly accessible and optionally
|
||||||
|
* takes an array of properties to ignore when binding.
|
||||||
|
*
|
||||||
|
* @param array|object $src An associative array or object to bind to the Table instance.
|
||||||
|
* @param array|string $ignore An optional array or space separated list of properties to ignore while binding.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 1.7.0
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function bind($array, $ignore = '')
|
||||||
|
{
|
||||||
|
// Bind the rules.
|
||||||
|
if (isset($array['rules']) && is_array($array['rules']))
|
||||||
|
{
|
||||||
|
$rules = new AccessRules($array['rules']);
|
||||||
|
$this->setRules($rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::bind($array, $ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overload the store method for the Repository table.
|
||||||
|
*
|
||||||
|
* @param boolean Toggle whether null values should be updated.
|
||||||
|
*
|
||||||
|
* @return boolean True on success, false on failure.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function store($updateNulls = false)
|
||||||
|
{
|
||||||
|
$date = Factory::getDate()->toSql();
|
||||||
|
$userId = $this->getCurrentUser()->id;
|
||||||
|
|
||||||
|
if ($this->id)
|
||||||
|
{
|
||||||
|
// Existing item
|
||||||
|
$this->modified = $date;
|
||||||
|
$this->modified_by = $userId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// New repository. A repository created and created_by field can be set by the user,
|
||||||
|
// so we don't touch either of these if they are set.
|
||||||
|
if (!(int) $this->created)
|
||||||
|
{
|
||||||
|
$this->created = $date;
|
||||||
|
}
|
||||||
|
if (empty($this->created_by))
|
||||||
|
{
|
||||||
|
$this->created_by = $userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->alias))
|
||||||
|
{
|
||||||
|
// Verify that the alias is unique
|
||||||
|
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||||
|
|
||||||
|
if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_COMPONENTBUILDER_REPOSITORY_ERROR_UNIQUE_ALIAS'));
|
||||||
|
|
||||||
|
if ($table->published === -2)
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_COMPONENTBUILDER_REPOSITORY_ERROR_UNIQUE_ALIAS_TRASHED'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->url))
|
||||||
|
{
|
||||||
|
// Convert IDN urls to punycode
|
||||||
|
$this->url = PunycodeHelper::urlToPunycode($this->url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->website))
|
||||||
|
{
|
||||||
|
// Convert IDN urls to punycode
|
||||||
|
$this->website = PunycodeHelper::urlToPunycode($this->website);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::store($updateNulls);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloaded check method to ensure data integrity.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @see \Joomla\CMS\Table\Table::check
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function check()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
parent::check();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->alias))
|
||||||
|
{
|
||||||
|
// Generate a valid alias
|
||||||
|
$this->generateAlias();
|
||||||
|
|
||||||
|
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||||
|
|
||||||
|
while ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0))
|
||||||
|
{
|
||||||
|
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clean up keywords -- eliminate extra spaces between phrases
|
||||||
|
* and cr (\r) and lf (\n) characters from string.
|
||||||
|
* Only process if not empty.
|
||||||
|
*/
|
||||||
|
if (!empty($this->metakey))
|
||||||
|
{
|
||||||
|
// Array of characters to remove.
|
||||||
|
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||||
|
|
||||||
|
// Remove bad characters.
|
||||||
|
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||||
|
|
||||||
|
// Create array using commas as delimiter.
|
||||||
|
$keys = explode(',', $after_clean);
|
||||||
|
$clean_keys = [];
|
||||||
|
|
||||||
|
foreach ($keys as $key)
|
||||||
|
{
|
||||||
|
// Ignore blank keywords.
|
||||||
|
if (trim($key))
|
||||||
|
{
|
||||||
|
$clean_keys[] = trim($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put array back together delimited by ", "
|
||||||
|
$this->metakey = implode(", ", $clean_keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up description -- eliminate quotes and <> brackets
|
||||||
|
if (!empty($this->metadesc))
|
||||||
|
{
|
||||||
|
// Only process if not empty
|
||||||
|
$bad_characters = array("\"", "<", ">");
|
||||||
|
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we don't have any access rules set at this point just use an empty AccessRules class
|
||||||
|
if (!$this->getRules())
|
||||||
|
{
|
||||||
|
$rules = $this->getDefaultAssetValues('com_componentbuilder.repository.'.$this->id);
|
||||||
|
$this->setRules($rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set ordering
|
||||||
|
if ($this->published < 0)
|
||||||
|
{
|
||||||
|
// Set ordering to 0 if state is archived or trashed
|
||||||
|
$this->ordering = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default asset values for a component.
|
||||||
|
*
|
||||||
|
* @param $string $component The component asset name to search for
|
||||||
|
*
|
||||||
|
* @return AccessRules The AccessRules object for the asset
|
||||||
|
*/
|
||||||
|
protected function getDefaultAssetValues($component, $try = true)
|
||||||
|
{
|
||||||
|
// Need to find the asset id by the name of the component.
|
||||||
|
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('id'))
|
||||||
|
->from($db->quoteName('#__assets'))
|
||||||
|
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
if ($db->loadRowList())
|
||||||
|
{
|
||||||
|
// asset already set so use saved rules
|
||||||
|
$assetId = (int) $db->loadResult();
|
||||||
|
return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||||
|
}
|
||||||
|
// try again
|
||||||
|
elseif ($try)
|
||||||
|
{
|
||||||
|
$try = explode('.',$component);
|
||||||
|
$result = $this->getDefaultAssetValues($try[0], false);
|
||||||
|
if ($result instanceof AccessRules)
|
||||||
|
{
|
||||||
|
if (isset($try[1]))
|
||||||
|
{
|
||||||
|
$_result = (string) $result;
|
||||||
|
$_result = json_decode($_result);
|
||||||
|
foreach ($_result as $name => &$rule)
|
||||||
|
{
|
||||||
|
$v = explode('.', $name);
|
||||||
|
if ($try[1] !== $v[0])
|
||||||
|
{
|
||||||
|
// remove since it is not part of this view
|
||||||
|
unset($_result->$name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// clear the value since we inherit
|
||||||
|
$rule = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check if there are any view values remaining
|
||||||
|
if (count( (array) $_result))
|
||||||
|
{
|
||||||
|
$_result = json_encode($_result);
|
||||||
|
$_result = array($_result);
|
||||||
|
// Instantiate and return the AccessRules object for the asset rules.
|
||||||
|
$rules = new AccessRules;
|
||||||
|
$rules->mergeCollection($_result);
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AccessRules::getAssetRules(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type alias for the history table
|
||||||
|
*
|
||||||
|
* The type alias generally is the internal component name with the
|
||||||
|
* content type. Ex.: com_content.article
|
||||||
|
*
|
||||||
|
* @return string The alias as described above
|
||||||
|
*
|
||||||
|
* @since 3.10.0
|
||||||
|
*/
|
||||||
|
public function getTypeAlias()
|
||||||
|
{
|
||||||
|
return $this->typeAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to compute the default name of the asset.
|
||||||
|
* The default name is in the form table_name.id
|
||||||
|
* where id is the value of the primary key of the table.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.7.0
|
||||||
|
*/
|
||||||
|
protected function _getAssetName()
|
||||||
|
{
|
||||||
|
$k = $this->_tbl_key;
|
||||||
|
|
||||||
|
return $this->getTypeAlias() . '.' . (int) $this->$k;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the parent asset under which to register this one.
|
||||||
|
*
|
||||||
|
* By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists.
|
||||||
|
* An extended class can define a table and ID to lookup. If the asset does not exist it will be created.
|
||||||
|
*
|
||||||
|
* @param Table $table A Table object for the asset parent.
|
||||||
|
* @param integer $id Id to look up
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*
|
||||||
|
* @since 1.7.0
|
||||||
|
*/
|
||||||
|
protected function _getAssetParentId(Table $table = null, $id = null)
|
||||||
|
{
|
||||||
|
/** @var Asset $assets */
|
||||||
|
$assets = self::getInstance('Asset', 'JTable', ['dbo' => $this->getDbo()]);
|
||||||
|
$rootId = $assets->getRootId();
|
||||||
|
|
||||||
|
// load the componentbuilder asset
|
||||||
|
$assets->loadByName('com_componentbuilder');
|
||||||
|
|
||||||
|
return $assets->id ?? $rootId ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This view does not actually have an alias
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function generateAlias()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -253,7 +253,7 @@ class HtmlView extends BaseHtmlView
|
|||||||
// add var key
|
// add var key
|
||||||
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
|
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
|
||||||
// add return_here
|
// add return_here
|
||||||
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
|
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
|
||||||
// set some lang
|
// set some lang
|
||||||
Text::script('COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER');
|
Text::script('COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER');
|
||||||
Text::script('COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS');
|
Text::script('COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS');
|
||||||
|
221
admin/src/View/Repositories/HtmlView.php
Normal file
221
admin/src/View/Repositories/HtmlView.php
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\View\Repositories;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Toolbar\Toolbar;
|
||||||
|
use Joomla\CMS\Form\FormHelper;
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Layout\FileLayout;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
use Joomla\CMS\Document\Document;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Componentbuilder Html View class for the Repositories
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class HtmlView extends BaseHtmlView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Repositories view display method
|
||||||
|
*
|
||||||
|
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
// Assign data to the view
|
||||||
|
$this->items = $this->get('Items');
|
||||||
|
$this->pagination = $this->get('Pagination');
|
||||||
|
$this->state = $this->get('State');
|
||||||
|
$this->styles = $this->get('Styles');
|
||||||
|
$this->scripts = $this->get('Scripts');
|
||||||
|
$this->user ??= Factory::getApplication()->getIdentity();
|
||||||
|
// Load the filter form from xml.
|
||||||
|
$this->filterForm = $this->get('FilterForm');
|
||||||
|
// Load the active filters.
|
||||||
|
$this->activeFilters = $this->get('ActiveFilters');
|
||||||
|
// Add the list ordering clause.
|
||||||
|
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
|
||||||
|
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
|
||||||
|
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||||
|
// set the return here value
|
||||||
|
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
|
||||||
|
// get global action permissions
|
||||||
|
$this->canDo = ComponentbuilderHelper::getActions('repository');
|
||||||
|
$this->canEdit = $this->canDo->get('repository.edit');
|
||||||
|
$this->canState = $this->canDo->get('repository.edit.state');
|
||||||
|
$this->canCreate = $this->canDo->get('repository.create');
|
||||||
|
$this->canDelete = $this->canDo->get('repository.delete');
|
||||||
|
$this->canBatch = ($this->canDo->get('repository.batch') && $this->canDo->get('core.batch'));
|
||||||
|
|
||||||
|
// If we don't have items we load the empty state
|
||||||
|
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
|
||||||
|
{
|
||||||
|
$this->setLayout('emptystate');
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't need toolbar in the modal window.
|
||||||
|
if ($this->getLayout() !== 'modal')
|
||||||
|
{
|
||||||
|
$this->addToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
throw new \Exception(implode("\n", $errors), 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the html view document stuff
|
||||||
|
$this->_prepareDocument();
|
||||||
|
|
||||||
|
// Display the template
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the page title and toolbar.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function addToolbar(): void
|
||||||
|
{
|
||||||
|
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_REPOSITORIES'), 'share');
|
||||||
|
|
||||||
|
if ($this->canCreate)
|
||||||
|
{
|
||||||
|
ToolbarHelper::addNew('repository.add');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only load if there are items
|
||||||
|
if (ArrayHelper::check($this->items))
|
||||||
|
{
|
||||||
|
if ($this->canEdit)
|
||||||
|
{
|
||||||
|
ToolbarHelper::editList('repository.edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->canState)
|
||||||
|
{
|
||||||
|
ToolbarHelper::publishList('repositories.publish');
|
||||||
|
ToolbarHelper::unpublishList('repositories.unpublish');
|
||||||
|
ToolbarHelper::archiveList('repositories.archive');
|
||||||
|
|
||||||
|
if ($this->canDo->get('core.admin'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::checkin('repositories.checkin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||||
|
{
|
||||||
|
ToolbarHelper::deleteList('', 'repositories.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||||
|
}
|
||||||
|
elseif ($this->canState && $this->canDelete)
|
||||||
|
{
|
||||||
|
ToolbarHelper::trash('repositories.trash');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set help url for this view if found
|
||||||
|
$this->help_url = ComponentbuilderHelper::getHelpUrl('repositories');
|
||||||
|
if (StringHelper::check($this->help_url))
|
||||||
|
{
|
||||||
|
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the options comp button
|
||||||
|
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::preferences('com_componentbuilder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare some document related stuff.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function _prepareDocument(): void
|
||||||
|
{
|
||||||
|
// Load jQuery
|
||||||
|
Html::_('jquery.framework');
|
||||||
|
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_REPOSITORIES'));
|
||||||
|
// add styles
|
||||||
|
foreach ($this->styles as $style)
|
||||||
|
{
|
||||||
|
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||||
|
}
|
||||||
|
// add scripts
|
||||||
|
foreach ($this->scripts as $script)
|
||||||
|
{
|
||||||
|
Html::_('script', $script, ['version' => 'auto']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes a value for output in a view script.
|
||||||
|
*
|
||||||
|
* @param mixed $var The output to escape.
|
||||||
|
* @param bool $shorten The switch to shorten.
|
||||||
|
* @param int $length The shorting length.
|
||||||
|
*
|
||||||
|
* @return mixed The escaped value.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function escape($var, bool $shorten = true, int $length = 50)
|
||||||
|
{
|
||||||
|
if (!is_string($var))
|
||||||
|
{
|
||||||
|
return $var;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of fields the table can be sorted by
|
||||||
|
*
|
||||||
|
* @return array containing the field name to sort by as the key and display text as value
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function getSortFields()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
|
||||||
|
'a.published' => Text::_('JSTATUS'),
|
||||||
|
'a.organisation' => Text::_('COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_LABEL'),
|
||||||
|
'a.repository' => Text::_('COM_COMPONENTBUILDER_REPOSITORY_REPOSITORY_LABEL'),
|
||||||
|
'a.target' => Text::_('COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL'),
|
||||||
|
'a.type' => Text::_('COM_COMPONENTBUILDER_REPOSITORY_TYPE_LABEL'),
|
||||||
|
'a.base' => Text::_('COM_COMPONENTBUILDER_REPOSITORY_BASE_LABEL'),
|
||||||
|
'a.id' => Text::_('JGRID_HEADING_ID')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
231
admin/src/View/Repository/HtmlView.php
Normal file
231
admin/src/View/Repository/HtmlView.php
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
namespace VDM\Component\Componentbuilder\Administrator\View\Repository;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Toolbar\Toolbar;
|
||||||
|
use Joomla\CMS\Form\FormHelper;
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Layout\FileLayout;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
use Joomla\CMS\Document\Document;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository Html View class
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class HtmlView extends BaseHtmlView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Repository view display method
|
||||||
|
*
|
||||||
|
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
// set params
|
||||||
|
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||||
|
$this->useCoreUI = true;
|
||||||
|
// Assign the variables
|
||||||
|
$this->form = $this->get('Form');
|
||||||
|
$this->item = $this->get('Item');
|
||||||
|
$this->styles = $this->get('Styles');
|
||||||
|
$this->scripts = $this->get('Scripts');
|
||||||
|
$this->state = $this->get('State');
|
||||||
|
// get action permissions
|
||||||
|
$this->canDo = ComponentbuilderHelper::getActions('repository', $this->item);
|
||||||
|
// get input
|
||||||
|
$jinput = Factory::getApplication()->input;
|
||||||
|
$this->ref = $jinput->get('ref', 0, 'word');
|
||||||
|
$this->refid = $jinput->get('refid', 0, 'int');
|
||||||
|
$return = $jinput->get('return', null, 'base64');
|
||||||
|
// set the referral string
|
||||||
|
$this->referral = '';
|
||||||
|
if ($this->refid && $this->ref)
|
||||||
|
{
|
||||||
|
// return to the item that referred to this item
|
||||||
|
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
|
||||||
|
}
|
||||||
|
elseif($this->ref)
|
||||||
|
{
|
||||||
|
// return to the list view that referred to this item
|
||||||
|
$this->referral = '&ref=' . (string) $this->ref;
|
||||||
|
}
|
||||||
|
// check return value
|
||||||
|
if (!is_null($return))
|
||||||
|
{
|
||||||
|
// add the return value
|
||||||
|
$this->referral .= '&return=' . (string) $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the toolbar
|
||||||
|
$this->addToolBar();
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
throw new \Exception(implode("\n", $errors), 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the html view document stuff
|
||||||
|
$this->_prepareDocument();
|
||||||
|
|
||||||
|
// Display the template
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the page title and toolbar.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function addToolbar(): void
|
||||||
|
{
|
||||||
|
Factory::getApplication()->input->set('hidemainmenu', true);
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
$userId = $user->id;
|
||||||
|
$isNew = $this->item->id == 0;
|
||||||
|
|
||||||
|
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_REPOSITORY_NEW' : 'COM_COMPONENTBUILDER_REPOSITORY_EDIT'), 'pencil-2 article-add');
|
||||||
|
// Built the actions for new and existing records.
|
||||||
|
if (StringHelper::check($this->referral))
|
||||||
|
{
|
||||||
|
if ($this->canDo->get('repository.create') && $isNew)
|
||||||
|
{
|
||||||
|
// We can create the record.
|
||||||
|
ToolbarHelper::save('repository.save', 'JTOOLBAR_SAVE');
|
||||||
|
}
|
||||||
|
elseif ($this->canDo->get('repository.edit'))
|
||||||
|
{
|
||||||
|
// We can save the record.
|
||||||
|
ToolbarHelper::save('repository.save', 'JTOOLBAR_SAVE');
|
||||||
|
}
|
||||||
|
if ($isNew)
|
||||||
|
{
|
||||||
|
// Do not creat but cancel.
|
||||||
|
ToolbarHelper::cancel('repository.cancel', 'JTOOLBAR_CANCEL');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We can close it.
|
||||||
|
ToolbarHelper::cancel('repository.cancel', 'JTOOLBAR_CLOSE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($isNew)
|
||||||
|
{
|
||||||
|
// For new records, check the create permission.
|
||||||
|
if ($this->canDo->get('repository.create'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::apply('repository.apply', 'JTOOLBAR_APPLY');
|
||||||
|
ToolbarHelper::save('repository.save', 'JTOOLBAR_SAVE');
|
||||||
|
ToolbarHelper::custom('repository.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||||
|
};
|
||||||
|
ToolbarHelper::cancel('repository.cancel', 'JTOOLBAR_CANCEL');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->canDo->get('repository.edit'))
|
||||||
|
{
|
||||||
|
// We can save the new record
|
||||||
|
ToolbarHelper::apply('repository.apply', 'JTOOLBAR_APPLY');
|
||||||
|
ToolbarHelper::save('repository.save', 'JTOOLBAR_SAVE');
|
||||||
|
// We can save this record, but check the create permission to see
|
||||||
|
// if we can return to make a new one.
|
||||||
|
if ($this->canDo->get('repository.create'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::custom('repository.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('repository.version'));
|
||||||
|
if ($this->state->params->get('save_history', 1) && $this->canDo->get('repository.edit') && $canVersion)
|
||||||
|
{
|
||||||
|
ToolbarHelper::versions('com_componentbuilder.repository', $this->item->id);
|
||||||
|
}
|
||||||
|
if ($this->canDo->get('repository.create'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::custom('repository.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||||
|
}
|
||||||
|
ToolbarHelper::cancel('repository.cancel', 'JTOOLBAR_CLOSE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ToolbarHelper::divider();
|
||||||
|
ToolbarHelper::inlinehelp();
|
||||||
|
// set help url for this view if found
|
||||||
|
$this->help_url = ComponentbuilderHelper::getHelpUrl('repository');
|
||||||
|
if (StringHelper::check($this->help_url))
|
||||||
|
{
|
||||||
|
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes a value for output in a view script.
|
||||||
|
*
|
||||||
|
* @param mixed $var The output to escape.
|
||||||
|
* @param bool $shorten The switch to shorten.
|
||||||
|
* @param int $length The shorting length.
|
||||||
|
*
|
||||||
|
* @return mixed The escaped value.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function escape($var, bool $shorten = true, int $length = 30)
|
||||||
|
{
|
||||||
|
if (!is_string($var))
|
||||||
|
{
|
||||||
|
return $var;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare some document related stuff.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function _prepareDocument(): void
|
||||||
|
{
|
||||||
|
// Load jQuery
|
||||||
|
Html::_('jquery.framework');
|
||||||
|
$isNew = ($this->item->id < 1);
|
||||||
|
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_REPOSITORY_NEW' : 'COM_COMPONENTBUILDER_REPOSITORY_EDIT'));
|
||||||
|
// add styles
|
||||||
|
foreach ($this->styles as $style)
|
||||||
|
{
|
||||||
|
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||||
|
}
|
||||||
|
// add scripts
|
||||||
|
foreach ($this->scripts as $script)
|
||||||
|
{
|
||||||
|
Html::_('script', $script, ['version' => 'auto']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -206,40 +206,6 @@ jQuery('#adminForm').on('change', '#jform_datatype',function (e)
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// #jform_store listeners for store_vvvvwbj function
|
|
||||||
jQuery('#jform_store').on('keyup',function()
|
|
||||||
{
|
|
||||||
var store_vvvvwbj = jQuery("#jform_store").val();
|
|
||||||
var datatype_vvvvwbj = jQuery("#jform_datatype").val();
|
|
||||||
vvvvwbj(store_vvvvwbj,datatype_vvvvwbj);
|
|
||||||
|
|
||||||
});
|
|
||||||
jQuery('#adminForm').on('change', '#jform_store',function (e)
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
var store_vvvvwbj = jQuery("#jform_store").val();
|
|
||||||
var datatype_vvvvwbj = jQuery("#jform_datatype").val();
|
|
||||||
vvvvwbj(store_vvvvwbj,datatype_vvvvwbj);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// #jform_datatype listeners for datatype_vvvvwbj function
|
|
||||||
jQuery('#jform_datatype').on('keyup',function()
|
|
||||||
{
|
|
||||||
var store_vvvvwbj = jQuery("#jform_store").val();
|
|
||||||
var datatype_vvvvwbj = jQuery("#jform_datatype").val();
|
|
||||||
vvvvwbj(store_vvvvwbj,datatype_vvvvwbj);
|
|
||||||
|
|
||||||
});
|
|
||||||
jQuery('#adminForm').on('change', '#jform_datatype',function (e)
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
var store_vvvvwbj = jQuery("#jform_store").val();
|
|
||||||
var datatype_vvvvwbj = jQuery("#jform_datatype").val();
|
|
||||||
vvvvwbj(store_vvvvwbj,datatype_vvvvwbj);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// #jform_store listeners for store_vvvvwbl function
|
// #jform_store listeners for store_vvvvwbl function
|
||||||
jQuery('#jform_store').on('keyup',function()
|
jQuery('#jform_store').on('keyup',function()
|
||||||
{
|
{
|
||||||
|
51
admin/tmpl/repositories/default.php
Normal file
51
admin/tmpl/repositories/default.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
if ($this->saveOrder)
|
||||||
|
{
|
||||||
|
$saveOrderingUrl = 'index.php?option=com_componentbuilder&task=repositories.saveOrderAjax&tmpl=component';
|
||||||
|
Html::_('sortablelist.sortable', 'repositoryList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&view=repositories'); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
|
<div id="j-main-container">
|
||||||
|
<?php
|
||||||
|
// Add the trash helper layout
|
||||||
|
echo LayoutHelper::render('trashhelper', $this);
|
||||||
|
// Add the searchtools
|
||||||
|
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this));
|
||||||
|
?>
|
||||||
|
<?php if (empty($this->items)): ?>
|
||||||
|
<div class="alert alert-no-items">
|
||||||
|
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<table class="table table-striped" id="repositoryList">
|
||||||
|
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||||
|
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||||
|
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||||
|
</table>
|
||||||
|
<input type="hidden" name="boxchecked" value="0" />
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="hidden" name="task" value="" />
|
||||||
|
<?php echo Html::_('form.token'); ?>
|
||||||
|
</form>
|
113
admin/tmpl/repositories/default_body.php
Normal file
113
admin/tmpl/repositories/default_body.php
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
$edit = "index.php?option=com_componentbuilder&view=repositories&task=repository.edit";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php foreach ($this->items as $i => $item): ?>
|
||||||
|
<?php
|
||||||
|
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
||||||
|
$userChkOut = Factory::getContainer()->
|
||||||
|
get(\Joomla\CMS\User\UserFactoryInterface::class)->
|
||||||
|
loadUserById($item->checked_out);
|
||||||
|
$canDo = ComponentbuilderHelper::getActions('repository',$item,'repositories');
|
||||||
|
?>
|
||||||
|
<tr class="row<?php echo $i % 2; ?>">
|
||||||
|
<td class="order nowrap center hidden-phone">
|
||||||
|
<?php if ($canDo->get('repository.edit.state')): ?>
|
||||||
|
<?php
|
||||||
|
$iconClass = '';
|
||||||
|
if (!$this->saveOrder)
|
||||||
|
{
|
||||||
|
$iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<span class="sortable-handler<?php echo $iconClass; ?>">
|
||||||
|
<i class="icon-menu"></i>
|
||||||
|
</span>
|
||||||
|
<?php if ($this->saveOrder) : ?>
|
||||||
|
<input type="text" style="display:none" name="order[]" size="5"
|
||||||
|
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
⋮
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="nowrap center">
|
||||||
|
<?php if ($canDo->get('repository.edit')): ?>
|
||||||
|
<?php if ($item->checked_out) : ?>
|
||||||
|
<?php if ($canCheckin) : ?>
|
||||||
|
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
□
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
□
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="nowrap">
|
||||||
|
<div class="name">
|
||||||
|
<?php if ($canDo->get('repository.edit')): ?>
|
||||||
|
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->system_name); ?></a>
|
||||||
|
<?php if ($item->checked_out): ?>
|
||||||
|
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'repositories.', $canCheckin); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo $this->escape($item->system_name); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo $this->escape($item->organisation); ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo $this->escape($item->repository); ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo Text::_($item->target); ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo Text::_($item->type); ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo $this->escape($item->base); ?>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<?php if ($canDo->get('repository.edit.state')) : ?>
|
||||||
|
<?php if ($item->checked_out) : ?>
|
||||||
|
<?php if ($canCheckin) : ?>
|
||||||
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'repositories.', true, 'cb'); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'repositories.', false, 'cb'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'repositories.', true, 'cb'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'repositories.', false, 'cb'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="nowrap center hidden-phone">
|
||||||
|
<?php echo $item->id; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
18
admin/tmpl/repositories/default_foot.php
Normal file
18
admin/tmpl/repositories/default_foot.php
Normal 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;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="10"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||||
|
</tr>
|
65
admin/tmpl/repositories/default_head.php
Normal file
65
admin/tmpl/repositories/default_head.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<?php if ($this->canEdit&& $this->canState): ?>
|
||||||
|
<th width="1%" class="nowrap center hidden-phone">
|
||||||
|
<?php echo Html::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
||||||
|
</th>
|
||||||
|
<th width="20" class="nowrap center">
|
||||||
|
<?php echo Html::_('grid.checkall'); ?>
|
||||||
|
</th>
|
||||||
|
<?php else: ?>
|
||||||
|
<th width="20" class="nowrap center hidden-phone">
|
||||||
|
▾
|
||||||
|
</th>
|
||||||
|
<th width="20" class="nowrap center">
|
||||||
|
■
|
||||||
|
</th>
|
||||||
|
<?php endif; ?>
|
||||||
|
<th class="nowrap" >
|
||||||
|
<?php echo Text::_('COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_LABEL'); ?>
|
||||||
|
</th>
|
||||||
|
<th class="nowrap hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_LABEL', 'a.organisation', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th class="nowrap hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_REPOSITORY_LABEL', 'a.repository', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th class="nowrap hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL', 'a.target', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th class="nowrap hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_TYPE_LABEL', 'a.type', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th class="nowrap hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_BASE_LABEL', 'a.base', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<?php if ($this->canState): ?>
|
||||||
|
<th width="10" class="nowrap center" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<?php else: ?>
|
||||||
|
<th width="10" class="nowrap center" >
|
||||||
|
<?php echo Text::_('COM_COMPONENTBUILDER_REPOSITORY_STATUS'); ?>
|
||||||
|
</th>
|
||||||
|
<?php endif; ?>
|
||||||
|
<th width="5" class="nowrap center hidden-phone" >
|
||||||
|
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_REPOSITORY_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
48
admin/tmpl/repositories/default_toolbar.php
Normal file
48
admin/tmpl/repositories/default_toolbar.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div id="filter-bar" class="btn-toolbar">
|
||||||
|
<div class="filter-search btn-group pull-left">
|
||||||
|
<label for="filter_search" class="element-invisible"><?php echo Text::_('Search');?></label>
|
||||||
|
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo Html::tooltipText('Search Repositories'); ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="btn-group pull-left">
|
||||||
|
<button type="submit" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||||
|
<button type="button" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group pull-right hidden-phone">
|
||||||
|
<label for="limit" class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||||
|
<?php echo $this->pagination->getLimitBox(); ?>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group pull-right hidden-phone">
|
||||||
|
<label for="directionTable" class="element-invisible"><?php echo Text::_('JFIELD_ORDERING_DESC');?></label>
|
||||||
|
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||||
|
<option value=""><?php echo Text::_('JFIELD_ORDERING_DESC');?></option>
|
||||||
|
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||||
|
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<label for="sortTable" class="element-invisible"><?php echo Text::_('JGLOBAL_SORT_BY');?></label>
|
||||||
|
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||||
|
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY');?></option>
|
||||||
|
<?php echo Html::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"> </div>
|
28
admin/tmpl/repositories/emptystate.php
Normal file
28
admin/tmpl/repositories/emptystate.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
$displayData = [
|
||||||
|
'textPrefix' => 'COM_COMPONENTBUILDER_REPOSITORIES',
|
||||||
|
'formURL' => 'index.php?option=com_componentbuilder&view=repositories',
|
||||||
|
'icon' => 'icon-share',
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($this->user->authorise('repository.create', 'com_componentbuilder'))
|
||||||
|
{
|
||||||
|
$displayData['createURL'] = 'index.php?option=com_componentbuilder&task=repository.add';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
106
admin/tmpl/repository/default.php
Normal file
106
admin/tmpl/repository/default.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||||
|
|
||||||
|
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||||
|
$wa = $this->getDocument()->getWebAssetManager();
|
||||||
|
$wa->useScript('keepalive')->useScript('form.validate');
|
||||||
|
Html::_('bootstrap.tooltip');
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// waiting spinner
|
||||||
|
var outerDiv = document.querySelector('body');
|
||||||
|
var loadingDiv = document.createElement('div');
|
||||||
|
loadingDiv.id = 'loading';
|
||||||
|
loadingDiv.style.cssText = "background: rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat; top: " + (outerDiv.getBoundingClientRect().top + window.pageYOffset) + "px; left: " + (outerDiv.getBoundingClientRect().left + window.pageXOffset) + "px; width: " + outerDiv.offsetWidth + "px; height: " + outerDiv.offsetHeight + "px; position: fixed; opacity: 0.80; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); filter: alpha(opacity=80); display: none;";
|
||||||
|
outerDiv.appendChild(loadingDiv);
|
||||||
|
loadingDiv.style.display = 'block';
|
||||||
|
// when page is ready remove and show
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
var componentLoader = document.getElementById('componentbuilder_loader');
|
||||||
|
if (componentLoader) componentLoader.style.display = 'block';
|
||||||
|
loadingDiv.style.display = 'none';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="componentbuilder_loader" style="display: none;">
|
||||||
|
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<?php echo LayoutHelper::render('repository.details_above', $this); ?>
|
||||||
|
<div class="main-card">
|
||||||
|
|
||||||
|
<?php echo Html::_('uitab.startTabSet', 'repositoryTab', ['active' => 'details', 'recall' => true]); ?>
|
||||||
|
|
||||||
|
<?php echo Html::_('uitab.addTab', 'repositoryTab', 'details', Text::_('COM_COMPONENTBUILDER_REPOSITORY_DETAILS', true)); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?php echo LayoutHelper::render('repository.details_left', $this); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?php echo LayoutHelper::render('repository.details_right', $this); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo Html::_('uitab.endTab'); ?>
|
||||||
|
|
||||||
|
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||||||
|
<?php $this->tab_name = 'repositoryTab'; ?>
|
||||||
|
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
|
||||||
|
|
||||||
|
<?php if ($this->canDo->get('repository.edit.created_by') || $this->canDo->get('repository.edit.created') || $this->canDo->get('repository.edit.state') || ($this->canDo->get('repository.delete') && $this->canDo->get('repository.edit.state'))) : ?>
|
||||||
|
<?php echo Html::_('uitab.addTab', 'repositoryTab', 'publishing', Text::_('COM_COMPONENTBUILDER_REPOSITORY_PUBLISHING', true)); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?php echo LayoutHelper::render('repository.publishing', $this); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?php echo LayoutHelper::render('repository.publlshing', $this); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo Html::_('uitab.endTab'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($this->canDo->get('core.admin')) : ?>
|
||||||
|
<?php echo Html::_('uitab.addTab', 'repositoryTab', 'permissions', Text::_('COM_COMPONENTBUILDER_REPOSITORY_PERMISSION', true)); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<fieldset class="adminform">
|
||||||
|
<div class="adminformlist">
|
||||||
|
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
|
||||||
|
<div>
|
||||||
|
<?php echo $field->label; echo $field->input;?>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo Html::_('uitab.endTab'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo Html::_('uitab.endTabSet'); ?>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="task" value="repository.edit" />
|
||||||
|
<?php echo Html::_('form.token'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
@ -1,15 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="5.0" method="upgrade">
|
<extension type="component" version="5.0" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>7th June, 2024</creationDate>
|
<creationDate>21st June, 2024</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>5.0.1-alpha4</version>
|
<version>5.0.1-alpha5</version>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<h1>Component Builder (v.5.0.1-alpha4)</h1>
|
<h1>Component Builder (v.5.0.1-alpha5)</h1>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<p>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.
|
<p>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.
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
|
|||||||
<menu option="com_componentbuilder" view="language_translations">COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS</menu>
|
<menu option="com_componentbuilder" view="language_translations">COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS</menu>
|
||||||
<menu option="com_componentbuilder" view="languages">COM_COMPONENTBUILDER_MENU_LANGUAGES</menu>
|
<menu option="com_componentbuilder" view="languages">COM_COMPONENTBUILDER_MENU_LANGUAGES</menu>
|
||||||
<menu option="com_componentbuilder" view="servers">COM_COMPONENTBUILDER_MENU_SERVERS</menu>
|
<menu option="com_componentbuilder" view="servers">COM_COMPONENTBUILDER_MENU_SERVERS</menu>
|
||||||
|
<menu option="com_componentbuilder" view="repositories">COM_COMPONENTBUILDER_MENU_REPOSITORIES</menu>
|
||||||
<menu option="com_componentbuilder" view="help_documents">COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS</menu>
|
<menu option="com_componentbuilder" view="help_documents">COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS</menu>
|
||||||
</submenu>
|
</submenu>
|
||||||
<files folder="admin">
|
<files folder="admin">
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<version>5.0.1-alpha</version>
|
<version>5.0.1-alpha</version>
|
||||||
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
||||||
<downloads>
|
<downloads>
|
||||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.1-alpha4.zip</downloadurl>
|
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.1-alpha5.zip</downloadurl>
|
||||||
</downloads>
|
</downloads>
|
||||||
<tags>
|
<tags>
|
||||||
<tag>alpha</tag>
|
<tag>alpha</tag>
|
||||||
@ -77,10 +77,10 @@
|
|||||||
<element>pkg_component_builder</element>
|
<element>pkg_component_builder</element>
|
||||||
<type>package</type>
|
<type>package</type>
|
||||||
<client>site</client>
|
<client>site</client>
|
||||||
<version>5.0.1-alpha4</version>
|
<version>5.0.1-alpha5</version>
|
||||||
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
||||||
<downloads>
|
<downloads>
|
||||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.1-alpha4.zip</downloadurl>
|
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.1-alpha5.zip</downloadurl>
|
||||||
</downloads>
|
</downloads>
|
||||||
<tags>
|
<tags>
|
||||||
<tag>alpha</tag>
|
<tag>alpha</tag>
|
||||||
|
@ -189,16 +189,22 @@ abstract class Grep implements GrepInterface
|
|||||||
{
|
{
|
||||||
foreach ($this->paths as $n => &$path)
|
foreach ($this->paths as $n => &$path)
|
||||||
{
|
{
|
||||||
if (isset($path->owner) && strlen($path->owner) > 1 &&
|
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
|
||||||
isset($path->repo) && strlen($path->repo) > 1)
|
isset($path->repository) && strlen($path->repository) > 1)
|
||||||
{
|
{
|
||||||
// build the path
|
// build the path
|
||||||
$path->path = trim($path->owner) . '/' . trim($path->repo);
|
$path->path = trim($path->organisation) . '/' . trim($path->repository);
|
||||||
|
|
||||||
// update the branch
|
// update the branch
|
||||||
if ($path->branch === 'default' || empty($path->branch))
|
if ($path->read_branch === 'default' || empty($path->read_branch))
|
||||||
{
|
{
|
||||||
$path->branch = null;
|
$path->read_branch = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only update the write branch if set
|
||||||
|
if (isset($path->write_branch) && ($path->write_branch === 'default' || empty($path->write_branch)))
|
||||||
|
{
|
||||||
|
$path->write_branch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set local path
|
// set local path
|
||||||
|
@ -15,6 +15,7 @@ namespace VDM\Joomla\Abstraction;
|
|||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
use VDM\Joomla\Interfaces\Tableinterface as Table;
|
use VDM\Joomla\Interfaces\Tableinterface as Table;
|
||||||
|
use VDM\Joomla\Interfaces\ModelInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,7 +23,7 @@ use VDM\Joomla\Interfaces\Tableinterface as Table;
|
|||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
abstract class Model
|
abstract class Model implements ModelInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Last ID
|
* Last ID
|
||||||
@ -40,16 +41,57 @@ abstract class Model
|
|||||||
*/
|
*/
|
||||||
protected Table $table;
|
protected Table $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected string $tableName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The switch to control the behaviour of empty values
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected bool $allowEmpty = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Table $table The search table object.
|
* @param Table $table The search table object.
|
||||||
|
* @param string|null $tableName The table
|
||||||
|
* @param bool|null $allowEmpty The switch to control the behaviour of empty values (default true)
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function __construct(Table $table)
|
public function __construct(Table $table, ?string $tableName = null, bool $allowEmpty = null)
|
||||||
{
|
{
|
||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
|
if ($tableName !== null)
|
||||||
|
{
|
||||||
|
$this->setTable($tableName);
|
||||||
|
}
|
||||||
|
if ($allowEmpty !== null)
|
||||||
|
{
|
||||||
|
$this->setAllowEmpty($allowEmpty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->setTable($table);
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -309,6 +351,54 @@ abstract class Model
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $tableName The table name
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function setTable(string $tableName): void
|
||||||
|
{
|
||||||
|
$this->tableName = $tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the switch to control the behaviour of empty values
|
||||||
|
*
|
||||||
|
* @param bool $allowEmpty The switch
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function setAllowEmpty(bool $allowEmpty): void
|
||||||
|
{
|
||||||
|
$this->allowEmpty = $allowEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the switch to control the behaviour of empty values
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected function getAllowEmpty(): bool
|
||||||
|
{
|
||||||
|
return $this->allowEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current active table's fields (including defaults)
|
* Get the current active table's fields (including defaults)
|
||||||
*
|
*
|
||||||
@ -345,14 +435,6 @@ abstract class Model
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool;
|
abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current active table
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
abstract protected function getTable(): string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,11 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
|
|||||||
|
|
||||||
|
|
||||||
use Joomla\Registry\Registry as JoomlaRegistry;
|
use Joomla\Registry\Registry as JoomlaRegistry;
|
||||||
use Joomla\CMS\Factory as JoomlaFactory;
|
use Joomla\CMS\Factory as JoomlaFactory;
|
||||||
|
use Joomla\Input\Input;
|
||||||
use VDM\Joomla\Utilities\GetHelper;
|
use VDM\Joomla\Utilities\GetHelper;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
|
||||||
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
|
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +45,9 @@ class Config extends BaseConfig
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Input|null $input Input
|
* @param Input|null $input Input
|
||||||
* @param Registry|null $params The component parameters
|
* @param JoomlaRegistry|null $params The component parameters
|
||||||
* @param Registry|null $config The Joomla configuration
|
* @param JoomlaRegistry|null $config The Joomla configuration
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
@ -65,7 +67,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteausername(): ?string
|
protected function getGiteausername(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_username ?? $this->params->get('gitea_username');
|
return $this->params->get('gitea_username');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,66 +78,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteatoken(): ?string
|
protected function getGiteatoken(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
|
return $this->params->get('gitea_token');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Add Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return int the add switch
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getAddcustomgiteaurl(): int
|
|
||||||
{
|
|
||||||
return $this->params->get('add_custom_gitea_url', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return string the custom gitea url
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteaurl(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_url');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Username
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteausername(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_username');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Access Token
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteatoken(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_token');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,11 +92,6 @@ class Config extends BaseConfig
|
|||||||
// the VDM default organisation is [joomla]
|
// the VDM default organisation is [joomla]
|
||||||
$organisation = 'joomla';
|
$organisation = 'joomla';
|
||||||
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('super_powers_core_organisation', $organisation);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $organisation;
|
return $organisation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,45 +106,66 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
$repos = [];
|
$repos = [];
|
||||||
|
|
||||||
// only add custom init with custom gitea
|
|
||||||
$paths = null;
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
$paths = $this->params->get('super_powers_core_repos');
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the users own power repo (can overwrite all)
|
// get the users own power repo (can overwrite all)
|
||||||
if (!empty($this->gitea_username))
|
if ($this->gitea_username !== null)
|
||||||
{
|
{
|
||||||
$repos[$this->gitea_username . '.super-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'super-powers', 'branch' => 'master'];
|
$repos[$this->gitea_username . '.super-powers'] = (object) [
|
||||||
|
'organisation' => $this->gitea_username,
|
||||||
|
'repository' => 'super-powers',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($paths) && is_array($paths))
|
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) [
|
||||||
{
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
foreach ($paths as $path)
|
'repository' => 'super-powers',
|
||||||
{
|
'read_branch' => 'master'
|
||||||
$owner = $path->owner ?? null;
|
];
|
||||||
$repo = $path->repo ?? null;
|
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) [
|
||||||
if ($owner !== null && $repo !== null)
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
{
|
'repository' => 'jcb-compiler',
|
||||||
// we make sure to get only the objects
|
'read_branch' => 'master'
|
||||||
$repos = ["{$owner}.{$repo}" => $path] + $repos;
|
];
|
||||||
}
|
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) [
|
||||||
}
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
}
|
'repository' => 'jcb-packager',
|
||||||
else
|
'read_branch' => 'master'
|
||||||
{
|
];
|
||||||
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
|
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) [
|
||||||
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-compiler', 'branch' => 'master'];
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-packager', 'branch' => 'master'];
|
'repository' => 'phpseclib',
|
||||||
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'phpseclib', 'branch' => 'master'];
|
'read_branch' => 'master'
|
||||||
$repos[$this->super_powers_core_organisation . '.search'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'search', 'branch' => 'master'];
|
];
|
||||||
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
|
$repos[$this->super_powers_core_organisation . '.search'] = (object) [
|
||||||
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
$repos[$this->super_powers_core_organisation . '.minify'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'minify', 'branch' => 'master'];
|
'repository' => 'search',
|
||||||
$repos[$this->super_powers_core_organisation . '.psr'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'psr', 'branch' => 'master'];
|
'read_branch' => 'master'
|
||||||
$repos[$this->super_powers_core_organisation . '.fof'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'fof', 'branch' => 'master'];
|
];
|
||||||
}
|
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) [
|
||||||
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
|
'repository' => 'gitea',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
$repos[$this->super_powers_core_organisation . '.openai'] = (object) [
|
||||||
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
|
'repository' => 'openai',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
$repos[$this->super_powers_core_organisation . '.minify'] = (object) [
|
||||||
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
|
'repository' => 'minify',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
$repos[$this->super_powers_core_organisation . '.psr'] = (object) [
|
||||||
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
|
'repository' => 'psr',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
$repos[$this->super_powers_core_organisation . '.fof'] = (object) [
|
||||||
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
|
'repository' => 'fof',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
|
||||||
return $repos;
|
return $repos;
|
||||||
}
|
}
|
||||||
@ -830,19 +789,14 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
$approved = $this->super_powers_core_repos;
|
$approved = $this->super_powers_core_repos;
|
||||||
|
|
||||||
if (!$this->add_own_powers)
|
$paths = RepoHelper::get(1); // super powers = 1
|
||||||
{
|
|
||||||
return array_values($approved);
|
|
||||||
}
|
|
||||||
|
|
||||||
$paths = $this->params->get('approved_paths');
|
if ($paths !== null)
|
||||||
|
|
||||||
if (!empty($paths))
|
|
||||||
{
|
{
|
||||||
foreach ($paths as $path)
|
foreach ($paths as $path)
|
||||||
{
|
{
|
||||||
$owner = $path->owner ?? null;
|
$owner = $path->organisation ?? null;
|
||||||
$repo = $path->repo ?? null;
|
$repo = $path->repository ?? null;
|
||||||
if ($owner !== null && $repo !== null)
|
if ($owner !== null && $repo !== null)
|
||||||
{
|
{
|
||||||
// we make sure to get only the objects
|
// we make sure to get only the objects
|
||||||
@ -879,11 +833,19 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
$repos = [];
|
$repos = [];
|
||||||
// get the users own power repo (can overwrite all)
|
// get the users own power repo (can overwrite all)
|
||||||
if (!empty($this->gitea_username))
|
if ($this->gitea_username !== null)
|
||||||
{
|
{
|
||||||
$repos[$this->gitea_username . '.joomla-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
$repos[$this->gitea_username . '.joomla-powers'] = (object) [
|
||||||
|
'organisation' => $this->gitea_username,
|
||||||
|
'repository' => 'joomla-powers',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) [
|
||||||
|
'organisation' => $this->joomla_powers_core_organisation,
|
||||||
|
'repository' => 'joomla-powers',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
|
|
||||||
return $repos;
|
return $repos;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
|
|||||||
use Joomla\DI\Container;
|
use Joomla\DI\Container;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Crypt;
|
use VDM\Joomla\Componentbuilder\Service\Crypt;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Server;
|
use VDM\Joomla\Componentbuilder\Service\Server;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Database;
|
use VDM\Joomla\Service\Database;
|
||||||
|
use VDM\Joomla\Service\Model as BaseModel;
|
||||||
|
use VDM\Joomla\Service\Data;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Model;
|
use VDM\Joomla\Componentbuilder\Compiler\Service\Model;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Compiler;
|
use VDM\Joomla\Componentbuilder\Compiler\Service\Compiler;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Event;
|
use VDM\Joomla\Componentbuilder\Compiler\Service\Event;
|
||||||
@ -149,6 +151,8 @@ abstract class Factory implements FactoryInterface
|
|||||||
->registerServiceProvider(new Crypt())
|
->registerServiceProvider(new Crypt())
|
||||||
->registerServiceProvider(new Server())
|
->registerServiceProvider(new Server())
|
||||||
->registerServiceProvider(new Database())
|
->registerServiceProvider(new Database())
|
||||||
|
->registerServiceProvider(new BaseModel())
|
||||||
|
->registerServiceProvider(new Data())
|
||||||
->registerServiceProvider(new Model())
|
->registerServiceProvider(new Model())
|
||||||
->registerServiceProvider(new Compiler())
|
->registerServiceProvider(new Compiler())
|
||||||
->registerServiceProvider(new Event())
|
->registerServiceProvider(new Event())
|
||||||
|
@ -21,7 +21,6 @@ use VDM\Joomla\Utilities\JsonHelper;
|
|||||||
use VDM\Joomla\Utilities\GuidHelper;
|
use VDM\Joomla\Utilities\GuidHelper;
|
||||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||||
use VDM\Joomla\Utilities\String\NamespaceHelper;
|
use VDM\Joomla\Utilities\String\NamespaceHelper;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||||
@ -102,43 +101,43 @@ class Power implements PowerInterface
|
|||||||
protected array $retry = [];
|
protected array $retry = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler Config
|
* The Config Class.
|
||||||
*
|
*
|
||||||
* @var Config
|
* @var Config
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
*/
|
||||||
protected Config $config;
|
protected Config $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler Placeholder
|
* The Placeholder Class.
|
||||||
*
|
*
|
||||||
* @var Placeholder
|
* @var Placeholder
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
*/
|
||||||
protected Placeholder $placeholder;
|
protected Placeholder $placeholder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler Customcode
|
* The Customcode Class.
|
||||||
*
|
*
|
||||||
* @var Customcode
|
* @var Customcode
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
*/
|
||||||
protected Customcode $customcode;
|
protected Customcode $customcode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler Customcode in Gui
|
* The Gui Class.
|
||||||
*
|
*
|
||||||
* @var Gui
|
* @var Gui
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
*/
|
||||||
protected Gui $gui;
|
protected Gui $gui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JCB Superpower class
|
* The Super Class.
|
||||||
*
|
*
|
||||||
* @var Superpower
|
* @var Superpower
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
*/
|
||||||
protected Superpower $superpower;
|
protected Superpower $superpower;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,23 +157,22 @@ class Power implements PowerInterface
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param Config|null $config The compiler config object.
|
* @param Config $config The Config Class.
|
||||||
* @param Placeholder|null $placeholder The compiler placeholder object.
|
* @param Placeholder $placeholder The Placeholder Class.
|
||||||
* @param Customcode|null $customcode The compiler customcode object.
|
* @param Customcode $customcode The Customcode Class.
|
||||||
* @param Gui|null $gui The compiler customcode gui object.
|
* @param Gui $gui The Gui Class.
|
||||||
* @param Superpower|null $superpower The JCB superpower object.
|
* @param Superpower $superpower The Super Class.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
|
public function __construct(Config $config, Placeholder $placeholder,
|
||||||
?Customcode $customcode = null, ?Gui $gui = null, ?Superpower $superpower = null)
|
Customcode $customcode, Gui $gui, Superpower $superpower)
|
||||||
{
|
{
|
||||||
$this->config = $config ?: Compiler::_('Config');
|
$this->config = $config;
|
||||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
$this->placeholder = $placeholder;
|
||||||
$this->customcode = $customcode ?: Compiler::_('Customcode');
|
$this->customcode = $customcode;
|
||||||
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
|
$this->gui = $gui;
|
||||||
$this->superpower = $superpower ?: Compiler::_('Superpower');
|
$this->superpower = $superpower;
|
||||||
$this->db = Factory::getDbo();
|
$this->db = Factory::getDbo();
|
||||||
$this->app = Factory::getApplication();
|
$this->app = Factory::getApplication();
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,6 @@ use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
|
|||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
|
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor;
|
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector;
|
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector;
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,15 +52,6 @@ class JoomlaPower implements ServiceProviderInterface
|
|||||||
|
|
||||||
$container->alias(Injector::class, 'Joomla.Power.Injector')
|
$container->alias(Injector::class, 'Joomla.Power.Injector')
|
||||||
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
|
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
|
||||||
|
|
||||||
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
|
|
||||||
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
|
|
||||||
|
|
||||||
$container->alias(Insert::class, 'Joomla.Power.Insert')
|
|
||||||
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
|
|
||||||
|
|
||||||
$container->alias(Update::class, 'Joomla.Power.Update')
|
|
||||||
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,8 +85,7 @@ class JoomlaPower implements ServiceProviderInterface
|
|||||||
{
|
{
|
||||||
return new Superpower(
|
return new Superpower(
|
||||||
$container->get('Joomla.Power.Grep'),
|
$container->get('Joomla.Power.Grep'),
|
||||||
$container->get('Joomla.Power.Insert'),
|
$container->get('Data.Item')
|
||||||
$container->get('Joomla.Power.Update')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,53 +136,6 @@ class JoomlaPower implements ServiceProviderInterface
|
|||||||
$container->get('Power.Parser'),
|
$container->get('Power.Parser'),
|
||||||
$container->get('Placeholder')
|
$container->get('Placeholder')
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Upsert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Upsert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelUpsert(Container $container): Upsert
|
|
||||||
{
|
|
||||||
return new Upsert(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Insert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Insert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getInsert(Container $container): Insert
|
|
||||||
{
|
|
||||||
return new Insert(
|
|
||||||
$container->get('Joomla.Power.Model.Upsert'),
|
|
||||||
$container->get('Insert')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Update
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Update
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getUpdate(Container $container): Update
|
|
||||||
{
|
|
||||||
return new Update(
|
|
||||||
$container->get('Joomla.Power.Model.Upsert'),
|
|
||||||
$container->get('Update')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
|||||||
use Joomla\DI\Container;
|
use Joomla\DI\Container;
|
||||||
use Joomla\DI\ServiceProviderInterface;
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power as Powers;
|
use VDM\Joomla\Componentbuilder\Compiler\Power as Powers;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Grep;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Super as Superpower;
|
use VDM\Joomla\Componentbuilder\Power\Super as Superpower;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Infusion;
|
use VDM\Joomla\Componentbuilder\Power\Grep;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Infusion;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Structure;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Structure;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Plantuml;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Plantuml;
|
||||||
@ -26,9 +26,6 @@ use VDM\Joomla\Componentbuilder\Compiler\Power\Repo\Readme as RepoReadme;
|
|||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Repos\Readme as ReposReadme;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Repos\Readme as ReposReadme;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Model\Upsert;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Update;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,19 +80,10 @@ class Power implements ServiceProviderInterface
|
|||||||
|
|
||||||
$container->alias(Injector::class, 'Power.Injector')
|
$container->alias(Injector::class, 'Power.Injector')
|
||||||
->share('Power.Injector', [$this, 'getInjector'], true);
|
->share('Power.Injector', [$this, 'getInjector'], true);
|
||||||
|
|
||||||
$container->alias(Upsert::class, 'Power.Model.Upsert')
|
|
||||||
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
|
|
||||||
|
|
||||||
$container->alias(Insert::class, 'Power.Insert')
|
|
||||||
->share('Power.Insert', [$this, 'getInsert'], true);
|
|
||||||
|
|
||||||
$container->alias(Update::class, 'Power.Update')
|
|
||||||
->share('Power.Update', [$this, 'getUpdate'], true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Powers
|
* Get The Power Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -108,12 +96,13 @@ class Power implements ServiceProviderInterface
|
|||||||
$container->get('Config'),
|
$container->get('Config'),
|
||||||
$container->get('Placeholder'),
|
$container->get('Placeholder'),
|
||||||
$container->get('Customcode'),
|
$container->get('Customcode'),
|
||||||
$container->get('Customcode.Gui')
|
$container->get('Customcode.Gui'),
|
||||||
|
$container->get('Superpower')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Superpower
|
* Get The Super Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -124,13 +113,12 @@ class Power implements ServiceProviderInterface
|
|||||||
{
|
{
|
||||||
return new Superpower(
|
return new Superpower(
|
||||||
$container->get('Power.Grep'),
|
$container->get('Power.Grep'),
|
||||||
$container->get('Power.Insert'),
|
$container->get('Data.Item')
|
||||||
$container->get('Power.Update')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Grep
|
* Get The Grep Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -147,7 +135,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Autoloader
|
* Get The Autoloader Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -164,7 +152,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Infusion
|
* Get The Infusion Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -187,7 +175,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Structure Builder
|
* Get The Structure Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -210,11 +198,11 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Parser
|
* Get The Parser Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
* @return Structure
|
* @return Parser
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function getParser(Container $container): Parser
|
public function getParser(Container $container): Parser
|
||||||
@ -223,7 +211,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Plantuml Builder
|
* Get The Plantuml Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -236,7 +224,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Repo Readme Builder
|
* Get The Readme Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -252,7 +240,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Repos Readme Builder
|
* Get The Readme Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -268,7 +256,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Extractor
|
* Get The Extractor Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -281,7 +269,7 @@ class Power implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Compiler Power Injector
|
* Get The Injector Class.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
@ -296,53 +284,6 @@ class Power implements ServiceProviderInterface
|
|||||||
$container->get('Power.Parser'),
|
$container->get('Power.Parser'),
|
||||||
$container->get('Placeholder')
|
$container->get('Placeholder')
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Upsert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Upsert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelUpsert(Container $container): Upsert
|
|
||||||
{
|
|
||||||
return new Upsert(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Insert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Insert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getInsert(Container $container): Insert
|
|
||||||
{
|
|
||||||
return new Insert(
|
|
||||||
$container->get('Power.Model.Upsert'),
|
|
||||||
$container->get('Insert')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Update
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return Update
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getUpdate(Container $container): Update
|
|
||||||
{
|
|
||||||
return new Update(
|
|
||||||
$container->get('Power.Model.Upsert'),
|
|
||||||
$container->get('Update')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Superpower of JCB
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
interface SuperInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Init all power not found in database
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function init(): bool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the powers
|
|
||||||
*
|
|
||||||
* @param array $powers The global unique ids of the powers
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function reset(array $powers): bool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load a superpower
|
|
||||||
*
|
|
||||||
* @param string $guid The global unique id of the power
|
|
||||||
* @param array $order The search order
|
|
||||||
* @param string|null $action The action to load power
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool;
|
|
||||||
}
|
|
||||||
|
|
@ -65,7 +65,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteausername(): ?string
|
protected function getGiteausername(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_username ?? $this->params->get('gitea_username');
|
return $this->params->get('gitea_username');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,66 +76,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteatoken(): ?string
|
protected function getGiteatoken(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
|
return $this->params->get('gitea_token');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Add Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return int the add switch
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getAddcustomgiteaurl(): int
|
|
||||||
{
|
|
||||||
return $this->params->get('add_custom_gitea_url', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return string the custom gitea url
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteaurl(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_url');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Username
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteausername(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_username');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Access Token
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteatoken(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_token');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,9 +106,9 @@ class Config extends BaseConfig
|
|||||||
// get the users own power repo (can overwrite all)
|
// get the users own power repo (can overwrite all)
|
||||||
if (!empty($this->gitea_username))
|
if (!empty($this->gitea_username))
|
||||||
{
|
{
|
||||||
$repos[$this->gitea_username . '.joomla-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
$repos[$this->gitea_username . '.joomla-powers'] = (object) ['organisation' => $this->gitea_username, 'repository' => 'joomla-powers', 'read_branch' => 'master'];
|
||||||
}
|
}
|
||||||
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['organisation' => $this->joomla_powers_core_organisation, 'repository' => 'joomla-powers', 'read_branch' => 'master'];
|
||||||
|
|
||||||
return $repos;
|
return $repos;
|
||||||
}
|
}
|
||||||
@ -183,7 +124,7 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
if (!empty($this->gitea_username))
|
if (!empty($this->gitea_username))
|
||||||
{
|
{
|
||||||
return (object) ['owner' => $this->gitea_username, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
return (object) ['organisation' => $this->gitea_username, 'repository' => 'joomla-powers', 'read_branch' => 'master'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
|
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Insert as ExtendingInsert;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joomla Power Database Insert
|
|
||||||
*
|
|
||||||
* @since 3.2.1
|
|
||||||
*/
|
|
||||||
final class Insert extends ExtendingInsert implements InsertInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Table Name
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 3.2.1
|
|
||||||
*/
|
|
||||||
protected string $table = 'power';
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
|
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Load as ExtendingLoad;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Power Database Load
|
|
||||||
*
|
|
||||||
* @since 2.0.1
|
|
||||||
*/
|
|
||||||
final class Load extends ExtendingLoad implements LoadInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Table Name
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 3.2.1
|
|
||||||
*/
|
|
||||||
protected string $table = 'joomla_power';
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
|
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Update as ExtendingUpdate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joomla Power Database Update
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
final class Update extends ExtendingUpdate implements UpdateInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Table Name
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 3.2.1
|
|
||||||
*/
|
|
||||||
protected string $table = 'joomla_power';
|
|
||||||
}
|
|
||||||
|
|
@ -14,8 +14,9 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
|
|||||||
|
|
||||||
use Joomla\DI\Container;
|
use Joomla\DI\Container;
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower as Power;
|
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower as Power;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Database;
|
use VDM\Joomla\Service\Database;
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\Database as PowerDatabase;
|
use VDM\Joomla\Service\Model;
|
||||||
|
use VDM\Joomla\Service\Data;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Gitea;
|
use VDM\Joomla\Componentbuilder\Service\Gitea;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
|
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
|
||||||
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
|
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
|
||||||
@ -77,7 +78,8 @@ abstract class Factory implements FactoryInterface
|
|||||||
return (new Container())
|
return (new Container())
|
||||||
->registerServiceProvider(new Power())
|
->registerServiceProvider(new Power())
|
||||||
->registerServiceProvider(new Database())
|
->registerServiceProvider(new Database())
|
||||||
->registerServiceProvider(new PowerDatabase())
|
->registerServiceProvider(new Model())
|
||||||
|
->registerServiceProvider(new Data())
|
||||||
->registerServiceProvider(new Gitea())
|
->registerServiceProvider(new Gitea())
|
||||||
->registerServiceProvider(new GiteaPower())
|
->registerServiceProvider(new GiteaPower())
|
||||||
->registerServiceProvider(new GiteaUtilities());
|
->registerServiceProvider(new GiteaUtilities());
|
||||||
|
@ -56,7 +56,9 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$path->index = $this->contents->get($path->owner, $path->repo, 'joomla-powers.json', $path->branch);
|
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||||
|
$path->index = $this->contents->get($path->organisation, $path->repository, 'joomla-powers.json', $path->read_branch);
|
||||||
|
$this->contents->reset_();
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
@ -108,46 +110,43 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
|||||||
*/
|
*/
|
||||||
protected function getRemote(object $path, string $guid): ?object
|
protected function getRemote(object $path, string $guid): ?object
|
||||||
{
|
{
|
||||||
|
$power = null;
|
||||||
if (empty($path->index->{$guid}->settings))
|
if (empty($path->index->{$guid}->settings))
|
||||||
{
|
{
|
||||||
return null;
|
return $power;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the settings
|
// get the settings
|
||||||
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
|
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||||
|
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $path->read_branch)) !== null &&
|
||||||
isset($power->guid))
|
isset($power->guid))
|
||||||
{
|
{
|
||||||
// set the git details in params
|
// set the git details in params
|
||||||
$power->params = (object) [
|
$power->params = (object) [
|
||||||
'git' => [
|
'source' => ['guid' => $path->guid ?? null]
|
||||||
'owner' => $path->owner,
|
|
||||||
'repo' => $path->repo,
|
|
||||||
'branch' => $path->branch
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return $power;
|
|
||||||
}
|
}
|
||||||
|
$this->contents->reset_();
|
||||||
|
|
||||||
return null;
|
return $power;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the remote file
|
* Load the remote file
|
||||||
*
|
*
|
||||||
* @param string $owner The repository owner
|
* @param string $organisation The repository organisation
|
||||||
* @param string $repo The repository name
|
* @param string $repository The repository name
|
||||||
* @param string $path The repository path to file
|
* @param string $path The repository path to file
|
||||||
* @param string|null $branch The repository branch name
|
* @param string|null $branch The repository branch name
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
protected function loadRemoteFile(string $owner, string $repo, string $path, ?string $branch)
|
protected function loadRemoteFile(string $organisation, string $repository, string $path, ?string $branch)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = $this->contents->get($owner, $repo, $path, $branch);
|
$data = $this->contents->get($organisation, $repository, $path, $branch);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
|
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\ModelInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Model\Load as ExtendingLoad;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joomla Power Model Load
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
final class Load extends ExtendingLoad implements ModelInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the current active table
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getTable(): string
|
|
||||||
{
|
|
||||||
return 'joomla_power';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
|
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\ModelInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as ExtendingUpsert;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joomla Power Model Update or Insert
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
final class Upsert extends ExtendingUpsert implements ModelInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the current active table
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getTable(): string
|
|
||||||
{
|
|
||||||
return 'joomla_power';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Service;
|
|
||||||
|
|
||||||
|
|
||||||
use Joomla\DI\Container;
|
|
||||||
use Joomla\DI\ServiceProviderInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Load as ModelLoad;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert as ModelUpsert;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Load as LoadDatabase;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert as InsertDatabase;
|
|
||||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update as UpdateDatabase;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database Service Provider
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
class Database implements ServiceProviderInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Registers the service provider with a DI container.
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function register(Container $container)
|
|
||||||
{
|
|
||||||
$container->alias(ModelLoad::class, 'Joomla.Power.Model.Load')
|
|
||||||
->share('Joomla.Power.Model.Load', [$this, 'getModelLoad'], true);
|
|
||||||
|
|
||||||
$container->alias(ModelUpsert::class, 'Joomla.Power.Model.Upsert')
|
|
||||||
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
|
|
||||||
|
|
||||||
$container->alias(LoadDatabase::class, 'Joomla.Power.Database.Load')
|
|
||||||
->share('Joomla.Power.Database.Load', [$this, 'getLoadDatabase'], true);
|
|
||||||
|
|
||||||
$container->alias(InsertDatabase::class, 'Joomla.Power.Database.Insert')
|
|
||||||
->share('Joomla.Power.Database.Insert', [$this, 'getInsertDatabase'], true);
|
|
||||||
|
|
||||||
$container->alias(UpdateDatabase::class, 'Joomla.Power.Database.Update')
|
|
||||||
->share('Joomla.Power.Database.Update', [$this, 'getUpdateDatabase'], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Load
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return ModelLoad
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelLoad(Container $container): ModelLoad
|
|
||||||
{
|
|
||||||
return new ModelLoad(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Update or Insert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return ModelUpsert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelUpsert(Container $container): ModelUpsert
|
|
||||||
{
|
|
||||||
return new ModelUpsert(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Load Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return LoadDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getLoadDatabase(Container $container): LoadDatabase
|
|
||||||
{
|
|
||||||
return new LoadDatabase(
|
|
||||||
$container->get('Joomla.Power.Model.Load'),
|
|
||||||
$container->get('Load')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Insert Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return InsertDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getInsertDatabase(Container $container): InsertDatabase
|
|
||||||
{
|
|
||||||
return new InsertDatabase(
|
|
||||||
$container->get('Joomla.Power.Model.Upsert'),
|
|
||||||
$container->get('Insert')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Update Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return UpdateDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getUpdateDatabase(Container $container): UpdateDatabase
|
|
||||||
{
|
|
||||||
return new UpdateDatabase(
|
|
||||||
$container->get('Joomla.Power.Model.Upsert'),
|
|
||||||
$container->get('Update')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -108,8 +108,7 @@ class JoomlaPower implements ServiceProviderInterface
|
|||||||
{
|
{
|
||||||
return new Superpower(
|
return new Superpower(
|
||||||
$container->get('Joomla.Power.Grep'),
|
$container->get('Joomla.Power.Grep'),
|
||||||
$container->get('Joomla.Power.Database.Insert'),
|
$container->get('Data.Item')
|
||||||
$container->get('Joomla.Power.Database.Update')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
|
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
|
use VDM\Joomla\Interfaces\Data\RemoteInterface;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Super as ExtendingSuper;
|
use VDM\Joomla\Data\Remote;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Super as ExtendingSuper;
|
|||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
final class Super extends ExtendingSuper implements SuperInterface
|
final class Super extends Remote implements RemoteInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Table Name
|
* Table Name
|
||||||
|
@ -13,9 +13,11 @@ namespace VDM\Joomla\Componentbuilder\Power;
|
|||||||
|
|
||||||
|
|
||||||
use Joomla\Registry\Registry as JoomlaRegistry;
|
use Joomla\Registry\Registry as JoomlaRegistry;
|
||||||
use Joomla\CMS\Factory as JoomlaFactory;
|
use Joomla\CMS\Factory as JoomlaFactory;
|
||||||
|
use Joomla\Input\Input;
|
||||||
use VDM\Joomla\Utilities\GetHelper;
|
use VDM\Joomla\Utilities\GetHelper;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
|
||||||
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
|
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +45,9 @@ class Config extends BaseConfig
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Input|null $input Input
|
* @param Input|null $input Input
|
||||||
* @param Registry|null $params The component parameters
|
* @param JoomlaRegistry|null $params The component parameters
|
||||||
* @param Registry|null $config The Joomla configuration
|
* @param JoomlaRegistry|null $config The Joomla configuration
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
@ -65,7 +67,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteausername(): ?string
|
protected function getGiteausername(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_username ?? $this->params->get('gitea_username');
|
return $this->params->get('gitea_username');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,66 +78,7 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getGiteatoken(): ?string
|
protected function getGiteatoken(): ?string
|
||||||
{
|
{
|
||||||
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
|
return $this->params->get('gitea_token');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Add Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return int the add switch
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getAddcustomgiteaurl(): int
|
|
||||||
{
|
|
||||||
return $this->params->get('add_custom_gitea_url', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea URL
|
|
||||||
*
|
|
||||||
* @return string the custom gitea url
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteaurl(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_url');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Username
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteausername(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_username');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get Custom Gitea Access Token
|
|
||||||
*
|
|
||||||
* @return string the custom access token
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
protected function getCustomgiteatoken(): ?string
|
|
||||||
{
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('custom_gitea_token');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,11 +92,6 @@ class Config extends BaseConfig
|
|||||||
// the VDM default organisation is [joomla]
|
// the VDM default organisation is [joomla]
|
||||||
$organisation = 'joomla';
|
$organisation = 'joomla';
|
||||||
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
return $this->params->get('super_powers_core_organisation', $organisation);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $organisation;
|
return $organisation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,38 +106,31 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
$repos = [];
|
$repos = [];
|
||||||
|
|
||||||
// only add custom init with custom gitea
|
|
||||||
$paths = null;
|
|
||||||
if ($this->add_custom_gitea_url == 2)
|
|
||||||
{
|
|
||||||
$paths = $this->params->get('super_powers_init_repos');
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the users own power repo (can overwrite all)
|
// get the users own power repo (can overwrite all)
|
||||||
if (!empty($this->gitea_username))
|
if ($this->gitea_username !== null)
|
||||||
{
|
{
|
||||||
$repos[$this->gitea_username . '.super-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'super-powers', 'branch' => 'master'];
|
$repos[$this->gitea_username . '.super-powers'] = (object) [
|
||||||
|
'organisation' => $this->gitea_username,
|
||||||
|
'repository' => 'super-powers',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($paths) && is_array($paths))
|
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) [
|
||||||
{
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
foreach ($paths as $path)
|
'repository' => 'super-powers',
|
||||||
{
|
'read_branch' => 'master'
|
||||||
$owner = $path->owner ?? null;
|
];
|
||||||
$repo = $path->repo ?? null;
|
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) [
|
||||||
if ($owner !== null && $repo !== null)
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
{
|
'repository' => 'gitea',
|
||||||
// we make sure to get only the objects
|
'read_branch' => 'master'
|
||||||
$repos = ["{$owner}.{$repo}" => $path] + $repos;
|
];
|
||||||
}
|
$repos[$this->super_powers_core_organisation . '.openai'] = (object) [
|
||||||
}
|
'organisation' => $this->super_powers_core_organisation,
|
||||||
}
|
'repository' => 'openai',
|
||||||
else
|
'read_branch' => 'master'
|
||||||
{
|
];
|
||||||
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
|
|
||||||
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
|
|
||||||
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $repos;
|
return $repos;
|
||||||
}
|
}
|
||||||
@ -212,9 +143,13 @@ class Config extends BaseConfig
|
|||||||
*/
|
*/
|
||||||
protected function getSuperpowerspushrepo(): ?object
|
protected function getSuperpowerspushrepo(): ?object
|
||||||
{
|
{
|
||||||
if (!empty($this->gitea_username))
|
if ($this->gitea_username !== null)
|
||||||
{
|
{
|
||||||
return (object) ['owner' => $this->gitea_username, 'repo' => 'super-powers', 'branch' => 'master'];
|
return (object) [
|
||||||
|
'organisation' => $this->gitea_username,
|
||||||
|
'repository' => 'super-powers',
|
||||||
|
'read_branch' => 'master'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -288,19 +223,14 @@ class Config extends BaseConfig
|
|||||||
// some defaults repos we need by JCB
|
// some defaults repos we need by JCB
|
||||||
$approved = $this->super_powers_init_repos;
|
$approved = $this->super_powers_init_repos;
|
||||||
|
|
||||||
if (!$this->add_own_powers)
|
$paths = RepoHelper::get(1); // super powers = 1
|
||||||
{
|
|
||||||
return array_values($approved);
|
|
||||||
}
|
|
||||||
|
|
||||||
$paths = $this->params->get('approved_paths');
|
if ($paths !== null)
|
||||||
|
|
||||||
if (!empty($paths))
|
|
||||||
{
|
{
|
||||||
foreach ($paths as $path)
|
foreach ($paths as $path)
|
||||||
{
|
{
|
||||||
$owner = $path->owner ?? null;
|
$owner = $path->organisation ?? null;
|
||||||
$repo = $path->repo ?? null;
|
$repo = $path->repository ?? null;
|
||||||
if ($owner !== null && $repo !== null)
|
if ($owner !== null && $repo !== null)
|
||||||
{
|
{
|
||||||
// we make sure to get only the objects
|
// we make sure to get only the objects
|
||||||
|
@ -14,8 +14,9 @@ namespace VDM\Joomla\Componentbuilder\Power;
|
|||||||
|
|
||||||
use Joomla\DI\Container;
|
use Joomla\DI\Container;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Service\Power;
|
use VDM\Joomla\Componentbuilder\Power\Service\Power;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Database;
|
use VDM\Joomla\Service\Database;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Service\Database as PowerDatabase;
|
use VDM\Joomla\Service\Model;
|
||||||
|
use VDM\Joomla\Service\Data;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Service\Generator;
|
use VDM\Joomla\Componentbuilder\Power\Service\Generator;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Gitea;
|
use VDM\Joomla\Componentbuilder\Service\Gitea;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
|
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
|
||||||
@ -78,7 +79,8 @@ abstract class Factory implements FactoryInterface
|
|||||||
return (new Container())
|
return (new Container())
|
||||||
->registerServiceProvider(new Power())
|
->registerServiceProvider(new Power())
|
||||||
->registerServiceProvider(new Database())
|
->registerServiceProvider(new Database())
|
||||||
->registerServiceProvider(new PowerDatabase())
|
->registerServiceProvider(new Model())
|
||||||
|
->registerServiceProvider(new Data())
|
||||||
->registerServiceProvider(new Generator())
|
->registerServiceProvider(new Generator())
|
||||||
->registerServiceProvider(new Gitea())
|
->registerServiceProvider(new Gitea())
|
||||||
->registerServiceProvider(new GiteaPower())
|
->registerServiceProvider(new GiteaPower())
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace VDM\Joomla\Componentbuilder\Power\Generator;
|
namespace VDM\Joomla\Componentbuilder\Power\Generator;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Load as Database;
|
use VDM\Joomla\Data\Action\Load as Database;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
|
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Generator\Bucket;
|
use VDM\Joomla\Componentbuilder\Power\Generator\Bucket;
|
||||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||||
@ -77,7 +77,7 @@ final class Search
|
|||||||
{
|
{
|
||||||
if (($power = $this->bucket->get("power.{$guid}")) === null)
|
if (($power = $this->bucket->get("power.{$guid}")) === null)
|
||||||
{
|
{
|
||||||
if (($power = $this->database->item(['guid' => $guid])) === null)
|
if (($power = $this->database->table('power')->item(['guid' => $guid])) === null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ final class Search
|
|||||||
{
|
{
|
||||||
if (($service_providers = $this->bucket->get("service_providers.{$guid}")) === null)
|
if (($service_providers = $this->bucket->get("service_providers.{$guid}")) === null)
|
||||||
{
|
{
|
||||||
if (($powers = $this->database->items([
|
if (($powers = $this->database->table('power')->items([
|
||||||
'use_selection' => [
|
'use_selection' => [
|
||||||
'operator' => 'LIKE',
|
'operator' => 'LIKE',
|
||||||
'value' => "'%{$guid}%'",
|
'value' => "'%{$guid}%'",
|
||||||
|
@ -48,14 +48,28 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch);
|
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||||
|
$path->index = $this->contents->get($path->organisation, $path->repository, 'super-powers.json', $path->read_branch);
|
||||||
|
$this->contents->reset_();
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$this->app->enqueueMessage(
|
if ('super-powers' === $path->repository && 'joomla' !== $path->organisation && (empty($path->base) || $path->base === 'https://git.vdm.dev'))
|
||||||
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
|
{
|
||||||
'Error'
|
// give heads-up about the overriding feature
|
||||||
);
|
$this->app->enqueueMessage(
|
||||||
|
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BHTTPSGITVDMDEVSB_CAN_BE_USED_TO_OVERRIDE_ANY_POWERBR_BUT_HAS_NOT_YET_BEEN_SET_IN_YOUR_ACCOUNT_AT_HTTPSGITVDMDEVSBR_SMALLTHIS_IS_AND_OPTIONAL_FEATURESMALL', $path->path, $path->organisation),
|
||||||
|
'Message'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// give error
|
||||||
|
$this->app->enqueueMessage(
|
||||||
|
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
|
||||||
|
'Error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$path->index = null;
|
$path->index = null;
|
||||||
}
|
}
|
||||||
@ -161,50 +175,48 @@ final class Grep extends ExtendingGrep implements GrepInterface
|
|||||||
*/
|
*/
|
||||||
protected function getRemote(object $path, string $guid): ?object
|
protected function getRemote(object $path, string $guid): ?object
|
||||||
{
|
{
|
||||||
|
$power = null;
|
||||||
if (empty($path->index->{$guid}->settings) || empty($path->index->{$guid}->code))
|
if (empty($path->index->{$guid}->settings) || empty($path->index->{$guid}->code))
|
||||||
{
|
{
|
||||||
return null;
|
return $power;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the settings
|
// get the settings
|
||||||
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
|
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
||||||
|
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $path->read_branch)) !== null &&
|
||||||
isset($power->guid))
|
isset($power->guid))
|
||||||
{
|
{
|
||||||
// get the code
|
// get the code
|
||||||
if (($code = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->power, $path->branch)) !== null)
|
if (($code = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->power, $path->read_branch)) !== null)
|
||||||
{
|
{
|
||||||
// set the git details in params
|
// set the git details in params
|
||||||
$power->params = (object) [
|
$power->params = (object) [
|
||||||
'git' => [
|
'source' => ['guid' => $path->guid ?? null]
|
||||||
'owner' => $path->owner,
|
|
||||||
'repo' => $path->repo,
|
|
||||||
'branch' => $path->branch
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
$power->main_class_code = $code;
|
$power->main_class_code = $code;
|
||||||
return $power;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->contents->reset_();
|
||||||
|
|
||||||
return null;
|
return $power;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the remote file
|
* Load the remote file
|
||||||
*
|
*
|
||||||
* @param string $owner The repository owner
|
* @param string $organisation The repository organisation
|
||||||
* @param string $repo The repository name
|
* @param string $repository The repository name
|
||||||
* @param string $path The repository path to file
|
* @param string $path The repository path to file
|
||||||
* @param string|null $branch The repository branch name
|
* @param string|null $branch The repository branch name
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
protected function loadRemoteFile(string $owner, string $repo, string $path, ?string $branch)
|
protected function loadRemoteFile(string $organisation, string $repository, string $path, ?string $branch)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = $this->contents->get($owner, $repo, $path, $branch);
|
$data = $this->contents->get($organisation, $repository, $path, $branch);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
|
@ -1,135 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\Power\Service;
|
|
||||||
|
|
||||||
|
|
||||||
use Joomla\DI\Container;
|
|
||||||
use Joomla\DI\ServiceProviderInterface;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Model\Load as ModelLoad;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as ModelUpsert;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Load as LoadDatabase;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Insert as InsertDatabase;
|
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\Update as UpdateDatabase;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database Service Provider
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
class Database implements ServiceProviderInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Registers the service provider with a DI container.
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function register(Container $container)
|
|
||||||
{
|
|
||||||
$container->alias(ModelLoad::class, 'Power.Model.Load')
|
|
||||||
->share('Power.Model.Load', [$this, 'getModelLoad'], true);
|
|
||||||
|
|
||||||
$container->alias(ModelUpsert::class, 'Power.Model.Upsert')
|
|
||||||
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
|
|
||||||
|
|
||||||
$container->alias(LoadDatabase::class, 'Power.Database.Load')
|
|
||||||
->share('Power.Database.Load', [$this, 'getLoadDatabase'], true);
|
|
||||||
|
|
||||||
$container->alias(InsertDatabase::class, 'Power.Database.Insert')
|
|
||||||
->share('Power.Database.Insert', [$this, 'getInsertDatabase'], true);
|
|
||||||
|
|
||||||
$container->alias(UpdateDatabase::class, 'Power.Database.Update')
|
|
||||||
->share('Power.Database.Update', [$this, 'getUpdateDatabase'], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Load
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return ModelLoad
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelLoad(Container $container): ModelLoad
|
|
||||||
{
|
|
||||||
return new ModelLoad(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Power Model Update or Insert
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return ModelUpsert
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getModelUpsert(Container $container): ModelUpsert
|
|
||||||
{
|
|
||||||
return new ModelUpsert(
|
|
||||||
$container->get('Table')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Load Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return LoadDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getLoadDatabase(Container $container): LoadDatabase
|
|
||||||
{
|
|
||||||
return new LoadDatabase(
|
|
||||||
$container->get('Power.Model.Load'),
|
|
||||||
$container->get('Load')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Insert Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return InsertDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getInsertDatabase(Container $container): InsertDatabase
|
|
||||||
{
|
|
||||||
return new InsertDatabase(
|
|
||||||
$container->get('Power.Model.Upsert'),
|
|
||||||
$container->get('Insert')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Update Database
|
|
||||||
*
|
|
||||||
* @param Container $container The DI container.
|
|
||||||
*
|
|
||||||
* @return UpdateDatabase
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function getUpdateDatabase(Container $container): UpdateDatabase
|
|
||||||
{
|
|
||||||
return new UpdateDatabase(
|
|
||||||
$container->get('Power.Model.Upsert'),
|
|
||||||
$container->get('Update')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -121,7 +121,7 @@ class Generator implements ServiceProviderInterface
|
|||||||
public function getSearch(Container $container): Search
|
public function getSearch(Container $container): Search
|
||||||
{
|
{
|
||||||
return new Search(
|
return new Search(
|
||||||
$container->get('Power.Database.Load'),
|
$container->get('Data.Load'),
|
||||||
$container->get('Power.Parser'),
|
$container->get('Power.Parser'),
|
||||||
$container->get('Power.Generator.Bucket')
|
$container->get('Power.Generator.Bucket')
|
||||||
);
|
);
|
||||||
|
@ -109,8 +109,7 @@ class Power implements ServiceProviderInterface
|
|||||||
{
|
{
|
||||||
return new Superpower(
|
return new Superpower(
|
||||||
$container->get('Power.Grep'),
|
$container->get('Power.Grep'),
|
||||||
$container->get('Power.Database.Insert'),
|
$container->get('Data.Item')
|
||||||
$container->get('Power.Database.Update')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,11 +12,8 @@
|
|||||||
namespace VDM\Joomla\Componentbuilder\Power;
|
namespace VDM\Joomla\Componentbuilder\Power;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\GrepInterface as Grep;
|
use VDM\Joomla\Interfaces\Data\RemoteInterface;
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface as Insert;
|
use VDM\Joomla\Data\Remote;
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface as Update;
|
|
||||||
use VDM\Joomla\Utilities\GuidHelper;
|
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,171 +21,14 @@ use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
|
|||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
class Super implements SuperInterface
|
final class Super extends Remote implements RemoteInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The Power Search Tool
|
|
||||||
*
|
|
||||||
* @var Grep
|
|
||||||
* @since 3.2.0
|
|
||||||
**/
|
|
||||||
protected Grep $grep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert Data Class
|
|
||||||
*
|
|
||||||
* @var Insert
|
|
||||||
* @since 3.2.0
|
|
||||||
**/
|
|
||||||
protected Insert $insert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update Data Class
|
|
||||||
*
|
|
||||||
* @var Update
|
|
||||||
* @since 3.2.0
|
|
||||||
**/
|
|
||||||
protected Update $update;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table Name
|
* Table Name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
protected string $table = 'power';
|
protected string $table = 'power';
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param Grep $grep The Power Grep object.
|
|
||||||
* @param Insert $insert The Power Database Insert object.
|
|
||||||
* @param Update $update The Power Database Update object.
|
|
||||||
*
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function __construct(Grep $grep, Insert $insert, Update $update)
|
|
||||||
{
|
|
||||||
$this->grep = $grep;
|
|
||||||
$this->insert = $insert;
|
|
||||||
$this->update = $update;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init all power not found in database
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function init(): bool
|
|
||||||
{
|
|
||||||
if (($powers = $this->grep->getRemotePowersGuid()) !== null)
|
|
||||||
{
|
|
||||||
foreach($powers as $guid)
|
|
||||||
{
|
|
||||||
if ($this->action($guid) === 'insert' && ($power = $this->grep->get($guid, ['remote'])) !== null)
|
|
||||||
{
|
|
||||||
$this->insert($power);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the powers
|
|
||||||
*
|
|
||||||
* @param array $powers The global unique ids of the powers
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function reset(array $powers): bool
|
|
||||||
{
|
|
||||||
if ($powers === [])
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$success = true;
|
|
||||||
|
|
||||||
foreach($powers as $guid)
|
|
||||||
{
|
|
||||||
if (!$this->load($guid, ['remote']))
|
|
||||||
{
|
|
||||||
$success = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load a superpower
|
|
||||||
*
|
|
||||||
* @param string $guid The global unique id of the power
|
|
||||||
* @param array $order The search order
|
|
||||||
* @param string|null $action The action to load power
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool
|
|
||||||
{
|
|
||||||
if (($power = $this->grep->get($guid, $order)) !== null &&
|
|
||||||
($action !== null || ($action = $this->action($power->guid)) !== null))
|
|
||||||
{
|
|
||||||
return method_exists($this, $action) ? $this->{$action}($power) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a superpower
|
|
||||||
*
|
|
||||||
* @param object $power The power
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
private function insert(object $power): bool
|
|
||||||
{
|
|
||||||
return $this->insert->item($power);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update a superpower
|
|
||||||
*
|
|
||||||
* @param object $power The power
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
private function update(object $power): bool
|
|
||||||
{
|
|
||||||
return $this->update->item($power);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get loading action
|
|
||||||
*
|
|
||||||
* @param string $guid The global unique id of the power
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @since 3.2.0
|
|
||||||
*/
|
|
||||||
private function action(string $guid): string
|
|
||||||
{
|
|
||||||
if (($id = GuidHelper::item($guid, $this->table)) !== null && $id > 0)
|
|
||||||
{
|
|
||||||
return 'update';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'insert';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -465,6 +465,42 @@ abstract class FilterHelper
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get available repositories of target area
|
||||||
|
*
|
||||||
|
* @param int $target The target area
|
||||||
|
*
|
||||||
|
* @return array|null The result ids
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public static function repositories(int $target): ?array
|
||||||
|
{
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query
|
||||||
|
->select($db->quoteName(array('repository', 'organisation')))
|
||||||
|
->from($db->quoteName('#__componentbuilder_repository'))
|
||||||
|
->where($db->quoteName('published') . ' >= 1')
|
||||||
|
->where($db->quoteName('target') . ' = ' . $target)
|
||||||
|
->order($db->quoteName('ordering') . ' desc');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
if ($db->getNumRows())
|
||||||
|
{
|
||||||
|
$items = $db->loadObjectList();
|
||||||
|
$options = [];
|
||||||
|
foreach($items as $item)
|
||||||
|
{
|
||||||
|
$path = $item->organisation . '/' . $item->repository;
|
||||||
|
$options[$path] = $path;
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a component admin views IDs
|
* Get a component admin views IDs
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Componentbuilder\Utilities;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repositories Helper
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
abstract class RepoHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* get available repositories of target area
|
||||||
|
*
|
||||||
|
* @param int $target The target area
|
||||||
|
*
|
||||||
|
* @return array|null The result set
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public static function get(int $target): ?array
|
||||||
|
{
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select($db->quoteName(array(
|
||||||
|
'type',
|
||||||
|
'base',
|
||||||
|
'organisation',
|
||||||
|
'repository',
|
||||||
|
'read_branch',
|
||||||
|
'write_branch',
|
||||||
|
'token',
|
||||||
|
'username',
|
||||||
|
'target',
|
||||||
|
'access_repo',
|
||||||
|
'guid'
|
||||||
|
)))
|
||||||
|
->from($db->quoteName('#__componentbuilder_repository'))
|
||||||
|
->where($db->quoteName('published') . ' >= 1')
|
||||||
|
->where($db->quoteName('target') . ' = ' . $target)
|
||||||
|
->order($db->quoteName('ordering') . ' desc');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
if ($db->getNumRows())
|
||||||
|
{
|
||||||
|
$items = $db->loadObjectList();
|
||||||
|
$options = [];
|
||||||
|
foreach($items as $item)
|
||||||
|
{
|
||||||
|
if ($item->access_repo != 1)
|
||||||
|
{
|
||||||
|
unset($item->username);
|
||||||
|
unset($item->token);
|
||||||
|
}
|
||||||
|
unset($item->access_repo);
|
||||||
|
$path = $item->organisation . '/' . $item->repository;
|
||||||
|
$options[$path] = $item;
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
112
libraries/vendor_jcb/VDM.Joomla/src/Data/Action/Delete.php
Normal file
112
libraries/vendor_jcb/VDM.Joomla/src/Data/Action/Delete.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Data\Action;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\DeleteInterface as Database;
|
||||||
|
use VDM\Joomla\Interfaces\Data\DeleteInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Delete
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
class Delete implements DeleteInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Delete Class.
|
||||||
|
*
|
||||||
|
* @var Database
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Database $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Database $database The Delete Class.
|
||||||
|
* @param string|null $table The table name.
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function __construct(Database $database, ?string $table = null)
|
||||||
|
{
|
||||||
|
$this->database = $database;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string|null $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(?string $table): self
|
||||||
|
{
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all items in the database that match these conditions
|
||||||
|
*
|
||||||
|
* @param array $conditions Conditions by which to delete the data in database [array of arrays (key => value)]
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
**/
|
||||||
|
public function items(array $conditions): bool
|
||||||
|
{
|
||||||
|
return $this->database->items($conditions, $this->getTable());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncate a table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
**/
|
||||||
|
public function truncate(): void
|
||||||
|
{
|
||||||
|
$this->database->truncate($this->getTable());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,18 +9,18 @@
|
|||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\Power\Database;
|
namespace VDM\Joomla\Data\Action;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
||||||
use VDM\Joomla\Database\Insert as Database;
|
use VDM\Joomla\Interfaces\InsertInterface as Database;
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
|
use VDM\Joomla\Interfaces\Data\InsertInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power Database Insert
|
* Data Insert (GUID)
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
class Insert implements InsertInterface
|
class Insert implements InsertInterface
|
||||||
{
|
{
|
||||||
@ -46,20 +46,43 @@ class Insert implements InsertInterface
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
protected string $table = 'power';
|
protected string $table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Model $model The set model object.
|
* @param Model $model The set model object.
|
||||||
* @param Database $database The insert database object.
|
* @param Database $database The insert database object.
|
||||||
|
* @param string|null $table The table name.
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
public function __construct(Model $model, Database $database)
|
public function __construct(Model $model, Database $database, ?string $table = null)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string|null $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(?string $table): self
|
||||||
|
{
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,10 +120,10 @@ class Insert implements InsertInterface
|
|||||||
public function row(array $item): bool
|
public function row(array $item): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($item = $this->model->row($item, $this->table)) !== null)
|
if (($item = $this->model->row($item, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Insert the column of this table
|
// Insert the column of this table
|
||||||
return $this->database->row($item, $this->table);
|
return $this->database->row($item, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -117,10 +140,10 @@ class Insert implements InsertInterface
|
|||||||
public function rows(?array $items): bool
|
public function rows(?array $items): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($items = $this->model->rows($items, $this->table)) !== null)
|
if (($items = $this->model->rows($items, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Insert the column of this table
|
// Insert the column of this table
|
||||||
return $this->database->rows($items, $this->table);
|
return $this->database->rows($items, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -137,10 +160,10 @@ class Insert implements InsertInterface
|
|||||||
public function item(object $item): bool
|
public function item(object $item): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($item = $this->model->item($item, $this->table)) !== null)
|
if (($item = $this->model->item($item, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Insert the column of this table
|
// Insert the column of this table
|
||||||
return $this->database->item($item, $this->table);
|
return $this->database->item($item, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -157,12 +180,23 @@ class Insert implements InsertInterface
|
|||||||
public function items(?array $items): bool
|
public function items(?array $items): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($items = $this->model->items($items, $this->table)) !== null)
|
if (($items = $this->model->items($items, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using guid as the primary key.
|
||||||
return $this->database->items($items, $this->table);
|
return $this->database->items($items, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9,18 +9,18 @@
|
|||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\Power\Database;
|
namespace VDM\Joomla\Data\Action;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
||||||
use VDM\Joomla\Database\Load as Database;
|
use VDM\Joomla\Interfaces\LoadInterface as Database;
|
||||||
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
|
use VDM\Joomla\Interfaces\Data\LoadInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power Database Load
|
* Data Load (GUID)
|
||||||
*
|
*
|
||||||
* @since 2.0.1
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
class Load implements LoadInterface
|
class Load implements LoadInterface
|
||||||
{
|
{
|
||||||
@ -46,21 +46,43 @@ class Load implements LoadInterface
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
protected string $table = 'power';
|
protected string $table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Table $table The core table object.
|
|
||||||
* @param Model $model The model object.
|
* @param Model $model The model object.
|
||||||
* @param Database $load The database object.
|
* @param Database $load The database object.
|
||||||
|
* @param string|null $table The table name.
|
||||||
*
|
*
|
||||||
* @since 2.0.1
|
* @since 2.0.1
|
||||||
*/
|
*/
|
||||||
public function __construct(Model $model, Database $load)
|
public function __construct(Model $model, Database $load, ?string $table = null)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
$this->load = $load;
|
$this->load = $load;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string|null $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(?string $table): self
|
||||||
|
{
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +95,6 @@ class Load implements LoadInterface
|
|||||||
*
|
*
|
||||||
* @param array $keys The item keys
|
* @param array $keys The item keys
|
||||||
* @param string $field The field key
|
* @param string $field The field key
|
||||||
* @param string $table The table
|
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @since 2.0.1
|
* @since 2.0.1
|
||||||
@ -83,11 +104,11 @@ class Load implements LoadInterface
|
|||||||
return $this->model->value(
|
return $this->model->value(
|
||||||
$this->load->value(
|
$this->load->value(
|
||||||
["a.{$field}" => $field],
|
["a.{$field}" => $field],
|
||||||
['a' => $this->table],
|
['a' => $this->getTable()],
|
||||||
$this->prefix($keys)
|
$this->prefix($keys)
|
||||||
),
|
),
|
||||||
$field,
|
$field,
|
||||||
$this->table
|
$this->getTable()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +121,6 @@ class Load implements LoadInterface
|
|||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* @param array $keys The item keys
|
* @param array $keys The item keys
|
||||||
* @param string $table The table
|
|
||||||
*
|
*
|
||||||
* @return object|null
|
* @return object|null
|
||||||
* @since 2.0.1
|
* @since 2.0.1
|
||||||
@ -110,10 +130,10 @@ class Load implements LoadInterface
|
|||||||
return $this->model->item(
|
return $this->model->item(
|
||||||
$this->load->item(
|
$this->load->item(
|
||||||
['all' => 'a.*'],
|
['all' => 'a.*'],
|
||||||
['a' => $this->table],
|
['a' => $this->getTable()],
|
||||||
$this->prefix($keys)
|
$this->prefix($keys)
|
||||||
),
|
),
|
||||||
$this->table
|
$this->getTable()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +147,9 @@ class Load implements LoadInterface
|
|||||||
* ]
|
* ]
|
||||||
* ]
|
* ]
|
||||||
* );
|
* );
|
||||||
* Example: $this->items($ids, 'table_name');
|
* Example: $this->items($ids);
|
||||||
*
|
*
|
||||||
* @param array $keys The item keys
|
* @param array $keys The item keys
|
||||||
* @param string $table The table
|
|
||||||
*
|
*
|
||||||
* @return array|null
|
* @return array|null
|
||||||
* @since 2.0.1
|
* @since 2.0.1
|
||||||
@ -139,12 +158,23 @@ class Load implements LoadInterface
|
|||||||
{
|
{
|
||||||
return $this->model->items(
|
return $this->model->items(
|
||||||
$this->load->items(
|
$this->load->items(
|
||||||
['all' => 'a.*'], ['a' => $this->table], $this->prefix($keys)
|
['all' => 'a.*'], ['a' => $this->getTable()], $this->prefix($keys)
|
||||||
),
|
),
|
||||||
$this->table
|
$this->getTable()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add prefix to the keys
|
* Add prefix to the keys
|
||||||
*
|
*
|
@ -9,18 +9,18 @@
|
|||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace VDM\Joomla\Componentbuilder\Power\Database;
|
namespace VDM\Joomla\Data\Action;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
use VDM\Joomla\Interfaces\ModelInterface as Model;
|
||||||
use VDM\Joomla\Database\Update as Database;
|
use VDM\Joomla\Interfaces\UpdateInterface as Database;
|
||||||
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface;
|
use VDM\Joomla\Interfaces\Data\UpdateInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power Database Update
|
* Data Update
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
class Update implements UpdateInterface
|
class Update implements UpdateInterface
|
||||||
{
|
{
|
||||||
@ -46,20 +46,43 @@ class Update implements UpdateInterface
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
protected string $table = 'power';
|
protected string $table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Model $model The set model object.
|
* @param Model $model The set model object.
|
||||||
* @param Database $database The update database object.
|
* @param Database $database The update database object.
|
||||||
|
* @param string|null $table The table name.
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function __construct(Model $model, Database $database)
|
public function __construct(Model $model, Database $database, ?string $table = null)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string|null $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(?string $table): self
|
||||||
|
{
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,8 +104,8 @@ class Update implements UpdateInterface
|
|||||||
$item[$key] = $keyValue;
|
$item[$key] = $keyValue;
|
||||||
$item[$field] = $value;
|
$item[$field] = $value;
|
||||||
|
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using $key as the primary key.
|
||||||
return $this->row($item);
|
return $this->row($item, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,17 +113,18 @@ class Update implements UpdateInterface
|
|||||||
* Example: $this->item(Array);
|
* Example: $this->item(Array);
|
||||||
*
|
*
|
||||||
* @param array $item The item to save
|
* @param array $item The item to save
|
||||||
|
* @param string $key The key name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function row(array $item): bool
|
public function row(array $item, string $key = 'guid'): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($item = $this->model->row($item, $this->table)) !== null)
|
if (($item = $this->model->row($item, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using $key as the primary key.
|
||||||
return $this->database->row($item, 'guid', $this->table);
|
return $this->database->row($item, $key, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -110,17 +134,18 @@ class Update implements UpdateInterface
|
|||||||
* Example: $this->items(Array);
|
* Example: $this->items(Array);
|
||||||
*
|
*
|
||||||
* @param array|null $items The items updated in database (array of arrays)
|
* @param array|null $items The items updated in database (array of arrays)
|
||||||
|
* @param string $key The key name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function rows(?array $items): bool
|
public function rows(?array $items, string $key = 'guid'): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($items = $this->model->rows($items, $this->table)) !== null)
|
if (($items = $this->model->rows($items, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using $key as the primary key.
|
||||||
return $this->database->rows($items, 'guid', $this->table);
|
return $this->database->rows($items, $key, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -130,17 +155,18 @@ class Update implements UpdateInterface
|
|||||||
* Example: $this->item(Object);
|
* Example: $this->item(Object);
|
||||||
*
|
*
|
||||||
* @param object $item The item to save
|
* @param object $item The item to save
|
||||||
|
* @param string $key The key name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function item(object $item): bool
|
public function item(object $item, string $key = 'guid'): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($item = $this->model->item($item, $this->table)) !== null)
|
if (($item = $this->model->item($item, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using $key as the primary key.
|
||||||
return $this->database->item($item, 'guid', $this->table);
|
return $this->database->item($item, $key, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -150,19 +176,31 @@ class Update implements UpdateInterface
|
|||||||
* Example: $this->items(Array);
|
* Example: $this->items(Array);
|
||||||
*
|
*
|
||||||
* @param array|null $items The items updated in database (array of objects)
|
* @param array|null $items The items updated in database (array of objects)
|
||||||
|
* @param string $key The key name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function items(?array $items): bool
|
public function items(?array $items, string $key = 'guid'): bool
|
||||||
{
|
{
|
||||||
// check if object could be modelled
|
// check if object could be modelled
|
||||||
if (($items = $this->model->items($items, $this->table)) !== null)
|
if (($items = $this->model->items($items, $this->getTable())) !== null)
|
||||||
{
|
{
|
||||||
// Update the column of this table using guid as the primary key.
|
// Update the column of this table using $key as the primary key.
|
||||||
return $this->database->items($items, 'guid', $this->table);
|
return $this->database->items($items, $key, $this->getTable());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
254
libraries/vendor_jcb/VDM.Joomla/src/Data/Item.php
Normal file
254
libraries/vendor_jcb/VDM.Joomla/src/Data/Item.php
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Data;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\Data\LoadInterface as Load;
|
||||||
|
use VDM\Joomla\Interfaces\Data\InsertInterface as Insert;
|
||||||
|
use VDM\Joomla\Interfaces\Data\UpdateInterface as Update;
|
||||||
|
use VDM\Joomla\Interfaces\Data\DeleteInterface as Delete;
|
||||||
|
use VDM\Joomla\Interfaces\LoadInterface as Database;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Item
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
final class Item implements ItemInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Load Class.
|
||||||
|
*
|
||||||
|
* @var Load
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Load $load;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Insert Class.
|
||||||
|
*
|
||||||
|
* @var Insert
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Insert $insert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Update Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Delete Class.
|
||||||
|
*
|
||||||
|
* @var Delete
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Delete $delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Load Class.
|
||||||
|
*
|
||||||
|
* @var Database
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Database $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2.1
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Load $load The LoadInterface Class.
|
||||||
|
* @param Insert $insert The InsertInterface Class.
|
||||||
|
* @param Update $update The UpdateInterface Class.
|
||||||
|
* @param Delete $delete The UpdateInterface Class.
|
||||||
|
* @param Database $database The Database Load Class.
|
||||||
|
* @param string|null $table The table name.
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function __construct(Load $load, Insert $insert, Update $update,
|
||||||
|
Delete $delete, Database $database, ?string $table = null)
|
||||||
|
{
|
||||||
|
$this->load = $load;
|
||||||
|
$this->insert = $insert;
|
||||||
|
$this->update = $update;
|
||||||
|
$this->delete = $delete;
|
||||||
|
$this->database = $database;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an item
|
||||||
|
*
|
||||||
|
* @param string $value The item key value
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return object|null The item object or null
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function get(string $value, string $key = 'guid'): ?object
|
||||||
|
{
|
||||||
|
return $this->load->table($this->getTable())->item([$key => $value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value
|
||||||
|
*
|
||||||
|
* @param string $value The item key value
|
||||||
|
* @param string $key The item key
|
||||||
|
* @param string $get The key of the values we want back
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function value(string $value, string $key = 'guid', string $get = 'id')
|
||||||
|
{
|
||||||
|
// Perform the database query
|
||||||
|
$value = $this->database->value(
|
||||||
|
["a.$get" => $get],
|
||||||
|
["a" => $this->getTable()],
|
||||||
|
["a.$key" => $value]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if rows are found
|
||||||
|
if ($value !== null)
|
||||||
|
{
|
||||||
|
// Return the value
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return null if no rows are found
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an item
|
||||||
|
*
|
||||||
|
* @param object $item The item
|
||||||
|
* @param string $key The item key
|
||||||
|
* @param string|null $action The action to load power
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(object $item, string $key = 'guid', ?string $action = null): bool
|
||||||
|
{
|
||||||
|
if ($action !== null || (isset($item->{$key}) && ($action = $this->action($item->{$key}, $key)) !== null))
|
||||||
|
{
|
||||||
|
return method_exists($this, $action) ? $this->{$action}($item, $key) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an item
|
||||||
|
*
|
||||||
|
* @param string $value The item key value
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function delete(string $value, string $key = 'guid'): bool
|
||||||
|
{
|
||||||
|
return $this->delete->table($this->getTable())->items([$key => $value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a item
|
||||||
|
*
|
||||||
|
* @param object $item The item
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function insert(object $item): bool
|
||||||
|
{
|
||||||
|
return $this->insert->table($this->getTable())->item($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a item
|
||||||
|
*
|
||||||
|
* @param object $item The item
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function update(object $item, string $key): bool
|
||||||
|
{
|
||||||
|
return $this->update->table($this->getTable())->item($item, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get loading action
|
||||||
|
*
|
||||||
|
* @param string $value The key value the item
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function action(string $value, string $key): string
|
||||||
|
{
|
||||||
|
if (($id = $this->value($value, $key, 'id')) !== null && $id > 0)
|
||||||
|
{
|
||||||
|
return 'update';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'insert';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
351
libraries/vendor_jcb/VDM.Joomla/src/Data/Items.php
Normal file
351
libraries/vendor_jcb/VDM.Joomla/src/Data/Items.php
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Data;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\Data\LoadInterface as Load;
|
||||||
|
use VDM\Joomla\Interfaces\Data\InsertInterface as Insert;
|
||||||
|
use VDM\Joomla\Interfaces\Data\UpdateInterface as Update;
|
||||||
|
use VDM\Joomla\Interfaces\Data\DeleteInterface as Delete;
|
||||||
|
use VDM\Joomla\Interfaces\LoadInterface as Database;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemsInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Items
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
final class Items implements ItemsInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The LoadInterface Class.
|
||||||
|
*
|
||||||
|
* @var Load
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Load $load;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The InsertInterface Class.
|
||||||
|
*
|
||||||
|
* @var Insert
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Insert $insert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UpdateInterface Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DeleteInterface Class.
|
||||||
|
*
|
||||||
|
* @var Delete
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Delete $delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Load Class.
|
||||||
|
*
|
||||||
|
* @var Database
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected Database $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2.1
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Load $load The LoadInterface Class.
|
||||||
|
* @param Insert $insert The InsertInterface Class.
|
||||||
|
* @param Update $update The UpdateInterface Class.
|
||||||
|
* @param Delete $delete The DeleteInterface Class.
|
||||||
|
* @param Database $database The Database Load Class.
|
||||||
|
* @param string|null $table The table name.
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function __construct(Load $load, Insert $insert, Update $update, Delete $delete,
|
||||||
|
Database $database, ?string $table = null)
|
||||||
|
{
|
||||||
|
$this->load = $load;
|
||||||
|
$this->insert = $insert;
|
||||||
|
$this->update = $update;
|
||||||
|
$this->delete = $delete;
|
||||||
|
$this->database = $database;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of items
|
||||||
|
*
|
||||||
|
* @param array $values The ids of the items
|
||||||
|
* @param string $key The key of the values
|
||||||
|
*
|
||||||
|
* @return array|null The item object or null
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function get(array $values, string $key = 'guid'): ?array
|
||||||
|
{
|
||||||
|
return $this->load->table($this->getTable())->items([
|
||||||
|
$key => [
|
||||||
|
'operator' => 'IN',
|
||||||
|
'value' => array_values($values)
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the values
|
||||||
|
*
|
||||||
|
* @param array $values The list of values (to search by).
|
||||||
|
* @param string $key The key on which the values being searched.
|
||||||
|
* @param string $get The key of the values we want back
|
||||||
|
*
|
||||||
|
* @return array|null The array of found values.
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function values(array $values, string $key = 'guid', string $get = 'id'): ?array
|
||||||
|
{
|
||||||
|
// Perform the database query
|
||||||
|
$rows = $this->database->rows(
|
||||||
|
["a.$get" => $get],
|
||||||
|
["a" => $this->getTable()],
|
||||||
|
["a.$key" => ['operator' => 'IN', 'value' => $values]]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if rows are found
|
||||||
|
if ($rows !== null)
|
||||||
|
{
|
||||||
|
// Return the values from the found rows
|
||||||
|
return array_values(
|
||||||
|
array_map(
|
||||||
|
fn($row) => $row[$get],
|
||||||
|
$rows
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return null if no rows are found
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set items
|
||||||
|
*
|
||||||
|
* @param array $items The list of items
|
||||||
|
* @param string $key The key on which the items should be set
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(array $items, string $key = 'guid'): bool
|
||||||
|
{
|
||||||
|
if (($sets = $this->sort($items, $key)) !== null)
|
||||||
|
{
|
||||||
|
foreach ($sets as $action => $items)
|
||||||
|
{
|
||||||
|
$this->{$action}($items, $key);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete items
|
||||||
|
*
|
||||||
|
* @param array $values The item key value
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function delete(string $values, string $key = 'guid'): bool
|
||||||
|
{
|
||||||
|
return $this->delete->table($this->getTable())->items([$key => ['operator' => 'IN', 'value' => $values]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a item
|
||||||
|
*
|
||||||
|
* @param array $items The item
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function insert(array $items): bool
|
||||||
|
{
|
||||||
|
return $this->insert->table($this->getTable())->rows($items);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a item
|
||||||
|
*
|
||||||
|
* @param object $item The item
|
||||||
|
* @param string $key The item key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function update(array $items, string $key): bool
|
||||||
|
{
|
||||||
|
return $this->update->table($this->getTable())->rows($items, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort items between insert and update.
|
||||||
|
*
|
||||||
|
* @param array $items The list of items.
|
||||||
|
* @param string $key The key on which the items should be sorted.
|
||||||
|
*
|
||||||
|
* @return array|null The sorted sets.
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function sort(array $items, string $key): ?array
|
||||||
|
{
|
||||||
|
// Extract relevant items based on the key.
|
||||||
|
$values = $this->extractValues($items, $key);
|
||||||
|
if ($values === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sets = [
|
||||||
|
'insert' => [],
|
||||||
|
'update' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// Check for existing items.
|
||||||
|
$existingItems = $this->values($values, $key, $key);
|
||||||
|
if ($existingItems !== null)
|
||||||
|
{
|
||||||
|
$sets['update'] = $this->extractSet($items, $existingItems, $key) ?? [];
|
||||||
|
$sets['insert'] = $this->extractSet($items, $existingItems, $key, true) ?? [];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sets['insert'] = $items;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If either set is empty, remove it from the result.
|
||||||
|
$sets = array_filter($sets);
|
||||||
|
|
||||||
|
return !empty($sets) ? $sets : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts values for a given key from an array of items.
|
||||||
|
* Items can be either arrays or objects.
|
||||||
|
*
|
||||||
|
* @param array $items Array of items (arrays or objects)
|
||||||
|
* @param string $key The key to extract values for
|
||||||
|
*
|
||||||
|
* @return array|null Extracted values
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function extractValues(array $items, string $key): ?array
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($items as $item)
|
||||||
|
{
|
||||||
|
if (is_array($item) && !empty($item[$key]))
|
||||||
|
{
|
||||||
|
$result[] = $item[$key];
|
||||||
|
}
|
||||||
|
elseif (is_object($item) && !empty($item->{$key}))
|
||||||
|
{
|
||||||
|
$result[] = $item->{$key};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($result === []) ? null : $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts items from an array of items based on a set.
|
||||||
|
* Items can be either arrays or objects.
|
||||||
|
*
|
||||||
|
* @param array $items Array of items (arrays or objects)
|
||||||
|
* @param array $set The set to match values against
|
||||||
|
* @param string $key The key of the set values
|
||||||
|
* @param bool $inverse Whether to extract items not in the set
|
||||||
|
*
|
||||||
|
* @return array|null Extracted values
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
private function extractSet(array $items, array $set, string $key, bool $inverse = false): ?array
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($items as $item)
|
||||||
|
{
|
||||||
|
$value = is_array($item) ? ($item[$key] ?? null) : ($item->{$key} ?? null);
|
||||||
|
|
||||||
|
if ($value !== null)
|
||||||
|
{
|
||||||
|
$inSet = in_array($value, $set);
|
||||||
|
if (($inSet && !$inverse) || (!$inSet && $inverse))
|
||||||
|
{
|
||||||
|
$result[] = is_array($item) ? $item : (array) $item; // convert all to arrays
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return empty($result) ? null : $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
169
libraries/vendor_jcb/VDM.Joomla/src/Data/Remote.php
Normal file
169
libraries/vendor_jcb/VDM.Joomla/src/Data/Remote.php
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Data;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\GrepInterface as Grep;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||||
|
use VDM\Joomla\Interfaces\Data\RemoteInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data based on global unique ids from remote system
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
class Remote implements RemoteInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Grep Class.
|
||||||
|
*
|
||||||
|
* @var Grep
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected Grep $grep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2.1
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Grep $grep The GrepInterface Class.
|
||||||
|
* @param Item $item The ItemInterface Class.
|
||||||
|
* @param string|null $table The table name.
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public function __construct(Grep $grep, Item $item, ?string $table = null)
|
||||||
|
{
|
||||||
|
$this->grep = $grep;
|
||||||
|
$this->item = $item;
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init all items not found in database
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public function init(): bool
|
||||||
|
{
|
||||||
|
if (($items = $this->grep->getRemotePowersGuid()) !== null)
|
||||||
|
{
|
||||||
|
foreach($items as $guid)
|
||||||
|
{
|
||||||
|
if ($this->item->table($this->getTable())->value($guid) !== null &&
|
||||||
|
($item = $this->grep->get($guid, ['remote'])) !== null)
|
||||||
|
{
|
||||||
|
$this->item->set($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the items
|
||||||
|
*
|
||||||
|
* @param array $items The global unique ids of the items
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public function reset(array $items): bool
|
||||||
|
{
|
||||||
|
if ($items === [])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$success = true;
|
||||||
|
|
||||||
|
foreach($items as $guid)
|
||||||
|
{
|
||||||
|
if (!$this->load($guid, ['remote']))
|
||||||
|
{
|
||||||
|
$success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a item
|
||||||
|
*
|
||||||
|
* @param string $guid The global unique id of the item
|
||||||
|
* @param array $order The search order
|
||||||
|
* @param string|null $action The action to load power
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool
|
||||||
|
{
|
||||||
|
if (($item = $this->grep->get($guid, $order)) !== null)
|
||||||
|
{
|
||||||
|
return $this->item->table($this->getTable())->set($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
132
libraries/vendor_jcb/VDM.Joomla/src/Database/Delete.php
Normal file
132
libraries/vendor_jcb/VDM.Joomla/src/Database/Delete.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Database;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
|
use VDM\Joomla\Interfaces\DeleteInterface;
|
||||||
|
use VDM\Joomla\Abstraction\Database;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Delete Class
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
final class Delete extends Database implements DeleteInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Delete all items in the database that match these conditions
|
||||||
|
*
|
||||||
|
* @param array $conditions Conditions by which to delete the data in database [array of arrays (key => value)]
|
||||||
|
* @param string $table The table where the data is being deleted
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.2
|
||||||
|
**/
|
||||||
|
public function items(array $conditions, string $table): bool
|
||||||
|
{
|
||||||
|
// set the update columns
|
||||||
|
if ($conditions === [])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get a query object
|
||||||
|
$query = $this->db->getQuery(true);
|
||||||
|
|
||||||
|
// start the conditions bucket
|
||||||
|
$_conditions = [];
|
||||||
|
foreach ($conditions as $key => $value)
|
||||||
|
{
|
||||||
|
if (ArrayHelper::check($value))
|
||||||
|
{
|
||||||
|
if (isset($value['value']) && isset($value['operator']))
|
||||||
|
{
|
||||||
|
// check if value needs to be quoted
|
||||||
|
$quote = $value['quote'] ?? true;
|
||||||
|
if (!$quote)
|
||||||
|
{
|
||||||
|
if (ArrayHelper::check($value['value']))
|
||||||
|
{
|
||||||
|
// add the where by array
|
||||||
|
$_conditions[] = $this->db->quoteName($key)
|
||||||
|
. ' ' . $value['operator']
|
||||||
|
. ' ' . ' (' .
|
||||||
|
implode(',', $value['value'])
|
||||||
|
. ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add the conditions
|
||||||
|
$_conditions[] = $this->db->quoteName($key)
|
||||||
|
. ' ' . $value['operator']
|
||||||
|
. ' ' . $value['value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ArrayHelper::check($value['value']))
|
||||||
|
{
|
||||||
|
// add the where by array
|
||||||
|
$_conditions[] = $this->db->quoteName($key)
|
||||||
|
. ' ' . $value['operator']
|
||||||
|
. ' ' . ' (' .
|
||||||
|
implode(',', array_map(fn($val) => $this->quote($val), $value['value']))
|
||||||
|
. ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add the conditions
|
||||||
|
$_conditions[] = $this->db->quoteName($key)
|
||||||
|
. ' ' . $value['operator']
|
||||||
|
. ' ' . $this->quote($value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we should through an exception
|
||||||
|
// for security we just return false for now
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add default condition
|
||||||
|
$_conditions[] = $this->db->quoteName($key) . ' = ' . $this->quote($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the query targets
|
||||||
|
$query->delete($this->db->quoteName($this->getTable($table)));
|
||||||
|
$query->where($_conditions);
|
||||||
|
|
||||||
|
$this->db->setQuery($query);
|
||||||
|
|
||||||
|
return $this->db->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncate a table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be truncated
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
**/
|
||||||
|
public function truncate(string $table): void
|
||||||
|
{
|
||||||
|
$this->db->truncateTable($this->getTable($table));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user