From 68f4ba57c7b48f596b562b8866e2443e1171087e Mon Sep 17 00:00:00 2001 From: Susanne Moog Date: Wed, 23 Oct 2019 17:19:39 +0200 Subject: [PATCH] [TASK] Add old released version --- Classes/Controller/AbstractController.php | 123 +-- Classes/Controller/BlogController.php | 315 ++++--- Classes/Controller/CommentController.php | 135 ++- Classes/Controller/PostController.php | 303 ++++--- Classes/Domain/Model/Administrator.php | 37 +- Classes/Domain/Model/Blog.php | 405 ++++----- Classes/Domain/Model/Comment.php | 274 +++--- Classes/Domain/Model/Info.php | 57 -- Classes/Domain/Model/Person.php | 296 +++---- Classes/Domain/Model/Post.php | 830 +++++++----------- Classes/Domain/Model/Tag.php | 93 +- .../Repository/AdministratorRepository.php | 36 +- Classes/Domain/Repository/BlogRepository.php | 58 +- .../Domain/Repository/PersonRepository.php | 39 +- Classes/Domain/Repository/PostRepository.php | 270 +++--- Classes/Domain/Service/BlogFactory.php | 115 +++ Classes/Domain/Validator/BlogValidator.php | 66 +- Classes/Domain/Validator/PostValidator.php | 40 - Classes/Service/BlogFactory.php | 117 --- Classes/ViewHelpers/GravatarViewHelper.php | 119 +-- Configuration/TCA/Overrides/fe_users.php | 10 - Configuration/TCA/Overrides/sys_template.php | 5 - Configuration/TCA/Overrides/tt_content.php | 42 - Configuration/TCA/tca.php | 517 +++++++++++ .../TCA/tx_blogexample_domain_model_blog.php | 190 ---- .../tx_blogexample_domain_model_comment.php | 78 -- .../TCA/tx_blogexample_domain_model_info.php | 95 -- .../tx_blogexample_domain_model_person.php | 132 --- .../TCA/tx_blogexample_domain_model_post.php | 254 ------ .../TCA/tx_blogexample_domain_model_tag.php | 98 --- .../{setup.typoscript => setup.txt} | 0 .../{constants.typoscript => constants.txt} | 4 +- .../{setup.typoscript => setup.txt} | 37 +- README.md | 7 - .../Private/Backend/Layouts/Default.html | 2 +- Resources/Private/Language/locallang.xml | 22 +- Resources/Private/Language/locallang_db.xml | 4 +- Resources/Private/Layouts/Default.html | 4 +- Resources/Private/Partials/FormErrors.html | 14 +- Resources/Private/Templates/Blog/Index.html | 129 +-- Resources/Private/Templates/Post/Index.html | 154 ++-- Resources/Private/Templates/Post/Show.html | 115 +-- Resources/Public/Icons/module-blog.svg | 15 - composer.json | 20 - ext_autoload.php | 20 + ext_emconf.php | 57 +- ext_icon.gif | Bin 0 -> 177 bytes ext_icon.svg | 15 - ext_localconf.php | 107 +-- ext_tables.php | 207 ++++- ext_tables.sql | 152 +++- ext_typoscript_setup.typoscript | 29 - 52 files changed, 2762 insertions(+), 3501 deletions(-) delete mode 100644 Classes/Domain/Model/Info.php create mode 100644 Classes/Domain/Service/BlogFactory.php delete mode 100644 Classes/Domain/Validator/PostValidator.php delete mode 100644 Classes/Service/BlogFactory.php delete mode 100644 Configuration/TCA/Overrides/fe_users.php delete mode 100644 Configuration/TCA/Overrides/sys_template.php delete mode 100644 Configuration/TCA/Overrides/tt_content.php create mode 100644 Configuration/TCA/tca.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_blog.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_comment.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_info.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_person.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_post.php delete mode 100644 Configuration/TCA/tx_blogexample_domain_model_tag.php rename Configuration/TypoScript/DefaultStyles/{setup.typoscript => setup.txt} (100%) rename Configuration/TypoScript/{constants.typoscript => constants.txt} (91%) rename Configuration/TypoScript/{setup.typoscript => setup.txt} (65%) delete mode 100644 README.md delete mode 100644 Resources/Public/Icons/module-blog.svg delete mode 100644 composer.json create mode 100644 ext_autoload.php create mode 100644 ext_icon.gif delete mode 100644 ext_icon.svg delete mode 100644 ext_typoscript_setup.typoscript diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index 8900b4a..8b1e8d8 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -1,72 +1,75 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Core\Messaging\FlashMessage; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * Abstract base controller for the BlogExample extension */ -abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController -{ +abstract class Tx_BlogExample_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController { - /** - * Override getErrorFlashMessage to present - * nice flash error messages. - * - * @return string - */ - protected function getErrorFlashMessage() - { - $defaultFlashMessage = parent::getErrorFlashMessage(); - $locallangKey = sprintf('error.%s.%s', $this->request->getControllerName(), $this->actionMethodName); - return $this->translate($locallangKey, $defaultFlashMessage); - } + /** + * Override getErrorFlashMessage to present + * nice flash error messages. + * + * @return string + */ + protected function getErrorFlashMessage() { + $defaultFlashMessage = parent::getErrorFlashMessage(); + $locallangKey = sprintf('error.%s.%s', $this->request->getControllerName(), $this->actionMethodName); + return $this->translate($locallangKey, $defaultFlashMessage); + } - /** - * helper function to render localized flashmessages - * - * @param string $action - * @param integer $severity optional severity code. One of the t3lib_FlashMessage constants - * @return void - */ - public function addLocalizedFlashMessage(string $action, int $severity = FlashMessage::OK): void - { - $messageLocallangKey = sprintf('flashmessage.%s.%s', $this->request->getControllerName(), $action); - $localizedMessage = $this->translate($messageLocallangKey, '[' . $messageLocallangKey . ']'); - $titleLocallangKey = sprintf('%s.title', $messageLocallangKey); - $localizedTitle = $this->translate($titleLocallangKey, '[' . $titleLocallangKey . ']'); - $this->addFlashMessage($localizedMessage, $localizedTitle, $severity); - } + /** + * helper function to render localized flashmessages + * + * @param string $action + * @param integer $severity optional severity code. One of the t3lib_FlashMessage constants + * @return void + */ + protected function addFlashMessage($action, $severity = t3lib_FlashMessage::OK) { + $messageLocallangKey = sprintf('flashmessage.%s.%s', $this->request->getControllerName(), $action); + $localizedMessage = $this->translate($messageLocallangKey, '[' . $messageLocallangKey . ']'); + $titleLocallangKey = sprintf('%s.title', $messageLocallangKey); + $localizedTitle = $this->translate($titleLocallangKey, '[' . $titleLocallangKey . ']'); + $this->flashMessageContainer->add($localizedMessage, $localizedTitle, $severity); + } + + /** + * helper function to use localized strings in BlogExample controllers + * + * @param string $key locallang key + * @param string $default the default message to show if key was not found + * @return string + */ + protected function translate($key, $defaultMessage = '') { + $message = Tx_Extbase_Utility_Localization::translate($key, 'BlogExample'); + if ($message === NULL) { + $message = $defaultMessage; + } + return $message; + } - /** - * helper function to use localized strings in BlogExample controllers - * - * @param string $key locallang key - * @param string $defaultMessage - * @return string - */ - protected function translate(string $key, string $defaultMessage = ''): string - { - $message = LocalizationUtility::translate($key, 'BlogExample'); - if ($message === null) { - $message = $defaultMessage; - } - return $message; - } } + +?> \ No newline at end of file diff --git a/Classes/Controller/BlogController.php b/Classes/Controller/BlogController.php index e53df72..1d2cb89 100644 --- a/Classes/Controller/BlogController.php +++ b/Classes/Controller/BlogController.php @@ -1,173 +1,162 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use FriendsOfTYPO3\BlogExample\Domain\Model\Blog; -use FriendsOfTYPO3\BlogExample\Domain\Repository\AdministratorRepository; -use FriendsOfTYPO3\BlogExample\Domain\Repository\BlogRepository; -use FriendsOfTYPO3\BlogExample\Service\BlogFactory; -use TYPO3\CMS\Core\Messaging\FlashMessage; -use TYPO3\CMS\Extbase\Annotation\IgnoreValidation; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * The blog controller for the BlogExample extension */ -class BlogController extends AbstractController -{ - - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Repository\BlogRepository - */ - protected $blogRepository; - - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Repository\AdministratorRepository - */ - protected $administratorRepository; - - /** - * Dependency injection of the Administrator Repository - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Repository\AdministratorRepository $administratorRepository - * @return void - */ - public function injectAdministratorRepository(AdministratorRepository $administratorRepository): void - { - $this->administratorRepository = $administratorRepository; - } - - /** - * BlogController constructor. - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Repository\BlogRepository $blogRepository - */ - public function __construct(BlogRepository $blogRepository) - { - parent::__construct(); - $this->blogRepository = $blogRepository; - } - - /** - * Index action for this controller. Displays a list of blogs. - * - * @return void - */ - public function indexAction() - { - $allAvailableBlogs = $this->blogRepository->findAll(); - $this->view->assign('blogs', $allAvailableBlogs); - } - - /** - * Displays a form for creating a new blog - * - * @param Blog $newBlog A fresh blog object taken as a basis for the rendering - * @return void - * @IgnoreValidation $newBlog - */ - public function newAction(Blog $newBlog = null) - { - $this->view->assign('newBlog', $newBlog); - $this->view->assign('administrators', $this->administratorRepository->findAll()); - } - - /** - * Creates a new blog - * - * @param Blog $newBlog A fresh Blog object which has not yet been added to the repository - * @return void - */ - public function createAction(Blog $newBlog) - { - // TODO access protection - $this->blogRepository->add($newBlog); - $this->addFlashMessage('created'); - $this->redirect('index'); - } - - /** - * Displays a form for editing an existing blog - * - * @param Blog $blog The blog to be edited. This might also be a clone of the original blog already containing modifications if the edit form has been submitted, contained errors and therefore ended up in this action again. - * @return void - * @IgnoreValidation $blog - */ - public function editAction(Blog $blog) - { - $this->view->assign('blog', $blog); - $this->view->assign('administrators', $this->administratorRepository->findAll()); - } - - /** - * Updates an existing blog - * - * @param Blog $blog A not yet persisted clone of the original blog containing the modifications - * @return void - */ - public function updateAction(Blog $blog) - { - // TODO access protection - $this->blogRepository->update($blog); - $this->addFlashMessage('updated'); - $this->redirect('index'); - } - - /** - * Deletes an existing blog - * - * @param Blog $blog The blog to delete - * @return void - */ - public function deleteAction(Blog $blog) - { - // TODO access protection - $this->blogRepository->remove($blog); - $this->addFlashMessage('deleted', FlashMessage::INFO); - $this->redirect('index'); - } - - /** - * Deletes an existing blog - * - * @return void - */ - public function deleteAllAction() - { - // TODO access protection - $this->blogRepository->removeAll(); - $this->redirect('index'); - } - - - /** - * Creates a several new blogs - * - * @return void - */ - public function populateAction() - { - // TODO access protection - $numberOfExistingBlogs = $this->blogRepository->countAll(); - $blogFactory = $this->objectManager->get(BlogFactory::class); - for ($blogNumber = $numberOfExistingBlogs + 1; $blogNumber < ($numberOfExistingBlogs + 5); $blogNumber++) { - $blog = $blogFactory->createBlog($blogNumber); - $this->blogRepository->add($blog); - } - $this->addFlashMessage('populated'); - $this->redirect('index'); - } +class Tx_BlogExample_Controller_BlogController extends Tx_BlogExample_Controller_AbstractController { + + /** + * @var Tx_BlogExample_Domain_Model_BlogRepository + */ + protected $blogRepository; + + /** + * @var Tx_BlogExample_Domain_Repository_AdministratorRepository + */ + protected $administratorRepository; + + /** ++ * Dependency injection of the Blog Repository + * + * @param Tx_BlogExample_Domain_Repository_BlogRepository $blogRepository + * @return void +- */ + public function injectBlogRepository(Tx_BlogExample_Domain_Repository_BlogRepository $blogRepository) { + $this->blogRepository = $blogRepository; + } + + /** ++ * Dependency injection of the Administrator Repository + * + * @param Tx_BlogExample_Domain_Repository_AdministratorRepository $administratorRepository + * @return void +- */ + public function injectAdministratorRepository(Tx_BlogExample_Domain_Repository_AdministratorRepository $administratorRepository) { + $this->administratorRepository = $administratorRepository; + } + + /** + * Index action for this controller. Displays a list of blogs. + * + * @return void + */ + public function indexAction() { + $this->view->assign('blogs', $this->blogRepository->findAll()); + } + + /** + * Displays a form for creating a new blog + * + * @param Tx_BlogExample_Domain_Model_Blog $newBlog A fresh blog object taken as a basis for the rendering + * @return void + * @dontvalidate $newBlog + */ + public function newAction(Tx_BlogExample_Domain_Model_Blog $newBlog = NULL) { + $this->view->assign('newBlog', $newBlog); + $this->view->assign('administrators', $this->administratorRepository->findAll()); + } + + /** + * Creates a new blog + * + * @param Tx_BlogExample_Domain_Model_Blog $newBlog A fresh Blog object which has not yet been added to the repository + * @return void + */ + public function createAction(Tx_BlogExample_Domain_Model_Blog $newBlog) { + // TODO access protection + $this->blogRepository->add($newBlog); + $this->addFlashMessage('created'); + $this->redirect('index'); + } + + /** + * Displays a form for editing an existing blog + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog to be edited. This might also be a clone of the original blog already containing modifications if the edit form has been submitted, contained errors and therefore ended up in this action again. + * @return void + * @dontvalidate $blog + */ + public function editAction(Tx_BlogExample_Domain_Model_Blog $blog) { + $this->view->assign('blog', $blog); + $this->view->assign('administrators', $this->administratorRepository->findAll()); + } + + /** + * Updates an existing blog + * + * @param Tx_BlogExample_Domain_Model_Blog $blog A not yet persisted clone of the original blog containing the modifications + * @return void + */ + public function updateAction(Tx_BlogExample_Domain_Model_Blog $blog) { + // TODO access protection + $this->blogRepository->update($blog); + $this->addFlashMessage('updated'); + $this->redirect('index'); + } + + /** + * Deletes an existing blog + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog to delete + * @return void + */ + public function deleteAction(Tx_BlogExample_Domain_Model_Blog $blog) { + // TODO access protection + $this->blogRepository->remove($blog); + $this->addFlashMessage('deleted', t3lib_FlashMessage::INFO); + $this->redirect('index'); + } + + /** + * Deletes an existing blog + * + * @return void + */ + public function deleteAllAction() { + // TODO access protection + $this->blogRepository->removeAll(); + $this->redirect('index'); + } + + /** + * Creates a several new blogs + * + * @return void + */ + public function populateAction() { + // TODO access protection + $numberOfExistingBlogs = $this->blogRepository->countAll(); + $blogFactory = $this->objectManager->get('Tx_BlogExample_Domain_Service_BlogFactory'); + for ($blogNumber = $numberOfExistingBlogs + 1; $blogNumber < ($numberOfExistingBlogs + 5); $blogNumber++) { + $blog = $blogFactory->createBlog($blogNumber); + $this->blogRepository->add($blog); + } + $this->addFlashMessage('populated'); + $this->redirect('index'); + } } +?> \ No newline at end of file diff --git a/Classes/Controller/CommentController.php b/Classes/Controller/CommentController.php index 78bc539..3f128c1 100644 --- a/Classes/Controller/CommentController.php +++ b/Classes/Controller/CommentController.php @@ -1,87 +1,72 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * The comment controller for the BlogExample extension */ -class CommentController extends AbstractController -{ - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Repository\PostRepository - */ - private $postRepository; - +class Tx_BlogExample_Controller_CommentController extends Tx_BlogExample_Controller_AbstractController { - /** - * @param \FriendsOfTYPO3\BlogExample\Domain\Repository\PostRepository $postRepository - */ - public function injectPostRepository(PostRepository $postRepository): void - { - $this->postRepository = $postRepository; - } + /** + * Adds a comment to a blog post and redirects to single view + * + * @param Tx_BlogExample_Domain_Model_Post $post The post the comment is related to + * @param Tx_BlogExample_Domain_Model_Comment $newComment The comment to create + * @return void + */ + public function createAction(Tx_BlogExample_Domain_Model_Post $post, Tx_BlogExample_Domain_Model_Comment $newComment) { + $post->addComment($newComment); + $this->addFlashMessage('created'); + $this->redirect('show', 'Post', NULL, array('post' => $post)); + } - /** - * Adds a comment to a blog post and redirects to single view - * - * @param Post $post The post the comment is related to - * @param Comment $newComment The comment to create - * @return void - */ - public function createAction(Post $post, Comment $newComment): void - { - $post->addComment($newComment); - $this->postRepository->update($post); - $this->addFlashMessage('created'); - $this->redirect('show', 'Post', null, ['post' => $post]); - } + /** + * Deletes an existing comment + * + * @param Tx_BlogExample_Domain_Model_Post $post The post the comment is related to + * @param Tx_BlogExample_Domain_Model_Comment $comment The comment to be deleted + * @return void + */ + public function deleteAction(Tx_BlogExample_Domain_Model_Post $post, Tx_BlogExample_Domain_Model_Comment $comment) { + // TODO access protection + $post->removeComment($comment); + $this->addFlashMessage('deleted', t3lib_FlashMessage::INFO); + $this->redirect('show', 'Post', NULL, array('post' => $post)); + } - /** - * Deletes an existing comment - * - * @param Post $post The post the comment is related to - * @param Comment $comment The comment to be deleted - * @return void - */ - public function deleteAction(Post $post, Comment $comment): void - { - // TODO access protection - $post->removeComment($comment); - $this->postRepository->update($post); - $this->addFlashMessage('deleted', FlashMessage::INFO); - $this->redirect('show', 'Post', null, ['post' => $post]); - } - - /** - * Deletes all comments of the given post - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Post $post - */ - public function deleteAllAction(Post $post): void - { - // TODO access protection - $post->removeAllComments(); - $this->postRepository->update($post); - $this->addFlashMessage('deletedAll', FlashMessage::INFO); - $this->redirect('edit', 'Post', null, ['post' => $post, 'blog' => $post->getBlog()]); - } + /** + * Deletes all comments of the given post + * + * @param Tx_BlogExample_Domain_Model_Post $post The post the comment is related to + * @return void + */ + public function deleteAllAction(Tx_BlogExample_Domain_Model_Post $post) { + // TODO access protection + $post->removeAllComments(); + $this->addFlashMessage('deletedAll', t3lib_FlashMessage::INFO); + $this->redirect('edit', 'Post', NULL, array('post' => $post, 'blog' => $post->getBlog())); + } } + +?> \ No newline at end of file diff --git a/Classes/Controller/PostController.php b/Classes/Controller/PostController.php index 23e4f3c..130a488 100644 --- a/Classes/Controller/PostController.php +++ b/Classes/Controller/PostController.php @@ -1,175 +1,168 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * The post controller for the BlogExample extension */ -class PostController extends \FriendsOfTYPO3\BlogExample\Controller\AbstractController -{ +class Tx_BlogExample_Controller_PostController extends Tx_BlogExample_Controller_AbstractController { - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Repository\PostRepository - */ - protected $postRepository; + /** + * @var Tx_BlogExample_Domain_Model_PostRepository + */ + protected $postRepository; - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Repository\PersonRepository - */ - protected $personRepository; + /** + * @var Tx_BlogExample_Domain_Repository_PersonRepository + */ + protected $personRepository; - /** - * Dependency injection of the Post Repository - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Repository\PostRepository $postRepository - * @return void - */ - public function injectPostRepository(PostRepository $postRepository): void - { - $this->postRepository = $postRepository; - } + /** + * Dependency injection of the Post Repository + * + * @param Tx_BlogExample_Domain_Repository_PostRepository $postRepository + * @return void + */ + public function injectPostRepository(Tx_BlogExample_Domain_Repository_PostRepository $postRepository) { + $this->postRepository = $postRepository; + } - /** - * Dependency injection of the Post Repository - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Repository\PersonRepository $personRepository - * @return void - */ - public function injectPersonRepository(PersonRepository $personRepository): void - { - $this->personRepository = $personRepository; - } + /** + * Dependency injection of the Post Repository + * + * @param Tx_BlogExample_Domain_Repository_PersonRepository $personRepository + * @return void + */ + public function injectPersonRepository(Tx_BlogExample_Domain_Repository_PersonRepository $personRepository) { + $this->personRepository = $personRepository; + } - /** - * Displays a list of posts. If $tag is set only posts matching this tag are shown - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog The blog to show the posts of - * @param string $tag The name of the tag to show the posts for - * @return void - */ - public function indexAction(Blog $blog, $tag = null) - { - if (empty($tag)) { - $posts = $this->postRepository->findByBlog($blog); - } else { - $tag = urldecode($tag); - $posts = $this->postRepository->findByTagAndBlog($tag, $blog); - $this->view->assign('tag', $tag); - } - $this->view->assign('blog', $blog); - $this->view->assign('posts', $posts); - } + /** + * Displays a list of posts. If $tag is set only posts matching this tag are shown + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog to show the posts of + * @param string $tag The name of the tag to show the posts for + * @return void + */ + public function indexAction(Tx_BlogExample_Domain_Model_Blog $blog, $tag = NULL) { + if (empty($tag)) { + $posts = $this->postRepository->findByBlog($blog); + } else { + $tag = urldecode($tag); + $posts = $this->postRepository->findByTagAndBlog($tag, $blog); + $this->view->assign('tag', $tag); + } + $this->view->assign('blog', $blog); + $this->view->assign('posts', $posts); + } - /** - * Displays one single post - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Post $post The post to display - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Comment $newComment A new comment - * @return void - * @IgnoreValidation $newComment - */ - public function showAction(Post $post, Comment $newComment = null) - { - $this->view->assign('post', $post); - $this->view->assign('newComment', $newComment); - } + /** + * Displays one single post + * + * @param Tx_BlogExample_Domain_Model_Post $post The post to display + * @param Tx_BlogExample_Domain_Model_Comment $newComment A new comment + * @return void + * @dontvalidate $newComment + */ + public function showAction(Tx_BlogExample_Domain_Model_Post $post, Tx_BlogExample_Domain_Model_Comment $newComment = NULL) { + $this->view->assign('post', $post); + $this->view->assign('newComment', $newComment); + } - /** - * Displays a form for creating a new post - * - * @param Blog $blog The blog the post belogs to - * @param Post $newPost A fresh post object taken as a basis for the rendering - * @return void - * @IgnoreValidation $newPost - */ - public function newAction(Blog $blog, Post $newPost = null) - { - $this->view->assign('authors', $this->personRepository->findAll()); - $this->view->assign('blog', $blog); - $this->view->assign('newPost', $newPost); - $this->view->assign('remainingPosts', $this->postRepository->findByBlog($blog)); - } + /** + * Displays a form for creating a new post + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belogs to + * @param Tx_BlogExample_Domain_Model_Post $newPost A fresh post object taken as a basis for the rendering + * @return void + * @dontvalidate $newPost + */ + public function newAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $newPost = NULL) { + $this->view->assign('authors', $this->personRepository->findAll()); + $this->view->assign('blog', $blog); + $this->view->assign('newPost', $newPost); + $this->view->assign('remainingPosts', $this->postRepository->findByBlog($blog)); + } - /** - * Creates a new post - * - * @param Blog $blog The blog the post belogns to - * @param Post $newBlog A fresh Blog object which has not yet been added to the repository - * @return void - */ - public function createAction(Blog $blog, Post $newPost) - { - // TODO access protection - $blog->addPost($newPost); - $newPost->setBlog($blog); - $this->addFlashMessage('created'); - $this->redirect('index', null, null, ['blog' => $blog]); - } + /** + * Creates a new post + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belogns to + * @param Tx_BlogExample_Domain_Model_Post $newBlog A fresh Blog object which has not yet been added to the repository + * @return void + */ + public function createAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $newPost) { + // TODO access protection + $blog->addPost($newPost); + $newPost->setBlog($blog); + $this->addFlashMessage('created'); + $this->redirect('index', NULL, NULL, array('blog' => $blog)); + } - /** - * Displays a form to edit an existing post - * - * @param Blog $blog The blog the post belogs to - * @param Post $post The original post - * @return void - * @IgnoreValidation $post - */ - public function editAction(Blog $blog, Post $post) - { - $this->view->assign('authors', $this->personRepository->findAll()); - $this->view->assign('blog', $blog); - $this->view->assign('post', $post); - $this->view->assign('remainingPosts', $this->postRepository->findRemaining($post)); - } + /** + * Displays a form to edit an existing post + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belogs to + * @param Tx_BlogExample_Domain_Model_Post $post The original post + * @return void + * @dontvalidate $post + */ + public function editAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $post) { + $this->view->assign('authors', $this->personRepository->findAll()); + $this->view->assign('blog', $blog); + $this->view->assign('post', $post); + $this->view->assign('remainingPosts', $this->postRepository->findRemaining($post)); + } - /** - * Updates an existing post - * - * @param Blog $blog The blog the post belongs to - * @param Post $post A clone of the original post with the updated values already applied - * @return void - */ - public function updateAction(Blog $blog, Post $post): void - { - // TODO access protection - $this->postRepository->update($post); - $this->addFlashMessage('updated'); - $this->redirect('show', null, null, ['post' => $post, 'blog' => $blog]); - } + /** + * Updates an existing post + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belongs to + * @param Tx_BlogExample_Domain_Model_Post $post A clone of the original post with the updated values already applied + * @return void + */ + public function updateAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $post) { + // TODO access protection + $this->postRepository->update($post); + $this->addFlashMessage('updated'); + $this->redirect('show', NULL, NULL, array('post' => $post, 'blog' => $blog)); + } + + /** + * Deletes an existing post + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belongs to + * @param Tx_BlogExample_Domain_Model_Post $post The post to be deleted + * @return void + */ + public function deleteAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $post) { + // TODO access protection + $this->postRepository->remove($post); + $this->addFlashMessage('deleted', t3lib_FlashMessage::INFO); + $this->redirect('index', NULL, NULL, array('blog' => $blog)); + } - /** - * Deletes an existing post - * - * @param Blog $blog The blog the post belongs to - * @param Post $post The post to be deleted - * @return void - */ - public function deleteAction(Blog $blog, Post $post): void - { - // TODO access protection - $this->postRepository->remove($post); - $this->addFlashMessage('deleted', FlashMessage::INFO); - $this->redirect('index', null, null, ['blog' => $blog]); - } } + +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Administrator.php b/Classes/Domain/Model/Administrator.php index 7a04a6b..bbe6105 100644 --- a/Classes/Domain/Model/Administrator.php +++ b/Classes/Domain/Model/Administrator.php @@ -1,23 +1,32 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * An Administrator of a Blog */ -class Administrator extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser -{ +class Tx_BlogExample_Domain_Model_Administrator extends Tx_Extbase_Domain_Model_FrontendUser { + } +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Blog.php b/Classes/Domain/Model/Blog.php index 98cfef3..91614f7 100644 --- a/Classes/Domain/Model/Blog.php +++ b/Classes/Domain/Model/Blog.php @@ -1,255 +1,168 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Extbase\Annotation as Extbase; -use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A blog */ -class Blog extends AbstractEntity -{ - /** - * The blog's title. - * - * @var string - * @Extbase\Validate("StringLength", options={"minimum": 1, "maximum": 80}) - */ - protected $title = ''; - - /** - * The blog's subtitle - * - * @var string - */ - protected $subtitle; - - /** - * A short description of the blog - * - * @var string - * @Extbase\Validate("StringLength", options={"maximum": 150}) - */ - protected $description = ''; - - /** - * A relative path to a logo image - * - * @var string - */ - protected $logo = ''; - - /** - * The posts of this blog - * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Post> - * @Extbase\ORM\Lazy - * @Extbase\ORM\Cascade("remove") - */ - protected $posts; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> - */ - protected $categories; - - /** - * The blog's administrator - * - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Administrator - * @Extbase\ORM\Lazy - */ - protected $administrator; - - /** - * Constructs a new Blog - */ - public function __construct() - { - $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->categories = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - } - - /** - * @return string - */ - public function getSubtitle() - { - return $this->subtitle; - } - - /** - * Sets this blog's title - * - * @param string $title The blog's title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Returns the blog's title - * - * @return string The blog's title - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $logo - */ - public function setLogo($logo) - { - $this->logo = $logo; - } - - /** - * @return string - */ - public function getLogo() - { - return $this->logo; - } - - /** - * Sets the description for the blog - * - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * Returns the description - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Adds a post to this blog - * - * @param Post $post - */ - public function addPost(Post $post) - { - $this->posts->attach($post); - } - - /** - * Remove a post from this blog - * - * @param Post $postToRemove The post to be removed - */ - public function removePost(Post $postToRemove) - { - $this->posts->detach($postToRemove); - } - - /** - * Remove all posts from this blog - */ - public function removeAllPosts() - { - $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - } - - /** - * Returns all posts in this blog - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage - */ - public function getPosts() - { - return $this->posts; - } - - /** - * Add category to a blog - * - * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category - */ - public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) - { - $this->categories->attach($category); - } - - /** - * Set categories - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories - */ - public function setCategories($categories) - { - $this->categories = $categories; - } - - /** - * Get categories - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage - */ - public function getCategories() - { - return $this->categories; - } - - /** - * Remove category from blog - * - * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category - */ - public function removeCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) - { - $this->categories->detach($category); - } - - /** - * Sets the administrator value - * - * @param Administrator $administrator The Administrator of this Blog - */ - public function setAdministrator(Administrator $administrator) - { - $this->administrator = $administrator; - } - - /** - * Returns the administrator value - * - * @return Administrator - */ - public function getAdministrator() - { - return $this->administrator; - } - - /** - * @param ?string $subtitle - */ - public function setSubtitle($subtitle) - { - $this->subtitle = $subtitle; - } +class Tx_BlogExample_Domain_Model_Blog extends Tx_Extbase_DomainObject_AbstractEntity { + + /** + * The blog's title. + * + * @var string + * @validate StringLength(minimum = 1, maximum = 80) + */ + protected $title = ''; + + /** + * A short description of the blog + * + * @var string + * @validate StringLength(maximum = 150) + */ + protected $description = ''; + + /** + * The posts of this blog + * + * @var Tx_Extbase_Persistence_ObjectStorage + * @lazy + * @cascade remove + */ + protected $posts; + + /** + * The blog's administrator + * + * @var Tx_BlogExample_Domain_Model_Administrator + * @lazy + */ + protected $administrator; + + /** + * Constructs a new Blog + * + */ + public function __construct() { + $this->posts = new Tx_Extbase_Persistence_ObjectStorage(); + } + + /** + * Sets this blog's title + * + * @param string $title The blog's title + * @return void + */ + public function setTitle($title) { + $this->title = $title; + } + + /** + * Returns the blog's title + * + * @return string The blog's title + */ + public function getTitle() { + return $this->title; + } + + /** + * Sets the description for the blog + * + * @param string $description + * @return void + */ + public function setDescription($description) { + $this->description = $description; + } + + /** + * Returns the description + * + * @return string + */ + public function getDescription() { + return $this->description; + } + + /** + * Adds a post to this blog + * + * @param Tx_BlogExample_Domain_Model_Post $post + * @return void + */ + public function addPost(Tx_BlogExample_Domain_Model_Post $post) { + $this->posts->attach($post); + } + + /** + * Remove a post from this blog + * + * @param Tx_BlogExample_Domain_Model_Post $postToRemove The post to be removed + * @return void + */ + public function removePost(Tx_BlogExample_Domain_Model_Post $postToRemove) { + $this->posts->detach($postToRemove); + } + + /** + * Remove all posts from this blog + * + * @return void + */ + public function removeAllPosts() { + $this->posts = new Tx_Extbase_Persistence_ObjectStorage(); + } + + /** + * Returns all posts in this blog + * + * @return Tx_Extbase_Persistence_ObjectStorage + */ + public function getPosts() { + return $this->posts; + } + + /** + * Sets the administrator value + * + * @param Tx_BlogExample_Domain_Model_Administrator $administrator The Administrator of this Blog + * @return void + */ + public function setAdministrator(Tx_BlogExample_Domain_Model_Administrator $administrator) { + $this->administrator = $administrator; + } + + /** + * Returns the administrator value + * + * @return Tx_BlogExample_Domain_Model_Administrator + */ + public function getAdministrator() { + return $this->administrator; + } + } +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Comment.php b/Classes/Domain/Model/Comment.php index b72954a..6aecad5 100644 --- a/Classes/Domain/Model/Comment.php +++ b/Classes/Domain/Model/Comment.php @@ -1,145 +1,147 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Extbase\Annotation as Extbase; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A blog post comment */ -class Comment extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity -{ - /** - * @var \DateTime - */ - protected $date; - - /** - * @var string - * Extbase\Validate("NotEmpty") - */ - protected $author = ''; - - /** - * @var string - * @Extbase\Validate("EmailAddress") - */ - protected $email = ''; - - /** - * @var string - * @Extbase\Validate("StringLength", options={"maximum": 500}) - */ - protected $content = ''; - - /** - * Constructs this post - */ - public function __construct() - { - $this->date = new \DateTime(); - } - - /** - * Setter for date - * - * @param \DateTime $date - */ - public function setDate(\DateTime $date) - { - $this->date = $date; - } - - /** - * Getter for date - * - * @return \DateTime - */ - public function getDate() - { - return $this->date; - } - - /** - * Sets the author for this comment - * - * @param string $author - */ - public function setAuthor($author) - { - $this->author = $author; - } - - /** - * Getter for author - * - * @return string - */ - public function getAuthor() - { - return $this->author; - } - - /** - * Sets the authors email for this comment - * - * @param string $email email of the author - */ - public function setEmail($email) - { - $this->email = $email; - } - - /** - * Getter for authors email - * - * @return string - */ - public function getEmail() - { - return $this->email; - } - - /** - * Sets the content for this comment - * - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } - - /** - * Getter for content - * - * @return string - */ - public function getContent() - { - return $this->content; - } - - /** - * Returns this comment as a formatted string - * - * @return string - */ - public function __toString() - { - return $this->author . ' (' . $this->email . ') said on ' . $this->date->format('Y-m-d') . ':' . chr(10) . - $this->content . chr(10); - } +class Tx_BlogExample_Domain_Model_Comment extends Tx_Extbase_DomainObject_AbstractEntity { + + /** + * @var DateTime + */ + protected $date; + + /** + * @var string + * @validate NotEmpty + */ + protected $author; + + /** + * @var string + * @validate EmailAddress + */ + protected $email; + + /** + * @var string + * @validate StringLength(maximum = 500) + */ + protected $content; + + /** + * Constructs this post + */ + public function __construct() { + $this->date = new DateTime(); + } + + /** + * Setter for date + * + * @param DateTime $date + * @return void + */ + public function setDate(DateTime $date) { + $this->date = $date; + } + + /** + * Getter for date + * + * @return DateTime + */ + public function getDate() { + return $this->date; + } + + /** + * Sets the author for this comment + * + * @param string $author + * @return void + */ + public function setAuthor($author) { + $this->author = $author; + } + + /** + * Getter for author + * + * @return string + */ + public function getAuthor() { + return $this->author; + } + + /** + * Sets the authors email for this comment + * + * @param string $email email of the author + * @return void + */ + public function setEmail($email) { + $this->email = $email; + } + + /** + * Getter for authors email + * + * @return string + */ + public function getEmail() { + return $this->email; + } + + /** + * Sets the content for this comment + * + * @param string $content + * @return void + */ + public function setContent($content) { + $this->content = $content; + } + + /** + * Getter for content + * + * @return string + */ + public function getContent() { + return $this->content; + } + + /** + * Returns this comment as a formatted string + * + * @return string + */ + public function __toString() { + return $this->author . ' (' . $this->email . ') said on ' . $this->date->format('Y-m-d') . ':' . chr(10) . + $this->content . chr(10); + } } +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Info.php b/Classes/Domain/Model/Info.php deleted file mode 100644 index 68d6ca4..0000000 --- a/Classes/Domain/Model/Info.php +++ /dev/null @@ -1,57 +0,0 @@ -content = $name; - } - - /** - * Getter for name - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Returns this info as a formatted string - * - * @return string - */ - public function __toString() - { - return $this->name; - } -} diff --git a/Classes/Domain/Model/Person.php b/Classes/Domain/Model/Person.php index 63cdca2..1683896 100644 --- a/Classes/Domain/Model/Person.php +++ b/Classes/Domain/Model/Person.php @@ -1,193 +1,123 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A person - acting as author */ -class Person extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity -{ - /** - * @var string - */ - protected $firstname = ''; - - /** - * @var string - */ - protected $lastname = ''; - - /** - * @var string - */ - protected $email = ''; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Tag> - */ - protected $tags; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Tag> - */ - protected $tagsSpecial; - - /** - * Constructs a new Person - */ - public function __construct($firstname, $lastname, $email) - { - $this->setFirstname($firstname); - $this->setLastname($lastname); - $this->setEmail($email); - - $this->tags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->tagsSpecial = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - } - - /** - * Sets this persons's firstname - * - * @param string $firstname The person's firstname - */ - public function setFirstname($firstname) - { - $this->firstname = $firstname; - } - - /** - * Returns the person's firstname - * - * @return string The persons's firstname - */ - public function getFirstname() - { - return $this->firstname; - } - - /** - * Sets this persons's lastname - * - * @param string $lastname The person's lastname - */ - public function setLastname($lastname) - { - $this->lastname = $lastname; - } - - /** - * Returns the person's lastname - * - * @return string The persons's lastname - */ - public function getLastname() - { - return $this->lastname; - } - - /** - * Returns the person's full name - * - * @return string The persons's lastname - */ - public function getFullName() - { - return $this->firstname . ' ' . $this->lastname; - } - - /** - * Sets this persons's email address - * - * @param string $email The person's email address - */ - public function setEmail($email) - { - $this->email = $email; - } - - /** - * Returns the person's email address - * - * @return string The persons's email address - */ - public function getEmail() - { - return $this->email; - } - - /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage|\FriendsOfTYPO3\BlogExample\Domain\Model\Tag[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Tag> $tags - */ - public function setTags(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags) - { - $this->tags = $tags; - } - - /** - * @param Tag $tag - */ - public function addTag(Tag $tag) - { - $this->tags->attach($tag); - } - - /** - * @param Tag $tag - */ - public function removeTag(Tag $tag) - { - $this->tags->detach($tag); - } - - /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage|\FriendsOfTYPO3\BlogExample\Domain\Model\Tag[] - */ - public function getTagsSpecial() - { - return $this->tagsSpecial; - } - - /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Tag> $tagsSpecial - */ - public function setTagsSpecial(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $tagsSpecial) - { - $this->tagsSpecial = $tagsSpecial; - } - - /** - * @param Tag $tag - */ - public function addTagSpecial(Tag $tag) - { - $this->tagsSpecial->attach($tag); - } +class Tx_BlogExample_Domain_Model_Person extends Tx_Extbase_DomainObject_AbstractEntity { + + /** + * @var string + */ + protected $firstname; + + /** + * @var string + */ + protected $lastname; + + /** + * @var string + */ + protected $email; + + /** + * Constructs a new Person + * + */ + public function __construct($firstname, $lastname, $email) { + $this->setFirstname($firstname); + $this->setLastname($lastname); + $this->setEmail($email); + } + + /** + * Sets this persons's firstname + * + * @param string $firstname The person's firstname + * @return void + */ + public function setFirstname($firstname) { + $this->firstname = $firstname; + } + + /** + * Returns the person's firstname + * + * @return string The persons's firstname + */ + public function getFirstname() { + return $this->firstname; + } + + /** + * Sets this persons's lastname + * + * @param string $firstname The person's lastname + * @return void + */ + public function setLastname($lastname) { + $this->lastname = $lastname; + } + + /** + * Returns the person's lastname + * + * @return string The persons's lastname + */ + public function getLastname() { + return $this->lastname; + } + + /** + * Returns the person's full name + * + * @return string The persons's lastname + */ + public function getFullName() { + return $this->firstname . ' ' . $this->lastname; + } + + /** + * Sets this persons's email adress + * + * @param string $firstname The person's email adress + * @return void + */ + public function setEmail($email) { + $this->email = $email; + } + + /** + * Returns the person's email address + * + * @return string The persons's email address + */ + public function getEmail() { + return $this->email; + } - /** - * @param Tag $tag - */ - public function removeTagSpecial(Tag $tag) - { - $this->tagsSpecial->detach($tag); - } } +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Post.php b/Classes/Domain/Model/Post.php index 88e0deb..04cabb8 100644 --- a/Classes/Domain/Model/Post.php +++ b/Classes/Domain/Model/Post.php @@ -1,512 +1,336 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Extbase\Annotation as Extbase; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A blog post */ -class Post extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity -{ - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Blog - */ - protected $blog; - - /** - * @var string - * @Extbase\Validate("StringLength", options={"minimum": 3, "maximum": 50}) - */ - protected $title = ''; - - /** - * @var \DateTime - */ - protected $date; - - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - protected $author; - - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - protected $secondAuthor; - - /** - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - protected $reviewer; - - /** - * @var string - * @Extbase\Validate("StringLength", options={"minimum": 3}) - */ - protected $content = ''; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Tag> - */ - protected $tags; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> - */ - protected $categories; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Comment> - * @Extbase\ORM\Lazy - * @Extbase\ORM\Cascade("remove") - */ - protected $comments; - - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Post> - * @Extbase\ORM\Lazy - */ - protected $relatedPosts; - - /** - * 1:1 relation stored as CSV value in this class - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Info - */ - protected $additionalName; - - /** - * 1:1 relation stored as foreign key in Info class - * @var \FriendsOfTYPO3\BlogExample\Domain\Model\Info - */ - protected $additionalInfo; - - /** - * 1:n relation stored as CSV value - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\FriendsOfTYPO3\BlogExample\Domain\Model\Comment> - * @Extbase\ORM\Lazy - */ - protected $additionalComments; - - /** - * Constructs this post - */ - public function __construct() - { - $this->tags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->categories = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->comments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->relatedPosts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->date = new \DateTime(); - $this->additionalComments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - } - - /** - * Sets the blog this post is part of - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog The blog - */ - public function setBlog(\FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog) - { - $this->blog = $blog; - } - - /** - * Returns the blog this post is part of - * - * @return \FriendsOfTYPO3\BlogExample\Domain\Model\Blog The blog this post is part of - */ - public function getBlog() - { - return $this->blog; - } - - /** - * Setter for title - * - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Getter for title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Setter for date - * - * @param \DateTime $date - */ - public function setDate(\DateTime $date) - { - $this->date = $date; - } - - /** - * Getter for date - * - * - * @return \DateTime - */ - public function getDate() - { - return $this->date; - } - - /** - * Setter for tags - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags One or more Tag objects - */ - public function setTags(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags) - { - $this->tags = $tags; - } - - /** - * Adds a tag to this post - * - * @param Tag $tag - */ - public function addTag(Tag $tag) - { - $this->tags->attach($tag); - } - - /** - * Removes a tag from this post - * - * @param Tag $tag - */ - public function removeTag(Tag $tag) - { - $this->tags->detach($tag); - } - - /** - * Remove all tags from this post - */ - public function removeAllTags() - { - $this->tags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - } - - /** - * Getter for tags - * Note: We return a clone of the tags because they must not be modified as they are Value Objects - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage A storage holding objects - */ - public function getTags() - { - return clone $this->tags; - } - - /** - * Add category to a post - * - * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category - */ - public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) - { - $this->categories->attach($category); - } - - /** - * Set categories - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories - */ - public function setCategories($categories) - { - $this->categories = $categories; - } - - /** - * Get categories - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage - */ - public function getCategories() - { - return $this->categories; - } - - /** - * Remove category from post - * - * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category - */ - public function removeCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) - { - $this->categories->detach($category); - } - - /** - * Sets the author for this post - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Person $author - */ - public function setAuthor(\FriendsOfTYPO3\BlogExample\Domain\Model\Person $author) - { - $this->author = $author; - } - - /** - * Getter for author - * - * @return \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - public function getAuthor() - { - return $this->author; - } - - /** - * @return \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - public function getSecondAuthor(): ?\FriendsOfTYPO3\BlogExample\Domain\Model\Person - { - return $this->secondAuthor; - } - - /** - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Person $secondAuthor - */ - public function setSecondAuthor(\FriendsOfTYPO3\BlogExample\Domain\Model\Person $secondAuthor): void - { - $this->secondAuthor = $secondAuthor; - } - - /** - * @return \FriendsOfTYPO3\BlogExample\Domain\Model\Person - */ - public function getReviewer() - { - return $this->reviewer; - } - - /** - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Person $reviewer - */ - public function setReviewer(\FriendsOfTYPO3\BlogExample\Domain\Model\Person $reviewer) - { - $this->reviewer = $reviewer; - } - - /** - * Sets the content for this post - * - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } - - /** - * Getter for content - * - * @return string - */ - public function getContent() - { - return $this->content; - } - - /** - * Setter for the comments to this post - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $comments An Object Storage of related Comment instances - */ - public function setComments(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $comments) - { - $this->comments = $comments; - } - - /** - * Adds a comment to this post - * - * @param Comment $comment - */ - public function addComment(Comment $comment) - { - $this->comments->attach($comment); - } - - /** - * Removes Comment from this post - * - * @param Comment $commentToDelete - */ - public function removeComment(Comment $commentToDelete) - { - $this->comments->detach($commentToDelete); - } - - /** - * Remove all comments from this post - */ - public function removeAllComments() - { - $comments = clone $this->comments; - $this->comments->removeAll($comments); - } - - /** - * Returns the comments to this post - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage holding instances of Comment - */ - public function getComments() - { - return $this->comments; - } - - /** - * Setter for the related posts - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $relatedPosts An Object Storage containing related Posts instances - */ - public function setRelatedPosts(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relatedPosts) - { - $this->relatedPosts = $relatedPosts; - } - - /** - * Adds a related post - * - * @param Post $post - */ - public function addRelatedPost(Post $post) - { - $this->relatedPosts->attach($post); - } - - /** - * Remove all related posts - */ - public function removeAllRelatedPosts() - { - $relatedPosts = clone $this->relatedPosts; - $this->relatedPosts->removeAll($relatedPosts); - } - - /** - * Returns the related posts - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage holding instances of Post - */ - public function getRelatedPosts() - { - return $this->relatedPosts; - } - - /** - * @return ?Info - */ - public function getAdditionalName(): ?Info - { - return $this->additionalName; - } - - /** - * @param Info $additionalName - */ - public function setAdditionalName(Info $additionalName): void - { - $this->additionalName = $additionalName; - } - - /** - * @return ?Info - */ - public function getAdditionalInfo(): ?Info - { - return $this->additionalInfo; - } - - /** - * @param Info $additionalInfo - */ - public function setAdditionalInfo(Info $additionalInfo): void - { - $this->additionalInfo = $additionalInfo; - } - - /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage - */ - public function getAdditionalComments(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage - { - return $this->additionalComments; - } - - /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalComments - */ - public function setAdditionalComments(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalComments): void - { - $this->additionalComments = $additionalComments; - } - - /** - * @param Comment $comment - */ - public function addAdditionalComment(Comment $comment) - { - $this->additionalComments->attach($comment); - } - - /** - * Remove all additional Comments - */ - public function removeAllAdditionalComments() - { - $comments = clone $this->additionalComments; - $this->additionalComments->removeAll($comments); - } - - /** - * @param Comment $comment - */ - public function removeAdditionalComment(Comment $comment) - { - $this->additionalComments->detach($comment); - } - - /** - * Returns this post as a formatted string - * - * @return string - */ - public function __toString() - { - return $this->title . chr(10) . - ' written on ' . $this->date->format('Y-m-d') . chr(10) . - ' by ' . $this->author->getFullName() . chr(10) . - wordwrap($this->content, 70, chr(10)) . chr(10) . - implode(', ', $this->tags->toArray()); - } +class Tx_BlogExample_Domain_Model_Post extends Tx_Extbase_DomainObject_AbstractEntity { + + /** + * @var Tx_BlogExample_Domain_Model_Blog + */ + protected $blog; + + /** + * @var string + * @validate StringLength(minimum = 3, maximum = 50) + */ + protected $title; + + /** + * @var DateTime + */ + protected $date; + + /** + * @var Tx_BlogExample_Domain_Model_Person + */ + protected $author; + + /** + * @var string + * @validate StringLength(minimum = 3) + */ + protected $content; + + /** + * @var Tx_Extbase_Persistence_ObjectStorage + */ + protected $tags; + + /** + * @var Tx_Extbase_Persistence_ObjectStorage + * @lazy + * @cascade remove + */ + protected $comments; + + /** + * @var Tx_Extbase_Persistence_ObjectStorage + * @lazy + */ + protected $relatedPosts; + + /** + * Constructs this post + */ + public function __construct() { + $this->tags = new Tx_Extbase_Persistence_ObjectStorage(); + $this->comments = new Tx_Extbase_Persistence_ObjectStorage(); + $this->relatedPosts = new Tx_Extbase_Persistence_ObjectStorage(); + $this->date = new DateTime(); + } + + /** + * Sets the blog this post is part of + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog + * @return void + */ + public function setBlog(Tx_BlogExample_Domain_Model_Blog $blog) { + $this->blog = $blog; + } + + /** + * Returns the blog this post is part of + * + * @return Tx_BlogExample_Domain_Model_Blog The blog this post is part of + */ + public function getBlog() { + return $this->blog; + } + + /** + * Setter for title + * + * @param string $title + * @return void + */ + public function setTitle($title) { + $this->title = $title; + } + + /** + * Getter for title + * + * @return string + */ + public function getTitle() { + return $this->title; + } + + /** + * Setter for date + * + * @param DateTime $date + * @return void + */ + public function setDate(DateTime $date) { + $this->date = $date; + } + + /** + * Getter for date + * + * + * @return DateTime + */ + public function getDate() { + return $this->date; + } + + /** + * Setter for tags + * + * @param Tx_Extbase_Persistence_ObjectStorage $tags One or more Tx_BlogExample_Domain_Model_Tag objects + * @return void + */ + public function setTags(Tx_Extbase_Persistence_ObjectStorage $tags) { + $this->tags = $tags; + } + + /** + * Adds a tag to this post + * + * @param Tx_BlogExample_Domain_Model_Tag $tag + * @return void + */ + public function addTag(Tx_BlogExample_Domain_Model_Tag $tag) { + $this->tags->attach($tag); + } + + /** + * Removes a tag from this post + * + * @param Tx_BlogExample_Domain_Model_Tag $tag + * @return void + */ + public function removeTag(Tx_BlogExample_Domain_Model_Tag $tag) { + $this->tags->detach($tag); + } + + /** + * Remove all tags from this post + * + * @return void + */ + public function removeAllTags() { + $this->tags = new Tx_Extbase_Persistence_ObjectStorage(); + } + + /** + * Getter for tags + * Note: We return a clone of the tags because they must not be modified as they are Value Objects + * + * @return Tx_Extbase_Persistence_ObjectStorage A storage holding Tx_BlogExample_Domain_Model_Tag objects + */ + public function getTags() { + return clone $this->tags; + } + + /** + * Sets the author for this post + * + * @param Tx_BlogExample_Domain_Model_Person $author + * @return void + */ + public function setAuthor(Tx_BlogExample_Domain_Model_Person $author) { + $this->author = $author; + } + + /** + * Getter for author + * + * @return Tx_BlogExample_Domain_Model_Person + */ + public function getAuthor() { + return $this->author; + } + + /** + * Sets the content for this post + * + * @param string $content + * @return void + */ + public function setContent($content) { + $this->content = $content; + } + + /** + * Getter for content + * + * @return string + */ + public function getContent() { + return $this->content; + } + + /** + * Setter for the comments to this post + * + * @param Tx_Extbase_Persistence_ObjectStorage $comments An Object Storage of related Comment instances + * @return void + */ + public function setComments(Tx_Extbase_Persistence_ObjectStorage $comments) { + $this->comments = $comments; + } + + /** + * Adds a comment to this post + * + * @param Tx_BlogExample_Domain_Model_Comment $comment + * @return void + */ + public function addComment(Tx_BlogExample_Domain_Model_Comment $comment) { + $this->comments->attach($comment); + } + + /** + * Removes Comment from this post + * + * @param Tx_BlogExample_Domain_Model_Comment $commentToDelete + * @return void + */ + public function removeComment(Tx_BlogExample_Domain_Model_Comment $commentToDelete) { + $this->comments->detach($commentToDelete); + } + + /** + * Remove all comments from this post + * + * @return void + */ + public function removeAllComments() { + $comments = clone $this->comments; + foreach($comments as $comment) { + $this->comments->detach($comment); + } + } + + /** + * Returns the comments to this post + * + * @return An Tx_Extbase_Persistence_ObjectStorage holding instances of Tx_BlogExample_Domain_Model_Comment + */ + public function getComments() { + return $this->comments; + } + + /** + * Setter for the related posts + * + * @param Tx_Extbase_Persistence_ObjectStorage $relatedPosts An Object Storage containing related Posts instances + * @return void + */ + public function setRelatedPosts(Tx_Extbase_Persistence_ObjectStorage $relatedPosts) { + $this->relatedPosts = $relatedPosts; + } + + /** + * Adds a related post + * + * @param Tx_BlogExample_Domain_Model_Post $comment + * @return void + */ + public function addRelatedPost(Tx_BlogExample_Domain_Model_Post $post) { + $this->relatedPosts->attach($post); + } + + /** + * Remove all related posts + * + * @return void + */ + public function removeAllRelatedPosts() { + $relatedPosts = clone $this->relatedPosts; + foreach($relatedPosts as $relatedPost) { + $this->relatedPosts->detach($relatedPost); + } + } + + /** + * Returns the related posts + * + * @return An Tx_Extbase_Persistence_ObjectStorage holding instances of Tx_BlogExample_Domain_Model_Post + */ + public function getRelatedPosts() { + return $this->relatedPosts; + } + + /** + * Returns this post as a formatted string + * + * @return string + */ + public function __toString() { + return $this->title . chr(10) . + ' written on ' . $this->date->format('Y-m-d') . chr(10) . + ' by ' . $this->author->getFullName() . chr(10) . + wordwrap($this->content, 70, chr(10)) . chr(10) . + implode(', ', $this->tags->toArray()); + } } +?> \ No newline at end of file diff --git a/Classes/Domain/Model/Tag.php b/Classes/Domain/Model/Tag.php index 7ae1379..0221f50 100644 --- a/Classes/Domain/Model/Tag.php +++ b/Classes/Domain/Model/Tag.php @@ -1,56 +1,61 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A blog post tag */ -class Tag extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject -{ - /** - * @var string - */ - protected $name = ''; +class Tx_BlogExample_Domain_Model_Tag extends Tx_Extbase_DomainObject_AbstractValueObject { + + /** + * @var string + */ + protected $name; - /** - * Constructs this tag - * - * @param $name - */ - public function __construct($name) - { - $this->name = $name; - } + /* + * Constructs this tag + */ + public function __construct($name) { + $this->name = $name; + } - /** - * Returns this tag's name - * - * @return string This tag's name - */ - public function getName() - { - return $this->name; - } + /** + * Returns this tag's name + * + * @return string This tag's name + */ + public function getName() { + return $this->name; + } - /** - * Returns this tag as a formatted string - * - * @return string - */ - public function __toString() - { - return $this->getName(); - } + /** + * Returns this tag as a formatted string + * + * @return string + */ + public function __toString() { + return $this->getName(); + } } +?> \ No newline at end of file diff --git a/Classes/Domain/Repository/AdministratorRepository.php b/Classes/Domain/Repository/AdministratorRepository.php index aa62c69..2f6dc3b 100644 --- a/Classes/Domain/Repository/AdministratorRepository.php +++ b/Classes/Domain/Repository/AdministratorRepository.php @@ -1,22 +1,32 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A repository for administrators */ -class AdministratorRepository extends \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository -{ +class Tx_BlogExample_Domain_Repository_AdministratorRepository extends Tx_Extbase_Domain_Repository_FrontendUserRepository { + } +?> \ No newline at end of file diff --git a/Classes/Domain/Repository/BlogRepository.php b/Classes/Domain/Repository/BlogRepository.php index 3dcf416..400d222 100644 --- a/Classes/Domain/Repository/BlogRepository.php +++ b/Classes/Domain/Repository/BlogRepository.php @@ -1,26 +1,50 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A repository for blogs */ -class BlogRepository extends \TYPO3\CMS\Extbase\Persistence\Repository -{ - protected $defaultOrderings = [ - 'crdate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING, - 'uid' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING - ]; +class Tx_BlogExample_Domain_Repository_BlogRepository extends Tx_Extbase_Persistence_Repository { + + protected $defaultOrderings = array( + 'crdate' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING, + 'uid' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING + ); + + /** + * Life cycle method. + * + * @return void + */ + public function initializeObject() { + /* + $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings'); + $querySettings->setRespectStoragePage(FALSE); + $this->setDefaultQuerySettings($querySettings); + */ + } + } +?> \ No newline at end of file diff --git a/Classes/Domain/Repository/PersonRepository.php b/Classes/Domain/Repository/PersonRepository.php index 91b7b77..7896fad 100644 --- a/Classes/Domain/Repository/PersonRepository.php +++ b/Classes/Domain/Repository/PersonRepository.php @@ -1,25 +1,32 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Extbase\Persistence\QueryInterface; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A repository for persons */ -class PersonRepository extends \TYPO3\CMS\Extbase\Persistence\Repository -{ - protected $defaultOrderings = ['lastname' => QueryInterface::ORDER_ASCENDING]; +class Tx_BlogExample_Domain_Repository_PersonRepository extends Tx_Extbase_Persistence_Repository { + } +?> \ No newline at end of file diff --git a/Classes/Domain/Repository/PostRepository.php b/Classes/Domain/Repository/PostRepository.php index 0191968..fd55f0c 100644 --- a/Classes/Domain/Repository/PostRepository.php +++ b/Classes/Domain/Repository/PostRepository.php @@ -1,166 +1,138 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ - -use FriendsOfTYPO3\BlogExample\Domain\Model\Post; -use TYPO3\CMS\Extbase\Persistence\QueryInterface; -use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * A repository for blog posts - * - * @method Post findByUid($uid) */ -class PostRepository extends \TYPO3\CMS\Extbase\Persistence\Repository -{ - protected $defaultOrderings = ['date' => QueryInterface::ORDER_DESCENDING]; +class Tx_BlogExample_Domain_Repository_PostRepository extends Tx_Extbase_Persistence_Repository { - /** - * Finds all posts by the specified blog - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog The blog the post must refer to - * @return QueryResultInterface The posts - */ - public function findAllByBlog(\FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->equals('blog', $blog) - ) - ->execute(); - } + protected $defaultOrderings = array('date' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING); - /** - * Finds posts by the specified tag and blog - * - * @param string $tag - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog The blog the post must refer to - * @return QueryResultInterface The posts - */ - public function findByTagAndBlog($tag, \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->logicalAnd( - $query->equals('blog', $blog), - $query->equals('tags.name', $tag) - ) - ) - ->execute(); - } + /** + * Finds all posts by the specified blog + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post must refer to + * @return Tx_Extbase_Persistence_QueryResultInterface The posts + */ + public function findAllByBlog(Tx_BlogExample_Domain_Model_Blog $blog) { + $query = $this->createQuery(); + return $query + ->matching( + $query->equals('blog', $blog) + ) + ->execute(); + } - /** - * Finds all remaining posts of the blog - * - * @param Post $post The reference post - * @return QueryResultInterface The posts - */ - public function findRemaining(Post $post) - { - $blog = $post->getBlog(); - $query = $this->createQuery(); - return $query - ->matching( - $query->logicalAnd( - $query->equals('blog', $blog), - $query->logicalNot( - $query->equals('uid', $post->getUid()) - ) - ) - ) - ->execute(); - } + /** + * Finds posts by the specified tag and blog + * + * @param string $tag + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post must refer to + * @return Tx_Extbase_Persistence_QueryResultInterface The posts + */ + public function findByTagAndBlog($tag, Tx_BlogExample_Domain_Model_Blog $blog) { + $query = $this->createQuery(); + return $query + ->matching( + $query->logicalAnd( + $query->equals('blog', $blog), + $query->equals('tags.name', $tag) + ) + ) + ->execute(); + } - /** - * Finds the previous of the given post - * - * @param Post $post The reference post - * @return Post - */ - public function findPrevious(Post $post) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->lessThan('date', $post->getDate()) - ) - ->execute() - ->getFirst(); - } + /** + * Finds all remaining posts of the blog + * + * @param Tx_BlogExample_Domain_Model_Post $post The reference post + * @return Tx_Extbase_Persistence_QueryResultInterface The posts + */ + public function findRemaining(Tx_BlogExample_Domain_Model_Post $post) { + $blog = $post->getBlog(); + $query = $this->createQuery(); + return $query + ->matching( + $query->logicalAnd( + $query->equals('blog', $blog), + $query->logicalNot( + $query->equals('uid', $post->getUid()) + ) + ) + ) + ->execute(); + } - /** - * Finds the post next to the given post - * - * @param Post $post The reference post - * @return Post - */ - public function findNext(Post $post) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->greaterThan('date', $post->getDate()) - ) - ->execute() - ->getFirst(); - } + /** + * Finds the previous of the given post + * + * @param Tx_BlogExample_Domain_Model_Post $post The reference post + * @return Tx_BlogExample_Domain_Model_Post + */ + public function findPrevious(Tx_BlogExample_Domain_Model_Post $post) { + $query = $this->createQuery(); + return $query + ->matching( + $query->lessThan('date', $post->getDate()) + ) + ->execute() + ->getFirst(); + } - /** - * Finds most recent posts by the specified blog - * - * @param \FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog The blog the post must refer to - * @param int $limit The number of posts to return at max - * @return QueryResultInterface The posts - */ - public function findRecentByBlog(\FriendsOfTYPO3\BlogExample\Domain\Model\Blog $blog, $limit = 5) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->equals('blog', $blog) - ) - ->setLimit((int)$limit) - ->execute(); - } + /** + * Finds the post next to the given post + * + * @param Tx_BlogExample_Domain_Model_Post $post The reference post + * @return Tx_BlogExample_Domain_Model_Post + */ + public function findNext(Tx_BlogExample_Domain_Model_Post $post) { + $query = $this->createQuery(); + return $query + ->matching( + $query->greaterThan('date', $post->getDate()) + ) + ->execute() + ->getFirst(); + } - /** - * Find posts by category - * - * @param int $categoryUid - * @return QueryResultInterface - */ - public function findByCategory($categoryUid) - { - $query = $this->createQuery(); - return $query - ->matching( - $query->contains('categories', $categoryUid) - ) - ->execute(); - } + /** + * Finds most recent posts by the specified blog + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post must refer to + * @param integer $limit The number of posts to return at max + * @return Tx_Extbase_Persistence_QueryResultInterface The posts + */ + public function findRecentByBlog(Tx_BlogExample_Domain_Model_Blog $blog, $limit = 5) { + $query = $this->createQuery(); + return $query + ->matching( + $query->equals('blog', $blog) + ) + ->setLimit((integer)$limit) + ->execute(); + } - public function findAllSortedByCategory(array $uids) - { - $q = $this->createQuery(); - $q->matching($q->in('uid', $uids)); - $q->setOrderings([ - 'categories.title' => QueryInterface::ORDER_ASCENDING, - 'uid' => QueryInterface::ORDER_ASCENDING, - ]); - return $q->execute(); - } } +?> \ No newline at end of file diff --git a/Classes/Domain/Service/BlogFactory.php b/Classes/Domain/Service/BlogFactory.php new file mode 100644 index 0000000..447f7ec --- /dev/null +++ b/Classes/Domain/Service/BlogFactory.php @@ -0,0 +1,115 @@ + + * (c) 2011 Bastian Waidelich + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * A simple blog factory to create sample data + */ +class Tx_BlogExample_Domain_Service_BlogFactory implements t3lib_Singleton { + + /** + * @var Tx_Extbase_Object_ObjectManagerInterface + */ + protected $objectManager; + + /** + * Injects the object manager + * + * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager + * @return void + */ + public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) { + $this->objectManager = $objectManager; + } + + /** + * Returns a sample blog populated with generic data + * It is also an example how to handle objects and repositories in general + * + * @param integer $blogNumber + * @return Tx_BlogExample_Domain_Model_Blog + */ + public function createBlog($blogNumber = 1) { + // initialize blog + $blog = $this->objectManager->create('Tx_BlogExample_Domain_Model_Blog'); + $blog->setTitle('Blog #' . $blogNumber); + $blog->setDescription('A blog about TYPO3 extension development.'); + + // create author + $author = $this->objectManager->create('Tx_BlogExample_Domain_Model_Person', 'Stephen', 'Smith', 'foo.bar@example.com'); + + // create administrator + $administrator = $this->objectManager->create('Tx_BlogExample_Domain_Model_Administrator'); + $administrator->setName('John Doe'); + $administrator->setEmail('john.doe@example.com'); + $blog->setAdministrator($administrator); + + // create sample posts + for ($postNumber = 1; $postNumber < 6; $postNumber++) { + + // create post + $post = $this->objectManager->create('Tx_BlogExample_Domain_Model_Post'); + $post->setTitle('The ' . $postNumber . '. post of blog #' . $blogNumber); + $post->setAuthor($author); + $post->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); + + // create comments + $comment = $this->objectManager->create('Tx_BlogExample_Domain_Model_Comment'); + $comment->setDate(new DateTime()); + $comment->setAuthor('Peter Pan'); + $comment->setEmail('peter.pan@example.com'); + $comment->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'); + $post->addComment($comment); + + $comment = $this->objectManager->create('Tx_BlogExample_Domain_Model_Comment'); + $comment->setDate(new DateTime('2009-03-19 23:44')); + $comment->setAuthor('John Smith'); + $comment->setEmail('john@matrix.org'); + $comment->setContent('Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'); + $post->addComment($comment); + + // create some random tags + if (rand(0, 1) > 0) { + $tag = $this->objectManager->create('Tx_BlogExample_Domain_Model_Tag', 'MVC'); + $post->addTag($tag); + } + if (rand(0, 1) > 0) { + $tag = $this->objectManager->create('Tx_BlogExample_Domain_Model_Tag', 'Domain Driven Design'); + $post->addTag($tag); + } + if (rand(0, 1) > 0) { + $tag = $this->objectManager->create('Tx_BlogExample_Domain_Model_Tag', 'TYPO3'); + $post->addTag($tag); + } + + // add the post to the current blog + $blog->addPost($post); + $post->setBlog($blog); + } + + return $blog; + } + +} +?> \ No newline at end of file diff --git a/Classes/Domain/Validator/BlogValidator.php b/Classes/Domain/Validator/BlogValidator.php index 6fc0dfd..9eb2ded 100644 --- a/Classes/Domain/Validator/BlogValidator.php +++ b/Classes/Domain/Validator/BlogValidator.php @@ -1,42 +1,46 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * An exemplary Blog validator */ -class BlogValidator extends \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator -{ +class Tx_BlogExample_Domain_Validator_BlogValidator extends Tx_Extbase_Validation_Validator_AbstractValidator { - /** - * Checks whether the given blog is valid - * - * @param Blog $blog The blog - * @return boolean TRUE if blog could be validated, otherwise FALSE - */ - public function isValid($blog) - { - if (strtolower($blog->getTitle()) === 'extbase') { - $this->addError(LocalizationUtility::translate('error.Blog.invalidTitle', 'BlogExample'), 1297418974); - return false; - } - return true; - } + /** + * Checks whether the given blog is valid + * + * @param Tx_BlogExample_Domain_Model_Blog $blog The blog + * @return boolean TRUE if blog could be validated, otherwise FALSE + */ + public function isValid($blog) { + if (strtolower($blog->getTitle()) === 'extbase') { + $this->addError(Tx_Extbase_Utility_Localization::translate('error.Blog.invalidTitle', 'BlogExample'), 1297418974); + return FALSE; + } + return TRUE; + } } +?> \ No newline at end of file diff --git a/Classes/Domain/Validator/PostValidator.php b/Classes/Domain/Validator/PostValidator.php deleted file mode 100644 index 5c615e3..0000000 --- a/Classes/Domain/Validator/PostValidator.php +++ /dev/null @@ -1,40 +0,0 @@ -getTitle() === '77') { - $error = new Error('Title custom validation failed', 1480872650); - $this->result->forProperty('title')->addError($error); - } - } -} diff --git a/Classes/Service/BlogFactory.php b/Classes/Service/BlogFactory.php deleted file mode 100644 index 2e161e6..0000000 --- a/Classes/Service/BlogFactory.php +++ /dev/null @@ -1,117 +0,0 @@ -objectManager = $objectManager; - } - - /** - * Returns a sample blog populated with generic data - * It is also an example how to handle objects and repositories in general - * - * @param integer $blogNumber - * @return \FriendsOfTYPO3\BlogExample\Domain\Model\Blog - */ - public function createBlog($blogNumber = 1) - { - // initialize blog - $blog = $this->objectManager->get(Blog::class); - $blog->setTitle('Blog #' . $blogNumber); - $blog->setDescription('A blog about TYPO3 extension development.'); - - // create author - $author = $this->objectManager->get(Person::class, 'Stephen', 'Smith', 'foo.bar@example.com'); - - // create administrator - $administrator = $this->objectManager->get(Administrator::class); - $administrator->setName('John Doe'); - $administrator->setEmail('john.doe@example.com'); - $blog->setAdministrator($administrator); - - // create sample posts - for ($postNumber = 1; $postNumber < 6; $postNumber++) { - - // create post - $post = $this->objectManager->get(Post::class); - $post->setTitle('The ' . $postNumber . '. post of blog #' . $blogNumber); - $post->setAuthor($author); - $post->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); - - // create comments - $comment = $this->objectManager->get(Comment::class); - $comment->setDate(new DateTime()); - $comment->setAuthor('Peter Pan'); - $comment->setEmail('peter.pan@example.com'); - $comment->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'); - $post->addComment($comment); - - $comment = $this->objectManager->get(Comment::class); - $comment->setDate(new DateTime('2009-03-19 23:44')); - $comment->setAuthor('John Smith'); - $comment->setEmail('john@matrix.org'); - $comment->setContent('Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'); - $post->addComment($comment); - - // create some random tags - if (random_int(0, 1) > 0) { - $tag = $this->objectManager->get(Tag::class, 'MVC'); - $post->addTag($tag); - } - if (random_int(0, 1) > 0) { - $tag = $this->objectManager->get(Tag::class, 'Domain Driven Design'); - $post->addTag($tag); - } - if (random_int(0, 1) > 0) { - $tag = $this->objectManager->get(Tag::class, 'TYPO3'); - $post->addTag($tag); - } - // add the post to the current blog - $blog->addPost($post); - $post->setBlog($blog); - } - return $blog; - } -} diff --git a/Classes/ViewHelpers/GravatarViewHelper.php b/Classes/ViewHelpers/GravatarViewHelper.php index 3d83914..a6c72ff 100644 --- a/Classes/ViewHelpers/GravatarViewHelper.php +++ b/Classes/ViewHelpers/GravatarViewHelper.php @@ -1,78 +1,85 @@ + * (c) 2011 Bastian Waidelich + * All rights reserved * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * The TYPO3 project - inspiring people to share! - */ + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** * View helper for rendering gravatar images. * See http://www.gravatar.com + * * = Examples = + * * * * + * * * * */ -class GravatarViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper -{ +class Tx_BlogExample_ViewHelpers_GravatarViewHelper extends Tx_Fluid_Core_ViewHelper_TagBasedViewHelper { - use CompileWithRenderStatic; + /** + * @var string + */ + protected $tagName = 'img'; - /** - * @var string - */ - protected $tagName = 'img'; + /** + * Initialize arguments + * + * @return void + */ + public function initializeArguments() { + parent::initializeArguments(); - /** - * Initialize arguments - * - * @return void - */ - public function initializeArguments() - { - parent::initializeArguments(); + $this->registerUniversalTagAttributes(); + } - $this->registerUniversalTagAttributes(); - $this->registerArgument('emailAddress', 'string', '', true) - ->registerArgument('defaultImageUri', 'string', '', false) - ->registerArgument('size', 'string', '', false); - } + /** + * Render the gravatar image + * + * @param string $emailAddress Gravataer email address + * @param integer $size Size of the gravatar image + * @param string $defaultImageUri absolute URI of the image to be shown if no gravatar was found + * @return string The rendered image tag + */ + public function render($emailAddress, $size = NULL, $defaultImageUri = NULL) { + $gravatarUri = 'http://www.gravatar.com/avatar/' . md5($emailAddress); + $uriParts = array(); + if ($defaultImageUri !== NULL) { + $uriParts[] = 'd=' . urlencode($defaultImageUri); + } + if ($size !== NULL) { + $uriParts[] = 's=' . urlencode($size); + } + if (count($uriParts) > 0) { + $gravatarUri .= '?' . implode('&', $uriParts); + } - /** - * Render the gravatar image - * - * @return string The rendered image tag - */ - public function render() - { - $gravatarUri = 'http://www.gravatar.com/avatar/' . md5($this->arguments['emailAddress']); - $uriParts = []; - if ($this->arguments['defaultImageUri'] !== null) { - $uriParts[] = 'd=' . urlencode($this->arguments['defaultImageUri']); - } - if ($this->arguments['size'] !== null) { - $uriParts[] = 's=' . urlencode($this->arguments['size']); - } - if (count($uriParts) > 0) { - $gravatarUri .= '?' . implode('&', $uriParts); - } - - $this->tag->addAttribute('src', $gravatarUri); - return $this->tag->render(); - } + $this->tag->addAttribute('src', $gravatarUri); + return $this->tag->render(); + } } + + +?> \ No newline at end of file diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php deleted file mode 100644 index 1f73aef..0000000 --- a/Configuration/TCA/Overrides/fe_users.php +++ /dev/null @@ -1,10 +0,0 @@ -get('blog_example', 'registerSinglePlugin')) { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'blog_example', - 'Pi1', - 'A Blog Example' // A title shown in the backend dropdown field - ); - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['blogexample_pi1'] = 'select_key'; - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['blogexample_pi1'] = 'pi_flexform,recursive'; - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('blogexample_pi1', 'FILE:EXT:' . 'blog_example' . '/Configuration/FlexForms/flexform_list.xml'); -} else { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'blog_example', - 'BlogList', - 'List of Blogs (BlogExample)' - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'blog_example', - 'PostList', - 'List of Posts (BlogExample)' - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'blog_example', - 'PostSingle', - 'Single Post (BlogExample)' - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'blog_example', - 'BlogAdmin', - 'Admin Plugin (BlogExample)' - ); - - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['blogexample_postlist'] = 'select_key'; - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['blogexample_postlist'] = 'pi_flexform,recursive'; - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('blogexample_postlist', 'FILE:EXT:' . 'blog_example' . '/Configuration/FlexForms/flexform_list.xml'); -} diff --git a/Configuration/TCA/tca.php b/Configuration/TCA/tca.php new file mode 100644 index 0000000..4c4c582 --- /dev/null +++ b/Configuration/TCA/tca.php @@ -0,0 +1,517 @@ + $TCA['tx_blogexample_domain_model_blog']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'title, posts, administrator' + ), + 'columns' => array( + 'sys_language_uid' => Array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language', + 'config' => Array ( + 'type' => 'select', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => Array( + Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1), + Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0) + ) + ) + ), + 'l18n_parent' => Array ( + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent', + 'config' => Array ( + 'type' => 'select', + 'items' => Array ( + Array('', 0), + ), + 'foreign_table' => 'tx_blogexample_domain_model_blog', + 'foreign_table_where' => 'AND tx_blogexample_domain_model_blog.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_blog.sys_language_uid IN (-1,0)', + ) + ), + 'l18n_diffsource' => Array( + 'config'=>array( + 'type'=>'passthrough' + ) + ), + 't3ver_label' => Array ( + 'displayCond' => 'FIELD:t3ver_label:REQ:true', + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.versionLabel', + 'config' => Array ( + 'type'=>'none', + 'cols' => 27 + ) + ), + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), + 'title' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.title', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim,required', + 'max' => 256 + ) + ), + 'description' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.description', + 'config' => array( + 'type' => 'text', + 'eval' => 'required', + 'rows' => 30, + 'cols' => 80, + ) + ), + 'logo' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.logo', + 'config' => array( + 'type' => 'group', + 'internal_type' => 'file', + 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], + 'max_size' => 3000, + 'uploadfolder' => 'uploads/pics', + 'show_thumbs' => 1, + 'size' => 1, + 'maxitems' => 1, + 'minitems' => 0 + ) + ), + 'posts' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.posts', + 'config' => array( + 'type' => 'inline', + 'foreign_table' => 'tx_blogexample_domain_model_post', + 'foreign_field' => 'blog', + 'foreign_sortby' => 'sorting', + 'maxitems' => 999999, + 'appearance' => array( + 'collapseAll' => 1, + 'expandSingle' => 1, + ), + ) + ), + 'administrator' => Array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.administrator', + 'config' => Array ( + 'type' => 'select', + 'foreign_table' => 'fe_users', + 'foreign_table_where' => "AND fe_users.tx_extbase_type='Tx_BlogExample_Domain_Model_Administrator'", + 'items' => array( + array('--none--', 0), + ), + 'wizards' => Array( + '_PADDING' => 1, + '_VERTICAL' => 1, + 'edit' => Array( + 'type' => 'popup', + 'title' => 'Edit', + 'script' => 'wizard_edit.php', + 'icon' => 'edit2.gif', + 'popup_onlyOpenIfSelected' => 1, + 'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1', + ), + 'add' => Array( + 'type' => 'script', + 'title' => 'Create new', + 'icon' => 'add.gif', + 'params' => Array( + 'table'=>'fe_users', + 'pid' => '###CURRENT_PID###', + 'setValue' => 'prepend' + ), + 'script' => 'wizard_add.php', + ), + ) + ) + ), + ), + 'types' => array( + '1' => array('showitem' => 'sys_language_uid, hidden, title, description, logo, posts, administrator') + ), + 'palettes' => array( + '1' => array('showitem' => '') + ) +); + +$TCA['tx_blogexample_domain_model_post'] = array( + 'ctrl' => $TCA['tx_blogexample_domain_model_post']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'title, date, author', + 'maxDBListItems' => 100, + 'maxSingleDBListItems' => 500 + ), + 'types' => array( + '1' => array('showitem' => 'sys_language_uid, hidden, blog, title, date, author, content, tags, comments, related_posts') + ), + 'columns' => array( + 'sys_language_uid' => Array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language', + 'config' => Array ( + 'type' => 'select', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => Array( + Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1), + Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0) + ) + ) + ), + 'l18n_parent' => Array ( + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent', + 'config' => Array ( + 'type' => 'select', + 'items' => Array ( + Array('', 0), + ), + 'foreign_table' => 'tx_blogexample_domain_model_post', + 'foreign_table_where' => 'AND tx_blogexample_domain_model_post.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_post.sys_language_uid IN (-1,0)', + ) + ), + 'l18n_diffsource' => Array( + 'config'=>array( + 'type'=>'passthrough' + ) + ), + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), + 'blog' => Array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.blog', + 'config' => Array ( + 'type' => 'select', + 'foreign_table' => 'tx_blogexample_domain_model_blog', + 'maxitems' => 1, + ) + ), + 'title' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.title', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim, required', + 'max' => 256 + ) + ), + 'date' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.date', + 'config' => array( + 'type' => 'input', + 'size' => 12, + 'checkbox' => 1, + 'eval' => 'datetime, required', + 'default' => time() + ) + ), + 'author' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.author', + 'config' => array( + 'type' => 'select', + 'foreign_table' => 'tx_blogexample_domain_model_person', + 'wizards' => Array( + '_PADDING' => 1, + '_VERTICAL' => 1, + 'edit' => Array( + 'type' => 'popup', + 'title' => 'Edit', + 'script' => 'wizard_edit.php', + 'icon' => 'edit2.gif', + 'popup_onlyOpenIfSelected' => 1, + 'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1', + ), + 'add' => Array( + 'type' => 'script', + 'title' => 'Create new', + 'icon' => 'add.gif', + 'params' => Array( + 'table'=>'tx_blogexample_domain_model_person', + 'pid' => '###CURRENT_PID###', + 'setValue' => 'prepend' + ), + 'script' => 'wizard_add.php', + ), + ) + ) + ), + 'content' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.content', + 'config' => array( + 'type' => 'text', + 'rows' => 30, + 'cols' => 80 + ) + ), + 'tags' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.tags', + 'config' => array( + 'type' => 'inline', + 'foreign_table' => 'tx_blogexample_domain_model_tag', + 'MM' => 'tx_blogexample_post_tag_mm', + 'maxitems' => 9999, + 'appearance' => array( + 'useCombination' => 1, + 'useSortable' => 1, + 'collapseAll' => 1, + 'expandSingle' => 1, + ) + ) + ), + 'comments' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.comments', + 'config' => array( + 'type' => 'inline', + 'foreign_table' => 'tx_blogexample_domain_model_comment', + 'foreign_field' => 'post', + 'size' => 10, + 'maxitems' => 9999, + 'autoSizeMax' => 30, + 'multiple' => 0, + 'appearance' => array( + 'collapseAll' => 1, + 'expandSingle' => 1, + ) + ) + ), + 'related_posts' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.related', + 'config' => array( + 'type' => 'select', + 'size' => 10, + 'maxitems' => 9999, + 'autoSizeMax' => 30, + 'multiple' => 0, + 'foreign_table' => 'tx_blogexample_domain_model_post', + 'foreign_table_where' => 'AND ###THIS_UID### != tx_blogexample_domain_model_post.uid', + 'MM' => 'tx_blogexample_post_post_mm', + 'MM_opposite_field' => 'related_posts', + ) + ), + ) +); + +$TCA['tx_blogexample_domain_model_comment'] = array( + 'ctrl' => $TCA['tx_blogexample_domain_model_comment']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'hidden, date, author, email, content' + ), + 'columns' => array( + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), + 'date' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.date', + 'config' => array( + 'type' => 'input', + 'size' => 12, + 'checkbox' => 1, + 'eval' => 'datetime, required', + 'default' => time() + ) + ), + 'author' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.author', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim, required', + 'max' => 256 + ) + ), + 'email' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.email', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim, required', + 'max' => 256 + ) + ), + 'content' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.content', + 'config' => array( + 'type' => 'text', + 'rows' => 30, + 'cols' => 80 + ) + ), + 'post' => array( + 'config' => array( + 'type' => 'passthrough', + ) + ), + ), + 'types' => array( + '1' => array('showitem' => 'hidden, date, author, email, content') + ), + 'palettes' => array( + '1' => array('showitem' => '') + ) +); + +$TCA['tx_blogexample_domain_model_person'] = array( + 'ctrl' => $TCA['tx_blogexample_domain_model_person']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'firstname, lastname, email, avatar' + ), + 'columns' => array( + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), + 'firstname' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.firstname', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim,required', + 'max' => 256 + ) + ), + 'lastname' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.lastname', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim,required', + 'max' => 256 + ) + ), + 'email' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.email', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim, required', + 'max' => 256 + ) + ) + ), + 'types' => array( + '1' => array('showitem' => 'firstname, lastname, email, avatar') + ), + 'palettes' => array( + '1' => array('showitem' => '') + ) +); + +$TCA['tx_blogexample_domain_model_tag'] = array( + 'ctrl' => $TCA['tx_blogexample_domain_model_tag']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'hidden, name, posts' + ), + 'columns' => array( + 'sys_language_uid' => Array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language', + 'config' => Array ( + 'type' => 'select', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => Array( + Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1), + Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0) + ) + ) + ), + 'l18n_parent' => Array ( + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent', + 'config' => Array ( + 'type' => 'select', + 'items' => Array ( + Array('', 0), + ), + 'foreign_table' => 'tx_blogexample_domain_model_tag', + 'foreign_table_where' => 'AND tx_blogexample_domain_model_tag.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_tag.sys_language_uid IN (-1,0)', + ) + ), + 'l18n_diffsource' => Array( + 'config'=>array( + 'type'=>'passthrough' + ) + ), + 'hidden' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', + 'config' => array( + 'type' => 'check' + ) + ), + 'name' => array( + 'exclude' => 0, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag.name', + 'config' => array( + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim, required', + 'max' => 256 + ) + ), + 'posts' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag.posts', + 'config' => array( + 'type' => 'select', + 'size' => 10, + 'minitems' => 0, + 'maxitems' => 9999, + 'autoSizeMax' => 30, + 'multiple' => 0, + 'foreign_table' => 'tx_blogexample_domain_model_post', + 'MM' => 'tx_blogexample_post_tag_mm', + 'MM_opposite_field' => 'tags', + ) + ), + ), + 'types' => array( + '1' => array('showitem' => 'sys_language_uid, hidden, name, posts') + ), + 'palettes' => array( + '1' => array('showitem' => '') + ) +); + +?> \ No newline at end of file diff --git a/Configuration/TCA/tx_blogexample_domain_model_blog.php b/Configuration/TCA/tx_blogexample_domain_model_blog.php deleted file mode 100644 index 23a0598..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_blog.php +++ /dev/null @@ -1,190 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog', - 'label' => 'title', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'versioningWS' => true, - 'origUid' => 't3_origuid', - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', - 'transOrigDiffSourceField' => 'l18n_diffsource', - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden', - 'fe_group' => 'fe_group', - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_blog.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'title, posts, administrator' - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ], - ], - 'default' => 0 - ] - ], - 'l18n_parent' => [ - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_blogexample_domain_model_blog', - 'foreign_table_where' => 'AND tx_blogexample_domain_model_blog.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_blog.sys_language_uid IN (-1,0)', - ] - ], - 'l18n_diffsource' => [ - 'config' => [ - 'type' => 'passthrough', - 'default' => '' - ] - ], - 't3ver_label' => [ - 'displayCond' => 'FIELD:t3ver_label:REQ:true', - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', - 'config' => [ - 'type' => 'none', - 'cols' => 27 - ] - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check' - ] - ], - 'fe_group' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.fe_group', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectMultipleSideBySide', - 'size' => 5, - 'maxitems' => 20, - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', - -1, - ], - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', - -2, - ], - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', - '--div--', - ], - ], - 'exclusiveKeys' => '-1,-2', - 'foreign_table' => 'fe_groups', - 'foreign_table_where' => 'ORDER BY fe_groups.title', - ], - ], - 'title' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.title', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim,required', - 'max' => 256 - ] - ], - 'subtitle' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.subtitle', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim', - 'max' => 256 - ] - ], - 'description' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.description', - 'config' => [ - 'type' => 'text', - 'eval' => 'required', - 'rows' => 30, - 'cols' => 80, - ] - ], - 'logo' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.logo', - 'config' => [ - 'type' => 'group', - 'internal_type' => 'file', - 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], - 'max_size' => 3000, - 'uploadfolder' => 'uploads/pics', - 'size' => 1, - 'maxitems' => 1, - 'minitems' => 0 - ] - ], - 'posts' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.posts', - 'config' => [ - 'type' => 'inline', - 'foreign_table' => 'tx_blogexample_domain_model_post', - 'foreign_field' => 'blog', - 'foreign_sortby' => 'sorting', - 'appearance' => [ - 'collapseAll' => 1, - 'expandSingle' => 1, - ], - ] - ], - 'administrator' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog.administrator', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'foreign_table' => 'fe_users', - 'foreign_table_where' => "AND fe_users.tx_extbase_type='FriendsOfTYPO3\\\\BlogExample\\\\Domain\\\\Model\\\\Administrator'", - 'items' => [ - ['--none--', 0], - ], - 'fieldControl' => [ - 'editPopup' => [ - 'disabled' => false, - ], - 'addRecord' => [ - 'disabled' => false, - 'options' => [ - 'setValue' => 'prepend', - ], - ], - ], - ], - ], - ], - 'types' => [ - '1' => ['showitem' => 'sys_language_uid, hidden, fe_group, title, description, logo, posts, administrator'] - ], - 'palettes' => [ - '1' => ['showitem' => ''] - ] -]; diff --git a/Configuration/TCA/tx_blogexample_domain_model_comment.php b/Configuration/TCA/tx_blogexample_domain_model_comment.php deleted file mode 100644 index b989779..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_comment.php +++ /dev/null @@ -1,78 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment', - 'label' => 'date', - 'label_alt' => 'author', - 'label_alt_force' => true, - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden' - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_comment.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'hidden, date, author, email, content' - ], - 'columns' => [ - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check' - ] - ], - 'date' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.date', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'dbType' => 'datetime', - 'size' => 12, - 'eval' => 'datetime, required', - 'default' => time() - ] - ], - 'author' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.author', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'email' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.email', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'content' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment.content', - 'config' => [ - 'type' => 'text', - 'rows' => 30, - 'cols' => 80 - ] - ], - 'post' => [ - 'config' => [ - 'type' => 'passthrough', - ] - ], - ], - 'types' => [ - '1' => ['showitem' => 'hidden, date, author, email, content'] - ], - 'palettes' => [ - '1' => ['showitem' => ''] - ] -]; diff --git a/Configuration/TCA/tx_blogexample_domain_model_info.php b/Configuration/TCA/tx_blogexample_domain_model_info.php deleted file mode 100644 index 47f10d0..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_info.php +++ /dev/null @@ -1,95 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_info', - 'label' => 'name', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'versioningWS' => true, - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', - 'transOrigDiffSourceField' => 'l18n_diffsource', - 'delete' => 'deleted', - 'sortby' => 'sorting', - 'enablecolumns' => [ - 'disabled' => 'hidden' - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_tag.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'hidden, name' - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ], - ], - 'default' => 0, - ] - ], - 'l18n_parent' => [ - 'exclude' => true, - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_blogexample_domain_model_info', - 'foreign_table_where' => 'AND tx_blogexample_domain_model_info.pid=###CURRENT_PID### AND tx_blogexample_domain_model_info.sys_language_uid IN (-1,0)', - 'default' => 0 - ] - ], - 'l18n_diffsource' => [ - 'config' => [ - 'type' => 'passthrough', - 'default' => '', - ], - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', - 'config' => [ - 'type' => 'check', - 'renderType' => 'checkboxToggle', - 'items' => [ - [ - 0 => '', - 1 => '', - 'invertStateDisplay' => true - ] - ], - ] - ], - 'name' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_info.name', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'post' => [ - 'config' => [ - 'type' => 'passthrough', - ] - ], - ], - 'types' => [ - 0 => ['showitem' => 'sys_language_uid, l18n_parent, hidden, name'] - ], -]; diff --git a/Configuration/TCA/tx_blogexample_domain_model_person.php b/Configuration/TCA/tx_blogexample_domain_model_person.php deleted file mode 100644 index f265e93..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_person.php +++ /dev/null @@ -1,132 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person', - 'label' => 'lastname', - 'label_alt' => 'firstname', - 'label_alt_force' => true, - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'versioningWS' => true, - 'origUid' => 't3_origuid', - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l10n_parent', - 'prependAtCopy' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.prependAtCopy', - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden' - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_person.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'firstname, lastname, email, avatar' - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ], - ], - 'default' => 0 - ] - ], - 'l10n_parent' => [ - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_blogexample_domain_model_person', - 'foreign_table_where' => 'AND tx_blogexample_domain_model_person.uid=###REC_FIELD_l10n_parent### AND tx_blogexample_domain_model_person.sys_language_uid IN (-1,0)', - ] - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check' - ] - ], - 'firstname' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.firstname', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim,required', - 'max' => 256 - ] - ], - 'lastname' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.lastname', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim,required', - 'max' => 256 - ] - ], - 'email' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.email', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'tags' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.tags', - 'config' => [ - 'type' => 'inline', - 'foreign_table' => 'tx_blogexample_domain_model_tag', - 'MM' => 'tx_blogexample_domain_model_tag_mm', - 'MM_match_fields' => [ - 'fieldname' => 'tags' - ], - 'appearance' => [ - 'useCombination' => 1, - 'useSortable' => 1, - 'collapseAll' => 1, - 'expandSingle' => 1, - ] - ] - ], - 'tags_special' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person.tags_special', - 'config' => [ - 'type' => 'inline', - 'foreign_table' => 'tx_blogexample_domain_model_tag', - 'MM' => 'tx_blogexample_domain_model_tag_mm', - 'MM_match_fields' => [ - 'fieldname' => 'tags_special' - ], - 'appearance' => [ - 'useCombination' => 1, - 'useSortable' => 1, - 'collapseAll' => 1, - 'expandSingle' => 1, - ] - ] - ], - ], - 'types' => [ - '1' => ['showitem' => 'sys_language_uid, firstname, lastname, email, avatar, tags, tags_special'] - ], - 'palettes' => [ - '1' => ['showitem' => ''] - ] -]; diff --git a/Configuration/TCA/tx_blogexample_domain_model_post.php b/Configuration/TCA/tx_blogexample_domain_model_post.php deleted file mode 100644 index fb050f2..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_post.php +++ /dev/null @@ -1,254 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post', - 'label' => 'title', - 'label_alt' => 'author', - 'label_alt_force' => true, - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'versioningWS' => true, - 'origUid' => 't3_origuid', - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', - 'transOrigDiffSourceField' => 'l18n_diffsource', - 'delete' => 'deleted', - 'sortby' => 'sorting', - 'enablecolumns' => [ - 'disabled' => 'hidden' - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_post.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'title, date, author', - 'maxDBListItems' => 100, - 'maxSingleDBListItems' => 500 - ], - 'types' => [ - '1' => ['showitem' => 'sys_language_uid, hidden, blog, title, date, author, second_author, content, tags, comments, related_posts, additional_name, additional_info, additional_comments'] - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ], - ], - 'default' => 0 - ] - ], - 'l18n_parent' => [ - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_blogexample_domain_model_post', - 'foreign_table_where' => 'AND tx_blogexample_domain_model_post.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_post.sys_language_uid IN (-1,0)', - ] - ], - 'l18n_diffsource' => [ - 'config' => [ - 'type' => 'passthrough', - 'default' => '' - ] - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check' - ] - ], - 'blog' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.blog', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'foreign_table' => 'tx_blogexample_domain_model_blog', - 'maxitems' => 1, - ] - ], - 'title' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.title', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'date' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.date', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'size' => 12, - 'eval' => 'datetime, required', - 'default' => time() - ] - ], - 'author' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.author', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'foreign_table' => 'tx_blogexample_domain_model_person', - 'fieldControl' => [ - 'editPopup' => [ - 'disabled' => false, - ], - 'addRecord' => [ - 'disabled' => false, - 'options' => [ - 'setValue' => 'prepend', - ], - ], - ], - ], - ], - 'second_author' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.second_author', - 'config' => [ - 'type' => 'group', - 'internal_type' => 'db', - 'allowed' => 'tx_blogexample_domain_model_person', - 'foreign_table' => 'tx_blogexample_domain_model_person', - 'maxitems' => 1, - 'fieldControl' => [ - 'editPopup' => [ - 'disabled' => false, - ], - 'addRecord' => [ - 'disabled' => false, - ], - 'listModule' => [ - 'disabled' => false, - ], - ], - ], - ], - 'reviewer' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.reviewer', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'foreign_table' => 'tx_blogexample_domain_model_person', - 'fieldControl' => [ - 'editPopup' => [ - 'disabled' => false, - ], - 'addRecord' => [ - 'disabled' => false, - 'options' => [ - 'setValue' => 'prepend', - ], - ], - ], - ], - ], - 'content' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.content', - 'config' => [ - 'type' => 'text', - 'rows' => 30, - 'cols' => 80 - ] - ], - 'tags' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.tags', - 'config' => [ - 'type' => 'inline', - 'foreign_table' => 'tx_blogexample_domain_model_tag', - 'MM' => 'tx_blogexample_post_tag_mm', - 'appearance' => [ - 'useCombination' => 1, - 'useSortable' => 1, - 'collapseAll' => 1, - 'expandSingle' => 1, - ] - ] - ], - 'comments' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.comments', - 'config' => [ - 'type' => 'inline', - 'foreign_table' => 'tx_blogexample_domain_model_comment', - 'foreign_field' => 'post', - 'size' => 10, - 'autoSizeMax' => 30, - 'multiple' => 0, - 'appearance' => [ - 'collapseAll' => 1, - 'expandSingle' => 1, - ] - ] - ], - 'related_posts' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.related', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectMultipleSideBySide', - 'size' => 10, - 'autoSizeMax' => 30, - 'multiple' => 0, - 'foreign_table' => 'tx_blogexample_domain_model_post', - 'foreign_table_where' => 'AND ###THIS_UID### != tx_blogexample_domain_model_post.uid', - 'MM' => 'tx_blogexample_post_post_mm', - 'MM_opposite_field' => 'related_posts', - ] - ], - 'additional_name' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.additional_name', - 'config' => [ - 'type' => 'inline', // this will store the info uid in the additional_name field (CSV) - 'foreign_table' => 'tx_blogexample_domain_model_info', - 'minitems' => 0, - 'maxitems' => 1, - ], - ], - 'additional_info' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.additional_info', - 'config' => [ - 'type' => 'inline', // this will store the post uid in the post field of the info table - 'foreign_table' => 'tx_blogexample_domain_model_info', - 'foreign_field' => 'post', - 'minitems' => 0, - 'maxitems' => 1, - ], - ], - 'additional_comments' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post.additional_comments', - 'config' => [ - 'type' => 'inline', // this will store the comments uids in the additional_comments field (CSV) - 'foreign_table' => 'tx_blogexample_domain_model_comment', - 'minitems' => 0, - 'maxitems' => 200, - ], - ], - ] -]; diff --git a/Configuration/TCA/tx_blogexample_domain_model_tag.php b/Configuration/TCA/tx_blogexample_domain_model_tag.php deleted file mode 100644 index 6c66fd7..0000000 --- a/Configuration/TCA/tx_blogexample_domain_model_tag.php +++ /dev/null @@ -1,98 +0,0 @@ - [ - 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag', - 'label' => 'name', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'versioningWS' => true, - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l18n_parent', - 'transOrigDiffSourceField' => 'l18n_diffsource', - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden' - ], - 'iconfile' => 'EXT:blog_example/Resources/Public/Icons/icon_tx_blogexample_domain_model_tag.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'hidden, name, posts' - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ], - ], - 'default' => 0 - ] - ], - 'l18n_parent' => [ - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_blogexample_domain_model_tag', - 'foreign_table_where' => 'AND tx_blogexample_domain_model_tag.uid=###REC_FIELD_l18n_parent### AND tx_blogexample_domain_model_tag.sys_language_uid IN (-1,0)', - ] - ], - 'l18n_diffsource' => [ - 'config' => [ - 'type' => 'passthrough', - 'default' => '', - ], - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check' - ] - ], - 'name' => [ - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag.name', - 'config' => [ - 'type' => 'input', - 'size' => 20, - 'eval' => 'trim, required', - 'max' => 256 - ] - ], - 'posts' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag.posts', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectMultipleSideBySide', - 'size' => 10, - 'minitems' => 0, - 'autoSizeMax' => 30, - 'multiple' => 0, - 'foreign_table' => 'tx_blogexample_domain_model_post', - 'MM' => 'tx_blogexample_post_tag_mm', - 'MM_opposite_field' => 'tags', - ] - ], - ], - 'types' => [ - '1' => ['showitem' => 'sys_language_uid, hidden, name, posts'] - ], - 'palettes' => [ - '1' => ['showitem' => ''] - ] -]; diff --git a/Configuration/TypoScript/DefaultStyles/setup.typoscript b/Configuration/TypoScript/DefaultStyles/setup.txt similarity index 100% rename from Configuration/TypoScript/DefaultStyles/setup.typoscript rename to Configuration/TypoScript/DefaultStyles/setup.txt diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.txt similarity index 91% rename from Configuration/TypoScript/constants.typoscript rename to Configuration/TypoScript/constants.txt index 0790585..c325f32 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.txt @@ -22,9 +22,9 @@ module.tx_blogexample { view { # cat=module.tx_blogexample/file; type=string; label=Path to template root (BE) templateRootPath = EXT:blog_example/Resources/Private/Backend/Templates/ - # cat=module.tx_blogexample/file; type=string; label=Path to template partials (BE) + # cat=plugin.tx_blogexample/file; type=string; label=Path to template partials (BE) partialRootPath = EXT:blog_example/Resources/Private/Partials/ - # cat=module.tx_blogexample/file; type=string; label=Path to template layouts (BE) + # cat=plugin.tx_blogexample/file; type=string; label=Path to template layouts (BE) layoutRootPath = EXT:blog_example/Resources/Private/Backend/Layouts/ } } \ No newline at end of file diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.txt similarity index 65% rename from Configuration/TypoScript/setup.typoscript rename to Configuration/TypoScript/setup.txt index ce52e73..9da4a60 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.txt @@ -1,39 +1,35 @@ -# Plugin configuration + # Plugin configuration plugin.tx_blogexample { settings { - # maximum number of posts to display per page + # maximum number of posts to display per page postsPerPage = 3 - # Editor FE Usergroup uid + # Editor FE Usergroup uid editorUsergroupUid = {$plugin.tx_blogexample.settings.editorUsergroupUid} - # Plaintext page type number + # Plaintext page type number plaintextPageType = {$plugin.tx_blogexample.settings.plaintextPageType} } - persistence { storagePid = {$plugin.tx_blogexample.persistence.storagePid} classes { - TYPO3\CMS\Extbase\Domain\Model\FrontendUser { + Tx_Extbase_Domain_Model_FrontendUser { subclasses { - \FriendsOfTYPO3\BlogExample\Domain\Model\Administrator = FriendsOfTYPO3\BlogExample\Domain\Model\Administrator + Tx_BlogExample_Domain_Model_Administrator = Tx_BlogExample_Domain_Model_Administrator } } - - FriendsOfTYPO3\BlogExample\Domain\Model\Administrator { + Tx_BlogExample_Domain_Model_Administrator { mapping { tableName = fe_users - recordType = FriendsOfTYPO3\BlogExample\Domain\Model\Administrator + recordType = Tx_BlogExample_Domain_Model_Administrator } } } } - view { templateRootPath = {$plugin.tx_blogexample.view.templateRootPath} partialRootPath = {$plugin.tx_blogexample.view.partialRootPath} layoutRootPath = {$plugin.tx_blogexample.view.layoutRootPath} defaultPid = auto } - # This is an example how to modify the translation _LOCAL_LANG { default { @@ -42,7 +38,7 @@ plugin.tx_blogexample { } } -# Module configuration + # Module configuration module.tx_blogexample { settings < plugin.tx_blogexample.settings persistence < plugin.tx_blogexample.persistence @@ -54,39 +50,36 @@ module.tx_blogexample { } } -# plaintext rendering + # plaintext rendering tx_blogexample_plaintext = PAGE tx_blogexample_plaintext { typeNum = {$plugin.tx_blogexample.settings.plaintextPageType} 10 = USER 10 { - userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run + userFunc = tx_extbase_core_bootstrap->run extensionName = BlogExample pluginName = PostList - vendorName = FriendsOfTYPO3 switchableControllerActions { Post { 1 = index } } } - config { admPanel = 0 no_cache = 1 disableAllHeaderCode = 1 - additionalHeaders.10.header = Content-Type: text/plain - additionalHeaders.10.replace = 1 + additionalHeaders = Content-type:text/plain defaultGetVars { tx_blogexample_postlist.format = txt } } } -# Adjust plaintext rendering, if blog_example runs as single, fully fledged plugin -[globalVar = TYPO3_CONF_VARS|EXTENSIONS|blog_example|registerSinglePlugin > 0] + # Adjust plaintext rendering, if blog_example runs as single, fully fledged plugin +[globalVar = TYPO3_CONF_VARS|EXTCONF|blog_example|registerSinglePlugin > 0] tx_blogexample_plaintext { 10.pluginName = Pi1 #config.defaultGetVars = } -[end] +[end] \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 07d5d4c..0000000 --- a/README.md +++ /dev/null @@ -1,7 +0,0 @@ -Blog Example for TYPO3 -====================== - -This example is part of the Extbase documentation of the TYPO3 project. - -It was originally written by Sebastian Kurfuerst and Jochen Rau (Thanks!) and -adjusted over time to reflect current development in the TYPO3 project. diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html index 7320afc..2c692b2 100644 --- a/Resources/Private/Backend/Layouts/Default.html +++ b/Resources/Private/Backend/Layouts/Default.html @@ -28,7 +28,7 @@
- +
diff --git a/Resources/Private/Language/locallang.xml b/Resources/Private/Language/locallang.xml index 9083291..6945b98 100644 --- a/Resources/Private/Language/locallang.xml +++ b/Resources/Private/Language/locallang.xml @@ -14,7 +14,7 @@ - + @@ -30,10 +30,10 @@ - + - + @@ -100,7 +100,7 @@ - + @@ -116,10 +116,10 @@ - + - + @@ -145,9 +145,9 @@ - + - + @@ -165,8 +165,8 @@ - - + + @@ -178,4 +178,4 @@ - + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_db.xml b/Resources/Private/Language/locallang_db.xml index c562ae3..01899a0 100644 --- a/Resources/Private/Language/locallang_db.xml +++ b/Resources/Private/Language/locallang_db.xml @@ -36,7 +36,7 @@ - + - + \ No newline at end of file diff --git a/Resources/Private/Layouts/Default.html b/Resources/Private/Layouts/Default.html index 8a0fb07..3d55903 100644 --- a/Resources/Private/Layouts/Default.html +++ b/Resources/Private/Layouts/Default.html @@ -1,6 +1,6 @@
- +

-
+ \ No newline at end of file diff --git a/Resources/Private/Partials/FormErrors.html b/Resources/Private/Partials/FormErrors.html index 5fc193a..b5fd61a 100644 --- a/Resources/Private/Partials/FormErrors.html +++ b/Resources/Private/Partials/FormErrors.html @@ -1,14 +1,13 @@ - - +

[following errors occurred:]

    - - + + - +
  • - [{errorDetail.message} ({errorDetail.code})] + [{errorDetail.message} ({errorDetail.code})]
  • @@ -30,5 +29,4 @@

    [following errors occurred:]

-
-
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Blog/Index.html b/Resources/Private/Templates/Blog/Index.html index f967fa9..b89e204 100644 --- a/Resources/Private/Templates/Blog/Index.html +++ b/Resources/Private/Templates/Blog/Index.html @@ -1,87 +1,50 @@ -

- [Blog header] -

-

- [introduction] -

- - -

- [list of blogs] - : -

- -
    - -
  1. -

    - {blog.title} ({f:translate(key: 'blog.numberOfPosts', arguments: '{numberOfPosts: \'{blog.posts -> f:count()}\'}')}) -

    - -
    - - - - - - -
    -
    -

    - {blog.description} -

    -
  2. -
    -
-
- - - -
- -

- [no blogs] -

- - - - - -

- [log in to create your first blog] -

-
-
-
-
+

[Blog header]

+

[introduction]

+ + +

[list of blogs]:

+ +
    + +
  1. +

    + {blog.title} ({f:translate(key: 'blog.numberOfPosts', arguments: '{numberOfPosts: \'{blog.posts -> f:count()}\'}')}) +

    + +
    + + +
    +
    +

    {blog.description}

    +
  2. +
    +
+
+ + + +
+ +

[no blogs]

+ + + + + +

[log in to create your first blog]

+
+
+
+
diff --git a/Resources/Private/Templates/Post/Index.html b/Resources/Private/Templates/Post/Index.html index ab2c005..fa8a3ff 100644 --- a/Resources/Private/Templates/Post/Index.html +++ b/Resources/Private/Templates/Post/Index.html @@ -1,99 +1,63 @@ -

- [Post header] -

- - -

- - [introduction (administrator)] - -

-
- -

- [introduction (no administrator)] -

-
-
- - - - -

- [list of posts (tag)] - : -

- - [show all posts] - -
- -

- [list of posts] - : -

-
-
- -
    - -
  1. -

    - {post.title} -

    - -
    - - - - - - -
    -
    -

    - {post.content} - - [read more] - -

    - - -
  2. -
    -
-
- - - -
- -

- [no entries] -

- - - -
-
+

[Post header]

+ + +

[introduction (administrator)]

+
+ +

[introduction (no administrator)]

+
+
+ + + + +

[list of posts (tag)]:

+ [show all posts] +
+ +

[list of posts]:

+
+
+ +
    + +
  1. +

    + {post.title} +

    + +
    + + +
    +
    +

    + {post.content} + [read more] +

    + + +
  2. +
    +
+
+ + + +
+ +

[no entries]

+ + + +
+
diff --git a/Resources/Private/Templates/Post/Show.html b/Resources/Private/Templates/Post/Show.html index 0816792..1f0841d 100644 --- a/Resources/Private/Templates/Post/Show.html +++ b/Resources/Private/Templates/Post/Show.html @@ -1,74 +1,49 @@ - +{namespace blog=Tx_BlogExample_ViewHelpers} - - [back] - -

{post.title}

-

- {post.content} -

- - - - - - -
- - - - - - -
-
-
-

- [comments] - : -

- -
    - -
  1. - - {comment.author} - -

    - {comment.content} -

    - -
    - - - -
    -
    -
  2. -
    -
-
-

- [add comment] -

- -
+ [back] +

{post.title}

+

{post.content}

+ + + + + + +
+ + +
+
+
+

[comments]:

+ +
    + +
  1. + + {comment.author} +

    {comment.content}

    + +
    + +
    +
    +
  2. +
    +
+
+

[add comment]

+ +
- diff --git a/Resources/Public/Icons/module-blog.svg b/Resources/Public/Icons/module-blog.svg deleted file mode 100644 index 9466dc5..0000000 --- a/Resources/Public/Icons/module-blog.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json deleted file mode 100644 index 917308c..0000000 --- a/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "friendsoftypo3/blog-example", - "authors": [ - { - "name": "TYPO3 Core Team", - "role": "Developer" - } - ], - "type": "typo3-cms-extension", - "description": "", - "license": "GPL-2.0-or-later", - "autoload": { - "psr-4": { - "FriendsOfTYPO3\\BlogExample\\": "Classes/" - } - }, - "require": { - "typo3/cms-core": ">=9.5 <10.0.0" - } -} diff --git a/ext_autoload.php b/ext_autoload.php new file mode 100644 index 0000000..e2dee9e --- /dev/null +++ b/ext_autoload.php @@ -0,0 +1,20 @@ + $extensionClassesPath . 'ViewHelpers/AbstractBackendViewHelper.php', + 'tx_blogexample_domain_model_blog' => $extensionClassesPath . 'Domain/Model/Blog.php', + 'tx_blogexample_domain_model_post' => $extensionClassesPath . 'Domain/Model/Post.php', + 'tx_blogexample_domain_model_tag' => $extensionClassesPath . 'Domain/Model/Tag.php', + 'tx_blogexample_domain_model_comment' => $extensionClassesPath . 'Domain/Model/Comment.php', + 'tx_blogexample_domain_model_person' => $extensionClassesPath . 'Domain/Model/Person.php', + 'tx_blogexample_domain_model_administrator' => $extensionClassesPath . 'Domain/Model/Administrator.php', + 'tx_blogexample_domain_repository_blogrepository' => $extensionClassesPath . 'Domain/Repository/BlogRepository.php', + 'tx_blogexample_domain_repository_personrepository' => $extensionClassesPath . 'Domain/Repository/PersonRepository.php', + 'tx_blogexample_domain_repository_postrepository' => $extensionClassesPath . 'Domain/Repository/PostRepository.php', + 'tx_blogexample_domain_repository_administratorrepository' => $extensionClassesPath . 'Domain/Repository/AdministratorRepository.php', + 'tx_blogexample_domain_validator_blogvalidator' => $extensionClassesPath . 'Domain/Validator/BlogValidator.php', + 'tx_blogexample_controller_blogcontroller' => $extensionClassesPath . 'Controller/BlogController.php', + 'tx_blogexample_controller_commentcontroller' => $extensionClassesPath . 'Controller/CommentController.php', + 'tx_blogexample_controller_postcontroller' => $extensionClassesPath . 'Controller/PostController.php' +); +?> \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php index e0b2904..844380d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,22 +1,39 @@ 'A Blog Example for the Extbase Framework', - 'description' => 'An example extension demonstrating the features of the Extbase Framework. Have fun playing with it!', - 'category' => 'example', - 'author' => 'TYPO3 Core Team', - 'author_company' => '', - 'author_email' => '', - 'state' => 'stable', - 'uploadfolder' => 0, - 'createDirs' => '', - 'clearCacheOnLoad' => 1, - 'version' => '9.5.0', - 'constraints' => [ - 'depends' => [ - 'typo3' => '9.5.0', - ], - 'conflicts' => [], - 'suggests' => [], - ], -]; +######################################################################## +# Extension Manager/Repository config file for ext "blog_example". +# +# Auto generated 07-08-2015 23:45 +# +# Manual updates: +# Only the data in the array - everything else is removed by next +# writing. "version" and "dependencies" must not be touched! +######################################################################## + +$EM_CONF[$_EXTKEY] = array( + 'title' => 'A Blog Example for the Extbase Framework', + 'description' => 'An example extension demonstrating the features of the Extbase Framework. It is the back-ported and tweaked Blog Example package of FLOW3. Have fun playing with it!', + 'category' => 'example', + 'shy' => 0, + 'version' => '1.3.0', + 'dependencies' => '', + 'conflicts' => '', + 'priority' => '', + 'loadOrder' => '', + 'TYPO3_version' => '4.5.0-0.0.0', + 'PHP_version' => '5.2.0-0.0.0', + 'module' => '', + 'state' => 'stable', + 'uploadfolder' => 0, + 'createDirs' => '', + 'modify_tables' => '', + 'clearcacheonload' => 1, + 'lockType' => '', + 'author' => 'TYPO3 core team', + 'author_email' => '', + 'author_company' => '', + 'CGLcompliance' => '', + 'CGLcompliance_note' => '', +); + +?> \ No newline at end of file diff --git a/ext_icon.gif b/ext_icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a832d4b660d1b498d5f980098a7c3953ff69a8f GIT binary patch literal 177 zcmV;i08al$Nk%w1VG;lk0J8!BWo2cKj*jy3@|l^L$;ruVY;1*vg|V@*=H}+t*Vju+ zOI1}>D=RBPLPGxj{r~^~A^8LW00062EC2ui01^NY000DDP{>KEmFXN=lmdfw08JA} z4Wlvz6_lkRDJ!#33)}#bQJ)i%E+I(Nh?AENSWw+41YJXc5Fk4ec9G3FRl5J_Rh9}OA1rm-a80vh15)lA9z(qn} literal 0 HcmV?d00001 diff --git a/ext_icon.svg b/ext_icon.svg deleted file mode 100644 index 11fca6e..0000000 --- a/ext_icon.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/ext_localconf.php b/ext_localconf.php index df86b01..91313d7 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,65 +1,66 @@ get('blog_example', 'registerSinglePlugin') -) { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'FriendsOfTYPO3.BlogExample', - 'Pi1', - [ - 'Blog' => 'index,new,create,delete,deleteAll,edit,update,populate', - 'Post' => 'index,show,new,create,delete,edit,update', - 'Comment' => 'create,delete', - ], - [ - 'Blog' => 'create,delete,deleteAll,update,populate', - 'Post' => 'create,delete,update', - 'Comment' => 'create,delete', - ] - ); +if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['registerSinglePlugin']) { + // fully fletged blog + Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, // The extension name (in UpperCamelCase) or the extension key (in lower_underscore) + 'Pi1', // A unique name of the plugin in UpperCamelCase + array ( // An array holding the controller-action-combinations that are accessible + 'Blog' => 'index,new,create,delete,deleteAll,edit,update,populate', // The first controller and its first action will be the default + 'Post' => 'index,show,new,create,delete,edit,update', + 'Comment' => 'create,delete' + ), + array( // An array of non-cachable controller-action-combinations (they must already be enabled) + 'Blog' => 'create,delete,deleteAll,update,populate', + 'Post' => 'create,delete,update', + 'Comment' => 'create,delete' + ) + ); } else { - // Blog plugins - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'FriendsOfTYPO3.BlogExample', - 'BlogList', - ['Blog' => 'index'] - ); + // Blog plugins + Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'BlogList', + array('Blog' => 'index') + ); - // Post plugins - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'FriendsOfTYPO3.BlogExample', - 'PostList', - ['Post' => 'index'] - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'FriendsOfTYPO3.BlogExample', - 'PostSingle', - ['Post' => 'show', 'Comment' => 'create'], - ['Comment' => 'create'] - ); + // Post plugins + Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'PostList', + array('Post' => 'index') + ); + Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'PostSingle', + array('Post' => 'show', 'Comment' => 'create'), + array('Comment' => 'create') + ); - // admin plugins - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'FriendsOfTYPO3.BlogExample', - 'BlogAdmin', - [ - 'Blog' => 'new,create,delete,deleteAll,edit,update,populate', - 'Post' => 'new,create,delete,edit,update', - 'Comment' => 'delete', - ], - [ - 'Blog' => 'create,delete,deleteAll,update,populate', - 'Post' => 'create,delete,update', - 'Comment' => 'delete', - ] - ); + // admin plugins + Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'BlogAdmin', + array( + 'Blog' => 'new,create,delete,deleteAll,edit,update,populate', + 'Post' => 'new,create,delete,edit,update', + 'Comment' => 'delete', + ), + array( + 'Blog' => 'create,delete,deleteAll,update,populate', + 'Post' => 'create,delete,update', + 'Comment' => 'delete', + ) + ); } + +?> \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php index 11dc966..56e51a6 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,31 +1,190 @@ 'index,new,create,delete,deleteAll,edit,update,populate', // The first controller and its first action will be the default - 'Post' => 'index,show,new,create,delete,edit,update', - 'Comment' => 'create,delete,deleteAll', - ], - [ - 'access' => 'user,group', - 'icon' => 'EXT:blog_example/Resources/Public/Icons/module-blog.svg', - 'labels' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_mod.xml', - ] -); +if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['registerSinglePlugin']) { + Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY,// The extension name (in UpperCamelCase) or the extension key (in lower_underscore) + 'Pi1', // A unique name of the plugin in UpperCamelCase + 'A Blog Example' // A title shown in the backend dropdown field + ); + + $pluginSignature = strtolower($extensionName) . '_pi1'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform,recursive'; + t3lib_extMgm::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml'); +} else { + t3lib_div::loadTCA('tt_content'); + //$TCA['tt_content']['columns']['list_type']['config']['iconsInOptionTags'] = 0; + $TCA['tt_content']['columns']['list_type']['config']['items'][] = array('Blog Example', '--div--', t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'); + Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY, + 'BlogList', + 'List of Blogs (BlogExample)' + ); + Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY, + 'PostList', + 'List of Posts (BlogExample)' + ); + Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY, + 'PostSingle', + 'Single Post (BlogExample)' + ); + Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY, + 'BlogAdmin', + 'Admin Plugin (BlogExample)' + ); + $TCA['tt_content']['columns']['list_type']['config']['items'][] = array('', '--div--'); + + $pluginSignature = strtolower($extensionName) . '_postlist'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform,recursive'; + t3lib_extMgm::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml'); +} + +if (TYPO3_MODE === 'BE') { + /** + * Registers a Backend Module + */ + Tx_Extbase_Utility_Extension::registerModule( + $_EXTKEY, + 'web', // Make module a submodule of 'web' + 'tx_blogexample_m1', // Submodule key + '', // Position + array( // An array holding the controller-action-combinations that are accessible + 'Blog' => 'index,new,create,delete,deleteAll,edit,update,populate', // The first controller and its first action will be the default + 'Post' => 'index,show,new,create,delete,edit,update', + 'Comment' => 'create,delete,deleteAll', + ), + array( + 'access' => 'user,group', + 'icon' => 'EXT:blog_example/ext_icon.gif', + 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml', + ) + ); + +} + /** * Add labels for context sensitive help (CSH) */ -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_BlogExampleTxBlogexampleM1', 'EXT:blog_example/Resources/Private/Language/locallang_csh.xml'); +t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_BlogExampleTxBlogexampleM1', 'EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_csh.xml'); + +t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'BlogExample setup'); +t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/DefaultStyles', 'BlogExample CSS Styles (optional)'); -// Categorize Blog,Post records -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('blog_example', 'tx_blogexample_domain_model_blog'); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('blog_example', 'tx_blogexample_domain_model_post'); +t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_blog'); +$TCA['tx_blogexample_domain_model_blog'] = array ( + 'ctrl' => array ( + 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'versioningWS' => 2, + 'versioning_followPages' => true, + 'origUid' => 't3_origuid', + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => array( + 'disabled' => 'hidden' + ), + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php', + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_blog.gif' + ) +); + +t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_post'); +$TCA['tx_blogexample_domain_model_post'] = array ( + 'ctrl' => array ( + 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post', + 'label' => 'title', + 'label_alt' => 'author', + 'label_alt_force' => TRUE, + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'versioningWS' => 2, + 'versioning_followPages' => true, + 'origUid' => 't3_origuid', + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l18n_parent', + 'transOrigDiffSourceField' => 'l18n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => array( + 'disabled' => 'hidden' + ), + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php', + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_post.gif' + ) +); + +t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_comment'); +$TCA['tx_blogexample_domain_model_comment'] = array ( + 'ctrl' => array ( + 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment', + 'label' => 'date', + 'label_alt' => 'author', + 'label_alt_force' => TRUE, + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'delete' => 'deleted', + 'enablecolumns' => array ( + 'disabled' => 'hidden' + ), + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php', + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_comment.gif' + ) +); + +t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_person'); +$TCA['tx_blogexample_domain_model_person'] = array ( + 'ctrl' => array ( + 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person', + 'label' => 'lastname', + 'label_alt' => 'firstname', + 'label_alt_force' => TRUE, + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'versioningWS' => 2, + 'versioning_followPages' => true, + 'origUid' => 't3_origuid', + 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.xml:LGL.prependAtCopy', + 'delete' => 'deleted', + 'enablecolumns' => array( + 'disabled' => 'hidden' + ), + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php', + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_person.gif' + ) +); + +t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_tag'); +$TCA['tx_blogexample_domain_model_tag'] = array ( + 'ctrl' => array ( + 'title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag', + 'label' => 'name', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'delete' => 'deleted', + 'enablecolumns' => array ( + 'disabled' => 'hidden' + ), + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php', + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_tag.gif' + ) +); + +t3lib_div::loadTCA('fe_users'); +if (is_array($TCA['fe_users']['columns']['tx_extbase_type'])) { + $TCA['fe_users']['types']['Tx_BlogExample_Domain_Model_Administrator'] = $TCA['fe_users']['types']['0']; + array_push($TCA['fe_users']['columns']['tx_extbase_type']['config']['items'], array('LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.Tx_BlogExample_Domain_Model_Administrator', 'Tx_BlogExample_Domain_Model_Administrator')); +} +?> \ No newline at end of file diff --git a/ext_tables.sql b/ext_tables.sql index c2af94e..affaa4f 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -2,89 +2,164 @@ # Table structure for table 'tx_blogexample_domain_model_blog' # CREATE TABLE tx_blogexample_domain_model_blog ( + uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + title varchar(255) DEFAULT '' NOT NULL, - subtitle varchar(255) DEFAULT '', description text NOT NULL, logo tinyblob NOT NULL, - administrator int(11) DEFAULT '0' NOT NULL, + administrator varchar(255) DEFAULT '', + + posts varchar(255) DEFAULT '' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(30) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage tinyint(4) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3_origuid int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l18n_parent int(11) DEFAULT '0' NOT NULL, + l18n_diffsource mediumblob NOT NULL, - posts varchar(255) DEFAULT '' NOT NULL + PRIMARY KEY (uid), + KEY parent (pid), ); # # Table structure for table 'tx_blogexample_domain_model_post' # CREATE TABLE tx_blogexample_domain_model_post ( - blog int(11) DEFAULT '0' NOT NULL, + uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + blog int(11) DEFAULT '0' NOT NULL, + title varchar(255) DEFAULT '' NOT NULL, date int(11) DEFAULT '0' NOT NULL, - author int(11) DEFAULT '0' NOT NULL, - second_author int(11) DEFAULT '0' NOT NULL, - reviewer int(11) DEFAULT '0' NOT NULL, + author int(255) DEFAULT '0' NOT NULL, content text NOT NULL, tags int(11) unsigned DEFAULT '0' NOT NULL, comments int(11) unsigned DEFAULT '0' NOT NULL, related_posts int(11) unsigned DEFAULT '0' NOT NULL, - additional_name varchar(255) DEFAULT '' NOT NULL, - additional_info int(11) DEFAULT '0' NOT NULL, - additional_comments varchar(255) DEFAULT '' NOT NULL + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + sorting tinyint(4) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(30) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage tinyint(4) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3_origuid int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l18n_parent int(11) DEFAULT '0' NOT NULL, + l18n_diffsource mediumblob NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), ); # # Table structure for table 'tx_blogexample_domain_model_comment' # CREATE TABLE tx_blogexample_domain_model_comment ( - post int(11) DEFAULT '0' NOT NULL, + uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, - date datetime, + post int(11) DEFAULT '0' NOT NULL, + + date int(11) DEFAULT '0' NOT NULL, author varchar(255) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, - content text NOT NULL + content text NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), ); # # Table structure for table 'tx_blogexample_domain_model_person' # CREATE TABLE tx_blogexample_domain_model_person ( + uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + firstname varchar(255) DEFAULT '' NOT NULL, lastname varchar(255) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, - tags int(11) unsigned DEFAULT '0' NOT NULL, - tags_special int(11) unsigned DEFAULT '0' NOT NULL + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(30) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage tinyint(4) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3_origuid int(11) DEFAULT '0' NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), ); # # Table structure for table 'tx_blogexample_domain_model_tag' # CREATE TABLE tx_blogexample_domain_model_tag ( - name varchar(255) DEFAULT '' NOT NULL, - posts int(11) unsigned DEFAULT '0' NOT NULL -); + uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, -# -# Table structure for table 'tx_blogexample_domain_model_tag_mm' -# -CREATE TABLE tx_blogexample_domain_model_tag_mm ( - uid_local int(11) unsigned DEFAULT '0' NOT NULL, - uid_foreign int(11) unsigned DEFAULT '0' NOT NULL, - tablenames varchar(255) DEFAULT '' NOT NULL, - fieldname varchar(255) DEFAULT '' NOT NULL, - sorting int(11) unsigned DEFAULT '0' NOT NULL, - sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL, + name varchar(255) DEFAULT '' NOT NULL, + posts int(11) unsigned DEFAULT '0' NOT NULL, - KEY uid_local (uid_local), - KEY uid_foreign (uid_foreign) + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l18n_parent int(11) DEFAULT '0' NOT NULL, + l18n_diffsource mediumblob NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), ); # # Table structure for table 'tx_blogexample_post_tag_mm' # CREATE TABLE tx_blogexample_post_tag_mm ( - uid_local int(11) unsigned DEFAULT '0' NOT NULL, - uid_foreign int(11) unsigned DEFAULT '0' NOT NULL, - sorting int(11) unsigned DEFAULT '0' NOT NULL, - sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL, + uid_local int(10) unsigned DEFAULT '0' NOT NULL, + uid_foreign int(10) unsigned DEFAULT '0' NOT NULL, + sorting int(10) unsigned DEFAULT '0' NOT NULL, + sorting_foreign int(10) unsigned DEFAULT '0' NOT NULL, KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) @@ -102,12 +177,3 @@ CREATE TABLE tx_blogexample_post_post_mm ( KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); - -# -# Table structure for table 'tx_blogexample_domain_model_info' -# -CREATE TABLE tx_blogexample_domain_model_info ( - name varchar(255) DEFAULT '' NOT NULL, - post int(11) DEFAULT '0' NOT NULL -); - diff --git a/ext_typoscript_setup.typoscript b/ext_typoscript_setup.typoscript deleted file mode 100644 index 4975566..0000000 --- a/ext_typoscript_setup.typoscript +++ /dev/null @@ -1,29 +0,0 @@ - # global configuration - -config.tx_extbase { - persistence{ - classes { - Extbase\Domain\ModelFrontendUser { - subclasses { - FriendsOfTYPO3\BlogExample\Domain\Model\Administrator = FriendsOfTYPO3\BlogExample\Domain\Model\Administrator - } - } - FriendsOfTYPO3\BlogExample\Domain\Model\Administrator { - mapping { - tableName = fe_users - recordType = FriendsOfTYPO3\BlogExample\Domain\Model\Administrator - } - } - FriendsOfTYPO3\BlogExample\Domain\Model\TtContent { - mapping { - tableName = tt_content - columns { - uid.mapOnProperty = uid - pid.mapOnProperty = pid - header.mapOnProperty = header - } - } - } - } - } -}