From 8068f3e4349207f759a567d1e2331c592142fb6c Mon Sep 17 00:00:00 2001 From: astridx Date: Sat, 22 Feb 2020 15:18:27 +0100 Subject: [PATCH] wip --- dist/current | 1 + .../components/com_foos/access.xml | 35 +++ .../components/com_foos/config.xml | 55 ++++ .../components/com_foos/foos.xml | 64 +++++ .../components/com_foos/forms/filter_foos.xml | 103 +++++++ .../components/com_foos/forms/foo.xml | 147 ++++++++++ .../com_foos/language/de-DE/com_foos.ini | 16 ++ .../com_foos/language/de-DE/com_foos.sys.ini | 15 + .../com_foos/language/en-GB/com_foos.ini | 53 ++++ .../com_foos/language/en-GB/com_foos.sys.ini | 18 ++ .../components/com_foos/script.php | 237 ++++++++++++++++ .../components/com_foos/services/provider.php | 66 +++++ .../com_foos/sql/install.mysql.utf8.sql | 47 +++ .../com_foos/sql/uninstall.mysql.utf8.sql | 1 + .../com_foos/sql/updates/mysql/10.0.0.sql | 3 + .../com_foos/sql/updates/mysql/12.0.0.sql | 5 + .../com_foos/sql/updates/mysql/13.0.0.sql | 7 + .../com_foos/sql/updates/mysql/15.0.0.sql | 3 + .../com_foos/sql/updates/mysql/16.0.0.sql | 1 + .../com_foos/sql/updates/mysql/18.0.0.sql | 1 + .../com_foos/sql/updates/mysql/21.0.0.sql | 5 + .../com_foos/sql/updates/mysql/24.0.0.sql | 3 + .../src/Controller/DisplayController.php | 47 +++ .../com_foos/src/Controller/FooController.php | 44 +++ .../src/Controller/FoosController.php | 119 ++++++++ .../com_foos/src/Extension/FoosComponent.php | 115 ++++++++ .../com_foos/src/Field/Modal/FooField.php | 199 +++++++++++++ .../src/Helper/AssociationsHelper.php | 237 ++++++++++++++++ .../com_foos/src/Helper/FooHelper.php | 50 ++++ .../com_foos/src/Model/FooModel.php | 248 ++++++++++++++++ .../com_foos/src/Model/FoosModel.php | 263 +++++++++++++++++ .../com_foos/src/Rule/LetterRule.php | 37 +++ .../src/Service/HTML/AdministratorService.php | 129 +++++++++ .../com_foos/src/Service/HTML/Icon.php | 198 +++++++++++++ .../com_foos/src/Table/FooTable.php | 127 +++++++++ .../com_foos/src/View/Foo/HtmlView.php | 150 ++++++++++ .../com_foos/src/View/Foos/HtmlView.php | 219 ++++++++++++++ .../components/com_foos/tmpl/foo/edit.php | 89 ++++++ .../com_foos/tmpl/foo/edit_associations.php | 14 + .../components/com_foos/tmpl/foo/modal.php | 15 + .../components/com_foos/tmpl/foos/default.php | 182 ++++++++++++ .../com_foos/tmpl/foos/default_batch.php | 59 ++++ .../com_foos/tmpl/foos/default_batch_body.php | 32 +++ .../tmpl/foos/default_batch_footer.php | 12 + .../components/com_foos/tmpl/foos/modal.php | 78 +++++ .../components/com_foos/forms/foo.xml | 23 ++ .../components/com_foos/forms/form.xml | 30 ++ .../com_foos/language/de-DE/com_foos.ini | 1 + .../com_foos/language/en-GB/com_foos.ini | 1 + .../src/Controller/DisplayController.php | 63 ++++ .../com_foos/src/Controller/FooController.php | 207 ++++++++++++++ .../com_foos/src/Helper/AssociationHelper.php | 67 +++++ .../components/com_foos/src/Helper/Route.php | 94 ++++++ .../com_foos/src/Helper/RouteHelper.php | 94 ++++++ .../com_foos/src/Model/FeaturedModel.php | 199 +++++++++++++ .../com_foos/src/Model/FooModel.php | 96 +++++++ .../com_foos/src/Model/FormModel.php | 224 +++++++++++++++ .../com_foos/src/Service/Router.php | 268 ++++++++++++++++++ .../com_foos/src/View/Featured/HtmlView.php | 200 +++++++++++++ .../com_foos/src/View/Foo/HtmlView.php | 92 ++++++ .../com_foos/src/View/Form/HtmlView.php | 177 ++++++++++++ .../com_foos/tmpl/featured/default.php | 35 +++ .../com_foos/tmpl/featured/default.xml | 48 ++++ .../com_foos/tmpl/featured/default_items.php | 80 ++++++ .../components/com_foos/tmpl/foo/default.php | 46 +++ .../components/com_foos/tmpl/foo/default.xml | 40 +++ .../components/com_foos/tmpl/foo/withhead.php | 19 ++ .../components/com_foos/tmpl/foo/withhead.xml | 25 ++ .../com_foos/tmpl/foo/withheadandfoot.php | 21 ++ .../components/com_foos/tmpl/form/edit.php | 66 +++++ .../components/com_foos/tmpl/form/edit.xml | 14 + dist/foos-1.0.0/foos.xml | 64 +++++ .../media/com_foos/js/admin-foos-letter.js | 17 ++ .../media/com_foos/js/admin-foos-modal.js | 60 ++++ dist/foos-1.0.0/script.php | 237 ++++++++++++++++ dist/pkg-foos-1.0.0.zip | Bin 0 -> 64182 bytes dist/pkg-foos-current.zip | 1 + .../components/com_foos/access.xml | 35 +++ .../components/com_foos/config.xml | 55 ++++ .../components/com_foos/foos.xml | 64 +++++ .../components/com_foos/forms/filter_foos.xml | 103 +++++++ .../components/com_foos/forms/foo.xml | 147 ++++++++++ .../com_foos/language/de-DE/com_foos.ini | 16 ++ .../com_foos/language/de-DE/com_foos.sys.ini | 15 + .../com_foos/language/en-GB/com_foos.ini | 53 ++++ .../com_foos/language/en-GB/com_foos.sys.ini | 18 ++ .../components/com_foos/script.php | 237 ++++++++++++++++ .../components/com_foos/services/provider.php | 66 +++++ .../com_foos/sql/install.mysql.utf8.sql | 47 +++ .../com_foos/sql/uninstall.mysql.utf8.sql | 1 + .../com_foos/sql/updates/mysql/10.0.0.sql | 3 + .../com_foos/sql/updates/mysql/12.0.0.sql | 5 + .../com_foos/sql/updates/mysql/13.0.0.sql | 7 + .../com_foos/sql/updates/mysql/15.0.0.sql | 3 + .../com_foos/sql/updates/mysql/16.0.0.sql | 1 + .../com_foos/sql/updates/mysql/18.0.0.sql | 1 + .../com_foos/sql/updates/mysql/21.0.0.sql | 5 + .../com_foos/sql/updates/mysql/24.0.0.sql | 3 + .../src/Controller/DisplayController.php | 47 +++ .../com_foos/src/Controller/FooController.php | 44 +++ .../src/Controller/FoosController.php | 119 ++++++++ .../com_foos/src/Extension/FoosComponent.php | 115 ++++++++ .../com_foos/src/Field/Modal/FooField.php | 199 +++++++++++++ .../src/Helper/AssociationsHelper.php | 237 ++++++++++++++++ .../com_foos/src/Helper/FooHelper.php | 50 ++++ .../com_foos/src/Model/FooModel.php | 248 ++++++++++++++++ .../com_foos/src/Model/FoosModel.php | 263 +++++++++++++++++ .../com_foos/src/Rule/LetterRule.php | 37 +++ .../src/Service/HTML/AdministratorService.php | 129 +++++++++ .../com_foos/src/Service/HTML/Icon.php | 198 +++++++++++++ .../com_foos/src/Table/FooTable.php | 127 +++++++++ .../com_foos/src/View/Foo/HtmlView.php | 150 ++++++++++ .../com_foos/src/View/Foos/HtmlView.php | 219 ++++++++++++++ .../components/com_foos/tmpl/foo/edit.php | 89 ++++++ .../com_foos/tmpl/foo/edit_associations.php | 14 + .../components/com_foos/tmpl/foo/modal.php | 15 + .../components/com_foos/tmpl/foos/default.php | 182 ++++++++++++ .../com_foos/tmpl/foos/default_batch.php | 59 ++++ .../com_foos/tmpl/foos/default_batch_body.php | 32 +++ .../tmpl/foos/default_batch_footer.php | 12 + .../components/com_foos/tmpl/foos/modal.php | 78 +++++ .../cbuild/components/com_foos/forms/foo.xml | 23 ++ .../cbuild/components/com_foos/forms/form.xml | 30 ++ .../com_foos/language/de-DE/com_foos.ini | 1 + .../com_foos/language/en-GB/com_foos.ini | 1 + .../src/Controller/DisplayController.php | 63 ++++ .../com_foos/src/Controller/FooController.php | 207 ++++++++++++++ .../com_foos/src/Helper/AssociationHelper.php | 67 +++++ .../components/com_foos/src/Helper/Route.php | 94 ++++++ .../com_foos/src/Helper/RouteHelper.php | 94 ++++++ .../com_foos/src/Model/FeaturedModel.php | 199 +++++++++++++ .../com_foos/src/Model/FooModel.php | 96 +++++++ .../com_foos/src/Model/FormModel.php | 224 +++++++++++++++ .../com_foos/src/Service/Router.php | 268 ++++++++++++++++++ .../com_foos/src/View/Featured/HtmlView.php | 200 +++++++++++++ .../com_foos/src/View/Foo/HtmlView.php | 92 ++++++ .../com_foos/src/View/Form/HtmlView.php | 177 ++++++++++++ .../com_foos/tmpl/featured/default.php | 35 +++ .../com_foos/tmpl/featured/default.xml | 48 ++++ .../com_foos/tmpl/featured/default_items.php | 80 ++++++ .../components/com_foos/tmpl/foo/default.php | 46 +++ .../components/com_foos/tmpl/foo/default.xml | 40 +++ .../components/com_foos/tmpl/foo/withhead.php | 19 ++ .../components/com_foos/tmpl/foo/withhead.xml | 25 ++ .../com_foos/tmpl/foo/withheadandfoot.php | 21 ++ .../components/com_foos/tmpl/form/edit.php | 66 +++++ .../components/com_foos/tmpl/form/edit.xml | 14 + .../media/com_foos/js/admin-foos-letter.js | 17 ++ .../media/com_foos/js/admin-foos-modal.js | 60 ++++ dist/zips/com_foos.zip | Bin 0 -> 81025 bytes .../com_foos/sql/install.mysql.utf8.sql | 10 +- 151 files changed, 12018 insertions(+), 5 deletions(-) create mode 120000 dist/current create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/access.xml create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/config.xml create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/foos.xml create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/forms/filter_foos.xml create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/forms/foo.xml create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.ini create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.sys.ini create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.ini create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.sys.ini create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/script.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/services/provider.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/install.mysql.utf8.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/uninstall.mysql.utf8.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/10.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/12.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/13.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/15.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/16.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/18.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/21.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/24.0.0.sql create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Controller/DisplayController.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Controller/FooController.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Controller/FoosController.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Extension/FoosComponent.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Field/Modal/FooField.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Helper/AssociationsHelper.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Helper/FooHelper.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Model/FooModel.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Model/FoosModel.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Rule/LetterRule.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Service/HTML/AdministratorService.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Service/HTML/Icon.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/Table/FooTable.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/View/Foo/HtmlView.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/src/View/Foos/HtmlView.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit_associations.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/modal.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch_body.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch_footer.php create mode 100644 dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/modal.php create mode 100644 dist/foos-1.0.0/components/com_foos/forms/foo.xml create mode 100644 dist/foos-1.0.0/components/com_foos/forms/form.xml create mode 100644 dist/foos-1.0.0/components/com_foos/language/de-DE/com_foos.ini create mode 100644 dist/foos-1.0.0/components/com_foos/language/en-GB/com_foos.ini create mode 100644 dist/foos-1.0.0/components/com_foos/src/Controller/DisplayController.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Controller/FooController.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Helper/AssociationHelper.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Helper/Route.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Helper/RouteHelper.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Model/FeaturedModel.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Model/FooModel.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Model/FormModel.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/Service/Router.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/View/Featured/HtmlView.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/View/Foo/HtmlView.php create mode 100644 dist/foos-1.0.0/components/com_foos/src/View/Form/HtmlView.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/featured/default.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/featured/default.xml create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/featured/default_items.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/foo/default.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/foo/default.xml create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/foo/withhead.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/foo/withhead.xml create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/foo/withheadandfoot.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/form/edit.php create mode 100644 dist/foos-1.0.0/components/com_foos/tmpl/form/edit.xml create mode 100644 dist/foos-1.0.0/foos.xml create mode 100644 dist/foos-1.0.0/media/com_foos/js/admin-foos-letter.js create mode 100644 dist/foos-1.0.0/media/com_foos/js/admin-foos-modal.js create mode 100644 dist/foos-1.0.0/script.php create mode 100644 dist/pkg-foos-1.0.0.zip create mode 120000 dist/pkg-foos-current.zip create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/access.xml create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/config.xml create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/foos.xml create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/forms/filter_foos.xml create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/forms/foo.xml create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/language/de-DE/com_foos.ini create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/language/de-DE/com_foos.sys.ini create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/language/en-GB/com_foos.ini create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/language/en-GB/com_foos.sys.ini create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/script.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/services/provider.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/install.mysql.utf8.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/uninstall.mysql.utf8.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/10.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/12.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/13.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/15.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/16.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/18.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/21.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/sql/updates/mysql/24.0.0.sql create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Controller/DisplayController.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Controller/FooController.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Controller/FoosController.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Extension/FoosComponent.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Field/Modal/FooField.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Helper/AssociationsHelper.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Helper/FooHelper.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Model/FooModel.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Model/FoosModel.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Rule/LetterRule.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Service/HTML/AdministratorService.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Service/HTML/Icon.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/Table/FooTable.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/View/Foo/HtmlView.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/src/View/Foos/HtmlView.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foo/edit.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foo/edit_associations.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foo/modal.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foos/default.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foos/default_batch.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foos/default_batch_body.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foos/default_batch_footer.php create mode 100644 dist/tmp/cbuild/administrator/components/com_foos/tmpl/foos/modal.php create mode 100644 dist/tmp/cbuild/components/com_foos/forms/foo.xml create mode 100644 dist/tmp/cbuild/components/com_foos/forms/form.xml create mode 100644 dist/tmp/cbuild/components/com_foos/language/de-DE/com_foos.ini create mode 100644 dist/tmp/cbuild/components/com_foos/language/en-GB/com_foos.ini create mode 100644 dist/tmp/cbuild/components/com_foos/src/Controller/DisplayController.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Controller/FooController.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Helper/AssociationHelper.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Helper/Route.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Helper/RouteHelper.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Model/FeaturedModel.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Model/FooModel.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Model/FormModel.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/Service/Router.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/View/Featured/HtmlView.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/View/Foo/HtmlView.php create mode 100644 dist/tmp/cbuild/components/com_foos/src/View/Form/HtmlView.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/featured/default.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/featured/default.xml create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/featured/default_items.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/foo/default.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/foo/default.xml create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/foo/withhead.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/foo/withhead.xml create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/foo/withheadandfoot.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/form/edit.php create mode 100644 dist/tmp/cbuild/components/com_foos/tmpl/form/edit.xml create mode 100644 dist/tmp/cbuild/media/com_foos/js/admin-foos-letter.js create mode 100644 dist/tmp/cbuild/media/com_foos/js/admin-foos-modal.js create mode 100644 dist/zips/com_foos.zip diff --git a/dist/current b/dist/current new file mode 120000 index 00000000..ad98bb65 --- /dev/null +++ b/dist/current @@ -0,0 +1 @@ +/home/astrid/git/joomla-development/boilerplate/dist/foos-1.0.0 \ No newline at end of file diff --git a/dist/foos-1.0.0/administrator/components/com_foos/access.xml b/dist/foos-1.0.0/administrator/components/com_foos/access.xml new file mode 100644 index 00000000..51a4b102 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/access.xml @@ -0,0 +1,35 @@ + + +
+ + + + + + + + + +
+
+ + + + + +
+
+ + + + + + +
+
+ + + + +
+
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/config.xml b/dist/foos-1.0.0/administrator/components/com_foos/config.xml new file mode 100644 index 00000000..0becb70f --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/config.xml @@ -0,0 +1,55 @@ + + +
+ + + + + + + + + + + + + + +
+
+ +
+
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/foos.xml b/dist/foos-1.0.0/administrator/components/com_foos/foos.xml new file mode 100644 index 00000000..0bb8e820 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/foos.xml @@ -0,0 +1,64 @@ + + + COM_FOOS + [DATE] + [AUTHOR] + [AUTHOR_EMAIL] + [AUTHOR_URL] + [COPYRIGHT] + GNU General Public License version 2 or later; + __BUMP_VERSION__ + COM_FOOS_XML_DESCRIPTION + Joomla\Component\Foos + script.php + + + sql/install.mysql.utf8.sql + + + + + sql/uninstall.mysql.utf8.sql + + + + + sql/updates/mysql + + + + + language + src + tmpl + + + js + + + + + COM_FOOS + + COM_FOOS + JCATEGORY + + + access.xml + foos.xml + config.xml + forms + language + services + sql + src + tmpl + + + https://raw.githubusercontent.com/astridx/boilerplate/tutorial/changelog.xml + + https://raw.githubusercontent.com/astridx/boilerplate/tutorial/foo_update.xml + + + diff --git a/dist/foos-1.0.0/administrator/components/com_foos/forms/filter_foos.xml b/dist/foos-1.0.0/administrator/components/com_foos/forms/filter_foos.xml new file mode 100644 index 00000000..613db7b4 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/forms/filter_foos.xml @@ -0,0 +1,103 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/forms/foo.xml b/dist/foos-1.0.0/administrator/components/com_foos/forms/foo.xml new file mode 100644 index 00000000..705442bf --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/forms/foo.xml @@ -0,0 +1,147 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+
+
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.ini b/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.ini new file mode 100644 index 00000000..7509a5f5 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.ini @@ -0,0 +1,16 @@ +COM_FOOS="[PROJECT_NAME]" +COM_FOOS_CONFIGURATION="Foo Optionen" + +COM_FOOS_MANAGER_FOO_NEW="Neu" +COM_FOOS_MANAGER_FOO_EDIT="Bearbeiten" +COM_FOOS_MANAGER_FOOS="Foo Manager" + +COM_FOOS_TABLE_TABLEHEAD_NAME="Name" +COM_FOOS_TABLE_TABLEHEAD_ID="ID" +COM_FOOS_ERROR_FOO_NOT_FOUND="Foo nicht gefunden" + +COM_FOOS_FIELD_NAME_LABEL="Name" + +COM_FOOS_FIELD_FOO_SHOW_CATEGORY_LABEL="Namensschild anzeigen" +COM_FOOS_FIELD_CONFIG_INDIVIDUAL_FOO_DESC="Diese Einstellungen gelten für alle foo." +COM_FOOS_FIELD_CONFIG_INDIVIDUAL_FOO_DISPLAY="Foo" diff --git a/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.sys.ini b/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.sys.ini new file mode 100644 index 00000000..10b620d2 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/language/de-DE/com_foos.sys.ini @@ -0,0 +1,15 @@ +COM_FOOS="[PROJECT_NAME]" +COM_FOOS_XML_DESCRIPTION="Foo Komponente" + +COM_FOOS_INSTALLERSCRIPT_PREFLIGHT="

