From 5168e0ef240e3240871980b5474a8093e85c95fc Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 6 Jan 2021 15:56:35 +0200 Subject: [PATCH] Updated with JCB v2.12.4 --- README.md | 45 ++++- admin/README.txt | 45 ++++- admin/assets/css/admin.css | 2 +- admin/assets/css/dashboard.css | 2 +- admin/assets/css/help_document.css | 2 +- admin/assets/css/help_documents.css | 2 +- admin/assets/css/question_and_answer.css | 2 +- admin/assets/css/questions_and_answers.css | 2 +- admin/assets/js/admin.js | 2 +- admin/controller.php | 2 +- admin/controllers/ajax.json.php | 2 +- admin/controllers/download.php | 2 +- admin/controllers/help.php | 2 +- admin/controllers/help_document.php | 2 +- admin/controllers/help_documents.php | 4 +- admin/controllers/import.php | 2 +- admin/controllers/question_and_answer.php | 2 +- admin/controllers/questions_and_answers.php | 4 +- admin/controllers/questionsanswers.php | 2 +- admin/helpers/headercheck.php | 2 +- admin/helpers/html/batch_.php | 2 +- admin/helpers/questionsanswers.php | 132 ++++++++++----- .../en-GB/en-GB.com_questionsanswers.ini | 5 +- admin/layouts/batchselection.php | 2 +- admin/layouts/help_document/details_above.php | 2 +- .../help_document/details_fullwidth.php | 2 +- admin/layouts/help_document/details_left.php | 2 +- admin/layouts/help_document/details_right.php | 2 +- admin/layouts/help_document/details_under.php | 2 +- admin/layouts/help_document/publishing.php | 2 +- admin/layouts/help_document/publlshing.php | 2 +- .../question_and_answer/details_fullwidth.php | 2 +- .../question_and_answer/details_rightside.php | 2 +- .../question_and_answer/details_under.php | 2 +- .../layouts/question_and_answer/metadata.php | 2 +- .../question_and_answer/publishing.php | 3 +- admin/models/ajax.php | 2 +- admin/models/fields/adminviewfolderlist.php | 2 +- .../models/fields/alloweddocumentformats.php | 2 +- admin/models/fields/allowedimageformats.php | 2 +- admin/models/fields/articles.php | 2 +- admin/models/fields/siteviewfolderlist.php | 2 +- admin/models/forms/help_document.js | 2 +- admin/models/forms/question_and_answer.js | 2 +- admin/models/forms/question_and_answer.xml | 8 + admin/models/help_document.php | 8 +- admin/models/help_documents.php | 156 ++++++++++++----- admin/models/import.php | 12 +- admin/models/question_and_answer.php | 6 +- admin/models/questions_and_answers.php | 112 ++++++++----- admin/models/questionsanswers.php | 46 +++-- admin/questionsanswers.php | 3 +- admin/sql/install.mysql.utf8.sql | 10 -- admin/sql/uninstall.mysql.utf8.sql | 1 + admin/tables/help_document.php | 2 +- admin/tables/question_and_answer.php | 2 +- admin/views/help_document/submitbutton.js | 2 +- admin/views/help_document/tmpl/edit.php | 31 +--- admin/views/help_document/view.html.php | 2 +- admin/views/help_documents/tmpl/default.php | 129 +++++++------- .../tmpl/default_batch_body.php | 4 +- .../tmpl/default_batch_footer.php | 4 +- .../help_documents/tmpl/default_body.php | 11 +- .../help_documents/tmpl/default_foot.php | 2 +- .../help_documents/tmpl/default_head.php | 4 +- .../help_documents/tmpl/default_toolbar.php | 2 +- admin/views/help_documents/view.html.php | 157 ++++++++---------- admin/views/import/tmpl/default.php | 2 +- admin/views/import/view.html.php | 2 +- .../views/question_and_answer/submitbutton.js | 2 +- admin/views/question_and_answer/tmpl/edit.php | 16 +- admin/views/question_and_answer/view.html.php | 2 +- .../questions_and_answers/tmpl/default.php | 129 +++++++------- .../tmpl/default_batch_body.php | 4 +- .../tmpl/default_batch_footer.php | 4 +- .../tmpl/default_body.php | 11 +- .../tmpl/default_foot.php | 2 +- .../tmpl/default_head.php | 4 +- .../tmpl/default_toolbar.php | 2 +- .../views/questions_and_answers/view.html.php | 75 +++++---- admin/views/questionsanswers/tmpl/default.php | 2 +- .../questionsanswers/tmpl/default_main.php | 2 +- .../tmpl/default_readme_information.php | 2 +- ...t_vast_development_method_notice_board.php | 2 +- .../questionsanswers/tmpl/default_vdm.php | 2 +- admin/views/questionsanswers/view.html.php | 2 +- media/css/A4.print.css | 2 +- questionsanswers.xml | 2 +- script.php | 67 ++++++-- site/assets/css/category.css | 2 +- site/assets/css/downloads.css | 2 +- site/assets/css/question_and_answer.css | 2 +- site/assets/css/questions_and_answers.css | 2 +- site/assets/css/site.css | 2 +- site/assets/js/site.js | 2 +- site/controller.php | 2 +- site/controllers/ajax.json.php | 2 +- site/controllers/download.php | 2 +- site/controllers/help.php | 2 +- site/controllers/question_and_answer.php | 2 +- site/helpers/category.php | 2 +- site/helpers/categoryquestion_and_answer.php | 2 +- site/helpers/headercheck.php | 2 +- site/helpers/questionsanswers.php | 77 ++++++--- site/helpers/route.php | 2 +- .../en-GB/en-GB.com_questionsanswers.ini | 2 + .../question_and_answer/details_fullwidth.php | 2 +- .../question_and_answer/details_rightside.php | 2 +- .../question_and_answer/details_under.php | 2 +- site/layouts/question_and_answer/metadata.php | 2 +- .../question_and_answer/publishing.php | 3 +- site/models/ajax.php | 2 +- site/models/category.php | 2 +- site/models/downloads.php | 2 +- site/models/forms/question_and_answer.js | 2 +- site/models/forms/question_and_answer.xml | 8 + site/models/question_and_answer.php | 6 +- site/models/questions_and_answers.php | 2 +- site/questionsanswers.php | 5 +- site/router.php | 2 +- site/views/category/tmpl/default.php | 3 +- .../views/category/tmpl/default_qna-table.php | 2 +- site/views/category/view.html.php | 4 +- site/views/downloads/tmpl/default.php | 3 +- .../tmpl/default_qna-downloads-table.php | 2 +- site/views/downloads/view.html.php | 4 +- .../views/question_and_answer/submitbutton.js | 2 +- site/views/question_and_answer/tmpl/edit.php | 25 +-- site/views/question_and_answer/view.html.php | 7 +- .../questions_and_answers/tmpl/default.php | 3 +- .../tmpl/default_qna-table.php | 2 +- .../views/questions_and_answers/view.html.php | 4 +- 132 files changed, 920 insertions(+), 656 deletions(-) diff --git a/README.md b/README.md index c2cf1a4..86dae51 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a [Joomla 3.x](http://www.joomla.org/) component. - ![Questions and Answers image](https://raw.githubusercontent.com/vdm-io/Joomla-Questions-and-Answers/master/admin/assets/images/vdm-component.jpg "The Questions and Answers") + ![Questions and Answers image](https://github.com/Llewellynvdm/Joomla-Questions-and-Answers/raw/master/admin/assets/images/vdm-component.jpg "The Questions and Answers") Just a basic Questions & Answers. @@ -12,23 +12,52 @@ Just a basic Questions & Answers. + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Questions and Answers](https://www.vdm.io/) + *First Build*: 30th January, 2017 -+ *Last Build*: 30th May, 2020 ++ *Last Build*: 6th January, 2021 + *Version*: 1.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html # Component Number -+ *Line count*: **30682** ++ *Line count*: **30948** + *File count*: **202** + *Folder count*: **63** > 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) -## Donations + +## Contributors +This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder). -If you want to support this project, please consider donating: -* PayPal: [paypal.me/asseblief](https://www.paypal.me/asseblief) -* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf -* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 \ No newline at end of file +[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors) + +### Backers +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)] + +[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers) + +### Sponsors +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)] + +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website) \ No newline at end of file diff --git a/admin/README.txt b/admin/README.txt index c2cf1a4..86dae51 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -2,7 +2,7 @@ This is a [Joomla 3.x](http://www.joomla.org/) component. - ![Questions and Answers image](https://raw.githubusercontent.com/vdm-io/Joomla-Questions-and-Answers/master/admin/assets/images/vdm-component.jpg "The Questions and Answers") + ![Questions and Answers image](https://github.com/Llewellynvdm/Joomla-Questions-and-Answers/raw/master/admin/assets/images/vdm-component.jpg "The Questions and Answers") Just a basic Questions & Answers. @@ -12,23 +12,52 @@ Just a basic Questions & Answers. + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Questions and Answers](https://www.vdm.io/) + *First Build*: 30th January, 2017 -+ *Last Build*: 30th May, 2020 ++ *Last Build*: 6th January, 2021 + *Version*: 1.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html # Component Number -+ *Line count*: **30682** ++ *Line count*: **30948** + *File count*: **202** + *Folder count*: **63** > 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) -## Donations + +## Contributors +This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder). -If you want to support this project, please consider donating: -* PayPal: [paypal.me/asseblief](https://www.paypal.me/asseblief) -* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf -* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 \ No newline at end of file +[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors) + +### Backers +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)] + +[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers) + +### Sponsors +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)] + +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website) \ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 0a7c3a5..c103554 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage admin.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index dda6a00..f58e817 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage dashboard.css diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index 1592385..295023b 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.css diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index 674ea7d..dbd229e 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_documents.css diff --git a/admin/assets/css/question_and_answer.css b/admin/assets/css/question_and_answer.css index 77ca672..d1a392b 100644 --- a/admin/assets/css/question_and_answer.css +++ b/admin/assets/css/question_and_answer.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.css diff --git a/admin/assets/css/questions_and_answers.css b/admin/assets/css/questions_and_answers.css index 65366d1..cd7e507 100644 --- a/admin/assets/css/questions_and_answers.css +++ b/admin/assets/css/questions_and_answers.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.css diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 5d9239c..c804745 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage admin.js diff --git a/admin/controller.php b/admin/controller.php index e8ba4af..441f39a 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage controller.php diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 899c0df..37e1d27 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.json.php diff --git a/admin/controllers/download.php b/admin/controllers/download.php index e04c93f..864c40e 100644 --- a/admin/controllers/download.php +++ b/admin/controllers/download.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage download.php diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 96a48a9..155ca9e 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help.php diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index f725919..1444ad5 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.php diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index 1458dcf..7e73177 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_documents.php @@ -69,7 +69,7 @@ class QuestionsanswersControllerHelp_documents extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Help_documents'); // get the data to export diff --git a/admin/controllers/import.php b/admin/controllers/import.php index ea924eb..31e9188 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage import.php diff --git a/admin/controllers/question_and_answer.php b/admin/controllers/question_and_answer.php index 5f6c42a..21464d4 100644 --- a/admin/controllers/question_and_answer.php +++ b/admin/controllers/question_and_answer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.php diff --git a/admin/controllers/questions_and_answers.php b/admin/controllers/questions_and_answers.php index 5f0fe26..b28cac1 100644 --- a/admin/controllers/questions_and_answers.php +++ b/admin/controllers/questions_and_answers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.php @@ -69,7 +69,7 @@ class QuestionsanswersControllerQuestions_and_answers extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Questions_and_answers'); // get the data to export diff --git a/admin/controllers/questionsanswers.php b/admin/controllers/questionsanswers.php index 7f56b5a..829dc9f 100644 --- a/admin/controllers/questionsanswers.php +++ b/admin/controllers/questionsanswers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index 95d3ceb..1d6cfef 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage headercheck.php diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 472e45a..bb9512b 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage batch_.php diff --git a/admin/helpers/questionsanswers.php b/admin/helpers/questionsanswers.php index c713385..c628558 100644 --- a/admin/helpers/questionsanswers.php +++ b/admin/helpers/questionsanswers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php @@ -26,8 +26,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\Language\Language; -use Joomla\String\StringHelper; +use Joomla\CMS\Language\Language; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -470,9 +471,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy date */ - public static function fancyDate($date) + public static function fancyDate($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -482,9 +483,9 @@ abstract class QuestionsanswersHelper /** * get date based in period past */ - public static function fancyDynamicDate($date) + public static function fancyDynamicDate($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -508,9 +509,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy day time and date */ - public static function fancyDayTimeDate($time) + public static function fancyDayTimeDate($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -520,9 +521,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy time and date */ - public static function fancyDateTime($time) + public static function fancyDateTime($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -532,9 +533,9 @@ abstract class QuestionsanswersHelper /** * Change to nice hour:minutes time */ - public static function fancyTime($time) + public static function fancyTime($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -544,9 +545,9 @@ abstract class QuestionsanswersHelper /** * set the date day as Sunday through Saturday */ - public static function setDayName($date) + public static function setDayName($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -556,9 +557,9 @@ abstract class QuestionsanswersHelper /** * set the date month as January through December */ - public static function setMonthName($date) + public static function setMonthName($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -568,9 +569,9 @@ abstract class QuestionsanswersHelper /** * set the date day as 1st */ - public static function setDay($date) + public static function setDay($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -580,9 +581,9 @@ abstract class QuestionsanswersHelper /** * set the date month as 5 */ - public static function setMonth($date) + public static function setMonth($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -592,9 +593,9 @@ abstract class QuestionsanswersHelper /** * set the date year as 2004 (for charts) */ - public static function setYear($date) + public static function setYear($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -604,9 +605,9 @@ abstract class QuestionsanswersHelper /** * set the date as 2004/05 (for charts) */ - public static function setYearMonth($date, $spacer = '/') + public static function setYearMonth($date, $spacer = '/', $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -616,15 +617,27 @@ abstract class QuestionsanswersHelper /** * set the date as 2004/05/03 (for charts) */ - public static function setYearMonthDay($date, $spacer = '/') + public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } return date('Y' . $spacer . 'm' . $spacer . 'd', $date); } + /** + * set the date as 03/05/2004 + */ + public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true) + { + if ($check_stamp && !self::isValidTimeStamp($date)) + { + $date = strtotime($date); + } + return date('d' . $spacer . 'm' . $spacer . 'Y', $date); + } + /** * Check if string is a valid time stamp */ @@ -635,6 +648,16 @@ abstract class QuestionsanswersHelper && ($timestamp >= ~PHP_INT_MAX); } + /** + * Check if string is a valid date + * https://www.php.net/manual/en/function.checkdate.php#113205 + */ + public static function isValidateDate($date, $format = 'Y-m-d H:i:s') + { + $d = DateTime::createFromFormat($format, $date); + return $d && $d->format($format) == $date; + } + /** * prepare base64 string for url @@ -2259,6 +2282,8 @@ abstract class QuestionsanswersHelper ->setLastModifiedBy($modified) ->setTitle($title) ->setSubject($subjectTab); + // The file type + $file_type = 'Xls'; // set description if ($description) { @@ -2298,21 +2323,46 @@ abstract class QuestionsanswersHelper )); // Add some data - if (self::checkArray($rows)) + if (($size = self::checkArray($rows)) !== false) { $i = 1; - foreach ($rows as $array){ + + // Based on data size we adapt the behaviour. + $xls_mode = 1; + if ($size > 3000) + { + $xls_mode = 3; + $file_type = 'Csv'; + } + elseif ($size > 2000) + { + $xls_mode = 2; + } + + // Set active sheet and get it. + $active_sheet = $spreadsheet->setActiveSheetIndex(0); + foreach ($rows as $array) + { $a = 'A'; - foreach ($array as $value){ - $spreadsheet->setActiveSheetIndex(0)->setCellValue($a.$i, $value); - if ($i == 1){ - $spreadsheet->getActiveSheet()->getColumnDimension($a)->setAutoSize(true); - $spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($headerStyles); - $spreadsheet->getActiveSheet()->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); - } elseif ($a === 'A'){ - $spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($sideStyles); - } else { - $spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($normalStyles); + foreach ($array as $value) + { + $active_sheet->setCellValue($a.$i, $value); + if ($xls_mode != 3) + { + if ($i == 1) + { + $active_sheet->getColumnDimension($a)->setAutoSize(true); + $active_sheet->getStyle($a.$i)->applyFromArray($headerStyles); + $active_sheet->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); + } + elseif ($a === 'A') + { + $active_sheet->getStyle($a.$i)->applyFromArray($sideStyles); + } + elseif ($xls_mode == 1) + { + $active_sheet->getStyle($a.$i)->applyFromArray($normalStyles); + } } $a++; } @@ -2332,7 +2382,7 @@ abstract class QuestionsanswersHelper // Redirect output to a client's web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); - header('Content-Disposition: attachment;filename="'.$fileName.'.xls"'); + header('Content-Disposition: attachment;filename="' . $fileName . '.' . strtolower($file_type) .'"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); @@ -2343,7 +2393,7 @@ abstract class QuestionsanswersHelper header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 - $writer = IOFactory::createWriter($spreadsheet, 'Xls'); + $writer = IOFactory::createWriter($spreadsheet, $file_type); $writer->save('php://output'); jexit(); } diff --git a/admin/language/en-GB/en-GB.com_questionsanswers.ini b/admin/language/en-GB/en-GB.com_questionsanswers.ini index 1d456ac..40a6b3c 100644 --- a/admin/language/en-GB/en-GB.com_questionsanswers.ini +++ b/admin/language/en-GB/en-GB.com_questionsanswers.ini @@ -122,6 +122,8 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_1="%d Help Document succe COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_MORE="%d Help Documents successfully checked in." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_DELETED="%s Help Documents deleted." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_DELETED_1="%s Help Document deleted." +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_FAILED_PUBLISHING="%s Help Documents failed publishing." +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_FAILED_PUBLISHING_1="%s Help Document failed publishing." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_FEATURED="%s Help Documents featured." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_FEATURED_1="%s Help Document featured." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_PUBLISHED="%s Help Documents published." @@ -168,7 +170,6 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENT_MODIFIED_DATE_LABEL="Modified Date" COM_QUESTIONSANSWERS_HELP_DOCUMENT_NEW="A New Help Document" COM_QUESTIONSANSWERS_HELP_DOCUMENT_NOT_REQUIRED="Not Required" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ORDERING_LABEL="Ordering" -COM_QUESTIONSANSWERS_HELP_DOCUMENT_PERMISSION="Permissions" COM_QUESTIONSANSWERS_HELP_DOCUMENT_PUBLISHING="Publishing" COM_QUESTIONSANSWERS_HELP_DOCUMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Help Document to customise the alias." COM_QUESTIONSANSWERS_HELP_DOCUMENT_SELECT_AN_OPTION="Select an option" @@ -296,6 +297,8 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_CHECKED_IN_1="%d Question and COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_CHECKED_IN_MORE="%d Questions and Answers successfully checked in." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_DELETED="%s Questions and Answers deleted." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_DELETED_1="%s Question and Answer deleted." +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FAILED_PUBLISHING="%s Questions and Answers failed publishing." +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FAILED_PUBLISHING_1="%s Question and Answer failed publishing." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FEATURED="%s Questions and Answers featured." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FEATURED_1="%s Question and Answer featured." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_PUBLISHED="%s Questions and Answers published." diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index db9a7f4..e48eeb2 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage batchselection.php diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index 304a260..08c7afa 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_above.php diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 1c44884..3632815 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_fullwidth.php diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index 113b2cc..f5a019c 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_left.php diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index 3b95a8e..12babb3 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_right.php diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index 8cbec88..b1a442f 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_under.php diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index 9986b20..ca5359d 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage publishing.php diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php index a0d21b2..0f1d91e 100644 --- a/admin/layouts/help_document/publlshing.php +++ b/admin/layouts/help_document/publlshing.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage publlshing.php diff --git a/admin/layouts/question_and_answer/details_fullwidth.php b/admin/layouts/question_and_answer/details_fullwidth.php index f7e5fac..92f866f 100644 --- a/admin/layouts/question_and_answer/details_fullwidth.php +++ b/admin/layouts/question_and_answer/details_fullwidth.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_fullwidth.php diff --git a/admin/layouts/question_and_answer/details_rightside.php b/admin/layouts/question_and_answer/details_rightside.php index 3be6300..069540b 100644 --- a/admin/layouts/question_and_answer/details_rightside.php +++ b/admin/layouts/question_and_answer/details_rightside.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_rightside.php diff --git a/admin/layouts/question_and_answer/details_under.php b/admin/layouts/question_and_answer/details_under.php index df115a9..86caebc 100644 --- a/admin/layouts/question_and_answer/details_under.php +++ b/admin/layouts/question_and_answer/details_under.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_under.php diff --git a/admin/layouts/question_and_answer/metadata.php b/admin/layouts/question_and_answer/metadata.php index e05bfbc..73ea074 100644 --- a/admin/layouts/question_and_answer/metadata.php +++ b/admin/layouts/question_and_answer/metadata.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage metadata.php diff --git a/admin/layouts/question_and_answer/publishing.php b/admin/layouts/question_and_answer/publishing.php index 9b97e65..7c711e3 100644 --- a/admin/layouts/question_and_answer/publishing.php +++ b/admin/layouts/question_and_answer/publishing.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage publishing.php @@ -40,6 +40,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( + 'title', 'created', 'created_by', 'modified', diff --git a/admin/models/ajax.php b/admin/models/ajax.php index dd87290..a912eea 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.php diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index 41d06f1..046731b 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage adminviewfolderlist.php diff --git a/admin/models/fields/alloweddocumentformats.php b/admin/models/fields/alloweddocumentformats.php index 803f1ea..c4694d6 100644 --- a/admin/models/fields/alloweddocumentformats.php +++ b/admin/models/fields/alloweddocumentformats.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage alloweddocumentformats.php diff --git a/admin/models/fields/allowedimageformats.php b/admin/models/fields/allowedimageformats.php index 0c6eb34..4398b3e 100644 --- a/admin/models/fields/allowedimageformats.php +++ b/admin/models/fields/allowedimageformats.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage allowedimageformats.php diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index 87d3260..f67a9ad 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage articles.php diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index 739b5cd..64a712e 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage siteviewfolderlist.php diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js index 849cfc3..d0279d4 100644 --- a/admin/models/forms/help_document.js +++ b/admin/models/forms/help_document.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.js diff --git a/admin/models/forms/question_and_answer.js b/admin/models/forms/question_and_answer.js index 2ab53df..e3fc70f 100644 --- a/admin/models/forms/question_and_answer.js +++ b/admin/models/forms/question_and_answer.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.js diff --git a/admin/models/forms/question_and_answer.xml b/admin/models/forms/question_and_answer.xml index 9bb5b03..79967bb 100644 --- a/admin/models/forms/question_and_answer.xml +++ b/admin/models/forms/question_and_answer.xml @@ -102,6 +102,14 @@ rows="3" cols="30" /> + + + + input->get('layout')) { $this->context .= '.' . $layout; - } - $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); - $this->setState('filter.title', $title); + } + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); $this->setState('filter.type', $type); @@ -81,25 +103,10 @@ class QuestionsanswersModelHelp_documents extends JModelList $this->setState('filter.admin_view', $admin_view); $site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view'); - $this->setState('filter.site_view', $site_view); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + $this->setState('filter.site_view', $site_view); + + $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); + $this->setState('filter.title', $title); // List state information. parent::populateState($ordering, $direction); @@ -250,29 +257,77 @@ class QuestionsanswersModelHelp_documents extends JModelList } // Filter by Type. - if ($type = $this->getState('filter.type')) + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } + } + elseif (QuestionsanswersHelper::checkString($_type)) + { + $query->where('a.type = ' . $db->quote($db->escape($_type))); } // Filter by Location. - if ($location = $this->getState('filter.location')) + $_location = $this->getState('filter.location'); + if (is_numeric($_location)) { - $query->where('a.location = ' . $db->quote($db->escape($location))); + if (is_float($_location)) + { + $query->where('a.location = ' . (float) $_location); + } + else + { + $query->where('a.location = ' . (int) $_location); + } } - // Filter by admin_view. - if ($admin_view = $this->getState('filter.admin_view')) + elseif (QuestionsanswersHelper::checkString($_location)) { - $query->where('a.admin_view = ' . $db->quote($db->escape($admin_view))); + $query->where('a.location = ' . $db->quote($db->escape($_location))); } - // Filter by site_view. - if ($site_view = $this->getState('filter.site_view')) + // Filter by Admin_view. + $_admin_view = $this->getState('filter.admin_view'); + if (is_numeric($_admin_view)) { - $query->where('a.site_view = ' . $db->quote($db->escape($site_view))); + if (is_float($_admin_view)) + { + $query->where('a.admin_view = ' . (float) $_admin_view); + } + else + { + $query->where('a.admin_view = ' . (int) $_admin_view); + } + } + elseif (QuestionsanswersHelper::checkString($_admin_view)) + { + $query->where('a.admin_view = ' . $db->quote($db->escape($_admin_view))); + } + // Filter by Site_view. + $_site_view = $this->getState('filter.site_view'); + if (is_numeric($_site_view)) + { + if (is_float($_site_view)) + { + $query->where('a.site_view = ' . (float) $_site_view); + } + else + { + $query->where('a.site_view = ' . (int) $_site_view); + } + } + elseif (QuestionsanswersHelper::checkString($_site_view)) + { + $query->where('a.site_view = ' . $db->quote($db->escape($_site_view))); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -292,7 +347,7 @@ class QuestionsanswersModelHelp_documents extends JModelList public function getExportData($pks, $user = null) { // setup the query - if (QuestionsanswersHelper::checkArray($pks)) + if (($pks_size = QuestionsanswersHelper::checkArray($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; @@ -310,7 +365,24 @@ class QuestionsanswersModelHelp_documents extends JModelList // From the questionsanswers_help_document table $query->from($db->quoteName('#__questionsanswers_help_document', 'a')); - $query->where('a.id IN (' . implode(',',$pks) . ')'); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } // Order the results by ordering $query->order('a.ordering ASC'); @@ -395,11 +467,11 @@ class QuestionsanswersModelHelp_documents extends JModelList $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.title'); $id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.location'); $id .= ':' . $this->getState('filter.admin_view'); - $id .= ':' . $this->getState('filter.site_view'); + $id .= ':' . $this->getState('filter.site_view'); + $id .= ':' . $this->getState('filter.title'); return parent::getStoreId($id); } diff --git a/admin/models/import.php b/admin/models/import.php index 0794eb9..dc7208d 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage import.php @@ -440,7 +440,15 @@ class QuestionsanswersModelImport extends JModelLegacy $jinput = JFactory::getApplication()->input; foreach($target_headers as $header) { - $data['target_headers'][$header] = $jinput->getString($header, null); + if (($column = $jinput->getString($header, false)) !== false || + ($column = $jinput->getString(strtolower($header), false)) !== false) + { + $data['target_headers'][$header] = $column; + } + else + { + $data['target_headers'][$header] = null; + } } // set the data if(isset($package['dir'])) diff --git a/admin/models/question_and_answer.php b/admin/models/question_and_answer.php index 5486934..9237907 100644 --- a/admin/models/question_and_answer.php +++ b/admin/models/question_and_answer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.php @@ -26,8 +26,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; /** diff --git a/admin/models/questions_and_answers.php b/admin/models/questions_and_answers.php index 72debc5..3e9ea69 100644 --- a/admin/models/questions_and_answers.php +++ b/admin/models/questions_and_answers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.php @@ -40,24 +40,31 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.question','question', - 'a.answer','answer', 'c.title','category_title', 'c.id', 'category_id', - 'a.catid', 'catid' + 'a.catid','catid', + 'a.question','question', + 'a.answer','answer' ); } parent::__construct($config); } - + /** * Method to auto-populate the model state. * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * * @return void + * */ protected function populateState($ordering = null, $direction = null) { @@ -67,12 +74,25 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $question = $this->getUserStateFromRequest($this->context . '.filter.question', 'filter_question'); - $this->setState('filter.question', $question); + } - $answer = $this->getUserStateFromRequest($this->context . '.filter.answer', 'filter_answer'); - $this->setState('filter.answer', $answer); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category'); $this->setState('filter.category', $category); @@ -80,26 +100,14 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); $this->setState('filter.category_id', $categoryId); - $catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + $catid = $this->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); + $this->setState('filter.catid', $catid); + + $question = $this->getUserStateFromRequest($this->context . '.filter.question', 'filter_question'); + $this->setState('filter.question', $question); + + $answer = $this->getUserStateFromRequest($this->context . '.filter.answer', 'filter_answer'); + $this->setState('filter.answer', $answer); // List state information. parent::populateState($ordering, $direction); @@ -179,9 +187,17 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (QuestionsanswersHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_questionsanswers')) @@ -221,9 +237,9 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList } elseif (is_array($categoryId)) { - ArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); - $query->where('a.category IN (' . $categoryId . ')'); + $query->where('a.catid IN (' . $categoryId . ')'); } @@ -249,7 +265,7 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList public function getExportData($pks, $user = null) { // setup the query - if (QuestionsanswersHelper::checkArray($pks)) + if (($pks_size = QuestionsanswersHelper::checkArray($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; @@ -267,7 +283,24 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList // From the questionsanswers_question_and_answer table $query->from($db->quoteName('#__questionsanswers_question_and_answer', 'a')); - $query->where('a.id IN (' . implode(',',$pks) . ')'); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } // Implement View Level Access if (!$user->authorise('core.options', 'com_questionsanswers')) { @@ -370,14 +403,15 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.question'); - $id .= ':' . $this->getState('filter.answer'); $id .= ':' . $this->getState('filter.category'); $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); + $id .= ':' . $this->getState('filter.catid'); + $id .= ':' . $this->getState('filter.question'); + $id .= ':' . $this->getState('filter.answer'); return parent::getStoreId($id); } diff --git a/admin/models/questionsanswers.php b/admin/models/questionsanswers.php index 3702d83..cac0bee 100644 --- a/admin/models/questionsanswers.php +++ b/admin/models/questionsanswers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php @@ -39,7 +39,7 @@ class QuestionsanswersModelQuestionsanswers extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.question_and_answer.add', 'png.questions_and_answers', 'png.questions_and_answers.catid', 'png.help_documents') + 'main' => array('png.question_and_answer.add', 'png.questions_and_answers', 'png.questions_and_answers.catid_qpo0O0oqp_com_questionsanswers_po0O0oq_question_and_answer', 'png.help_documents') ); // view access array $viewAccess = array( @@ -73,8 +73,8 @@ class QuestionsanswersModelQuestionsanswers extends JModelList $viewName = $name; $alt = $name; $url = $url; - $image = $name.'.'.$type; - $name = 'COM_QUESTIONSANSWERS_DASHBOARD_'.QuestionsanswersHelper::safeString($name,'U'); + $image = $name . '.' . $type; + $name = 'COM_QUESTIONSANSWERS_DASHBOARD_' . QuestionsanswersHelper::safeString($name,'U'); } } // internal views @@ -96,17 +96,27 @@ class QuestionsanswersModelQuestionsanswers extends JModelList switch($action) { case 'add': - $url = 'index.php?option=com_questionsanswers&view='.$name.'&layout=edit'; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; + $url = 'index.php?option=com_questionsanswers&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; $name = 'COM_QUESTIONSANSWERS_DASHBOARD_'.QuestionsanswersHelper::safeString($name,'U').'_ADD'; $add = true; break; default: - $url = 'index.php?option=com_categories&view=categories&extension=com_questionsanswers.'.$name; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_QUESTIONSANSWERS_DASHBOARD_'.QuestionsanswersHelper::safeString($name,'U').'_'.QuestionsanswersHelper::safeString($action,'U'); + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_questionsanswers.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_QUESTIONSANSWERS_DASHBOARD_' . QuestionsanswersHelper::safeString($name,'U') . '_' . QuestionsanswersHelper::safeString($action,'U'); break; } } @@ -114,9 +124,9 @@ class QuestionsanswersModelQuestionsanswers extends JModelList { $viewName = $name; $alt = $name; - $url = 'index.php?option=com_questionsanswers&view='.$name; - $image = $name.'.'.$type; - $name = 'COM_QUESTIONSANSWERS_DASHBOARD_'.QuestionsanswersHelper::safeString($name,'U'); + $url = 'index.php?option=com_questionsanswers&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_QUESTIONSANSWERS_DASHBOARD_' . QuestionsanswersHelper::safeString($name,'U'); $hover = false; } } @@ -124,8 +134,8 @@ class QuestionsanswersModelQuestionsanswers extends JModelList { $viewName = $view; $alt = $view; - $url = 'index.php?option=com_questionsanswers&view='.$view; - $image = $view.'.png'; + $url = 'index.php?option=com_questionsanswers&view=' . $view; + $image = $view . '.png'; $name = ucwords($view).'

'; $hover = false; } @@ -137,7 +147,7 @@ class QuestionsanswersModelQuestionsanswers extends JModelList $dashboard_list = false; $accessTo = ''; $accessAdd = ''; - // acces checking start + // access checking start $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? QuestionsanswersHelper::checkString($viewAccess[$viewName.'.create']):false; $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? QuestionsanswersHelper::checkString($viewAccess[$viewName.'.access']):false; // set main controllers @@ -152,7 +162,7 @@ class QuestionsanswersModelQuestionsanswers extends JModelList { $accessAdd = 'core.create'; } - // check if acces to view is set + // check if access to view is set if ($accessAccess) { $accessTo = $viewAccess[$viewName.'.access']; diff --git a/admin/questionsanswers.php b/admin/questionsanswers.php index 646e727..fee6f8b 100644 --- a/admin/questionsanswers.php +++ b/admin/questionsanswers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php @@ -25,6 +25,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.tabstate'); // Access check. diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index f8b1295..19e021d 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -69,13 +69,3 @@ CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` ( ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; - --- --- 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.'; diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index 3a521a8..8806170 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,2 +1,3 @@ DROP TABLE IF EXISTS `#__questionsanswers_question_and_answer`; DROP TABLE IF EXISTS `#__questionsanswers_help_document`; + diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index 178cef1..543f6de 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.php diff --git a/admin/tables/question_and_answer.php b/admin/tables/question_and_answer.php index 8c2d519..ccc1d3b 100644 --- a/admin/tables/question_and_answer.php +++ b/admin/tables/question_and_answer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.php diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js index 14a430e..be57b92 100644 --- a/admin/views/help_document/submitbutton.js +++ b/admin/views/help_document/submitbutton.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage submitbutton.js diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index 044d05a..dc90e43 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage edit.php @@ -26,10 +26,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> @@ -83,7 +83,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst tab_name = 'help_documentTab'; ?> - canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?> + canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.created') || $this->canDo->get('help_document.edit.state') || ($this->canDo->get('help_document.delete') && $this->canDo->get('help_document.edit.state'))) : ?>
@@ -96,25 +96,6 @@ $componentParams = $this->params; // will be removed just use $this->params inst - canDo->get('core.admin')) : ?> - -
-
-
-
- form->getFieldset('accesscontrol') as $field): ?> -
- label; echo $field->input;?> -
-
- -
-
-
-
- - -
diff --git a/admin/views/help_document/view.html.php b/admin/views/help_document/view.html.php index 22aac3b..9cb00b3 100644 --- a/admin/views/help_document/view.html.php +++ b/admin/views/help_document/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php diff --git a/admin/views/help_documents/tmpl/default.php b/admin/views/help_documents/tmpl/default.php index 6ec65d8..b398983 100644 --- a/admin/views/help_documents/tmpl/default.php +++ b/admin/views/help_documents/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php @@ -24,76 +24,73 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_questionsanswers&task=help_documents.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + diff --git a/admin/views/help_documents/tmpl/default_batch_body.php b/admin/views/help_documents/tmpl/default_batch_body.php index bcb5670..28262ac 100644 --- a/admin/views/help_documents/tmpl/default_batch_body.php +++ b/admin/views/help_documents/tmpl/default_batch_body.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_batch_body.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> diff --git a/admin/views/help_documents/tmpl/default_batch_footer.php b/admin/views/help_documents/tmpl/default_batch_footer.php index 807b5e2..1b6e0ec 100644 --- a/admin/views/help_documents/tmpl/default_batch_footer.php +++ b/admin/views/help_documents/tmpl/default_batch_footer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_batch_footer.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> diff --git a/admin/views/help_documents/tmpl/default_body.php b/admin/views/help_documents/tmpl/default_body.php index 9c2e06a..02cb2e5 100644 --- a/admin/views/help_documents/tmpl/default_body.php +++ b/admin/views/help_documents/tmpl/default_body.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_body.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_questionsanswers&view=help_documents&task=help_document.edit"; @@ -39,11 +39,8 @@ $edit = "index.php?option=com_questionsanswers&view=help_documents&task=help_doc get('help_document.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/help_documents/tmpl/default_foot.php b/admin/views/help_documents/tmpl/default_foot.php index 51cce3f..0666b48 100644 --- a/admin/views/help_documents/tmpl/default_foot.php +++ b/admin/views/help_documents/tmpl/default_foot.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_foot.php diff --git a/admin/views/help_documents/tmpl/default_head.php b/admin/views/help_documents/tmpl/default_head.php index c008ea2..25917ef 100644 --- a/admin/views/help_documents/tmpl/default_head.php +++ b/admin/views/help_documents/tmpl/default_head.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_head.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> diff --git a/admin/views/help_documents/tmpl/default_toolbar.php b/admin/views/help_documents/tmpl/default_toolbar.php index df3deea..95acce9 100644 --- a/admin/views/help_documents/tmpl/default_toolbar.php +++ b/admin/views/help_documents/tmpl/default_toolbar.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_toolbar.php diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php index 652ae4f..7b8214f 100644 --- a/admin/views/help_documents/view.html.php +++ b/admin/views/help_documents/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php @@ -50,8 +50,8 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy $this->user = JFactory::getUser(); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -166,39 +166,16 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_questionsanswers'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load publish filter if state change is allowed + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); } // Set Type Selection @@ -219,16 +196,6 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy 'filter_type', JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') - ); - } } // Set Location Selection @@ -249,16 +216,6 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy 'filter_location', JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location')) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Location Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL').' -', - 'batch[location]', - JHtml::_('select.options', $this->locationOptions, 'value', 'text') - ); - } } // Set Admin View Selection @@ -275,20 +232,10 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy { // Admin View Filter JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + '- Select ' . JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'filter_admin_view', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view')) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Admin View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', - 'batch[admin_view]', - JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') - ); - } } // Set Site View Selection @@ -305,20 +252,64 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy { // Site View Filter JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + '- Select ' . JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_LABEL') . ' -', 'filter_site_view', JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view')) ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Site View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', - 'batch[site_view]', - JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') - ); - } + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') + ); + } + + // Only load Location batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Location Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL').' -', + 'batch[location]', + JHtml::_('select.options', $this->locationOptions, 'value', 'text') + ); + } + + // Only load Admin View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Admin View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + 'batch[admin_view]', + JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') + ); + } + + // Only load Site View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Site View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + 'batch[site_view]', + JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') + ); } } @@ -363,7 +354,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.title' => JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_TITLE_LABEL'), 'a.type' => JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_LABEL'), @@ -391,13 +382,13 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy $db->setQuery($query); $results = $db->loadColumn(); + $_filter = array(); if ($results) { // get model $model = $this->getModel(); $results = array_unique($results); - $_filter = array(); foreach ($results as $type) { // Translate the type selection @@ -405,9 +396,8 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy // Now add the type and its text to the options array $_filter[] = JHtml::_('select.option', $type, JText::_($text)); } - return $_filter; } - return false; + return $_filter; } protected function getTheLocationSelections() @@ -427,13 +417,13 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy $db->setQuery($query); $results = $db->loadColumn(); + $_filter = array(); if ($results) { // get model $model = $this->getModel(); $results = array_unique($results); - $_filter = array(); foreach ($results as $location) { // Translate the location selection @@ -441,8 +431,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy // Now add the location and its text to the options array $_filter[] = JHtml::_('select.option', $location, JText::_($text)); } - return $_filter; } - return false; + return $_filter; } } diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php index 5336c8d..a423a80 100644 --- a/admin/views/import/tmpl/default.php +++ b/admin/views/import/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index b46f340..42a2dd8 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php diff --git a/admin/views/question_and_answer/submitbutton.js b/admin/views/question_and_answer/submitbutton.js index 62a9528..14c1071 100644 --- a/admin/views/question_and_answer/submitbutton.js +++ b/admin/views/question_and_answer/submitbutton.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage submitbutton.js diff --git a/admin/views/question_and_answer/tmpl/edit.php b/admin/views/question_and_answer/tmpl/edit.php index 5243e3a..c61cc3b 100644 --- a/admin/views/question_and_answer/tmpl/edit.php +++ b/admin/views/question_and_answer/tmpl/edit.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage edit.php @@ -26,10 +26,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> @@ -77,7 +77,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst tab_name = 'question_and_answerTab'; ?> - canDo->get('question_and_answer.delete') || $this->canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.state') || $this->canDo->get('question_and_answer.edit.created')) : ?> + canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.created') || $this->canDo->get('question_and_answer.edit.state') || ($this->canDo->get('question_and_answer.delete') && $this->canDo->get('question_and_answer.edit.state'))) : ?>
@@ -422,7 +422,7 @@ function JRouter(link) { function getFile(filename, fileFormat, target, type){ // set uikit version - var uiVer = params->get('uikit_version', 2); ?>; + var uiVer = params->get('uikit_version', 3); ?>; // set the link var link = ''; // build the return @@ -486,7 +486,7 @@ function getFile(filename, fileFormat, target, type){ var theplaceholder = '
[DOCLINK='+fileName+'] [DOCBUTTON='+fileName+']
.
'; // get the download link if set var thedownload = ''; - if (documentsLinks.hasOwnProperty(item)) { + if (typeof documentsLinks !== 'undefined' && documentsLinks.hasOwnProperty(item)) { thedownload = ' '+fileName+''; } var thedelete = ''; diff --git a/admin/views/question_and_answer/view.html.php b/admin/views/question_and_answer/view.html.php index 3e9258b..7b29e1e 100644 --- a/admin/views/question_and_answer/view.html.php +++ b/admin/views/question_and_answer/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php diff --git a/admin/views/questions_and_answers/tmpl/default.php b/admin/views/questions_and_answers/tmpl/default.php index 58dc539..0d6dcf7 100644 --- a/admin/views/questions_and_answers/tmpl/default.php +++ b/admin/views/questions_and_answers/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php @@ -24,76 +24,73 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_questionsanswers&task=questions_and_answers.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'question_and_answerList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + diff --git a/admin/views/questions_and_answers/tmpl/default_batch_body.php b/admin/views/questions_and_answers/tmpl/default_batch_body.php index f4ced7e..b279a2b 100644 --- a/admin/views/questions_and_answers/tmpl/default_batch_body.php +++ b/admin/views/questions_and_answers/tmpl/default_batch_body.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_batch_body.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> diff --git a/admin/views/questions_and_answers/tmpl/default_batch_footer.php b/admin/views/questions_and_answers/tmpl/default_batch_footer.php index e6e9113..5500650 100644 --- a/admin/views/questions_and_answers/tmpl/default_batch_footer.php +++ b/admin/views/questions_and_answers/tmpl/default_batch_footer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_batch_footer.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> diff --git a/admin/views/questions_and_answers/tmpl/default_body.php b/admin/views/questions_and_answers/tmpl/default_body.php index 9bd1b08..4bb2784 100644 --- a/admin/views/questions_and_answers/tmpl/default_body.php +++ b/admin/views/questions_and_answers/tmpl/default_body.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_body.php @@ -24,7 +24,7 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_questionsanswers&view=questions_and_answers&task=question_and_answer.edit"; @@ -39,11 +39,8 @@ $edit = "index.php?option=com_questionsanswers&view=questions_and_answers&task=q get('question_and_answer.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/questions_and_answers/tmpl/default_foot.php b/admin/views/questions_and_answers/tmpl/default_foot.php index 97969e1..f85d564 100644 --- a/admin/views/questions_and_answers/tmpl/default_foot.php +++ b/admin/views/questions_and_answers/tmpl/default_foot.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_foot.php diff --git a/admin/views/questions_and_answers/tmpl/default_head.php b/admin/views/questions_and_answers/tmpl/default_head.php index 7272eb8..82075ce 100644 --- a/admin/views/questions_and_answers/tmpl/default_head.php +++ b/admin/views/questions_and_answers/tmpl/default_head.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_head.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> diff --git a/admin/views/questions_and_answers/tmpl/default_toolbar.php b/admin/views/questions_and_answers/tmpl/default_toolbar.php index b37338e..cd066df 100644 --- a/admin/views/questions_and_answers/tmpl/default_toolbar.php +++ b/admin/views/questions_and_answers/tmpl/default_toolbar.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_toolbar.php diff --git a/admin/views/questions_and_answers/view.html.php b/admin/views/questions_and_answers/view.html.php index 0134667..9272616 100644 --- a/admin/views/questions_and_answers/view.html.php +++ b/admin/views/questions_and_answers/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php @@ -51,7 +51,7 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -166,41 +166,24 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_questionsanswers'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } + // Only load publish filter if state change is allowed + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + // Category Filter. JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_CATEGORY'), @@ -208,6 +191,26 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy JHtml::_('select.options', JHtml::_('category.options', 'com_questionsanswers.question_and_answer'), 'value', 'text', $this->state->get('filter.category_id')) ); + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_QUESTIONSANSWERS_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + if ($this->canBatch && $this->canCreate && $this->canEdit) { // Category Batch selection. @@ -260,7 +263,7 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.question' => JText::_('COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_LABEL'), 'a.answer' => JText::_('COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL'), diff --git a/admin/views/questionsanswers/tmpl/default.php b/admin/views/questionsanswers/tmpl/default.php index 5f0a1b8..ce1ac4c 100644 --- a/admin/views/questionsanswers/tmpl/default.php +++ b/admin/views/questionsanswers/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php diff --git a/admin/views/questionsanswers/tmpl/default_main.php b/admin/views/questionsanswers/tmpl/default_main.php index 5da108b..01d8818 100644 --- a/admin/views/questionsanswers/tmpl/default_main.php +++ b/admin/views/questionsanswers/tmpl/default_main.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_main.php diff --git a/admin/views/questionsanswers/tmpl/default_readme_information.php b/admin/views/questionsanswers/tmpl/default_readme_information.php index 225416c..5922943 100644 --- a/admin/views/questionsanswers/tmpl/default_readme_information.php +++ b/admin/views/questionsanswers/tmpl/default_readme_information.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_readme_information.php diff --git a/admin/views/questionsanswers/tmpl/default_vast_development_method_notice_board.php b/admin/views/questionsanswers/tmpl/default_vast_development_method_notice_board.php index 1a388b6..8a6896e 100644 --- a/admin/views/questionsanswers/tmpl/default_vast_development_method_notice_board.php +++ b/admin/views/questionsanswers/tmpl/default_vast_development_method_notice_board.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_vast_development_method_notice_board.php diff --git a/admin/views/questionsanswers/tmpl/default_vdm.php b/admin/views/questionsanswers/tmpl/default_vdm.php index 90b5ee3..de64a4a 100644 --- a/admin/views/questionsanswers/tmpl/default_vdm.php +++ b/admin/views/questionsanswers/tmpl/default_vdm.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_vdm.php diff --git a/admin/views/questionsanswers/view.html.php b/admin/views/questionsanswers/view.html.php index 3c248cd..3b36eb0 100644 --- a/admin/views/questionsanswers/view.html.php +++ b/admin/views/questionsanswers/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php diff --git a/media/css/A4.print.css b/media/css/A4.print.css index 084588f..0492819 100644 --- a/media/css/A4.print.css +++ b/media/css/A4.print.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage A4.print.css diff --git a/questionsanswers.xml b/questionsanswers.xml index 777be23..76a1d76 100644 --- a/questionsanswers.xml +++ b/questionsanswers.xml @@ -1,7 +1,7 @@ COM_QUESTIONSANSWERS - 30th May, 2020 + 6th January, 2021 Llewellyn van der Merwe joomla@vdm.io https://www.vdm.io/ diff --git a/script.php b/script.php index 26becf5..5128da1 100644 --- a/script.php +++ b/script.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage script.php @@ -89,7 +89,7 @@ class com_questionsanswersInstallerScript $question_and_answer_done = $db->execute(); if ($question_and_answer_done) { - // If succesfully remove Question_and_answer add queued success message. + // If successfully remove Question_and_answer add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the #__content_type table')); } @@ -104,7 +104,7 @@ class com_questionsanswersInstallerScript $question_and_answer_done = $db->execute(); if ($question_and_answer_done) { - // If succesfully remove Question_and_answer add queued success message. + // If successfully remove Question_and_answer add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the #__contentitem_tag_map table')); } @@ -119,7 +119,7 @@ class com_questionsanswersInstallerScript $question_and_answer_done = $db->execute(); if ($question_and_answer_done) { - // If succesfully remove Question_and_answer add queued success message. + // If successfully removed Question_and_answer add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the #__ucm_content table')); } @@ -175,7 +175,7 @@ class com_questionsanswersInstallerScript $question_and_answer_catid_done = $db->execute(); if ($question_and_answer_catid_done) { - // If succesfully remove Question_and_answer catid add queued success message. + // If successfully remove Question_and_answer catid add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer.category) type alias was removed from the #__content_type table')); } @@ -190,7 +190,7 @@ class com_questionsanswersInstallerScript $question_and_answer_catid_done = $db->execute(); if ($question_and_answer_catid_done) { - // If succesfully remove Question_and_answer catid add queued success message. + // If successfully remove Question_and_answer catid add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer.category) type alias was removed from the #__contentitem_tag_map table')); } @@ -205,7 +205,7 @@ class com_questionsanswersInstallerScript $question_and_answer_catid_done = $db->execute(); if ($question_and_answer_catid_done) { - // If succesfully remove Question_and_answer catid add queued success message. + // If successfully removed Question_and_answer catid add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer.category) type alias was removed from the #__ucm_content table')); } @@ -261,7 +261,7 @@ class com_questionsanswersInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the #__content_type table')); } @@ -276,7 +276,7 @@ class com_questionsanswersInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the #__contentitem_tag_map table')); } @@ -291,7 +291,7 @@ class com_questionsanswersInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully removed Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the #__ucm_content table')); } @@ -335,10 +335,31 @@ class com_questionsanswersInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove questionsanswers add queued success message. + // If successfully removed questionsanswers add queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); } + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length < 5120) + { + // Revert the assets table rules column back to the default + $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + $db->setQuery($revert_rule); + $db->execute(); + $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); + } + else + { + + $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); + } + } // Set db if not set already. if (!isset($db)) @@ -602,9 +623,9 @@ class com_questionsanswersInstallerScript $help_document->type_title = 'Questionsanswers Help_document'; $help_document->type_alias = 'com_questionsanswers.help_document'; $help_document->table = '{"special": {"dbtable": "#__questionsanswers_help_document","key": "id","type": "Help_document","prefix": "questionsanswersTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","not_required":"not_required","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; + $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; $help_document->router = 'QuestionsanswersHelperRoute::getHelp_documentRoute'; - $help_document->content_history_options = '{"formFile": "administrator/components/com_questionsanswers/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_questionsanswers/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; // Set the object into the content types table. $help_document_Inserted = $db->insertObject('#__content_types', $help_document); @@ -624,6 +645,22 @@ class com_questionsanswersInstallerScript $db->setQuery($query); $allDone = $db->execute(); + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length <= 7520) + { + // Fix the assets table rules column size + $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; + $db->setQuery($fix_rules_size); + $db->execute(); + $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); + } + } echo ' '; @@ -744,9 +781,9 @@ class com_questionsanswersInstallerScript $help_document->type_title = 'Questionsanswers Help_document'; $help_document->type_alias = 'com_questionsanswers.help_document'; $help_document->table = '{"special": {"dbtable": "#__questionsanswers_help_document","key": "id","type": "Help_document","prefix": "questionsanswersTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","not_required":"not_required","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; + $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; $help_document->router = 'QuestionsanswersHelperRoute::getHelp_documentRoute'; - $help_document->content_history_options = '{"formFile": "administrator/components/com_questionsanswers/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_questionsanswers/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; // Check if help_document type is already in content_type DB. $help_document_id = null; diff --git a/site/assets/css/category.css b/site/assets/css/category.css index 29534f7..3006b3e 100644 --- a/site/assets/css/category.css +++ b/site/assets/css/category.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage category.css diff --git a/site/assets/css/downloads.css b/site/assets/css/downloads.css index 8533cbf..b48f176 100644 --- a/site/assets/css/downloads.css +++ b/site/assets/css/downloads.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage downloads.css diff --git a/site/assets/css/question_and_answer.css b/site/assets/css/question_and_answer.css index 77ca672..d1a392b 100644 --- a/site/assets/css/question_and_answer.css +++ b/site/assets/css/question_and_answer.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.css diff --git a/site/assets/css/questions_and_answers.css b/site/assets/css/questions_and_answers.css index 1a12579..5498c75 100644 --- a/site/assets/css/questions_and_answers.css +++ b/site/assets/css/questions_and_answers.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.css diff --git a/site/assets/css/site.css b/site/assets/css/site.css index f87925e..c48fdfc 100644 --- a/site/assets/css/site.css +++ b/site/assets/css/site.css @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage site.css diff --git a/site/assets/js/site.js b/site/assets/js/site.js index bc3db34..ee4ea9f 100644 --- a/site/assets/js/site.js +++ b/site/assets/js/site.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage site.js diff --git a/site/controller.php b/site/controller.php index 8c79530..b0c16bd 100644 --- a/site/controller.php +++ b/site/controller.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage controller.php diff --git a/site/controllers/ajax.json.php b/site/controllers/ajax.json.php index 9a6a27a..0a4be67 100644 --- a/site/controllers/ajax.json.php +++ b/site/controllers/ajax.json.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.json.php diff --git a/site/controllers/download.php b/site/controllers/download.php index e04c93f..864c40e 100644 --- a/site/controllers/download.php +++ b/site/controllers/download.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage download.php diff --git a/site/controllers/help.php b/site/controllers/help.php index 7829659..5a4aa72 100644 --- a/site/controllers/help.php +++ b/site/controllers/help.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage help.php diff --git a/site/controllers/question_and_answer.php b/site/controllers/question_and_answer.php index 992c707..9c66b88 100644 --- a/site/controllers/question_and_answer.php +++ b/site/controllers/question_and_answer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.php diff --git a/site/helpers/category.php b/site/helpers/category.php index 7c27672..b044254 100644 --- a/site/helpers/category.php +++ b/site/helpers/category.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage category.php diff --git a/site/helpers/categoryquestion_and_answer.php b/site/helpers/categoryquestion_and_answer.php index 73164ba..4d5a078 100644 --- a/site/helpers/categoryquestion_and_answer.php +++ b/site/helpers/categoryquestion_and_answer.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage categoryquestion_and_answer.php diff --git a/site/helpers/headercheck.php b/site/helpers/headercheck.php index 95d3ceb..1d6cfef 100644 --- a/site/helpers/headercheck.php +++ b/site/helpers/headercheck.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage headercheck.php diff --git a/site/helpers/questionsanswers.php b/site/helpers/questionsanswers.php index 89eaf30..d665dbb 100644 --- a/site/helpers/questionsanswers.php +++ b/site/helpers/questionsanswers.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php @@ -26,8 +26,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\Language\Language; -use Joomla\String\StringHelper; +use Joomla\CMS\Language\Language; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; /** @@ -467,9 +468,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy date */ - public static function fancyDate($date) + public static function fancyDate($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -479,9 +480,9 @@ abstract class QuestionsanswersHelper /** * get date based in period past */ - public static function fancyDynamicDate($date) + public static function fancyDynamicDate($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -505,9 +506,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy day time and date */ - public static function fancyDayTimeDate($time) + public static function fancyDayTimeDate($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -517,9 +518,9 @@ abstract class QuestionsanswersHelper /** * Change to nice fancy time and date */ - public static function fancyDateTime($time) + public static function fancyDateTime($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -529,9 +530,9 @@ abstract class QuestionsanswersHelper /** * Change to nice hour:minutes time */ - public static function fancyTime($time) + public static function fancyTime($time, $check_stamp = true) { - if (!self::isValidTimeStamp($time)) + if ($check_stamp && !self::isValidTimeStamp($time)) { $time = strtotime($time); } @@ -541,9 +542,9 @@ abstract class QuestionsanswersHelper /** * set the date day as Sunday through Saturday */ - public static function setDayName($date) + public static function setDayName($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -553,9 +554,9 @@ abstract class QuestionsanswersHelper /** * set the date month as January through December */ - public static function setMonthName($date) + public static function setMonthName($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -565,9 +566,9 @@ abstract class QuestionsanswersHelper /** * set the date day as 1st */ - public static function setDay($date) + public static function setDay($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -577,9 +578,9 @@ abstract class QuestionsanswersHelper /** * set the date month as 5 */ - public static function setMonth($date) + public static function setMonth($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -589,9 +590,9 @@ abstract class QuestionsanswersHelper /** * set the date year as 2004 (for charts) */ - public static function setYear($date) + public static function setYear($date, $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -601,9 +602,9 @@ abstract class QuestionsanswersHelper /** * set the date as 2004/05 (for charts) */ - public static function setYearMonth($date, $spacer = '/') + public static function setYearMonth($date, $spacer = '/', $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } @@ -613,15 +614,27 @@ abstract class QuestionsanswersHelper /** * set the date as 2004/05/03 (for charts) */ - public static function setYearMonthDay($date, $spacer = '/') + public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true) { - if (!self::isValidTimeStamp($date)) + if ($check_stamp && !self::isValidTimeStamp($date)) { $date = strtotime($date); } return date('Y' . $spacer . 'm' . $spacer . 'd', $date); } + /** + * set the date as 03/05/2004 + */ + public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true) + { + if ($check_stamp && !self::isValidTimeStamp($date)) + { + $date = strtotime($date); + } + return date('d' . $spacer . 'm' . $spacer . 'Y', $date); + } + /** * Check if string is a valid time stamp */ @@ -632,6 +645,16 @@ abstract class QuestionsanswersHelper && ($timestamp >= ~PHP_INT_MAX); } + /** + * Check if string is a valid date + * https://www.php.net/manual/en/function.checkdate.php#113205 + */ + public static function isValidateDate($date, $format = 'Y-m-d H:i:s') + { + $d = DateTime::createFromFormat($format, $date); + return $d && $d->format($format) == $date; + } + /** * prepare base64 string for url diff --git a/site/helpers/route.php b/site/helpers/route.php index af206da..fe3c859 100644 --- a/site/helpers/route.php +++ b/site/helpers/route.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage route.php diff --git a/site/language/en-GB/en-GB.com_questionsanswers.ini b/site/language/en-GB/en-GB.com_questionsanswers.ini index 941ef5b..73d9990 100644 --- a/site/language/en-GB/en-GB.com_questionsanswers.ini +++ b/site/language/en-GB/en-GB.com_questionsanswers.ini @@ -39,6 +39,8 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_CHECKED_IN_1="%d Question and COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_CHECKED_IN_MORE="%d Questions and Answers successfully checked in." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_DELETED="%s Questions and Answers deleted." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_DELETED_1="%s Question and Answer deleted." +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FAILED_PUBLISHING="%s Questions and Answers failed publishing." +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FAILED_PUBLISHING_1="%s Question and Answer failed publishing." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FEATURED="%s Questions and Answers featured." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_FEATURED_1="%s Question and Answer featured." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_PUBLISHED="%s Questions and Answers published." diff --git a/site/layouts/question_and_answer/details_fullwidth.php b/site/layouts/question_and_answer/details_fullwidth.php index f7e5fac..92f866f 100644 --- a/site/layouts/question_and_answer/details_fullwidth.php +++ b/site/layouts/question_and_answer/details_fullwidth.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_fullwidth.php diff --git a/site/layouts/question_and_answer/details_rightside.php b/site/layouts/question_and_answer/details_rightside.php index 3be6300..069540b 100644 --- a/site/layouts/question_and_answer/details_rightside.php +++ b/site/layouts/question_and_answer/details_rightside.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_rightside.php diff --git a/site/layouts/question_and_answer/details_under.php b/site/layouts/question_and_answer/details_under.php index df115a9..86caebc 100644 --- a/site/layouts/question_and_answer/details_under.php +++ b/site/layouts/question_and_answer/details_under.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage details_under.php diff --git a/site/layouts/question_and_answer/metadata.php b/site/layouts/question_and_answer/metadata.php index e05bfbc..73ea074 100644 --- a/site/layouts/question_and_answer/metadata.php +++ b/site/layouts/question_and_answer/metadata.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage metadata.php diff --git a/site/layouts/question_and_answer/publishing.php b/site/layouts/question_and_answer/publishing.php index 9b97e65..7c711e3 100644 --- a/site/layouts/question_and_answer/publishing.php +++ b/site/layouts/question_and_answer/publishing.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage publishing.php @@ -40,6 +40,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( + 'title', 'created', 'created_by', 'modified', diff --git a/site/models/ajax.php b/site/models/ajax.php index b5484ca..e32bf36 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.php diff --git a/site/models/category.php b/site/models/category.php index b9c9dff..2118fdb 100644 --- a/site/models/category.php +++ b/site/models/category.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage category.php diff --git a/site/models/downloads.php b/site/models/downloads.php index aaa5f8b..f1ded9f 100644 --- a/site/models/downloads.php +++ b/site/models/downloads.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage downloads.php diff --git a/site/models/forms/question_and_answer.js b/site/models/forms/question_and_answer.js index 2ab53df..e3fc70f 100644 --- a/site/models/forms/question_and_answer.js +++ b/site/models/forms/question_and_answer.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.js diff --git a/site/models/forms/question_and_answer.xml b/site/models/forms/question_and_answer.xml index 9bb5b03..79967bb 100644 --- a/site/models/forms/question_and_answer.xml +++ b/site/models/forms/question_and_answer.xml @@ -102,6 +102,14 @@ rows="3" cols="30" /> + + + + addStyleSheet('components/com_questionsanswers/assets/css/site.css'); $document->addScript('components/com_questionsanswers/assets/js/site.js'); // Require helper files -JLoader::register('QuestionsanswersHelper', __DIR__ . '/helpers/questionsanswers.php'); +JLoader::register('QuestionsanswersHelper', __DIR__ . '/helpers/questionsanswers.php'); JLoader::register('QuestionsanswersHelperRoute', __DIR__ . '/helpers/route.php'); // Triger the Global Site Event diff --git a/site/router.php b/site/router.php index 27c21f5..35f327e 100644 --- a/site/router.php +++ b/site/router.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage router.php diff --git a/site/views/category/tmpl/default.php b/site/views/category/tmpl/default.php index 6007071..31c98f5 100644 --- a/site/views/category/tmpl/default.php +++ b/site/views/category/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php @@ -26,6 +26,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + ?> items) && QuestionsanswersHelper::checkArray($this->items)): ?> diff --git a/site/views/category/tmpl/default_qna-table.php b/site/views/category/tmpl/default_qna-table.php index 4d5bb59..83b022e 100644 --- a/site/views/category/tmpl/default_qna-table.php +++ b/site/views/category/tmpl/default_qna-table.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_qna-table.php diff --git a/site/views/category/view.html.php b/site/views/category/view.html.php index b317676..ab3db73 100644 --- a/site/views/category/view.html.php +++ b/site/views/category/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php @@ -278,8 +278,6 @@ class QuestionsanswersViewCategory extends JViewLegacy */ protected function addToolBar() { - // adding the joomla toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php'); // set help url for this view if found $help_url = QuestionsanswersHelper::getHelpUrl('category'); diff --git a/site/views/downloads/tmpl/default.php b/site/views/downloads/tmpl/default.php index 2cc3333..ba7b1ba 100644 --- a/site/views/downloads/tmpl/default.php +++ b/site/views/downloads/tmpl/default.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default.php @@ -26,6 +26,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + ?> items) && QuestionsanswersHelper::checkArray($this->items)): ?> diff --git a/site/views/downloads/tmpl/default_qna-downloads-table.php b/site/views/downloads/tmpl/default_qna-downloads-table.php index 834480b..ef2aae5 100644 --- a/site/views/downloads/tmpl/default_qna-downloads-table.php +++ b/site/views/downloads/tmpl/default_qna-downloads-table.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage default_qna-downloads-table.php diff --git a/site/views/downloads/view.html.php b/site/views/downloads/view.html.php index 45ab399..171d484 100644 --- a/site/views/downloads/view.html.php +++ b/site/views/downloads/view.html.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage view.html.php @@ -278,8 +278,6 @@ class QuestionsanswersViewDownloads extends JViewLegacy */ protected function addToolBar() { - // adding the joomla toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php'); // set help url for this view if found $help_url = QuestionsanswersHelper::getHelpUrl('downloads'); diff --git a/site/views/question_and_answer/submitbutton.js b/site/views/question_and_answer/submitbutton.js index 62a9528..14c1071 100644 --- a/site/views/question_and_answer/submitbutton.js +++ b/site/views/question_and_answer/submitbutton.js @@ -10,7 +10,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage submitbutton.js diff --git a/site/views/question_and_answer/tmpl/edit.php b/site/views/question_and_answer/tmpl/edit.php index 868719b..1f1abe9 100644 --- a/site/views/question_and_answer/tmpl/edit.php +++ b/site/views/question_and_answer/tmpl/edit.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 30th May, 2020 + @build 6th January, 2021 @created 30th January, 2017 @package Questions and Answers @subpackage edit.php @@ -26,15 +26,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +JHtml::_('behavior.tabstate'); JHtml::_('behavior.calendar'); -$componentParams = $this->params; // will be removed just use $this->params instead ?> +
toolbar->render(); ?>
@@ -57,7 +57,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst tab_name = 'question_and_answerTab'; ?> - canDo->get('question_and_answer.delete') || $this->canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.state') || $this->canDo->get('question_and_answer.edit.created')) : ?> + canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.created') || $this->canDo->get('question_and_answer.edit.state') || ($this->canDo->get('question_and_answer.delete') && $this->canDo->get('question_and_answer.edit.state'))) : ?>
@@ -102,7 +102,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- + +