Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
2f90f9359c | |||
b1d9b672ab | |||
d9b2e51f8c | |||
2caaa1a1e3 | |||
1b3cb2bfdd | |||
5a6ef33c5b | |||
7eb5a2473c | |||
34d14ed95d | |||
d31b0b6c0c | |||
f3f91f492f | |||
bd0febd92c | |||
b294af2e7d | |||
82fd08cf57 | |||
5dc3f97f15 | |||
cca07258d6 | |||
f61bb46073 | |||
8b522f44d9 | |||
63b1bac955 | |||
3c610acb31 | |||
cfd9b33b30 | |||
952d26f1f8 | |||
b0ad2ddffc | |||
7534aed01d | |||
28198e9b9e | |||
3953df845c | |||
30e37dcfde | |||
bc9e5495d7 | |||
4d47f8292f | |||
a1ff74f157 | |||
dc1217e6d1 | |||
f2e4df6ecb | |||
a197f503a9 | |||
79ab3164a6 | |||
290a51dd5a | |||
de008d5907 | |||
5b5599575b |
15
README.md
15
README.md
@ -1,4 +1,4 @@
|
||||
# Component Builder (2.3.0)
|
||||
# Component Builder (2.4.2)
|
||||
|
||||
This is a [Joomla 3.x](http://www.joomla.org/) component.
|
||||
|
||||
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
|
||||
|
||||
Whether you're a seasoned [Joomla](http://www.joomla.org/) 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.3.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.4.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
|
||||
@ -70,6 +70,7 @@ Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
+ You can dynamically add internal help structures to all component.
|
||||
+ There is no limitations on how big or how much you want to build (server limitation only).
|
||||
+ This is a complete factory kind of component that functions like a deployment hub.
|
||||
+ Export any component completely mapped in JCB and import into another JCB.
|
||||
+ This and much much more are all possible with this component builder!
|
||||
|
||||
# Get Access to Video Tutorials
|
||||
@ -104,13 +105,13 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th February, 2017
|
||||
+ *Version*: 2.3.0
|
||||
+ *Last Build*: 6th April, 2017
|
||||
+ *Version*: 2.4.2
|
||||
+ *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*: **91058**
|
||||
+ *File count*: **589**
|
||||
+ *Folder count*: **105**
|
||||
+ *Line count*: **105639**
|
||||
+ *File count*: **639**
|
||||
+ *Folder count*: **115**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Component Builder (2.3.0)
|
||||
# Component Builder (2.4.2)
|
||||
|
||||
This is a [Joomla 3.x](http://www.joomla.org/) component.
|
||||
|
||||
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
|
||||
|
||||
Whether you're a seasoned [Joomla](http://www.joomla.org/) 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.3.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.4.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
|
||||
@ -70,6 +70,7 @@ Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
+ You can dynamically add internal help structures to all component.
|
||||
+ There is no limitations on how big or how much you want to build (server limitation only).
|
||||
+ This is a complete factory kind of component that functions like a deployment hub.
|
||||
+ Export any component completely mapped in JCB and import into another JCB.
|
||||
+ This and much much more are all possible with this component builder!
|
||||
|
||||
# Get Access to Video Tutorials
|
||||
@ -104,13 +105,13 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th February, 2017
|
||||
+ *Version*: 2.3.0
|
||||
+ *Last Build*: 6th April, 2017
|
||||
+ *Version*: 2.4.2
|
||||
+ *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*: **91058**
|
||||
+ *File count*: **589**
|
||||
+ *Folder count*: **105**
|
||||
+ *Line count*: **105639**
|
||||
+ *File count*: **639**
|
||||
+ *Folder count*: **115**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -101,6 +101,41 @@
|
||||
<action name="help_document.export" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT_DESC" />
|
||||
<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.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.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.dashboard_add" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD_DESC" />
|
||||
<action name="joomla_component.dashboard_list" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST_DESC" />
|
||||
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
|
||||
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_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.export" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC" />
|
||||
<action name="joomla_component.import" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC" />
|
||||
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_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" />
|
||||
<action name="language_translation.dashboard_list" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST_DESC" />
|
||||
<action name="language_translation.delete" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE_DESC" />
|
||||
<action name="language_translation.edit" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_DESC" />
|
||||
<action name="language_translation.edit.own" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC" />
|
||||
<action name="language_translation.edit.state" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC" />
|
||||
<action name="language_translation.version" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC" />
|
||||
<action name="language_translation.export" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT_DESC" />
|
||||
<action name="language_translation.import" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT_DESC" />
|
||||
<action name="language_translation.submenu" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_SUBMENU" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_SUBMENU_DESC" />
|
||||
<action name="language.access" title="COM_COMPONENTBUILDER_LANGUAGES_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC" />
|
||||
<action name="language.batch" title="COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC" />
|
||||
<action name="language.create" title="COM_COMPONENTBUILDER_LANGUAGES_CREATE" description="COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC" />
|
||||
<action name="language.delete" title="COM_COMPONENTBUILDER_LANGUAGES_DELETE" description="COM_COMPONENTBUILDER_LANGUAGES_DELETE_DESC" />
|
||||
<action name="language.edit" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_DESC" />
|
||||
<action name="language.edit.own" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC" />
|
||||
<action name="language.edit.state" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC" />
|
||||
<action name="language.version" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC" />
|
||||
<action name="language.export" title="COM_COMPONENTBUILDER_LANGUAGES_EXPORT" description="COM_COMPONENTBUILDER_LANGUAGES_EXPORT_DESC" />
|
||||
<action name="language.import" title="COM_COMPONENTBUILDER_LANGUAGES_IMPORT" description="COM_COMPONENTBUILDER_LANGUAGES_IMPORT_DESC" />
|
||||
<action name="language.submenu" title="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU" description="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC" />
|
||||
<action name="layout.access" title="COM_COMPONENTBUILDER_LAYOUTS_ACCESS" description="COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC" />
|
||||
<action name="layout.batch" title="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE" description="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC" />
|
||||
<action name="layout.dashboard_add" title="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD_DESC" />
|
||||
@ -134,6 +169,11 @@
|
||||
<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" />
|
||||
</section>
|
||||
<section name="joomla_component">
|
||||
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
|
||||
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_DESC" />
|
||||
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="admin_view">
|
||||
<action name="core.edit" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE_DESC" />
|
||||
@ -226,6 +266,24 @@
|
||||
<action name="fieldtype.access" title="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS_DESC" />
|
||||
<action name="fieldtype.version" title="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION" description="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="language_translation">
|
||||
<action name="language_translation.edit" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_DESC" />
|
||||
<action name="language_translation.edit.own" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC" />
|
||||
<action name="language_translation.edit.state" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC" />
|
||||
<action name="language_translation.create" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC" />
|
||||
<action name="language_translation.delete" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE_DESC" />
|
||||
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
|
||||
<action name="language_translation.version" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="language">
|
||||
<action name="language.edit" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_DESC" />
|
||||
<action name="language.edit.own" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC" />
|
||||
<action name="language.edit.state" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC" />
|
||||
<action name="language.create" title="COM_COMPONENTBUILDER_LANGUAGES_CREATE" description="COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC" />
|
||||
<action name="language.delete" title="COM_COMPONENTBUILDER_LANGUAGES_DELETE" description="COM_COMPONENTBUILDER_LANGUAGES_DELETE_DESC" />
|
||||
<action name="language.access" title="COM_COMPONENTBUILDER_LANGUAGES_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC" />
|
||||
<action name="language.version" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="help_document">
|
||||
<action name="help_document.edit" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_DESC" />
|
||||
<action name="help_document.edit.own" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC" />
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 109 of this MVC
|
||||
@build 31st March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 109 of this MVC
|
||||
@build 31st March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_views.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 11 of this MVC
|
||||
@build 2nd February, 2017
|
||||
@version @update number 47 of this MVC
|
||||
@build 21st March, 2017
|
||||
@created 1st February, 2017
|
||||
@package Component Builder
|
||||
@subpackage compiler.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_views.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dashboard.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@build 18th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_document.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@build 18th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_documents.css
|
||||
|
@ -9,11 +9,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 318 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.css
|
||||
@subpackage joomla_component.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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
|
@ -9,11 +9,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 318 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.css
|
||||
@subpackage joomla_components.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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
|
27
admin/assets/css/language.css
Normal file
27
admin/assets/css/language.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 3 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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/language_translation.css
Normal file
27
admin/assets/css/language_translation.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 37 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_translation.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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/language_translations.css
Normal file
27
admin/assets/css/language_translations.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 37 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_translations.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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/languages.css
Normal file
27
admin/assets/css/languages.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 3 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage languages.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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 */
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 1st April, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 1st April, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layouts.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_views.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st April, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st April, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage templates.css
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
BIN
admin/assets/images/icons/language_translations.png
Normal file
BIN
admin/assets/images/icons/language_translations.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
@ -146,13 +146,18 @@ abstract class ###Component###Helper
|
||||
|
||||
if (self::checkArray($where))
|
||||
{
|
||||
// prep main <-- why? well if $main='' is empty then $table can be categories or users
|
||||
if (self::checkString($main))
|
||||
{
|
||||
$main = '_'.ltrim($main, '_');
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
$query->from($db->quoteName('#_'.$main.'_'.$table));
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
@ -681,57 +686,86 @@ abstract class ###Component###Helper
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function safeString($string, $type = 'L', $spacer = '_')
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to a thousand)
|
||||
$string = self::replaceNumbers($string);
|
||||
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to millions)
|
||||
$string = self::replaceNumbers($string);
|
||||
}
|
||||
// 0nly continue if we have a string
|
||||
if (self::checkString($string))
|
||||
{
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
if ($type == 'W')
|
||||
{
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'w')
|
||||
{
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type == 'Ww')
|
||||
{
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'WW')
|
||||
{
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'U')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'F')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'L')
|
||||
// create file name without the extention that is safe
|
||||
if ($type === 'filename')
|
||||
{
|
||||
// make sure VDM is not in the string
|
||||
$string = str_replace('VDM', 'vDm', $string);
|
||||
// Remove anything which isn't a word, whitespace, number
|
||||
// or any of the following caracters -_()
|
||||
// If you don't need to handle multi-byte characters
|
||||
// you can use preg_replace rather than mb_ereg_replace
|
||||
// Thanks @Łukasz Rysiak!
|
||||
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
|
||||
// http://stackoverflow.com/a/2021729/1429677
|
||||
return preg_replace('/\s+/', ' ', $string);
|
||||
}
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
elseif ($type === 'W')
|
||||
{
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'w' || $type === 'word')
|
||||
{
|
||||
// return a string with all lowercase(no undersocre)
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'Ww' || $type === 'Word')
|
||||
{
|
||||
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'WW' || $type === 'WORD')
|
||||
{
|
||||
// return a string with all the uppercase(no undersocre)
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'U' || $type === 'strtoupper')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'F' || $type === 'ucfirst')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
|
||||
{
|
||||
// convert all words to first letter uppercase
|
||||
$string = ucwords(strtolower($string));
|
||||
// remove white space
|
||||
$string = preg_replace('/\s+/', '', $string);
|
||||
// now return first letter lowercase
|
||||
return lcfirst($string);
|
||||
}
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
|
35
admin/compiler/joomla_3/Helper_category.php
Normal file
35
admin/compiler/joomla_3/Helper_category.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@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');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* ###Component### Component Category Tree
|
||||
*/
|
||||
###CATEGORY_CLASS_TREES###
|
50
admin/compiler/joomla_3/Helper_category_view.php
Normal file
50
admin/compiler/joomla_3/Helper_category_view.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@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');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Component Category Tree
|
||||
*/
|
||||
class ###Component######Views###Categories extends JCategories
|
||||
{
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param array $options Array of options
|
||||
*
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options['table'] = '#__###component###_###view###';
|
||||
$options['extension'] = 'com_###component###.###views###';
|
||||
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
@ -320,13 +320,18 @@ abstract class ###Component###Helper
|
||||
|
||||
if (self::checkArray($where))
|
||||
{
|
||||
// prep main <-- why? well if $main='' is empty then $table can be categories or users
|
||||
if (self::checkString($main))
|
||||
{
|
||||
$main = '_'.ltrim($main, '_');
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
$query->from($db->quoteName('#_'.$main.'_'.$table));
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
@ -673,62 +678,91 @@ abstract class ###Component###Helper
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function safeString($string, $type = 'L', $spacer = '_')
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to a thousand)
|
||||
$string = self::replaceNumbers($string);
|
||||
|
||||
if (self::checkString($string))
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to millions)
|
||||
$string = self::replaceNumbers($string);
|
||||
}
|
||||
// 0nly continue if we have a string
|
||||
if (self::checkString($string))
|
||||
{
|
||||
// create file name without the extention that is safe
|
||||
if ($type === 'filename')
|
||||
{
|
||||
// make sure VDM is not in the string
|
||||
$string = str_replace('VDM', 'vDm', $string);
|
||||
// Remove anything which isn't a word, whitespace, number
|
||||
// or any of the following caracters -_()
|
||||
// If you don't need to handle multi-byte characters
|
||||
// you can use preg_replace rather than mb_ereg_replace
|
||||
// Thanks @Łukasz Rysiak!
|
||||
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
|
||||
// http://stackoverflow.com/a/2021729/1429677
|
||||
return preg_replace('/\s+/', ' ', $string);
|
||||
}
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
if ($type == 'W')
|
||||
{
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'w')
|
||||
{
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type == 'Ww')
|
||||
{
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'WW')
|
||||
{
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'U')
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'W')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'F')
|
||||
elseif ($type === 'w' || $type === 'word')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
// return a string with all lowercase(no undersocre)
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'Ww' || $type === 'Word')
|
||||
{
|
||||
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'L')
|
||||
elseif ($type === 'WW' || $type === 'WORD')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
// return a string with all the uppercase(no undersocre)
|
||||
return strtoupper($string);
|
||||
}
|
||||
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
// not a string
|
||||
return '';
|
||||
elseif ($type === 'U' || $type === 'strtoupper')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'F' || $type === 'ucfirst')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
|
||||
{
|
||||
// convert all words to first letter uppercase
|
||||
$string = ucwords(strtolower($string));
|
||||
// remove white space
|
||||
$string = preg_replace('/\s+/', '', $string);
|
||||
// now return first letter lowercase
|
||||
return lcfirst($string);
|
||||
}
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
// not a string
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function htmlEscape($var, $charset = 'UTF-8', $sorten = false, $length = 40)
|
||||
|
@ -47,5 +47,5 @@ class ###Component###Controller###Views### extends JControllerAdmin
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER###
|
||||
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### ###ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST###
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class ###Component###Model###View### extends JModelAdmin
|
||||
public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD###
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
@ -248,6 +248,45 @@ class ###Component###Model###View### extends JModelAdmin
|
||||
|
||||
return $data;
|
||||
}###VALIDATIONFIX### ###UNIQUEFIELDS###
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{###JMODELADMIN_BEFORE_DELETE###
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_DELETE###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{###JMODELADMIN_BEFORE_PUBLISH###
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_PUBLISH###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
|
@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class ###Component###ModelImport extends JModelLegacy
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
@ -75,10 +80,6 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
// set uploading values
|
||||
$this->use_streams = false;
|
||||
$this->allow_unsafe = false;
|
||||
$this->safeFileOptions = array();
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
@ -285,21 +286,16 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
}
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
@ -357,21 +353,15 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
$config = JFactory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
@ -384,6 +374,28 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
return $check;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the extension
|
||||
*
|
||||
* @param string $file Name of the uploaded file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function checkExtension($file)
|
||||
{
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($file, PATHINFO_EXTENSION)))
|
||||
{
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
|
@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class ###Component###Model###View### extends JModelLegacy
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
@ -75,10 +80,6 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
// set uploading values
|
||||
$this->use_streams = false;
|
||||
$this->allow_unsafe = false;
|
||||
$this->safeFileOptions = array();
|
||||
parent::populateState();
|
||||
}
|
||||
###IMPORT_METHOD_CUSTOM###
|
||||
@ -175,21 +176,16 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
}
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
@ -247,21 +243,15 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
$config = JFactory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
@ -273,6 +263,7 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
|
||||
return $check;
|
||||
}
|
||||
###IMPORT_EXT_METHOD_CUSTOM###
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
|
@ -47,7 +47,7 @@ class ###Component###Model###Views### extends JModelList
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD_LIST###
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
|
@ -52,7 +52,8 @@ class ###Component###ViewImport extends JViewLegacy
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors'))){
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode('<br />', $errors));
|
||||
return false;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS###
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
|
@ -60,8 +60,7 @@
|
||||
</files>
|
||||
|
||||
<languages folder="site">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_###component###.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_###component###.sys.ini</language>
|
||||
###SITE_LANGUAGES###
|
||||
</languages>
|
||||
|
||||
<administration>
|
||||
@ -86,8 +85,7 @@
|
||||
</files>
|
||||
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_###component###.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_###component###.sys.ini</language>
|
||||
###ADMIN_LANGUAGES###
|
||||
</languages>
|
||||
|
||||
</administration>###UPDATESERVER###
|
||||
|
@ -1,6 +1,11 @@
|
||||
###INSTALL###
|
||||
|
||||
--
|
||||
-- Always insure this column is large enough for all the access control values.
|
||||
-- Always insure this column rules is large enough for all the access control values.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';
|
||||
|
||||
--
|
||||
-- Always insure this column name is large enough for long component and view names.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';
|
||||
|
@ -139,11 +139,11 @@ class ###Component###Router extends JComponentRouterBase
|
||||
return $vars;
|
||||
}
|
||||
|
||||
protected function getVar($table, $where = null, $whereString = 'user', $what = 'id', $category = false, $operator = '=', $main = '###component###')
|
||||
protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = '###component###')
|
||||
{
|
||||
if(!$where)
|
||||
if(!$where || !$what || !$whereString)
|
||||
{
|
||||
$where = JFactory::getUser()->id;
|
||||
return false;
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
@ -153,19 +153,42 @@ class ###Component###Router extends JComponentRouterBase
|
||||
$query->select($db->quoteName(array($what)));
|
||||
if ('categories' == $table || 'category' == $table || $category)
|
||||
{
|
||||
$query->from($db->quoteName('#__categories'));
|
||||
$getTable = '#__categories';
|
||||
$query->from($db->quoteName($getTable));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
// we must check if the table exist (TODO not ideal)
|
||||
$tables = $db->getTableList();
|
||||
$app = JFactory::getApplication();
|
||||
$prefix = $app->get('dbprefix');
|
||||
$check = $prefix.$main.'_'.$table;
|
||||
if (in_array($check, $tables))
|
||||
{
|
||||
$getTable = '#__'.$main.'_'.$table;
|
||||
$query->from($db->quoteName($getTable));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (is_numeric($where))
|
||||
{
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where);
|
||||
return false;
|
||||
}
|
||||
elseif (is_string($where))
|
||||
elseif ($this->checkString($where))
|
||||
{
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
|
||||
// we must first check if this table has the column
|
||||
$columns = $db->getTableColumns($getTable);
|
||||
if (isset($columns[$whereString]))
|
||||
{
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -179,6 +202,15 @@ class ###Component###Router extends JComponentRouterBase
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function checkString($string)
|
||||
{
|
||||
if (isset($string) && is_string($string) && strlen($string) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function ###Component###BuildRoute(&$query)
|
||||
|
@ -157,24 +157,19 @@
|
||||
"rename": "Helper_site",
|
||||
"type": "file"
|
||||
},
|
||||
"Helper_category.php": {
|
||||
"naam":"Helper_category.php",
|
||||
"path": "c0mp0n3nt/site/helpers",
|
||||
"rename": "new",
|
||||
"newName": "category.php",
|
||||
"type": "file"
|
||||
},
|
||||
"script.php": {
|
||||
"naam":"script.php",
|
||||
"path": "c0mp0n3nt/",
|
||||
"rename": false,
|
||||
"type": "file"
|
||||
},
|
||||
"en-GB.com_admin.ini": {
|
||||
"naam":"en-GB.com_admin.ini",
|
||||
"path": "c0mp0n3nt/admin/language/en-GB",
|
||||
"rename": "admin",
|
||||
"type": "file"
|
||||
},
|
||||
"en-GB.com_admin.sys.ini": {
|
||||
"naam":"en-GB.com_admin.sys.ini",
|
||||
"path": "c0mp0n3nt/admin/language/en-GB",
|
||||
"rename": "admin",
|
||||
"type": "file"
|
||||
},
|
||||
"install.mysql.utf8.sql": {
|
||||
"naam":"install.mysql.utf8.sql",
|
||||
"path": "c0mp0n3nt/admin/sql",
|
||||
@ -212,18 +207,6 @@
|
||||
"rename": false,
|
||||
"type": "file"
|
||||
},
|
||||
"en-GB.com_site.ini": {
|
||||
"naam":"en-GB.com_site.ini",
|
||||
"path": "c0mp0n3nt/site/language/en-GB",
|
||||
"rename": "site",
|
||||
"type": "file"
|
||||
},
|
||||
"en-GB.com_site.sys.ini": {
|
||||
"naam":"en-GB.com_site.sys.ini",
|
||||
"path": "c0mp0n3nt/site/language/en-GB",
|
||||
"rename": "site",
|
||||
"type": "file"
|
||||
},
|
||||
"headercheck.php": {
|
||||
"naam":"headercheck.php",
|
||||
"path": "c0mp0n3nt/site/helpers",
|
||||
@ -677,6 +660,11 @@
|
||||
"rename": "new",
|
||||
"newName": "submitbutton.js",
|
||||
"type": "custom_form"
|
||||
},
|
||||
"Helper_category_view.php": {
|
||||
"path": "c0mp0n3nt/site/helpers",
|
||||
"rename": "Helper_category_view",
|
||||
"type": "category"
|
||||
}
|
||||
},
|
||||
"custom_admin": {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@ -44,7 +44,10 @@ $document->addScript('components/com_componentbuilder/assets/js/admin.js');
|
||||
|
||||
// require helper files
|
||||
JLoader::register('ComponentbuilderHelper', dirname(__FILE__) . '/helpers/componentbuilder.php');
|
||||
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
|
||||
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
|
||||
|
||||
// Triger the Global Admin Event
|
||||
ComponentbuilderHelper::globalEvent($document);
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
164
admin/config.xml
164
admin/config.xml
@ -61,6 +61,19 @@
|
||||
<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_a Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_a" hr="true" class="spacer_hr_a" />
|
||||
<field name="autorTitle"
|
||||
@ -222,6 +235,157 @@
|
||||
message="Error! Please add folder path here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="company_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_COMPANY">
|
||||
|
||||
<!-- Export_company Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="export_company"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add company name here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_HINT"
|
||||
/>
|
||||
<!-- Export_owner Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="export_owner"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_LABEL"
|
||||
size="10"
|
||||
maxlength="120"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="HTML"
|
||||
message="Error! Please add owner name here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_HINT"
|
||||
/>
|
||||
<!-- Export_email Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="export_email"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
validate="email"
|
||||
message="Error! Please email address here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_HINT"
|
||||
/>
|
||||
<!-- Export_website Field. Type: Url. (joomla) -->
|
||||
<field
|
||||
type="url"
|
||||
name="export_website"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_LABEL"
|
||||
size="60"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="url"
|
||||
validated="url"
|
||||
message="Error! Please add website here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_HINT"
|
||||
/>
|
||||
<!-- Export_license Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="export_license"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_LABEL"
|
||||
rows="7"
|
||||
cols="10"
|
||||
default="GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_HINT"
|
||||
required="true"
|
||||
/>
|
||||
<!-- Export_copyright Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="export_copyright"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_LABEL"
|
||||
rows="7"
|
||||
cols="10"
|
||||
default="Copyright (C) 2015. All Rights Reserved"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_HINT"
|
||||
required="true"
|
||||
/>
|
||||
<!-- Export_buy_link Field. Type: Url. (joomla) -->
|
||||
<field
|
||||
type="url"
|
||||
name="export_buy_link"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_LABEL"
|
||||
size="60"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="false"
|
||||
filter="url"
|
||||
validated="url"
|
||||
message="Error! Please add link here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_HINT"
|
||||
/>
|
||||
<!-- Export_buy_query Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="export_buy_query"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_QUERY_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_QUERY_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="STRING"
|
||||
message="Error! Please email address here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_QUERY_HINT"
|
||||
/>
|
||||
<!-- Export_package_link Field. Type: Url. (joomla) -->
|
||||
<field
|
||||
type="url"
|
||||
name="export_package_link"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_LINK_LABEL"
|
||||
size="60"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_LINK_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="false"
|
||||
filter="url"
|
||||
validated="url"
|
||||
message="Error! Please add link here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_LINK_HINT"
|
||||
/>
|
||||
<!-- Export_package_query Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="export_package_query"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_QUERY_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_QUERY_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="STRING"
|
||||
message="Error! Please email address here."
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_PACKAGE_QUERY_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="permissions"
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage controller.php
|
||||
@ -88,7 +88,7 @@ class ComponentbuilderController extends JControllerLegacy
|
||||
if (ComponentbuilderHelper::checkString($view))
|
||||
{
|
||||
$views = array(
|
||||
'component' => 'components',
|
||||
'joomla_component' => 'joomla_components',
|
||||
'admin_view' => 'admin_views',
|
||||
'custom_admin_view' => 'custom_admin_views',
|
||||
'site_view' => 'site_views',
|
||||
@ -99,6 +99,8 @@ class ComponentbuilderController extends JControllerLegacy
|
||||
'snippet' => 'snippets',
|
||||
'field' => 'fields',
|
||||
'fieldtype' => 'fieldtypes',
|
||||
'language_translation' => 'language_translations',
|
||||
'language' => 'languages',
|
||||
'help_document' => 'help_documents'
|
||||
);
|
||||
// check if this is a list view
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 109 of this MVC
|
||||
@build 31st March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 109 of this MVC
|
||||
@build 31st March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_views.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerAdmin_views extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ajax.json.php
|
||||
@ -44,6 +44,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
// load the tasks
|
||||
$this->registerTask('isNew', 'ajax');
|
||||
$this->registerTask('isRead', 'ajax');
|
||||
$this->registerTask('getComponentDetails', 'ajax');
|
||||
$this->registerTask('tableColumns', 'ajax');
|
||||
$this->registerTask('fieldSelectOptions', 'ajax');
|
||||
$this->registerTask('getImportScripts', 'ajax');
|
||||
@ -54,7 +55,11 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
$this->registerTask('dynamicFormDetails', 'ajax');
|
||||
$this->registerTask('dbTableColumns', 'ajax');
|
||||
$this->registerTask('viewTableColumns', 'ajax');
|
||||
$this->registerTask('fieldOptions', 'ajax');
|
||||
$this->registerTask('checkFunctionName', 'ajax');
|
||||
$this->registerTask('usedin', 'ajax');
|
||||
$this->registerTask('fieldOptions', 'ajax');
|
||||
$this->registerTask('getBuildTable', 'ajax');
|
||||
$this->registerTask('getButton', 'ajax');
|
||||
}
|
||||
|
||||
public function ajax()
|
||||
@ -145,6 +150,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getComponentDetails':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getComponentDetails($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 'tableColumns':
|
||||
try
|
||||
{
|
||||
@ -530,6 +573,85 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'checkFunctionName':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$functioNameValue = $jinput->get('functioName', NULL, 'STRING');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($functioNameValue && $idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $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 'usedin':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$functioNameValue = $jinput->get('functioName', NULL, 'WORD');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
$targetValue = $jinput->get('target', NULL, 'WORD');
|
||||
if($functioNameValue && $idValue && $targetValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->usedin($functioNameValue, $idValue, $targetValue);
|
||||
}
|
||||
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
|
||||
{
|
||||
@ -567,6 +689,83 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getBuildTable':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$idNameValue = $jinput->get('idName', NULL, 'CMD');
|
||||
$objectValue = $jinput->get('object', NULL, 'STRING');
|
||||
if($idNameValue && $objectValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getBuildTable($idNameValue, $objectValue);
|
||||
}
|
||||
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 'getButton':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$typeValue = $jinput->get('type', NULL, 'WORD');
|
||||
if($typeValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getButton($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;
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 11 of this MVC
|
||||
@build 2nd February, 2017
|
||||
@version @update number 47 of this MVC
|
||||
@build 21st March, 2017
|
||||
@created 1st February, 2017
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -66,15 +66,17 @@ 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');
|
||||
$addGit = $jinput->post->get('git', 0, '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');
|
||||
$addGit = $jinput->post->get('git', 0, 'INT');
|
||||
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
|
||||
$debugLinenr = $jinput->post->get('debuglinenr', 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,$addGit))
|
||||
if ($model->builder($version,$componentId,$addBackup,$addGit,$addPlaceholders,$debugLinenr))
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
@ -91,61 +93,37 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
if (empty($redirect_url) && $componentId > 0)
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
// setup the unrealistic numbers
|
||||
$counter = $model->getCount();
|
||||
$folders = $counter['folders'] * 5;
|
||||
$files = $counter['files'] * 5;
|
||||
$lines = $counter['lines'] * 10;
|
||||
$seconds = $folders + $files + $lines;
|
||||
$totalHours = round($seconds / 3600);
|
||||
$totalDays = round($totalHours / 8);
|
||||
// setup the more realistic numbers
|
||||
$debugging = $seconds / 4;
|
||||
$planning = $seconds / 7;
|
||||
$mapping = $seconds / 10;
|
||||
$office = $seconds / 6;
|
||||
$seconds = $folders + $files + $lines + $debugging + $planning + $mapping + $office;
|
||||
$actualTotalHours = round($seconds / 3600);
|
||||
$actualTotalDays = round($actualTotalHours / 8);
|
||||
$debuggingHours = round($debugging / 3600);
|
||||
$planningHours = round($planning / 3600);
|
||||
$mappingHours = round($mapping / 3600);
|
||||
$officeHours = round($office / 3600);
|
||||
// the actual time spent
|
||||
$actualHoursSpent = $actualTotalHours - $totalHours;
|
||||
$actualDaysSpent = $actualTotalDays - $totalDays;
|
||||
// calculate the projects actual time frame of completion
|
||||
$projectWeekTime = round($actualTotalDays / 5,1);
|
||||
$projectMonthTime = round($actualTotalDays / 24,1);
|
||||
if (($pos = strpos($counter['filePath'], "/tmp/")) !== FALSE)
|
||||
if (($pos = strpos($model->compiler->filepath, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$url = JURI::root() . substr($counter['filePath'], $pos + 1);
|
||||
$url = JURI::root() . substr($model->compiler->filepath, $pos + 1);
|
||||
}
|
||||
// Message of successful build
|
||||
$message = '<h1>The ('.$counter['filename'].') Was Successfully Compiled!</h1>';
|
||||
$message = '<h1>The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!</h1>';
|
||||
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installExtention\')">';
|
||||
$message .= 'Install '.$counter['filename'].' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
|
||||
$message .= 'Install '.$model->compiler->componentFolderName.' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
|
||||
$message .= '<h2>Total time saved</h2>';
|
||||
$message .= '<ul>';
|
||||
$message .= '<li>Total folders created: <b>'.$counter['folders'].'</b></li>';
|
||||
$message .= '<li>Total files created: <b>'.$counter['files'].'</b></li>';
|
||||
$message .= '<li>Total lines written: <b>'.$counter['lines'].'</b></li>';
|
||||
$message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
|
||||
$message .= '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>';
|
||||
$message .= '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>';
|
||||
$message .= '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>';
|
||||
$message .= '</ul>';
|
||||
$message .= '<p><b>'.$totalHours.' Hours</b> or <b>'.$totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message .= '<p><b>'.$model->compiler->totalHours.' Hours</b> or <b>'.$model->compiler->totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, never making one mistake or taking any coffee break.)</small><br />';
|
||||
$message .= '<b>'.$actualHoursSpent.' Hours</b> or <b>'.$actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message .= '<small>(with the following break down: <b>debugging @'.$debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$mappingHours.'hours</b> = codingtime / 10; <b>office @'.$officeHours.'hours</b> = codingtime / 6;)</small></p>';
|
||||
$message .= '<p><b>'.$actualTotalHours.' Hours</b> or <b>'.$actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message .= '<b>'.$model->compiler->actualHoursSpent.' Hours</b> or <b>'.$model->compiler->actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message .= '<small>(with the following break down: <b>debugging @'.$model->compiler->debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$model->compiler->planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$model->compiler->mappingHours.'hours</b> = codingtime / 10; <b>office @'.$model->compiler->officeHours.'hours</b> = codingtime / 6;)</small></p>';
|
||||
$message .= '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
|
||||
$message .= '<p>Project duration: <b>'.$projectWeekTime. ' weeks</b> or <b>'.$projectMonthTime.' months</b></p>';
|
||||
$message .= '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>';
|
||||
$message .= '<h2>Path to Zip File</h2>';
|
||||
$message .= '<p><b>Path:</b> <code>'.$counter['filePath'].'</code><br />';
|
||||
$message .= '<p><b>Path:</b> <code>'.$model->compiler->filepath.'</code><br />';
|
||||
$message .= '<b>URL:</b> <code>'.$url.'</code><br /><br />';
|
||||
$message .= '<small>Hey! you can also download the file right now!</small><br /><a class="btn btn-success" href="'.$url.'" ><span class="icon-download icon-white"></span>Download</a></p>';
|
||||
$message .= '<p><small><b>Remember!</b> This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!</small> </p>';
|
||||
$message .= '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
|
||||
// set redirect
|
||||
$this->setRedirect($redirect_url,$message,'message');
|
||||
$app->setUserState('com_componentbuilder.extension_name', $counter['filename']);
|
||||
$app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_views.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerCustom_admin_views extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerCustom_codes extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,5 +107,5 @@ class ComponentbuilderControllerDynamic_gets extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,33 +60,14 @@ class ComponentbuilderControllerField extends JControllerForm
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// get the user object
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Access check.
|
||||
$access = $user->authorise('field.access', 'com_componentbuilder');
|
||||
$access = JFactory::getUser()->authorise('field.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
|
||||
$allow = null;
|
||||
|
||||
if ($categoryId)
|
||||
{
|
||||
// If the category has been passed in the URL check it.
|
||||
$allow = $user->authorise('core.create', $this->option . '.fields.category.' . $categoryId);
|
||||
}
|
||||
|
||||
if ($allow === null)
|
||||
{
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('field.create', $this->option);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $allow;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('field.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,18 +127,6 @@ class ComponentbuilderControllerField extends JControllerForm
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
|
||||
|
||||
if ($categoryId)
|
||||
{
|
||||
// The category has been set. Check the category permissions.
|
||||
$catpermission = $user->authorise('core.edit', $this->option . '.fields.category.' . $categoryId);
|
||||
if (!$catpermission && !is_null($catpermission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('field.edit', $this->option);
|
||||
|
@ -107,5 +107,5 @@ class ComponentbuilderControllerFields extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,33 +60,14 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// get the user object
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Access check.
|
||||
$access = $user->authorise('fieldtype.access', 'com_componentbuilder');
|
||||
$access = JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
|
||||
$allow = null;
|
||||
|
||||
if ($categoryId)
|
||||
{
|
||||
// If the category has been passed in the URL check it.
|
||||
$allow = $user->authorise('core.create', $this->option . '.fieldtypes.category.' . $categoryId);
|
||||
}
|
||||
|
||||
if ($allow === null)
|
||||
{
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('fieldtype.create', $this->option);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $allow;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('fieldtype.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,18 +127,6 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
|
||||
|
||||
if ($categoryId)
|
||||
{
|
||||
// The category has been set. Check the category permissions.
|
||||
$catpermission = $user->authorise('core.edit', $this->option . '.fieldtypes.category.' . $categoryId);
|
||||
if (!$catpermission && !is_null($catpermission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('fieldtype.edit', $this->option);
|
||||
|
@ -107,5 +107,5 @@ class ComponentbuilderControllerFieldtypes extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage help.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@build 18th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_document.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@build 18th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_documents.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerHelp_documents extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.0
|
||||
@build 4th February, 2017
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import.php
|
||||
|
67
admin/controllers/import_joomla_components.php
Normal file
67
admin/controllers/import_joomla_components.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 6th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import_joomla_components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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');
|
||||
|
||||
/**
|
||||
* Componentbuilder Import_joomla_components Controller
|
||||
*/
|
||||
class ComponentbuilderControllerImport_joomla_components extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('Import_joomla_components');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_componentbuilder.redirect_url', '');
|
||||
$app->setUserState('com_componentbuilder.message', '');
|
||||
$app->setUserState('com_componentbuilder.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
@ -10,11 +10,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 318 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
@subpackage joomla_component.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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
|
||||
@ -30,9 +30,9 @@ defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
/**
|
||||
* Component Controller
|
||||
* Joomla_component Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponent extends JControllerForm
|
||||
class ComponentbuilderControllerJoomla_component extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
@ -45,7 +45,7 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Components'; // safeguard for setting the return view listing to the main view.
|
||||
$this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
@ -59,7 +59,14 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{ // In the absense of better information, revert to the component permissions.
|
||||
{
|
||||
// Access check.
|
||||
$access = JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
@ -84,10 +91,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('core.edit', 'com_componentbuilder.component.' . (int) $recordId);
|
||||
$permission = $user->authorise('core.edit', 'com_componentbuilder.joomla_component.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('core.edit.own', 'com_componentbuilder.component.' . $recordId))
|
||||
if ($user->authorise('core.edit.own', 'com_componentbuilder.joomla_component.' . $recordId))
|
||||
{
|
||||
// Now test the owner is the user.
|
||||
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||
@ -182,10 +189,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Component', '', array());
|
||||
$model = $this->getModel('Joomla_component', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components' . $this->getRedirectToListAppend(), false));
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
242
admin/controllers/joomla_components.php
Normal file
242
admin/controllers/joomla_components.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 318 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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');
|
||||
|
||||
/**
|
||||
* Joomla_components Controller
|
||||
*/
|
||||
class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_COMPONENTS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Joomla_component', $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('joomla_component.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('Joomla_components');
|
||||
// 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,'Joomla_components_'.$date->format('jS_F_Y'),'Joomla components exported ('.$date->format('jS F, Y').')','joomla components');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', 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('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// 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('joomla_component_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'joomla_component');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_COMPONENTS');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', 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=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
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'))
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'smart_package');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message);
|
||||
return;
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_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;
|
||||
}
|
||||
|
||||
public function smartExport()
|
||||
{
|
||||
// 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('joomla_component.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);
|
||||
// check if there is any selections
|
||||
if (!ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// set auto loader
|
||||
ComponentbuilderHelper::autoLoader('smart');
|
||||
// get the data to export
|
||||
if ($model->getSmartExport($pks))
|
||||
{
|
||||
// set the key string
|
||||
if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32)
|
||||
{
|
||||
$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'])))
|
||||
{
|
||||
$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>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
|
||||
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '</p>';
|
||||
$ownerDetails .= '<h3>' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
|
||||
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '</p>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$keyNotice = '<h1>' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
|
||||
$ownerDetails = '<p>' . JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '</p>';
|
||||
}
|
||||
// Redirect to the list screen with success.
|
||||
$message = array();
|
||||
$message[] = '<h1>' . JText::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '</h1>';
|
||||
$message[] = '<p>' . JText::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S', $model->zipPath, $keyNotice, $ownerDetails) . '</p>';
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode('', $message), 'Success');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (componentbuilderHelper::checkString($model->packagePath))
|
||||
{
|
||||
// clear all if not successful
|
||||
ComponentbuilderHelper::removeFolder($model->packagePath);
|
||||
}
|
||||
if (componentbuilderHelper::checkString($model->zipPath))
|
||||
{
|
||||
// clear all if not successful
|
||||
JFile::delete($model->zipPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
326
admin/controllers/language.php
Normal file
326
admin/controllers/language.php
Normal file
@ -0,0 +1,326 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 3 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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');
|
||||
|
||||
/**
|
||||
* Language Controller
|
||||
*/
|
||||
class ComponentbuilderControllerLanguage 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 = 'Languages'; // 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('language.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('language.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('language.access', 'com_componentbuilder.language.' . (int) $recordId) && $user->authorise('language.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('language.edit', 'com_componentbuilder.language.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('language.edit.own', 'com_componentbuilder.language.' . $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('language.edit.own', 'com_componentbuilder'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('language.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('Language', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages' . $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;
|
||||
}
|
||||
|
||||
}
|
326
admin/controllers/language_translation.php
Normal file
326
admin/controllers/language_translation.php
Normal file
@ -0,0 +1,326 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 37 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_translation.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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');
|
||||
|
||||
/**
|
||||
* Language_translation Controller
|
||||
*/
|
||||
class ComponentbuilderControllerLanguage_translation 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 = 'Language_translations'; // 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('language_translation.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('language_translation.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('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $recordId) && $user->authorise('language_translation.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('language_translation.edit', 'com_componentbuilder.language_translation.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('language_translation.edit.own', 'com_componentbuilder.language_translation.' . $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('language_translation.edit.own', 'com_componentbuilder'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('language_translation.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('Language_translation', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations' . $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/language_translations.php
Normal file
111
admin/controllers/language_translations.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 37 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_translations.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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');
|
||||
|
||||
/**
|
||||
* Language_translations Controller
|
||||
*/
|
||||
class ComponentbuilderControllerLanguage_translations extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Language_translation', $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('language_translation.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('Language_translations');
|
||||
// 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,'Language_translations_'.$date->format('jS_F_Y'),'Language translations exported ('.$date->format('jS F, Y').')','language translations');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations', 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('language_translation.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Language_translations');
|
||||
// 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('language_translation_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'language_translations');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'language_translation');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGE_TRANSLATIONS');
|
||||
$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=language_translations', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@ -10,11 +10,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@created 6th May, 2015
|
||||
@version @update number 3 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage components.php
|
||||
@subpackage languages.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/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
|
||||
@ -30,16 +30,16 @@ defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Components Controller
|
||||
* Languages Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
class ComponentbuilderControllerLanguages extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS';
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_LANGUAGES';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Component', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
public function getModel($name = 'Language', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
@ -52,7 +52,7 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
if ($user->authorise('language.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
@ -60,19 +60,19 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Components');
|
||||
$model = $this->getModel('Languages');
|
||||
// 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,'Components_'.$date->format('jS_F_Y'),'Components exported ('.$date->format('jS F, Y').')','components');
|
||||
ComponentbuilderHelper::xls($data,'Languages_'.$date->format('jS_F_Y'),'Languages exported ('.$date->format('jS F, Y').')','languages');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,10 +83,10 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
if ($user->authorise('language.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Components');
|
||||
$model = $this->getModel('Languages');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
@ -94,18 +94,18 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
// Load headers to session.
|
||||
$session = JFactory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('component_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'component');
|
||||
$session->set('language_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'languages');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'language');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_COMPONENTS');
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGES');
|
||||
$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=components', false), $message, 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 1st April, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 1st April, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layouts.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerLayouts extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_views.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerSite_views extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,5 +107,5 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st April, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st April, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage templates.php
|
||||
@ -107,5 +107,5 @@ class ComponentbuilderControllerTemplates extends JControllerAdmin
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,4 +464,3 @@ class Dropbox
|
||||
return function_exists('curl_version');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,169 +1,175 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.0.6
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable,
|
||||
table.footable-details {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.footable-details {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table > tbody > tr > td > span.footable-toggle {
|
||||
margin-right: 8px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
table > tbody > tr > td > span.footable-toggle.last-column {
|
||||
margin-left: 8px;
|
||||
float: right;
|
||||
}
|
||||
table.table-condensed > tbody > tr > td > span.footable-toggle {
|
||||
margin-right: 5px;
|
||||
}
|
||||
table.footable-details > tbody > tr > th:nth-child(1) {
|
||||
min-width: 40px;
|
||||
width: 120px;
|
||||
}
|
||||
table.footable-details > tbody > tr > td:nth-child(2) {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
table.footable-details > thead > tr:first-child > th,
|
||||
table.footable-details > thead > tr:first-child > td,
|
||||
table.footable-details > tbody > tr:first-child > th,
|
||||
table.footable-details > tbody > tr:first-child > td,
|
||||
table.footable-details > tfoot > tr:first-child > th,
|
||||
table.footable-details > tfoot > tr:first-child > td {
|
||||
border-top-width: 0;
|
||||
}
|
||||
table.footable-details.table-bordered > thead > tr:first-child > th,
|
||||
table.footable-details.table-bordered > thead > tr:first-child > td,
|
||||
table.footable-details.table-bordered > tbody > tr:first-child > th,
|
||||
table.footable-details.table-bordered > tbody > tr:first-child > td,
|
||||
table.footable-details.table-bordered > tfoot > tr:first-child > th,
|
||||
table.footable-details.table-bordered > tfoot > tr:first-child > td {
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
div.footable-loader {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
}
|
||||
div.footable-loader > span.fooicon {
|
||||
display: inline-block;
|
||||
opacity: 0.3;
|
||||
font-size: 30px;
|
||||
line-height: 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-top: -16px;
|
||||
margin-left: -16px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-webkit-animation: fooicon-spin-r 2s infinite linear;
|
||||
animation: fooicon-spin-r 2s infinite linear;
|
||||
}
|
||||
table.footable > tbody > tr.footable-empty > td {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
}
|
||||
table.footable > tbody > tr > td,
|
||||
table.footable > tbody > tr > th {
|
||||
display: none;
|
||||
}
|
||||
table.footable > tbody > tr.footable-empty > td,
|
||||
table.footable > tbody > tr.footable-empty > th,
|
||||
table.footable > tbody > tr.footable-detail-row > td,
|
||||
table.footable > tbody > tr.footable-detail-row > th {
|
||||
display: table-cell;
|
||||
}
|
||||
@-webkit-keyframes fooicon-spin-r {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fooicon-spin-r {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
.fooicon {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
display: inline-block;
|
||||
font-family: 'Glyphicons Halflings' !important;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.fooicon:before,
|
||||
.fooicon:after {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.fooicon-loader:before {
|
||||
content: "\e030";
|
||||
}
|
||||
.fooicon-plus:before {
|
||||
content: "\2b";
|
||||
}
|
||||
.fooicon-minus:before {
|
||||
content: "\2212";
|
||||
}
|
||||
.fooicon-search:before {
|
||||
content: "\e003";
|
||||
}
|
||||
.fooicon-remove:before {
|
||||
content: "\e014";
|
||||
}
|
||||
.fooicon-sort:before {
|
||||
content: "\e150";
|
||||
}
|
||||
.fooicon-sort-asc:before {
|
||||
content: "\e155";
|
||||
}
|
||||
.fooicon-sort-desc:before {
|
||||
content: "\e156";
|
||||
}
|
||||
.fooicon-pencil:before {
|
||||
content: "\270f";
|
||||
}
|
||||
.fooicon-trash:before {
|
||||
content: "\e020";
|
||||
}
|
||||
.fooicon-eye-close:before {
|
||||
content: "\e106";
|
||||
}
|
||||
.fooicon-flash:before {
|
||||
content: "\e162";
|
||||
}
|
||||
.fooicon-cog:before {
|
||||
content: "\e019";
|
||||
}
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable,
|
||||
table.footable-details {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.footable-details {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table.footable-hide-fouc {
|
||||
display: none;
|
||||
}
|
||||
table > tbody > tr > td > span.footable-toggle {
|
||||
margin-right: 8px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
table > tbody > tr > td > span.footable-toggle.last-column {
|
||||
margin-left: 8px;
|
||||
float: right;
|
||||
}
|
||||
table.table-condensed > tbody > tr > td > span.footable-toggle {
|
||||
margin-right: 5px;
|
||||
}
|
||||
table.footable-details > tbody > tr > th:nth-child(1) {
|
||||
min-width: 40px;
|
||||
width: 120px;
|
||||
}
|
||||
table.footable-details > tbody > tr > td:nth-child(2) {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
table.footable-details > thead > tr:first-child > th,
|
||||
table.footable-details > thead > tr:first-child > td,
|
||||
table.footable-details > tbody > tr:first-child > th,
|
||||
table.footable-details > tbody > tr:first-child > td,
|
||||
table.footable-details > tfoot > tr:first-child > th,
|
||||
table.footable-details > tfoot > tr:first-child > td {
|
||||
border-top-width: 0;
|
||||
}
|
||||
table.footable-details.table-bordered > thead > tr:first-child > th,
|
||||
table.footable-details.table-bordered > thead > tr:first-child > td,
|
||||
table.footable-details.table-bordered > tbody > tr:first-child > th,
|
||||
table.footable-details.table-bordered > tbody > tr:first-child > td,
|
||||
table.footable-details.table-bordered > tfoot > tr:first-child > th,
|
||||
table.footable-details.table-bordered > tfoot > tr:first-child > td {
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
div.footable-loader {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
}
|
||||
div.footable-loader > span.fooicon {
|
||||
display: inline-block;
|
||||
opacity: 0.3;
|
||||
font-size: 30px;
|
||||
line-height: 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-top: -16px;
|
||||
margin-left: -16px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-webkit-animation: fooicon-spin-r 2s infinite linear;
|
||||
animation: fooicon-spin-r 2s infinite linear;
|
||||
}
|
||||
table.footable > tbody > tr.footable-empty > td {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
}
|
||||
table.footable > tbody > tr > td,
|
||||
table.footable > tbody > tr > th {
|
||||
display: none;
|
||||
}
|
||||
table.footable > tbody > tr.footable-empty > td,
|
||||
table.footable > tbody > tr.footable-empty > th,
|
||||
table.footable > tbody > tr.footable-detail-row > td,
|
||||
table.footable > tbody > tr.footable-detail-row > th {
|
||||
display: table-cell;
|
||||
}
|
||||
@-webkit-keyframes fooicon-spin-r {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fooicon-spin-r {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
.fooicon {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
display: inline-block;
|
||||
font-family: 'Glyphicons Halflings' !important;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.fooicon:before,
|
||||
.fooicon:after {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.fooicon-loader:before {
|
||||
content: "\e030";
|
||||
}
|
||||
.fooicon-plus:before {
|
||||
content: "\2b";
|
||||
}
|
||||
.fooicon-minus:before {
|
||||
content: "\2212";
|
||||
}
|
||||
.fooicon-search:before {
|
||||
content: "\e003";
|
||||
}
|
||||
.fooicon-remove:before {
|
||||
content: "\e014";
|
||||
}
|
||||
.fooicon-sort:before {
|
||||
content: "\e150";
|
||||
}
|
||||
.fooicon-sort-asc:before {
|
||||
content: "\e155";
|
||||
}
|
||||
.fooicon-sort-desc:before {
|
||||
content: "\e156";
|
||||
}
|
||||
.fooicon-pencil:before {
|
||||
content: "\270f";
|
||||
}
|
||||
.fooicon-trash:before {
|
||||
content: "\e020";
|
||||
}
|
||||
.fooicon-eye-close:before {
|
||||
content: "\e106";
|
||||
}
|
||||
.fooicon-flash:before {
|
||||
content: "\e162";
|
||||
}
|
||||
.fooicon-cog:before {
|
||||
content: "\e019";
|
||||
}
|
||||
.fooicon-stats:before {
|
||||
content: "\e185";
|
||||
}
|
||||
|
1
admin/custom/footable3/css/footable.core.bootstrap.min.css
vendored
Normal file
1
admin/custom/footable3/css/footable.core.bootstrap.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
table.footable,table.footable-details{position:relative;width:100%;border-spacing:0;border-collapse:collapse}table.footable-details{margin-bottom:0}table.footable-hide-fouc{display:none}table>tbody>tr>td>span.footable-toggle{margin-right:8px;opacity:.3}table>tbody>tr>td>span.footable-toggle.last-column{margin-left:8px;float:right}table.table-condensed>tbody>tr>td>span.footable-toggle{margin-right:5px}table.footable-details>tbody>tr>th:nth-child(1){min-width:40px;width:120px}table.footable-details>tbody>tr>td:nth-child(2){word-break:break-all}table.footable-details>tbody>tr:first-child>td,table.footable-details>tbody>tr:first-child>th,table.footable-details>tfoot>tr:first-child>td,table.footable-details>tfoot>tr:first-child>th,table.footable-details>thead>tr:first-child>td,table.footable-details>thead>tr:first-child>th{border-top-width:0}table.footable-details.table-bordered>tbody>tr:first-child>td,table.footable-details.table-bordered>tbody>tr:first-child>th,table.footable-details.table-bordered>tfoot>tr:first-child>td,table.footable-details.table-bordered>tfoot>tr:first-child>th,table.footable-details.table-bordered>thead>tr:first-child>td,table.footable-details.table-bordered>thead>tr:first-child>th{border-top-width:1px}div.footable-loader{vertical-align:middle;text-align:center;height:300px;position:relative}div.footable-loader>span.fooicon{display:inline-block;opacity:.3;font-size:30px;line-height:32px;width:32px;height:32px;margin-top:-16px;margin-left:-16px;position:absolute;top:50%;left:50%;-webkit-animation:fooicon-spin-r 2s infinite linear;animation:fooicon-spin-r 2s infinite linear}table.footable>tbody>tr.footable-empty>td{vertical-align:middle;text-align:center;font-size:30px}table.footable>tbody>tr>td,table.footable>tbody>tr>th{display:none}table.footable>tbody>tr.footable-detail-row>td,table.footable>tbody>tr.footable-detail-row>th,table.footable>tbody>tr.footable-empty>td,table.footable>tbody>tr.footable-empty>th{display:table-cell}@-webkit-keyframes fooicon-spin-r{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fooicon-spin-r{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fooicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings'!important;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fooicon:after,.fooicon:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.fooicon-loader:before{content:"\e030"}.fooicon-plus:before{content:"\2b"}.fooicon-minus:before{content:"\2212"}.fooicon-search:before{content:"\e003"}.fooicon-remove:before{content:"\e014"}.fooicon-sort:before{content:"\e150"}.fooicon-sort-asc:before{content:"\e155"}.fooicon-sort-desc:before{content:"\e156"}.fooicon-pencil:before{content:"\270f"}.fooicon-trash:before{content:"\e020"}.fooicon-eye-close:before{content:"\e106"}.fooicon-flash:before{content:"\e162"}.fooicon-cog:before{content:"\e019"}.fooicon-stats:before{content:"\e185"}
|
File diff suppressed because it is too large
Load Diff
1
admin/custom/footable3/css/footable.core.standalone.min.css
vendored
Normal file
1
admin/custom/footable3/css/footable.core.standalone.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
50
admin/custom/footable3/css/footable.editing.css
Normal file
50
admin/custom/footable3/css/footable.editing.css
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
td.footable-editing {
|
||||
width: 90px;
|
||||
max-width: 90px;
|
||||
}
|
||||
table.footable-editing-no-edit td.footable-editing,
|
||||
table.footable-editing-no-delete td.footable-editing,
|
||||
table.footable-editing-no-view td.footable-editing {
|
||||
width: 70px;
|
||||
max-width: 70px;
|
||||
}
|
||||
table.footable-editing-no-edit.footable-editing-no-delete td.footable-editing,
|
||||
table.footable-editing-no-edit.footable-editing-no-view td.footable-editing,
|
||||
table.footable-editing-no-delete.footable-editing-no-view td.footable-editing {
|
||||
width: 50px;
|
||||
max-width: 50px;
|
||||
}
|
||||
table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view td.footable-editing,
|
||||
table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view th.footable-editing {
|
||||
width: 0;
|
||||
max-width: 0;
|
||||
display: none !important;
|
||||
}
|
||||
table.footable-editing-right td.footable-editing,
|
||||
table.footable-editing-right tr.footable-editing {
|
||||
text-align: right;
|
||||
}
|
||||
table.footable-editing-left td.footable-editing,
|
||||
table.footable-editing-left tr.footable-editing {
|
||||
text-align: left;
|
||||
}
|
||||
table.footable-editing button.footable-add,
|
||||
table.footable-editing button.footable-hide,
|
||||
table.footable-editing-show button.footable-show,
|
||||
table.footable-editing.footable-editing-always-show button.footable-show,
|
||||
table.footable-editing.footable-editing-always-show button.footable-hide,
|
||||
table.footable-editing.footable-editing-always-show.footable-editing-no-add tr.footable-editing {
|
||||
display: none;
|
||||
}
|
||||
table.footable-editing.footable-editing-show button.footable-add,
|
||||
table.footable-editing.footable-editing-show button.footable-hide,
|
||||
table.footable-editing.footable-editing-always-show button.footable-add {
|
||||
display: inline-block;
|
||||
}
|
1
admin/custom/footable3/css/footable.editing.min.css
vendored
Normal file
1
admin/custom/footable3/css/footable.editing.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
td.footable-editing{width:90px;max-width:90px}table.footable-editing-no-delete td.footable-editing,table.footable-editing-no-edit td.footable-editing,table.footable-editing-no-view td.footable-editing{width:70px;max-width:70px}table.footable-editing-no-delete.footable-editing-no-view td.footable-editing,table.footable-editing-no-edit.footable-editing-no-delete td.footable-editing,table.footable-editing-no-edit.footable-editing-no-view td.footable-editing{width:50px;max-width:50px}table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view td.footable-editing,table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view th.footable-editing{width:0;max-width:0;display:none!important}table.footable-editing-right td.footable-editing,table.footable-editing-right tr.footable-editing{text-align:right}table.footable-editing-left td.footable-editing,table.footable-editing-left tr.footable-editing{text-align:left}table.footable-editing button.footable-add,table.footable-editing button.footable-hide,table.footable-editing-show button.footable-show,table.footable-editing.footable-editing-always-show button.footable-hide,table.footable-editing.footable-editing-always-show button.footable-show,table.footable-editing.footable-editing-always-show.footable-editing-no-add tr.footable-editing{display:none}table.footable-editing.footable-editing-always-show button.footable-add,table.footable-editing.footable-editing-show button.footable-add,table.footable-editing.footable-editing-show button.footable-hide{display:inline-block}
|
@ -1,55 +1,55 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.0.6
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable > thead > tr.footable-filtering > th {
|
||||
border-bottom-width: 1px;
|
||||
font-weight: normal;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th,
|
||||
table.footable.footable-filtering-right > thead > tr.footable-filtering > th {
|
||||
text-align: right;
|
||||
}
|
||||
table.footable.footable-filtering-left > thead > tr.footable-filtering > th {
|
||||
text-align: left;
|
||||
}
|
||||
table.footable.footable-filtering-center > thead > tr.footable-filtering > th {
|
||||
text-align: center;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
|
||||
margin-top: 5px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.input-group {
|
||||
width: 100%;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox {
|
||||
margin: 0;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox > label {
|
||||
display: block;
|
||||
padding-left: 20px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox input[type="checkbox"] {
|
||||
position: absolute;
|
||||
margin-left: -20px;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
table.footable > thead > tr.footable-filtering > th div.input-group {
|
||||
width: auto;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group {
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
|
||||
margin-top: 0;
|
||||
}
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable > thead > tr.footable-filtering > th {
|
||||
border-bottom-width: 1px;
|
||||
font-weight: normal;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th,
|
||||
table.footable.footable-filtering-right > thead > tr.footable-filtering > th {
|
||||
text-align: right;
|
||||
}
|
||||
table.footable.footable-filtering-left > thead > tr.footable-filtering > th {
|
||||
text-align: left;
|
||||
}
|
||||
table.footable.footable-filtering-center > thead > tr.footable-filtering > th {
|
||||
text-align: center;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
|
||||
margin-top: 5px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.input-group {
|
||||
width: 100%;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox {
|
||||
margin: 0;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox > label {
|
||||
display: block;
|
||||
padding-left: 20px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox input[type="checkbox"] {
|
||||
position: absolute;
|
||||
margin-left: -20px;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
table.footable > thead > tr.footable-filtering > th div.input-group {
|
||||
width: auto;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group {
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.0.6
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable > tfoot > tr.footable-paging > td > ul.pagination {
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
table.footable > tfoot > tr.footable-paging > td > span.label {
|
||||
display: inline-block;
|
||||
margin: 0 0 10px 0;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
table.footable > tfoot > tr.footable-paging > td,
|
||||
table.footable-paging-center > tfoot > tr.footable-paging > td {
|
||||
text-align: center;
|
||||
}
|
||||
table.footable-paging-left > tfoot > tr.footable-paging > td {
|
||||
text-align: left;
|
||||
}
|
||||
table.footable-paging-right > tfoot > tr.footable-paging > td {
|
||||
text-align: right;
|
||||
}
|
||||
ul.pagination > li.footable-page {
|
||||
display: none;
|
||||
}
|
||||
ul.pagination > li.footable-page.visible {
|
||||
display: inline;
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable > tfoot > tr.footable-paging > td > ul.pagination {
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
table.footable > tfoot > tr.footable-paging > td > span.label {
|
||||
display: inline-block;
|
||||
margin: 0 0 10px 0;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
table.footable > tfoot > tr.footable-paging > td,
|
||||
table.footable-paging-center > tfoot > tr.footable-paging > td {
|
||||
text-align: center;
|
||||
}
|
||||
table.footable-paging-left > tfoot > tr.footable-paging > td {
|
||||
text-align: left;
|
||||
}
|
||||
table.footable-paging-right > tfoot > tr.footable-paging > td {
|
||||
text-align: right;
|
||||
}
|
||||
ul.pagination > li.footable-page {
|
||||
display: none;
|
||||
}
|
||||
ul.pagination > li.footable-page.visible {
|
||||
display: inline;
|
||||
}
|
@ -1,32 +1,46 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.0.6
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
td.footable-sortable,
|
||||
th.footable-sortable {
|
||||
position: relative;
|
||||
padding-right: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
td.footable-sortable > span.fooicon,
|
||||
th.footable-sortable > span.fooicon {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 50%;
|
||||
margin-top: -7px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in;
|
||||
}
|
||||
td.footable-sortable:hover > span.fooicon,
|
||||
th.footable-sortable:hover > span.fooicon {
|
||||
opacity: 1;
|
||||
}
|
||||
td.footable-sortable.footable-asc > span.fooicon,
|
||||
th.footable-sortable.footable-asc > span.fooicon,
|
||||
td.footable-sortable.footable-desc > span.fooicon,
|
||||
th.footable-sortable.footable-desc > span.fooicon {
|
||||
opacity: 1;
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
table.footable > thead > tr > td.footable-sortable,
|
||||
table.footable > thead > tr > th.footable-sortable,
|
||||
table.footable > tbody > tr > td.footable-sortable,
|
||||
table.footable > tbody > tr > th.footable-sortable,
|
||||
table.footable > tfoot > tr > td.footable-sortable,
|
||||
table.footable > tfoot > tr > th.footable-sortable {
|
||||
position: relative;
|
||||
padding-right: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
td.footable-sortable > span.fooicon,
|
||||
th.footable-sortable > span.fooicon {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 50%;
|
||||
margin-top: -7px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in;
|
||||
}
|
||||
td.footable-sortable:hover > span.fooicon,
|
||||
th.footable-sortable:hover > span.fooicon {
|
||||
opacity: 1;
|
||||
}
|
||||
td.footable-sortable.footable-asc > span.fooicon,
|
||||
th.footable-sortable.footable-asc > span.fooicon,
|
||||
td.footable-sortable.footable-desc > span.fooicon,
|
||||
th.footable-sortable.footable-desc > span.fooicon {
|
||||
opacity: 1;
|
||||
}
|
||||
/* hides the sort icons when sorting is not allowed */
|
||||
table.footable-sorting-disabled td.footable-sortable.footable-asc > span.fooicon,
|
||||
table.footable-sorting-disabled td.footable-sortable.footable-desc > span.fooicon,
|
||||
table.footable-sorting-disabled td.footable-sortable:hover > span.fooicon,
|
||||
table.footable-sorting-disabled th.footable-sortable.footable-asc > span.fooicon,
|
||||
table.footable-sorting-disabled th.footable-sortable.footable-desc > span.fooicon,
|
||||
table.footable-sorting-disabled th.footable-sortable:hover > span.fooicon {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
@ -1 +1 @@
|
||||
td.footable-sortable,th.footable-sortable{position:relative;padding-right:30px;cursor:pointer}td.footable-sortable>span.fooicon,th.footable-sortable>span.fooicon{position:absolute;right:6px;top:50%;margin-top:-7px;opacity:0;transition:opacity .3s ease-in}td.footable-sortable.footable-asc>span.fooicon,td.footable-sortable.footable-desc>span.fooicon,td.footable-sortable:hover>span.fooicon,th.footable-sortable.footable-asc>span.fooicon,th.footable-sortable.footable-desc>span.fooicon,th.footable-sortable:hover>span.fooicon{opacity:1}
|
||||
table.footable>tbody>tr>td.footable-sortable,table.footable>tbody>tr>th.footable-sortable,table.footable>tfoot>tr>td.footable-sortable,table.footable>tfoot>tr>th.footable-sortable,table.footable>thead>tr>td.footable-sortable,table.footable>thead>tr>th.footable-sortable{position:relative;padding-right:30px;cursor:pointer}td.footable-sortable>span.fooicon,th.footable-sortable>span.fooicon{position:absolute;right:6px;top:50%;margin-top:-7px;opacity:0;transition:opacity .3s ease-in}td.footable-sortable.footable-asc>span.fooicon,td.footable-sortable.footable-desc>span.fooicon,td.footable-sortable:hover>span.fooicon,th.footable-sortable.footable-asc>span.fooicon,th.footable-sortable.footable-desc>span.fooicon,th.footable-sortable:hover>span.fooicon{opacity:1}table.footable-sorting-disabled td.footable-sortable.footable-asc>span.fooicon,table.footable-sorting-disabled td.footable-sortable.footable-desc>span.fooicon,table.footable-sorting-disabled td.footable-sortable:hover>span.fooicon,table.footable-sorting-disabled th.footable-sortable.footable-asc>span.fooicon,table.footable-sorting-disabled th.footable-sortable.footable-desc>span.fooicon,table.footable-sorting-disabled th.footable-sortable:hover>span.fooicon{opacity:0;visibility:hidden}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
802
admin/custom/footable3/js/footable.editing.js
Normal file
802
admin/custom/footable3/js/footable.editing.js
Normal file
@ -0,0 +1,802 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
(function($, F){
|
||||
|
||||
F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
|
||||
/**
|
||||
* The editing component adds a column with edit and delete buttons to each row as well as a single add row button in the footer.
|
||||
* @constructs
|
||||
* @extends FooTable.Component
|
||||
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
|
||||
* @returns {FooTable.Editing}
|
||||
*/
|
||||
construct: function(table){
|
||||
// call the base constructor
|
||||
this._super(table, table.o.editing.enabled);
|
||||
|
||||
/**
|
||||
* Whether or not to automatically page to a new row when it is added to the table.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.pageToNew = table.o.editing.pageToNew;
|
||||
|
||||
/**
|
||||
* Whether or not the editing column and add row button are always visible.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.alwaysShow = table.o.editing.alwaysShow;
|
||||
|
||||
/**
|
||||
* The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
|
||||
* @type {object}
|
||||
* @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
|
||||
* @prop {string} name="editing" - The name of the column.
|
||||
* @prop {string} title="" - The title displayed in the header row of the table for the column.
|
||||
* @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
|
||||
* @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
|
||||
*/
|
||||
this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});
|
||||
|
||||
/**
|
||||
* The position of the editing column in the table as well as the alignment of the buttons.
|
||||
* @type {string}
|
||||
*/
|
||||
this.position = table.o.editing.position;
|
||||
|
||||
|
||||
/**
|
||||
* The text that appears in the show button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.showText = table.o.editing.showText;
|
||||
|
||||
/**
|
||||
* The text that appears in the hide button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.hideText = table.o.editing.hideText;
|
||||
|
||||
/**
|
||||
* The text that appears in the add button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.addText = table.o.editing.addText;
|
||||
|
||||
/**
|
||||
* The text that appears in the edit button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.editText = table.o.editing.editText;
|
||||
|
||||
/**
|
||||
* The text that appears in the delete button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.deleteText = table.o.editing.deleteText;
|
||||
|
||||
/**
|
||||
* The text that appears in the view button. This can contain HTML.
|
||||
* @type {string}
|
||||
*/
|
||||
this.viewText = table.o.editing.viewText;
|
||||
|
||||
/**
|
||||
* Whether or not to show the Add Row button.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.allowAdd = table.o.editing.allowAdd;
|
||||
|
||||
/**
|
||||
* Whether or not to show the Edit Row button.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.allowEdit = table.o.editing.allowEdit;
|
||||
|
||||
/**
|
||||
* Whether or not to show the Delete Row button.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.allowDelete = table.o.editing.allowDelete;
|
||||
|
||||
/**
|
||||
* Whether or not to show the View Row button.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.allowView = table.o.editing.allowView;
|
||||
|
||||
/**
|
||||
* Caches the row button elements to help with performance.
|
||||
* @type {(null|jQuery)}
|
||||
* @private
|
||||
*/
|
||||
this._$buttons = null;
|
||||
|
||||
/**
|
||||
* This object is used to contain the callbacks for the add, edit and delete row buttons.
|
||||
* @type {object}
|
||||
* @prop {function} addRow
|
||||
* @prop {function} editRow
|
||||
* @prop {function} deleteRow
|
||||
* @prop {function} viewRow
|
||||
*/
|
||||
this.callbacks = {
|
||||
addRow: F.checkFnValue(this, table.o.editing.addRow),
|
||||
editRow: F.checkFnValue(this, table.o.editing.editRow),
|
||||
deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
|
||||
viewRow: F.checkFnValue(this, table.o.editing.viewRow)
|
||||
};
|
||||
},
|
||||
/* PROTECTED */
|
||||
/**
|
||||
* Checks the supplied data and options for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @param {object} data - The jQuery data object from the parent table.
|
||||
* @fires FooTable.Editing#"preinit.ft.editing"
|
||||
*/
|
||||
preinit: function(data){
|
||||
var self = this;
|
||||
/**
|
||||
* The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Editing#"preinit.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {object} data - The jQuery data object of the table raising the event.
|
||||
*/
|
||||
this.ft.raise('preinit.ft.editing', [data]).then(function(){
|
||||
if (self.ft.$el.hasClass('footable-editing'))
|
||||
self.enabled = true;
|
||||
|
||||
self.enabled = F.is.boolean(data.editing)
|
||||
? data.editing
|
||||
: self.enabled;
|
||||
|
||||
if (!self.enabled) return;
|
||||
|
||||
self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;
|
||||
|
||||
self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;
|
||||
|
||||
self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;
|
||||
|
||||
self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;
|
||||
|
||||
self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;
|
||||
|
||||
self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;
|
||||
|
||||
self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;
|
||||
|
||||
self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;
|
||||
|
||||
self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;
|
||||
|
||||
self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;
|
||||
|
||||
self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;
|
||||
|
||||
self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;
|
||||
|
||||
self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;
|
||||
|
||||
self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));
|
||||
|
||||
if (self.ft.$el.hasClass('footable-editing-left'))
|
||||
self.position = 'left';
|
||||
|
||||
if (self.ft.$el.hasClass('footable-editing-right'))
|
||||
self.position = 'right';
|
||||
|
||||
if (self.position === 'right'){
|
||||
self.column.index = self.ft.columns.array.length;
|
||||
} else {
|
||||
self.column.index = 0;
|
||||
for (var i = 0, len = self.ft.columns.array.length; i < len; i++){
|
||||
self.ft.columns.array[i].index += 1;
|
||||
}
|
||||
}
|
||||
self.ft.columns.array.push(self.column);
|
||||
self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });
|
||||
|
||||
self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
|
||||
self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
|
||||
self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
|
||||
self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Initializes the editing component for the plugin using the supplied table and options.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Editing#"init.ft.editing"
|
||||
*/
|
||||
init: function(){
|
||||
/**
|
||||
* The init.ft.editing event is raised before its UI is generated.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Editing#"init.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('init.ft.editing').then(function(){
|
||||
self.$create();
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Destroys the editing component removing any UI generated from the table.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Editing#"destroy.ft.editing"
|
||||
*/
|
||||
destroy: function () {
|
||||
/**
|
||||
* The destroy.ft.editing event is raised before its UI is removed.
|
||||
* Calling preventDefault on this event will prevent the component from being destroyed.
|
||||
* @event FooTable.Editing#"destroy.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('destroy.ft.editing').then(function(){
|
||||
self.ft.$el.removeClass('footable-editing footable-editing-always-show footable-editing-no-add footable-editing-no-edit footable-editing-no-delete footable-editing-no-view')
|
||||
.off('click.ft.editing').find('tfoot > tr.footable-editing').remove();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Creates the editing UI from the current options setting the various jQuery properties of this component.
|
||||
* @instance
|
||||
* @protected
|
||||
*/
|
||||
$create: function(){
|
||||
var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
|
||||
self.ft.$el.addClass('footable-editing').addClass(position)
|
||||
.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
|
||||
.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
|
||||
.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
|
||||
.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
|
||||
.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
|
||||
.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);
|
||||
|
||||
self.$cell = $('<td/>').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
|
||||
if (self.allowAdd){
|
||||
self.$cell.append(self.$buttonAdd());
|
||||
}
|
||||
self.$cell.append(self.$buttonHide());
|
||||
|
||||
if (self.alwaysShow){
|
||||
self.ft.$el.addClass('footable-editing-always-show');
|
||||
}
|
||||
|
||||
if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
|
||||
if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
|
||||
if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
|
||||
if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');
|
||||
|
||||
var $tfoot = self.ft.$el.children('tfoot');
|
||||
if ($tfoot.length == 0){
|
||||
$tfoot = $('<tfoot/>');
|
||||
self.ft.$el.append($tfoot);
|
||||
}
|
||||
self.$row = $('<tr/>', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
|
||||
},
|
||||
/**
|
||||
* Creates the show button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonShow: function(){
|
||||
return '<button type="button" class="btn btn-primary footable-show">' + this.showText + '</button>';
|
||||
},
|
||||
/**
|
||||
* Creates the hide button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonHide: function(){
|
||||
return '<button type="button" class="btn btn-default footable-hide">' + this.hideText + '</button>';
|
||||
},
|
||||
/**
|
||||
* Creates the add button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonAdd: function(){
|
||||
return '<button type="button" class="btn btn-primary footable-add">' + this.addText + '</button> ';
|
||||
},
|
||||
/**
|
||||
* Creates the edit button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonEdit: function(){
|
||||
return '<button type="button" class="btn btn-default footable-edit">' + this.editText + '</button> ';
|
||||
},
|
||||
/**
|
||||
* Creates the delete button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonDelete: function(){
|
||||
return '<button type="button" class="btn btn-default footable-delete">' + this.deleteText + '</button>';
|
||||
},
|
||||
/**
|
||||
* Creates the view button for the editing component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$buttonView: function(){
|
||||
return '<button type="button" class="btn btn-default footable-view">' + this.viewText + '</button> ';
|
||||
},
|
||||
/**
|
||||
* Creates the button group for the row buttons.
|
||||
* @instance
|
||||
* @protected
|
||||
* @returns {(string|HTMLElement|jQuery)}
|
||||
*/
|
||||
$rowButtons: function(){
|
||||
if (F.is.jq(this._$buttons)) return this._$buttons.clone();
|
||||
this._$buttons = $('<div class="btn-group btn-group-xs" role="group"></div>');
|
||||
if (this.allowView) this._$buttons.append(this.$buttonView());
|
||||
if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
|
||||
if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
|
||||
return this._$buttons;
|
||||
},
|
||||
/**
|
||||
* Performs the drawing of the component.
|
||||
*/
|
||||
draw: function(){
|
||||
this.$cell.attr('colspan', this.ft.columns.visibleColspan);
|
||||
},
|
||||
/**
|
||||
* Handles the edit button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"edit.ft.editing"
|
||||
*/
|
||||
_onEditClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
|
||||
if (row instanceof F.Row){
|
||||
/**
|
||||
* The edit.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"edit.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Row} row - The row to be edited.
|
||||
*/
|
||||
self.ft.raise('edit.ft.editing', [row]).then(function(){
|
||||
self.callbacks.editRow.call(self.ft, row);
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Handles the delete button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"delete.ft.editing"
|
||||
*/
|
||||
_onDeleteClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
|
||||
if (row instanceof F.Row){
|
||||
/**
|
||||
* The delete.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"delete.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Row} row - The row to be deleted.
|
||||
*/
|
||||
self.ft.raise('delete.ft.editing', [row]).then(function(){
|
||||
self.callbacks.deleteRow.call(self.ft, row);
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Handles the view button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"view.ft.editing"
|
||||
*/
|
||||
_onViewClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
|
||||
if (row instanceof F.Row){
|
||||
/**
|
||||
* The view.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"view.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Row} row - The row to be viewed.
|
||||
*/
|
||||
self.ft.raise('view.ft.editing', [row]).then(function(){
|
||||
self.callbacks.viewRow.call(self.ft, row);
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Handles the add button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"add.ft.editing"
|
||||
*/
|
||||
_onAddClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self;
|
||||
/**
|
||||
* The add.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"add.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
self.ft.raise('add.ft.editing').then(function(){
|
||||
self.callbacks.addRow.call(self.ft);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handles the show button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"show.ft.editing"
|
||||
*/
|
||||
_onShowClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self;
|
||||
/**
|
||||
* The show.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"show.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
self.ft.raise('show.ft.editing').then(function(){
|
||||
self.ft.$el.addClass('footable-editing-show');
|
||||
self.column.visible = true;
|
||||
self.ft.draw();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handles the hide button click event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @fires FooTable.Editing#"show.ft.editing"
|
||||
*/
|
||||
_onHideClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = e.data.self;
|
||||
/**
|
||||
* The hide.ft.editing event is raised before its callback is executed.
|
||||
* Calling preventDefault on this event will prevent the callback from being executed.
|
||||
* @event FooTable.Editing#"hide.ft.editing"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
self.ft.raise('hide.ft.editing').then(function(){
|
||||
self.ft.$el.removeClass('footable-editing-show');
|
||||
self.column.visible = false;
|
||||
self.ft.draw();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
F.components.register('editing', F.Editing, 850);
|
||||
|
||||
})(jQuery, FooTable);
|
||||
|
||||
(function($, F){
|
||||
|
||||
F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
|
||||
/**
|
||||
* The Editing column class is used to create the column containing the editing buttons.
|
||||
* @constructs
|
||||
* @extends FooTable.Column
|
||||
* @param {FooTable.Table} instance - The parent {@link FooTable.Table} this column belongs to.
|
||||
* @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
|
||||
* @param {object} definition - An object containing all the properties to set for the column.
|
||||
* @returns {FooTable.EditingColumn}
|
||||
*/
|
||||
construct: function(instance, editing, definition){
|
||||
this._super(instance, definition, 'editing');
|
||||
this.editing = editing;
|
||||
},
|
||||
/**
|
||||
* After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
|
||||
* @instance
|
||||
* @protected
|
||||
* @this FooTable.Column
|
||||
*/
|
||||
$create: function(){
|
||||
(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>', {'class': 'footable-editing'})).html(this.title);
|
||||
},
|
||||
/**
|
||||
* This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
|
||||
* will be provided to the {@link FooTable.EditingColumn#format} function
|
||||
* to generate the cell contents.
|
||||
* @instance
|
||||
* @protected
|
||||
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
|
||||
* @returns {(jQuery)}
|
||||
*/
|
||||
parser: function(valueOrElement){
|
||||
if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
|
||||
if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
|
||||
if (F.is.jq(valueOrElement)){
|
||||
var tagName = valueOrElement.prop('tagName').toLowerCase();
|
||||
if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
|
||||
return valueOrElement;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
/**
|
||||
* Creates a cell to be used in the supplied row for this column.
|
||||
* @param {FooTable.Row} row - The row to create the cell for.
|
||||
* @returns {FooTable.Cell}
|
||||
*/
|
||||
createCell: function(row){
|
||||
var $buttons = this.editing.$rowButtons(), $cell = $('<td/>').append($buttons);
|
||||
if (F.is.jq(row.$el)){
|
||||
if (this.index === 0){
|
||||
$cell.prependTo(row.$el);
|
||||
} else {
|
||||
$cell.insertAfter(row.$el.children().eq(this.index-1));
|
||||
}
|
||||
}
|
||||
return new F.Cell(this.ft, row, this, $cell || $cell.html());
|
||||
}
|
||||
});
|
||||
|
||||
F.columns.register('editing', F.EditingColumn);
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function($, F) {
|
||||
|
||||
/**
|
||||
* An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
|
||||
* @type {object}
|
||||
* @prop {boolean} enabled=false - Whether or not to allow editing on the table.
|
||||
* @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
|
||||
* @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
|
||||
* @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
|
||||
* @prop {function} addRow - The callback function to execute when the add row button is clicked.
|
||||
* @prop {function} editRow - The callback function to execute when the edit row button is clicked.
|
||||
* @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
|
||||
* @prop {function} viewRow - The callback function to execute when the view row button is clicked.
|
||||
* @prop {string} showText - The text that appears in the show button. This can contain HTML.
|
||||
* @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
|
||||
* @prop {string} addText - The text that appears in the add button. This can contain HTML.
|
||||
* @prop {string} editText - The text that appears in the edit button. This can contain HTML.
|
||||
* @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
|
||||
* @prop {string} viewText - The text that appears in the view button. This can contain HTML.
|
||||
* @prop {boolean} allowAdd - Whether or not to show the Add Row button.
|
||||
* @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
|
||||
* @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
|
||||
* @prop {boolean} allowView - Whether or not to show the View Row button.
|
||||
* @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
|
||||
* @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
|
||||
* @prop {string} column.name="editing" - The name of the column.
|
||||
* @prop {string} column.title="" - The title displayed in the header row of the table for the column.
|
||||
* @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
|
||||
* @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
|
||||
*/
|
||||
F.Defaults.prototype.editing = {
|
||||
enabled: false,
|
||||
pageToNew: true,
|
||||
position: 'right',
|
||||
alwaysShow: false,
|
||||
addRow: function(){},
|
||||
editRow: function(row){},
|
||||
deleteRow: function(row){},
|
||||
viewRow: function(row){},
|
||||
showText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span> Edit rows',
|
||||
hideText: 'Cancel',
|
||||
addText: 'New row',
|
||||
editText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span>',
|
||||
deleteText: '<span class="fooicon fooicon-trash" aria-hidden="true"></span>',
|
||||
viewText: '<span class="fooicon fooicon-stats" aria-hidden="true"></span>',
|
||||
allowAdd: true,
|
||||
allowEdit: true,
|
||||
allowDelete: true,
|
||||
allowView: false,
|
||||
column: {
|
||||
classes: 'footable-editing',
|
||||
name: 'editing',
|
||||
title: '',
|
||||
filterable: false,
|
||||
sortable: false
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, FooTable);
|
||||
|
||||
(function($, F){
|
||||
|
||||
if (F.is.defined(F.Paging)){
|
||||
/**
|
||||
* Holds a shallow clone of the un-paged {@link FooTable.Rows#array} value before paging occurs and superfluous rows are removed. Added by the {@link FooTable.Editing} component.
|
||||
* @instance
|
||||
* @public
|
||||
* @type {Array<FooTable.Row>}
|
||||
*/
|
||||
F.Paging.prototype.unpaged = [];
|
||||
|
||||
// override the default predraw method with one that sets the unpaged property.
|
||||
F.Paging.extend('predraw', function(){
|
||||
this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
|
||||
this._super(); // call the original method
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function($, F){
|
||||
|
||||
/**
|
||||
* Adds the row to the table.
|
||||
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
|
||||
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
|
||||
* @returns {jQuery.Deferred}
|
||||
*/
|
||||
F.Row.prototype.add = function(redraw){
|
||||
redraw = F.is.boolean(redraw) ? redraw : true;
|
||||
var self = this;
|
||||
return $.Deferred(function(d){
|
||||
var index = self.ft.rows.all.push(self) - 1;
|
||||
if (redraw){
|
||||
return self.ft.draw().then(function(){
|
||||
d.resolve(index);
|
||||
});
|
||||
} else {
|
||||
d.resolve(index);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the row from the table.
|
||||
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
|
||||
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
|
||||
* @returns {jQuery.Deferred}
|
||||
*/
|
||||
F.Row.prototype.delete = function(redraw){
|
||||
redraw = F.is.boolean(redraw) ? redraw : true;
|
||||
var self = this;
|
||||
return $.Deferred(function(d){
|
||||
var index = self.ft.rows.all.indexOf(self);
|
||||
if (F.is.number(index) && index >= 0 && index < self.ft.rows.all.length){
|
||||
self.ft.rows.all.splice(index, 1);
|
||||
if (redraw){
|
||||
return self.ft.draw().then(function(){
|
||||
d.resolve(self);
|
||||
});
|
||||
}
|
||||
}
|
||||
d.resolve(self);
|
||||
});
|
||||
};
|
||||
|
||||
if (F.is.defined(F.Paging)){
|
||||
// override the default add method with one that supports paging
|
||||
F.Row.extend('add', function(redraw){
|
||||
redraw = F.is.boolean(redraw) ? redraw : true;
|
||||
var self = this,
|
||||
added = this._super(redraw),
|
||||
editing = self.ft.use(F.Editing),
|
||||
paging;
|
||||
if (editing && editing.pageToNew && (paging = self.ft.use(F.Paging)) && redraw){
|
||||
return added.then(function(){
|
||||
var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
|
||||
var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
|
||||
if (paging.current !== page){ // goto the page if we need to
|
||||
return paging.goto(page);
|
||||
}
|
||||
});
|
||||
}
|
||||
return added;
|
||||
});
|
||||
}
|
||||
|
||||
if (F.is.defined(F.Sorting)){
|
||||
// override the default val method with one that supports sorting and paging
|
||||
F.Row.extend('val', function(data, redraw){
|
||||
redraw = F.is.boolean(redraw) ? redraw : true;
|
||||
var result = this._super(data);
|
||||
if (!F.is.hash(data)){
|
||||
return result;
|
||||
}
|
||||
var self = this;
|
||||
if (redraw){
|
||||
self.ft.draw().then(function(){
|
||||
var editing = self.ft.use(F.Editing), paging;
|
||||
if (F.is.defined(F.Paging) && editing && editing.pageToNew && (paging = self.ft.use(F.Paging))){
|
||||
var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
|
||||
var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
|
||||
if (paging.current !== page){ // goto the page if we need to
|
||||
return paging.goto(page);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
|
||||
/**
|
||||
* Adds a row to the underlying {@link FooTable.Rows#all} array.
|
||||
* @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
|
||||
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
|
||||
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
|
||||
*/
|
||||
F.Rows.prototype.add = function(dataOrRow, redraw){
|
||||
var row = dataOrRow;
|
||||
if (F.is.hash(dataOrRow)){
|
||||
row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
|
||||
}
|
||||
if (row instanceof FooTable.Row){
|
||||
row.add(redraw);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates a row in the underlying {@link FooTable.Rows#all} array.
|
||||
* @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
|
||||
* @param {object} data - A hash containing the new row values.
|
||||
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
|
||||
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
|
||||
*/
|
||||
F.Rows.prototype.update = function(indexOrRow, data, redraw){
|
||||
var len = this.ft.rows.all.length,
|
||||
row = indexOrRow;
|
||||
if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
|
||||
row = this.ft.rows.all[indexOrRow];
|
||||
}
|
||||
if (row instanceof FooTable.Row && F.is.hash(data)){
|
||||
row.val(data, redraw);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Deletes a row from the underlying {@link FooTable.Rows#all} array.
|
||||
* @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
|
||||
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
|
||||
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
|
||||
*/
|
||||
F.Rows.prototype.delete = function(indexOrRow, redraw){
|
||||
var len = this.ft.rows.all.length,
|
||||
row = indexOrRow;
|
||||
if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
|
||||
row = this.ft.rows.all[indexOrRow];
|
||||
}
|
||||
if (row instanceof FooTable.Row){
|
||||
row.delete(redraw);
|
||||
}
|
||||
};
|
||||
|
||||
})(FooTable);
|
8
admin/custom/footable3/js/footable.editing.min.js
vendored
Normal file
8
admin/custom/footable3/js/footable.editing.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,435 +1,490 @@
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.0.6
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
(function($, F){
|
||||
|
||||
F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
|
||||
/**
|
||||
* The sorter object contains the column and direction to sort by.
|
||||
* @constructs
|
||||
* @extends FooTable.Class
|
||||
* @param {FooTable.Column} column - The column to sort.
|
||||
* @param {string} direction - The direction to sort by.
|
||||
* @returns {FooTable.Sorter}
|
||||
*/
|
||||
construct: function(column, direction){
|
||||
/**
|
||||
* The column to sort.
|
||||
* @type {FooTable.Column}
|
||||
*/
|
||||
this.column = column;
|
||||
/**
|
||||
* The direction to sort by.
|
||||
* @type {string}
|
||||
*/
|
||||
this.direction = direction;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function ($, F) {
|
||||
F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
|
||||
/**
|
||||
* The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
|
||||
* @constructs
|
||||
* @extends FooTable.Component
|
||||
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
|
||||
* @returns {FooTable.Sorting}
|
||||
*/
|
||||
construct: function (table) {
|
||||
// call the constructor of the base class
|
||||
this._super(table, table.o.sorting.enabled);
|
||||
|
||||
/* PROTECTED */
|
||||
/**
|
||||
* This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
|
||||
* @instance
|
||||
* @protected
|
||||
* @type {object}
|
||||
*/
|
||||
this.o = table.o.sorting;
|
||||
/**
|
||||
* The current sorted column.
|
||||
* @instance
|
||||
* @type {FooTable.Column}
|
||||
*/
|
||||
this.column = null;
|
||||
|
||||
/* PRIVATE */
|
||||
/**
|
||||
* Sets a flag indicating whether or not the sorting has changed. When set to true the {@link FooTable.Sorting#sorting_changing} and {@link FooTable.Sorting#sorting_changed} events
|
||||
* will be raised during the drawing operation.
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this._changed = false;
|
||||
},
|
||||
|
||||
/* PROTECTED */
|
||||
/**
|
||||
* Checks the supplied data and options for the sorting component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @param {object} data - The jQuery data object from the parent table.
|
||||
* @fires FooTable.Sorting#"preinit.ft.sorting"
|
||||
* @this FooTable.Sorting
|
||||
*/
|
||||
preinit: function(data){
|
||||
var self = this;
|
||||
/**
|
||||
* The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Sorting#"preinit.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {object} data - The jQuery data object of the table raising the event.
|
||||
*/
|
||||
this.ft.raise('preinit.ft.sorting', [data]).then(function(){
|
||||
if (self.ft.$el.hasClass('footable-sorting'))
|
||||
self.enabled = true;
|
||||
self.enabled = F.is.boolean(data.sorting)
|
||||
? data.sorting
|
||||
: self.enabled;
|
||||
if (!self.enabled) return;
|
||||
self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Initializes the sorting component for the plugin using the supplied table and options.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Sorting#"init.ft.sorting"
|
||||
* @this FooTable.Sorting
|
||||
*/
|
||||
init: function () {
|
||||
/**
|
||||
* The init.ft.sorting event is raised before its UI is generated.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Sorting#"init.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('init.ft.sorting').then(function(){
|
||||
F.arr.each(self.ft.columns.array, function(col){
|
||||
if (col.sortable){
|
||||
col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
|
||||
}
|
||||
});
|
||||
self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Destroys the sorting component removing any UI generated from the table.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Sorting#"destroy.ft.sorting"
|
||||
*/
|
||||
destroy: function () {
|
||||
/**
|
||||
* The destroy.ft.sorting event is raised before its UI is removed.
|
||||
* Calling preventDefault on this event will prevent the component from being destroyed.
|
||||
* @event FooTable.Sorting#"destroy.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('destroy.ft.paging').then(function(){
|
||||
self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
|
||||
self.ft.$el.children('thead').children('tr.footable-header')
|
||||
.children('.footable-sortable').removeClass('footable-sortable')
|
||||
.find('span.fooicon').remove();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Performs the actual sorting against the {@link FooTable.Rows#current} array.
|
||||
* @instance
|
||||
* @protected
|
||||
*/
|
||||
predraw: function () {
|
||||
if (!this.column) return;
|
||||
var self = this, col = self.column;
|
||||
//self.ft.rows.array.sort(function (a, b) {
|
||||
// return col.direction == 'ASC'
|
||||
// ? col.sorter(a.cells[col.index].value, b.cells[col.index].value)
|
||||
// : col.sorter(b.cells[col.index].value, a.cells[col.index].value);
|
||||
//});
|
||||
self.ft.rows.array.sort(function (a, b) {
|
||||
return col.direction == 'ASC'
|
||||
? col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue)
|
||||
: col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Updates the sorting UI setting the state of the sort buttons.
|
||||
* @instance
|
||||
* @protected
|
||||
*/
|
||||
draw: function () {
|
||||
if (!this.column) return;
|
||||
var self = this,
|
||||
$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
|
||||
$active = self.column.$el;
|
||||
|
||||
$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
|
||||
$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
|
||||
$active.addClass(self.column.direction == 'ASC' ? 'footable-asc' : 'footable-desc')
|
||||
.children('.fooicon').addClass(self.column.direction == 'ASC' ? 'fooicon-sort-asc' : 'fooicon-sort-desc');
|
||||
},
|
||||
|
||||
/* PUBLIC */
|
||||
/**
|
||||
* Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
|
||||
* @instance
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"before.ft.sorting"
|
||||
* @fires FooTable.Sorting#"after.ft.sorting"
|
||||
*/
|
||||
sort: function(column, direction){
|
||||
return this._sort(column, direction);
|
||||
},
|
||||
|
||||
/* PRIVATE */
|
||||
/**
|
||||
* Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"before.ft.sorting"
|
||||
* @fires FooTable.Sorting#"after.ft.sorting"
|
||||
*/
|
||||
_sort: function(column, direction){
|
||||
var self = this;
|
||||
var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
|
||||
/**
|
||||
* The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
|
||||
* @event FooTable.Sorting#"before.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
|
||||
*/
|
||||
return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
|
||||
F.arr.each(self.ft.columns.array, function(col){
|
||||
if (col != self.column) col.direction = null;
|
||||
});
|
||||
self.column = self.ft.columns.get(sorter.column);
|
||||
if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
|
||||
return self.ft.draw().then(function(){
|
||||
/**
|
||||
* The after.ft.sorting event is raised after a sorter has been applied.
|
||||
* @event FooTable.Sorting#"after.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Sorter} sorter - The sorter that has been applied.
|
||||
*/
|
||||
self.ft.raise('after.ft.sorting', [sorter]);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handles the sort button clicked event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The event object for the event.
|
||||
*/
|
||||
_onSortClicked: function (e) {
|
||||
e.preventDefault();
|
||||
var self = e.data.self, $header = $(this).closest('th,td'),
|
||||
direction = $header.is('.footable-asc, .footable-desc')
|
||||
? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
|
||||
: 'ASC';
|
||||
self._sort($header.index(), direction);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks the supplied string is a valid direction and if not returns ASC as default.
|
||||
* @static
|
||||
* @protected
|
||||
* @param {string} str - The string to check.
|
||||
*/
|
||||
F.Sorting.dir = function(str){
|
||||
return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
|
||||
};
|
||||
|
||||
F.components.core.register('sorting', F.Sorting, 5);
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
|
||||
/**
|
||||
* The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
|
||||
* If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {string}
|
||||
* @default null
|
||||
*/
|
||||
F.Cell.prototype.sortValue = null;
|
||||
|
||||
// this is used to define the sorting specific properties on cell creation
|
||||
F.Cell.prototype.__sorting_define__ = function(valueOrElement){
|
||||
this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
|
||||
};
|
||||
|
||||
// this is used to update the sortValue property whenever the cell value is changed
|
||||
F.Cell.prototype.__sorting_val__ = function(value){
|
||||
if (F.is.defined(value)){
|
||||
// set only
|
||||
this.sortValue = this.column.sortValue.call(this.column, value);
|
||||
}
|
||||
};
|
||||
|
||||
// overrides the public define method and replaces it with our own
|
||||
F.Cell.extend('define', function(valueOrElement){
|
||||
this._super(valueOrElement);
|
||||
this.__sorting_define__(valueOrElement);
|
||||
});
|
||||
// overrides the public val method and replaces it with our own
|
||||
F.Cell.extend('val', function(value){
|
||||
var val = this._super(value);
|
||||
this.__sorting_val__(value);
|
||||
return val;
|
||||
});
|
||||
})(FooTable);
|
||||
(function($, F){
|
||||
/**
|
||||
* The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {string}
|
||||
* @default null
|
||||
*/
|
||||
F.Column.prototype.direction = null;
|
||||
/**
|
||||
* Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {boolean}
|
||||
* @default true
|
||||
*/
|
||||
F.Column.prototype.sortable = true;
|
||||
/**
|
||||
* Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {boolean}
|
||||
* @default false
|
||||
*/
|
||||
F.Column.prototype.sorted = false;
|
||||
|
||||
/**
|
||||
* This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
|
||||
* @param {*} a - The first value to be compared.
|
||||
* @param {*} b - The second value to compare to the first.
|
||||
* @returns {number}
|
||||
* @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
|
||||
* "sorter": function(a, b){
|
||||
* if (a is less than b by some ordering criterion) {
|
||||
* return -1;
|
||||
* }
|
||||
* if (a is greater than b by the ordering criterion) {
|
||||
* return 1;
|
||||
* }
|
||||
* // a must be equal to b
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
F.Column.prototype.sorter = function(a, b){
|
||||
if (typeof a === 'string') a = a.toLowerCase();
|
||||
if (typeof b === 'string') b = b.toLowerCase();
|
||||
if (a === b) return 0;
|
||||
if (a < b) return -1;
|
||||
return 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
|
||||
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
|
||||
* @returns {*}
|
||||
* @this FooTable.Column
|
||||
*/
|
||||
F.Column.prototype.sortValue = function(valueOrElement){
|
||||
// if we have an element or a jQuery object use jQuery to get the value
|
||||
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) return $(valueOrElement).data('sortValue') || this.parser(valueOrElement);
|
||||
// if options are supplied with the value
|
||||
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
|
||||
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
|
||||
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
|
||||
}
|
||||
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
|
||||
return null;
|
||||
};
|
||||
|
||||
// this is used to define the sorting specific properties on column creation
|
||||
F.Column.prototype.__sorting_define__ = function(definition){
|
||||
this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
|
||||
this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
|
||||
this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
|
||||
this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
|
||||
};
|
||||
|
||||
// overrides the public define method and replaces it with our own
|
||||
F.Column.extend('define', function(definition){
|
||||
this._super(definition);
|
||||
this.__sorting_define__(definition);
|
||||
});
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
/**
|
||||
* An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {object}
|
||||
* @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
|
||||
*/
|
||||
F.Defaults.prototype.sorting = {
|
||||
enabled: false
|
||||
};
|
||||
})(FooTable);
|
||||
(function($, F){
|
||||
|
||||
F.HTMLColumn.extend('__sorting_define__', function(definition){
|
||||
this._super(definition);
|
||||
this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
|
||||
});
|
||||
|
||||
/**
|
||||
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
|
||||
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
|
||||
* @returns {*}
|
||||
* @this FooTable.HTMLColumn
|
||||
*/
|
||||
F.HTMLColumn.prototype.sortValue = function(valueOrElement){
|
||||
// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
|
||||
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
|
||||
return $(valueOrElement).data('sortValue') || $.trim($(valueOrElement)[this.sortUse]());
|
||||
}
|
||||
// if options are supplied with the value
|
||||
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
|
||||
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
|
||||
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
|
||||
}
|
||||
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
|
||||
return null;
|
||||
};
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
/**
|
||||
* Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
|
||||
* @instance
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"change.ft.sorting"
|
||||
* @fires FooTable.Sorting#"changed.ft.sorting"
|
||||
* @see FooTable.Sorting#sort
|
||||
*/
|
||||
F.Table.prototype.sort = function(column, direction){
|
||||
return this.use(F.Sorting).sort(column, direction);
|
||||
};
|
||||
/*
|
||||
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
|
||||
* @version 3.1.4
|
||||
* @link http://fooplugins.com
|
||||
* @copyright Steven Usher & Brad Vincent 2015
|
||||
* @license Released under the GPLv3 license.
|
||||
*/
|
||||
(function($, F){
|
||||
|
||||
F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
|
||||
/**
|
||||
* The sorter object contains the column and direction to sort by.
|
||||
* @constructs
|
||||
* @extends FooTable.Class
|
||||
* @param {FooTable.Column} column - The column to sort.
|
||||
* @param {string} direction - The direction to sort by.
|
||||
* @returns {FooTable.Sorter}
|
||||
*/
|
||||
construct: function(column, direction){
|
||||
/**
|
||||
* The column to sort.
|
||||
* @type {FooTable.Column}
|
||||
*/
|
||||
this.column = column;
|
||||
/**
|
||||
* The direction to sort by.
|
||||
* @type {string}
|
||||
*/
|
||||
this.direction = direction;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function ($, F) {
|
||||
F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
|
||||
/**
|
||||
* The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
|
||||
* @constructs
|
||||
* @extends FooTable.Component
|
||||
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
|
||||
* @returns {FooTable.Sorting}
|
||||
*/
|
||||
construct: function (table) {
|
||||
// call the constructor of the base class
|
||||
this._super(table, table.o.sorting.enabled);
|
||||
|
||||
/* PROTECTED */
|
||||
/**
|
||||
* This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
|
||||
* @instance
|
||||
* @protected
|
||||
* @type {object}
|
||||
*/
|
||||
this.o = table.o.sorting;
|
||||
/**
|
||||
* The current sorted column.
|
||||
* @instance
|
||||
* @type {FooTable.Column}
|
||||
*/
|
||||
this.column = null;
|
||||
/**
|
||||
* Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
|
||||
* @instance
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.allowed = true;
|
||||
/**
|
||||
* The initial sort state of the table, this value is used for determining if the sorting has occurred or to reset the state to default.
|
||||
* @instance
|
||||
* @type {{isset: boolean, rows: Array.<FooTable.Row>, column: string, direction: ?string}}
|
||||
*/
|
||||
this.initial = null;
|
||||
},
|
||||
|
||||
/* PROTECTED */
|
||||
/**
|
||||
* Checks the supplied data and options for the sorting component.
|
||||
* @instance
|
||||
* @protected
|
||||
* @param {object} data - The jQuery data object from the parent table.
|
||||
* @fires FooTable.Sorting#"preinit.ft.sorting"
|
||||
* @this FooTable.Sorting
|
||||
*/
|
||||
preinit: function(data){
|
||||
var self = this;
|
||||
/**
|
||||
* The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Sorting#"preinit.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {object} data - The jQuery data object of the table raising the event.
|
||||
*/
|
||||
this.ft.raise('preinit.ft.sorting', [data]).then(function(){
|
||||
if (self.ft.$el.hasClass('footable-sorting'))
|
||||
self.enabled = true;
|
||||
self.enabled = F.is.boolean(data.sorting)
|
||||
? data.sorting
|
||||
: self.enabled;
|
||||
if (!self.enabled) return;
|
||||
self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Initializes the sorting component for the plugin using the supplied table and options.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Sorting#"init.ft.sorting"
|
||||
* @this FooTable.Sorting
|
||||
*/
|
||||
init: function () {
|
||||
/**
|
||||
* The init.ft.sorting event is raised before its UI is generated.
|
||||
* Calling preventDefault on this event will disable the component.
|
||||
* @event FooTable.Sorting#"init.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('init.ft.sorting').then(function(){
|
||||
if (!self.initial){
|
||||
var isset = !!self.column;
|
||||
self.initial = {
|
||||
isset: isset,
|
||||
// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
|
||||
rows: self.ft.rows.all.slice(0),
|
||||
// if there is a sorted column store its name and direction
|
||||
column: isset ? self.column.name : null,
|
||||
direction: isset ? self.column.direction : null
|
||||
}
|
||||
}
|
||||
F.arr.each(self.ft.columns.array, function(col){
|
||||
if (col.sortable){
|
||||
col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
|
||||
}
|
||||
});
|
||||
self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
|
||||
}, function(){
|
||||
self.enabled = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Destroys the sorting component removing any UI generated from the table.
|
||||
* @instance
|
||||
* @protected
|
||||
* @fires FooTable.Sorting#"destroy.ft.sorting"
|
||||
*/
|
||||
destroy: function () {
|
||||
/**
|
||||
* The destroy.ft.sorting event is raised before its UI is removed.
|
||||
* Calling preventDefault on this event will prevent the component from being destroyed.
|
||||
* @event FooTable.Sorting#"destroy.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
*/
|
||||
var self = this;
|
||||
this.ft.raise('destroy.ft.paging').then(function(){
|
||||
self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
|
||||
self.ft.$el.children('thead').children('tr.footable-header')
|
||||
.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
|
||||
.find('span.fooicon').remove();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Performs the actual sorting against the {@link FooTable.Rows#current} array.
|
||||
* @instance
|
||||
* @protected
|
||||
*/
|
||||
predraw: function () {
|
||||
if (!this.column) return;
|
||||
var self = this, col = self.column;
|
||||
self.ft.rows.array.sort(function (a, b) {
|
||||
return col.direction == 'DESC'
|
||||
? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
|
||||
: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Updates the sorting UI setting the state of the sort buttons.
|
||||
* @instance
|
||||
* @protected
|
||||
*/
|
||||
draw: function () {
|
||||
if (!this.column) return;
|
||||
var self = this,
|
||||
$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
|
||||
$active = self.column.$el;
|
||||
|
||||
$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
|
||||
$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
|
||||
$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
|
||||
.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
|
||||
},
|
||||
|
||||
/* PUBLIC */
|
||||
/**
|
||||
* Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
|
||||
* @instance
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"before.ft.sorting"
|
||||
* @fires FooTable.Sorting#"after.ft.sorting"
|
||||
*/
|
||||
sort: function(column, direction){
|
||||
return this._sort(column, direction);
|
||||
},
|
||||
/**
|
||||
* Toggles whether or not sorting is currently allowed.
|
||||
* @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
|
||||
*/
|
||||
toggleAllowed: function(state){
|
||||
state = F.is.boolean(state) ? state : !this.allowed;
|
||||
this.allowed = state;
|
||||
this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
|
||||
},
|
||||
/**
|
||||
* Checks whether any sorting has occurred for the table.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasChanged: function(){
|
||||
return !(!this.initial || !this.column ||
|
||||
(this.column.name === this.initial.column &&
|
||||
(this.column.direction === this.initial.direction || (this.initial.direction === null && this.column.direction === 'ASC')))
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Resets the table sorting to the initial state recorded in the components init method.
|
||||
*/
|
||||
reset: function(){
|
||||
if (!!this.initial){
|
||||
if (this.initial.isset){
|
||||
// if the initial value specified a column, sort by it
|
||||
this.sort(this.initial.column, this.initial.direction);
|
||||
} else {
|
||||
// if there was no initial column then we need to reset the rows to there original order
|
||||
if (!!this.column){
|
||||
// if there is a currently sorted column remove the asc/desc classes and set it to null.
|
||||
this.column.$el.removeClass('footable-asc footable-desc');
|
||||
this.column = null;
|
||||
}
|
||||
// replace the current all rows array with the one stored in the initial value
|
||||
this.ft.rows.all = this.initial.rows;
|
||||
// force the table to redraw itself using the updated rows array
|
||||
this.ft.draw();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* PRIVATE */
|
||||
/**
|
||||
* Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"before.ft.sorting"
|
||||
* @fires FooTable.Sorting#"after.ft.sorting"
|
||||
*/
|
||||
_sort: function(column, direction){
|
||||
if (!this.allowed) return $.Deferred().reject('sorting disabled');
|
||||
var self = this;
|
||||
var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
|
||||
/**
|
||||
* The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
|
||||
* @event FooTable.Sorting#"before.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
|
||||
*/
|
||||
return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
|
||||
F.arr.each(self.ft.columns.array, function(col){
|
||||
if (col != self.column) col.direction = null;
|
||||
});
|
||||
self.column = self.ft.columns.get(sorter.column);
|
||||
if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
|
||||
return self.ft.draw().then(function(){
|
||||
/**
|
||||
* The after.ft.sorting event is raised after a sorter has been applied.
|
||||
* @event FooTable.Sorting#"after.ft.sorting"
|
||||
* @param {jQuery.Event} e - The jQuery.Event object for the event.
|
||||
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
|
||||
* @param {FooTable.Sorter} sorter - The sorter that has been applied.
|
||||
*/
|
||||
self.ft.raise('after.ft.sorting', [sorter]);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handles the sort button clicked event.
|
||||
* @instance
|
||||
* @private
|
||||
* @param {jQuery.Event} e - The event object for the event.
|
||||
*/
|
||||
_onSortClicked: function (e) {
|
||||
var self = e.data.self, $header = $(this).closest('th,td'),
|
||||
direction = $header.is('.footable-asc, .footable-desc')
|
||||
? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
|
||||
: 'ASC';
|
||||
self._sort($header.index(), direction);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks the supplied string is a valid direction and if not returns ASC as default.
|
||||
* @static
|
||||
* @protected
|
||||
* @param {string} str - The string to check.
|
||||
*/
|
||||
F.Sorting.dir = function(str){
|
||||
return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
|
||||
};
|
||||
|
||||
F.components.register('sorting', F.Sorting, 600);
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
|
||||
/**
|
||||
* The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
|
||||
* If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {string}
|
||||
* @default null
|
||||
*/
|
||||
F.Cell.prototype.sortValue = null;
|
||||
|
||||
// this is used to define the sorting specific properties on cell creation
|
||||
F.Cell.prototype.__sorting_define__ = function(valueOrElement){
|
||||
this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
|
||||
};
|
||||
|
||||
// this is used to update the sortValue property whenever the cell value is changed
|
||||
F.Cell.prototype.__sorting_val__ = function(value){
|
||||
if (F.is.defined(value)){
|
||||
// set only
|
||||
this.sortValue = this.column.sortValue.call(this.column, value);
|
||||
}
|
||||
};
|
||||
|
||||
// overrides the public define method and replaces it with our own
|
||||
F.Cell.extend('define', function(valueOrElement){
|
||||
this._super(valueOrElement);
|
||||
this.__sorting_define__(valueOrElement);
|
||||
});
|
||||
// overrides the public val method and replaces it with our own
|
||||
F.Cell.extend('val', function(value){
|
||||
var val = this._super(value);
|
||||
this.__sorting_val__(value);
|
||||
return val;
|
||||
});
|
||||
})(FooTable);
|
||||
(function($, F){
|
||||
/**
|
||||
* The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {string}
|
||||
* @default null
|
||||
*/
|
||||
F.Column.prototype.direction = null;
|
||||
/**
|
||||
* Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {boolean}
|
||||
* @default true
|
||||
*/
|
||||
F.Column.prototype.sortable = true;
|
||||
/**
|
||||
* Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {boolean}
|
||||
* @default false
|
||||
*/
|
||||
F.Column.prototype.sorted = false;
|
||||
|
||||
/**
|
||||
* This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
|
||||
* @param {*} a - The first value to be compared.
|
||||
* @param {*} b - The second value to compare to the first.
|
||||
* @returns {number}
|
||||
* @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
|
||||
* "sorter": function(a, b){
|
||||
* if (a is less than b by some ordering criterion) {
|
||||
* return -1;
|
||||
* }
|
||||
* if (a is greater than b by the ordering criterion) {
|
||||
* return 1;
|
||||
* }
|
||||
* // a must be equal to b
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
F.Column.prototype.sorter = function(a, b){
|
||||
if (typeof a === 'string') a = a.toLowerCase();
|
||||
if (typeof b === 'string') b = b.toLowerCase();
|
||||
if (a === b) return 0;
|
||||
if (a < b) return -1;
|
||||
return 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
|
||||
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
|
||||
* @returns {*}
|
||||
* @this FooTable.Column
|
||||
*/
|
||||
F.Column.prototype.sortValue = function(valueOrElement){
|
||||
// if we have an element or a jQuery object use jQuery to get the value
|
||||
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
|
||||
var data = $(valueOrElement).data('sortValue');
|
||||
return F.is.defined(data) ? data : this.parser(valueOrElement);
|
||||
}
|
||||
// if options are supplied with the value
|
||||
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
|
||||
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
|
||||
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
|
||||
}
|
||||
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
|
||||
return null;
|
||||
};
|
||||
|
||||
// this is used to define the sorting specific properties on column creation
|
||||
F.Column.prototype.__sorting_define__ = function(definition){
|
||||
this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
|
||||
this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
|
||||
this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
|
||||
this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
|
||||
this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
|
||||
};
|
||||
|
||||
// overrides the public define method and replaces it with our own
|
||||
F.Column.extend('define', function(definition){
|
||||
this._super(definition);
|
||||
this.__sorting_define__(definition);
|
||||
});
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
/**
|
||||
* An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
|
||||
* @type {object}
|
||||
* @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
|
||||
*/
|
||||
F.Defaults.prototype.sorting = {
|
||||
enabled: false
|
||||
};
|
||||
})(FooTable);
|
||||
(function($, F){
|
||||
|
||||
F.HTMLColumn.extend('__sorting_define__', function(definition){
|
||||
this._super(definition);
|
||||
this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
|
||||
});
|
||||
|
||||
/**
|
||||
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
|
||||
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
|
||||
* @returns {*}
|
||||
* @this FooTable.HTMLColumn
|
||||
*/
|
||||
F.HTMLColumn.prototype.sortValue = function(valueOrElement){
|
||||
// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
|
||||
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
|
||||
var data = $(valueOrElement).data('sortValue');
|
||||
return F.is.defined(data) ? data : $.trim($(valueOrElement)[this.sortUse]());
|
||||
}
|
||||
// if options are supplied with the value
|
||||
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
|
||||
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
|
||||
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
|
||||
}
|
||||
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
|
||||
return null;
|
||||
};
|
||||
|
||||
})(jQuery, FooTable);
|
||||
(function(F){
|
||||
/**
|
||||
* Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
|
||||
* @instance
|
||||
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
|
||||
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
|
||||
* @returns {jQuery.Promise}
|
||||
* @fires FooTable.Sorting#"change.ft.sorting"
|
||||
* @fires FooTable.Sorting#"changed.ft.sorting"
|
||||
* @see FooTable.Sorting#sort
|
||||
*/
|
||||
F.Table.prototype.sort = function(column, direction){
|
||||
return this.use(F.Sorting).sort(column, direction);
|
||||
};
|
||||
})(FooTable);
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user