Alles hier passiert vor der Installation / Aktualisierung / Deinstallation der Komponente

" +COM_FOOS_INSTALLERSCRIPT_UPDATE="

TDie Komponente wurde aktualisiert

" +COM_FOOS_INSTALLERSCRIPT_UNINSTALL="

Die Komponente wurde deinstalliert

" +COM_FOOS_INSTALLERSCRIPT_INSTALL="

Die Komponente wurde installiert

" +COM_FOOS_INSTALLERSCRIPT_POSTFLIGHT="

Alles hier passiert nach der Installation / Aktualisierung / Deinstallation der Komponente

" + +COM_FOOS_FOO_VIEW_DEFAULT_TITLE="Ein einzelnes Foo" +COM_FOOS_FOO_VIEW_DEFAULT_DESC="Dies ist ein Link zu den Informationen für ein Foo." +COM_FOOS_SELECT_FOO_LABEL="Wählen Sie ein foo aus" + +COM_FOOS_CHANGE_FOO="Ändern Sie ein foo" +COM_FOOS_SELECT_A_FOO="Wählen Sie ein foo aus" diff --git a/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.ini b/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.ini new file mode 100644 index 00000000..69cc46c1 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.ini @@ -0,0 +1,53 @@ +COM_FOOS="[PROJECT_NAME]" +COM_FOOS_CONFIGURATION="Foo Options" +COM_FOOS_FOOS="Foos" +COM_FOOS_CATEGORIES="Categories" + +COM_FOOS_MANAGER_FOO_NEW="New" +COM_FOOS_MANAGER_FOO_EDIT="Edit" +COM_FOOS_MANAGER_FOOS="Foo Manager" + +COM_FOOS_TABLE_TABLEHEAD_NAME="Name" +COM_FOOS_TABLE_TABLEHEAD_ID="ID" +COM_FOOS_ERROR_FOO_NOT_FOUND="Foo not found" + +COM_FOOS_FIELD_NAME_LABEL="Name" + +COM_FOOS_FIELD_FOO_SHOW_CATEGORY_LABEL="Show name label" +COM_FOOS_FIELD_CONFIG_INDIVIDUAL_FOO_DESC="These settings apply for all foo." +COM_FOOS_FIELD_CONFIG_INDIVIDUAL_FOO_DISPLAY="Foo" + +COM_FOOS_FIELD_PUBLISH_DOWN_LABEL="Finish Publishing" +COM_FOOS_FIELD_PUBLISH_UP_LABEL="Start Publishing" +COM_FOOS_N_ITEMS_PUBLISHED="%d foos published." +COM_FOOS_N_ITEMS_PUBLISHED_1="%d foo published." +COM_FOOS_N_ITEMS_UNPUBLISHED="%d foos unpublished." +COM_FOOS_N_ITEMS_UNPUBLISHED_1="%d foo unpublished." +COM_FOOS_N_ITEMS_CHECKED_IN_1="%d foo checked in." +COM_FOOS_N_ITEMS_CHECKED_IN_MORE="%d foos checked in." +COM_FOOS_N_ITEMS_FEATURED="%d foos featured." +COM_FOOS_N_ITEMS_FEATURED_1="Foo featured." +COM_FOOS_N_ITEMS_UNFEATURED="%d foos unfeatured." +COM_FOOS_N_ITEMS_UNFEATURED_1="Foo unfeatured." + +COM_FOOS_EDIT_FOO="Edit Foo" +COM_FOOS_NEW_FOO="New Foo" + +COM_FOOS_HEADING_ASSOCIATION="Association" +COM_FOOS_CHANGE_FOO="Change a foo" +COM_FOOS_SELECT_A_FOO="Select a foo" + +COM_FOOS_TABLE_CAPTION="Foo Table Caption" + +COM_FOOS_N_ITEMS_ARCHIVED="%d foos archived." +COM_FOOS_N_ITEMS_ARCHIVED_1="%d foo archived." +COM_FOOS_N_ITEMS_DELETED="%d foos deleted." +COM_FOOS_N_ITEMS_DELETED_1="%d foo deleted." +COM_FOOS_N_ITEMS_TRASHED="%d foos trashed." +COM_FOOS_N_ITEMS_TRASHED_1="%d foo trashed." +COM_FOO_MANAGER_FOOS="Foos" + +COM_FOOS_FIELD_PARAMS_NAME_LABEL="Show Name" + +COM_FOOS_FILTER_SEARCH_DESC="Search in foo name." +COM_FOOS_FILTER_SEARCH_LABEL="Search Foos" diff --git a/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.sys.ini b/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.sys.ini new file mode 100644 index 00000000..2078fadf --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/language/en-GB/com_foos.sys.ini @@ -0,0 +1,18 @@ +COM_FOOS="[PROJECT_NAME]" +COM_FOOS_XML_DESCRIPTION="Foo Component" + +COM_FOOS_INSTALLERSCRIPT_PREFLIGHT="

