[FEATURE] Rebuild sys_note to match extbase scheme 09/16909/9
authorKai Vogel <kai.vogel@speedprogs.de>
Fri, 30 Nov 2012 22:35:12 +0000 (23:35 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 1 Feb 2013 11:00:51 +0000 (12:00 +0100)
This patch extends the sys_note extension and adds a controller and
model. Additionally it rewrites the repository to use the extbase
persistance layer. And it provides the possibility to modify the view
configuration via TypoScript.

Resolves: #43495
Releases: 6.1

Change-Id: I372e9fe0761875cd8967e920417d89cd5ad379b9
Reviewed-on: https://review.typo3.org/16909
Reviewed-by: Kai Vogel
Tested-by: Kai Vogel
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
21 files changed:
typo3/sysext/sys_note/Classes/Controller/NoteController.php [new file with mode: 0644]
typo3/sysext/sys_note/Classes/Core/Bootstrap.php [new file with mode: 0644]
typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php [new file with mode: 0644]
typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php
typo3/sysext/sys_note/Classes/Hook/InfoModuleHook.php
typo3/sysext/sys_note/Classes/Hook/PageHook.php
typo3/sysext/sys_note/Classes/Hook/RecordListHook.php
typo3/sysext/sys_note/Classes/SysNoteRenderer.php [deleted file]
typo3/sysext/sys_note/Classes/ViewHelpers/EditLinkViewHelper.php
typo3/sysext/sys_note/Configuration/TCA/SysNote.php [new file with mode: 0644]
typo3/sysext/sys_note/Configuration/Tca/SysNote.php [deleted file]
typo3/sysext/sys_note/Configuration/TypoScript/constants.txt [new file with mode: 0644]
typo3/sysext/sys_note/Configuration/TypoScript/setup.txt [new file with mode: 0644]
typo3/sysext/sys_note/Resources/Private/Language/locallang.xlf
typo3/sysext/sys_note/Resources/Private/Layouts/Default.html [new file with mode: 0644]
typo3/sysext/sys_note/Resources/Private/Template/List.html [deleted file]
typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html [new file with mode: 0644]
typo3/sysext/sys_note/ext_localconf.php
typo3/sysext/sys_note/ext_tables.php
typo3/sysext/sys_note/ext_typoscript_constants.txt [new file with mode: 0644]
typo3/sysext/sys_note/ext_typoscript_setup.txt [new file with mode: 0644]

diff --git a/typo3/sysext/sys_note/Classes/Controller/NoteController.php b/typo3/sysext/sys_note/Classes/Controller/NoteController.php
new file mode 100644 (file)
index 0000000..4c5fffa
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+namespace TYPO3\CMS\SysNote\Controller;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
+ *
+ *  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 3 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!
+ ***************************************************************/
+
+/**
+ * Note controller
+ *
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
+ */
+class NoteController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
+
+       /**
+        * @var \TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository
+        * @inject
+        */
+       protected $sysNoteRepository;
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Domain\Repository\BackendUserRepository
+        * @inject
+        */
+       protected $backendUserRepository;
+
+       /**
+        * Render notes by single PID or PID list
+        *
+        * @param mixed $pids Single PID or comma separated list of PIDs
+        * @return string
+        * @dontvalidate $pids
+        */
+       public function listAction($pids) {
+               if (empty($pids) || empty($GLOBALS['BE_USER']->user['uid'])) {
+                       return '';
+               }
+               $author = $this->backendUserRepository->findByUid($GLOBALS['BE_USER']->user['uid']);
+               $notes = $this->sysNoteRepository->findByPidsAndAuthor($pids, $author);
+               $this->view->assign('notes', $notes);
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Classes/Core/Bootstrap.php b/typo3/sysext/sys_note/Classes/Core/Bootstrap.php
new file mode 100644 (file)
index 0000000..9445837
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+namespace TYPO3\CMS\SysNote\Core;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
+ *
+ *  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 3 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!
+ ***************************************************************/
+
+/**
+ * Bootstrap for note module
+ *
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
+ */
+class Bootstrap {
+
+       /**
+        * Do not touch if you are not sure what you are doing!
+        * @var array
+        */
+       protected $extbaseConfiguration = array(
+               'vendorName' => 'TYPO3\CMS',
+               'extensionName' => 'SysNote',
+               'pluginName' => 'Note',
+       );
+
+       /**
+        * @var array
+        */
+       protected $currentGetArguments;
+
+       /**
+        * Bootstrap extbase and execute controller
+        *
+        * @param string $controllerName Controller to execute
+        * @param string $actionName Action to run
+        * @param array $arguments Arguments to pass to the controller action
+        * @return string
+        */
+       public function run($controllerName, $actionName, array $arguments = array()) {
+               $arguments['controller'] = ucfirst(trim($controllerName));
+               $arguments['action'] = lcfirst(trim($actionName));
+               $this->overrideGetArguments($arguments);
+               /** @var $extbaseBootstrap \TYPO3\CMS\Extbase\Core\Bootstrap */
+               $extbaseBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
+               $content = $extbaseBootstrap->run('', $this->extbaseConfiguration);
+               $this->revertGetArguments();
+               return $content;
+       }
+
+       /**
+        * Modify $_GET to force specific controller, action and arguments in
+        * extbase bootstrap process
+        *
+        * Note: Overwriting $_GET was the most simple solution here until extbase
+        * provides a clean way to force a controller and action in backend mode.
+        *
+        * @param array $arguments The arguments to set
+        * @return void
+        */
+       protected function overrideGetArguments(array $arguments) {
+               $this->currentGetArguments = $_GET;
+               $_GET['tx_sysnote_note'] = $arguments;
+       }
+
+       /**
+        * Revert previously backuped get arguments
+        *
+        * @return void
+        */
+       protected function revertGetArguments() {
+               if (is_array($this->currentGetArguments)) {
+                       $_GET = $this->currentGetArguments;
+               }
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php b/typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php
new file mode 100644 (file)
index 0000000..12b5e84
--- /dev/null
@@ -0,0 +1,176 @@
+<?php
+namespace TYPO3\CMS\SysNote\Domain\Model;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
+ *
+ *  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 3 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!
+ ***************************************************************/
+
+/**
+ * SysNote model
+ *
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
+ */
+class SysNote extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
+
+       /**
+        * @var \DateTime
+        */
+       protected $creationDate;
+
+       /**
+        * @var \DateTime
+        */
+       protected $modificationDate;
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Domain\Model\BackendUser
+        */
+       protected $author;
+
+       /**
+        * @var string
+        */
+       protected $subject;
+
+       /**
+        * @var string
+        */
+       protected $message;
+
+       /**
+        * @var boolean
+        */
+       protected $personal;
+
+       /**
+        * @var integer
+        */
+       protected $category;
+
+       /**
+        * @return \DateTime $creationDate
+        */
+       public function getCreationDate() {
+               return $this->creationDate;
+       }
+
+       /**
+        * @param \DateTime $creationDate
+        * @return void
+        */
+       public function setCreationDate($creationDate) {
+               $this->creationDate = $creationDate;
+       }
+
+       /**
+        * @return \DateTime $modificationDate
+        */
+       public function getModificationDate() {
+               return $this->modificationDate;
+       }
+
+       /**
+        * @param \DateTime $modificationDate
+        * @return void
+        */
+       public function setModificationDate($modificationDate) {
+               $this->modificationDate = $modificationDate;
+       }
+
+       /**
+        * @return \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author
+        */
+       public function getAuthor() {
+               return $this->author;
+       }
+
+       /**
+        * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author
+        * @return void
+        */
+       public function setAuthor(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $author) {
+               $this->author = $author;
+       }
+
+       /**
+        * @return string $subject
+        */
+       public function getSubject() {
+               return $this->subject;
+       }
+
+       /**
+        * @param string $subject
+        * @return void
+        */
+       public function setSubject($subject) {
+               $this->subject = $subject;
+       }
+
+       /**
+        * @return string $message
+        */
+       public function getMessage() {
+               return $this->message;
+       }
+
+       /**
+        * @param string $message
+        * @return void
+        */
+       public function setMessage($message) {
+               $this->message = $message;
+       }
+
+       /**
+        * @return boolean $personal
+        */
+       public function getPersonal() {
+               return $this->personal;
+       }
+
+       /**
+        * @param boolean $personal
+        * @return void
+        */
+       public function setPersonal($personal) {
+               $this->personal = $personal;
+       }
+
+       /**
+        * @return integer $category
+        */
+       public function getCategory() {
+               return $this->category;
+       }
+
+       /**
+        * @param integer $category
+        * @return void
+        */
+       public function setCategory($category) {
+               $this->category = $category;
+       }
+
+}
+?>
\ No newline at end of file
index 9dfd8e3..22ec86f 100644 (file)
@@ -23,35 +23,51 @@ namespace TYPO3\CMS\SysNote\Domain\Repository;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Sys_note repository
  *
  * @author Georg Ringer <typo3@ringerge.org>
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
  */
-class SysNoteRepository {
+class SysNoteRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
 
        /**
-        * Find all sys_notes by a given pidlist
+        * Initialize the repository
         *
-        * @param string $pidlist comma separated list of pids
-        * @return array records
+        * @return void
         */
-       public function findAllByPidList($pidlist) {
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_note', 'pid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($pidlist) . ')
-                                       AND (personal=0 OR cruser=' . intval($GLOBALS['BE_USER']->user['uid']) . ')' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_note'), '', 'sorting');
-               // exec_SELECTgetRows can return NULL if the query failed. This is
-               // transformed here to an empty array instead.
-               if ($records === NULL) {
-                       $records = array();
-               }
-               foreach ($records as $key => $record) {
-                       $records[$key]['tstamp'] = new \DateTime('@' . $record['tstamp']);
-                       $records[$key]['author'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $record['cruser']);
-               }
-               return $records;
+       public function initializeObject() {
+               $querySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
+               $querySettings->setRespectStoragePage(FALSE);
+               $this->setDefaultQuerySettings($querySettings);
        }
 
-}
-
+       /**
+        * Find notes by given pids and author
+        *
+        * @param mixed $pids Single PID or comma separated list of PIDs
+        * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author The author
+        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
+        */
+       public function findByPidsAndAuthor($pids, \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author) {
+               $pids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', (string) $pids);
+               $query = $this->createQuery();
+               $query->setOrderings(array(
+                       'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
+                       'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
+               ));
+               $query->matching(
+                       $query->logicalAnd(
+                               $query->in('pid', $pids),
+                               $query->logicalOr(
+                                       $query->equals('personal', 0),
+                                       $query->equals('author', $author)
+                               )
+                       )
+               );
+               return $query->execute();
+       }
 
+}
 ?>
\ No newline at end of file
index 1af9d5a..a620fa1 100644 (file)
@@ -23,24 +23,26 @@ namespace TYPO3\CMS\SysNote\Hook;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Hook for the info module
  *
  * @author Georg Ringer <typo3@ringerge.org>
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
  */
 class InfoModuleHook {
 
        /**
-        * Add sys_notes as additional content to the footer of the page module
+        * Add sys_notes as additional content to the footer of the info module
         *
         * @param array $params
-        * @param \TYPO3\CMS\Backend\Controller\PageLayoutController $parentObject
+        * @param \TYPO3\CMS\Frontend\Controller\PageInformationController $parentObject
         * @return string
         */
        public function render(array $params = array(), \TYPO3\CMS\Frontend\Controller\PageInformationController $parentObject) {
-               $sysNote = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\SysNoteRenderer');
-               $content = $sysNote->renderByPid($parentObject->pObj->id);
-               return $content;
+               /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
+               $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\Core\\Bootstrap');
+               return $noteBootstrap->run('Note', 'list', array('pids' => $parentObject->pObj->id));
        }
 
 }
index f4c2a7d..819a548 100644 (file)
@@ -23,10 +23,12 @@ namespace TYPO3\CMS\SysNote\Hook;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Hook for the page module
  *
  * @author Georg Ringer <typo3@ringerge.org>
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
  */
 class PageHook {
 
@@ -38,9 +40,9 @@ class PageHook {
         * @return string
         */
        public function render(array $params = array(), \TYPO3\CMS\Backend\Controller\PageLayoutController $parentObject) {
-               $sysNote = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\SysNoteRenderer');
-               $content = $sysNote->renderByPid($parentObject->id);
-               return $content;
+               /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
+               $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\Core\\Bootstrap');
+               return $noteBootstrap->run('Note', 'list', array('pids' => $parentObject->id));
        }
 
 }
index 5eba603..3d1e9f4 100644 (file)
@@ -23,10 +23,12 @@ namespace TYPO3\CMS\SysNote\Hook;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Hook for the list module
  *
  * @author Georg Ringer <typo3@ringerge.org>
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
  */
 class RecordListHook {
 
@@ -38,9 +40,9 @@ class RecordListHook {
         * @return string
         */
        public function render(array $params = array(), \TYPO3\CMS\Recordlist\RecordList $parentObject) {
-               $renderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\SysNoteRenderer');
-               $sysNotes = $renderer->renderByPid($parentObject->id);
-               return $sysNotes;
+               /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
+               $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\Core\\Bootstrap');
+               return $noteBootstrap->run('Note', 'list', array('pids' => $parentObject->id));
        }
 
 }
diff --git a/typo3/sysext/sys_note/Classes/SysNoteRenderer.php b/typo3/sysext/sys_note/Classes/SysNoteRenderer.php
deleted file mode 100644 (file)
index ff2c9b5..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-namespace TYPO3\CMS\SysNote;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Georg Ringer <typo3@ringerge.org>
- *  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!
- ***************************************************************/
-/**
- * Render sys_notes
- *
- * @author Georg Ringer <typo3@ringerge.org>
- */
-class SysNoteRenderer {
-
-       /**
-        * Render sys_notes by pid
-        *
-        * @param string $pidList comma separated list of page ids
-        * @return string
-        */
-       public function renderByPid($pidList) {
-               /** @var $repository \TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository */
-               $repository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\Domain\\Repository\\SysNoteRepository');
-               $notes = $repository->findAllByPidList($pidList);
-               $out = '';
-               if ($this->notesAvailable($notes)) {
-                       /** @var $fluidView \TYPO3\CMS\Fluid\View\StandaloneView */
-                       $fluidView = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
-                       $templatePathAndFilename = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sys_note', 'Resources/Private/Template/List.html');
-                       $fluidView->setTemplatePathAndFilename($templatePathAndFilename);
-                       $fluidView->assign('notes', $notes);
-                       $out = $fluidView->render();
-               }
-               return $out;
-       }
-
-       /**
-        * Check if notes are available
-        *
-        * @param array $notes All notes returned from repository
-        * @return boolean TRUE if there are one or more notes
-        */
-       protected function notesAvailable(array $notes) {
-               $notesAvailable = FALSE;
-               if (count($notes) > 0) {
-                       $notesAvailable = TRUE;
-               }
-               return $notesAvailable;
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 70bda1b..ffec3e2 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\SysNote\ViewHelpers;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * ViewHelper to create a link to edit a note
  *
diff --git a/typo3/sysext/sys_note/Configuration/TCA/SysNote.php b/typo3/sysext/sys_note/Configuration/TCA/SysNote.php
new file mode 100644 (file)
index 0000000..e645a7c
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+if (!defined('TYPO3_MODE')) {
+       die('Access denied.');
+}
+$TCA['sys_note'] = array(
+       'ctrl' => $TCA['sys_note']['ctrl'],
+       'interface' => array(
+               'showRecordFieldList' => 'category,subject,message,personal'
+       ),
+       'columns' => array(
+               'category' => array(
+                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.category',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array('', '0'),
+                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.1', '1', 'sysext/t3skin/icons/ext/sys_note/icon-instruction.png'),
+                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.3', '3', 'sysext/t3skin/icons/ext/sys_note/icon-note.png'),
+                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.4', '4', 'sysext/t3skin/icons/ext/sys_note/icon-todo.png'),
+                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.2', '2', 'sysext/t3skin/icons/ext/sys_note/icon-template.png')
+                               ),
+                               'default' => '0'
+                       )
+               ),
+               'subject' => array(
+                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.subject',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '40',
+                               'max' => '256'
+                       )
+               ),
+               'message' => array(
+                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.message',
+                       'config' => array(
+                               'type' => 'text',
+                               'cols' => '40',
+                               'rows' => '15'
+                       )
+               ),
+               'personal' => array(
+                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.personal',
+                       'config' => array(
+                               'type' => 'check'
+                       )
+               )
+       ),
+       'types' => array(
+               '0' => array('showitem' => 'category;;;;2-2-2, personal, subject;;;;3-3-3, message')
+       )
+);
+?>
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Configuration/Tca/SysNote.php b/typo3/sysext/sys_note/Configuration/Tca/SysNote.php
deleted file mode 100644 (file)
index e645a7c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-if (!defined('TYPO3_MODE')) {
-       die('Access denied.');
-}
-$TCA['sys_note'] = array(
-       'ctrl' => $TCA['sys_note']['ctrl'],
-       'interface' => array(
-               'showRecordFieldList' => 'category,subject,message,personal'
-       ),
-       'columns' => array(
-               'category' => array(
-                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.category',
-                       'config' => array(
-                               'type' => 'select',
-                               'items' => array(
-                                       array('', '0'),
-                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.1', '1', 'sysext/t3skin/icons/ext/sys_note/icon-instruction.png'),
-                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.3', '3', 'sysext/t3skin/icons/ext/sys_note/icon-note.png'),
-                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.4', '4', 'sysext/t3skin/icons/ext/sys_note/icon-todo.png'),
-                                       array('LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.2', '2', 'sysext/t3skin/icons/ext/sys_note/icon-template.png')
-                               ),
-                               'default' => '0'
-                       )
-               ),
-               'subject' => array(
-                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.subject',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '40',
-                               'max' => '256'
-                       )
-               ),
-               'message' => array(
-                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.message',
-                       'config' => array(
-                               'type' => 'text',
-                               'cols' => '40',
-                               'rows' => '15'
-                       )
-               ),
-               'personal' => array(
-                       'label' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.personal',
-                       'config' => array(
-                               'type' => 'check'
-                       )
-               )
-       ),
-       'types' => array(
-               '0' => array('showitem' => 'category;;;;2-2-2, personal, subject;;;;3-3-3, message')
-       )
-);
-?>
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Configuration/TypoScript/constants.txt b/typo3/sysext/sys_note/Configuration/TypoScript/constants.txt
new file mode 100644 (file)
index 0000000..a47c78c
--- /dev/null
@@ -0,0 +1,15 @@
+# ======================================================================
+# Module constants
+# ======================================================================
+module.tx_sysnote {
+       view {
+               # cat=Internal Notes/general/1000; type=string; label=Layout Root Path: Path to layouts
+               layoutRootPath = EXT:sys_note/Resources/Private/Layouts/
+
+               # cat=Internal Notes/general/1010; type=string; label=Partial Root Path: Path to partials
+               partialRootPath = EXT:sys_note/Resources/Private/Partials/
+
+               # cat=Internal Notes/general/1020; type=string; label=Template Root Path: Path to templates
+               templateRootPath = EXT:sys_note/Resources/Private/Templates/
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Configuration/TypoScript/setup.txt b/typo3/sysext/sys_note/Configuration/TypoScript/setup.txt
new file mode 100644 (file)
index 0000000..33ec34e
--- /dev/null
@@ -0,0 +1,28 @@
+# ======================================================================
+# Module setup
+# ======================================================================
+module.tx_sysnote {
+       view {
+               layoutRootPath = {$module.tx_sysnote.view.layoutRootPath}
+               templateRootPath = {$module.tx_sysnote.view.templateRootPath}
+               partialRootPath = {$module.tx_sysnote.view.partialRootPath}
+       }
+}
+
+
+# ======================================================================
+# Extbase mapping
+# ======================================================================
+config.tx_extbase.persistence.classes {
+
+       TYPO3\CMS\SysNote\Domain\Model\SysNote.mapping {
+               tableName = sys_note
+               recordType =
+               columns {
+                       crdate.mapOnProperty = creationDate
+                       tstamp.mapOnProperty = modificationDate
+                       cruser.mapOnProperty = author
+               }
+       }
+
+}
\ No newline at end of file
index 08ae4c6..1d96f7a 100644 (file)
@@ -3,8 +3,29 @@
        <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:37Z" product-name="sys_note">
                <header/>
                <body>
+                       <trans-unit id="author" xml:space="preserve">
+                               <source>Author:</source>
+                       </trans-unit>
                        <trans-unit id="date" xml:space="preserve">
-                               <source>Date</source>
+                               <source>Date:</source>
+                       </trans-unit>
+                       <trans-unit id="personal" xml:space="preserve">
+                               <source>Personal:</source>
+                       </trans-unit>
+                       <trans-unit id="category.1" xml:space="preserve">
+                               <source>Instructions</source>
+                       </trans-unit>
+                       <trans-unit id="category.2" xml:space="preserve">
+                               <source>Template</source>
+                       </trans-unit>
+                       <trans-unit id="category.3" xml:space="preserve">
+                               <source>Notes</source>
+                       </trans-unit>
+                       <trans-unit id="category.4" xml:space="preserve">
+                               <source>To-do</source>
+                       </trans-unit>
+                       <trans-unit id="yes" xml:space="preserve">
+                               <source>Yes</source>
                        </trans-unit>
                </body>
        </file>
diff --git a/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html b/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html
new file mode 100644 (file)
index 0000000..036bdf0
--- /dev/null
@@ -0,0 +1 @@
+<f:render section="Content" />
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Resources/Private/Template/List.html b/typo3/sysext/sys_note/Resources/Private/Template/List.html
deleted file mode 100644 (file)
index 53eaf9b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-{namespace notes=TYPO3\CMS\SysNote\ViewHelpers}
-
-<div id="typo3-dblist-sysnotes" xmlns:f="http://www.w3.org/1999/html">
-       <f:for each="{notes}" as="note">
-               <div class="single-note category-{note.category}">
-                       <div class="header">
-                               <span><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.author" /></span>
-                               <f:if condition="{note.author.realName}">
-                                       <f:then>{note.author.realName}</f:then>
-                                       <f:else>{note.author.username}</f:else>
-                               </f:if>
-                               &middot;
-
-                               <span><f:translate key="LLL:EXT:sys_note/Resources/Private/Language/locallang.xlf:date" />:</span>
-                               <f:format.date>{note.tstamp}</f:format.date>
-
-                               <f:if condition="{note.personal}">
-                                       &middot;
-                                       <span><f:translate key="LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.personal" /></span>
-                               </f:if>
-
-                               <div class="right">
-                                       <f:be.buttons.icon uri="{notes:editLink(id:note.uid)}" icon="actions-document-open" />
-                               </div>
-                       </div>
-                       <div class="content">
-                               <div class="title">
-                                       <f:if condition="{note.category}"><f:translate key="LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note.category.I.{note.category}" />:</f:if>
-                                       {note.subject}</div>
-                               <f:format.nl2br>{note.message}</f:format.nl2br>
-                       </div>
-               </div>
-       </f:for>
-</div>
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html b/typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html
new file mode 100644 (file)
index 0000000..aebe0a7
--- /dev/null
@@ -0,0 +1,43 @@
+{namespace notes=TYPO3\CMS\SysNote\ViewHelpers}
+
+<f:layout name="Default" />
+
+<f:section name="Content">
+       <f:if condition="{notes}">
+
+               <div id="typo3-dblist-sysnotes">
+                       <f:for each="{notes}" as="note">
+                               <div class="single-note category-{note.category}">
+                                       <div class="header">
+                                               <span><f:translate key="author" /></span>
+                                               <f:if condition="{note.author.realName}">
+                                                       <f:then>{note.author.realName}</f:then>
+                                                       <f:else>{note.author.userName}</f:else>
+                                               </f:if>
+                                               &middot;
+
+                                               <span><f:translate key="date" /></span>
+                                               <f:format.date>{note.modificationDate}</f:format.date>
+
+                                               <f:if condition="{note.personal}">
+                                                       &middot;
+                                                       <span><f:translate key="personal" /></span>&nbsp;<f:translate key="yes" />
+                                               </f:if>
+
+                                               <div class="right">
+                                                       <f:be.buttons.icon uri="{notes:editLink(id:note.uid)}" icon="actions-document-open" />
+                                               </div>
+                                       </div>
+                                       <div class="content">
+                                               <div class="title">
+                                                       <f:if condition="{note.category}"><f:translate key="category.{note.category}" />:</f:if>
+                                                       {note.subject}
+                                               </div>
+                                               <f:format.nl2br>{note.message}</f:format.nl2br>
+                                       </div>
+                               </div>
+                       </f:for>
+               </div>
+
+       </f:if>
+</f:section>
\ No newline at end of file
index 5fa5c9a..dbde450 100644 (file)
@@ -2,6 +2,14 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
+
+// Register "switchableControllerActions" manually because it exists no plugin or module for sys_note
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['SysNote']['modules']['Note']['controllers'] = array(
+       'Note' => array(
+               'actions' => array('list')
+       )
+);
+
 // Hook into the list module
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hook/RecordListHook.php:TYPO3\\CMS\\SysNote\\Hook\\RecordListHook->render';
 // Hook into the page module
index 3f665f0..53dacd5 100755 (executable)
@@ -2,7 +2,7 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
-$TCA['sys_note'] = array(
+$GLOBALS['TCA']['sys_note'] = array(
        'ctrl' => array(
                'label' => 'subject',
                'default_sortby' => 'ORDER BY crdate',
@@ -14,8 +14,8 @@ $TCA['sys_note'] = array(
                'title' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note',
                'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'ext_icon.gif',
                'sortby' => 'sorting',
-               'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/Tca/SysNote.php'
-       )
+               'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/SysNote.php',
+       ),
 );
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('sys_note');
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('sys_note', 'EXT:sys_note/Resources/Private/Language/locallang_csh_sysnote.xlf');
diff --git a/typo3/sysext/sys_note/ext_typoscript_constants.txt b/typo3/sysext/sys_note/ext_typoscript_constants.txt
new file mode 100644 (file)
index 0000000..8c04e05
--- /dev/null
@@ -0,0 +1 @@
+<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sys_note/Configuration/TypoScript/constants.txt">
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/ext_typoscript_setup.txt b/typo3/sysext/sys_note/ext_typoscript_setup.txt
new file mode 100644 (file)
index 0000000..d7d7929
--- /dev/null
@@ -0,0 +1 @@
+<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sys_note/Configuration/TypoScript/setup.txt">
\ No newline at end of file