Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
cc35295cf6 | |||
3329aad3c7 | |||
47f90de990 | |||
8b8b42ae8f | |||
f200e635b8 | |||
e905aa895f | |||
2f4f9ff0a3 | |||
d961652f56 | |||
dfef0774f3 | |||
88dbcee380 | |||
8b4efd640f | |||
cec566176d | |||
74f2d8df56 | |||
47d1a6c155 | |||
909a91844f | |||
0857101371 | |||
a110ff0e35 | |||
4b57e69edb | |||
d1813147d3 | |||
48a3a49d6f | |||
98448b24b7 | |||
0dc22b100b | |||
dfff74989e | |||
4e7d4af1d3 | |||
81e5038bb2 | |||
82c9b6edef | |||
3002e093de | |||
a0890ea87f | |||
04aefa256b | |||
131d144ce8 | |||
c53716b811 | |||
694612aff9 | |||
51d13b75f0 | |||
802554e7a9 | |||
e6b2b48ac7 | |||
6d4c823ea6 | |||
10fdac5d60 | |||
6a77d71095 | |||
5d3a68b448 | |||
0a4b8f067f | |||
af1e76d21e | |||
07662a8a8b | |||
65e0a19dee | |||
4e740f568e | |||
0ba2a0e8cf | |||
856a6fad3f | |||
4f7ddcefe7 | |||
b761c7b22d |
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 safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.0) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.7) 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)
|
||||
|
||||
@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 21st March, 2018
|
||||
+ *Version*: 2.7.0
|
||||
+ *Last Build*: 4th May, 2018
|
||||
+ *Version*: 2.7.7
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **186509**
|
||||
+ *Field count*: **994**
|
||||
+ *File count*: **1171**
|
||||
+ *Folder count*: **189**
|
||||
+ *Line count*: **193747**
|
||||
+ *Field count*: **1034**
|
||||
+ *File count*: **1201**
|
||||
+ *Folder count*: **193**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -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 safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.0) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.7.7) 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)
|
||||
|
||||
@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 21st March, 2018
|
||||
+ *Version*: 2.7.0
|
||||
+ *Last Build*: 4th May, 2018
|
||||
+ *Version*: 2.7.7
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **186509**
|
||||
+ *Field count*: **994**
|
||||
+ *File count*: **1171**
|
||||
+ *Folder count*: **189**
|
||||
+ *Line count*: **193747**
|
||||
+ *Field count*: **1034**
|
||||
+ *File count*: **1201**
|
||||
+ *Folder count*: **193**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -212,15 +212,16 @@
|
||||
<action name="fieldtype.submenu" title="COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU" description="COM_COMPONENTBUILDER_FIELDTYPES_SUBMENU_DESC" />
|
||||
<action name="get_snippets.access" title="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC" />
|
||||
<action name="get_snippets.custom_admin_views" title="COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.dashboard_list" title="COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST_DESC" />
|
||||
<action name="get_snippets.layouts" title="COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.libraries" title="COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.site_views" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.snippets" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="get_snippets.submenu" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU_DESC" />
|
||||
<action name="get_snippets.templates" title="COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC" />
|
||||
<action name="help_document.access" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC" />
|
||||
<action name="help_document.batch" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC" />
|
||||
<action name="help_document.create" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC" />
|
||||
<action name="help_document.dashboard_add" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD_DESC" />
|
||||
<action name="help_document.dashboard_list" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST_DESC" />
|
||||
<action name="help_document.delete" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DELETE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_DELETE_DESC" />
|
||||
<action name="help_document.edit" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_DESC" />
|
||||
@ -231,8 +232,9 @@
|
||||
<action name="help_document.import" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT_DESC" />
|
||||
<action name="help_document.submenu" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU_DESC" />
|
||||
<action name="joomla_component.backup" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.export_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.import_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.clone" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.export_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.import_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.access" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC" />
|
||||
<action name="joomla_component.batch" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC" />
|
||||
<action name="joomla_component.create" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC" />
|
||||
@ -246,6 +248,7 @@
|
||||
<action name="joomla_component.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC" />
|
||||
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
|
||||
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
|
||||
<action name="language.build" title="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC" />
|
||||
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
|
||||
<action name="language_translation.batch" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC" />
|
||||
<action name="language_translation.create" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC" />
|
||||
@ -344,7 +347,6 @@
|
||||
<action name="snippet_type.version" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION_DESC" />
|
||||
<action name="snippet.access" title="COM_COMPONENTBUILDER_SNIPPETS_ACCESS" description="COM_COMPONENTBUILDER_SNIPPETS_ACCESS_DESC" />
|
||||
<action name="snippet.batch" title="COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE" description="COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC" />
|
||||
<action name="snippet.dashboard_add" title="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD_DESC" />
|
||||
<action name="snippet.dashboard_list" title="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST_DESC" />
|
||||
<action name="snippet.version" title="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC" />
|
||||
<action name="snippet.export" title="COM_COMPONENTBUILDER_SNIPPETS_EXPORT" description="COM_COMPONENTBUILDER_SNIPPETS_EXPORT_DESC" />
|
||||
@ -359,6 +361,18 @@
|
||||
<action name="template.export" title="COM_COMPONENTBUILDER_TEMPLATES_EXPORT" description="COM_COMPONENTBUILDER_TEMPLATES_EXPORT_DESC" />
|
||||
<action name="template.import" title="COM_COMPONENTBUILDER_TEMPLATES_IMPORT" description="COM_COMPONENTBUILDER_TEMPLATES_IMPORT_DESC" />
|
||||
<action name="template.submenu" title="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU" description="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU_DESC" />
|
||||
<action name="validation_rule.access" title="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS" description="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC" />
|
||||
<action name="validation_rule.batch" title="COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC" />
|
||||
<action name="validation_rule.create" title="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC" />
|
||||
<action name="validation_rule.dashboard_list" title="COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST_DESC" />
|
||||
<action name="validation_rule.delete" title="COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE_DESC" />
|
||||
<action name="validation_rule.edit" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_DESC" />
|
||||
<action name="validation_rule.edit.own" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC" />
|
||||
<action name="validation_rule.edit.state" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC" />
|
||||
<action name="validation_rule.version" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC" />
|
||||
<action name="validation_rule.export" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC" />
|
||||
<action name="validation_rule.import" title="COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT" description="COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC" />
|
||||
<action name="validation_rule.submenu" title="COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU" description="COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC" />
|
||||
</section>
|
||||
<section name="joomla_component">
|
||||
<action name="joomla_component.edit" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_DESC" />
|
||||
@ -456,6 +470,15 @@
|
||||
<action name="snippet.access" title="COM_COMPONENTBUILDER_SNIPPETS_ACCESS" description="COM_COMPONENTBUILDER_SNIPPETS_ACCESS_DESC" />
|
||||
<action name="snippet.version" title="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="validation_rule">
|
||||
<action name="validation_rule.edit" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_DESC" />
|
||||
<action name="validation_rule.edit.state" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC" />
|
||||
<action name="validation_rule.edit.own" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC" />
|
||||
<action name="validation_rule.create" title="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC" />
|
||||
<action name="validation_rule.delete" title="COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE" description="COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE_DESC" />
|
||||
<action name="validation_rule.access" title="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS" description="COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC" />
|
||||
<action name="validation_rule.version" title="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION" description="COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="field">
|
||||
<action name="field.edit" title="COM_COMPONENTBUILDER_FIELDS_EDIT" description="COM_COMPONENTBUILDER_FIELDS_EDIT_DESC" />
|
||||
<action name="field.edit.state" title="COM_COMPONENTBUILDER_FIELDS_EDIT_STATE" description="COM_COMPONENTBUILDER_FIELDS_EDIT_STATE_DESC" />
|
||||
|
@ -26,6 +26,8 @@
|
||||
.no-click {
|
||||
pointer-events: none;
|
||||
}
|
||||
.fieldMedium { width: 130px; }
|
||||
.fieldMedium { width: 120px; }
|
||||
.fieldMid { width: 80px; }
|
||||
.fieldFull { width: 100%; }
|
||||
.fieldSmall { width: 60px; }
|
||||
code { display: inline-block; margin: 3px;}
|
||||
|
@ -42,4 +42,7 @@ width: 100% !important;
|
||||
}
|
||||
.jform_dynamic_get_input_width {
|
||||
width: 90% !important;
|
||||
}
|
||||
.uk-scrollable-box {
|
||||
height: 380px !important;
|
||||
}
|
||||
|
@ -24,4 +24,6 @@
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
|
||||
.uk-scrollable-box { height: 380px !important; }
|
||||
.subform-table-sublayout-section .controls { margin-left: 0px; }
|
||||
|
@ -36,4 +36,7 @@ width: 100% !important;
|
||||
}
|
||||
.jform_dynamic_get_input_width {
|
||||
width: 90% !important;
|
||||
}
|
||||
.uk-scrollable-box {
|
||||
height: 380px !important;
|
||||
}
|
||||
|
@ -42,4 +42,7 @@ width: 100% !important;
|
||||
}
|
||||
.jform_dynamic_get_input_width {
|
||||
width: 90% !important;
|
||||
}
|
||||
.uk-scrollable-box {
|
||||
height: 380px !important;
|
||||
}
|
||||
|
@ -36,4 +36,7 @@ width: 100% !important;
|
||||
}
|
||||
.jform_dynamic_get_input_width {
|
||||
width: 90% !important;
|
||||
}
|
||||
.uk-scrollable-box {
|
||||
height: 380px !important;
|
||||
}
|
||||
|
27
admin/assets/css/validation_rule.css
Normal file
27
admin/assets/css/validation_rule.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage validation_rule.css
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
27
admin/assets/css/validation_rules.css
Normal file
27
admin/assets/css/validation_rules.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage validation_rules.css
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
BIN
admin/assets/images/icons/importjcbpackages.png
Normal file
BIN
admin/assets/images/icons/importjcbpackages.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
BIN
admin/assets/images/icons/validation_rules.png
Normal file
BIN
admin/assets/images/icons/validation_rules.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
23
admin/compiler/JCB.txt
Normal file
23
admin/compiler/JCB.txt
Normal file
@ -0,0 +1,23 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version ###VERSION###
|
||||
@created ###CREATIONDATE###
|
||||
@package ###Component_name###
|
||||
@subpackage ###FILENAME###
|
||||
@author ###AUTHOR### <###AUTHORWEBSITE###>###CONTRIBUTORS###
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright ###COPYRIGHT###
|
||||
@license ###LICENSE###
|
||||
|
||||
###SHORT_DESCRIPTION###
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
22
admin/compiler/SD.txt
Normal file
22
admin/compiler/SD.txt
Normal file
@ -0,0 +1,22 @@
|
||||
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
____ ____ __ __ __
|
||||
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
|
||||
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
|
||||
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
|
||||
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
|
||||
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
|
||||
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
|
||||
|
||||
/------------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version ###VERSION###
|
||||
@created ###CREATIONDATE###
|
||||
@package ###Component_name###
|
||||
@subpackage ###FILENAME###
|
||||
@author ###AUTHOR### <###AUTHORWEBSITE###>###CONTRIBUTORS###
|
||||
@copyright ###COPYRIGHT###
|
||||
@license ###LICENSE###
|
||||
|
||||
###SHORT_DESCRIPTION###
|
||||
|
||||
/----------------------------------------------------------------------------------------------------------------------------------*/
|
@ -110,6 +110,19 @@ abstract class ###Component###Helper
|
||||
###SUBMENU###
|
||||
}###HELPER_CREATEUSER### ###HELPER_UIKIT### ###HELPER_EXEL###
|
||||
|
||||
/**
|
||||
* Get a Variable
|
||||
*
|
||||
* @param string $table The table from which to get the variable
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
*
|
||||
* @return mix string/int/float
|
||||
*
|
||||
*/
|
||||
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###')
|
||||
{
|
||||
if(!$where)
|
||||
@ -150,6 +163,20 @@ abstract class ###Component###Helper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of variables
|
||||
*
|
||||
* @param string $table The table from which to get the variables
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
* @param bool $unique The switch to return a unique array
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true)
|
||||
{
|
||||
if(!$where)
|
||||
@ -198,8 +225,15 @@ abstract class ###Component###Helper
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null)
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
// do some table foot work
|
||||
$external = false;
|
||||
if (strpos($table, '#__') !== false)
|
||||
{
|
||||
$external = true;
|
||||
$table = str_replace('#__', '', $table);
|
||||
}
|
||||
// check if string is JSON
|
||||
$result = json_decode($value, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE)
|
||||
@ -212,9 +246,19 @@ abstract class ###Component###Helper
|
||||
$names = array();
|
||||
foreach ($result as $val)
|
||||
{
|
||||
if ($name = self::getVar($table, $val, 'id', 'name'))
|
||||
if ($external)
|
||||
{
|
||||
$names[] = $name;
|
||||
if ($name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
{
|
||||
$names[] = $name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($name = self::getVar($table, $val, $id, $name))
|
||||
{
|
||||
$names[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self::checkArray($names))
|
||||
@ -618,28 +662,141 @@ abstract class ###Component###Helper
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAppend
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlAppend(&$xml, $node)
|
||||
{
|
||||
if (!$node)
|
||||
{
|
||||
// element was not returned
|
||||
return;
|
||||
}
|
||||
switch (get_class($node))
|
||||
{
|
||||
case 'stdClass':
|
||||
if (property_exists($node, 'comment'))
|
||||
{
|
||||
self::xmlComment($xml, $node->comment);
|
||||
}
|
||||
if (property_exists($node, 'fieldXML'))
|
||||
{
|
||||
self::xmlAppend($xml, $node->fieldXML);
|
||||
}
|
||||
break;
|
||||
case 'SimpleXMLElement':
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domNode = dom_import_simplexml($node);
|
||||
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlComment
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param string $comment The comment to inject
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlComment(&$xml, $comment)
|
||||
{
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domComment = new DOMComment($comment);
|
||||
$nodeTarget = $domXML->ownerDocument->importNode($domComment, true);
|
||||
$domXML->appendChild($nodeTarget);
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddAttributes
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $attributes The attributes to apply to the XML element
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlAddAttributes(&$xml, $attributes = array())
|
||||
{
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
$xml->addAttribute($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddOptions
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public static function xmlAddOptions(&$xml, $options = array())
|
||||
{
|
||||
foreach ($options as $key => $value)
|
||||
{
|
||||
$addOption = $xml->addChild('option');
|
||||
$addOption->addAttribute('value', $key);
|
||||
$addOption[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
* @param array $args All the args for the button
|
||||
* 0) name
|
||||
* 1) additional (options class) // not used at this time
|
||||
* 2) default
|
||||
* 3) yes (name)
|
||||
* 4) no (name)
|
||||
*
|
||||
* @return string The input html of the button
|
||||
*
|
||||
*/
|
||||
public static function renderBoolButton()
|
||||
{
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// start the xml
|
||||
$buttonXML = new SimpleXMLElement('<field/>');
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button',
|
||||
'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// load the haskey attributes
|
||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||
// load the button options
|
||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
||||
|
||||
// get the radio element
|
||||
$button = JFormHelper::loadFieldType('radio');
|
||||
|
||||
// setup the properties
|
||||
$name = self::htmlEscape($args[0]);
|
||||
$additional = isset($args[1]) ? (string) $args[1] : '';
|
||||
$value = $args[2];
|
||||
$yes = isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES';
|
||||
$no = isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO';
|
||||
|
||||
// prepare the xml
|
||||
$element = new SimpleXMLElement('<field name="'.$name.'" type="radio" class="btn-group"><option '.$additional.' value="0">'.$no.'</option><option '.$additional.' value="1">'.$yes.'</option></field>');
|
||||
|
||||
// run
|
||||
$button->setup($element, $value);
|
||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
||||
|
||||
return $button->input;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,8 +35,15 @@ defined('_JEXEC') or die('Restricted access');
|
||||
abstract class ###Component###Helper
|
||||
{###SITE_GLOBAL_EVENT_HELPER### ###SITE_CUSTOM_HELPER_SCRIPT### ###BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null)
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
// do some table foot work
|
||||
$external = false;
|
||||
if (strpos($table, '#__') !== false)
|
||||
{
|
||||
$external = true;
|
||||
$table = str_replace('#__', '', $table);
|
||||
}
|
||||
// check if string is JSON
|
||||
$result = json_decode($value, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE)
|
||||
@ -49,9 +56,19 @@ abstract class ###Component###Helper
|
||||
$names = array();
|
||||
foreach ($result as $val)
|
||||
{
|
||||
if ($name = self::getVar($table, $val, 'id', 'name'))
|
||||
if ($external)
|
||||
{
|
||||
$names[] = $name;
|
||||
if ($name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
{
|
||||
$names[] = $name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($name = self::getVar($table, $val, $id, $name))
|
||||
{
|
||||
$names[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self::checkArray($names))
|
||||
@ -291,30 +308,156 @@ abstract class ###Component###Helper
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAppend
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlAppend(&$xml, $node)
|
||||
{
|
||||
if (!$node)
|
||||
{
|
||||
// element was not returned
|
||||
return;
|
||||
}
|
||||
switch (get_class($node))
|
||||
{
|
||||
case 'stdClass':
|
||||
if (property_exists($node, 'comment'))
|
||||
{
|
||||
self::xmlComment($xml, $node->comment);
|
||||
}
|
||||
if (property_exists($node, 'fieldXML'))
|
||||
{
|
||||
self::xmlAppend($xml, $node->fieldXML);
|
||||
}
|
||||
break;
|
||||
case 'SimpleXMLElement':
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domNode = dom_import_simplexml($node);
|
||||
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlComment
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param string $comment The comment to inject
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlComment(&$xml, $comment)
|
||||
{
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domComment = new DOMComment($comment);
|
||||
$nodeTarget = $domXML->ownerDocument->importNode($domComment, true);
|
||||
$domXML->appendChild($nodeTarget);
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddAttributes
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $attributes The attributes to apply to the XML element
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public static function xmlAddAttributes(&$xml, $attributes = array())
|
||||
{
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
$xml->addAttribute($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddOptions
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public static function xmlAddOptions(&$xml, $options = array())
|
||||
{
|
||||
foreach ($options as $key => $value)
|
||||
{
|
||||
$addOption = $xml->addChild('option');
|
||||
$addOption->addAttribute('value', $key);
|
||||
$addOption[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
* @param array $args All the args for the button
|
||||
* 0) name
|
||||
* 1) additional (options class) // not used at this time
|
||||
* 2) default
|
||||
* 3) yes (name)
|
||||
* 4) no (name)
|
||||
*
|
||||
* @return string The input html of the button
|
||||
*
|
||||
*/
|
||||
public static function renderBoolButton()
|
||||
{
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// start the xml
|
||||
$buttonXML = new SimpleXMLElement('<field/>');
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button',
|
||||
'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// load the haskey attributes
|
||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||
// load the button options
|
||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
||||
|
||||
// get the radio element
|
||||
$button = JFormHelper::loadFieldType('radio');
|
||||
|
||||
// setup the properties
|
||||
$name = self::htmlEscape($args[0]);
|
||||
$additional = isset($args[1]) ? (string) $args[1] : '';
|
||||
$value = $args[2];
|
||||
$yes = isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES';
|
||||
$no = isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO';
|
||||
|
||||
// prepare the xml
|
||||
$element = new SimpleXMLElement('<field name="'.$name.'" type="radio" class="btn-group"><option '.$additional.' value="0">'.$no.'</option><option '.$additional.' value="1">'.$yes.'</option></field>');
|
||||
|
||||
// run
|
||||
$button->setup($element, $value);
|
||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
||||
|
||||
return $button->input;
|
||||
|
||||
}###HELPER_UIKIT### ###HELPER_CREATEUSER###
|
||||
|
||||
/**
|
||||
* Get a variable
|
||||
*
|
||||
* @param string $table The table from which to get the variable
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
*
|
||||
* @return mix string/int/float
|
||||
*
|
||||
*/
|
||||
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###')
|
||||
{
|
||||
if(!$where)
|
||||
@ -355,6 +498,20 @@ abstract class ###Component###Helper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of variables
|
||||
*
|
||||
* @param string $table The table from which to get the variables
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
* @param bool $unique The switch to return a unique array
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true)
|
||||
{
|
||||
if(!$where)
|
||||
|
@ -43,7 +43,7 @@ class JFormField###Type### extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###type###'; ###ADD_BUTTON###
|
||||
public $type = '###type###';###ADD_BUTTON###
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -26,22 +26,17 @@ defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
namespace Joomla\CMS\Form\Rule;
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Form\FormRule;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// import Joomla formrule library
|
||||
jimport('joomla.form.formrule');
|
||||
/**
|
||||
* Form Rule class for the Joomla Framework.
|
||||
* Form Rule (###Name###) class for the Joomla Platform.
|
||||
*/
|
||||
class JFormRule###Name### extends JFormRule
|
||||
{
|
||||
/**
|
||||
* The regular expression.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected $regex = '^[^_]+$';
|
||||
class JFormRule###Name### extends FormRule
|
||||
{###VALIDATION_RULE_METHODS###
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class ###Component###Table###View### extends JTable
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count($_result))
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
@ -323,29 +323,6 @@ class ###Component###Table###View### extends JTable
|
||||
$asset->loadByName('com_###component###');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a valid alias from title / date.
|
||||
* Remains public to be able to check for duplicated alias before saving
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateAlias()
|
||||
{
|
||||
if (empty($this->alias))
|
||||
{
|
||||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
||||
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
|
||||
}
|
||||
|
||||
return $this->alias;
|
||||
}
|
||||
}###GENERATENEWALIAS###
|
||||
|
||||
}
|
||||
|
@ -99,4 +99,4 @@ if ($this->saveOrder)
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
</form>###VIEWS_FOOTER_SCRIPT###
|
268
admin/config.xml
268
admin/config.xml
@ -47,6 +47,72 @@
|
||||
/>
|
||||
<field type="spacer" name="spacerHistory" hr="true" />
|
||||
|
||||
<!-- Manage_jcb_package_directories Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="manage_jcb_package_directories"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_MANAGE_JCB_PACKAGE_DIRECTORIES_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_MANAGE_JCB_PACKAGE_DIRECTORIES_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="2"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NONE</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_SHOW_ALL</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_MANUAL_SELECTION</option>
|
||||
</field>
|
||||
<!-- Jcb_package_directories Field. Type: List. (joomla) -->
|
||||
<field
|
||||
type="list"
|
||||
name="jcb_package_directories"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="true"
|
||||
showon="manage_jcb_package_directories:1">
|
||||
<!-- Option Set. -->
|
||||
<option value="vdm">
|
||||
COM_COMPONENTBUILDER_CONFIG_VDM_PACKAGES</option>
|
||||
<option value="jcb">
|
||||
COM_COMPONENTBUILDER_CONFIG_JCB_COMMUNITY_PACKAGES</option>
|
||||
</field>
|
||||
<!-- Spacer_hr_one Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_one" hr="true" class="spacer_hr_one" />
|
||||
<!-- Add_menu_prefix Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="add_menu_prefix"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_YES</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
||||
</field>
|
||||
<!-- Menu_prefix Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="menu_prefix"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_LABEL"
|
||||
size="30"
|
||||
maxlength="30"
|
||||
default="»"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="SAFEHTML"
|
||||
message="COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_HINT"
|
||||
autocomplete="on"
|
||||
showon="add_menu_prefix:1"
|
||||
/>
|
||||
<!-- Spacer_hr_two Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_two" hr="true" class="spacer_hr_two" />
|
||||
<!-- Minify Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
@ -61,46 +127,8 @@
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
||||
</field>
|
||||
<!-- Percentagelanguageadd Field. Type: Number. (joomla) -->
|
||||
<field
|
||||
type="number"
|
||||
name="percentagelanguageadd"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_LABEL"
|
||||
default="50"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
min="10"
|
||||
max="100"
|
||||
step="10"
|
||||
/>
|
||||
<!-- Spacer_hr_one Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_one" hr="true" class="spacer_hr_one" />
|
||||
<!-- Compiler_field_builder_type Field. Type: List. (joomla) -->
|
||||
<field
|
||||
type="list"
|
||||
name="compiler_field_builder_type"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_DESCRIPTION"
|
||||
class="list_class"
|
||||
filter="INT"
|
||||
required="true"
|
||||
default="2">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_STRING_MANIPULATION</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_SIMPLEXMLELEMENT_CLASS</option>
|
||||
</field>
|
||||
<!-- Spacer_hr_two Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_two" hr="true" class="spacer_hr_two" />
|
||||
<!-- Api Field. Type: User. (joomla) -->
|
||||
<field
|
||||
type="user"
|
||||
name="api"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_API_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION"
|
||||
/>
|
||||
<!-- Spacer_hr_three Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_three" hr="true" class="spacer_hr_three" />
|
||||
<!-- Set_browser_storage Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
@ -152,8 +180,63 @@
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE</option>
|
||||
</field>
|
||||
<!-- Spacer_hr_three Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_three" hr="true" class="spacer_hr_three" />
|
||||
<!-- Spacer_hr_four Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_four" hr="true" class="spacer_hr_four" />
|
||||
<!-- Note_language_global Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_language_global" label="COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_DESCRIPTION" heading="h4" class="alert alert-info note_language_global" />
|
||||
<!-- Language Field. Type: Lang. (custom) -->
|
||||
<field
|
||||
type="lang"
|
||||
name="language"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_LANGUAGE_LABEL"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
required="true"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Percentagelanguageadd Field. Type: Number. (joomla) -->
|
||||
<field
|
||||
type="number"
|
||||
name="percentagelanguageadd"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_LABEL"
|
||||
default="50"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
min="10"
|
||||
max="100"
|
||||
step="10"
|
||||
/>
|
||||
<!-- Spacer_hr_five Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_five" hr="true" class="spacer_hr_five" />
|
||||
<!-- Compiler_field_builder_type Field. Type: List. (joomla) -->
|
||||
<field
|
||||
type="list"
|
||||
name="compiler_field_builder_type"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_DESCRIPTION"
|
||||
class="list_class"
|
||||
filter="INT"
|
||||
required="true"
|
||||
default="2">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_STRING_MANIPULATION</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_SIMPLEXMLELEMENT_CLASS</option>
|
||||
</field>
|
||||
<!-- Spacer_hr_six Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_six" hr="true" class="spacer_hr_six" />
|
||||
<!-- Api Field. Type: User. (joomla) -->
|
||||
<field
|
||||
type="user"
|
||||
name="api"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_API_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION"
|
||||
/>
|
||||
<!-- Spacer_hr_seven Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_seven" hr="true" class="spacer_hr_seven" />
|
||||
<field name="autorTitle"
|
||||
type="spacer"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_AUTHOR"
|
||||
@ -572,8 +655,105 @@
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="cronjob_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_CRONJOB">
|
||||
name="development_method_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD">
|
||||
|
||||
<!-- Development_method Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="development_method"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_DEFAULT</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_EXPANSION</option>
|
||||
</field>
|
||||
<!-- Note_development_method_default Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_development_method_default" label="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION" heading="h4" class="alert alert-info note_development_method_default" showon="development_method:1" />
|
||||
<!-- Note_development_method_expansion Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_development_method_expansion" label="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION" heading="h4" class="alert alert-info note_development_method_expansion" showon="development_method:2" />
|
||||
<!-- Expansion Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="expansion"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPANSION_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPANSION_DESCRIPTION"
|
||||
icon="list"
|
||||
max="50"
|
||||
min="1"
|
||||
showon="development_method:2">
|
||||
<form hidden="true" name="list_expansion_modal" repeat="true">
|
||||
<!-- Component Field. Type: Component. (custom) -->
|
||||
<field
|
||||
type="component"
|
||||
name="component"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_COMPONENT_LABEL"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
required="false"
|
||||
button="false"
|
||||
/>
|
||||
<!-- Backup Field. Type: Checkbox. (joomla) -->
|
||||
<field
|
||||
type="checkbox"
|
||||
name="backup"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_BACKUP_LABEL"
|
||||
value="1"
|
||||
required="false"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_BACKUP_DESCRIPTION"
|
||||
class="inputbox"
|
||||
/>
|
||||
<!-- Repository Field. Type: Checkbox. (joomla) -->
|
||||
<field
|
||||
type="checkbox"
|
||||
name="repository"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_REPOSITORY_LABEL"
|
||||
value="1"
|
||||
required="false"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_REPOSITORY_DESCRIPTION"
|
||||
class="inputbox"
|
||||
/>
|
||||
<!-- Placeholders Field. Type: Checkbox. (joomla) -->
|
||||
<field
|
||||
type="checkbox"
|
||||
name="placeholders"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_PLACEHOLDERS_LABEL"
|
||||
value="1"
|
||||
required="false"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_PLACEHOLDERS_DESCRIPTION"
|
||||
class="inputbox"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Return_options_build Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="return_options_build"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="2"
|
||||
showon="development_method:2">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_DISPLAY_MESSAGE</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_ONLY_BOOLEAN</option>
|
||||
</field>
|
||||
<!-- Expansioncronjob_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="expansioncronjob_note" label="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_DESCRIPTION" heading="h4" class="expansioncronjob_note" showon="development_method:2" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="auto_backup_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_AUTO_BACKUP">
|
||||
|
||||
<!-- Backupcronjob_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="backupcronjob_note" label="COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_DESCRIPTION" heading="h4" class="backupcronjob_note" />
|
||||
|
@ -117,6 +117,7 @@ class ComponentbuilderController extends JControllerLegacy
|
||||
'custom_code' => 'custom_codes',
|
||||
'library' => 'libraries',
|
||||
'snippet' => 'snippets',
|
||||
'validation_rule' => 'validation_rules',
|
||||
'field' => 'fields',
|
||||
'fieldtype' => 'fieldtypes',
|
||||
'language_translation' => 'language_translations',
|
||||
|
@ -46,6 +46,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
$this->registerTask('isRead', 'ajax');
|
||||
$this->registerTask('getComponentDetails', 'ajax');
|
||||
$this->registerTask('getCronPath', 'ajax');
|
||||
$this->registerTask('getJCBpackageInfo', 'ajax');
|
||||
$this->registerTask('tableColumns', 'ajax');
|
||||
$this->registerTask('fieldSelectOptions', 'ajax');
|
||||
$this->registerTask('getDynamicScripts', 'ajax');
|
||||
@ -53,6 +54,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
$this->registerTask('getButtonID', 'ajax');
|
||||
$this->registerTask('getAjaxDisplay', 'ajax');
|
||||
$this->registerTask('getLinked', 'ajax');
|
||||
$this->registerTask('checkAliasField', 'ajax');
|
||||
$this->registerTask('templateDetails', 'ajax');
|
||||
$this->registerTask('getLayoutDetails', 'ajax');
|
||||
$this->registerTask('dbTableColumns', 'ajax');
|
||||
@ -60,7 +62,11 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
$this->registerTask('getDynamicValues', 'ajax');
|
||||
$this->registerTask('checkFunctionName', 'ajax');
|
||||
$this->registerTask('usedin', 'ajax');
|
||||
$this->registerTask('getExistingValidationRuleCode', 'ajax');
|
||||
$this->registerTask('getValidationRulesTable', 'ajax');
|
||||
$this->registerTask('checkRuleName', 'ajax');
|
||||
$this->registerTask('fieldOptions', 'ajax');
|
||||
$this->registerTask('getFieldPropertyDesc', 'ajax');
|
||||
$this->registerTask('snippetDetails', 'ajax');
|
||||
$this->registerTask('setSnippetGithub', 'ajax');
|
||||
$this->registerTask('getSnippets', 'ajax');
|
||||
@ -230,6 +236,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getJCBpackageInfo':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$urlValue = $jinput->get('url', NULL, 'STRING');
|
||||
if($urlValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getJCBpackageInfo($urlValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'tableColumns':
|
||||
try
|
||||
{
|
||||
@ -349,9 +393,10 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$typeValue = $jinput->get('type', NULL, 'WORD');
|
||||
if($typeValue && $user->id != 0)
|
||||
$sizeValue = $jinput->get('size', NULL, 'INT');
|
||||
if($typeValue && $sizeValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getButton($typeValue);
|
||||
$result = $this->getModel('ajax')->getButton($typeValue, $sizeValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -497,6 +542,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'checkAliasField':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$typeValue = $jinput->get('type', NULL, 'INT');
|
||||
if($typeValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->checkAliasField($typeValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'templateDetails':
|
||||
try
|
||||
{
|
||||
@ -771,6 +854,121 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getExistingValidationRuleCode':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$nameValue = $jinput->get('name', NULL, 'WORD');
|
||||
if($nameValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getExistingValidationRuleCode($nameValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getValidationRulesTable':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getValidationRulesTable($idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'checkRuleName':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$nameValue = $jinput->get('name', NULL, 'STRING');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($nameValue && $idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->checkRuleName($nameValue, $idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'fieldOptions':
|
||||
try
|
||||
{
|
||||
@ -809,6 +1007,45 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getFieldPropertyDesc':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$propertyValue = $jinput->get('property', NULL, 'WORD');
|
||||
$fieldtypeValue = $jinput->get('fieldtype', NULL, 'ALNUM');
|
||||
if($propertyValue && $fieldtypeValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getFieldPropertyDesc($propertyValue, $fieldtypeValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'snippetDetails':
|
||||
try
|
||||
{
|
||||
|
@ -66,17 +66,18 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
if($user->authorise('core.admin', 'com_componentbuilder'))
|
||||
{
|
||||
// get the post values
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$componentId = $jinput->post->get('component', 0, 'INT');
|
||||
$version = $jinput->post->get('version', 0, 'INT');
|
||||
$addBackup = $jinput->post->get('backup', 0, 'INT');
|
||||
$addRepo = $jinput->post->get('repository', 0, 'INT');
|
||||
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
|
||||
$debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$componentId = $jinput->post->get('component', 0, 'INT');
|
||||
$version = $jinput->post->get('version', 0, 'INT');
|
||||
$addBackup = $jinput->post->get('backup', 0, 'INT');
|
||||
$addRepo = $jinput->post->get('repository', 0, 'INT');
|
||||
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
|
||||
$debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
|
||||
$minify = $jinput->post->get('minify', 2, 'INT');
|
||||
// include component compiler
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
|
||||
$model = $this->getModel('compiler');
|
||||
if ($model->builder($version,$componentId,$addBackup,$addRepo,$addPlaceholders,$debugLinenr))
|
||||
$model = $this->getModel('compiler');
|
||||
if ($model->builder($version,$componentId,$addBackup,$addRepo,$addPlaceholders,$debugLinenr, $minify))
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
@ -88,8 +89,8 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
|
||||
$message = $app->getUserState('com_componentbuilder.message');
|
||||
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
|
||||
$message = $app->getUserState('com_componentbuilder.message');
|
||||
if (empty($redirect_url) && $componentId > 0)
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
@ -193,7 +194,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
$lang->load($extension, $base_dir, $language_tag, $reload);
|
||||
$message = '('.$fileName.'.zip) file was also removed from tmp!';
|
||||
$this->setRedirect($redirect_url,$message,'message');
|
||||
return $model->install($fileName.'.zip');;
|
||||
return $model->install($fileName.'.zip');
|
||||
}
|
||||
}
|
||||
$this->setRedirect($redirect_url,$message,'error');
|
||||
|
@ -111,8 +111,6 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
|
||||
public function smartImport()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
@ -165,40 +163,9 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
$keyNotice = '<h1>' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
|
||||
$keyNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEYBR_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY') . '</h1>';
|
||||
// set the package owner info
|
||||
if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])))
|
||||
if (componentbuilderHelper::getPackageOwnerValue('owner', $model->info) || componentbuilderHelper::getPackageOwnerValue('company', $model->info))
|
||||
{
|
||||
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
|
||||
$ownerDetails .= '<ul>';
|
||||
if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '</li>';
|
||||
}
|
||||
$ownerDetails .= '</ul>';
|
||||
$ownerDetails = componentbuilderHelper::getPackageOwnerDetailsDisplay($model->info, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -400,6 +367,56 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
public function cloner()
|
||||
{
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// check if export is allowed for this user.
|
||||
$model->user = JFactory::getUser();
|
||||
if ($model->user->authorise('joomla_component.cloner', 'com_componentbuilder') && $model->user->authorise('core.copy', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// check if there is any selections
|
||||
if (!ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// only one component allowed at this time
|
||||
elseif (count( (array) $pks) !== 1)
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// set the active type
|
||||
$model->activeType = 'clone';
|
||||
// clone the component and the views and the fields... everything linked to the component.
|
||||
if ($model->cloner($pks))
|
||||
{
|
||||
// clone was successful
|
||||
$message = JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_WITH_ALL_LINKED_ADMIN_VIEWS_FIELDS_LINKED_TO_ADMIN_VIEWS_CUSTOM_ADMIN_VIEWS_SITE_VIEWS_TEMPLATES_AND_LAYOUTS_WERE_CLONED_SUCCESSFUL');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message);
|
||||
return;
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_CLONE_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
protected function getApiUser()
|
||||
{
|
||||
// admin area does not have API user, only front-end (so we fallback on login user)
|
||||
|
@ -107,5 +107,31 @@ class ComponentbuilderControllerLanguages extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function buildLanguages()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('core.create', 'com_componentbuilder'))
|
||||
{
|
||||
// get the model
|
||||
$model = $this->getModel('languages');
|
||||
if ($model->buildLanguages())
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_IMPORT_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
}
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
326
admin/controllers/validation_rule.php
Normal file
326
admin/controllers/validation_rule.php
Normal file
@ -0,0 +1,326 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage validation_rule.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controllerform library
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
/**
|
||||
* Validation_rule Controller
|
||||
*/
|
||||
class ComponentbuilderControllerValidation_rule extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Validation_rules'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Access check.
|
||||
$access = JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('validation_rule.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 = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
// get record id.
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
|
||||
|
||||
// Access check.
|
||||
$access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $recordId) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('validation_rule.edit', 'com_componentbuilder.validation_rule.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('validation_rule.edit.own', 'com_componentbuilder.validation_rule.' . $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('validation_rule.edit.own', 'com_componentbuilder'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('validation_rule.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 12.2
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
$tmpl = $this->input->get('tmpl');
|
||||
$layout = $this->input->get('layout', 'edit', 'string');
|
||||
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Setup redirect info.
|
||||
|
||||
$append = '';
|
||||
|
||||
if ($refid)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref;
|
||||
}
|
||||
|
||||
if ($tmpl)
|
||||
{
|
||||
$append .= '&tmpl=' . $tmpl;
|
||||
}
|
||||
|
||||
if ($layout)
|
||||
{
|
||||
$append .= '&layout=' . $layout;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
$append .= '&' . $urlVar . '=' . $recordId;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Validation_rule', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules' . $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 referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if ($this->refid)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect to the items screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . '&view=' . $this->view_list, 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 referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
if ($this->ref || $this->refid)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
if ($this->refid && $saved)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref && $saved)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'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 JModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
111
admin/controllers/validation_rules.php
Normal file
111
admin/controllers/validation_rules.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage validation_rules.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Validation_rules Controller
|
||||
*/
|
||||
class ComponentbuilderControllerValidation_rules extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_VALIDATION_RULES';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Validation_rule', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('validation_rule.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Validation_rules');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (ComponentbuilderHelper::checkArray($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = JFactory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Validation_rules_'.$date->format('jS_F_Y'),'Validation rules exported ('.$date->format('jS F, Y').')','validation rules');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('validation_rule.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Validation_rules');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = JFactory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('validation_rule_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'validation_rules');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'validation_rule');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_VALIDATION_RULES');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@ -72,12 +72,12 @@ class Compiler extends Infusion
|
||||
$comConfig = JFactory::getConfig();
|
||||
$this->tempPath = $comConfig->get('tmp_path');
|
||||
// set some folder paths in relation to distribution
|
||||
if ($config['addBackup'])
|
||||
if ($config['backup'])
|
||||
{
|
||||
$this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip';
|
||||
$this->dynamicIntegration = true;
|
||||
}
|
||||
if ($config['addRepo'])
|
||||
if ($config['repository'])
|
||||
{
|
||||
$this->repoPath = $this->params->get('git_folder_path', null);
|
||||
}
|
||||
@ -170,7 +170,7 @@ class Compiler extends Infusion
|
||||
foreach ($mismatch as $string)
|
||||
{
|
||||
$constant = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>Joomla.JText._(\'%s\')</b> language constant for (%s) does not have a corresponding JText::Script() decalaration.', $constant, $string), 'Warning');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>Joomla.JText._(\'%s\')</b> language constant for <b>%s</b> does not have a corresponding <code>JText::script(\'%s\')</code> decalaration, please add it.', $constant, $string, $string), 'Warning');
|
||||
}
|
||||
$this->app->enqueueMessage('<hr />', 'Warning');
|
||||
}
|
||||
@ -548,7 +548,7 @@ class Compiler extends Infusion
|
||||
$lineBites[$lineNumber] = (int) mb_strlen($lineContent, '8bit');
|
||||
if (!$found)
|
||||
{
|
||||
$bites = (int) bcadd($lineBites[$lineNumber], $bites);
|
||||
$bites = (int) $this->bcmath('add', $lineBites[$lineNumber], $bites);
|
||||
}
|
||||
if ($found && !$foundEnd)
|
||||
{
|
||||
@ -684,12 +684,12 @@ class Compiler extends Infusion
|
||||
// Add the data
|
||||
fwrite($fpFile, $data);
|
||||
// truncate file at the end of the data that was added
|
||||
$remove = bcadd($position, mb_strlen($data, '8bit'));
|
||||
$remove = $this->bcmath('add', $position, mb_strlen($data, '8bit'));
|
||||
ftruncate($fpFile, $remove);
|
||||
// check if this was a replacement of data
|
||||
if ($replace)
|
||||
{
|
||||
$position = bcadd($position, $replace);
|
||||
$position = $this->bcmath('add', $position, $replace);
|
||||
}
|
||||
// move to the position of the data that should remain below the new data
|
||||
fseek($fpTemp, $position);
|
||||
|
@ -204,7 +204,14 @@ class Get
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $languages = array('en-GB' => array());
|
||||
public $languages = array();
|
||||
|
||||
/**
|
||||
* The Main Languages
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $langTag = 'en-GB';
|
||||
|
||||
/**
|
||||
* The Multi Languages bucket
|
||||
@ -250,7 +257,8 @@ class Get
|
||||
'Joomla' . '.JText._(',
|
||||
'JText:' . ':script(',
|
||||
'JText:' . ':_(',
|
||||
'JText:' . ':sprintf('
|
||||
'JText:' . ':sprintf(',
|
||||
'JustTEXT:' . ':_('
|
||||
);
|
||||
|
||||
/**
|
||||
@ -414,6 +422,13 @@ class Get
|
||||
*/
|
||||
public $sqlTweak = array();
|
||||
|
||||
/**
|
||||
* The validation rules that should be added
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $validationRules = array();
|
||||
|
||||
/**
|
||||
* The admin views data array
|
||||
*
|
||||
@ -428,6 +443,13 @@ class Get
|
||||
*/
|
||||
private $_fieldData = array();
|
||||
|
||||
/**
|
||||
* The custom alias builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $customAliasBuilder = array();
|
||||
|
||||
/**
|
||||
* The field builder type
|
||||
*
|
||||
@ -592,6 +614,13 @@ class Get
|
||||
*/
|
||||
public $libraries = array();
|
||||
|
||||
/**
|
||||
* Is minify Enabled
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $minify = 0;
|
||||
|
||||
/**
|
||||
* Is Tidy Enabled
|
||||
*
|
||||
@ -616,10 +645,16 @@ class Get
|
||||
{
|
||||
// load application
|
||||
$this->app = JFactory::getApplication();
|
||||
// check if we have Tidy enabled
|
||||
$this->tidy = extension_loaded('Tidy');
|
||||
// Set the params
|
||||
$this->params = JComponentHelper::getParams('com_componentbuilder');
|
||||
// set the minfy switch of the JavaScript
|
||||
$this->minify = (isset($config['minify']) && $config['minify'] != 2) ? $config['minify'] : $this->params->get('minify', 0);
|
||||
// set the global language
|
||||
$this->langTag = $this->params->get('language', $this->langTag);
|
||||
// setup the main language array
|
||||
$this->languages[$this->langTag] = array();
|
||||
// check if we have Tidy enabled
|
||||
$this->tidy = extension_loaded('Tidy');
|
||||
// set the field type builder
|
||||
$this->fieldBuilderType = $this->params->get('compiler_field_builder_type', 2);
|
||||
// check the field builder type logic
|
||||
@ -633,7 +668,7 @@ class Get
|
||||
// load the compiler path
|
||||
$this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler');
|
||||
// set the component ID
|
||||
$this->componentID = (int) $config['componentId'];
|
||||
$this->componentID = (int) $config['component'];
|
||||
// set this components code name
|
||||
if ($name_code = ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'name_code'))
|
||||
{
|
||||
@ -643,10 +678,10 @@ class Get
|
||||
$this->componentCodeName = ComponentbuilderHelper::safeString($name_code);
|
||||
// set if placeholders should be added to customcode
|
||||
$global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'add_placeholders') == 1) ? true : false;
|
||||
$this->addPlaceholders = ((int) $config['addPlaceholders'] == 0) ? false : (((int) $config['addPlaceholders'] == 1) ? true : $global);
|
||||
$this->addPlaceholders = ((int) $config['placeholders'] == 0) ? false : (((int) $config['placeholders'] == 1) ? true : $global);
|
||||
// set if line numbers should be added to comments
|
||||
$global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'debug_linenr') == 1) ? true : false;
|
||||
$this->debugLinenr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global);
|
||||
$this->debugLinenr = ((int) $config['debuglinenr'] == 0) ? false : (((int) $config['debuglinenr'] == 1) ? true : $global);
|
||||
// set the current user
|
||||
$this->user = JFactory::getUser();
|
||||
// Get a db connection.
|
||||
@ -912,17 +947,19 @@ class Get
|
||||
// build the admin_views settings
|
||||
$component->admin_views = array_map(function($array)
|
||||
{
|
||||
$array = array_map(function($value)
|
||||
{
|
||||
$array = array_map(function($value) {
|
||||
if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) && strval($value) === strval(intval($value)))
|
||||
{
|
||||
return (int) $value;
|
||||
}
|
||||
return $value;
|
||||
}, $array);
|
||||
// has become a lacacy issue, can't remove this
|
||||
$array['view'] = $array['adminview'];
|
||||
$array['settings'] = $this->getAdminViewData($array['view']);
|
||||
// check if we must add to site
|
||||
if (isset($array['edit_create_site_view']) && $array['edit_create_site_view'])
|
||||
{
|
||||
$this->siteEditView[$array['adminview']] = true;
|
||||
$this->lang = 'both';
|
||||
}
|
||||
if (isset($array['port']) && $array['port'] && !$this->addEximport)
|
||||
{
|
||||
$this->addEximport = true;
|
||||
@ -931,14 +968,14 @@ class Get
|
||||
{
|
||||
$this->setTagHistory = true;
|
||||
}
|
||||
if (isset($array['edit_create_site_view']) && $array['edit_create_site_view'])
|
||||
{
|
||||
$this->siteEditView[$array['adminview']] = true;
|
||||
}
|
||||
// has become a lacacy issue, can't remove this
|
||||
$array['view'] = $array['adminview'];
|
||||
// get the admin settings/data
|
||||
$array['settings'] = $this->getAdminViewData($array['view']);
|
||||
|
||||
return $array;
|
||||
}, array_values($component->addadmin_views));
|
||||
}
|
||||
|
||||
// set the site_view data
|
||||
$component->addsite_views = (isset($component->addsite_views) && ComponentbuilderHelper::checkJson($component->addsite_views)) ? json_decode($component->addsite_views, true) : null;
|
||||
if (ComponentbuilderHelper::checkArray($component->addsite_views))
|
||||
@ -1420,7 +1457,7 @@ class Get
|
||||
$view->fields = array_map(function($field) use($name_single, $name_list)
|
||||
{
|
||||
// set hash
|
||||
static $hash = 1;
|
||||
static $hash = 123467890; // (TODO) I found this making duplicates
|
||||
// load hash
|
||||
$field['hash'] = md5($field['field'] . $hash);
|
||||
// increment hash
|
||||
@ -1603,6 +1640,10 @@ class Get
|
||||
unset($view->addlinked_views);
|
||||
// set the lang target
|
||||
$this->lang = 'admin';
|
||||
if (isset($this->siteEditView[$id]))
|
||||
{
|
||||
$this->lang = 'both';
|
||||
}
|
||||
// add_javascript
|
||||
$addArrayJ = array('javascript_view_file', 'javascript_view_footer', 'javascript_views_file', 'javascript_views_footer');
|
||||
foreach ($addArrayJ as $scripter)
|
||||
@ -1741,6 +1782,33 @@ class Get
|
||||
$this->addAjax = true;
|
||||
}
|
||||
}
|
||||
// activate alias builder
|
||||
if (!isset($this->customAliasBuilder[$name_single]) && isset($view->alias_builder_type) && 2 == $view->alias_builder_type
|
||||
&& isset($view->alias_builder) && ComponentbuilderHelper::checkJson($view->alias_builder))
|
||||
{
|
||||
// get the aliasFields
|
||||
$alias_fields = (array) json_decode($view->alias_builder, true);
|
||||
// get the active fields
|
||||
$alias_fields = (array) array_filter($view->fields, function($field) use($alias_fields) {
|
||||
// check if field is in view fields
|
||||
if (in_array($field['field'], $alias_fields))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// check if all is well
|
||||
if (ComponentbuilderHelper::checkArray($alias_fields))
|
||||
{
|
||||
// load the field names
|
||||
$this->customAliasBuilder[$name_single] = (array) array_map(function ($field) use($name_list) {
|
||||
return $this->getFieldName($field, $name_list);
|
||||
},$alias_fields
|
||||
);
|
||||
}
|
||||
}
|
||||
// unset
|
||||
unset($view->alias_builder);
|
||||
// add_sql
|
||||
if ($view->add_sql == 1)
|
||||
{
|
||||
@ -2048,7 +2116,7 @@ class Get
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
// Order it by the ordering field.
|
||||
// Select all the values in the field
|
||||
$query->select('a.*');
|
||||
$query->select($this->db->quoteName(array('c.name', 'c.properties'), array('type_name', 'properties')));
|
||||
$query->from('#__componentbuilder_field AS a');
|
||||
@ -2083,6 +2151,36 @@ class Get
|
||||
// load the values form params
|
||||
$field->xml = $this->setDynamicValues(json_decode($field->xml));
|
||||
|
||||
// check if we have validate (validation rule set)
|
||||
$validationRule = ComponentbuilderHelper::getBetween($field->xml, 'validate="', '"');
|
||||
if (ComponentbuilderHelper::checkString($validationRule))
|
||||
{
|
||||
// make sure it is lowercase
|
||||
$validationRule = ComponentbuilderHelper::safeString($validationRule);
|
||||
// make sure it is not already set
|
||||
if (!isset($this->validationRules[$validationRule]))
|
||||
{
|
||||
// get joomla core validation names
|
||||
if ($coreValidationRules = ComponentbuilderHelper::getExistingValidationRuleNames(true))
|
||||
{
|
||||
// make sure this rule is not a core validation rule
|
||||
if (!in_array($validationRule, (array) $coreValidationRules))
|
||||
{
|
||||
// get the class methods for this rule if it exists
|
||||
if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name','php'))
|
||||
{
|
||||
// open and set the validation rule
|
||||
$this->validationRules[$validationRule] = $this->setDynamicValues(base64_decode($this->validationRules[$validationRule]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// set the notice that this validation rule is custom and was not found (TODO)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load the type values form type params
|
||||
$field->properties = (isset($field->properties) && ComponentbuilderHelper::checkJson($field->properties)) ? json_decode($field->properties, true) : null;
|
||||
if (ComponentbuilderHelper::checkArray($field->properties))
|
||||
@ -2186,16 +2284,16 @@ class Get
|
||||
{
|
||||
$this->customScriptBuilder['views_footer'] = array();
|
||||
}
|
||||
if (!isset($this->customScriptBuilder['views_footer'][$name_list]))
|
||||
if (!isset($this->customScriptBuilder['views_footer'][$name_single]))
|
||||
{
|
||||
$this->customScriptBuilder['views_footer'][$name_list] = '';
|
||||
$this->customScriptBuilder['views_footer'][$name_single] = '';
|
||||
}
|
||||
if (!isset($this->_fieldData[$id]->javascript_views_footer_decoded))
|
||||
{
|
||||
$this->_fieldData[$id]->javascript_views_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_views_footer));
|
||||
$this->_fieldData[$id]->javascript_views_footer_decoded = true;
|
||||
}
|
||||
$this->customScriptBuilder['views_footer'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->javascript_views_footer;
|
||||
$this->customScriptBuilder['views_footer'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->javascript_views_footer;
|
||||
if (strpos($this->_fieldData[$id]->javascript_views_footer, "token") !== false ||
|
||||
strpos($this->_fieldData[$id]->javascript_views_footer, "task=ajax") !== false)
|
||||
{
|
||||
@ -3492,11 +3590,11 @@ class Get
|
||||
|
||||
/**
|
||||
* Set Language Place Holders
|
||||
*
|
||||
*
|
||||
* @param string $content The content
|
||||
*
|
||||
* @return string The content with the updated Language place holder
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function setLangStrings($content)
|
||||
{
|
||||
@ -3515,11 +3613,17 @@ class Get
|
||||
{
|
||||
// insure string is not broken
|
||||
$content = str_replace('COM_###COMPONENT###', $this->langPrefix, $content);
|
||||
// first get the Joomla.JText._()
|
||||
// reset some buckets
|
||||
$langHolders = array();
|
||||
$langCheck = array();
|
||||
$langOnly = array();
|
||||
$jsTEXT = array();
|
||||
$scTEXT = array();
|
||||
// first get the Joomla .JText._()
|
||||
if (in_array('Joomla' . '.JText._(', $langStringTargets))
|
||||
{
|
||||
$jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla" . ".JText._('", "'");
|
||||
$jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.' . 'JText._("', '"');
|
||||
$jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla' . '.JText._("', '"');
|
||||
// combine into one array
|
||||
$jsTEXT = ComponentbuilderHelper::mergeArrays($jsTEXT);
|
||||
// we need to add a check to insure these JavaScript lang matchup
|
||||
@ -3545,50 +3649,89 @@ class Get
|
||||
$this->langMatch = ComponentbuilderHelper::mergeArrays(array($scTEXT, $this->langMatch));
|
||||
}
|
||||
}
|
||||
// now do the little trick for JustTEXT: :_('Just uppercase text');
|
||||
if (in_array('JustTEXT:' . ':_(', $langStringTargets))
|
||||
{
|
||||
$langOnly[] = ComponentbuilderHelper::getAllBetween($content, "JustTEXT:" . ":_('", "')");
|
||||
$langOnly[] = ComponentbuilderHelper::getAllBetween($content, 'JustTEXT:' . ':_("', '")');
|
||||
}
|
||||
// set language data
|
||||
foreach ($langStringTargets as $langStringTarget)
|
||||
{
|
||||
// need some special treatment here
|
||||
if ($langStringTarget === 'Joomla' . '.JText._(' || $langStringTarget === 'JText:' . ':script(')
|
||||
if ($langStringTarget === 'Joomla' . '.JText._(' ||
|
||||
$langStringTarget === 'JText:' . ':script(' ||
|
||||
$langStringTarget === 'JustTEXT:' . ':_(')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget . "'", "'");
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget . '"', '"');
|
||||
}
|
||||
$langArray = ComponentbuilderHelper::mergeArrays($langCheck);
|
||||
if (ComponentbuilderHelper::checkArray($langArray)) //<-- not really needed hmmm
|
||||
// the normal loading of the language strings
|
||||
$langCheck = ComponentbuilderHelper::mergeArrays($langCheck);
|
||||
if (ComponentbuilderHelper::checkArray($langCheck)) //<-- not really needed hmmm
|
||||
{
|
||||
foreach ($langArray as $string)
|
||||
foreach ($langCheck as $string)
|
||||
{
|
||||
// this is there to insure we dont break already added Language strings
|
||||
if (ComponentbuilderHelper::safeString($string, 'U') === $string)
|
||||
if ($keyLang = $this->setLang($string))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// only load if string is not already set
|
||||
$keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U');
|
||||
if (!isset($this->langContent[$this->lang][$keyLang]))
|
||||
{
|
||||
$this->langContent[$this->lang][$keyLang] = trim($string);
|
||||
}
|
||||
// load the language targets
|
||||
foreach ($langStringTargets as $langStringTarget)
|
||||
{
|
||||
$langHolders[$langStringTarget . "'" . $string . "'"] = $langStringTarget . "'" . $keyLang . "'";
|
||||
$langHolders[$langStringTarget . '"' . $string . '"'] = $langStringTarget . '"' . $keyLang . '"';
|
||||
// load the language targets
|
||||
foreach ($langStringTargets as $langStringTarget)
|
||||
{
|
||||
$langHolders[$langStringTarget . "'" . $string . "'"] = $langStringTarget . "'" . $keyLang . "'";
|
||||
$langHolders[$langStringTarget . '"' . $string . '"'] = $langStringTarget . '"' . $keyLang . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
// only continue if we have value to replace
|
||||
if (isset($langHolders) && ComponentbuilderHelper::checkArray($langHolders))
|
||||
}
|
||||
// the uppercase loading only (for arrays and other tricks)
|
||||
if (ComponentbuilderHelper::checkArray($langOnly))
|
||||
{
|
||||
$langOnly = ComponentbuilderHelper::mergeArrays($langOnly);
|
||||
foreach ($langOnly as $string)
|
||||
{
|
||||
$content = $this->setPlaceholders($content, $langHolders);
|
||||
if ($keyLang = $this->setLang($string))
|
||||
{
|
||||
// load the language targets
|
||||
$langHolders["JustTEXT:" . ":_('" . $string . "')"] = "'" . $keyLang . "'";
|
||||
$langHolders['JustTEXT:' . ':_("' . $string . '")'] = '"' . $keyLang . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
// only continue if we have value to replace
|
||||
if (ComponentbuilderHelper::checkArray($langHolders))
|
||||
{
|
||||
$content = $this->setPlaceholders($content, $langHolders);
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the language String
|
||||
*
|
||||
* @param string $string The plan text string (English)
|
||||
*
|
||||
* @return string The key language string (all uppercase)
|
||||
*
|
||||
*/
|
||||
public function setLang($string)
|
||||
{
|
||||
// this is there to insure we dont break already added Language strings
|
||||
if (ComponentbuilderHelper::safeString($string, 'U') === $string)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// only load if string is not already set
|
||||
$keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U');
|
||||
if (!isset($this->langContent[$this->lang][$keyLang]))
|
||||
{
|
||||
$this->langContent[$this->lang][$keyLang] = trim($string);
|
||||
}
|
||||
return $keyLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Data Selection of the dynamic get
|
||||
*
|
||||
@ -4385,8 +4528,8 @@ class Get
|
||||
$query->from($this->db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
$query->select($this->db->quoteName(array('a.id', 'a.translation', 'a.entranslation', 'a.components', 'a.published')));
|
||||
$query->where($this->db->quoteName('a.entranslation') . ' IN (' . implode(',', array_map(function($a)
|
||||
$query->select($this->db->quoteName(array('a.id', 'a.translation', 'a.source', 'a.components', 'a.published')));
|
||||
$query->where($this->db->quoteName('a.source') . ' IN (' . implode(',', array_map(function($a)
|
||||
{
|
||||
return $this->db->quote($a);
|
||||
}, $values)) . ')');
|
||||
@ -4394,7 +4537,7 @@ class Get
|
||||
$this->db->execute();
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
return $this->db->loadAssocList('entranslation');
|
||||
return $this->db->loadAssocList('source');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -4412,7 +4555,7 @@ class Get
|
||||
$counterInsert = 0;
|
||||
$counterUpdate = 0;
|
||||
$today = JFactory::getDate()->toSql();
|
||||
foreach ($this->languages['en-GB'] as $area => $placeholders)
|
||||
foreach ($this->languages[$this->langTag] as $area => $placeholders)
|
||||
{
|
||||
foreach ($placeholders as $placeholder => $string)
|
||||
{
|
||||
@ -4499,7 +4642,7 @@ class Get
|
||||
// add the new lang placeholder to the db
|
||||
$this->newLangStrings[$counterInsert] = array();
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(json_encode(array($this->componentID))); // 'components'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'source'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote((int) $this->user->id); // 'created_by'
|
||||
@ -4537,7 +4680,7 @@ class Get
|
||||
$query = $this->db->getQuery(true);
|
||||
$continue = false;
|
||||
// Insert columns.
|
||||
$columns = array('components', 'entranslation', 'published', 'created', 'created_by', 'version', 'access');
|
||||
$columns = array('components', 'source', 'published', 'created', 'created_by', 'version', 'access');
|
||||
// Prepare the insert query.
|
||||
$query->insert($this->db->quoteName('#__componentbuilder_language_translation'));
|
||||
$query->columns($this->db->quoteName($columns));
|
||||
@ -4632,7 +4775,7 @@ class Get
|
||||
$query->from($this->db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
$query->select($this->db->quoteName(array('a.id', 'a.translation', 'a.components')));
|
||||
// get all string that are not linked to this component
|
||||
$query->where($this->db->quoteName('a.entranslation') . ' NOT IN (' . implode(',', array_map(function($a)
|
||||
$query->where($this->db->quoteName('a.source') . ' NOT IN (' . implode(',', array_map(function($a)
|
||||
{
|
||||
return $this->db->quote($a);
|
||||
}, $values)) . ')');
|
||||
@ -4983,6 +5126,7 @@ class Get
|
||||
{
|
||||
$path = $file;
|
||||
}
|
||||
// now we go line by line
|
||||
foreach (new SplFileObject($file) as $lineNumber => $lineContent)
|
||||
{
|
||||
// we musk keep last few lines to dynamic find target entry later
|
||||
@ -5263,7 +5407,7 @@ class Get
|
||||
}
|
||||
|
||||
/**
|
||||
* search for the system id in the line given
|
||||
* set the start replace placeholder
|
||||
*
|
||||
* @param int $id The comment id
|
||||
* @param int $commentType The comment type
|
||||
@ -5294,6 +5438,7 @@ class Get
|
||||
*
|
||||
* @param string $lineContent The file path to search
|
||||
* @param string $placeholders The values to search for
|
||||
* @param int $commentType The comment type
|
||||
*
|
||||
* @return array on success
|
||||
*
|
||||
@ -5319,7 +5464,7 @@ class Get
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse Engineer the dynamic placeholders (hmmmm)
|
||||
* Reverse Engineer the dynamic placeholders (TODO hmmmm this is not ideal)
|
||||
*
|
||||
* @param string $string The string to revers
|
||||
* @param int $id The custom code id
|
||||
@ -5352,13 +5497,13 @@ class Get
|
||||
// get targets to search for
|
||||
$langStringTargets = array_filter(
|
||||
$this->langStringTargets, function($get) use($string)
|
||||
{
|
||||
if (strpos($string, $get) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (strpos($string, $get) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// check if we should continue
|
||||
if (ComponentbuilderHelper::checkArray($langStringTargets))
|
||||
{
|
||||
@ -5413,13 +5558,12 @@ class Get
|
||||
* @param string $data The actual data
|
||||
* @param array $placeholder The placeholders
|
||||
* @param int $action The action to use
|
||||
* ===================================================
|
||||
*
|
||||
* THE ACTION OPTIONS ARE
|
||||
* ===================================================
|
||||
* 1 -> Just replace (default)
|
||||
* 2 -> Check if data string has placeholders
|
||||
* 3 -> Remove placeholders not in data string
|
||||
* ===================================================
|
||||
*
|
||||
* @param int $langSwitch The lang switch
|
||||
*
|
||||
* @return string
|
||||
@ -5476,7 +5620,7 @@ class Get
|
||||
}
|
||||
|
||||
/**
|
||||
* return the placeholders for insered and replaced code
|
||||
* return the placeholders for inserted and replaced code
|
||||
*
|
||||
* @param int $type The type of placement
|
||||
* @param int $id The code id in the system
|
||||
@ -5588,4 +5732,46 @@ class Get
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* bc math wrapper (very basic not for accounting)
|
||||
*
|
||||
* @param string $type The type bc math
|
||||
* @param int $val1 The first value
|
||||
* @param int $val2 The second value
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
public function bcmath($type, $val1, $val2)
|
||||
{
|
||||
// build function name
|
||||
$function = 'bc'.$type;
|
||||
// use the bcmath function of available
|
||||
if (function_exists($function))
|
||||
{
|
||||
return $function($val1, $val2);
|
||||
}
|
||||
// if function does not exist we use +-*/ operators (since it realy not that serious)
|
||||
switch($type)
|
||||
{
|
||||
// Multiply two numbers
|
||||
case 'mul':
|
||||
return round($val1 * $val2);
|
||||
break;
|
||||
// Divide of two numbers
|
||||
case 'div':
|
||||
return round($val1 / $val2);
|
||||
break;
|
||||
// Adding two numbers
|
||||
case 'add':
|
||||
return round($val1 + $val2);
|
||||
break;
|
||||
// Subtract one number from the other
|
||||
case 'add':
|
||||
return round($val1 - $val2);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -338,9 +338,9 @@ class Structure extends Get
|
||||
// run global updater
|
||||
ComponentbuilderHelper::runGlobalUpdater();
|
||||
// set the Joomla version
|
||||
$this->joomlaVersion = $config['joomlaVersion'];
|
||||
$this->joomlaVersion = $config['version'];
|
||||
// set the template path
|
||||
$this->templatePath = $this->compilerPath . '/joomla_' . $config['joomlaVersion'];
|
||||
$this->templatePath = $this->compilerPath . '/joomla_' . $config['version'];
|
||||
// set some default names
|
||||
$this->componentSalesName = 'com_' . $this->componentData->sales_name . '__J' . $this->joomlaVersion;
|
||||
$this->componentBackupName = 'com_' . $this->componentData->sales_name . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion;
|
||||
@ -1369,6 +1369,8 @@ class Structure extends Get
|
||||
// set new file to object
|
||||
$versionData->move->static->$key_pointer = new stdClass();
|
||||
$versionData->move->static->$key_pointer->naam = $custom['file'];
|
||||
// update the dynamic component name placholders in file names
|
||||
$custom['path'] = $this->setPlaceholders($custom['path'], $this->placeholders);
|
||||
// get the path info
|
||||
$pathInfo = pathinfo($custom['path']);
|
||||
if (isset($pathInfo['extension']) && $pathInfo['extension'])
|
||||
|
@ -755,8 +755,8 @@ class Fields extends Structure
|
||||
$XML = new simpleXMLElement('<a/>');
|
||||
$fieldSetXML = $XML->addChild('fieldset');
|
||||
$fieldSetXML->addAttribute('name', 'details');
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields.");
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields.");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)");
|
||||
// if id is not set
|
||||
if (!isset($this->fieldsNames[$view_name_single]['id']))
|
||||
{
|
||||
@ -770,7 +770,7 @@ class Fields extends Structure
|
||||
'default' => 0
|
||||
);
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -787,9 +787,9 @@ class Fields extends Structure
|
||||
'filter' => 'user_utc'
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -803,9 +803,9 @@ class Fields extends Structure
|
||||
'description' => $langView . '_CREATED_BY_DESC',
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -818,9 +818,9 @@ class Fields extends Structure
|
||||
'label' => 'JSTATUS'
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value)
|
||||
@ -844,9 +844,9 @@ class Fields extends Structure
|
||||
'format' => '%Y-%m-%d %H:%M:%S',
|
||||
'filter' => 'user_utc'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -862,9 +862,9 @@ class Fields extends Structure
|
||||
'readonly' => 'true',
|
||||
'filter' => 'unset'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -880,9 +880,9 @@ class Fields extends Structure
|
||||
'required' => "false"
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -900,9 +900,9 @@ class Fields extends Structure
|
||||
'required' => "false"
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -919,9 +919,9 @@ class Fields extends Structure
|
||||
'readonly' => "true",
|
||||
'filter' => 'unset'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -937,34 +937,34 @@ class Fields extends Structure
|
||||
'rows' => 3,
|
||||
'cols' => 30
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
// metadesc
|
||||
$attributes['name'] = 'metadesc';
|
||||
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
|
||||
$attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC';
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
// load the dynamic fields now
|
||||
if (count($dynamicFieldsXML))
|
||||
{
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields.");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields.");
|
||||
foreach ($dynamicFieldsXML as $dynamicfield)
|
||||
{
|
||||
$this->xmlAppend($fieldSetXML, $dynamicfield);
|
||||
ComponentbuilderHelper::xmlAppend($fieldSetXML, $dynamicfield);
|
||||
}
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view_name_single]))
|
||||
{
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields");
|
||||
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields");
|
||||
$fieldsXML = $fieldSetXML->addChild('fields');
|
||||
$fieldsXML->addAttribute('name', 'metadata');
|
||||
$fieldsXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||
@ -972,7 +972,7 @@ class Fields extends Structure
|
||||
$fieldsFieldSetXML->addAttribute('name', 'vdmmetadata');
|
||||
$fieldsFieldSetXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||
// robots
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
||||
$robots = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'robots',
|
||||
@ -980,7 +980,7 @@ class Fields extends Structure
|
||||
'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
|
||||
'description' => 'JFIELD_METADATA_ROBOTS_DESC'
|
||||
);
|
||||
$this->xmlAddAttributes($robots, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($robots, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
$options = array(
|
||||
@ -997,7 +997,7 @@ class Fields extends Structure
|
||||
$option[] = $text;
|
||||
}
|
||||
// author
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
||||
$author = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'author',
|
||||
@ -1006,11 +1006,11 @@ class Fields extends Structure
|
||||
'description' => 'JFIELD_METADATA_AUTHOR_DESC',
|
||||
'size' => 20
|
||||
);
|
||||
$this->xmlAddAttributes($author, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($author, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
// rights
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
||||
ComponentbuilderHelper::xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
||||
$rights = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'rights',
|
||||
@ -1022,7 +1022,7 @@ class Fields extends Structure
|
||||
'cols' => 30,
|
||||
'rows' => 2
|
||||
);
|
||||
$this->xmlAddAttributes($rights, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($rights, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
}
|
||||
@ -1581,7 +1581,7 @@ class Fields extends Structure
|
||||
}
|
||||
elseif ($property === 'option')
|
||||
{
|
||||
$this->xmlComment($field->fieldXML, $this->setLine(__LINE__) . " Option Set.");
|
||||
ComponentbuilderHelper::xmlComment($field->fieldXML, $this->setLine(__LINE__) . " Option Set.");
|
||||
if (strpos($value, ',') !== false)
|
||||
{
|
||||
// mulitpal options
|
||||
@ -1644,7 +1644,7 @@ class Fields extends Structure
|
||||
}
|
||||
if (!$field->fieldXML->count())
|
||||
{
|
||||
$this->xmlComment($field->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
|
||||
ComponentbuilderHelper::xmlComment($field->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
|
||||
}
|
||||
}
|
||||
elseif ($setType === 'plain')
|
||||
@ -1733,12 +1733,12 @@ class Fields extends Structure
|
||||
if ($this->defaultField($r_typeName, 'option'))
|
||||
{
|
||||
// now add to the field set
|
||||
$this->xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
}
|
||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||
{
|
||||
// now add to the field set
|
||||
$this->xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||
{
|
||||
@ -1746,7 +1746,7 @@ class Fields extends Structure
|
||||
$custom = $r_fieldValues['custom'];
|
||||
unset($r_fieldValues['custom']);
|
||||
// now add to the field set
|
||||
$this->xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
// set lang (just incase)
|
||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||
// add to lang array
|
||||
@ -1794,7 +1794,7 @@ class Fields extends Structure
|
||||
'name' => 'list_' . $fieldAttributes['name'] . '_modal',
|
||||
'repeat' => 'true'
|
||||
);
|
||||
$this->xmlAddAttributes($form, $attributes);
|
||||
ComponentbuilderHelper::xmlAddAttributes($form, $attributes);
|
||||
|
||||
if (strpos($fieldAttributes['fields'], ',') !== false)
|
||||
{
|
||||
@ -1830,12 +1830,12 @@ class Fields extends Structure
|
||||
if ($this->defaultField($r_typeName, 'option'))
|
||||
{
|
||||
// now add to the field set
|
||||
$this->xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
}
|
||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||
{
|
||||
// now add to the field set
|
||||
$this->xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||
{
|
||||
@ -1843,7 +1843,7 @@ class Fields extends Structure
|
||||
$custom = $r_fieldValues['custom'];
|
||||
unset($r_fieldValues['custom']);
|
||||
// now add to the field set
|
||||
$this->xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
ComponentbuilderHelper::xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
|
||||
// set lang (just incase)
|
||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||
// add to lang array
|
||||
@ -2013,7 +2013,18 @@ class Fields extends Structure
|
||||
// set the decoding methods
|
||||
if (in_array($set, $decode))
|
||||
{
|
||||
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type);
|
||||
if (isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]) &&
|
||||
isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode']))
|
||||
{
|
||||
if (!in_array($set, $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode']))
|
||||
{
|
||||
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'][] = $set;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => array($set), 'type' => $type);
|
||||
}
|
||||
}
|
||||
// set the uikit checker
|
||||
if ((2 == $this->uikit || 1 == $this->uikit) && in_array($type, $textareas))
|
||||
@ -2083,6 +2094,15 @@ class Fields extends Structure
|
||||
// get the actual field name
|
||||
$xmlValue = $this->setPlaceholders($name, $placeholders);
|
||||
}
|
||||
elseif ($property['name'] === 'validate')
|
||||
{
|
||||
// check if we have validate (validation rule set)
|
||||
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, 'validate="', '"');
|
||||
if (ComponentbuilderHelper::checkString($xmlValue))
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::safeString($xmlValue);
|
||||
}
|
||||
}
|
||||
elseif ($property['name'] === 'extension' || $property['name'] === 'directory' || $property['name'] === 'formsource')
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
@ -2151,6 +2171,15 @@ class Fields extends Structure
|
||||
{
|
||||
// dont load the button to repeatable
|
||||
$xmlValue = 'false';
|
||||
// do not add button
|
||||
$fieldAttributes['custom']['add_button'] = 'false';
|
||||
}
|
||||
elseif ($property['name'] === 'button' && $setCustom)
|
||||
{
|
||||
// dont load the button to repeatable
|
||||
$xmlValue = (string) ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'button="', '"'));
|
||||
// add to custom values
|
||||
$fieldAttributes['custom']['add_button'] = (ComponentbuilderHelper::checkString($xmlValue) || 1 == $xmlValue) ? $xmlValue: 'false';
|
||||
}
|
||||
elseif ($property['name'] === 'required' && $repeatable)
|
||||
{
|
||||
@ -2290,6 +2319,16 @@ class Fields extends Structure
|
||||
{
|
||||
$fieldAttributes['display'] = $display;
|
||||
}
|
||||
// make sure validation is set if found (even it not part of field properties)
|
||||
if (!isset($fieldAttributes['validate']))
|
||||
{
|
||||
// check if we have validate (validation rule set)
|
||||
$validationRule = ComponentbuilderHelper::getBetween($field['settings']->xml, 'validate="', '"');
|
||||
if (ComponentbuilderHelper::checkString($validationRule))
|
||||
{
|
||||
$fieldAttributes['validate'] = ComponentbuilderHelper::safeString($validationRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $fieldAttributes;
|
||||
@ -2315,12 +2354,19 @@ class Fields extends Structure
|
||||
*/
|
||||
public function setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false)
|
||||
{
|
||||
if ($typeName === 'tag')
|
||||
// dbSwitch
|
||||
$dbSwitch = true;
|
||||
if (isset($field['list']) && $field['list'] == 2)
|
||||
{
|
||||
// do not add this field to the database
|
||||
$dbSwitch = false;
|
||||
}
|
||||
elseif ($typeName === 'tag')
|
||||
{
|
||||
// set tags for this view but don't load to DB
|
||||
$this->tagsBuilder[$view_name_single] = $view_name_single;
|
||||
}
|
||||
else
|
||||
elseif (isset($field['settings']->datatype))
|
||||
{
|
||||
// insure default not none if number type
|
||||
$intKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE');
|
||||
@ -2374,12 +2420,12 @@ class Fields extends Structure
|
||||
$this->historyBuilder[$view_name_single] = $view_name_single;
|
||||
}
|
||||
// set Alias (only one title per view)
|
||||
if (isset($field['alias']) && $field['alias'])
|
||||
if ($dbSwitch && isset($field['alias']) && $field['alias'] && !isset($this->aliasBuilder[$view_name_single]))
|
||||
{
|
||||
$this->aliasBuilder[$view_name_single] = $name;
|
||||
}
|
||||
// set Titles (only one title per view)
|
||||
if (isset($field['title']) && $field['title'])
|
||||
if ($dbSwitch && isset($field['title']) && $field['title'] && !isset($this->titleBuilder[$view_name_single]))
|
||||
{
|
||||
$this->titleBuilder[$view_name_single] = $name;
|
||||
}
|
||||
@ -2439,7 +2485,7 @@ class Fields extends Structure
|
||||
$this->hiddenFieldsBuilder[$view_name_single] .= ',"' . $name . '"';
|
||||
}
|
||||
// set all int fields of this view
|
||||
if ($field['settings']->datatype === 'INT' || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT')
|
||||
if ($dbSwitch && isset($field['settings']->datatype) && ($field['settings']->datatype === 'INT' || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT'))
|
||||
{
|
||||
if (!isset($this->intFieldsBuilder[$view_name_single]))
|
||||
{
|
||||
@ -2465,7 +2511,7 @@ class Fields extends Structure
|
||||
}
|
||||
// TODO we may need to add a switch instead (since now it uses the first editor field)
|
||||
// set the main(biggest) text field of this view
|
||||
if ($typeName === 'editor')
|
||||
if ($dbSwitch && $typeName === 'editor')
|
||||
{
|
||||
if (!isset($this->maintextBuilder[$view_name_single]) || !ComponentbuilderHelper::checkString($this->maintextBuilder[$view_name_single]))
|
||||
{
|
||||
@ -2497,7 +2543,7 @@ class Fields extends Structure
|
||||
$this->setScriptMediaSwitch[$typeName] = $typeName;
|
||||
}
|
||||
// setup gategory for this view
|
||||
if ($typeName === 'category')
|
||||
if ($dbSwitch && $typeName === 'category')
|
||||
{
|
||||
if (isset($this->catOtherName[$view_name_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$view_name_list]))
|
||||
{
|
||||
@ -2514,13 +2560,14 @@ class Fields extends Structure
|
||||
$this->catCodeBuilder[$view_name_single] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView);
|
||||
}
|
||||
// setup checkbox for this view
|
||||
if ($typeName === 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes'))
|
||||
if ($dbSwitch && ($typeName === 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes')))
|
||||
{
|
||||
$this->checkboxBuilder[$view_name_single][] = $name;
|
||||
}
|
||||
// setup checkboxes and other json items for this view
|
||||
if (($typeName === 'subform' || $typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag')
|
||||
if ($dbSwitch && (($typeName === 'subform' || $typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag'))
|
||||
{
|
||||
$subformJsonSwitch = true;
|
||||
switch ($field['settings']->store)
|
||||
{
|
||||
case 1:
|
||||
@ -2558,6 +2605,8 @@ class Fields extends Structure
|
||||
$this->jsonItemBuilder[$view_name_single][] = $name;
|
||||
// Site settings of each field if needed
|
||||
$this->buildSiteFieldData($view_name_single, $name, 'json', $typeName);
|
||||
// no londer add the json again (already added)
|
||||
$subformJsonSwitch = false;
|
||||
break;
|
||||
}
|
||||
// just a heads-up for usergroups set to multiple
|
||||
@ -2579,14 +2628,23 @@ class Fields extends Structure
|
||||
}
|
||||
}
|
||||
|
||||
// if subform the values must revert to array
|
||||
// subform house keeping
|
||||
if ('subform' === $typeName)
|
||||
{
|
||||
// the values must revert to array
|
||||
$this->jsonItemBuilderArray[$view_name_single][] = $name;
|
||||
// should the json builder still be added
|
||||
if ($subformJsonSwitch)
|
||||
{
|
||||
// and insure the if is converted to json
|
||||
$this->jsonItemBuilder[$view_name_single][] = $name;
|
||||
// Site settings of each field if needed
|
||||
$this->buildSiteFieldData($view_name_single, $name, 'json', $typeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
// build the data for the export & import methods $typeName === 'repeatable' ||
|
||||
if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options))
|
||||
if ($dbSwitch && (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options)))
|
||||
{
|
||||
$this->getItemsMethodEximportStringFixBuilder[$view_name_single][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store);
|
||||
}
|
||||
@ -2598,18 +2656,18 @@ class Fields extends Structure
|
||||
$this->selectionTranslationFixBuilder[$view_name_list][$name] = $options;
|
||||
}
|
||||
// build the sort values
|
||||
if ((isset($field['sort']) && $field['sort'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform'))
|
||||
if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform'))
|
||||
{
|
||||
$this->sortBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'options' => $options);
|
||||
}
|
||||
// build the search values
|
||||
if (isset($field['search']) && $field['search'] == 1)
|
||||
if ($dbSwitch && isset($field['search']) && $field['search'] == 1)
|
||||
{
|
||||
$_list = (isset($field['list'])) ? $field['list'] : 0;
|
||||
$this->searchBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $_list);
|
||||
}
|
||||
// build the filter values
|
||||
if ((isset($field['filter']) && $field['filter'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform'))
|
||||
if ($dbSwitch && (isset($field['filter']) && $field['filter'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform'))
|
||||
{
|
||||
$this->filterBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'database' => $view_name_single, 'function' => ComponentbuilderHelper::safeString($name, 'F'), 'custom' => $custom, 'options' => $options);
|
||||
}
|
||||
@ -2628,6 +2686,16 @@ class Fields extends Structure
|
||||
$this->setLayoutBuilder($view_name_single, $tabName, $name, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
* set Custom Field Type File
|
||||
*
|
||||
* @param array $data The field complete data set
|
||||
* @param string $view_name_list The list view code name
|
||||
* @param string $view_name_single The single view code name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function setCustomFieldTypeFile($data, $view_name_list, $view_name_single)
|
||||
{
|
||||
// make sure it is not already been build or if it is prime
|
||||
@ -2681,11 +2749,12 @@ class Fields extends Structure
|
||||
{
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
// catch empty stuff
|
||||
if (!ComponentbuilderHelper::checkString($phpCode))
|
||||
{
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
|
||||
// some house cleaning for users
|
||||
if ($data['custom']['extends'] === 'user')
|
||||
{
|
||||
// now load the php xclude script
|
||||
@ -2742,10 +2811,203 @@ class Fields extends Structure
|
||||
// ###type### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type'];
|
||||
// ###type### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']);
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButtonToListField($data['custom']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set Add Button To List Field (getInput tweak)
|
||||
*
|
||||
* @param array $fieldData The field custom data
|
||||
*
|
||||
* @return string of getInput class on success empty string otherwise
|
||||
*
|
||||
*/
|
||||
protected function setAddButtonToListField($fieldData)
|
||||
{
|
||||
// make sure hte view values are set
|
||||
if (isset($fieldData['add_button']) && ($fieldData['add_button'] === 'true' || 1 == $fieldData['add_button']) &&
|
||||
isset($fieldData['view']) && isset($fieldData['views']) &&
|
||||
ComponentbuilderHelper::checkString($fieldData['view']) && ComponentbuilderHelper::checkString($fieldData['views']))
|
||||
{
|
||||
// check that the component value is set
|
||||
if (!isset($fieldData['component']) || !ComponentbuilderHelper::checkString($fieldData['component']))
|
||||
{
|
||||
$fieldData['component'] = "com_" . $this->fileContentStatic['###component###'];
|
||||
}
|
||||
// check that the componet has the com_ value in it
|
||||
if (strpos($fieldData['component'], 'com_') === false || strpos($fieldData['component'], '=') !== false)
|
||||
{
|
||||
$fieldData['component'] = "com_" . $fieldData['component'];
|
||||
}
|
||||
// make sure the component is update if ### or [[[ component placeholder is used
|
||||
if (strpos($fieldData['component'], '###') !== false || strpos($fieldData['component'], '[[[') !== false ) // should not be needed... but
|
||||
{
|
||||
$fieldData['component'] = $this->setPlaceholders($fieldData['component'], $this->placeholders);
|
||||
}
|
||||
// get core permissions
|
||||
$coreLoad = false;
|
||||
// add ref tags
|
||||
$refLoad = true;
|
||||
if (isset($this->permissionCore[$fieldData['view']]))
|
||||
{
|
||||
// get the core permission naming array
|
||||
$core = $this->permissionCore[$fieldData['view']];
|
||||
// set switch to activate easy update
|
||||
$coreLoad = true;
|
||||
// since the view is local to the component use this component name
|
||||
$component = "com_" . $this->fileContentStatic['###component###'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// fall back on the field component
|
||||
$component = $fieldData['component'];
|
||||
}
|
||||
// check if we should add ref tags
|
||||
if ($fieldData['component'] !== $component)
|
||||
{
|
||||
// do not add ref tags
|
||||
$refLoad = false;
|
||||
}
|
||||
// start building the add buttons/s
|
||||
$addButton = array();
|
||||
$addButton[] = PHP_EOL . PHP_EOL . "\t/**";
|
||||
$addButton[] = "\t * Override to add new button";
|
||||
$addButton[] = "\t *";
|
||||
$addButton[] = "\t * @return string The field input markup.";
|
||||
$addButton[] = "\t *";
|
||||
$addButton[] = "\t * @since 3.2";
|
||||
$addButton[] = "\t */";
|
||||
$addButton[] = "\tprotected function getInput()";
|
||||
$addButton[] = "\t{";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " see if we should add buttons";
|
||||
$addButton[] = "\t\t\$setButton = \$this->getAttribute('button');";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " get html";
|
||||
$addButton[] = "\t\t\$html = parent::getInput();";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " if true set button";
|
||||
$addButton[] = "\t\tif (\$setButton === 'true')";
|
||||
$addButton[] = "\t\t{";
|
||||
$addButton[] = "\t\t\t\$button = array();";
|
||||
$addButton[] = "\t\t\t\$script = array();";
|
||||
$addButton[] = "\t\t\t\$buttonName = \$this->getAttribute('name');";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the input from url";
|
||||
$addButton[] = "\t\t\t\$app = JFactory::getApplication();";
|
||||
$addButton[] = "\t\t\t\$jinput = \$app->input;";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the view name & id";
|
||||
$addButton[] = "\t\t\t\$values = \$jinput->getArray(array(";
|
||||
$addButton[] = "\t\t\t\t'id' => 'int',";
|
||||
$addButton[] = "\t\t\t\t'view' => 'word'";
|
||||
$addButton[] = "\t\t\t));";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if new item";
|
||||
$addButton[] = "\t\t\t\$ref = '';";
|
||||
$addButton[] = "\t\t\t\$refJ = '';";
|
||||
if ($refLoad)
|
||||
{
|
||||
$addButton[] = "\t\t\tif (!is_null(\$values['id']) && strlen(\$values['view']))";
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " only load referal if not new item.";
|
||||
$addButton[] = "\t\t\t\t\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
|
||||
$addButton[] = "\t\t\t\t\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
|
||||
$addButton[] = "\t\t\t}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif (!is_null(\$values['id']) && strlen(\$values['view']))";
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " get the return value.";
|
||||
$addButton[] = "\t\t\t\t\$_uri = (string) JUri::getInstance();";
|
||||
$addButton[] = "\t\t\t\t\$_return = urlencode(base64_encode(\$_uri));";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load return value.";
|
||||
$addButton[] = "\t\t\t\t\$ref = '&return=' . \$_return;";
|
||||
$addButton[] = "\t\t\t\t\$refJ = '&return=' . \$_return;";
|
||||
$addButton[] = "\t\t\t}";
|
||||
}
|
||||
$addButton[] = "\t\t\t\$user = JFactory::getUser();";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to create " . $fieldData['view'];
|
||||
// check if the item has permissions.
|
||||
if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($fieldData['view'], $this->permissionBuilder['global'][$core['core.create']]))
|
||||
{
|
||||
$addButton[] = "\t\t\tif (\$user->authorise('" . $core['core.create'] . "', '" . $component . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif (\$user->authorise('core.create', '" . $component . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build Create button";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));";
|
||||
$addButton[] = "\t\t\t\t\$button[] = '<a id=\"'.\$buttonName.'Create\" class=\"btn btn-small btn-success hasTooltip\" title=\"'.JText:" . ":sprintf('" . $this->langPrefix . "_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\"";
|
||||
$addButton[] = "\t\t\t\t\thref=\"index.php?option=" . $fieldData['component'] . "&view=" . $fieldData['view'] . "&layout=edit'.\$ref.'\" >";
|
||||
$addButton[] = "\t\t\t\t\t<span class=\"icon-new icon-white\"></span></a>';";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to edit " . $fieldData['view'];
|
||||
// check if the item has permissions.
|
||||
if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($fieldData['view'], $this->permissionBuilder['global'][$core['core.edit']]))
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '" . $fieldData['view'] . "' || \$buttonName === '" . $fieldData['views'] . "') && \$user->authorise('" . $core['core.edit'] . "', '" . $component . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '" . $fieldData['view'] . "' || \$buttonName === '" . $fieldData['views'] . "') && \$user->authorise('core.edit', '" . $component . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build edit button";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));";
|
||||
$addButton[] = "\t\t\t\t\$button[] = '<a id=\"'.\$buttonName.'Edit\" class=\"btn btn-small hasTooltip\" title=\"'.JText:" . ":sprintf('" . $this->langPrefix . "_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >";
|
||||
$addButton[] = "\t\t\t\t\t<span class=\"icon-edit\"></span></a>';";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build script";
|
||||
$addButton[] = "\t\t\t\t\$script[] = \"";
|
||||
$addButton[] = "\t\t\t\t\tjQuery(document).ready(function() {";
|
||||
$addButton[] = "\t\t\t\t\t\tjQuery('#adminForm').on('change', '#jform_\".\$buttonName.\"',function (e) {";
|
||||
$addButton[] = "\t\t\t\t\t\t\te.preventDefault();";
|
||||
$addButton[] = "\t\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);";
|
||||
$addButton[] = "\t\t\t\t\t\t});";
|
||||
$addButton[] = "\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();";
|
||||
$addButton[] = "\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);";
|
||||
$addButton[] = "\t\t\t\t\t});";
|
||||
$addButton[] = "\t\t\t\t\tfunction \".\$buttonName.\"Button(value) {";
|
||||
$addButton[] = "\t\t\t\t\t\tif (value > 0) {"; // TODO not ideal since value may not be an (int)
|
||||
$addButton[] = "\t\t\t\t\t\t\t// hide the create button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Create').hide();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// show edit button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').show();";
|
||||
$addButton[] = "\t\t\t\t\t\t\tvar url = 'index.php?option=" . $fieldData['component'] . "&view=" . $fieldData['views'] . "&task=" . $fieldData['view'] . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').attr('href', url);";
|
||||
$addButton[] = "\t\t\t\t\t\t} else {";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// show the create button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Create').show();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// hide edit button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').hide();";
|
||||
$addButton[] = "\t\t\t\t\t\t}";
|
||||
$addButton[] = "\t\t\t\t\t}\";";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if button was created for " . $fieldData['view'] . " field.";
|
||||
$addButton[] = "\t\t\tif (is_array(\$button) && count(\$button) > 0)";
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Load the needed script.";
|
||||
$addButton[] = "\t\t\t\t\$document = JFactory::getDocument();";
|
||||
$addButton[] = "\t\t\t\t\$document->addScriptDeclaration(implode(' ',\$script));";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " return the button attached to input field.";
|
||||
$addButton[] = "\t\t\t\treturn '<div class=\"input-append\">' .\$html . implode('',\$button).'</div>';";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t}";
|
||||
$addButton[] = "\t\treturn \$html;";
|
||||
$addButton[] = "\t}";
|
||||
|
||||
return implode(PHP_EOL, $addButton);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* default Fields
|
||||
*
|
||||
@ -2798,78 +3060,6 @@ class Fields extends Structure
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlComment
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param string $comment The comment to inject
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public function xmlComment(&$xml, $comment)
|
||||
{
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domComment = new DOMComment($comment);
|
||||
$nodeTarget = $domXML->ownerDocument->importNode($domComment, true);
|
||||
$domXML->appendChild($nodeTarget);
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddAttributes
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $attributes The attributes to apply to the XML element
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public function xmlAddAttributes(&$xml, $attributes = array())
|
||||
{
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
$xml->addAttribute($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAppend
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
public function xmlAppend(&$xml, $node)
|
||||
{
|
||||
if (!$node)
|
||||
{
|
||||
// element was not returned
|
||||
return;
|
||||
}
|
||||
switch (get_class($node))
|
||||
{
|
||||
case 'stdClass':
|
||||
if (property_exists($node, 'comment'))
|
||||
{
|
||||
$this->xmlComment($xml, $node->comment);
|
||||
}
|
||||
if (property_exists($node, 'fieldXML'))
|
||||
{
|
||||
$this->xmlAppend($xml, $node->fieldXML);
|
||||
}
|
||||
break;
|
||||
case 'SimpleXMLElement':
|
||||
$domXML = dom_import_simplexml($xml);
|
||||
$domNode = dom_import_simplexml($node);
|
||||
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
|
||||
$xml = simplexml_import_dom($domXML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlPrettyPrint
|
||||
*
|
||||
|
@ -1270,7 +1270,7 @@ class Interpretation extends Fields
|
||||
$method[] = "\t\t\$lang = JFactory::getLanguage();";
|
||||
$method[] = "\t\t\$extension = 'com_users';";
|
||||
$method[] = "\t\t\$base_dir = JPATH_SITE;";
|
||||
$method[] = "\t\t\$language_tag = 'en-GB';";
|
||||
$method[] = "\t\t\$language_tag = '".$this->langTag."';";
|
||||
$method[] = "\t\t\$reload = true;";
|
||||
$method[] = "\t\t\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = "\t\t//" . $this->setLine(__LINE__) . " load the user regestration model";
|
||||
@ -1351,7 +1351,7 @@ class Interpretation extends Fields
|
||||
$method[] = "\t\t\$lang = JFactory::getLanguage();";
|
||||
$method[] = "\t\t\$extension = 'com_users';";
|
||||
$method[] = "\t\t\$base_dir = JPATH_ADMINISTRATOR;";
|
||||
$method[] = "\t\t\$language_tag = 'en-GB';";
|
||||
$method[] = "\t\t\$language_tag = '".$this->langTag."';";
|
||||
$method[] = "\t\t\$reload = true;";
|
||||
$method[] = "\t\t\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = "\t\t// load the user model";
|
||||
@ -1686,37 +1686,43 @@ class Interpretation extends Fields
|
||||
$fieldDecode = '';
|
||||
foreach ($checker as $field => $array)
|
||||
{
|
||||
if (strpos($get['selection']['select'], $field) !== false)
|
||||
if (strpos($get['selection']['select'], $field) !== false && ComponentbuilderHelper::checkArray($array['decode']))
|
||||
{
|
||||
if ('json' === $array['decode'])
|
||||
// insure it is unique
|
||||
$array['decode'] = (array) array_unique(array_reverse((array) $array['decode']));
|
||||
// now loop the array
|
||||
foreach ($array['decode'] as $decode)
|
||||
{
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// json_decode
|
||||
$decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);";
|
||||
}
|
||||
elseif ('base64' === $array['decode'])
|
||||
{
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// base64_decode
|
||||
$decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");";
|
||||
}
|
||||
elseif (strpos($array['decode'], '_encryption') !== false)
|
||||
{
|
||||
foreach ($this->cryptionTypes as $cryptionType)
|
||||
if ('json' === $decode)
|
||||
{
|
||||
if ($cryptionType . '_encryption' === $array['decode'])
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// json_decode
|
||||
$decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);";
|
||||
}
|
||||
elseif ('base64' === $decode)
|
||||
{
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// base64_decode
|
||||
$decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");";
|
||||
}
|
||||
elseif (strpos($decode, '_encryption') !== false)
|
||||
{
|
||||
foreach ($this->cryptionTypes as $cryptionType)
|
||||
{
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// set decryption
|
||||
$decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
|
||||
$this->siteDecrypt[$cryptionType][$code] = true;
|
||||
if ($cryptionType . '_encryption' === $decode)
|
||||
{
|
||||
$if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{";
|
||||
// set decryption
|
||||
$decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
|
||||
$this->siteDecrypt[$cryptionType][$code] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// build decoder string
|
||||
$fieldDecode .= $if . PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Decode " . $field;
|
||||
$fieldDecode .= PHP_EOL . "\t" . $tab . "\t\t" . $decoder . PHP_EOL . "\t" . $tab . "\t}";
|
||||
// build decoder string
|
||||
$fieldDecode .= $if . PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Decode " . $field;
|
||||
$fieldDecode .= PHP_EOL . "\t" . $tab . "\t\t" . $decoder . PHP_EOL . "\t" . $tab . "\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $fieldDecode;
|
||||
@ -2821,10 +2827,25 @@ class Interpretation extends Fields
|
||||
return $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the a script from the custom script builder
|
||||
*
|
||||
* @param string $first The first key
|
||||
* @param string $second The second key
|
||||
* @param string $prefix The prefix to add in front of the script if found
|
||||
* @param string/bool $note The switch/note to add to the script
|
||||
* @param bool $unset The switch to unset the value if found
|
||||
* @param string/bool $default The switch/string to use as default return if script not found
|
||||
* @param string $sufix The sufix to add after the script if found
|
||||
*
|
||||
* @return mix The string/script if found or the default value if not found
|
||||
*
|
||||
*/
|
||||
public function getCustomScriptBuilder($first, $second, $prefix = '', $note = null, $unset = null, $default = null, $sufix = '')
|
||||
{
|
||||
// check if there is any custom script
|
||||
// default is to return an empty string
|
||||
$script = '';
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$first][$second]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$first][$second]))
|
||||
{
|
||||
// add not if set
|
||||
@ -2832,6 +2853,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$script .= $note;
|
||||
}
|
||||
// load the actual script
|
||||
$script .= $prefix . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$first][$second]) . $sufix;
|
||||
// clear some memory
|
||||
if ($unset)
|
||||
@ -3087,6 +3109,17 @@ class Interpretation extends Fields
|
||||
|
||||
public function setPrepareDocument(&$view)
|
||||
{
|
||||
// fix just incase we missed it somewhere
|
||||
$tmp = $this->lang;
|
||||
if ('site' === $this->target)
|
||||
{
|
||||
$this->lang = 'site';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->lang = 'admin';
|
||||
}
|
||||
|
||||
// ensure correct target is set
|
||||
$TARGET = ComponentbuilderHelper::safeString($this->target, 'U');
|
||||
|
||||
@ -3132,6 +3165,9 @@ class Interpretation extends Fields
|
||||
|
||||
// set a JavaScript file if needed
|
||||
$this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_LIBRARIES_LOADER###'] .= $this->setJavaScriptFile($view, $TARGET);
|
||||
|
||||
// fix just incase we missed it somewhere
|
||||
$this->lang = $tmp;
|
||||
}
|
||||
|
||||
public function setGetModules($view, $TARGET)
|
||||
@ -3297,12 +3333,13 @@ class Interpretation extends Fields
|
||||
{
|
||||
foreach ($view['settings']->custom_buttons as $custom_button)
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// load the button
|
||||
if (3 !== $type && ($custom_button['target'] != 2 || $this->target === 'site'))
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
if ($custom_button['target'] == 2)
|
||||
{
|
||||
@ -3320,10 +3357,6 @@ class Interpretation extends Fields
|
||||
// load the list button
|
||||
elseif (3 == $type && $custom_button['target'] != 1)
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
if (isset($custom_button['type']) && $custom_button['type'] == 2)
|
||||
{
|
||||
@ -4219,6 +4252,39 @@ class Interpretation extends Fields
|
||||
public function setMethodGetItem(&$view)
|
||||
{
|
||||
$script = '';
|
||||
// get the component name
|
||||
$Component = $this->fileContentStatic['###Component###'];
|
||||
// go from base64 to string
|
||||
if (isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view]))
|
||||
{
|
||||
foreach ($this->base64Builder[$view] as $baseString)
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . "))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")";
|
||||
$script .= PHP_EOL . "\t\t\t{";
|
||||
$script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " base64 Decode " . $baseString . ".";
|
||||
$script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = base64_decode(\$item->" . $baseString . ");";
|
||||
$script .= PHP_EOL . "\t\t\t}";
|
||||
}
|
||||
}
|
||||
// decryption
|
||||
foreach ($this->cryptionTypes as $cryptionType)
|
||||
{
|
||||
if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view]))
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
|
||||
$script .= PHP_EOL . "\t\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
|
||||
$script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object.";
|
||||
$script .= PHP_EOL . "\t\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
|
||||
foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString)
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))";
|
||||
$script .= PHP_EOL . "\t\t\t{";
|
||||
$script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . ".";
|
||||
$script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");";
|
||||
$script .= PHP_EOL . "\t\t\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
// go from json to array
|
||||
if (isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view]))
|
||||
{
|
||||
@ -4254,39 +4320,6 @@ class Interpretation extends Fields
|
||||
$script .= PHP_EOL . "\t\t\t}";
|
||||
}
|
||||
}
|
||||
// go from base64 to string
|
||||
if (isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view]))
|
||||
{
|
||||
foreach ($this->base64Builder[$view] as $baseString)
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . "))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")";
|
||||
$script .= PHP_EOL . "\t\t\t{";
|
||||
$script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " base64 Decode " . $baseString . ".";
|
||||
$script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = base64_decode(\$item->" . $baseString . ");";
|
||||
$script .= PHP_EOL . "\t\t\t}";
|
||||
}
|
||||
}
|
||||
// get the component name
|
||||
$Component = $this->fileContentStatic['###Component###'];
|
||||
// decryption
|
||||
foreach ($this->cryptionTypes as $cryptionType)
|
||||
{
|
||||
if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view]))
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
|
||||
$script .= PHP_EOL . "\t\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
|
||||
$script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object.";
|
||||
$script .= PHP_EOL . "\t\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
|
||||
foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString)
|
||||
{
|
||||
$script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))";
|
||||
$script .= PHP_EOL . "\t\t\t{";
|
||||
$script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . ".";
|
||||
$script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");";
|
||||
$script .= PHP_EOL . "\t\t\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add custom php to getitem method
|
||||
$script .= $this->getCustomScriptBuilder('php_getitem', $view, PHP_EOL . PHP_EOL);
|
||||
@ -5064,8 +5097,6 @@ class Interpretation extends Fields
|
||||
public function setBatchMove($viewName_single)
|
||||
{
|
||||
// set needed defaults
|
||||
$title = false;
|
||||
$alias = false;
|
||||
$category = false;
|
||||
$batchmove = array();
|
||||
$VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U');
|
||||
@ -5083,16 +5114,6 @@ class Interpretation extends Fields
|
||||
{
|
||||
$category = $this->catCodeBuilder[$viewName_single]['code'];
|
||||
}
|
||||
// only load alias if set in this view
|
||||
if (array_key_exists($viewName_single, $this->aliasBuilder))
|
||||
{
|
||||
$alias = $this->aliasBuilder[$viewName_single];
|
||||
}
|
||||
// only load title if set in this view
|
||||
if (array_key_exists($viewName_single, $this->titleBuilder))
|
||||
{
|
||||
$title = $this->titleBuilder[$viewName_single];
|
||||
}
|
||||
// prepare custom script
|
||||
$customScript = $this->getCustomScriptBuilder('php_batchmove', $viewName_single, PHP_EOL . PHP_EOL, null, true);
|
||||
|
||||
@ -5252,6 +5273,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
// set needed defaults
|
||||
$title = false;
|
||||
$titles = array();
|
||||
$alias = false;
|
||||
$category = false;
|
||||
$batchcopy = array();
|
||||
@ -5277,9 +5299,26 @@ class Interpretation extends Fields
|
||||
$alias = $this->aliasBuilder[$viewName_single];
|
||||
}
|
||||
// only load title if set in this view
|
||||
if (array_key_exists($viewName_single, $this->titleBuilder))
|
||||
if (isset($this->customAliasBuilder[$viewName_single]))
|
||||
{
|
||||
$title = $this->titleBuilder[$viewName_single];
|
||||
$titles = array_values($this->customAliasBuilder[$viewName_single]);
|
||||
$title = true;
|
||||
}
|
||||
elseif (array_key_exists($viewName_single, $this->titleBuilder))
|
||||
{
|
||||
$titles = array($this->titleBuilder[$viewName_single]);
|
||||
$title = true;
|
||||
}
|
||||
// se the dynamic title
|
||||
if ($title)
|
||||
{
|
||||
// reset the bucket
|
||||
$titleData = array();
|
||||
// load the dynamic title builder
|
||||
foreach ($titles as $_title)
|
||||
{
|
||||
$titleData[] = "\$this->table->" . $_title;
|
||||
}
|
||||
}
|
||||
// prepare custom script
|
||||
$customScript = $this->getCustomScriptBuilder('php_batchcopy', $viewName_single, PHP_EOL . PHP_EOL, null, true);
|
||||
@ -5400,7 +5439,7 @@ class Interpretation extends Fields
|
||||
$batchcopy[] = "\t\t\t\t\tcontinue;";
|
||||
$batchcopy[] = "\t\t\t\t}";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
if ($category && $alias === 'alias' && $title === 'title')
|
||||
if ($category && $alias === 'alias' && ($title && count($titles) == 1 && in_array('title', $titles)))
|
||||
{
|
||||
$batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))";
|
||||
$batchcopy[] = "\t\t\t{";
|
||||
@ -5411,27 +5450,31 @@ class Interpretation extends Fields
|
||||
$batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$this->table->" . $category . ", \$this->table);";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
}
|
||||
elseif ($category && $alias && $title)
|
||||
elseif ($category && $alias && ($title && count($titles) == 1))
|
||||
{
|
||||
$batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))";
|
||||
$batchcopy[] = "\t\t\t{";
|
||||
$batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$values['" . $category . "'], \$this->table->" . $alias . ", \$this->table->" . $title . ");";
|
||||
$batchcopy[] = "\t\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$values['" . $category . "'], \$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
$batchcopy[] = "\t\t\telse";
|
||||
$batchcopy[] = "\t\t\t{";
|
||||
$batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$this->table->" . $category . ", \$this->table->" . $alias . ", \$this->table->" . $title . ");";
|
||||
$batchcopy[] = "\t\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$this->table->" . $category . ", \$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
}
|
||||
elseif (!$category && $alias && ($title && count($titles) == 1))
|
||||
{
|
||||
$batchcopy[] = "\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");";
|
||||
}
|
||||
elseif (!$category && $alias && $title)
|
||||
{
|
||||
$batchcopy[] = "\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", \$this->table->" . $title . ");";
|
||||
$batchcopy[] = "\t\t\tlist(" . implode(', ', $titleData) . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", array(" . implode(', ', $titleData) . "));";
|
||||
}
|
||||
elseif (!$category && !$alias && $title && $title != 'user' && $title != 'jobnumber') // TODO [jobnumber] just for one project (not ideal)
|
||||
elseif (!$category && !$alias && ($title && count($titles) == 1 && !in_array('user', $titles) && !in_array('jobnumber', $titles))) // TODO [jobnumber] just for one project (not ideal)
|
||||
{
|
||||
$batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Only for strings";
|
||||
$batchcopy[] = "\t\t\tif (" . $Helper . "::checkString(\$this->table->" . $title . ") && !is_numeric(\$this->table->" . $title . "))";
|
||||
$batchcopy[] = "\t\t\tif (" . $Helper . "::checkString(\$this->table->" . implode('', $titles). ") && !is_numeric(\$this->table->" . implode('', $titles) . "))";
|
||||
$batchcopy[] = "\t\t\t{";
|
||||
$batchcopy[] = "\t\t\t\t\$this->table->" . $title . " = \$this->generateUniqe('" . $title . "',\$this->table->" . $title . ");";
|
||||
$batchcopy[] = "\t\t\t\t\$this->table->" . implode('', $titles) . " = \$this->generateUniqe('" . implode('', $titles) . "',\$this->table->" . implode('', $titles) . ");";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
}
|
||||
|
||||
@ -5503,35 +5546,65 @@ class Interpretation extends Fields
|
||||
{
|
||||
$fixUniqe = array();
|
||||
// only load this if these two items are set
|
||||
if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder))
|
||||
if (array_key_exists($viewName_single, $this->aliasBuilder) &&
|
||||
(array_key_exists($viewName_single, $this->titleBuilder) || isset($this->customAliasBuilder[$viewName_single])))
|
||||
{
|
||||
// set needed defaults
|
||||
$setCategory = false;
|
||||
$alias = $this->aliasBuilder[$viewName_single];
|
||||
$title = $this->titleBuilder[$viewName_single];
|
||||
$VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U');
|
||||
if (array_key_exists($viewName_single, $this->catCodeBuilder))
|
||||
{
|
||||
$category = $this->catCodeBuilder[$viewName_single]['code'];
|
||||
$setCategory = true;
|
||||
}
|
||||
// set the title stuff
|
||||
if (isset($this->customAliasBuilder[$viewName_single]))
|
||||
{
|
||||
$titles = array_values($this->customAliasBuilder[$viewName_single]);
|
||||
if (isset($this->titleBuilder[$viewName_single]))
|
||||
{
|
||||
// $titles[] = $this->titleBuilder[$viewName_single]; // TODO this may be unexpected
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$titles = array($this->titleBuilder[$viewName_single]);
|
||||
}
|
||||
// start building the fix
|
||||
$fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the " . $title . " for save as copy";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the " . implode(', ',$titles) . " for save as copy";
|
||||
$fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')";
|
||||
$fixUniqe[] = "\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\$origTable = clone \$this->getTable();";
|
||||
$fixUniqe[] = "\t\t\t\$origTable->load(\$input->getInt('id'));";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\tif (\$data['" . $title . "'] == \$origTable->" . $title . ")";
|
||||
$fixUniqe[] = "\t\t\t{";
|
||||
if ($setCategory)
|
||||
// reset the buckets
|
||||
$ifStatment = array();
|
||||
$titleVars = array();
|
||||
$titleData = array();
|
||||
$titleUpdate = array();
|
||||
// load the dynamic title builder
|
||||
foreach ($titles as $title)
|
||||
{
|
||||
$fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);";
|
||||
$ifStatment[] = "\$data['" . $title . "'] == \$origTable->" . $title;
|
||||
$titleVars[] = "\$" . $title;
|
||||
$titleData[] = "\$data['" . $title . "']";
|
||||
$titleUpdate[] = "\t\t\t\t\$data['" . $title . "'] = \$" . $title . ";";
|
||||
}
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\tif (" . implode(' || ', $ifStatment) . ")";
|
||||
$fixUniqe[] = "\t\t\t{";
|
||||
if ($setCategory && count($titles) == 1)
|
||||
{
|
||||
$fixUniqe[] = "\t\t\t\tlist(" . implode('',$titleVars) . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], " . implode('',$titleData) . ");";
|
||||
}
|
||||
elseif (count($titles) == 1)
|
||||
{
|
||||
$fixUniqe[] = "\t\t\t\tlist(" . implode(', ',$titleVars) . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], " . implode('',$titleData) . ");";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);";
|
||||
$fixUniqe[] = "\t\t\t\tlist(" . implode(', ',$titleVars) . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], array(" . implode(', ',$titleData) . "));";
|
||||
}
|
||||
$fixUniqe[] = "\t\t\t\t\$data['" . $title . "'] = \$" . $title . ";";
|
||||
$fixUniqe[] = implode("\n", $titleUpdate);
|
||||
$fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";";
|
||||
$fixUniqe[] = "\t\t\t}";
|
||||
$fixUniqe[] = "\t\t\telse";
|
||||
@ -5546,24 +5619,25 @@ class Interpretation extends Fields
|
||||
$fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Automatic handling of " . $alias . " for empty fields";
|
||||
$fixUniqe[] = "\t\tif (in_array(\$input->get('task'), array('apply', 'save', 'save2new')) && (int) \$input->get('id') == 0)";
|
||||
$fixUniqe[] = "\t\t{";
|
||||
$fixUniqe[] = "\t\t\tif (\$data['" . $alias . "'] == null)";
|
||||
$fixUniqe[] = "\t\t\tif (\$data['" . $alias . "'] == null || empty(\$data['" . $alias . "']))";
|
||||
$fixUniqe[] = "\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\tif (JFactory::getConfig()->get('unicodeslugs') == 1)";
|
||||
$fixUniqe[] = "\t\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(\$data['" . $title . "']);";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(" . implode(' . " " . ', $titleData) . ");";
|
||||
$fixUniqe[] = "\t\t\t\t}";
|
||||
$fixUniqe[] = "\t\t\t\telse";
|
||||
$fixUniqe[] = "\t\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(\$data['" . $title . "']);";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(". implode(' . " " . ', $titleData) .");";
|
||||
$fixUniqe[] = "\t\t\t\t}";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\t\$table = JTable::getInstance('" . $viewName_single . "', '" . $this->fileContentStatic['###component###'] . "Table');";
|
||||
if ($setCategory)
|
||||
if ($setCategory && count($titles) == 1)
|
||||
{
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'], '" . $category . "' => \$data['" . $category . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))";
|
||||
$fixUniqe[] = "\t\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');";
|
||||
$fixUniqe[] = "\t\t\t\t}";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\tlist(" . implode('',$titleVars) . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], " . implode('',$titleData) . ");";
|
||||
$fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5571,9 +5645,8 @@ class Interpretation extends Fields
|
||||
$fixUniqe[] = "\t\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');";
|
||||
$fixUniqe[] = "\t\t\t\t}";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\t\$data['" . $alias . "'] = \$this->_generateNewTitle(\$data['" . $alias . "']);";
|
||||
}
|
||||
$fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";";
|
||||
$fixUniqe[] = PHP_EOL . "\t\t\t\tif (isset(\$msg))";
|
||||
$fixUniqe[] = "\t\t\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\t\tJFactory::getApplication()->enqueueMessage(\$msg, 'warning');";
|
||||
@ -5602,28 +5675,56 @@ class Interpretation extends Fields
|
||||
public function setGenerateNewTitle($viewName_single)
|
||||
{
|
||||
// if category is added to this view then do nothing
|
||||
if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder))
|
||||
if (array_key_exists($viewName_single, $this->aliasBuilder) &&
|
||||
(array_key_exists($viewName_single, $this->titleBuilder) || isset($this->customAliasBuilder[$viewName_single])))
|
||||
{
|
||||
// get component name
|
||||
$Component = $this->fileContentStatic['###Component###'];
|
||||
// rest the new function
|
||||
$newFunction = array();
|
||||
$newFunction[] = PHP_EOL . PHP_EOL . "\t/**";
|
||||
$newFunction[] = "\t* Method to change the title & alias.";
|
||||
$newFunction[] = "\t* Method to change the title/s & alias.";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @param string \$alias The alias.";
|
||||
$newFunction[] = "\t* @param string \$title The title.";
|
||||
$newFunction[] = "\t* @param string \$alias The alias.";
|
||||
$newFunction[] = "\t* @param string/array \$title The title.";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @return array Contains the modified title and alias.";
|
||||
$newFunction[] = "\t* @return array/string Contains the modified title/s and/or alias.";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t*/";
|
||||
$newFunction[] = "\tprotected function _generateNewTitle(\$alias, \$title)";
|
||||
$newFunction[] = "\tprotected function _generateNewTitle(\$alias, \$title = null)";
|
||||
$newFunction[] = "\t{";
|
||||
$newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title & alias";
|
||||
$newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title/s & alias";
|
||||
$newFunction[] = "\t\t\$table = \$this->getTable();";
|
||||
$newFunction[] = PHP_EOL . "\t\twhile (\$table->load(array('alias' => \$alias)))";
|
||||
$newFunction[] = "\t\t{";
|
||||
$newFunction[] = "\t\t\t\$title = JString::increment(\$title);";
|
||||
$newFunction[] = "\t\t\t//" . $this->setLine(__LINE__) . " Check if this is an array of titles";
|
||||
$newFunction[] = "\t\t\tif (".$Component."Helper::checkArray(\$title))";
|
||||
$newFunction[] = "\t\t\t{";
|
||||
$newFunction[] = "\t\t\t\tforeach(\$title as \$nr => &\$_title)";
|
||||
$newFunction[] = "\t\t\t\t{";
|
||||
$newFunction[] = "\t\t\t\t\t\$_title = JString::increment(\$_title);";
|
||||
$newFunction[] = "\t\t\t\t}";
|
||||
$newFunction[] = "\t\t\t}";
|
||||
$newFunction[] = "\t\t\t//" . $this->setLine(__LINE__) . " Make sure we have a title";
|
||||
$newFunction[] = "\t\t\telseif (\$title)";
|
||||
$newFunction[] = "\t\t\t{";
|
||||
$newFunction[] = "\t\t\t\t\$title = JString::increment(\$title);";
|
||||
$newFunction[] = "\t\t\t}";
|
||||
$newFunction[] = "\t\t\t\$alias = JString::increment(\$alias, 'dash');";
|
||||
$newFunction[] = "\t\t}";
|
||||
$newFunction[] = PHP_EOL . "\t\treturn array(\$title, \$alias);";
|
||||
$newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " Check if this is an array of titles";
|
||||
$newFunction[] = "\t\tif (".$Component."Helper::checkArray(\$title))";
|
||||
$newFunction[] = "\t\t{";
|
||||
$newFunction[] = "\t\t\t\$title[] = \$alias;";
|
||||
$newFunction[] = "\t\t\treturn \$title;";
|
||||
$newFunction[] = "\t\t}";
|
||||
$newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " Make sure we have a title";
|
||||
$newFunction[] = "\t\telseif (\$title)";
|
||||
$newFunction[] = "\t\t{";
|
||||
$newFunction[] = "\t\t\treturn array(\$title, \$alias);";
|
||||
$newFunction[] = "\t\t}";
|
||||
$newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " We only had an alias";
|
||||
$newFunction[] = "\t\treturn \$alias;";
|
||||
$newFunction[] = "\t}";
|
||||
return implode(PHP_EOL, $newFunction);
|
||||
}
|
||||
@ -5631,9 +5732,9 @@ class Interpretation extends Fields
|
||||
{
|
||||
$newFunction = array();
|
||||
$newFunction[] = PHP_EOL . PHP_EOL . "\t/**";
|
||||
$newFunction[] = "\t* Method to change the title & alias.";
|
||||
$newFunction[] = "\t* Method to change the title";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @param string \$title The title.";
|
||||
$newFunction[] = "\t* @param string \$title The title.";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @return array Contains the modified title and alias.";
|
||||
$newFunction[] = "\t*";
|
||||
@ -5653,6 +5754,71 @@ class Interpretation extends Fields
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setGenerateNewAlias($viewName_single)
|
||||
{
|
||||
// make sure this view has an alias
|
||||
if (isset($this->aliasBuilder[$viewName_single]))
|
||||
{
|
||||
// set the title stuff
|
||||
if (isset($this->customAliasBuilder[$viewName_single]))
|
||||
{
|
||||
$titles = array_values($this->customAliasBuilder[$viewName_single]);
|
||||
}
|
||||
elseif (isset($this->titleBuilder[$viewName_single]))
|
||||
{
|
||||
$titles = array($this->titleBuilder[$viewName_single]);
|
||||
}
|
||||
// reset the bucket
|
||||
$titleData = array();
|
||||
// load the dynamic title builder
|
||||
if (isset($titles) && ComponentbuilderHelper::checkArray($titles))
|
||||
{
|
||||
foreach ($titles as $title)
|
||||
{
|
||||
$titleData[] = "\$this->" . $title;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$titleData = array("'-'"); // just incase some mad man does not set a title/customAlias (we fall back on the date)
|
||||
}
|
||||
// rest the new function
|
||||
$newFunction = array();
|
||||
$newFunction[] = PHP_EOL . PHP_EOL . "\t/**";
|
||||
$newFunction[] = "\t* Generate a valid alias from title / date.";
|
||||
$newFunction[] = "\t* Remains public to be able to check for duplicated alias before saving";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @return string";
|
||||
$newFunction[] = "\t*/";
|
||||
$newFunction[] = "\tpublic function generateAlias()";
|
||||
$newFunction[] = "\t{";
|
||||
$newFunction[] = "\t\tif (empty(\$this->alias))";
|
||||
$newFunction[] = "\t\t{";
|
||||
$newFunction[] = "\t\t\t\$this->alias = ".implode(".' '.",$titleData).';';
|
||||
$newFunction[] = "\t\t}";
|
||||
$newFunction[] = PHP_EOL ."\t\t\$this->alias = JApplication::stringURLSafe(\$this->alias);";
|
||||
$newFunction[] = PHP_EOL ."\t\tif (trim(str_replace('-', '', \$this->alias)) == '')";
|
||||
$newFunction[] = "\t\t{";
|
||||
$newFunction[] = "\t\t\t\$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');";
|
||||
$newFunction[] = "\t\t}";
|
||||
$newFunction[] = PHP_EOL ."\t\treturn \$this->alias;";
|
||||
$newFunction[] = "\t}";
|
||||
return implode(PHP_EOL, $newFunction);
|
||||
}
|
||||
// rest the new function
|
||||
$newFunction = array();
|
||||
$newFunction[] = PHP_EOL . PHP_EOL . "\t/**";
|
||||
$newFunction[] = "\t* This view does not actually have an alias";
|
||||
$newFunction[] = "\t*";
|
||||
$newFunction[] = "\t* @return bool";
|
||||
$newFunction[] = "\t*/";
|
||||
$newFunction[] = "\tpublic function generateAlias()";
|
||||
$newFunction[] = "\t{";
|
||||
$newFunction[] = "\t\treturn false;";
|
||||
$newFunction[] = "\t}";
|
||||
return implode(PHP_EOL, $newFunction);
|
||||
}
|
||||
|
||||
public function setInstall()
|
||||
{
|
||||
if (isset($this->queryBuilder) && ComponentbuilderHelper::checkArray($this->queryBuilder))
|
||||
@ -5997,7 +6163,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
ksort($this->langContent['admin']);
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['admin'] = $this->langContent['admin'];
|
||||
$this->languages[$this->langTag]['admin'] = $this->langContent['admin'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['admin']);
|
||||
|
||||
@ -6050,7 +6216,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
ksort($this->langContent['site']);
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['site'] = $this->langContent['site'];
|
||||
$this->languages[$this->langTag]['site'] = $this->langContent['site'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['site']);
|
||||
|
||||
@ -6078,7 +6244,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
ksort($this->langContent['sitesys']);
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['sitesys'] = $this->langContent['sitesys'];
|
||||
$this->languages[$this->langTag]['sitesys'] = $this->langContent['sitesys'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['sitesys']);
|
||||
|
||||
@ -6101,7 +6267,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
ksort($this->langContent['adminsys']);
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['adminsys'] = $this->langContent['adminsys'];
|
||||
$this->languages[$this->langTag]['adminsys'] = $this->langContent['adminsys'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['adminsys']);
|
||||
|
||||
@ -8608,136 +8774,6 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
|
||||
public function setAddButttonToListField($targetView, $targetViews)
|
||||
{
|
||||
$addButton = array();
|
||||
$addButton[] = PHP_EOL . "\t/**";
|
||||
$addButton[] = "\t * Override to add new button";
|
||||
$addButton[] = "\t *";
|
||||
$addButton[] = "\t * @return string The field input markup.";
|
||||
$addButton[] = "\t *";
|
||||
$addButton[] = "\t * @since 3.2";
|
||||
$addButton[] = "\t */";
|
||||
$addButton[] = "\tprotected function getInput()";
|
||||
$addButton[] = "\t{";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " see if we should add buttons";
|
||||
$addButton[] = "\t\t\$setButton = \$this->getAttribute('button');";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " get html";
|
||||
$addButton[] = "\t\t\$html = parent::getInput();";
|
||||
$addButton[] = "\t\t//" . $this->setLine(__LINE__) . " if true set button";
|
||||
$addButton[] = "\t\tif (\$setButton === 'true')";
|
||||
$addButton[] = "\t\t{";
|
||||
$addButton[] = "\t\t\t\$button = array();";
|
||||
$addButton[] = "\t\t\t\$script = array();";
|
||||
$addButton[] = "\t\t\t\$buttonName = \$this->getAttribute('name');";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the input from url";
|
||||
$addButton[] = "\t\t\t\$app = JFactory::getApplication();";
|
||||
$addButton[] = "\t\t\t\$jinput = \$app->input;";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the view name & id";
|
||||
$addButton[] = "\t\t\t\$values = \$jinput->getArray(array(";
|
||||
$addButton[] = "\t\t\t\t'id' => 'int',";
|
||||
$addButton[] = "\t\t\t\t'view' => 'word'";
|
||||
$addButton[] = "\t\t\t));";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if new item";
|
||||
$addButton[] = "\t\t\t\$ref = '';";
|
||||
$addButton[] = "\t\t\t\$refJ = '';";
|
||||
$addButton[] = "\t\t\tif (!is_null(\$values['id']) && strlen(\$values['view']))";
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " only load referal if not new item.";
|
||||
$addButton[] = "\t\t\t\t\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
|
||||
$addButton[] = "\t\t\t\t\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t\t\$user = JFactory::getUser();";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to create " . $targetView;
|
||||
// get core permissions
|
||||
$coreLoad = false;
|
||||
if (isset($this->permissionCore[$targetView]))
|
||||
{
|
||||
$core = $this->permissionCore[$targetView];
|
||||
$coreLoad = true;
|
||||
}
|
||||
// check if the item has permissions.
|
||||
if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($targetView, $this->permissionBuilder['global'][$core['core.create']]))
|
||||
{
|
||||
$addButton[] = "\t\t\tif (\$user->authorise('" . $core['core.create'] . "', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif (\$user->authorise('core.create', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build Create button";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));";
|
||||
$addButton[] = "\t\t\t\t\$button[] = '<a id=\"'.\$buttonName.'Create\" class=\"btn btn-small btn-success hasTooltip\" title=\"'.JText:" . ":sprintf('" . $this->langPrefix . "_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\"";
|
||||
$addButton[] = "\t\t\t\t\thref=\"index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $targetView . "&layout=edit'.\$ref.'\" >";
|
||||
$addButton[] = "\t\t\t\t\t<span class=\"icon-new icon-white\"></span></a>';";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to edit " . $targetView;
|
||||
// check if the item has permissions.
|
||||
if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($targetView, $this->permissionBuilder['global'][$core['core.edit']]))
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '" . $targetView . "' || \$buttonName === '" . $targetViews . "') && \$user->authorise('" . $core['core.edit'] . "', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '" . $targetView . "' || \$buttonName === '" . $targetViews . "') && \$user->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build edit button";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);";
|
||||
$addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));";
|
||||
$addButton[] = "\t\t\t\t\$button[] = '<a id=\"'.\$buttonName.'Edit\" class=\"btn btn-small hasTooltip\" title=\"'.JText:" . ":sprintf('" . $this->langPrefix . "_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >";
|
||||
$addButton[] = "\t\t\t\t\t<span class=\"icon-edit\"></span></a>';";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build script";
|
||||
$addButton[] = "\t\t\t\t\$script[] = \"";
|
||||
$addButton[] = "\t\t\t\t\tjQuery(document).ready(function() {";
|
||||
$addButton[] = "\t\t\t\t\t\tjQuery('#adminForm').on('change', '#jform_\".\$buttonName.\"',function (e) {";
|
||||
$addButton[] = "\t\t\t\t\t\t\te.preventDefault();";
|
||||
$addButton[] = "\t\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);";
|
||||
$addButton[] = "\t\t\t\t\t\t});";
|
||||
$addButton[] = "\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();";
|
||||
$addButton[] = "\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);";
|
||||
$addButton[] = "\t\t\t\t\t});";
|
||||
$addButton[] = "\t\t\t\t\tfunction \".\$buttonName.\"Button(value) {";
|
||||
$addButton[] = "\t\t\t\t\t\tif (value > 0) {"; // TODO not ideal since value may not be an (int)
|
||||
$addButton[] = "\t\t\t\t\t\t\t// hide the create button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Create').hide();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// show edit button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').show();";
|
||||
$addButton[] = "\t\t\t\t\t\t\tvar url = 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $targetViews . "&task=" . $targetView . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').attr('href', url);";
|
||||
$addButton[] = "\t\t\t\t\t\t} else {";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// show the create button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Create').show();";
|
||||
$addButton[] = "\t\t\t\t\t\t\t// hide edit button";
|
||||
$addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').hide();";
|
||||
$addButton[] = "\t\t\t\t\t\t}";
|
||||
$addButton[] = "\t\t\t\t\t}\";";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if button was created for " . $targetView . " field.";
|
||||
$addButton[] = "\t\t\tif (is_array(\$button) && count(\$button) > 0)";
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Load the needed script.";
|
||||
$addButton[] = "\t\t\t\t\$document = JFactory::getDocument();";
|
||||
$addButton[] = "\t\t\t\t\$document->addScriptDeclaration(implode(' ',\$script));";
|
||||
$addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " return the button attached to input field.";
|
||||
$addButton[] = "\t\t\t\treturn '<div class=\"input-append\">' .\$html . implode('',\$button).'</div>';";
|
||||
$addButton[] = "\t\t\t}";
|
||||
$addButton[] = "\t\t}";
|
||||
$addButton[] = "\t\treturn \$html;";
|
||||
$addButton[] = "\t}";
|
||||
|
||||
return implode(PHP_EOL, $addButton);
|
||||
}
|
||||
|
||||
public function setFilterQuery($viewName_list)
|
||||
{
|
||||
if (isset($this->filterBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->filterBuilder[$viewName_list]))
|
||||
@ -9114,7 +9150,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
// minfy the script
|
||||
if ($this->params->get('minify') && isset($fileScript) && ComponentbuilderHelper::checkString($fileScript))
|
||||
if ($this->minify && isset($fileScript) && ComponentbuilderHelper::checkString($fileScript))
|
||||
{
|
||||
// minify the fielScript javscript
|
||||
$minifier = new JS;
|
||||
@ -9122,7 +9158,7 @@ class Interpretation extends Fields
|
||||
$fileScript = $minifier->minify();
|
||||
}
|
||||
// minfy the script
|
||||
if ($this->params->get('minify') && isset($footerScript) && ComponentbuilderHelper::checkString($footerScript))
|
||||
if ($this->minify && isset($footerScript) && ComponentbuilderHelper::checkString($footerScript))
|
||||
{
|
||||
// minify the footerScript javscript
|
||||
$minifier = new JS;
|
||||
@ -9618,7 +9654,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (ComponentbuilderHelper::typeField($type, 'list') || ComponentbuilderHelper::typeField($type, 'dynamic') || !ComponentbuilderHelper::typeField($type))
|
||||
{
|
||||
$optionsArray = explode(PHP_EOL, $options);
|
||||
$optionsArray = array_map('trim', (array) explode(PHP_EOL, $options));
|
||||
if (!ComponentbuilderHelper::checkArray($optionsArray))
|
||||
{
|
||||
$optionsArray[] = $optionsArray;
|
||||
@ -9627,7 +9663,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (strpos($option, '|') !== false)
|
||||
{
|
||||
list($option) = explode('|', $option);
|
||||
list($option) = array_map('trim', (array) explode('|', $option));
|
||||
}
|
||||
if ($option != 'dynamic_list')
|
||||
{
|
||||
@ -9644,7 +9680,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (strpos($keywords, ',') !== false)
|
||||
{
|
||||
$keywords = explode(',', $keywords);
|
||||
$keywords = array_map('trim', (array) explode(',', $keywords));
|
||||
foreach ($keywords as $keyword)
|
||||
{
|
||||
$buket['keywords'][] = trim($keyword);
|
||||
@ -11879,8 +11915,16 @@ class Interpretation extends Fields
|
||||
$fix .= PHP_EOL . "\t" . $tab . "\t\t\t//" . $this->setLine(__LINE__) . " convert " . $item['name'];
|
||||
if (isset($item['custom']['table']))
|
||||
{
|
||||
$keyTableNAme = str_replace('#__' . $this->fileContentStatic['###component###'] . '_', '', $item['custom']['table']);
|
||||
$fix .= PHP_EOL . "\t" . $tab . "\t\t\t\$item->" . $item['name'] . " = " . $Component . "Helper::jsonToString(\$item->" . $item['name'] . ", ', ', '" . $keyTableNAme . "');";
|
||||
// check if this is a local table
|
||||
if (strpos($item['custom']['table'], '#__' . $this->fileContentStatic['###component###'] . '_') !== false)
|
||||
{
|
||||
$keyTableNAme = str_replace('#__' . $this->fileContentStatic['###component###'] . '_', '', $item['custom']['table']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$keyTableNAme = $item['custom']['table'];
|
||||
}
|
||||
$fix .= PHP_EOL . "\t" . $tab . "\t\t\t\$item->" . $item['name'] . " = " . $Component . "Helper::jsonToString(\$item->" . $item['name'] . ", ', ', '" . $keyTableNAme . "', '".$item['custom']['id']."', '".$item['custom']['text']."');";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -12742,7 +12786,16 @@ class Interpretation extends Fields
|
||||
// set the code name
|
||||
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
|
||||
// set main menu name to lang
|
||||
$this->langContent['adminsys'][$lang] = '» ' . $this->componentData->name;
|
||||
$addPrefix = $this->params->get('add_menu_prefix', 1);
|
||||
if ($addPrefix == 1)
|
||||
{
|
||||
$prefix = trim($this->params->get('menu_prefix', '»'));
|
||||
$this->langContent['adminsys'][$lang] = $prefix . ' ' . $this->componentData->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->langContent['adminsys'][$lang] = $this->componentData->name;
|
||||
}
|
||||
foreach ($this->componentData->admin_views as $view)
|
||||
{
|
||||
// set custom menu
|
||||
@ -13083,12 +13136,6 @@ class Interpretation extends Fields
|
||||
$tabCode = ComponentbuilderHelper::safeString($tab) . '_custom_config';
|
||||
$tabUpper = ComponentbuilderHelper::safeString($tab, 'U');
|
||||
$tabLower = ComponentbuilderHelper::safeString($tab);
|
||||
// setup lang
|
||||
$this->langContent[$this->lang][$lang . '_' . $tabUpper] = $tab;
|
||||
// start field set
|
||||
$this->configFieldSets[] = "\t<fieldset";
|
||||
$this->configFieldSets[] = "\t\t" . 'name="' . $tabCode . '"';
|
||||
$this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_' . $tabUpper . '">';
|
||||
// remove display targeted fields
|
||||
$bucket = array();
|
||||
foreach ($tabFields as $tabField)
|
||||
@ -13100,10 +13147,20 @@ class Interpretation extends Fields
|
||||
$bucket[] = str_replace('display="config"', '', $tabField);
|
||||
}
|
||||
}
|
||||
// set the fields
|
||||
$this->configFieldSets[] = implode("", $bucket);
|
||||
// close field set
|
||||
$this->configFieldSets[] = "\t</fieldset>";
|
||||
// only add the tab if it has values
|
||||
if (ComponentbuilderHelper::checkArray($bucket))
|
||||
{
|
||||
// setup lang
|
||||
$this->langContent[$this->lang][$lang . '_' . $tabUpper] = $tab;
|
||||
// start field set
|
||||
$this->configFieldSets[] = "\t<fieldset";
|
||||
$this->configFieldSets[] = "\t\t" . 'name="' . $tabCode . '"';
|
||||
$this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_' . $tabUpper . '">';
|
||||
// set the fields
|
||||
$this->configFieldSets[] = implode("", $bucket);
|
||||
// close field set
|
||||
$this->configFieldSets[] = "\t</fieldset>";
|
||||
}
|
||||
// remove after loading
|
||||
unset($this->configFieldSetsCustomField[$tab]);
|
||||
}
|
||||
|
@ -299,14 +299,12 @@ class Infusion extends Interpretation
|
||||
// ###AJAXTOKE### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###AJAXTOKE###'] = $this->setAjaxToke($viewName_single);
|
||||
|
||||
if (isset($this->customScriptBuilder['php_document'][$viewName_single]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['php_document'][$viewName_single]))
|
||||
// ###DOCUMENT_CUSTOM_PHP### <<<DYNAMIC>>>
|
||||
if ($phpDocument = $this->getCustomScriptBuilder('php_document', $viewName_single, PHP_EOL, null, true, false))
|
||||
{
|
||||
// ###DOCUMENT_CUSTOM_PHP### <<<DYNAMIC>>>
|
||||
$this->customScriptBuilder['php_document'][$viewName_single] = str_replace('$document->', '$this->document->', $this->customScriptBuilder['php_document'][$viewName_single]);
|
||||
$this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###'] = PHP_EOL . $this->setPlaceholders(
|
||||
$this->customScriptBuilder['php_document'][$viewName_single], $this->placeholders);
|
||||
$this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###'] = str_replace('$document->', '$this->document->', $phpDocument);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder['php_document'][$viewName_single]);
|
||||
unset($phpDocument);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -361,18 +359,9 @@ class Infusion extends Interpretation
|
||||
// ###POSTSAVEHOOK### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###POSTSAVEHOOK###'] = $this->getCustomScriptBuilder('php_postsavehook', $viewName_single, PHP_EOL, null, true, PHP_EOL . "\t\treturn;", PHP_EOL . PHP_EOL . "\t\treturn;");
|
||||
|
||||
if (isset($this->customScriptBuilder['css_view'][$viewName_single]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['css_view'][$viewName_single]))
|
||||
{
|
||||
// ###VIEWCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###VIEWCSS###'] = $this->setPlaceholders($this->customScriptBuilder['css_view'][$viewName_single], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder['css_view'][$viewName_single]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###VIEWCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###VIEWCSS###'] = '';
|
||||
}
|
||||
// ###VIEWCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###VIEWCSS###'] = $this->getCustomScriptBuilder('css_view', $viewName_single, '', null, true);
|
||||
|
||||
// add css to front end
|
||||
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
|
||||
{
|
||||
@ -489,17 +478,30 @@ class Infusion extends Interpretation
|
||||
// ###JVIEWLISTCANDO### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###JVIEWLISTCANDO###'] = $this->setJviewListCanDo($viewName_single, $viewName_list);
|
||||
|
||||
if (isset($this->customScriptBuilder['css_views'][$viewName_list]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['css_views'][$viewName_list]))
|
||||
// ###VIEWSCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###VIEWSCSS###'] = $this->getCustomScriptBuilder('css_views', $viewName_list, '', null, true);
|
||||
|
||||
// ###VIEWS_FOOTER_SCRIPT### <<<DYNAMIC>>>
|
||||
$scriptNote = PHP_EOL . '//' . $this->setLine(__LINE__) . ' ' . $viewName_list.' footer script';
|
||||
if ($footerScript = $this->getCustomScriptBuilder('views_footer', $viewName_single, '', $scriptNote, true, false, PHP_EOL))
|
||||
{
|
||||
// ###VIEWCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###VIEWSCSS###'] = $this->setPlaceholders($this->customScriptBuilder['css_views'][$viewName_list], $this->placeholders);
|
||||
// only minfy if no php is added to the footer script
|
||||
if ($this->minify && strpos($footerScript, '<?php') === false)
|
||||
{
|
||||
// minfy the script
|
||||
$minifier = new JS;
|
||||
$minifier->add($footerScript);
|
||||
$footerScript = $minifier->minify();
|
||||
// clear some memory
|
||||
unset($minifier);
|
||||
}
|
||||
$this->fileContentDynamic[$viewName_list]['###VIEWS_FOOTER_SCRIPT###'] = PHP_EOL . '<script type="text/javascript">' . $footerScript . "</script>";
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder['css_views'][$viewName_list]);
|
||||
unset($footerScript);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###VIEWCSS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###VIEWSCSS###'] = '';
|
||||
$this->fileContentDynamic[$viewName_list]['###VIEWS_FOOTER_SCRIPT###'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,6 +514,9 @@ class Infusion extends Interpretation
|
||||
// ###GENERATENEWTITLE### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###GENERATENEWTITLE###'] = $this->setGenerateNewTitle($viewName_single);
|
||||
|
||||
// ###GENERATENEWALIAS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###GENERATENEWALIAS###'] = $this->setGenerateNewAlias($viewName_single);
|
||||
|
||||
// ###MODEL_BATCH_COPY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single]['###MODEL_BATCH_COPY###'] = $this->setBatchCopy($viewName_single);
|
||||
|
||||
@ -617,86 +622,31 @@ class Infusion extends Interpretation
|
||||
|
||||
if ($view['settings']->main_get->gettype == 1)
|
||||
{
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]))
|
||||
{
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEM###'] = $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEM###'] = '';
|
||||
}
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEM###'] = $this->getCustomScriptBuilder($this->target . '_php_before_getitem', $view['settings']->code, '', null, true);
|
||||
|
||||
// ###CUSTOM_ADMIN_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_ITEM###'] = $this->setCustomViewGetItem($view['settings']->main_get, $view['settings']->code, "\t\t");
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]))
|
||||
{
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEM###'] = $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEM###'] = '';
|
||||
}
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEM###'] = $this->getCustomScriptBuilder($this->target . '_php_after_getitem', $view['settings']->code, '', null, true);
|
||||
}
|
||||
elseif ($view['settings']->main_get->gettype == 2)
|
||||
{
|
||||
// ###CUSTOM_ADMIN_GET_LIST_QUERY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_LIST_QUERY###'] = $this->setCustomViewListQuery($view['settings']->main_get, $view['settings']->code);
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]))
|
||||
{
|
||||
// ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###'] = PHP_EOL . $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###'] = '';
|
||||
}
|
||||
// ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###'] = $this->getCustomScriptBuilder($this->target . '_php_getlistquery', $view['settings']->code, PHP_EOL, null, true);
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]))
|
||||
{
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###'] = PHP_EOL . $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###'] = '';
|
||||
}
|
||||
// ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###'] = $this->getCustomScriptBuilder($this->target . '_php_before_getitems', $view['settings']->code, PHP_EOL, null, true);
|
||||
|
||||
// ###CUSTOM_ADMIN_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_ITEMS###'] = $this->setCustomViewGetItems($view['settings']->main_get, $view['settings']->code);
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]))
|
||||
{
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###'] = PHP_EOL . $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###'] = '';
|
||||
}
|
||||
// ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###'] = $this->getCustomScriptBuilder($this->target . '_php_after_getitems', $view['settings']->code, PHP_EOL, null, true);
|
||||
}
|
||||
|
||||
// ###CUSTOM_ADMIN_CUSTOM_METHODS### <<<DYNAMIC>>>
|
||||
@ -815,6 +765,21 @@ class Infusion extends Interpretation
|
||||
// set the module
|
||||
$this->fileContentDynamic['ajax']['###AJAX_SITE_MODEL_METHODS###'] = $this->setAjaxModelMethods('site');
|
||||
}
|
||||
|
||||
// build the validation rules
|
||||
if (isset($this->validationRules) && ComponentbuilderHelper::checkArray($this->validationRules))
|
||||
{
|
||||
foreach ($this->validationRules as $rule => $_php)
|
||||
{
|
||||
// setup rule file
|
||||
$target = array('admin' => 'a_rule_zi');
|
||||
$this->buildDynamique($target, 'rule', $rule);
|
||||
// set the JFormRule Name
|
||||
$this->fileContentDynamic['a_rule_zi_'.$rule]['###Name###'] = ucfirst($rule);
|
||||
// set the JFormRule PHP
|
||||
$this->fileContentDynamic['a_rule_zi_'.$rule]['###VALIDATION_RULE_METHODS###'] = PHP_EOL . $_php;
|
||||
}
|
||||
}
|
||||
|
||||
// run the second run if needed
|
||||
if (isset($this->secondRunAdmin) && ComponentbuilderHelper::checkArray($this->secondRunAdmin))
|
||||
@ -893,36 +858,15 @@ class Infusion extends Interpretation
|
||||
{
|
||||
// set user permission access check ###USER_PERMISSION_CHECK_ACCESS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###USER_PERMISSION_CHECK_ACCESS###'] = $this->setUserPermissionCheckAccess($view, 1);
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]))
|
||||
{
|
||||
// ###SITE_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEM###'] = $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###SITE_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEM###'] = '';
|
||||
}
|
||||
|
||||
// ###SITE_BEFORE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEM###'] = $this->getCustomScriptBuilder($this->target . '_php_before_getitem', $view['settings']->code, '', null, true);
|
||||
|
||||
// ###SITE_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_GET_ITEM###'] = $this->setCustomViewGetItem($view['settings']->main_get, $view['settings']->code, "\t\t");
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]))
|
||||
{
|
||||
// ###SITE_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEM###'] = $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###SITE_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEM###'] = '';
|
||||
}
|
||||
// ###SITE_AFTER_GET_ITEM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEM###'] = $this->getCustomScriptBuilder($this->target . '_php_after_getitem', $view['settings']->code, '', null, true);
|
||||
}
|
||||
elseif ($view['settings']->main_get->gettype == 2)
|
||||
{
|
||||
@ -931,36 +875,14 @@ class Infusion extends Interpretation
|
||||
// ###SITE_GET_LIST_QUERY### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_GET_LIST_QUERY###'] = $this->setCustomViewListQuery($view['settings']->main_get, $view['settings']->code);
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]))
|
||||
{
|
||||
// ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###'] = PHP_EOL . $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###'] = '';
|
||||
}
|
||||
// ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###'] = $this->getCustomScriptBuilder($this->target . '_php_before_getitems', $view['settings']->code, PHP_EOL, null, true);
|
||||
|
||||
// ###SITE_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_GET_ITEMS###'] = $this->setCustomViewGetItems($view['settings']->main_get, $view['settings']->code);
|
||||
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]))
|
||||
{
|
||||
// ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###'] = PHP_EOL . $this->setPlaceholders($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code], $this->placeholders);
|
||||
// clear some memory
|
||||
unset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###'] = '';
|
||||
}
|
||||
// ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###'] = $this->getCustomScriptBuilder($this->target . '_php_after_getitems', $view['settings']->code, PHP_EOL, null, true);
|
||||
}
|
||||
// add to lang array
|
||||
if (!isset($this->langContent['site'][$this->langPrefix . '_' . $view['settings']->CODE]))
|
||||
@ -1147,8 +1069,7 @@ class Infusion extends Interpretation
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the lang values and insert to fiel
|
||||
*
|
||||
* Build the language values and insert into file
|
||||
*
|
||||
* @return boolean on success
|
||||
*
|
||||
@ -1160,26 +1081,26 @@ class Infusion extends Interpretation
|
||||
// check the admin lang is set
|
||||
if ($this->setLangAdmin())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['admin']);
|
||||
$mainLangLoader['admin'] = count($this->languages['en-GB']['admin']);
|
||||
$values[] = array_values($this->languages[$this->langTag]['admin']);
|
||||
$mainLangLoader['admin'] = count($this->languages[$this->langTag]['admin']);
|
||||
}
|
||||
// check the admin system lang is set
|
||||
if ($this->setLangAdminSys())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['adminsys']);
|
||||
$mainLangLoader['adminsys'] = count($this->languages['en-GB']['adminsys']);
|
||||
$values[] = array_values($this->languages[$this->langTag]['adminsys']);
|
||||
$mainLangLoader['adminsys'] = count($this->languages[$this->langTag]['adminsys']);
|
||||
}
|
||||
// check the site lang is set
|
||||
if (!$this->removeSiteFolder && $this->setLangSite())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['site']);
|
||||
$mainLangLoader['site'] = count($this->languages['en-GB']['site']);
|
||||
$values[] = array_values($this->languages[$this->langTag]['site']);
|
||||
$mainLangLoader['site'] = count($this->languages[$this->langTag]['site']);
|
||||
}
|
||||
// check the site system lang is set
|
||||
if (!$this->removeSiteFolder && $this->setLangSiteSys())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['sitesys']);
|
||||
$mainLangLoader['sitesys'] = count($this->languages['en-GB']['sitesys']);
|
||||
$values[] = array_values($this->languages[$this->langTag]['sitesys']);
|
||||
$mainLangLoader['sitesys'] = count($this->languages[$this->langTag]['sitesys']);
|
||||
}
|
||||
$values = array_unique(ComponentbuilderHelper::mergeArrays($values));
|
||||
// get the other lang strings if there is any
|
||||
@ -1196,14 +1117,16 @@ class Infusion extends Interpretation
|
||||
$langXML = array();
|
||||
foreach ($this->languages as $tag => $areas)
|
||||
{
|
||||
// trim the tag
|
||||
$tag = trim($tag);
|
||||
foreach ($areas as $area => $languageStrings)
|
||||
{
|
||||
// only log messages for none en-GB translations
|
||||
if ('en-GB' !== $tag)
|
||||
// only log messages for none $this->langTag translations
|
||||
if ($this->langTag !== $tag)
|
||||
{
|
||||
$langStringNr = count($languageStrings);
|
||||
$langStringSum = bcmul($langStringNr, 100);
|
||||
$percentage = bcdiv($langStringSum, $mainLangLoader[$area]);
|
||||
$langStringSum = $this->bcmath('mul', $langStringNr, 100);
|
||||
$percentage = $this->bcmath('div', $langStringSum, $mainLangLoader[$area]);
|
||||
$stringNAme = ($langStringNr == 1) ? '(string ' . $tag . ' translated)' : '(strings ' . $tag . ' translated)';
|
||||
// force load if debug lines are added
|
||||
if (!$this->debugLinenr)
|
||||
@ -1212,12 +1135,12 @@ class Infusion extends Interpretation
|
||||
if ($percentage < $this->percentageLanguageAdd)
|
||||
{
|
||||
// dont add
|
||||
$this->langNot[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total en-GB strings) only <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
|
||||
$this->langNot[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total '.$this->langTag.' strings) only <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// show if it was added as well
|
||||
$this->langSet[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total en-GB strings) and <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
|
||||
$this->langSet[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total '.$this->langTag.' strings) and <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
|
||||
}
|
||||
// set naming convention
|
||||
$p = 'admin';
|
||||
@ -1249,15 +1172,13 @@ class Infusion extends Interpretation
|
||||
// count the file created
|
||||
$this->fileCount++;
|
||||
// add content to it
|
||||
$lang = '';
|
||||
foreach ($languageStrings as $place => $string)
|
||||
{
|
||||
$lang .= $place . '="' . $string . '"' . PHP_EOL;
|
||||
}
|
||||
$lang = array_map(function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring . '"';
|
||||
}, $languageStrings, array_keys($languageStrings));
|
||||
// add to language file
|
||||
$this->writeFile($path . '/' . $fileName, $lang);
|
||||
$this->writeFile($path . '/' . $fileName, implode(PHP_EOL, $lang));
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + substr_count($lang, PHP_EOL);
|
||||
$this->lineCount = $this->lineCount + count((array)$lang);
|
||||
// build xml strings
|
||||
if (!isset($langXML[$p]))
|
||||
{
|
||||
@ -1289,5 +1210,4 @@ class Infusion extends Interpretation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -277,13 +277,13 @@ class Builder extends Mapping
|
||||
protected function setFieldXML(&$field, $fieldId)
|
||||
{
|
||||
// load the field settings
|
||||
$settings = array();
|
||||
$settings['name'] = $field['name'];
|
||||
$settings['description'] = 'The '.strtolower($field['label']) . ' is set here.';
|
||||
$settings['message'] = "Error! Please add some ".strtolower($field['label'])." here.";
|
||||
$settings['label'] = $field['label'];
|
||||
$settings['default'] = ($field['default'] == 'Other') ? $field['defaultOther'] : $field['default'];
|
||||
$settings['hint'] = $field['label'] .' Here!';
|
||||
$settings = array();
|
||||
$settings['name'] = $field['name'];
|
||||
$settings['description'] = 'The '.strtolower($field['label']) . ' is set here.';
|
||||
$settings['message'] = "Error! Please add some ".strtolower($field['label'])." here.";
|
||||
$settings['label'] = $field['label'];
|
||||
$settings['default'] = ($field['default'] == 'Other') ? $field['defaultOther'] : $field['default'];
|
||||
$settings['hint'] = $field['label'] .' Here!';
|
||||
// okay set the xml field values
|
||||
if ($fieldOptions = ComponentbuilderHelper::getFieldOptions($fieldId, 'id', $settings))
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -412,6 +412,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS="Get Snippets Custom Admin Views Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the custom admin views button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST="Get Snippets Dashboard List"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the Get Snippets"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS="Get Snippets Layouts Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the layouts button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS="Get Snippets Libraries Button Access"
|
||||
@ -420,6 +422,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS="Get Snippets Site Vi
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the site views button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU="Get Snippets Submenu"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU_DESC="Allows the users in this group to update the submenu of the Get Snippets"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS="Get Snippets Templates Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the templates button."
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access"
|
||||
@ -428,8 +432,6 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE="Help Documents Create"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD="Help Documents Dashboard Add"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the help document"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DELETE="Help Documents Delete"
|
||||
@ -478,10 +480,12 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU="Joomla Components Submenu"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the joomla component"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS="Joomla Component Backup Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS_DESC=" Allows the users in this group to access the backup button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Export Components Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export components button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Import Components Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import components button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS="Joomla Component Clone Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS_DESC=" Allows the users in this group to access the clone button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Export JCB Packages Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export jcb packages button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Import JCB Packages Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import jcb packages button."
|
||||
COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to access access languages"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use"
|
||||
@ -504,6 +508,8 @@ COM_COMPONENTBUILDER_LANGUAGES_IMPORT="Languages Import"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_IMPORT_DESC="Allows the users in this group to import import languages"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU="Languages Submenu"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC="Allows the users in this group to update the submenu of the language"
|
||||
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS="Language Build Button Access"
|
||||
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC=" Allows the users in this group to access the build button."
|
||||
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS="Language Translations Access"
|
||||
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC="Allows the users in this group to access access language translations"
|
||||
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE="Language Translations Batch Use"
|
||||
@ -634,6 +640,7 @@ COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
|
||||
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
|
||||
COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets"
|
||||
COM_COMPONENTBUILDER_MENU_TEMPLATES="Templates"
|
||||
COM_COMPONENTBUILDER_MENU_VALIDATION_RULES="Validation Rules"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to access access servers"
|
||||
COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use"
|
||||
@ -696,8 +703,6 @@ COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE="Snippets Batch Use"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_CREATE="Snippets Create"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_CREATE_DESC="Allows the users in this group to create create snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD="Snippets Dashboard Add"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST="Snippets Dashboard List"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_DELETE="Snippets Delete"
|
||||
@ -766,3 +771,27 @@ COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS="Template Get Snippets
|
||||
COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
|
||||
COM_COMPONENTBUILDER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS="Validation Rules Access"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC="Allows the users in this group to access access validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE="Validation Rules Batch Use"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE="Validation Rules Create"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC="Allows the users in this group to create create validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST="Validation Rules Dashboard List"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the validation rule"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE="Validation Rules Delete"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE_DESC="Allows the users in this group to delete delete validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT="Validation Rules Edit"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_DESC="Allows the users in this group to edit the validation rule"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN="Validation Rules Edit Own"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC="Allows the users in this group to edit edit own validation rules created by them"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE="Validation Rules Edit State"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the validation rule"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION="Validation Rules Edit Version"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT="Validation Rules Export"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this group to export export validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC="Allows the users in this group to import import validation rules"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU="Validation Rules Submenu"
|
||||
COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to update the submenu of the validation rule"
|
@ -30,7 +30,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'note_create_edit_notice'
|
||||
'note_create_edit_notice',
|
||||
'alias_builder_type',
|
||||
'note_alias_builder_custom',
|
||||
'note_alias_builder_default',
|
||||
'alias_builder'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
49
admin/layouts/field/data_base_fullwidth.php
Normal file
49
admin/layouts/field/data_base_fullwidth.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage data_base_fullwidth.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'note_no_database_settings_needed',
|
||||
'note_database_settings_needed'
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $form->getLabel($field); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $form->getInput($field); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
@ -13,7 +13,7 @@
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_left.php
|
||||
@subpackage data_base_left.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -30,18 +30,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'fieldtype',
|
||||
'name',
|
||||
'catid',
|
||||
'datatype',
|
||||
'datalenght',
|
||||
'datalenght_other',
|
||||
'datadefault',
|
||||
'datadefault_other',
|
||||
'indexes',
|
||||
'null_switch',
|
||||
'store',
|
||||
'note_whmcs_encryption'
|
||||
'datadefault_other'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
57
admin/layouts/field/data_base_right.php
Normal file
57
admin/layouts/field/data_base_right.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage data_base_right.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'indexes',
|
||||
'null_switch',
|
||||
'store',
|
||||
'note_whmcs_encryption'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = is_array($field) ? $field : array($field);
|
||||
foreach ($field as $f)
|
||||
{
|
||||
if ($form->getField($f))
|
||||
{
|
||||
if (in_array($f, $hiddenFields))
|
||||
{
|
||||
$form->setFieldAttribute($f, 'type', 'hidden');
|
||||
}
|
||||
|
||||
echo $form->renderField($f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
43
admin/layouts/field/set_properties_above.php
Normal file
43
admin/layouts/field/set_properties_above.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage set_properties_above.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = array(
|
||||
'fieldtype',
|
||||
'name',
|
||||
'catid'
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field){
|
||||
echo $form->renderField($field);
|
||||
} ?>
|
||||
</div>
|
@ -13,7 +13,7 @@
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_fullwidth.php
|
||||
@subpackage set_properties_fullwidth.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'xml',
|
||||
'note_select_field_type',
|
||||
'note_filter_information'
|
||||
);
|
||||
|
@ -13,7 +13,7 @@
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_under.php
|
||||
@subpackage set_properties_under.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
49
admin/layouts/field/type_info_fullwidth.php
Normal file
49
admin/layouts/field/type_info_fullwidth.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage type_info_fullwidth.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'helpnote',
|
||||
'xml'
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $form->getLabel($field); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $form->getInput($field); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
@ -61,10 +61,10 @@ $can = ComponentbuilderHelper::getActions('field');
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="all" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'); ?>
|
||||
</th>
|
||||
<th width="10" data-breakpoints="xs sm md">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD_STATUS'); ?>
|
||||
@ -104,6 +104,9 @@ $can = ComponentbuilderHelper::getActions('field');
|
||||
<td>
|
||||
<?php echo JText::_($item->null_switch); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JText::_($item->store); ?>
|
||||
</td>
|
||||
<td class="nowrap">
|
||||
<?php if ($user->authorise('core.edit', 'com_componentbuilder.fields.category.' . (int)$item->catid)): ?>
|
||||
<a href="index.php?option=com_categories&task=category.edit&id=<?php echo (int)$item->catid; ?>&extension=com_componentbuilder.fields"><?php echo $displayData->escape($item->category_title); ?></a>
|
||||
@ -111,9 +114,6 @@ $can = ComponentbuilderHelper::getActions('field');
|
||||
<?php echo $displayData->escape($item->category_title); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JText::_($item->store); ?>
|
||||
</td>
|
||||
<?php if ($item->published == 1):?>
|
||||
<td class="center" data-sort-value="1">
|
||||
<span class="status-metro status-published" title="<?php echo JText::_('COM_COMPONENTBUILDER_PUBLISHED'); ?>">
|
||||
|
@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'entranslation',
|
||||
'source',
|
||||
'translation',
|
||||
'components'
|
||||
);
|
||||
|
41
admin/layouts/validation_rule/extends_formrule_above.php
Normal file
41
admin/layouts/validation_rule/extends_formrule_above.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage extends_formrule_above.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = array(
|
||||
'inherit'
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="form-inline form-inline-header">
|
||||
<?php foreach($fields as $field){
|
||||
echo $form->renderField($field);
|
||||
} ?>
|
||||
</div>
|
48
admin/layouts/validation_rule/extends_formrule_fullwidth.php
Normal file
48
admin/layouts/validation_rule/extends_formrule_fullwidth.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage extends_formrule_fullwidth.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'php'
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $form->getLabel($field); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $form->getInput($field); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
@ -13,7 +13,7 @@
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_right.php
|
||||
@subpackage extends_formrule_left.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'helpnote'
|
||||
'name'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
54
admin/layouts/validation_rule/extends_formrule_right.php
Normal file
54
admin/layouts/validation_rule/extends_formrule_right.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage extends_formrule_right.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'short_description'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = is_array($field) ? $field : array($field);
|
||||
foreach ($field as $f)
|
||||
{
|
||||
if ($form->getField($f))
|
||||
{
|
||||
if (in_array($f, $hiddenFields))
|
||||
{
|
||||
$form->setFieldAttribute($f, 'type', 'hidden');
|
||||
}
|
||||
|
||||
echo $form->renderField($f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
1
admin/layouts/validation_rule/index.html
Normal file
1
admin/layouts/validation_rule/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
58
admin/layouts/validation_rule/publishing.php
Normal file
58
admin/layouts/validation_rule/publishing.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage publishing.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = is_array($field) ? $field : array($field);
|
||||
foreach ($field as $f)
|
||||
{
|
||||
if ($form->getField($f))
|
||||
{
|
||||
if (in_array($f, $hiddenFields))
|
||||
{
|
||||
$form->setFieldAttribute($f, 'type', 'hidden');
|
||||
}
|
||||
|
||||
echo $form->renderField($f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
60
admin/layouts/validation_rule/publlshing.php
Normal file
60
admin/layouts/validation_rule/publlshing.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage publlshing.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = is_array($field) ? $field : array($field);
|
||||
foreach ($field as $f)
|
||||
{
|
||||
if ($form->getField($f))
|
||||
{
|
||||
if (in_array($f, $hiddenFields))
|
||||
{
|
||||
$form->setFieldAttribute($f, 'type', 'hidden');
|
||||
}
|
||||
|
||||
echo $form->renderField($f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -879,9 +879,9 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -869,9 +869,9 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -100,6 +100,210 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->html_import_view))
|
||||
{
|
||||
// base64 Decode html_import_view.
|
||||
$item->html_import_view = base64_decode($item->html_import_view);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_save))
|
||||
{
|
||||
// base64 Decode php_import_save.
|
||||
$item->php_import_save = base64_decode($item->php_import_save);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_headers))
|
||||
{
|
||||
// base64 Decode php_import_headers.
|
||||
$item->php_import_headers = base64_decode($item->php_import_headers);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitem))
|
||||
{
|
||||
// base64 Decode php_getitem.
|
||||
$item->php_getitem = base64_decode($item->php_getitem);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitems))
|
||||
{
|
||||
// base64 Decode php_getitems.
|
||||
$item->php_getitems = base64_decode($item->php_getitems);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitems_after_all))
|
||||
{
|
||||
// base64 Decode php_getitems_after_all.
|
||||
$item->php_getitems_after_all = base64_decode($item->php_getitems_after_all);
|
||||
}
|
||||
|
||||
if (!empty($item->css_view))
|
||||
{
|
||||
// base64 Decode css_view.
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getlistquery))
|
||||
{
|
||||
// base64 Decode php_getlistquery.
|
||||
$item->php_getlistquery = base64_decode($item->php_getlistquery);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_save))
|
||||
{
|
||||
// base64 Decode php_before_save.
|
||||
$item->php_before_save = base64_decode($item->php_before_save);
|
||||
}
|
||||
|
||||
if (!empty($item->css_views))
|
||||
{
|
||||
// base64 Decode css_views.
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
}
|
||||
|
||||
if (!empty($item->php_save))
|
||||
{
|
||||
// base64 Decode php_save.
|
||||
$item->php_save = base64_decode($item->php_save);
|
||||
}
|
||||
|
||||
if (!empty($item->php_postsavehook))
|
||||
{
|
||||
// base64 Decode php_postsavehook.
|
||||
$item->php_postsavehook = base64_decode($item->php_postsavehook);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_view_file))
|
||||
{
|
||||
// base64 Decode javascript_view_file.
|
||||
$item->javascript_view_file = base64_decode($item->javascript_view_file);
|
||||
}
|
||||
|
||||
if (!empty($item->php_allowedit))
|
||||
{
|
||||
// base64 Decode php_allowedit.
|
||||
$item->php_allowedit = base64_decode($item->php_allowedit);
|
||||
}
|
||||
|
||||
if (!empty($item->php_batchcopy))
|
||||
{
|
||||
// base64 Decode php_batchcopy.
|
||||
$item->php_batchcopy = base64_decode($item->php_batchcopy);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_view_footer))
|
||||
{
|
||||
// base64 Decode javascript_view_footer.
|
||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||
}
|
||||
|
||||
if (!empty($item->php_batchmove))
|
||||
{
|
||||
// base64 Decode php_batchmove.
|
||||
$item->php_batchmove = base64_decode($item->php_batchmove);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_publish))
|
||||
{
|
||||
// base64 Decode php_before_publish.
|
||||
$item->php_before_publish = base64_decode($item->php_before_publish);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_views_file))
|
||||
{
|
||||
// base64 Decode javascript_views_file.
|
||||
$item->javascript_views_file = base64_decode($item->javascript_views_file);
|
||||
}
|
||||
|
||||
if (!empty($item->php_after_publish))
|
||||
{
|
||||
// base64 Decode php_after_publish.
|
||||
$item->php_after_publish = base64_decode($item->php_after_publish);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_delete))
|
||||
{
|
||||
// base64 Decode php_before_delete.
|
||||
$item->php_before_delete = base64_decode($item->php_before_delete);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_views_footer))
|
||||
{
|
||||
// base64 Decode javascript_views_footer.
|
||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||
}
|
||||
|
||||
if (!empty($item->php_after_delete))
|
||||
{
|
||||
// base64 Decode php_after_delete.
|
||||
$item->php_after_delete = base64_decode($item->php_after_delete);
|
||||
}
|
||||
|
||||
if (!empty($item->php_document))
|
||||
{
|
||||
// base64 Decode php_document.
|
||||
$item->php_document = base64_decode($item->php_document);
|
||||
}
|
||||
|
||||
if (!empty($item->php_controller))
|
||||
{
|
||||
// base64 Decode php_controller.
|
||||
$item->php_controller = base64_decode($item->php_controller);
|
||||
}
|
||||
|
||||
if (!empty($item->sql))
|
||||
{
|
||||
// base64 Decode sql.
|
||||
$item->sql = base64_decode($item->sql);
|
||||
}
|
||||
|
||||
if (!empty($item->php_model))
|
||||
{
|
||||
// base64 Decode php_model.
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
}
|
||||
|
||||
if (!empty($item->php_controller_list))
|
||||
{
|
||||
// base64 Decode php_controller_list.
|
||||
$item->php_controller_list = base64_decode($item->php_controller_list);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_display))
|
||||
{
|
||||
// base64 Decode php_import_display.
|
||||
$item->php_import_display = base64_decode($item->php_import_display);
|
||||
}
|
||||
|
||||
if (!empty($item->php_model_list))
|
||||
{
|
||||
// base64 Decode php_model_list.
|
||||
$item->php_model_list = base64_decode($item->php_model_list);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import))
|
||||
{
|
||||
// base64 Decode php_import.
|
||||
$item->php_import = base64_decode($item->php_import);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_setdata))
|
||||
{
|
||||
// base64 Decode php_import_setdata.
|
||||
$item->php_import_setdata = base64_decode($item->php_import_setdata);
|
||||
}
|
||||
|
||||
if (!empty($item->php_ajaxmethod))
|
||||
{
|
||||
// base64 Decode php_ajaxmethod.
|
||||
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_ext))
|
||||
{
|
||||
// base64 Decode php_import_ext.
|
||||
$item->php_import_ext = base64_decode($item->php_import_ext);
|
||||
}
|
||||
|
||||
if (!empty($item->addpermissions))
|
||||
{
|
||||
// Convert the addpermissions field to an array.
|
||||
@ -132,6 +336,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$item->addtables = $addtables->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->alias_builder))
|
||||
{
|
||||
// Convert the alias_builder field to an array.
|
||||
$alias_builder = new Registry;
|
||||
$alias_builder->loadString($item->alias_builder);
|
||||
$item->alias_builder = $alias_builder->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->custom_button))
|
||||
{
|
||||
// Convert the custom_button field to an array.
|
||||
@ -148,210 +360,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$item->ajax_input = $ajax_input->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_save))
|
||||
{
|
||||
// base64 Decode php_import_save.
|
||||
$item->php_import_save = base64_decode($item->php_import_save);
|
||||
}
|
||||
|
||||
if (!empty($item->html_import_view))
|
||||
{
|
||||
// base64 Decode html_import_view.
|
||||
$item->html_import_view = base64_decode($item->html_import_view);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_headers))
|
||||
{
|
||||
// base64 Decode php_import_headers.
|
||||
$item->php_import_headers = base64_decode($item->php_import_headers);
|
||||
}
|
||||
|
||||
if (!empty($item->css_view))
|
||||
{
|
||||
// base64 Decode css_view.
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitems))
|
||||
{
|
||||
// base64 Decode php_getitems.
|
||||
$item->php_getitems = base64_decode($item->php_getitems);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitems_after_all))
|
||||
{
|
||||
// base64 Decode php_getitems_after_all.
|
||||
$item->php_getitems_after_all = base64_decode($item->php_getitems_after_all);
|
||||
}
|
||||
|
||||
if (!empty($item->css_views))
|
||||
{
|
||||
// base64 Decode css_views.
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getlistquery))
|
||||
{
|
||||
// base64 Decode php_getlistquery.
|
||||
$item->php_getlistquery = base64_decode($item->php_getlistquery);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_save))
|
||||
{
|
||||
// base64 Decode php_before_save.
|
||||
$item->php_before_save = base64_decode($item->php_before_save);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_view_file))
|
||||
{
|
||||
// base64 Decode javascript_view_file.
|
||||
$item->javascript_view_file = base64_decode($item->javascript_view_file);
|
||||
}
|
||||
|
||||
if (!empty($item->php_save))
|
||||
{
|
||||
// base64 Decode php_save.
|
||||
$item->php_save = base64_decode($item->php_save);
|
||||
}
|
||||
|
||||
if (!empty($item->php_postsavehook))
|
||||
{
|
||||
// base64 Decode php_postsavehook.
|
||||
$item->php_postsavehook = base64_decode($item->php_postsavehook);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_view_footer))
|
||||
{
|
||||
// base64 Decode javascript_view_footer.
|
||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||
}
|
||||
|
||||
if (!empty($item->php_allowedit))
|
||||
{
|
||||
// base64 Decode php_allowedit.
|
||||
$item->php_allowedit = base64_decode($item->php_allowedit);
|
||||
}
|
||||
|
||||
if (!empty($item->php_batchcopy))
|
||||
{
|
||||
// base64 Decode php_batchcopy.
|
||||
$item->php_batchcopy = base64_decode($item->php_batchcopy);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_views_file))
|
||||
{
|
||||
// base64 Decode javascript_views_file.
|
||||
$item->javascript_views_file = base64_decode($item->javascript_views_file);
|
||||
}
|
||||
|
||||
if (!empty($item->php_batchmove))
|
||||
{
|
||||
// base64 Decode php_batchmove.
|
||||
$item->php_batchmove = base64_decode($item->php_batchmove);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_publish))
|
||||
{
|
||||
// base64 Decode php_before_publish.
|
||||
$item->php_before_publish = base64_decode($item->php_before_publish);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_views_footer))
|
||||
{
|
||||
// base64 Decode javascript_views_footer.
|
||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||
}
|
||||
|
||||
if (!empty($item->php_after_publish))
|
||||
{
|
||||
// base64 Decode php_after_publish.
|
||||
$item->php_after_publish = base64_decode($item->php_after_publish);
|
||||
}
|
||||
|
||||
if (!empty($item->php_before_delete))
|
||||
{
|
||||
// base64 Decode php_before_delete.
|
||||
$item->php_before_delete = base64_decode($item->php_before_delete);
|
||||
}
|
||||
|
||||
if (!empty($item->php_after_delete))
|
||||
{
|
||||
// base64 Decode php_after_delete.
|
||||
$item->php_after_delete = base64_decode($item->php_after_delete);
|
||||
}
|
||||
|
||||
if (!empty($item->php_controller))
|
||||
{
|
||||
// base64 Decode php_controller.
|
||||
$item->php_controller = base64_decode($item->php_controller);
|
||||
}
|
||||
|
||||
if (!empty($item->php_document))
|
||||
{
|
||||
// base64 Decode php_document.
|
||||
$item->php_document = base64_decode($item->php_document);
|
||||
}
|
||||
|
||||
if (!empty($item->php_model))
|
||||
{
|
||||
// base64 Decode php_model.
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
}
|
||||
|
||||
if (!empty($item->php_controller_list))
|
||||
{
|
||||
// base64 Decode php_controller_list.
|
||||
$item->php_controller_list = base64_decode($item->php_controller_list);
|
||||
}
|
||||
|
||||
if (!empty($item->sql))
|
||||
{
|
||||
// base64 Decode sql.
|
||||
$item->sql = base64_decode($item->sql);
|
||||
}
|
||||
|
||||
if (!empty($item->php_model_list))
|
||||
{
|
||||
// base64 Decode php_model_list.
|
||||
$item->php_model_list = base64_decode($item->php_model_list);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_display))
|
||||
{
|
||||
// base64 Decode php_import_display.
|
||||
$item->php_import_display = base64_decode($item->php_import_display);
|
||||
}
|
||||
|
||||
if (!empty($item->php_ajaxmethod))
|
||||
{
|
||||
// base64 Decode php_ajaxmethod.
|
||||
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import))
|
||||
{
|
||||
// base64 Decode php_import.
|
||||
$item->php_import = base64_decode($item->php_import);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_setdata))
|
||||
{
|
||||
// base64 Decode php_import_setdata.
|
||||
$item->php_import_setdata = base64_decode($item->php_import_setdata);
|
||||
}
|
||||
|
||||
if (!empty($item->php_import_ext))
|
||||
{
|
||||
// base64 Decode php_import_ext.
|
||||
$item->php_import_ext = base64_decode($item->php_import_ext);
|
||||
}
|
||||
|
||||
if (!empty($item->php_getitem))
|
||||
{
|
||||
// base64 Decode php_getitem.
|
||||
$item->php_getitem = base64_decode($item->php_getitem);
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
@ -1236,6 +1244,19 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['addtables'] = '';
|
||||
}
|
||||
|
||||
// Set the alias_builder items to data.
|
||||
if (isset($data['alias_builder']) && is_array($data['alias_builder']))
|
||||
{
|
||||
$alias_builder = new JRegistry;
|
||||
$alias_builder->loadArray($data['alias_builder']);
|
||||
$data['alias_builder'] = (string) $alias_builder;
|
||||
}
|
||||
elseif (!isset($data['alias_builder']))
|
||||
{
|
||||
// Set the empty alias_builder to data
|
||||
$data['alias_builder'] = '';
|
||||
}
|
||||
|
||||
// Set the custom_button items to data.
|
||||
if (isset($data['custom_button']) && is_array($data['custom_button']))
|
||||
{
|
||||
@ -1262,28 +1283,28 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['ajax_input'] = '';
|
||||
}
|
||||
|
||||
// Set the php_import_save string to base64 string.
|
||||
if (isset($data['php_import_save']))
|
||||
{
|
||||
$data['php_import_save'] = base64_encode($data['php_import_save']);
|
||||
}
|
||||
|
||||
// Set the html_import_view string to base64 string.
|
||||
if (isset($data['html_import_view']))
|
||||
{
|
||||
$data['html_import_view'] = base64_encode($data['html_import_view']);
|
||||
}
|
||||
|
||||
// Set the php_import_save string to base64 string.
|
||||
if (isset($data['php_import_save']))
|
||||
{
|
||||
$data['php_import_save'] = base64_encode($data['php_import_save']);
|
||||
}
|
||||
|
||||
// Set the php_import_headers string to base64 string.
|
||||
if (isset($data['php_import_headers']))
|
||||
{
|
||||
$data['php_import_headers'] = base64_encode($data['php_import_headers']);
|
||||
}
|
||||
|
||||
// Set the css_view string to base64 string.
|
||||
if (isset($data['css_view']))
|
||||
// Set the php_getitem string to base64 string.
|
||||
if (isset($data['php_getitem']))
|
||||
{
|
||||
$data['css_view'] = base64_encode($data['css_view']);
|
||||
$data['php_getitem'] = base64_encode($data['php_getitem']);
|
||||
}
|
||||
|
||||
// Set the php_getitems string to base64 string.
|
||||
@ -1298,10 +1319,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_getitems_after_all'] = base64_encode($data['php_getitems_after_all']);
|
||||
}
|
||||
|
||||
// Set the css_views string to base64 string.
|
||||
if (isset($data['css_views']))
|
||||
// Set the css_view string to base64 string.
|
||||
if (isset($data['css_view']))
|
||||
{
|
||||
$data['css_views'] = base64_encode($data['css_views']);
|
||||
$data['css_view'] = base64_encode($data['css_view']);
|
||||
}
|
||||
|
||||
// Set the php_getlistquery string to base64 string.
|
||||
@ -1316,10 +1337,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_before_save'] = base64_encode($data['php_before_save']);
|
||||
}
|
||||
|
||||
// Set the javascript_view_file string to base64 string.
|
||||
if (isset($data['javascript_view_file']))
|
||||
// Set the css_views string to base64 string.
|
||||
if (isset($data['css_views']))
|
||||
{
|
||||
$data['javascript_view_file'] = base64_encode($data['javascript_view_file']);
|
||||
$data['css_views'] = base64_encode($data['css_views']);
|
||||
}
|
||||
|
||||
// Set the php_save string to base64 string.
|
||||
@ -1334,10 +1355,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_postsavehook'] = base64_encode($data['php_postsavehook']);
|
||||
}
|
||||
|
||||
// Set the javascript_view_footer string to base64 string.
|
||||
if (isset($data['javascript_view_footer']))
|
||||
// Set the javascript_view_file string to base64 string.
|
||||
if (isset($data['javascript_view_file']))
|
||||
{
|
||||
$data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']);
|
||||
$data['javascript_view_file'] = base64_encode($data['javascript_view_file']);
|
||||
}
|
||||
|
||||
// Set the php_allowedit string to base64 string.
|
||||
@ -1352,10 +1373,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_batchcopy'] = base64_encode($data['php_batchcopy']);
|
||||
}
|
||||
|
||||
// Set the javascript_views_file string to base64 string.
|
||||
if (isset($data['javascript_views_file']))
|
||||
// Set the javascript_view_footer string to base64 string.
|
||||
if (isset($data['javascript_view_footer']))
|
||||
{
|
||||
$data['javascript_views_file'] = base64_encode($data['javascript_views_file']);
|
||||
$data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']);
|
||||
}
|
||||
|
||||
// Set the php_batchmove string to base64 string.
|
||||
@ -1370,10 +1391,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_before_publish'] = base64_encode($data['php_before_publish']);
|
||||
}
|
||||
|
||||
// Set the javascript_views_footer string to base64 string.
|
||||
if (isset($data['javascript_views_footer']))
|
||||
// Set the javascript_views_file string to base64 string.
|
||||
if (isset($data['javascript_views_file']))
|
||||
{
|
||||
$data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']);
|
||||
$data['javascript_views_file'] = base64_encode($data['javascript_views_file']);
|
||||
}
|
||||
|
||||
// Set the php_after_publish string to base64 string.
|
||||
@ -1388,22 +1409,34 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_before_delete'] = base64_encode($data['php_before_delete']);
|
||||
}
|
||||
|
||||
// Set the javascript_views_footer string to base64 string.
|
||||
if (isset($data['javascript_views_footer']))
|
||||
{
|
||||
$data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']);
|
||||
}
|
||||
|
||||
// Set the php_after_delete string to base64 string.
|
||||
if (isset($data['php_after_delete']))
|
||||
{
|
||||
$data['php_after_delete'] = base64_encode($data['php_after_delete']);
|
||||
}
|
||||
|
||||
// Set the php_document string to base64 string.
|
||||
if (isset($data['php_document']))
|
||||
{
|
||||
$data['php_document'] = base64_encode($data['php_document']);
|
||||
}
|
||||
|
||||
// Set the php_controller string to base64 string.
|
||||
if (isset($data['php_controller']))
|
||||
{
|
||||
$data['php_controller'] = base64_encode($data['php_controller']);
|
||||
}
|
||||
|
||||
// Set the php_document string to base64 string.
|
||||
if (isset($data['php_document']))
|
||||
// Set the sql string to base64 string.
|
||||
if (isset($data['sql']))
|
||||
{
|
||||
$data['php_document'] = base64_encode($data['php_document']);
|
||||
$data['sql'] = base64_encode($data['sql']);
|
||||
}
|
||||
|
||||
// Set the php_model string to base64 string.
|
||||
@ -1418,28 +1451,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_controller_list'] = base64_encode($data['php_controller_list']);
|
||||
}
|
||||
|
||||
// Set the sql string to base64 string.
|
||||
if (isset($data['sql']))
|
||||
{
|
||||
$data['sql'] = base64_encode($data['sql']);
|
||||
}
|
||||
|
||||
// Set the php_model_list string to base64 string.
|
||||
if (isset($data['php_model_list']))
|
||||
{
|
||||
$data['php_model_list'] = base64_encode($data['php_model_list']);
|
||||
}
|
||||
|
||||
// Set the php_import_display string to base64 string.
|
||||
if (isset($data['php_import_display']))
|
||||
{
|
||||
$data['php_import_display'] = base64_encode($data['php_import_display']);
|
||||
}
|
||||
|
||||
// Set the php_ajaxmethod string to base64 string.
|
||||
if (isset($data['php_ajaxmethod']))
|
||||
// Set the php_model_list string to base64 string.
|
||||
if (isset($data['php_model_list']))
|
||||
{
|
||||
$data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']);
|
||||
$data['php_model_list'] = base64_encode($data['php_model_list']);
|
||||
}
|
||||
|
||||
// Set the php_import string to base64 string.
|
||||
@ -1454,16 +1475,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
$data['php_import_setdata'] = base64_encode($data['php_import_setdata']);
|
||||
}
|
||||
|
||||
// Set the php_ajaxmethod string to base64 string.
|
||||
if (isset($data['php_ajaxmethod']))
|
||||
{
|
||||
$data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']);
|
||||
}
|
||||
|
||||
// Set the php_import_ext string to base64 string.
|
||||
if (isset($data['php_import_ext']))
|
||||
{
|
||||
$data['php_import_ext'] = base64_encode($data['php_import_ext']);
|
||||
}
|
||||
|
||||
// Set the php_getitem string to base64 string.
|
||||
if (isset($data['php_getitem']))
|
||||
{
|
||||
$data['php_getitem'] = base64_encode($data['php_getitem']);
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
|
@ -262,74 +262,74 @@ class ComponentbuilderModelAdmin_views extends JModelList
|
||||
continue;
|
||||
}
|
||||
|
||||
// decode php_import_save
|
||||
$item->php_import_save = base64_decode($item->php_import_save);
|
||||
// decode html_import_view
|
||||
$item->html_import_view = base64_decode($item->html_import_view);
|
||||
// decode php_import_save
|
||||
$item->php_import_save = base64_decode($item->php_import_save);
|
||||
// decode php_import_headers
|
||||
$item->php_import_headers = base64_decode($item->php_import_headers);
|
||||
// decode css_view
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
// decode php_getitem
|
||||
$item->php_getitem = base64_decode($item->php_getitem);
|
||||
// decode php_getitems
|
||||
$item->php_getitems = base64_decode($item->php_getitems);
|
||||
// decode php_getitems_after_all
|
||||
$item->php_getitems_after_all = base64_decode($item->php_getitems_after_all);
|
||||
// decode css_views
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
// decode css_view
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
// decode php_getlistquery
|
||||
$item->php_getlistquery = base64_decode($item->php_getlistquery);
|
||||
// decode php_before_save
|
||||
$item->php_before_save = base64_decode($item->php_before_save);
|
||||
// decode javascript_view_file
|
||||
$item->javascript_view_file = base64_decode($item->javascript_view_file);
|
||||
// decode css_views
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
// decode php_save
|
||||
$item->php_save = base64_decode($item->php_save);
|
||||
// decode php_postsavehook
|
||||
$item->php_postsavehook = base64_decode($item->php_postsavehook);
|
||||
// decode javascript_view_footer
|
||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||
// decode javascript_view_file
|
||||
$item->javascript_view_file = base64_decode($item->javascript_view_file);
|
||||
// decode php_allowedit
|
||||
$item->php_allowedit = base64_decode($item->php_allowedit);
|
||||
// decode php_batchcopy
|
||||
$item->php_batchcopy = base64_decode($item->php_batchcopy);
|
||||
// decode javascript_views_file
|
||||
$item->javascript_views_file = base64_decode($item->javascript_views_file);
|
||||
// decode javascript_view_footer
|
||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||
// decode php_batchmove
|
||||
$item->php_batchmove = base64_decode($item->php_batchmove);
|
||||
// decode php_before_publish
|
||||
$item->php_before_publish = base64_decode($item->php_before_publish);
|
||||
// decode javascript_views_footer
|
||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||
// decode javascript_views_file
|
||||
$item->javascript_views_file = base64_decode($item->javascript_views_file);
|
||||
// decode php_after_publish
|
||||
$item->php_after_publish = base64_decode($item->php_after_publish);
|
||||
// decode php_before_delete
|
||||
$item->php_before_delete = base64_decode($item->php_before_delete);
|
||||
// decode javascript_views_footer
|
||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||
// decode php_after_delete
|
||||
$item->php_after_delete = base64_decode($item->php_after_delete);
|
||||
// decode php_controller
|
||||
$item->php_controller = base64_decode($item->php_controller);
|
||||
// decode php_document
|
||||
$item->php_document = base64_decode($item->php_document);
|
||||
// decode php_controller
|
||||
$item->php_controller = base64_decode($item->php_controller);
|
||||
// decode sql
|
||||
$item->sql = base64_decode($item->sql);
|
||||
// decode php_model
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
// decode php_controller_list
|
||||
$item->php_controller_list = base64_decode($item->php_controller_list);
|
||||
// decode sql
|
||||
$item->sql = base64_decode($item->sql);
|
||||
// decode php_model_list
|
||||
$item->php_model_list = base64_decode($item->php_model_list);
|
||||
// decode php_import_display
|
||||
$item->php_import_display = base64_decode($item->php_import_display);
|
||||
// decode php_ajaxmethod
|
||||
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
|
||||
// decode php_model_list
|
||||
$item->php_model_list = base64_decode($item->php_model_list);
|
||||
// decode php_import
|
||||
$item->php_import = base64_decode($item->php_import);
|
||||
// decode php_import_setdata
|
||||
$item->php_import_setdata = base64_decode($item->php_import_setdata);
|
||||
// decode php_ajaxmethod
|
||||
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
|
||||
// decode php_import_ext
|
||||
$item->php_import_ext = base64_decode($item->php_import_ext);
|
||||
// decode php_getitem
|
||||
$item->php_getitem = base64_decode($item->php_getitem);
|
||||
// unset the values we don't want exported.
|
||||
unset($item->asset_id);
|
||||
unset($item->checked_out);
|
||||
|
@ -116,6 +116,29 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the JCB package info (html)
|
||||
**/
|
||||
public function getJCBpackageInfo($url)
|
||||
{
|
||||
// convert URL
|
||||
$url = str_replace('.zip', '.info', $url);
|
||||
// check if url exist
|
||||
if ($info = ComponentbuilderHelper::getFileContents($url, false))
|
||||
{
|
||||
// Get the encryption object.
|
||||
$opener = new FOFEncryptAes('V4stD3vel0pmEntMethOd@YoUrS3rv!s', 128);
|
||||
$info = rtrim($opener->decryptString($info), "\0");
|
||||
// check if we have json
|
||||
if (ComponentbuilderHelper::checkJson($info))
|
||||
{
|
||||
$info = json_decode($info, true);
|
||||
return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
|
||||
}
|
||||
}
|
||||
return array('error' => JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE'));
|
||||
}
|
||||
|
||||
/**
|
||||
* set the component display
|
||||
**/
|
||||
@ -168,6 +191,19 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
}
|
||||
$result['path'] = '<code>' . $path . '</code>';
|
||||
}
|
||||
elseif ('expand' === $type)
|
||||
{
|
||||
$result['error'] = '<span style="color: red;">' . JText::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . '</span>';
|
||||
if ($this->hasCurl())
|
||||
{
|
||||
$path = '* * * * * curl -s "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = '* * * * * wget "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1';
|
||||
}
|
||||
$result['path'] = '<code>' . $path . '</code>';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -215,6 +251,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'library_files_folders_urls' => 'libraries_files_folders_urls',
|
||||
'admin_fields' => 'admins_fields',
|
||||
'admin_fields_conditions' => 'admins_fields_conditions',
|
||||
'validation_rule' => 'validation_rules',
|
||||
'field' => 'fields',
|
||||
'component_admin_views' => 'components_admin_views' ,
|
||||
'component_site_views' => 'components_site_views',
|
||||
@ -227,7 +264,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'component_files_folders' => 'components_files_folders',
|
||||
'language' => true);
|
||||
|
||||
public function getButton($type)
|
||||
public function getButton($type, $size)
|
||||
{
|
||||
if (isset($this->buttonArray[$type]))
|
||||
{
|
||||
@ -244,18 +281,27 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'];
|
||||
}
|
||||
// build the button
|
||||
$button = '<div class="control-group">
|
||||
<div class="control-label">
|
||||
<label>' . ucwords($type) . '</label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view='.$type.'&layout=edit'.$ref.'\' })" href="javascript:void(0)" >
|
||||
<span class="icon-new icon-white"></span>
|
||||
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
// build url (A tag)
|
||||
$startAtag = '<a class="btn btn-success vdm-button-new" onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view='.$type.'&layout=edit'.$ref.'\' })" href="javascript:void(0)" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', ComponentbuilderHelper::safeString($type, 'W')).'">';
|
||||
// build the smaller button
|
||||
if (2 == $size)
|
||||
{
|
||||
$button = $startAtag.'<span class="icon-new icon-white"></span> ' . JText::_('COM_COMPONENTBUILDER_CREATE') . '</a>';
|
||||
}
|
||||
else
|
||||
// build the big button
|
||||
{
|
||||
$button = '<div class="control-group">
|
||||
<div class="control-label">
|
||||
<label>' . ucwords($type) . '</label>
|
||||
</div>
|
||||
<div class="controls"> '.$startAtag.'
|
||||
<span class="icon-new icon-white"></span>
|
||||
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
// return the button attached to input field
|
||||
return $button;
|
||||
}
|
||||
@ -307,7 +353,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
$button[] = '</div>';
|
||||
$button[] = '<div class="controls">';
|
||||
}
|
||||
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" >';
|
||||
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" title="'.$buttonText.'">';
|
||||
if (1 == $size)
|
||||
{
|
||||
$button[] = '<span class="'.$icon.' icon-white"></span>';
|
||||
@ -335,7 +381,36 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getDynamicScripts($type)
|
||||
public function checkAliasField($type)
|
||||
{
|
||||
// get the view name & id
|
||||
$values = $this->getViewID();
|
||||
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray))
|
||||
{
|
||||
// get the fields
|
||||
if ($fields = ComponentbuilderHelper::getVar('admin_fields', $values['a_id'], 'admin_view', 'addfields'))
|
||||
{
|
||||
// open the fields
|
||||
if (ComponentbuilderHelper::checkJson($fields))
|
||||
{
|
||||
$fields = json_decode($fields, true);
|
||||
if (ComponentbuilderHelper::checkArray($fields))
|
||||
{
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if (isset($field['alias']) && $field['alias'] == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDynamicScripts($type)
|
||||
{
|
||||
// get from global helper
|
||||
return ComponentbuilderHelper::getDynamicScripts($type);
|
||||
@ -348,7 +423,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'type' => 'setURLType',
|
||||
// Admin View
|
||||
'field' => 'setItemNames',
|
||||
'list' => 'setYesNo',
|
||||
'list' => 'setAdminBehaviour',
|
||||
'title' => 'setYesNo',
|
||||
'alias' => 'setYesNo',
|
||||
'sort' => 'setYesNo',
|
||||
@ -394,7 +469,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'update' => JText::_('COM_COMPONENTBUILDER_UPDATE'),
|
||||
// Admin View (fields)
|
||||
'field' => JText::_('COM_COMPONENTBUILDER_FIELD'),
|
||||
'list' => JText::_('COM_COMPONENTBUILDER_ADMIN_LIST'),
|
||||
'list' => JText::_('COM_COMPONENTBUILDER_ADMIN_BEHAVIOUR'),
|
||||
'order_list' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS'),
|
||||
'title' => JText::_('COM_COMPONENTBUILDER_TITLE'),
|
||||
'alias' => JText::_('COM_COMPONENTBUILDER_ALIAS'),
|
||||
@ -408,10 +483,10 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'order_edit' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_EDIT'),
|
||||
// Admin View (conditions)
|
||||
'target_field' => JText::_('COM_COMPONENTBUILDER_TARGET_FIELDS'),
|
||||
'target_behavior' => JText::_('COM_COMPONENTBUILDER_TARGET_BEHAVIOR'),
|
||||
'target_behavior' => JText::_('COM_COMPONENTBUILDER_TARGET_BEHAVIOUR'),
|
||||
'target_relation' => JText::_('COM_COMPONENTBUILDER_TARGET_RELATION'),
|
||||
'match_field' => JText::_('COM_COMPONENTBUILDER_MATCH_FIELD'),
|
||||
'match_behavior' => JText::_('COM_COMPONENTBUILDER_MATCH_BEHAVIOR'),
|
||||
'match_behavior' => JText::_('COM_COMPONENTBUILDER_MATCH_BEHAVIOUR'),
|
||||
'match_options' => JText::_('COM_COMPONENTBUILDER_MATCH_OPTIONS'),
|
||||
// Joomla Component
|
||||
'menu' => JText::_('COM_COMPONENTBUILDER_ADD_MENU'),
|
||||
@ -831,7 +906,8 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
if ($this->canEdit($id, $view))
|
||||
{
|
||||
$edit = "index.php?option=com_componentbuilder&view=".$views."&task=".$view.".edit&id=".$id.$this->ref;
|
||||
return ' <a onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$edit.'\' })" href="javascript:void(0)" class="uk-icon-pencil"></a>';
|
||||
$title = ComponentbuilderHelper::safeString(JText::_('COM_COMPONENTBUILDER_EDIT').' '.$view, 'W');
|
||||
return ' <a onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$edit.'\' })" href="javascript:void(0)" class="uk-icon-pencil" title="'.$title.'"></a>';
|
||||
|
||||
}
|
||||
return '';
|
||||
@ -849,6 +925,22 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return $this->user->authorise($view.'.edit', 'com_componentbuilder.'.$view.'.' . (int) $id);
|
||||
}
|
||||
|
||||
protected function setAdminBehaviour($header, $value)
|
||||
{
|
||||
switch ($value)
|
||||
{
|
||||
case 1:
|
||||
return JText::_('COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW');
|
||||
break;
|
||||
case 2:
|
||||
return JText::_('COM_COMPONENTBUILDER_NONE_DB');
|
||||
break;
|
||||
default:
|
||||
return JText::_('COM_COMPONENTBUILDER_DEFAULT');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected $tabNames = array();
|
||||
|
||||
protected function setTabName($header, $value)
|
||||
@ -1120,8 +1212,12 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
// get the linked to
|
||||
if ($linked = $this->getLinkedTo($values['a_view'], $values['a_id']))
|
||||
{
|
||||
// just return it for now as an unordered list
|
||||
return '<div class="control-group"><ul class="uk-list uk-list-striped"><li>' .implode('</li><li>', $linked) . '</li></ul></div></div>';
|
||||
// just return it for now a table
|
||||
$table = '<div class="control-group"><table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">';
|
||||
$table .= '<caption>'.JText::sprintf('COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED', ComponentbuilderHelper::safeString($values['a_view'], 'w')).'</caption>';
|
||||
$table .= '<thead><tr><th>'.JText::_('COM_COMPONENTBUILDER_TYPE_NAME').'</th></tr></thead>';
|
||||
$table .= '<tbody><tr><td>' .implode('</td></tr><tr><td>', $linked) . '</td></tr></tbody></table></div>';
|
||||
return $table;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1299,66 +1395,92 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
// Used in template
|
||||
public function getTemplateDetails($id)
|
||||
{
|
||||
// set table
|
||||
$table = false;
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.alias','a.template','b.name')));
|
||||
$query->select($db->quoteName(array('a.id','a.alias','a.template','b.name','a.dynamic_get')));
|
||||
$query->from($db->quoteName('#__componentbuilder_template', 'a'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')');
|
||||
$query->where($db->quoteName('a.id') . ' != '.(int) $id);
|
||||
$query->where($db->quoteName('a.published') . ' = 1');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$results = $db->loadObjectList();
|
||||
$templateString = array('<h3>Template Code Snippets</h3><div class="row-fluid form-horizontal-desktop">');
|
||||
$templateString = array();
|
||||
// get the view name & id
|
||||
$values = $this->getViewID();
|
||||
// check if we are in the correct view.
|
||||
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
|
||||
{
|
||||
// set the return ref
|
||||
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'];
|
||||
}
|
||||
foreach ($results as $result)
|
||||
{
|
||||
$templateString[] = "<div>dynamicGet: <b>".$result->name."</b><br /><code><?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?></code></div>";
|
||||
$edit = ($button = $this->addEditLink($result->id, 'template', 'templates')) ? $button : '';
|
||||
$editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && $button = $this->addEditLink($result->dynamic_get, 'dynamic_get', 'dynamic_gets')) ? $button : '';
|
||||
$result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED');
|
||||
$templateString[] = "<td><b>".$result->name."</b> ".$editget."</td><td><code><?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?></code> ".$edit."</td>";
|
||||
}
|
||||
$templateString[] = "</div><hr />";
|
||||
return implode("\n",$templateString);
|
||||
// build the table
|
||||
$table = '<h2>'.JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS').'</h2><div class="uk-scrollable-box"><table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">';
|
||||
$table .= '<caption>'.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'</caption>';
|
||||
$table .= '<thead><tr><th>'.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').'</th><th>'.JText::_('COM_COMPONENTBUILDER_SNIPPET').'</th></thead>';
|
||||
$table .= '<tbody><tr>'.implode("</tr><tr>",$templateString)."</tr></tbody></table></div>";
|
||||
}
|
||||
return false;
|
||||
return $table;
|
||||
}
|
||||
|
||||
// Used in layout
|
||||
public function getLayoutDetails($id)
|
||||
{
|
||||
// set table
|
||||
$table = false;
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.alias','a.layout','b.getcustom','b.gettype','b.name')));
|
||||
$query->select($db->quoteName(array('a.id','a.alias','a.layout','b.getcustom','b.gettype','b.name','a.dynamic_get')));
|
||||
$query->from($db->quoteName('#__componentbuilder_layout', 'a'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')');
|
||||
$query->where($db->quoteName('a.id') . ' != '.(int) $id);
|
||||
$query->where($db->quoteName('a.published') . ' = 1');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$results = $db->loadObjectList();
|
||||
$layoutString = array('<h3>Layout Code Snippets</h3><div class="row-fluid form-horizontal-desktop">');
|
||||
$layoutString = array();
|
||||
// get the view name & id
|
||||
$values = $this->getViewID();
|
||||
// check if we are in the correct view.
|
||||
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
|
||||
{
|
||||
// set the return ref
|
||||
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'];
|
||||
}
|
||||
foreach ($results as $result)
|
||||
{
|
||||
$edit = ($button = $this->addEditLink($result->id, 'layout', 'layouts')) ? $button : '';
|
||||
$editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && $button = $this->addEditLink($result->dynamic_get, 'dynamic_get', 'dynamic_gets')) ? $button : '';
|
||||
$result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED');
|
||||
|
||||
switch ($result->gettype)
|
||||
{
|
||||
case 1:
|
||||
// single
|
||||
$layoutString[] = "<div>dynamicGet: <b>".$result->name."</b><br /><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->item); ?></code></div>";
|
||||
$layoutString[] = "<td><b>".$result->name."</b> ".$editget."</td><td><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->item); ?></code> ".$edit."</td>";
|
||||
break;
|
||||
case 2:
|
||||
// list
|
||||
$layoutString[] = "<div>dynamicGet: <b>".$result->name."</b><br /><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->items); ?></code></div>";
|
||||
$layoutString[] = "<td><b>".$result->name."</b> ".$editget."</td><td><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->items); ?></code> ".$edit."</td>";
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
@ -1372,14 +1494,17 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
{
|
||||
$varName = $result->getcustom;
|
||||
}
|
||||
$layoutString[] = "<div>dynamicGet: <b>".$result->name."</b><br /><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->".$varName."); ?></code></div>";
|
||||
$layoutString[] = "<td><b>".$result->name."</b> ".$editget."</td><td><code><?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->".$varName."); ?></code> ".$edit."</td>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$layoutString[] = "</div><hr />";
|
||||
return implode("\n",$layoutString);
|
||||
// build the table
|
||||
$table = '<h2>'.JText::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS').'</h2><div class="uk-scrollable-box"><table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">';
|
||||
$table .= '<caption>'.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'</caption>';
|
||||
$table .= '<thead><tr><th>'.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').'</th><th>'.JText::_('COM_COMPONENTBUILDER_SNIPPET').'</th></thead>';
|
||||
$table .= '<tbody><tr>'.implode("</tr><tr>",$layoutString)."</tr></tbody></table></div>";
|
||||
}
|
||||
return false;
|
||||
return $table;
|
||||
}
|
||||
|
||||
// Used in dynamic_get
|
||||
@ -2029,15 +2154,405 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return false;
|
||||
}
|
||||
|
||||
// Used in field
|
||||
public function getFieldOptions($id)
|
||||
// Used in validation_rule
|
||||
public function getExistingValidationRuleCode($name)
|
||||
{
|
||||
if ($field = ComponentbuilderHelper::getFieldOptions($id, 'id'))
|
||||
// make sure we have all the exiting rule names
|
||||
if ($names = ComponentbuilderHelper::getExistingValidationRuleNames())
|
||||
{
|
||||
// check that this is a valid rule file
|
||||
if (ComponentbuilderHelper::checkArray($names) && in_array($name, $names))
|
||||
{
|
||||
// get the full path to rule file
|
||||
$path = JPATH_LIBRARIES . '/src/Form/Rule/'.$name.'Rule.php';
|
||||
// get all the code
|
||||
if ($code = ComponentbuilderHelper::getFileContents($path))
|
||||
{
|
||||
// remove the class details and the ending }
|
||||
$codeArray = (array) explode("FormRule\n{\n", $code);
|
||||
if (isset($codeArray[1]))
|
||||
{
|
||||
return array('values' => rtrim(rtrim(rtrim($codeArray[1]),'}')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkRuleName($name, $id)
|
||||
{
|
||||
$name = ComponentbuilderHelper::safeString($name);
|
||||
if ($found = ComponentbuilderHelper::getVar('validation_rule', $name, 'name', 'id'))
|
||||
{
|
||||
if ((int) $id !== (int) $found)
|
||||
{
|
||||
return array (
|
||||
'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM', $name),
|
||||
'status' => 'danger',
|
||||
'timeout' => 6000);
|
||||
}
|
||||
}
|
||||
// now check the existing once
|
||||
if ($names = ComponentbuilderHelper::getExistingValidationRuleNames(true))
|
||||
{
|
||||
if (in_array($name, $names))
|
||||
{
|
||||
return array (
|
||||
'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME', $name),
|
||||
'status' => 'danger',
|
||||
'timeout' => 10000);
|
||||
}
|
||||
}
|
||||
return array (
|
||||
'name' => $name,
|
||||
'message' => JText::sprintf('COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK', $name),
|
||||
'status' => 'success',
|
||||
'timeout' => 5000);
|
||||
}
|
||||
|
||||
public function getValidationRulesTable($id)
|
||||
{
|
||||
// get all the validation rules
|
||||
if ($rules = $this->getValidationRules())
|
||||
{
|
||||
// build table
|
||||
$table = '<div class="control-group"><table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">';
|
||||
$table .= '<caption>'.JText::sprintf('COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE').'</caption>';
|
||||
$table .= '<thead><tr><th class="uk-text-right">'.JText::_('COM_COMPONENTBUILDER_VALIDATE').'</th><th>'.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').'</th></tr></thead>';
|
||||
$table .= '<tbody>';
|
||||
foreach ($rules as $name => $decs)
|
||||
{
|
||||
// just load the values
|
||||
$decs = (ComponentbuilderHelper::checkString($decs) && !is_numeric($decs)) ? $decs : '';
|
||||
$table .= '<tr><td class="uk-text-right"><code>'.$name.'</code></td><td>'. $decs. '</td></tr>';
|
||||
}
|
||||
return $table.'</tbody></table></div>';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getValidationRules()
|
||||
{
|
||||
// custom rule names
|
||||
$names = array();
|
||||
// make sure we have all the exiting rule names
|
||||
if (!$exitingNames = ComponentbuilderHelper::getExistingValidationRuleNames(true))
|
||||
{
|
||||
// stop (something is wrong)
|
||||
return false;
|
||||
}
|
||||
// convert names to keys
|
||||
$exitingNames = array_flip($exitingNames);
|
||||
// load the descriptions (taken from https://docs.joomla.org/Server-side_form_validation)
|
||||
$exitingNames["boolean"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE");
|
||||
$exitingNames["color"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES");
|
||||
$exitingNames["email"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS");
|
||||
$exitingNames["equals"] = JText::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '<br /><code><input<br /> type="text"<br /> name="email_check"<br /> validate="equals"<br /> field="email"<br />/></code>');
|
||||
$exitingNames["options"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST");
|
||||
$exitingNames["tel"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE");
|
||||
$exitingNames["url"] = JText::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '<br /><code><input<br /> type="text"<br /> name="link"<br /> validate="url"<br /> scheme="http,https,mailto"<br />/></code>');
|
||||
$exitingNames["username"] = JText::_("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME");
|
||||
// now get the custom created rules
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.name','a.short_description')));
|
||||
$query->from($db->quoteName('#__componentbuilder_validation_rule','a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$names = $db->loadAssocList('name', 'short_description');
|
||||
}
|
||||
// merge the arrays
|
||||
$rules = ComponentbuilderHelper::mergeArrays(array($exitingNames, $names));
|
||||
// sort the array
|
||||
ksort($rules);
|
||||
// return the validation rules
|
||||
return $rules;
|
||||
}
|
||||
|
||||
// Used in field
|
||||
// the current extras available
|
||||
protected $extraFieldProperties = array(
|
||||
'listclass' => 'COM_COMPONENTBUILDER_SET_A_CLASS_VALUE_FOR_THE_LIST_VIEW_OF_THIS_FIELD',
|
||||
'escape' => 'COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW',
|
||||
'display' => 'COM_COMPONENTBUILDER_DISPLAY_SWITCH_FOR_DYNAMIC_PLACEMENT_IN_RELATION_TO_THE_USE_OF_THE_FIELD_IN_MENU_AND_GLOBAL_CONFIGURATION_OPTIONS_SO_THE_CONFIG_OPTION_WILL_ONLY_ADD_THE_FIELD_TO_THE_GLOBAL_CONFIGURATION_AREA_MENU_WILL_ADD_THE_FIELD_ONLY_TO_THE_MENU_AREA',
|
||||
'validate' => 'COM_COMPONENTBUILDER_TO_ADD_VALIDATION_TO_A_FIELD_IF_VALIDATION_IS_NOT_PART_OF_FIELD_TYPE_PROPERTIES_LOADED_ABOVE_SO_IF_YOU_HAVE_VALIDATION_SET_AS_A_FIELD_PROPERTY_THIS_EXTRA_PROPERTY_WILL_NOT_BE_NEEDED');
|
||||
|
||||
public function getFieldOptions($fieldtype)
|
||||
{
|
||||
// get the xml
|
||||
$xml = $this->getFieldXML($fieldtype);
|
||||
// now get the field options
|
||||
if ($field = ComponentbuilderHelper::getFieldOptions($fieldtype, 'id', null, $xml))
|
||||
{
|
||||
// get subform field properties object
|
||||
$properties = $this->buildFieldOptionsSubform($field['subform'], $field['nameListOptions']);
|
||||
// load the extra options
|
||||
$extraValues = $this->getFieldExtraValues($xml, $field['nameListOptions']);
|
||||
// set the nameListOption
|
||||
$extraNameListOption = $this->extraFieldProperties;
|
||||
array_walk($extraNameListOption, function (&$value, $key) {
|
||||
$value = $key;
|
||||
});
|
||||
// get subform field object
|
||||
$extras = $this->buildFieldOptionsSubform($extraValues, $extraNameListOption, 'extraproperties', 'COM_COMPONENTBUILDER_EXTRA_PROPERTIES_LIKE_LISTCLASS_ESCAPE_DISPLAY_VALIDATEBR_SMALLHERE_YOU_CAN_SET_THE_EXTRA_PROPERTIES_FOR_THIS_FIELDSMALL');
|
||||
// load the html
|
||||
$field['subform'] = '<div class="control-label prop_removal">'. $properties->label . '</div><div class="controls prop_removal">' . $properties->input . '</div>';
|
||||
$field['extra'] = '<div class="control-label prop_removal">'. $extras->label . '</div><div class="controls prop_removal">' . $extras->input . '</div>';
|
||||
// check if we have PHP values
|
||||
if (ComponentbuilderHelper::checkArray($field['php']))
|
||||
{
|
||||
$field['textarea'] = array();
|
||||
foreach($field['php'] as $name => $values)
|
||||
{
|
||||
$value = implode(PHP_EOL, $values['value']);
|
||||
$textarea = $this->buildFieldTexteara($name, $values['desc'], $value, substr_count( $value, PHP_EOL ));
|
||||
// load the html
|
||||
$field['textarea'][] = '<div class="control-label prop_removal">'. $textarea->label . '</div><div class="controls prop_removal">' . $textarea->input . '</div><br />';
|
||||
}
|
||||
}
|
||||
// remove some unneeded values
|
||||
unset($field['values']);
|
||||
// return found field options
|
||||
return $field;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getFieldExtraValues($xml, $options)
|
||||
{
|
||||
// get the value
|
||||
$values = array();
|
||||
// value to check since there are false and null values even 0 in the values returned
|
||||
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
|
||||
$nr = 0;
|
||||
foreach ($this->extraFieldProperties as $extra => $desc)
|
||||
{
|
||||
if (!in_array($extra, $options))
|
||||
{
|
||||
$value = ComponentbuilderHelper::getValueFromXMLstring($xml, $extra, $confirmation);
|
||||
if ($confirmation !== $value)
|
||||
{
|
||||
$values['extraproperties' . $nr] = array('name' => $extra, 'value' => $value, 'desc' => JText::_($desc));
|
||||
$nr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// return only if extras founb
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
return $values;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function buildFieldTexteara($name, $desc, $default, $rows)
|
||||
{
|
||||
// get the textarea
|
||||
$textarea = JFormHelper::loadFieldType('textarea', true);
|
||||
// start building the name field XML
|
||||
$textareaXML = new SimpleXMLElement('<field/>');
|
||||
// textarea attributes
|
||||
$textareaAttribute = array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'property_'.$name,
|
||||
'label' => $desc,
|
||||
'rows' => (int) ($rows >= 3) ? $rows : $rows + 2,
|
||||
'cols' => '15',
|
||||
'class' => 'text_area span12',
|
||||
'filter' => 'RAW',
|
||||
'hint' => 'COM_COMPONENTBUILDER__ADD_YOUR_PHP_SCRIPT_HERE');
|
||||
// load the textarea attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($textareaXML, $textareaAttribute);
|
||||
|
||||
// setup subform with values
|
||||
$textarea->setup($textareaXML, $default);
|
||||
|
||||
// return textarea object
|
||||
return $textarea;
|
||||
}
|
||||
|
||||
protected function buildFieldOptionsSubform($values, $nameListOptions = null, $name = 'properties', $label = 'COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL')
|
||||
{
|
||||
// get the subform
|
||||
$subform = JFormHelper::loadFieldType('subform', true);
|
||||
// start building the subform field XML
|
||||
$subformXML = new SimpleXMLElement('<field/>');
|
||||
// subform attributes
|
||||
$subformAttribute = array(
|
||||
'type' => 'subform',
|
||||
'name' => $name,
|
||||
'label' => $label,
|
||||
'layout' => 'joomla.form.field.subform.repeatable-table',
|
||||
'multiple' => 'true',
|
||||
'icon' => 'list',
|
||||
'max' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? (int) count($nameListOptions) : 4);
|
||||
// load the subform attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($subformXML, $subformAttribute);
|
||||
// now add the subform child form
|
||||
$childForm = $subformXML->addChild('form');
|
||||
// child form attributes
|
||||
$childFormAttribute = array(
|
||||
'hidden' => 'true',
|
||||
'name' => 'list_properties',
|
||||
'repeat' => 'true');
|
||||
// load the child form attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($childForm, $childFormAttribute);
|
||||
|
||||
// start building the name field XML
|
||||
$nameXML = new SimpleXMLElement('<field/>');
|
||||
// subform attributes
|
||||
$nameAttribute = array(
|
||||
'type' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? 'list' : 'text',
|
||||
'name' => 'name',
|
||||
'label' => 'COM_COMPONENTBUILDER_PROPERTY',
|
||||
'size' => '40',
|
||||
'maxlength' => '150',
|
||||
'class' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? 'list_class field_list_name_options' : 'text_area',
|
||||
'filter' => 'STRING');
|
||||
// add the hint only if not name list and description if name list is an array
|
||||
if (ComponentbuilderHelper::checkArray($nameListOptions))
|
||||
{
|
||||
$nameAttribute['description'] = 'COM_COMPONENTBUILDER_SELECTION';
|
||||
$nameAttribute['multiple'] = 'false';
|
||||
$nameAttribute['onchange'] = "getFieldPropertyDesc(this, '".$name."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$nameAttribute['hint'] = 'COM_COMPONENTBUILDER_PROPERTY_NAME';
|
||||
}
|
||||
// load the subform attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute);
|
||||
// add name list if found
|
||||
if (ComponentbuilderHelper::checkArray($nameListOptions))
|
||||
{
|
||||
ComponentbuilderHelper::xmlAddOptions($nameXML, $nameListOptions);
|
||||
}
|
||||
// now add the fields to the child form
|
||||
ComponentbuilderHelper::xmlAppend($childForm, $nameXML);
|
||||
|
||||
// start building the name field XML
|
||||
$valueXML = new SimpleXMLElement('<field/>');
|
||||
// subform attributes
|
||||
$valueAttribute = array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'value',
|
||||
'label' => 'COM_COMPONENTBUILDER_VALUE',
|
||||
'rows' => '1',
|
||||
'cols' => '15',
|
||||
'class' => 'text_area span12',
|
||||
'filter' => 'STRING',
|
||||
'hint' => 'COM_COMPONENTBUILDER_PROPERTY_VALUE');
|
||||
// load the subform attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($valueXML, $valueAttribute);
|
||||
// now add the fields to the child form
|
||||
ComponentbuilderHelper::xmlAppend($childForm, $valueXML);
|
||||
|
||||
// start building the desc field XML
|
||||
$descXML = new SimpleXMLElement('<field/>');
|
||||
// subform attributes
|
||||
$descAttribute = array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'desc',
|
||||
'label' => 'COM_COMPONENTBUILDER_DESCRIPTION',
|
||||
'rows' => '3',
|
||||
'cols' => '25',
|
||||
'readonly' => 'true',
|
||||
'class' => 'text_area span12',
|
||||
'filter' => 'WORD',
|
||||
'hint' => 'COM_COMPONENTBUILDER_SELECT_A_PROPERTY');
|
||||
// load the desc attributes
|
||||
ComponentbuilderHelper::xmlAddAttributes($descXML, $descAttribute);
|
||||
// now add the fields to the child form
|
||||
ComponentbuilderHelper::xmlAppend($childForm, $descXML);
|
||||
|
||||
// setup subform with values
|
||||
$subform->setup($subformXML, $values);
|
||||
|
||||
// return subfrom object
|
||||
return $subform;
|
||||
}
|
||||
|
||||
public function getFieldPropertyDesc($_property, $fieldtype)
|
||||
{
|
||||
if (is_numeric($fieldtype))
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('properties', 'short_description', 'description')));
|
||||
$query->from($db->quoteName('#__componentbuilder_fieldtype'));
|
||||
$query->where($db->quoteName('id') . ' = '. (int) $fieldtype);
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// get the result
|
||||
$result = $db->loadObject();
|
||||
// get the xml
|
||||
$xml = $this->getFieldXML($fieldtype);
|
||||
// open the properties
|
||||
$properties = json_decode($result->properties,true);
|
||||
// value to check since there are false and null values even 0 in the values returned
|
||||
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
|
||||
// make sure we have an array
|
||||
if (ComponentbuilderHelper::checkArray($properties))
|
||||
{
|
||||
foreach ($properties as $property)
|
||||
{
|
||||
if(isset($property['name']) && $_property === $property['name'])
|
||||
{
|
||||
// check if we should load the value
|
||||
$value = ComponentbuilderHelper::getValueFromXMLstring($xml, $property['name'], $confirmation);
|
||||
if ($confirmation === $value)
|
||||
{
|
||||
$value = (isset($property['example']) && ComponentbuilderHelper::checkString($property['example'])) ? $property['example'] : '';
|
||||
}
|
||||
// return the found values
|
||||
return array('value' => $value, 'desc' => $property['description']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($this->extraFieldProperties[$_property]))
|
||||
{
|
||||
return array('value' => '', 'desc' => JText::_($this->extraFieldProperties[$_property]));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getFieldXML($fieldtype)
|
||||
{
|
||||
// reset xml to null
|
||||
$xml = null;
|
||||
// get the view name & id
|
||||
$global = $this->getViewID();
|
||||
// get the xml if this view already has it set
|
||||
if (!is_null($global['a_id']) && $global['a_id'] > 0 && isset($global['a_view']) && 'field' === $global['a_view'])
|
||||
{
|
||||
// first check field type
|
||||
$_fieldType = ComponentbuilderHelper::getVar('field', $global['a_id'], 'id', 'fieldtype');
|
||||
// only continue if field type is the same
|
||||
if ($fieldtype == $_fieldType)
|
||||
{
|
||||
$xmlDB = ComponentbuilderHelper::getVar('field', $global['a_id'], 'id', 'xml');
|
||||
// check if it is a string
|
||||
if (ComponentbuilderHelper::checkString($xmlDB))
|
||||
{
|
||||
$xml = json_decode($xmlDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
|
||||
// Used in get_snippets
|
||||
|
@ -151,7 +151,7 @@ class ComponentbuilderModelCompiler extends JModelList
|
||||
}
|
||||
|
||||
public $compiler;
|
||||
|
||||
|
||||
public function getComponents()
|
||||
{
|
||||
// Get a db connection.
|
||||
@ -169,17 +169,18 @@ class ComponentbuilderModelCompiler extends JModelList
|
||||
// return the result
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
public function builder($version, $id, $backup, $repo, $addPlaceholders, $debugLinenr)
|
||||
{
|
||||
$set['joomlaVersion'] = $version;
|
||||
$set['componentId'] = $id;
|
||||
$set['addBackup'] = $backup;
|
||||
$set['addRepo'] = $repo;
|
||||
$set['addPlaceholders'] = $addPlaceholders;
|
||||
$set['debugLinenr'] = $debugLinenr;
|
||||
|
||||
public function builder($version, $id, $backup, $repo, $addPlaceholders, $debugLinenr, $minify)
|
||||
{
|
||||
$set['version'] = $version;
|
||||
$set['component'] = $id;
|
||||
$set['backup'] = $backup;
|
||||
$set['repository'] = $repo;
|
||||
$set['placeholders'] = $addPlaceholders;
|
||||
$set['debuglinenr'] = $debugLinenr;
|
||||
$set['minify'] = $minify;
|
||||
// start up Compiler
|
||||
$this->compiler = new Compiler($set);
|
||||
$this->compiler = new Compiler($set);
|
||||
if($this->compiler)
|
||||
{
|
||||
return true;
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -95,6 +95,12 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->php_dashboard_methods))
|
||||
{
|
||||
// base64 Decode php_dashboard_methods.
|
||||
$item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
|
||||
}
|
||||
|
||||
if (!empty($item->dashboard_tab))
|
||||
{
|
||||
// Convert the dashboard_tab field to an array.
|
||||
@ -103,12 +109,6 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
|
||||
$item->dashboard_tab = $dashboard_tab->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->php_dashboard_methods))
|
||||
{
|
||||
// base64 Decode php_dashboard_methods.
|
||||
$item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
|
||||
}
|
||||
|
||||
// update the fields
|
||||
$objectUpdate = new stdClass();
|
||||
$objectUpdate->id = (int) $item->id;
|
||||
@ -892,9 +892,9 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -944,9 +944,9 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -43,12 +43,14 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
$icons = array();
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents')
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_documents')
|
||||
);
|
||||
// view access array
|
||||
$viewAccess = array(
|
||||
'compiler.submenu' => 'compiler.submenu',
|
||||
'compiler.dashboard_list' => 'compiler.dashboard_list',
|
||||
'get_snippets.submenu' => 'get_snippets.submenu',
|
||||
'get_snippets.dashboard_list' => 'get_snippets.dashboard_list',
|
||||
'joomla_component.create' => 'joomla_component.create',
|
||||
'joomla_components.access' => 'joomla_component.access',
|
||||
'joomla_component.access' => 'joomla_component.access',
|
||||
@ -101,7 +103,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'snippet.access' => 'snippet.access',
|
||||
'snippets.submenu' => 'snippet.submenu',
|
||||
'snippets.dashboard_list' => 'snippet.dashboard_list',
|
||||
'snippet.dashboard_add' => 'snippet.dashboard_add',
|
||||
'validation_rule.create' => 'validation_rule.create',
|
||||
'validation_rules.access' => 'validation_rule.access',
|
||||
'validation_rule.access' => 'validation_rule.access',
|
||||
'validation_rules.submenu' => 'validation_rule.submenu',
|
||||
'validation_rules.dashboard_list' => 'validation_rule.dashboard_list',
|
||||
'field.create' => 'field.create',
|
||||
'fields.access' => 'field.access',
|
||||
'field.access' => 'field.access',
|
||||
@ -133,7 +139,6 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'help_document.access' => 'help_document.access',
|
||||
'help_documents.submenu' => 'help_document.submenu',
|
||||
'help_documents.dashboard_list' => 'help_document.dashboard_list',
|
||||
'help_document.dashboard_add' => 'help_document.dashboard_add',
|
||||
'admin_fields.create' => 'admin_fields.create',
|
||||
'admins_fields.access' => 'admin_fields.access',
|
||||
'admin_fields.access' => 'admin_fields.access',
|
||||
|
@ -100,38 +100,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->ajax_input))
|
||||
{
|
||||
// Convert the ajax_input field to an array.
|
||||
$ajax_input = new Registry;
|
||||
$ajax_input->loadString($item->ajax_input);
|
||||
$item->ajax_input = $ajax_input->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->libraries))
|
||||
{
|
||||
// Convert the libraries field to an array.
|
||||
$libraries = new Registry;
|
||||
$libraries->loadString($item->libraries);
|
||||
$item->libraries = $libraries->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->custom_get))
|
||||
{
|
||||
// Convert the custom_get field to an array.
|
||||
$custom_get = new Registry;
|
||||
$custom_get->loadString($item->custom_get);
|
||||
$item->custom_get = $custom_get->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->custom_button))
|
||||
{
|
||||
// Convert the custom_button field to an array.
|
||||
$custom_button = new Registry;
|
||||
$custom_button->loadString($item->custom_button);
|
||||
$item->custom_button = $custom_button->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->php_jview_display))
|
||||
{
|
||||
// base64 Decode php_jview_display.
|
||||
@ -204,6 +172,38 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
}
|
||||
|
||||
if (!empty($item->ajax_input))
|
||||
{
|
||||
// Convert the ajax_input field to an array.
|
||||
$ajax_input = new Registry;
|
||||
$ajax_input->loadString($item->ajax_input);
|
||||
$item->ajax_input = $ajax_input->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->libraries))
|
||||
{
|
||||
// Convert the libraries field to an array.
|
||||
$libraries = new Registry;
|
||||
$libraries->loadString($item->libraries);
|
||||
$item->libraries = $libraries->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->custom_get))
|
||||
{
|
||||
// Convert the custom_get field to an array.
|
||||
$custom_get = new Registry;
|
||||
$custom_get->loadString($item->custom_get);
|
||||
$item->custom_get = $custom_get->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->custom_button))
|
||||
{
|
||||
// Convert the custom_button field to an array.
|
||||
$custom_button = new Registry;
|
||||
$custom_button->loadString($item->custom_button);
|
||||
$item->custom_button = $custom_button->toArray();
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
@ -1140,9 +1140,9 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -876,9 +876,9 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -100,54 +100,6 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->filter))
|
||||
{
|
||||
// Convert the filter field to an array.
|
||||
$filter = new Registry;
|
||||
$filter->loadString($item->filter);
|
||||
$item->filter = $filter->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->where))
|
||||
{
|
||||
// Convert the where field to an array.
|
||||
$where = new Registry;
|
||||
$where->loadString($item->where);
|
||||
$item->where = $where->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->order))
|
||||
{
|
||||
// Convert the order field to an array.
|
||||
$order = new Registry;
|
||||
$order->loadString($item->order);
|
||||
$item->order = $order->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->global))
|
||||
{
|
||||
// Convert the global field to an array.
|
||||
$global = new Registry;
|
||||
$global->loadString($item->global);
|
||||
$item->global = $global->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->join_view_table))
|
||||
{
|
||||
// Convert the join_view_table field to an array.
|
||||
$join_view_table = new Registry;
|
||||
$join_view_table->loadString($item->join_view_table);
|
||||
$item->join_view_table = $join_view_table->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->join_db_table))
|
||||
{
|
||||
// Convert the join_db_table field to an array.
|
||||
$join_db_table = new Registry;
|
||||
$join_db_table->loadString($item->join_db_table);
|
||||
$item->join_db_table = $join_db_table->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->php_custom_get))
|
||||
{
|
||||
// base64 Decode php_custom_get.
|
||||
@ -196,6 +148,54 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
|
||||
$item->php_calculation = base64_decode($item->php_calculation);
|
||||
}
|
||||
|
||||
if (!empty($item->filter))
|
||||
{
|
||||
// Convert the filter field to an array.
|
||||
$filter = new Registry;
|
||||
$filter->loadString($item->filter);
|
||||
$item->filter = $filter->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->where))
|
||||
{
|
||||
// Convert the where field to an array.
|
||||
$where = new Registry;
|
||||
$where->loadString($item->where);
|
||||
$item->where = $where->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->order))
|
||||
{
|
||||
// Convert the order field to an array.
|
||||
$order = new Registry;
|
||||
$order->loadString($item->order);
|
||||
$item->order = $order->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->global))
|
||||
{
|
||||
// Convert the global field to an array.
|
||||
$global = new Registry;
|
||||
$global->loadString($item->global);
|
||||
$item->global = $global->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->join_view_table))
|
||||
{
|
||||
// Convert the join_view_table field to an array.
|
||||
$join_view_table = new Registry;
|
||||
$join_view_table->loadString($item->join_view_table);
|
||||
$item->join_view_table = $join_view_table->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->join_db_table))
|
||||
{
|
||||
// Convert the join_db_table field to an array.
|
||||
$join_db_table = new Registry;
|
||||
$join_db_table->loadString($item->join_db_table);
|
||||
$item->join_db_table = $join_db_table->toArray();
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
@ -1146,9 +1146,9 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -100,10 +100,10 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->xml))
|
||||
if (!empty($item->css_views))
|
||||
{
|
||||
// JSON Decode xml.
|
||||
$item->xml = json_decode($item->xml);
|
||||
// base64 Decode css_views.
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
}
|
||||
|
||||
if (!empty($item->css_view))
|
||||
@ -112,12 +112,6 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
}
|
||||
|
||||
if (!empty($item->css_views))
|
||||
{
|
||||
// base64 Decode css_views.
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
}
|
||||
|
||||
if (!empty($item->javascript_view_footer))
|
||||
{
|
||||
// base64 Decode javascript_view_footer.
|
||||
@ -130,6 +124,12 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
|
||||
}
|
||||
|
||||
if (!empty($item->xml))
|
||||
{
|
||||
// JSON Decode xml.
|
||||
$item->xml = json_decode($item->xml);
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
@ -889,24 +889,89 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// get the properties
|
||||
$properties = $input->get('properties', null, 'ARRAY');
|
||||
// get the extra properties
|
||||
$extraproperties = $input->get('extraproperties', null, 'ARRAY');
|
||||
// get the type phpx property
|
||||
$typephpx = $input->get('property_type_phpx', null, 'RAW');
|
||||
// get the type php property
|
||||
$typephp = $input->get('property_type_php', null, 'RAW');
|
||||
// make sure we have an array
|
||||
if (ComponentbuilderHelper::checkArray($properties))
|
||||
{
|
||||
// set the bucket
|
||||
$bucket = array();
|
||||
foreach($properties as $property)
|
||||
{
|
||||
// make sure we have the correct values
|
||||
if (ComponentbuilderHelper::checkArray($property) && isset($property['name']) && ComponentbuilderHelper::checkString($property['name']) && isset($property['value']))
|
||||
{
|
||||
// fix the name (TODO)
|
||||
// $property['name'] = ComponentbuilderHelper::safeString($property['name']);
|
||||
// some fixes, just in case (more can be added)
|
||||
switch ($property['name'])
|
||||
{
|
||||
// fix the values
|
||||
case 'name':
|
||||
case 'type':
|
||||
$property['value'] = ComponentbuilderHelper::safeString($property['value']);
|
||||
break;
|
||||
}
|
||||
// load the property
|
||||
$bucket[] = "\t".$property['name'].'="'. str_replace('"', """, $property['value']).'"';
|
||||
}
|
||||
}
|
||||
// make sure we have an array
|
||||
if (ComponentbuilderHelper::checkArray($extraproperties))
|
||||
{
|
||||
foreach($extraproperties as $xproperty)
|
||||
{
|
||||
// make sure we have the correct values
|
||||
if (ComponentbuilderHelper::checkArray($xproperty) && isset($xproperty['name']) && ComponentbuilderHelper::checkString($xproperty['name']) && isset($xproperty['value']))
|
||||
{
|
||||
// load the extra property
|
||||
$bucket[] = "\t".ComponentbuilderHelper::safeString($xproperty['name']).'="'. str_replace('"', """, $xproperty['value']).'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
// make sure we have a string
|
||||
if (ComponentbuilderHelper::checkString($typephp))
|
||||
{
|
||||
// load the type_php property
|
||||
$bucket[] = "\t".'type_php_1="'. str_replace('"', "'", $typephp).'"';
|
||||
}
|
||||
// make sure we have a string
|
||||
if (ComponentbuilderHelper::checkString($typephpx))
|
||||
{
|
||||
// load the type_phpx property
|
||||
$bucket[] = "\t".'type_phpx_1="'. str_replace('"', "'", $typephp).'"';
|
||||
}
|
||||
// if the bucket has been loaded
|
||||
if (ComponentbuilderHelper::checkArray($bucket))
|
||||
{
|
||||
$data['xml'] = "<field".PHP_EOL.implode(PHP_EOL, $bucket).PHP_EOL."/>";
|
||||
}
|
||||
}
|
||||
|
||||
// Set the xml string to JSON string.
|
||||
if (isset($data['xml']))
|
||||
{
|
||||
$data['xml'] = (string) json_encode($data['xml']);
|
||||
}
|
||||
|
||||
// Set the css_view string to base64 string.
|
||||
if (isset($data['css_view']))
|
||||
{
|
||||
$data['css_view'] = base64_encode($data['css_view']);
|
||||
}
|
||||
|
||||
// Set the css_views string to base64 string.
|
||||
if (isset($data['css_views']))
|
||||
{
|
||||
$data['css_views'] = base64_encode($data['css_views']);
|
||||
}
|
||||
|
||||
// Set the css_view string to base64 string.
|
||||
if (isset($data['css_view']))
|
||||
{
|
||||
$data['css_view'] = base64_encode($data['css_view']);
|
||||
}
|
||||
|
||||
// Set the javascript_view_footer string to base64 string.
|
||||
if (isset($data['javascript_view_footer']))
|
||||
{
|
||||
@ -973,9 +1038,9 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
|
@ -49,10 +49,10 @@ class ComponentbuilderModelFields extends JModelList
|
||||
'a.datatype','datatype',
|
||||
'a.indexes','indexes',
|
||||
'a.null_switch','null_switch',
|
||||
'a.store','store',
|
||||
'c.title','category_title',
|
||||
'c.id', 'category_id',
|
||||
'a.catid', 'catid',
|
||||
'a.store','store'
|
||||
'a.catid', 'catid'
|
||||
);
|
||||
}
|
||||
|
||||
@ -88,6 +88,9 @@ class ComponentbuilderModelFields extends JModelList
|
||||
$null_switch = $this->getUserStateFromRequest($this->context . '.filter.null_switch', 'filter_null_switch');
|
||||
$this->setState('filter.null_switch', $null_switch);
|
||||
|
||||
$store = $this->getUserStateFromRequest($this->context . '.filter.store', 'filter_store');
|
||||
$this->setState('filter.store', $store);
|
||||
|
||||
$category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
|
||||
$this->setState('filter.category', $category);
|
||||
|
||||
@ -95,10 +98,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
$this->setState('filter.category_id', $categoryId);
|
||||
|
||||
$catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid');
|
||||
$this->setState('filter.catid', $catid);
|
||||
|
||||
$store = $this->getUserStateFromRequest($this->context . '.filter.store', 'filter_store');
|
||||
$this->setState('filter.store', $store);
|
||||
$this->setState('filter.catid', $catid);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
@ -184,6 +184,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
if ($name === 'datatype')
|
||||
{
|
||||
$datatypeArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_FIELD_SELECT_AN_OPTION',
|
||||
'CHAR' => 'COM_COMPONENTBUILDER_FIELD_CHAR',
|
||||
'VARCHAR' => 'COM_COMPONENTBUILDER_FIELD_VARCHAR',
|
||||
'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT',
|
||||
@ -313,7 +314,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.store LIKE '.$search.')');
|
||||
$query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.store LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,10 +432,10 @@ class ComponentbuilderModelFields extends JModelList
|
||||
continue;
|
||||
}
|
||||
|
||||
// decode css_view
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
// decode css_views
|
||||
$item->css_views = base64_decode($item->css_views);
|
||||
// decode css_view
|
||||
$item->css_view = base64_decode($item->css_view);
|
||||
// decode javascript_view_footer
|
||||
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
|
||||
// decode javascript_views_footer
|
||||
@ -504,10 +505,10 @@ class ComponentbuilderModelFields extends JModelList
|
||||
$id .= ':' . $this->getState('filter.datatype');
|
||||
$id .= ':' . $this->getState('filter.indexes');
|
||||
$id .= ':' . $this->getState('filter.null_switch');
|
||||
$id .= ':' . $this->getState('filter.store');
|
||||
$id .= ':' . $this->getState('filter.category');
|
||||
$id .= ':' . $this->getState('filter.category_id');
|
||||
$id .= ':' . $this->getState('filter.catid');
|
||||
$id .= ':' . $this->getState('filter.store');
|
||||
$id .= ':' . $this->getState('filter.catid');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldAdminsviews extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'adminsviews';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create admin_view
|
||||
if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'adminsviews';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'adminviewfolderlist';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'adminviewfolderlist';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldAdminviews extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'adminviews';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create admin_view
|
||||
if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'adminviews';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldAdminviewsreadonly extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'adminviewsreadonly';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create admin_view
|
||||
if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'adminviewsreadonly';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
105
admin/models/fields/aliasbuilder.php
Normal file
105
admin/models/fields/aliasbuilder.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage aliasbuilder.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Aliasbuilder Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldAliasbuilder extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The aliasbuilder field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'aliasbuilder';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
// load the db opbject
|
||||
$db = JFactory::getDBO();
|
||||
// get the input from url
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
// get the id
|
||||
$adminView = $jinput->getInt('id', 0);
|
||||
// rest the fields ids
|
||||
$fieldIds = array();
|
||||
if (is_numeric($adminView) && $adminView >= 1)
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($addFields))
|
||||
{
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (ComponentbuilderHelper::checkArray($addFields))
|
||||
{
|
||||
foreach($addFields as $addField)
|
||||
{
|
||||
if (isset($addField['field']) && (!isset($addField['alias']) || 1 != $addField['alias']))
|
||||
{
|
||||
$fieldIds[] = (int) $addField['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.name','b.name'),array('id','name','type')));
|
||||
$query->from($db->quoteName('#__componentbuilder_field', 'a'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 'b') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
// filter by fields linked
|
||||
if (ComponentbuilderHelper::checkArray($fieldIds))
|
||||
{
|
||||
// only load these fields
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')');
|
||||
}
|
||||
$query->order('a.name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [' . $item->type . ']');
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -40,107 +40,7 @@ class JFormFieldArticles extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'articles';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create article
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=article&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit article
|
||||
if (($buttonName === 'article' || $buttonName === 'articles') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=articles&task=article.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for article field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'articles';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,7 +40,8 @@ class JFormFieldComponent extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'component';
|
||||
public $type = 'component';
|
||||
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
@ -149,23 +150,24 @@ class JFormFieldComponent extends JFormFieldList
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','component_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->component_system_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','component_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->component_system_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldComponentadminmenus extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'componentadminmenus';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create admin_view
|
||||
if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'componentadminmenus';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldComponentadminviews extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'componentadminviews';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create admin_view
|
||||
if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'componentadminviews';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldComponents extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'components';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create joomla_component
|
||||
if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=joomla_component&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit joomla_component
|
||||
if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for joomla_component field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'components';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldCustomadminviews extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'customadminviews';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create custom_admin_view
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=custom_admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit custom_admin_view
|
||||
if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=custom_admin_views&task=custom_admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for custom_admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'customadminviews';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldCustomfilelist extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'customfilelist';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'customfilelist';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldCustomfolderlist extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'customfolderlist';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'customfolderlist';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldCustomgets extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'customgets';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create dynamic_get
|
||||
if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=dynamic_get&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit dynamic_get
|
||||
if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for dynamic_get field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'customgets';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldDbtables extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'dbtables';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'dbtables';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldDynamicdashboard extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'dynamicdashboard';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create custom_admin_view
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=custom_admin_view&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit custom_admin_view
|
||||
if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=custom_admin_views&task=custom_admin_view.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for custom_admin_view field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'dynamicdashboard';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
@ -40,7 +40,8 @@ class JFormFieldDynamicget extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'dynamicget';
|
||||
public $type = 'dynamicget';
|
||||
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
|
@ -40,107 +40,7 @@ class JFormFieldDynamicgets extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'dynamicgets';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create dynamic_get
|
||||
if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=dynamic_get&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit dynamic_get
|
||||
if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for dynamic_get field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'dynamicgets';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
65
admin/models/fields/existingvalidationrules.php
Normal file
65
admin/models/fields/existingvalidationrules.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.7.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage existingvalidationrules.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Existingvalidationrules Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldExistingvalidationrules extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The existingvalidationrules field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'existingvalidationrules';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
// get the existing validation rules names
|
||||
if ($items = ComponentbuilderHelper::getExistingValidationRuleNames())
|
||||
{
|
||||
// load the items
|
||||
$options = array(JHtml::_('select.option', '', 'Select an option'));
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item, ComponentbuilderHelper::safeString($item, 'Ww'));
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND')));
|
||||
}
|
||||
}
|
@ -40,107 +40,7 @@ class JFormFieldFields extends JFormFieldList
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'fields';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create field
|
||||
if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=field&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit field
|
||||
if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for field field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public $type = 'fields';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user