Anything here happens before the installation/update/uninstallation of the component

" +COM_FOOS_INSTALLERSCRIPT_UPDATE="

The component has been updated

" +COM_FOOS_INSTALLERSCRIPT_UNINSTALL="

The component has been uninstalled

" +COM_FOOS_INSTALLERSCRIPT_INSTALL="

The component has been installed

" +COM_FOOS_INSTALLERSCRIPT_POSTFLIGHT="

Anything here happens after the installation/update/uninstallation of the component

" + +COM_FOOS_FOO_VIEW_DEFAULT_TITLE="Single Foo" +COM_FOOS_FOO_VIEW_DEFAULT_DESC="This links to the information for one foo." +COM_FOOS_SELECT_FOO_LABEL="Select a foo" + +COM_FOOS_CHANGE_FOO="Change a foo" +COM_FOOS_SELECT_A_FOO="Select a foo" + +COM_FOOS_FOO_VIEW_WITHHEAD_TITLE="Single Foo with a headertext" +COM_FOOS_FOO_VIEW_WITHHEAD_DESC="This links to the information for one foo with a headertext." diff --git a/dist/foos-1.0.0/administrator/components/com_foos/script.php b/dist/foos-1.0.0/administrator/components/com_foos/script.php new file mode 100644 index 00000000..d96bd9d7 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/script.php @@ -0,0 +1,237 @@ + 'com_foos', + 'title' => 'Uncategorised', + 'description' => '', + 'published' => 1, + 'access' => 1, + 'level' => 1, + 'path' => 'uncategorised', + 'params' => '{"category_layout":"","image":"", "image_alt":""}', + 'metadesc' => '', + 'metakey' => '', + 'metadata' => '{"author":"","robots":""}', + 'created_time' => Factory::getDate()->toSql(), + 'created_user_id' => (int) $this->getAdminId(), + 'rules' => array(), + 'parent_id' => 1, + ); + + // Bind the data to the table + if (!$category->bind($data)) + { + return false; + } + + // Check to make sure our data is valid. + if (!$category->check()) + { + return false; + } + + // Store the category. + if (!$category->store(true)) + { + return false; + } + + return true; + } + + /** + * Method to uninstall the extension + * + * @param InstallerAdapter $parent The class calling this method + * + * @return boolean True on success + * + * @since __BUMP_VERSION__ + */ + public function uninstall($parent): bool + { + echo Text::_('COM_FOOS_INSTALLERSCRIPT_UNINSTALL'); + + return true; + } + + /** + * Method to update the extension + * + * @param InstallerAdapter $parent The class calling this method + * + * @return boolean True on success + * + * @since __BUMP_VERSION__ + * + */ + public function update($parent): bool + { + echo Text::_('COM_FOOS_INSTALLERSCRIPT_UPDATE'); + + return true; + } + + /** + * Function called before extension installation/update/removal procedure commences + * + * @param string $type The type of change (install, update or discover_install, not uninstall) + * @param InstallerAdapter $parent The class calling this method + * + * @return boolean True on success + * + * @since __BUMP_VERSION__ + * + * @throws Exception + */ + public function preflight($type, $parent): bool + { + if ($type !== 'uninstall') + { + // Check for the minimum PHP version before continuing + if (!empty($this->minimumPHPVersion) && version_compare(PHP_VERSION, $this->minimumPHPVersion, '<')) + { + Log::add( + Text::sprintf('JLIB_INSTALLER_MINIMUM_PHP', $this->minimumPHPVersion), + Log::WARNING, + 'jerror' + ); + + return false; + } + + // Check for the minimum Joomla version before continuing + if (!empty($this->minimumJoomlaVersion) && version_compare(JVERSION, $this->minimumJoomlaVersion, '<')) + { + Log::add( + Text::sprintf('JLIB_INSTALLER_MINIMUM_JOOMLA', $this->minimumJoomlaVersion), + Log::WARNING, + 'jerror' + ); + + return false; + } + } + + echo Text::_('COM_FOOS_INSTALLERSCRIPT_PREFLIGHT'); + + return true; + } + + /** + * Function called after extension installation/update/removal procedure commences + * + * @param string $type The type of change (install, update or discover_install, not uninstall) + * @param InstallerAdapter $parent The class calling this method + * + * @return boolean True on success + * + * @since __BUMP_VERSION__ + * + */ + public function postflight($type, $parent) + { + echo Text::_('COM_FOOS_INSTALLERSCRIPT_POSTFLIGHT'); + + return true; + } + + /** + * Retrieve the admin user id. + * + * @return integer|boolean One Administrator ID. + * + * @since 3.2 + */ + private function getAdminId() + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + // Select the admin user ID + $query + ->clear() + ->select($db->quoteName('u') . '.' . $db->quoteName('id')) + ->from($db->quoteName('#__users', 'u')) + ->join( + 'LEFT', + $db->quoteName('#__user_usergroup_map', 'map') + . ' ON ' . $db->quoteName('map') . '.' . $db->quoteName('user_id') + . ' = ' . $db->quoteName('u') . '.' . $db->quoteName('id') + ) + ->join( + 'LEFT', + $db->quoteName('#__usergroups', 'g') + . ' ON ' . $db->quoteName('map') . '.' . $db->quoteName('group_id') + . ' = ' . $db->quoteName('g') . '.' . $db->quoteName('id') + ) + ->where( + $db->quoteName('g') . '.' . $db->quoteName('title') + . ' = ' . $db->quote('Super Users') + ); + + $db->setQuery($query); + $id = $db->loadResult(); + + if (!$id || $id instanceof \Exception) + { + return false; + } + + return $id; + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/services/provider.php b/dist/foos-1.0.0/administrator/components/com_foos/services/provider.php new file mode 100644 index 00000000..5ed10c49 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/services/provider.php @@ -0,0 +1,66 @@ +set(AssociationExtensionInterface::class, new AssociationsHelper); + + $container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Foos')); + $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Foos')); + $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Foos')); + + $container->set( + ComponentInterface::class, + function (Container $container) + { + $component = new FoosComponent($container->get(ComponentDispatcherFactoryInterface::class)); + + $component->setRegistry($container->get(Registry::class)); + $component->setMVCFactory($container->get(MVCFactoryInterface::class)); + $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); + $component->setAssociationExtension($container->get(AssociationExtensionInterface::class)); + + return $component; + } + ); + } +}; diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/install.mysql.utf8.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/install.mysql.utf8.sql new file mode 100644 index 00000000..9c814133 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/install.mysql.utf8.sql @@ -0,0 +1,47 @@ +CREATE TABLE IF NOT EXISTS `#__foos_details` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '', + `name` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +ALTER TABLE `#__foos_details` ADD COLUMN `access` int(10) unsigned NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_access` (`access`); + +ALTER TABLE `#__foos_details` ADD COLUMN `catid` int(11) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `state` tinyint(3) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_catid` (`catid`); + +ALTER TABLE `#__foos_details` ADD COLUMN `published` tinyint(1) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `publish_up` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `publish_down` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_state` (`published`); + +ALTER TABLE `#__foos_details` ADD COLUMN `language` char(7) NOT NULL DEFAULT '*' AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_language` (`language`); + +ALTER TABLE `#__foos_details` ADD COLUMN `ordering` int(11) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `params` text NOT NULL AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `checked_out` int(10) unsigned NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `checked_out_time` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_checkout` (`checked_out`); + +ALTER TABLE `#__foos_details` ADD COLUMN `featured` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Set if contact is featured.'; + +ALTER TABLE `#__foos_details` ADD KEY `idx_featured_catid` (`featured`,`catid`); + +INSERT INTO `#__foos_details` (`id`, `alias`, `checked_out_time`, `checked_out`, `params`, `ordering`, `language`, `publish_down`, `publish_up`, `published`, `state`, `catid`, `access`, `name`, `featured`) VALUES +(1, 'astrid', '0000-00-00 00:00:00', 0, '{\"show_name\":\"\",\"foos_layout\":\"\"}', 0, '*', NULL, NULL, 1, 0, 8, 5, 'Astrid', 0), +(2, 'nina', '0000-00-00 00:00:00', 0, '{\"show_name\":\"\",\"foos_layout\":\"\"}', 0, '*', '2020-02-27 15:08:16', '2020-02-11 15:08:12', 1, 0, 8, 1, 'Nina', 0), +(3, 'elmar', '0000-00-00 00:00:00', 0, '{\"show_name\":\"\",\"foos_layout\":\"\"}', 0, '*', '2020-02-27 15:08:16', '2020-02-11 15:08:12', 1, 0, 8, 1, 'Elmar', 1); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/uninstall.mysql.utf8.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/uninstall.mysql.utf8.sql new file mode 100644 index 00000000..0fd7415a --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/uninstall.mysql.utf8.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `#__foos_details`; diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/10.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/10.0.0.sql new file mode 100644 index 00000000..fd5b6cc0 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/10.0.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `access` int(10) unsigned NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_access` (`access`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/12.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/12.0.0.sql new file mode 100644 index 00000000..fc849665 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/12.0.0.sql @@ -0,0 +1,5 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `catid` int(11) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `state` tinyint(3) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_catid` (`catid`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/13.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/13.0.0.sql new file mode 100644 index 00000000..a8ad5bb2 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/13.0.0.sql @@ -0,0 +1,7 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `published` tinyint(1) NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `publish_up` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `publish_down` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_state` (`published`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/15.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/15.0.0.sql new file mode 100644 index 00000000..d3ab7545 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/15.0.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `language` char(7) NOT NULL DEFAULT '*' AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_language` (`language`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/16.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/16.0.0.sql new file mode 100644 index 00000000..49c221e3 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/16.0.0.sql @@ -0,0 +1 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `ordering` int(11) NOT NULL DEFAULT 0 AFTER `alias`; diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/18.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/18.0.0.sql new file mode 100644 index 00000000..7f48eb52 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/18.0.0.sql @@ -0,0 +1 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `params` text NOT NULL AFTER `alias`; diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/21.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/21.0.0.sql new file mode 100644 index 00000000..9498eedf --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/21.0.0.sql @@ -0,0 +1,5 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `checked_out` int(10) unsigned NOT NULL DEFAULT 0 AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD COLUMN `checked_out_time` datetime AFTER `alias`; + +ALTER TABLE `#__foos_details` ADD KEY `idx_checkout` (`checked_out`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/24.0.0.sql b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/24.0.0.sql new file mode 100644 index 00000000..ffc693fa --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/sql/updates/mysql/24.0.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__foos_details` ADD COLUMN `featured` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Set if contact is featured.'; + +ALTER TABLE `#__foos_details` ADD KEY `idx_featured_catid` (`featured`,`catid`); diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/DisplayController.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/DisplayController.php new file mode 100644 index 00000000..dd744c88 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/DisplayController.php @@ -0,0 +1,47 @@ +checkToken(); + + $model = $this->getModel('Foo', 'Administrator', array()); + + // Preset the redirect + $this->setRedirect(Route::_('index.php?option=com_foos&view=foos' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/FoosController.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/FoosController.php new file mode 100644 index 00000000..f4d33b0c --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Controller/FoosController.php @@ -0,0 +1,119 @@ +registerTask('unfeatured', 'featured'); + } + + /** + * Method to toggle the featured setting of a list of foos. + * + * @return void + * + * @since __BUMP_VERSION__ + */ + public function featured() + { + // Check for request forgeries + $this->checkToken(); + + $ids = $this->input->get('cid', array(), 'array'); + $values = array('featured' => 1, 'unfeatured' => 0); + $task = $this->getTask(); + $value = ArrayHelper::getValue($values, $task, 0, 'int'); + + $model = $this->getModel(); + + // Access checks. + foreach ($ids as $i => $id) + { + $item = $model->getItem($id); + + if (!$this->app->getIdentity()->authorise('core.edit.state', 'com_foos.category.' . (int) $item->catid)) + { + // Prune items that you can't change. + unset($ids[$i]); + $this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice'); + } + } + + if (empty($ids)) + { + $this->app->enqueueMessage(Text::_('COM_FOOS_NO_ITEM_SELECTED'), 'warning'); + } + else + { + // Publish the items. + if (!$model->featured($ids, $value)) + { + $this->app->enqueueMessage($model->getError(), 'warning'); + } + + if ($value == 1) + { + $message = Text::plural('COM_FOOS_N_ITEMS_FEATURED', count($ids)); + } + else + { + $message = Text::plural('COM_FOOS_N_ITEMS_UNFEATURED', count($ids)); + } + } + + $this->setRedirect('index.php?option=com_foos&view=foos', $message); + } + + /** + * Proxy for getModel. + * + * @param string $name The name of the model. + * @param string $prefix The prefix for the PHP class name. + * @param array $config Array of configuration parameters. + * + * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel + * + * @since __BUMP_VERSION__ + */ + public function getModel($name = 'Foo', $prefix = 'Administrator', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Extension/FoosComponent.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Extension/FoosComponent.php new file mode 100644 index 00000000..fee69c98 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Extension/FoosComponent.php @@ -0,0 +1,115 @@ +getRegistry()->register('foosadministrator', new AdministratorService); + $this->getRegistry()->register('fooicon', new Icon($container->get(SiteApplication::class))); + } + + /** + * Adds Count Items for Category Manager. + * + * @param \stdClass[] $items The category objects + * @param string $section The section + * + * @return void + * + * @since __BUMP_VERSION__ + */ + public function countItems(array $items, string $section) + { + try + { + $config = (object) array( + 'related_tbl' => $this->getTableNameForSection($section), + 'state_col' => 'published', + 'group_col' => 'catid', + 'relation_type' => 'category_or_group', + ); + + ContentHelper::countRelations($items, $config); + } + catch (\Exception $e) + { + // Ignore it + } + } + + /** + * Returns the table for the count items functions for the given section. + * + * @param string $section The section + * + * @return string|null + * + * @since __BUMP_VERSION__ + */ + protected function getTableNameForSection(string $section = null) + { + return ($section === 'category' ? 'categories' : 'foos_details'); + + } + + /** + * Returns the state column for the count items functions for the given section. + * + * @param string $section The section + * + * @return string|null + * + * @since __BUMP_VERSION__ + */ + protected function getStateColumnForSection(string $section = null) + { + return 'published'; + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Field/Modal/FooField.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Field/Modal/FooField.php new file mode 100644 index 00000000..6d4eb910 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Field/Modal/FooField.php @@ -0,0 +1,199 @@ +element['clear'] != 'false'); + $allowSelect = ((string) $this->element['select'] != 'false'); + + // The active foo id field. + $value = (int) $this->value > 0 ? (int) $this->value : ''; + + // Create the modal id. + $modalId = 'Foo_' . $this->id; + + // Add the modal field script to the document head. + HTMLHelper::_('script', 'system/fields/modal-fields.min.js', array('version' => 'auto', 'relative' => true)); + + // Script to proxy the select modal function to the modal-fields.js file. + if ($allowSelect) + { + static $scriptSelect = null; + + if (is_null($scriptSelect)) + { + $scriptSelect = array(); + } + + if (!isset($scriptSelect[$this->id])) + { + Factory::getDocument()->addScriptDeclaration(" + function jSelectFoo_" . $this->id . "(id, title, object) { + window.processModalSelect('Foo', '" . $this->id . "', id, title, '', object); + } + " + ); + + $scriptSelect[$this->id] = true; + } + } + + // Setup variables for display. + $linkFoos = 'index.php?option=com_foos&view=foos&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; + $linkFoo = 'index.php?option=com_foos&view=foo&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; + $modalTitle = Text::_('COM_FOOS_CHANGE_FOO'); + + if (isset($this->element['language'])) + { + $linkFoos .= '&forcedLanguage=' . $this->element['language']; + $linkFoo .= '&forcedLanguage=' . $this->element['language']; + $modalTitle .= ' — ' . $this->element['label']; + } + + $urlSelect = $linkFoos . '&function=jSelectFoo_' . $this->id; + + if ($value) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('name')) + ->from($db->quoteName('#__foos_details')) + ->where($db->quoteName('id') . ' = ' . (int) $value); + $db->setQuery($query); + + try + { + $title = $db->loadResult(); + } + catch (\RuntimeException $e) + { + Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + + $title = empty($title) ? Text::_('COM_FOOS_SELECT_A_FOO') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + + // The current foo display field. + $html = ''; + + if ($allowSelect || $allowNew || $allowEdit || $allowClear) + { + $html .= ''; + } + + $html .= ''; + + if ($allowSelect || $allowNew || $allowEdit || $allowClear) + { + $html .= ''; + } + + // Select foo button + if ($allowSelect) + { + $html .= '' + . ' ' . Text::_('JSELECT') + . ''; + } + + // Clear foo button + if ($allowClear) + { + $html .= '' + . '' . Text::_('JCLEAR') + . ''; + } + + if ($allowSelect || $allowNew || $allowEdit || $allowClear) + { + $html .= ''; + } + + // Select foo modal + if ($allowSelect) + { + $html .= HTMLHelper::_( + 'bootstrap.renderModal', + 'ModalSelect' . $modalId, + array( + 'title' => $modalTitle, + 'url' => $urlSelect, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => 70, + 'modalWidth' => 80, + 'footer' => '', + ) + ); + } + + // Note: class='required' for client side validation. + $class = $this->required ? ' class="required modal-value"' : ''; + + $html .= ''; + + return $html; + } + + /** + * Method to get the field label markup. + * + * @return string The field label markup. + * + * @since __DEPLOY_VERSION__ + */ + protected function getLabel() + { + return str_replace($this->id, $this->id . '_name', parent::getLabel()); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/AssociationsHelper.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/AssociationsHelper.php new file mode 100644 index 00000000..226e94a3 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/AssociationsHelper.php @@ -0,0 +1,237 @@ +getType($typeName); + + $context = $this->extension . '.item'; + $catidField = 'catid'; + + if ($typeName === 'category') + { + $context = 'com_categories.item'; + $catidField = ''; + } + + // Get the associations. + $associations = Associations::getAssociations( + $this->extension, + $type['tables']['a'], + $context, + $id, + 'id', + 'alias', + $catidField + ); + + return $associations; + } + + /** + * Get item information + * + * @param string $typeName The item type + * @param int $id The id of item for which we need the associated items + * + * @return Table|null + * + * @since __BUMP_VERSION__ + */ + public function getItem($typeName, $id) + { + if (empty($id)) + { + return null; + } + + $table = null; + + switch ($typeName) + { + case 'foo': + $table = Table::getInstance('FooTable', 'Joomla\\Component\\Foos\\Administrator\\Table\\'); + break; + + case 'category': + $table = Table::getInstance('Category'); + break; + } + + if (empty($table)) + { + return null; + } + + $table->load($id); + + return $table; + } + + /** + * Get information about the type + * + * @param string $typeName The item type + * + * @return array Array of item types + * + * @since __BUMP_VERSION__ + */ + public function getType($typeName = '') + { + $fields = $this->getFieldsTemplate(); + $tables = array(); + $joins = array(); + $support = $this->getSupportTemplate(); + $title = ''; + + if (in_array($typeName, $this->itemTypes)) + { + switch ($typeName) + { + case 'foo': + $fields['title'] = 'a.name'; + $fields['state'] = 'a.published'; + + $support['state'] = true; + $support['acl'] = true; + $support['category'] = true; + $support['save2copy'] = true; + + $tables = array( + 'a' => '#__foos_details' + ); + + $title = 'foo'; + break; + + case 'category': + $fields['created_user_id'] = 'a.created_user_id'; + $fields['ordering'] = 'a.lft'; + $fields['level'] = 'a.level'; + $fields['catid'] = ''; + $fields['state'] = 'a.published'; + + $support['state'] = true; + $support['acl'] = true; + $support['checkout'] = false; + $support['level'] = false; + + $tables = array( + 'a' => '#__categories' + ); + + $title = 'category'; + break; + } + } + + return array( + 'fields' => $fields, + 'support' => $support, + 'tables' => $tables, + 'joins' => $joins, + 'title' => $title + ); + } + + /** + * Get default values for fields array + * + * @return array + * + * @since __BUMP_VERSION__ + */ + protected function getFieldsTemplate() + { + return array( + 'id' => 'a.id', + 'title' => 'a.title', + 'alias' => 'a.alias', + 'ordering' => '', + 'menutype' => '', + 'level' => '', + 'catid' => 'a.catid', + 'language' => 'a.language', + 'access' => 'a.access', + 'state' => 'a.state', + 'created_user_id' => '', + 'checked_out' => '', + 'checked_out_time' => '' + ); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/FooHelper.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/FooHelper.php new file mode 100644 index 00000000..e113bbbe --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Helper/FooHelper.php @@ -0,0 +1,50 @@ +get('custom_fields_enable', '1')) + { + \JHtmlSidebar::addEntry( + Text::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_foos.foo', + $vName == 'fields.fields' + ); + \JHtmlSidebar::addEntry( + Text::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_fields&view=groups&context=com_foos.foo', + $vName == 'fields.groups' + ); + } + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FooModel.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FooModel.php new file mode 100644 index 00000000..e07edd76 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FooModel.php @@ -0,0 +1,248 @@ + 'batchAccess', + 'language_id' => 'batchLanguage', + 'user_id' => 'batchUser', + ); + + /** + * Method to get the row form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return \JForm|boolean A \JForm object on success, false on failure + * + * @since __BUMP_VERSION__ + */ + public function getForm($data = array(), $loadData = true) + { + // Get the form. + $form = $this->loadForm('com_foos.foo', 'foo', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + return $form; + } + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since __BUMP_VERSION__ + */ + protected function loadFormData() + { + $app = Factory::getApplication(); + + $data = $this->getItem(); + + $this->preprocessData('com_foos.foo', $data); + + return $data; + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since __BUMP_VERSION__ + */ + public function getItem($pk = null) + { + $item = parent::getItem($pk); + + // Load associated foo items + $assoc = Associations::isEnabled(); + + if ($assoc) + { + $item->associations = array(); + + if ($item->id != null) + { + $associations = Associations::getAssociations('com_foos', '#__foos_details', 'com_foos.item', $item->id, 'id', null); + + foreach ($associations as $tag => $association) + { + $item->associations[$tag] = $association->id; + } + } + } + + return $item; + } + + /** + * Method to toggle the featured setting of foos. + * + * @param array $pks The ids of the items to toggle. + * @param integer $value The value to toggle to. + * + * @return boolean True on success. + * + * @since __BUMP_VERSION__ + */ + public function featured($pks, $value = 0) + { + // Sanitize the ids. + $pks = ArrayHelper::toInteger((array) $pks); + + if (empty($pks)) + { + $this->setError(Text::_('COM_FOOS_NO_ITEM_SELECTED')); + + return false; + } + + $table = $this->getTable(); + + try + { + $db = $this->getDbo(); + + $query = $db->getQuery(true); + $query->update($db->quoteName('#__foos_details')); + $query->set($db->quoteName('featured') . ' = :featured'); + $query->whereIn($db->quoteName('id'), $pks); + $query->bind(':featured', $value, ParameterType::INTEGER); + + $db->setQuery($query); + + $db->execute(); + } + catch (\Exception $e) + { + $this->setError($e->getMessage()); + + return false; + } + + $table->reorder(); + + // Clean component's cache + $this->cleanCache(); + + return true; + } + + /** + * Preprocess the form. + * + * @param \JForm $form Form object. + * @param object $data Data object. + * @param string $group Group name. + * + * @return void + * + * @since __BUMP_VERSION__ + */ + protected function preprocessForm(\JForm $form, $data, $group = 'content') + { + if (Associations::isEnabled()) + { + $languages = LanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + + if (count($languages) > 1) + { + $addform = new \SimpleXMLElement('
'); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + + foreach ($languages as $language) + { + $field = $fieldset->addChild('field'); + $field->addAttribute('name', $language->lang_code); + $field->addAttribute('type', 'modal_foo'); + $field->addAttribute('language', $language->lang_code); + $field->addAttribute('label', $language->title); + $field->addAttribute('translate_label', 'false'); + $field->addAttribute('select', 'true'); + $field->addAttribute('new', 'true'); + $field->addAttribute('edit', 'true'); + $field->addAttribute('clear', 'true'); + } + + $form->load($addform, false); + } + } + + parent::preprocessForm($form, $data, $group); + } + + /** + * Prepare and sanitise the table prior to saving. + * + * @param \Joomla\CMS\Table\Table $table The Table object + * + * @return void + * + * @since __BUMP_VERSION__ + */ + protected function prepareTable($table) + { + $table->generateAlias(); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FoosModel.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FoosModel.php new file mode 100644 index 00000000..13d37f74 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Model/FoosModel.php @@ -0,0 +1,263 @@ +getDbo(); + $query = $db->getQuery(true); + + // Select the required fields from the table. + $query->select( + $db->quoteName( + explode( + ', ', + $this->getState( + 'list.select', + 'a.id, a.name, a.catid' . + ', a.access' . + ', a.checked_out' . + ', a.checked_out_time' . + ', a.language' . + ', a.ordering' . + ', a.featured' . + ', a.state' . + ', a.published' . + ', a.publish_up, a.publish_down' + ) + ) + ) + ); + + $query->from($db->quoteName('#__foos_details', 'a')); + + // Join over the asset groups. + $query->select($db->quoteName('ag.title', 'access_level')) + ->join( + 'LEFT', + $db->quoteName('#__viewlevels', 'ag') . ' ON ' . $db->quoteName('ag.id') . ' = ' . $db->quoteName('a.access') + ); + + // Join over the categories. + $query->select($db->quoteName('c.title', 'category_title')) + ->join( + 'LEFT', + $db->quoteName('#__categories', 'c') . ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('a.catid') + ); + + // Join over the language + $query->select($db->quoteName('l.title', 'language_title')) + ->select($db->quoteName('l.image', 'language_image')) + ->join( + 'LEFT', + $db->quoteName('#__languages', 'l') . ' ON ' . $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language') + ); + + // Join over the associations. + if (Associations::isEnabled()) + { + $subQuery = $db->getQuery(true) + ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') + ->from($db->quoteName('#__associations', 'asso1')) + ->join('INNER', $db->quoteName('#__associations', 'asso2'), $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) + ->where( + [ + $db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), + $db->quoteName('asso1.context') . ' = ' . $db->quote('com_foos.item'), + ] + ); + + $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); + } + + // Join over the users for the checked out user. + $query->select($db->quoteName('uc.name', 'editor')) + ->join( + 'LEFT', + $db->quoteName('#__users', 'uc') . ' ON ' . $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out') + ); + + // Filter on the language. + if ($language = $this->getState('filter.language')) + { + $query->where($db->quoteName('a.language') . ' = ' . $db->quote($language)); + } + + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where($db->quoteName('a.access') . ' = ' . (int) $access); + } + + // Filter by published state + $published = (string) $this->getState('filter.published'); + + if (is_numeric($published)) + { + $query->where($db->quoteName('a.published') . ' = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(' . $db->quoteName('a.published') . ' = 0 OR ' . $db->quoteName('a.published') . ' = 1)'); + } + + // Filter by a single or group of categories. + $categoryId = $this->getState('filter.category_id'); + + if (is_numeric($categoryId)) + { + $query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId); + } + elseif (is_array($categoryId)) + { + $query->where($db->quoteName('a.catid') . ' IN (' . implode(',', ArrayHelper::toInteger($categoryId)) . ')'); + } + + // Filter by search in name. + $search = $this->getState('filter.search'); + + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where( + '(' . $db->quoteName('a.name') . ' LIKE ' . $search . ')' + ); + } + } + + // Filter by featured. + $featured = (string) $this->getState('filter.featured'); + + if (in_array($featured, ['0','1'])) + { + $query->where($db->quoteName('a.featured') . ' = ' . (int) $featured); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.name'); + $orderDirn = $this->state->get('list.direction', 'asc'); + + if ($orderCol == 'a.ordering' || $orderCol == 'category_title') + { + $orderCol = $db->quoteName('c.title') . ' ' . $orderDirn . ', ' . $db->quoteName('a.ordering'); + } + + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + + return $query; + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + * @since __BUMP_VERSION__ + */ + protected function populateState($ordering = 'a.name', $direction = 'asc') + { + $app = Factory::getApplication(); + $forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd'); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Adjust the context to support forced languages. + if ($forcedLanguage) + { + $this->context .= '.' . $forcedLanguage; + } + + // List state information. + parent::populateState($ordering, $direction); + + // Force a language. + if (!empty($forcedLanguage)) + { + $this->setState('filter.language', $forcedLanguage); + } + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Rule/LetterRule.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Rule/LetterRule.php new file mode 100644 index 00000000..370749e4 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Rule/LetterRule.php @@ -0,0 +1,37 @@ + $associated) + { + $associations[$tag] = (int) $associated->id; + } + + // Get the associated foo items + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select('c.id, c.name as title') + ->select('l.sef as lang_sef, lang_code') + ->from('#__foos_details as c') + ->select('cat.title as category_title') + ->join('LEFT', '#__categories as cat ON cat.id=c.catid') + ->where('c.id IN (' . implode(',', array_values($associations)) . ')') + ->where('c.id != ' . $fooid) + ->join('LEFT', '#__languages as l ON c.language=l.lang_code') + ->select('l.image') + ->select('l.title as language_title'); + $db->setQuery($query); + + try + { + $items = $db->loadObjectList('id'); + } + catch (\RuntimeException $e) + { + throw new \Exception($e->getMessage(), 500, $e); + } + + if ($items) + { + foreach ($items as &$item) + { + $text = strtoupper($item->lang_sef); + $url = Route::_('index.php?option=com_foos&task=foo.edit&id=' . (int) $item->id); + $tooltip = '' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '
' + . htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '
' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); + $classes = 'badge badge-secondary'; + + $item->link = '' . $text . '' + . ''; + } + } + + $html = LayoutHelper::render('joomla.content.associations', $items); + } + + return $html; + } + /** + * Show the featured/not-featured icon. + * + * @param integer $value The featured value. + * @param integer $i Id of the item. + * @param boolean $canChange Whether the value can be changed or not. + * + * @return string The anchor tag to toggle featured/unfeatured foos. + * + * @since __BUMP_VERSION__ + */ + public function featured($value, $i, $canChange = true) + { + // Array of image, task, title, action + $states = array( + 0 => array('unfeatured', 'foos.featured', 'COM_FOOS_UNFEATURED', 'JGLOBAL_TOGGLE_FEATURED'), + 1 => array('featured', 'foos.unfeatured', 'JFEATURED', 'JGLOBAL_TOGGLE_FEATURED'), + ); + $state = ArrayHelper::getValue($states, (int) $value, $states[1]); + $icon = $state[0]; + + if ($canChange) + { + $html = ''; + } + else + { + $html = ''; + } + + return $html; + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Service/HTML/Icon.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Service/HTML/Icon.php new file mode 100644 index 00000000..6af121b6 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Service/HTML/Icon.php @@ -0,0 +1,198 @@ +application = $application; + } + + /** + * Method to generate a link to the create item page for the given category + * + * @param object $category The category information + * @param Registry $params The item parameters + * @param array $attribs Optional attributes for the link + * + * @return string The HTML markup for the create item link + * + * @since __DEPLOY_VERSION__ + */ + public static function create($category, $params, $attribs = array()) + { + $uri = Uri::getInstance(); + + $url = 'index.php?option=com_foos&task=foo.add&return=' . base64_encode($uri) . '&id=0&catid=' . $category->id; + + $text = LayoutHelper::render('joomla.content.icons.create', array('params' => $params, 'legacy' => false)); + + // Add the button classes to the attribs array + if (isset($attribs['class'])) + { + $attribs['class'] .= ' btn btn-primary'; + } + else + { + $attribs['class'] = 'btn btn-primary'; + } + + $button = HTMLHelper::_('link', Route::_($url), $text, $attribs); + + $output = '' . $button . ''; + + return $output; + } + + /** + * Display an edit icon for the foo. + * + * This icon will not display in a popup window, nor if the foo is trashed. + * Edit access checks must be performed in the calling code. + * + * @param object $foo The foo information + * @param Registry $params The item parameters + * @param array $attribs Optional attributes for the link + * @param boolean $legacy True to use legacy images, false to use icomoon based graphic + * + * @return string The HTML for the foo edit icon. + * + * @since __DEPLOY_VERSION__ + */ + public static function edit($foo, $params, $attribs = array(), $legacy = false) + { + $user = Factory::getUser(); + $uri = Uri::getInstance(); + + // Ignore if in a popup window. + if ($params && $params->get('popup')) + { + return ''; + } + + // Ignore if the state is negative (trashed). + if ($foo->published < 0) + { + return ''; + } + + // Set the link class + $attribs['class'] = 'dropdown-item'; + + // Show checked_out icon if the foo is checked out by a different user + if (property_exists($foo, 'checked_out') + && property_exists($foo, 'checked_out_time') + && $foo->checked_out > 0 + && $foo->checked_out != $user->get('id')) + { + $checkoutUser = Factory::getUser($foo->checked_out); + $date = HTMLHelper::_('date', $foo->checked_out_time); + $tooltip = Text::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . Text::sprintf('COM_FOOS_CHECKED_OUT_BY', $checkoutUser->name) + . '
' . $date; + + $text = LayoutHelper::render('joomla.content.icons.edit_lock', array('tooltip' => $tooltip, 'legacy' => $legacy)); + + $output = HTMLHelper::_('link', '#', $text, $attribs); + + return $output; + } + + if (!isset($foo->slug)) + { + $foo->slug = ""; + } + + $fooUrl = RouteHelper::getFooRoute($foo->slug, $foo->catid, $foo->language); + $url = $fooUrl . '&task=foo.edit&id=' . $foo->id . '&return=' . base64_encode($uri); + + if ($foo->published == 0) + { + $overlib = Text::_('JUNPUBLISHED'); + } + else + { + $overlib = Text::_('JPUBLISHED'); + } + + if (!isset($foo->created)) + { + $date = HTMLHelper::_('date', 'now'); + } + else + { + $date = HTMLHelper::_('date', $foo->created); + } + + if (!isset($created_by_alias) && !isset($foo->created_by)) + { + $author = ''; + } + else + { + $author = $foo->created_by_alias ?: Factory::getUser($foo->created_by)->name; + } + + $overlib .= '<br />'; + $overlib .= $date; + $overlib .= '<br />'; + $overlib .= Text::sprintf('COM_FOOS_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8')); + + $icon = $foo->published ? 'edit' : 'eye-slash'; + + if (strtotime($foo->publish_up) > strtotime(Factory::getDate()) + || ((strtotime($foo->publish_down) < strtotime(Factory::getDate())) && $foo->publish_down != Factory::getDbo()->getNullDate())) + { + $icon = 'eye-slash'; + } + + $text = ' '; + $text .= Text::_('JGLOBAL_EDIT'); + + $attribs['title'] = Text::_('COM_FOOS_EDIT_CONTACT'); + $output = HTMLHelper::_('link', Route::_($url), $text, $attribs); + + return $output; + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/Table/FooTable.php b/dist/foos-1.0.0/administrator/components/com_foos/src/Table/FooTable.php new file mode 100644 index 00000000..f7aed038 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/Table/FooTable.php @@ -0,0 +1,127 @@ +typeAlias = 'com_foos.foo'; + + parent::__construct('#__foos_details', 'id', $db); + } + + /** + * Stores a foo. + * + * @param boolean $updateNulls True to update fields even if they are null. + * + * @return boolean True on success, false on failure. + * + * @since __BUMP_VERSION__ + */ + public function store($updateNulls = false) + { + // Transform the params field + if (is_array($this->params)) + { + $registry = new Registry($this->params); + $this->params = (string) $registry; + } + + return parent::store($updateNulls); + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = ApplicationHelper::stringURLSafe($this->alias, $this->language); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + + /** + * Overloaded check function + * + * @return boolean + * + * @see Table::check + * @since __BUMP_VERSION__ + */ + public function check() + { + try + { + parent::check(); + } + catch (\Exception $e) + { + $this->setError($e->getMessage()); + + return false; + } + + // Check the publish down date is not earlier than publish up. + if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) + { + $this->setError(Text::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); + + return false; + } + + // Set publish_up, publish_down to null if not set + if (!$this->publish_up) + { + $this->publish_up = null; + } + + if (!$this->publish_down) + { + $this->publish_down = null; + } + + return true; + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foo/HtmlView.php b/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foo/HtmlView.php new file mode 100644 index 00000000..a321951b --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foo/HtmlView.php @@ -0,0 +1,150 @@ +item = $this->get('Item'); + + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->input->get('forcedLanguage', '', 'cmd')) + { + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); + $this->form->setFieldAttribute('language', 'readonly', 'true'); + + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); + } + + $this->addToolbar(); + + return parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since __BUMP_VERSION__ + */ + protected function addToolbar() + { + Factory::getApplication()->input->set('hidemainmenu', true); + + $user = Factory::getUser(); + $userId = $user->id; + + $isNew = ($this->item->id == 0); + + ToolbarHelper::title($isNew ? Text::_('COM_FOOS_MANAGER_FOO_NEW') : Text::_('COM_FOOS_MANAGER_FOO_EDIT'), 'address foo'); + + // Since we don't track these assets at the item level, use the category id. + $canDo = ContentHelper::getActions('com_foos', 'category', $this->item->catid); + + // Build the actions for new and existing records. + if ($isNew) + { + // For new records, check the create permission. + if ($isNew && (count($user->getAuthorisedCategories('com_foos', 'core.create')) > 0)) + { + ToolbarHelper::apply('foo.apply'); + ToolbarHelper::saveGroup( + [ + ['save', 'foo.save'], + ['save2new', 'foo.save2new'] + ], + 'btn-success' + ); + } + + ToolbarHelper::cancel('foo.cancel'); + } + else + { + // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. + $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); + $toolbarButtons = []; + + // Can't save the record if it's not editable + if ($itemEditable) + { + ToolbarHelper::apply('foo.apply'); + $toolbarButtons[] = ['save', 'foo.save']; + + // We can save this record, but check the create permission to see if we can return to make a new one. + if ($canDo->get('core.create')) + { + $toolbarButtons[] = ['save2new', 'foo.save2new']; + } + } + + // If checked out, we can still save + if ($canDo->get('core.create')) + { + $toolbarButtons[] = ['save2copy', 'foo.save2copy']; + } + + ToolbarHelper::saveGroup( + $toolbarButtons, + 'btn-success' + ); + + if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) + { + ToolbarHelper::custom('foo.editAssociations', 'contract', 'contract', 'JTOOLBAR_ASSOCIATIONS', false, false); + } + + ToolbarHelper::cancel('foo.cancel', 'JTOOLBAR_CLOSE'); + } + + ToolbarHelper::divider(); + ToolbarHelper::help('', false, 'http://joomla.org'); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foos/HtmlView.php b/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foos/HtmlView.php new file mode 100644 index 00000000..4c623dc1 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/src/View/Foos/HtmlView.php @@ -0,0 +1,219 @@ +items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + $this->state = $this->get('State'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new GenericDataException(implode("\n", $errors), 500); + } + + // Preprocess the list of items to find ordering divisions. + // TODO: Complete the ordering stuff with nested sets + foreach ($this->items as &$item) + { + $item->order_up = true; + $item->order_dn = true; + } + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = \JHtmlSidebar::render(); + } + else + { + // In article associations modal we need to remove language filter if forcing a language. + // We also need to change the category filter to show show categories with All or the forced language. + if ($forcedLanguage = Factory::getApplication()->input->get('forcedLanguage', '', 'CMD')) + { + // If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field. + $languageXml = new \SimpleXMLElement(''); + $this->filterForm->setField($languageXml, 'filter', true); + + // Also, unset the active language filter so the search tools is not open by default with this filter. + unset($this->activeFilters['language']); + + // One last changes needed is to change the category filter to just show categories with All language or with the forced language. + $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter'); + } + } + + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since __BUMP_VERSION__ + */ + protected function addToolbar() + { + FooHelper::addSubmenu('foos'); + $this->sidebar = \JHtmlSidebar::render(); + + $canDo = ContentHelper::getActions('com_foos', 'category', $this->state->get('filter.category_id')); + $user = Factory::getUser(); + + // Get the toolbar object instance + $toolbar = Toolbar::getInstance('toolbar'); + + ToolbarHelper::title(Text::_('COM_FOOS_MANAGER_FOOS'), 'address foo'); + + if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_foos', 'core.create')) > 0) + { + $toolbar->addNew('foo.add'); + } + + if ($canDo->get('core.edit.state')) + { + $dropdown = $toolbar->dropdownButton('status-group') + ->text('JTOOLBAR_CHANGE_STATUS') + ->toggleSplit(false) + ->icon('fa fa-ellipsis-h') + ->buttonClass('btn btn-action') + ->listCheck(true); + $childBar = $dropdown->getChildToolbar(); + $childBar->publish('foos.publish')->listCheck(true); + $childBar->unpublish('foos.unpublish')->listCheck(true); + + $childBar->standardButton('featured') + ->text('JFEATURE') + ->task('foos.featured') + ->listCheck(true); + $childBar->standardButton('unfeatured') + ->text('JUNFEATURE') + ->task('foos.unfeatured') + ->listCheck(true); + + $childBar->archive('foos.archive')->listCheck(true); + + if ($user->authorise('core.admin')) + { + $childBar->checkin('foos.checkin')->listCheck(true); + } + + if ($this->state->get('filter.published') != -2) + { + $childBar->trash('foos.trash')->listCheck(true); + } + + if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) + { + $childBar->delete('foos.delete') + ->text('JTOOLBAR_EMPTY_TRASH') + ->message('JGLOBAL_CONFIRM_DELETE') + ->listCheck(true); + } + + // Add a batch button + if ($user->authorise('core.create', 'com_foos') + && $user->authorise('core.edit', 'com_foos') + && $user->authorise('core.edit.state', 'com_foos')) + { + $childBar->popupButton('batch') + ->text('JTOOLBAR_BATCH') + ->selector('collapseModal') + ->listCheck(true); + } + } + + if ($user->authorise('core.admin', 'com_foos') || $user->authorise('core.options', 'com_foos')) + { + $toolbar->preferences('com_foos'); + } + + ToolbarHelper::divider(); + ToolbarHelper::help('', false, 'http://joomla.org'); + + HTMLHelper::_('sidebar.setAction', 'index.php?option=com_foos'); + } +} diff --git a/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit.php b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit.php new file mode 100644 index 00000000..ebaef704 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit.php @@ -0,0 +1,89 @@ + 'auto', 'relative' => true)); + +$app = Factory::getApplication(); +$input = $app->input; + +$assoc = Associations::isEnabled(); + +$this->ignore_fieldsets = array('item_associations'); +$this->useCoreUI = true; + +// In case of modal +$isModal = $input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; +?> + + + + +
+ 'details')); ?> + + item->id) ? Text::_('COM_FOOS_NEW_FOO') : Text::_('COM_FOOS_EDIT_FOO')); ?> +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ + + + + loadTemplate('associations'); ?> + + + + + + + + +
+
+
+ +
+ +
+
+
+
+ + + +
+ + + + diff --git a/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit_associations.php b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit_associations.php new file mode 100644 index 00000000..fa0f1004 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foo/edit_associations.php @@ -0,0 +1,14 @@ + +
+ setLayout('edit'); ?> + loadTemplate(); ?> +
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default.php b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default.php new file mode 100644 index 00000000..e65849f8 --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default.php @@ -0,0 +1,182 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$saveOrder = $listOrder == 'a.ordering'; + +if ($saveOrder && !empty($this->items)) +{ + $saveOrderingUrl = 'index.php?option=com_foos&task=foos.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; +} +?> +
+
+ sidebar)) : ?> +
+ sidebar; ?> +
+ +
+
+ $this)); ?> + items)) : ?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + + items); + foreach ($this->items as $i => $item) : + ?> + + + + + + + + + + + + + + + + + + +
+ , +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + id); ?> + + checked_out) : ?> + editor, $item->checked_out_time, 'foos.', true); ?> + +
+ escape($item->name); ?> +
+ '; ?> + + escape($item->name); ?> + +
+ escape($item->category_title); ?> +
+
+ featured, $i, $canChange); ?> + + access_level; ?> + + published, $i, 'foos.', $canChange, 'cb', $item->publish_up, $item->publish_down); + ?> + + + association) : ?> + id); + ?> + + + + + id; ?> +
+ + pagination->getListFooter(); ?> + + Text::_('COM_FOOS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer'), + ), + $this->loadTemplate('batch_body') + ); ?> + + + + + +
+
+
+
diff --git a/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch.php b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch.php new file mode 100644 index 00000000..a8b26c1f --- /dev/null +++ b/dist/foos-1.0.0/administrator/components/com_foos/tmpl/foos/default_batch.php @@ -0,0 +1,59 @@ +state->get('filter.published'); +$noUser = true; +?> +