[BUGFIX] Fix ajax scripts in recycler
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 25 Aug 2012 11:35:43 +0000 (13:35 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Aug 2012 13:44:07 +0000 (15:44 +0200)
Fix ajax scripts in recycler

Change-Id: Idda6fbde50f300365b6659a8cb8efe6438b2de4b
Resolves: #40175
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14070
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
23 files changed:
typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Controller/class.tx_recycler_controller_ajax.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Domain/Model/Tables.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/helper/class.tx_recycler_helper.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/model/class.tx_recycler_model_deletedRecords.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/model/class.tx_recycler_model_tables.php [new file with mode: 0644]
typo3/sysext/recycler/Classes/view/class.tx_recycler_view_deletedRecords.php [new file with mode: 0644]
typo3/sysext/recycler/classes/Domain/Model/DeletedRecords.php [deleted file]
typo3/sysext/recycler/classes/Domain/Model/Tables.php [deleted file]
typo3/sysext/recycler/classes/Utility/RecyclerUtility.php [deleted file]
typo3/sysext/recycler/classes/controller/DeletedRecordsController.php [deleted file]
typo3/sysext/recycler/classes/controller/RecyclerAjaxController.php [deleted file]
typo3/sysext/recycler/classes/controller/RecyclerModuleController.php [deleted file]
typo3/sysext/recycler/classes/controller/class.tx_recycler_controller_ajax.php [deleted file]
typo3/sysext/recycler/classes/helper/class.tx_recycler_helper.php [deleted file]
typo3/sysext/recycler/classes/model/class.tx_recycler_model_deletedRecords.php [deleted file]
typo3/sysext/recycler/classes/model/class.tx_recycler_model_tables.php [deleted file]
typo3/sysext/recycler/classes/view/class.tx_recycler_view_deletedRecords.php [deleted file]
typo3/sysext/recycler/ext_localconf.php

diff --git a/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php b/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
new file mode 100644 (file)
index 0000000..9b4ef4f
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+namespace TYPO3\CMS\Recycler\Controller;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+
+/**
+ * Deleted Records View
+ *
+ * @author Erik Frister <erik_frister@otq-solutions.com>
+ * @author Julian Kleinhans <typo3@kj187.de>
+ * @package TYPO3
+ * @subpackage tx_recycler
+ */
+class DeletedRecordsController {
+
+       /**
+        * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
+        *
+        * @param array     $rows   Array with table as key and array with all deleted rows
+        * @param integer       $totalDeleted: Number of deleted records in total, for PagingToolbar
+        * @return string   JSON Array
+        */
+       public function transform($deletedRowsArray, $totalDeleted) {
+               $total = 0;
+               $jsonArray = array(
+                       'rows' => array()
+               );
+               // iterate
+               if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
+                       foreach ($deletedRowsArray as $table => $rows) {
+                               $total += count($deletedRowsArray[$table]);
+                               foreach ($rows as $row) {
+                                       $backendUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
+                                       $jsonArray['rows'][] = array(
+                                               'uid' => $row['uid'],
+                                               'pid' => $row['pid'],
+                                               'table' => $table,
+                                               'crdate' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]),
+                                               'tstamp' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]),
+                                               'owner' => htmlspecialchars($backendUser['username']),
+                                               'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']],
+                                               'tableTitle' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
+                                               'title' => htmlspecialchars(\TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row))),
+                                               'path' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getRecordPath($row['pid'])
+                                       );
+                               }
+                       }
+               }
+               $jsonArray['total'] = $totalDeleted;
+               return json_encode($jsonArray);
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php b/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php
new file mode 100644 (file)
index 0000000..9e1b585
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+namespace TYPO3\CMS\Recycler\Controller;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+
+/**
+ * Controller class for the 'recycler' extension. Handles the AJAX Requests
+ *
+ * @author             Julian Kleinhans <typo3@kj187.de>
+ * @author     Erik Frister <erik_frister@otq-solutions.com>
+ * @package            TYPO3
+ * @subpackage         tx_recycler
+ */
+class RecyclerAjaxController {
+
+       /**
+        * Stores the content for the ajax output
+        *
+        * @var         string
+        */
+       protected $content;
+
+       /**
+        * Command to be processed
+        *
+        * @var         string
+        */
+       protected $command;
+
+       /**
+        * Stores relevant data from extJS
+        * Example: Json format
+        * [ ["pages",1],["pages",2],["tt_content",34] ]
+        *
+        * @var         string
+        */
+       protected $data;
+
+       /**
+        * Initialize method
+        *
+        * @return void
+        */
+       public function init() {
+               $this->mapCommand();
+               $this->getContent();
+       }
+
+       /**
+        * Maps the command to the correct Model and View
+        *
+        * @return void
+        */
+       public function mapCommand() {
+               $this->command = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd');
+               $this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('data');
+               // check params
+               if (!is_string($this->command)) {
+                       // @TODO make devlog output
+                       return FALSE;
+               }
+               // Create content
+               $this->createContent();
+       }
+
+       /**
+        * Creates the content
+        *
+        * @return void
+        */
+       protected function createContent() {
+               $str = '';
+               switch ($this->command) {
+               case 'getDeletedRecords':
+                       $table = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table') : \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tableDefault');
+                       $limit = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('limit') ? (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('limit') : (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pagingSizeDefault');
+                       $start = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('start') ? (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('start') : 0;
+                       $filter = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filterTxt') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filterTxt') : '';
+                       $startUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') : '';
+                       $depth = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') : '';
+                       $this->setDataInSession('tableSelection', $table);
+                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
+                       $model->loadData($startUid, $table, $depth, ($start . ',') . $limit, $filter);
+                       $deletedRowsArray = $model->getDeletedRows();
+                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
+                       $totalDeleted = $model->getTotalCount($startUid, $table, $depth, $filter);
+                       // load view
+                       $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Controller\\DeletedRecordsController');
+                       $str = $view->transform($deletedRowsArray, $totalDeleted);
+                       break;
+               case 'doDelete':
+                       $str = FALSE;
+                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
+                       if ($model->deleteData($this->data)) {
+                               $str = TRUE;
+                       }
+                       break;
+               case 'doUndelete':
+                       $str = FALSE;
+                       $recursive = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('recursive');
+                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
+                       if ($model->undeleteData($this->data, $recursive)) {
+                               $str = TRUE;
+                       }
+                       break;
+               case 'getTables':
+                       $depth = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') : 0;
+                       $startUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') : '';
+                       $this->setDataInSession('depthSelection', $depth);
+                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\Tables');
+                       $str = $model->getTables('json', 1, $startUid, $depth);
+                       break;
+               default:
+                       $str = 'No command was recognized.';
+                       break;
+               }
+               $this->content = $str;
+       }
+
+       /**
+        * Returns the content that was created in the mapCommand method
+        *
+        * @return string
+        */
+       public function getContent() {
+               echo $this->content;
+       }
+
+       /**
+        * Sets data in the session of the current backend user.
+        *
+        * @param       string          $identifier: The identifier to be used to set the data
+        * @param       string          $data: The data to be stored in the session
+        * @return      void
+        */
+       protected function setDataInSession($identifier, $data) {
+               $GLOBALS['BE_USER']->uc['tx_recycler'][$identifier] = $data;
+               $GLOBALS['BE_USER']->writeUC();
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php b/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php
new file mode 100644 (file)
index 0000000..3bb7dd3
--- /dev/null
@@ -0,0 +1,294 @@
+<?php
+namespace TYPO3\CMS\Recycler\Controller;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+
+// This checks permissions and exits if the users has no permission for entry.
+/**
+ * Module 'Recycler' for the 'recycler' extension.
+ *
+ * @author     Julian Kleinhans <typo3@kj187.de>
+ * @package    TYPO3
+ * @subpackage         tx_recycler
+ */
+class RecyclerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
+
+       /**
+        * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       public $doc;
+
+       protected $relativePath;
+
+       protected $pageRecord = array();
+
+       protected $isAccessibleForCurrentUser = FALSE;
+
+       protected $allowDelete = FALSE;
+
+       protected $recordsPageLimit = 50;
+
+       /**
+        * @var t3lib_pageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
+        * Initializes the Module
+        *
+        * @return      void
+        */
+       public function initialize() {
+               parent::init();
+               $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
+               $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'mod1/mod_template.html');
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               $this->doc->setExtDirectStateProvider();
+               $this->pageRenderer = $this->doc->getPageRenderer();
+               $this->relativePath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('recycler');
+               $this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
+               $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin();
+               //don't access in workspace
+               if ($GLOBALS['BE_USER']->workspace !== 0) {
+                       $this->isAccessibleForCurrentUser = FALSE;
+               }
+               //read configuration
+               $modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler');
+               if ($this->isCurrentUserAdmin()) {
+                       $this->allowDelete = TRUE;
+               } else {
+                       $this->allowDelete = $modTS['properties']['allowDelete'] == '1';
+               }
+               if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) {
+                       $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']);
+               }
+       }
+
+       /**
+        * Renders the content of the module.
+        *
+        * @return      void
+        */
+       public function render() {
+               $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
+               $this->content .= $this->doc->section('', $GLOBALS['LANG']->getLL('description'));
+               if ($this->isAccessibleForCurrentUser) {
+                       $this->loadHeaderData();
+                       // div container for renderTo
+                       $this->content .= '<div id="recyclerContent"></div>';
+               } else {
+                       // If no access or if ID == zero
+                       $this->content .= $this->doc->spacer(10);
+               }
+       }
+
+       /**
+        * Flushes the rendered content to browser.
+        *
+        * @return      void
+        */
+       public function flush() {
+               $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $this->getTemplateMarkers());
+               // Renders the module page
+               $content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $content);
+               $this->content = NULL;
+               $this->doc = NULL;
+               echo $content;
+       }
+
+       /**
+        * Determines whether the current user is admin.
+        *
+        * @return      boolean         Whether the current user is admin
+        */
+       protected function isCurrentUserAdmin() {
+               return (bool) $GLOBALS['BE_USER']->user['admin'];
+       }
+
+       /**
+        * Loads data in the HTML head section (e.g. JavaScript or stylesheet information).
+        *
+        * @return      void
+        */
+       protected function loadHeaderData() {
+               // Load CSS Stylesheets:
+               $this->pageRenderer->addCssFile($this->relativePath . 'res/css/customExtJs.css');
+               // Load Ext JS:
+               $this->pageRenderer->loadExtJS();
+               $this->pageRenderer->enableExtJSQuickTips();
+               // Integrate dynamic JavaScript such as configuration or lables:
+               $this->pageRenderer->addInlineSettingArray('Recycler', $this->getJavaScriptConfiguration());
+               $this->pageRenderer->addInlineLanguageLabelArray($this->getJavaScriptLabels());
+               // Load Recycler JavaScript:
+               // Load Plugins
+               $uxPath = $this->doc->backpath . '../t3lib/js/extjs/ux/';
+               $this->pageRenderer->addJsFile($uxPath . 'Ext.grid.RowExpander.js');
+               $this->pageRenderer->addJsFile($uxPath . 'Ext.app.SearchField.js');
+               $this->pageRenderer->addJsFile($uxPath . 'Ext.ux.FitToParent.js');
+               // Load main script
+               $this->pageRenderer->addJsFile($this->relativePath . 'res/js/t3_recycler.js');
+       }
+
+       /**
+        * Gets the JavaScript configuration for the Ext JS interface.
+        *
+        * @return      array           The JavaScript configuration
+        */
+       protected function getJavaScriptConfiguration() {
+               $configuration = array(
+                       'pagingSize' => $this->recordsPageLimit,
+                       'showDepthMenu' => 1,
+                       'startUid' => $this->id,
+                       'tableDefault' => 'pages',
+                       'renderTo' => 'recyclerContent',
+                       'isSSL' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL'),
+                       'ajaxController' => $this->doc->backPath . 'ajax.php?ajaxID=RecyclerAjaxController::init',
+                       'deleteDisable' => $this->allowDelete ? 0 : 1,
+                       'depthSelection' => $this->getDataFromSession('depthSelection', 0),
+                       'tableSelection' => $this->getDataFromSession('tableSelection', 'pages'),
+                       'States' => $GLOBALS['BE_USER']->uc['moduleData']['web_recycler']['States']
+               );
+               return $configuration;
+       }
+
+       /**
+        * Gets the labels to be used in JavaScript in the Ext JS interface.
+        *
+        * @return      array           The labels to be used in JavaScript
+        */
+       protected function getJavaScriptLabels() {
+               $coreLabels = array(
+                       'title' => $GLOBALS['LANG']->getLL('title'),
+                       'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path'),
+                       'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table'),
+                       'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xml:Depth'),
+                       'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
+                       'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
+                       'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
+                       'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
+                       'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
+                       'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
+               );
+               $extensionLabels = $this->getJavaScriptLabelsFromLocallang('js.', 'label_');
+               $javaScriptLabels = array_merge($coreLabels, $extensionLabels);
+               return $javaScriptLabels;
+       }
+
+       /**
+        * Gets labels to be used in JavaScript fetched from the current locallang file.
+        *
+        * @param       string          $selectionPrefix: Prefix to select the correct labels (default: 'js.')
+        * @param       string          $stripFromSelectionName: Sub-prefix to be removed from label names in the result (default: '')
+        * @return      array           Lables to be used in JavaScript of the current locallang file
+        * @todo        Check, whether this method can be moved in a generic way to $GLOBALS['LANG']
+        */
+       protected function getJavaScriptLabelsFromLocallang($selectionPrefix = 'js.', $stripFromSelectionName = '') {
+               $extraction = array();
+               $labels = array_merge((array) $GLOBALS['LOCAL_LANG']['default'], (array) $GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang]);
+               // Regular expression to strip the selection prefix and possibly something from the label name:
+               $labelPattern = ((('#^' . preg_quote($selectionPrefix, '#')) . '(') . preg_quote($stripFromSelectionName, '#')) . ')?#';
+               // Iterate through all locallang lables:
+               foreach ($labels as $label => $value) {
+                       if (strpos($label, $selectionPrefix) === 0) {
+                               $key = preg_replace($labelPattern, '', $label);
+                               $extraction[$key] = $value;
+                       }
+               }
+               return $extraction;
+       }
+
+       /**
+        * Gets the buttons that shall be rendered in the docHeader.
+        *
+        * @return      array           Available buttons for the docHeader
+        */
+       protected function getDocHeaderButtons() {
+               $buttons = array(
+                       'csh' => \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']),
+                       'shortcut' => $this->getShortcutButton(),
+                       'save' => ''
+               );
+               // SAVE button
+               $buttons['save'] = '';
+               //<input type="image" class="c-inputButton" name="submit" value="Update"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
+               return $buttons;
+       }
+
+       /**
+        * Gets the button to set a new shortcut in the backend (if current user is allowed to).
+        *
+        * @return      string          HTML representation of the shortcut button
+        */
+       protected function getShortcutButton() {
+               $result = '';
+               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+                       $result = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
+               }
+               return $result;
+       }
+
+       /**
+        * Gets the filled markers that are used in the HTML template.
+        *
+        * @return      array           The filled marker array
+        */
+       protected function getTemplateMarkers() {
+               $markers = array(
+                       'FUNC_MENU' => $this->getFunctionMenu(),
+                       'CONTENT' => $this->content,
+                       'TITLE' => $GLOBALS['LANG']->getLL('title')
+               );
+               return $markers;
+       }
+
+       /**
+        * Gets the function menu selector for this backend module.
+        *
+        * @return      string          The HTML representation of the function menu selector
+        */
+       protected function getFunctionMenu() {
+               return \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
+       }
+
+       /**
+        * Gets data from the session of the current backend user.
+        *
+        * @param       string          $identifier: The identifier to be used to get the data
+        * @param       string          $default: The default date to be used if nothing was found in the session
+        * @return      string          The accordant data in the session of the current backend user
+        */
+       protected function getDataFromSession($identifier, $default = NULL) {
+               $sessionData =& $GLOBALS['BE_USER']->uc['tx_recycler'];
+               if (isset($sessionData[$identifier]) && $sessionData[$identifier]) {
+                       $data = $sessionData[$identifier];
+               } else {
+                       $data = $default;
+               }
+               return $data;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Controller/class.tx_recycler_controller_ajax.php b/typo3/sysext/recycler/Classes/Controller/class.tx_recycler_controller_ajax.php
new file mode 100644 (file)
index 0000000..753ecda
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+// Pre-Include all models and views
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/model/class.tx_recycler_model_deletedRecords.php');
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/model/class.tx_recycler_model_tables.php');
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/view/class.tx_recycler_view_deletedRecords.php');
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/helper/class.tx_recycler_helper.php');
+/*
+ * @deprecated since 6.0, the classname tx_recycler_controller_ajax and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Controller/RecyclerAjaxController.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php b/typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php
new file mode 100644 (file)
index 0000000..8eaab97
--- /dev/null
@@ -0,0 +1,383 @@
+<?php
+namespace TYPO3\CMS\Recycler\Domain\Model;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+
+/**
+ * Model class for the 'recycler' extension.
+ *
+ * @author     Julian Kleinhans <typo3@kj187.de>
+ * @package    TYPO3
+ * @subpackage         tx_recycler
+ */
+class DeletedRecords {
+
+       /**
+        * Array with all deleted rows
+        *
+        * @var         array
+        */
+       protected $deletedRows = array();
+
+       /**
+        * String with the global limit
+        *
+        * @var         string
+        */
+       protected $limit = '';
+
+       /**
+        * Array with all avaiable FE tables
+        *
+        * @var         array
+        */
+       protected $table = array();
+
+       /**
+        * Object from helper class
+        *
+        * @var \TYPO3\CMS\Recycler\Utility\RecyclerUtility
+        */
+       protected $recyclerHelper;
+
+       /**
+        * Array with all label fields drom different tables
+        *
+        * @var         array
+        */
+       public $label;
+
+       /**
+        * Array with all title fields drom different tables
+        *
+        * @var         array
+        */
+       public $title;
+
+       /************************************************************
+        * GET DATA FUNCTIONS
+        *
+        *
+        ************************************************************/
+       /**
+        * Load all deleted rows from $table
+        * If table is not set, it iterates the TCA tables
+        *
+        * @param       integer         $id: UID from selected page
+        * @param       string          $table: Tablename
+        * @param       integer         $depth: How many levels recursive
+        * @param       integer         $limit: MySQL LIMIT
+        * @param       string          $filter: Filter text
+        * @return      recycler_model_delRecords
+        */
+       public function loadData($id, $table, $depth, $limit = '', $filter = '') {
+               // set the limit
+               $this->limit = trim($limit);
+               if ($table) {
+                       if (array_key_exists($table, $GLOBALS['TCA'])) {
+                               $this->table[] = $table;
+                               $this->setData($id, $table, $depth, $GLOBALS['TCA'][$table]['ctrl'], $filter);
+                       }
+               } else {
+                       foreach ($GLOBALS['TCA'] as $tableKey => $tableValue) {
+                               // only go into this table if the limit allows it
+                               if ($this->limit != '') {
+                                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
+                                       // abort loop if LIMIT 0,0
+                                       if ($parts[0] == 0 && $parts[1] == 0) {
+                                               break;
+                                       }
+                               }
+                               $this->table[] = $tableKey;
+                               $this->setData($id, $tableKey, $depth, $tableValue['ctrl'], $filter);
+                       }
+               }
+               return $this;
+       }
+
+       /**
+        * Find the total count of deleted records
+        *
+        * @param       integer         $id: UID from record
+        * @param       string          $table: Tablename from record
+        * @param       integer         $depth: How many levels recursive
+        * @param       string          $filter: Filter text
+        * @return      void
+        */
+       public function getTotalCount($id, $table, $depth, $filter) {
+               $deletedRecords = $this->loadData($id, $table, $depth, '', $filter)->getDeletedRows();
+               $countTotal = 0;
+               foreach ($this->table as $tableName) {
+                       $countTotal += count($deletedRecords[$tableName]);
+               }
+               return $countTotal;
+       }
+
+       /**
+        * Set all deleted rows
+        *
+        * @param       integer         $id: UID from record
+        * @param       string          $table: Tablename from record
+        * @param       integer         $depth: How many levels recursive
+        * @param       array           $ctrl: TCA CTRL Array
+        * @param       string          $filter: Filter text
+        * @return      void
+        */
+       protected function setData($id = 0, $table, $depth, $tcaCtrl, $filter) {
+               $id = intval($id);
+               if (array_key_exists('delete', $tcaCtrl)) {
+                       // find the 'deleted' field for this table
+                       $deletedField = \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getDeletedField($table);
+                       // create the filter WHERE-clause
+                       if (trim($filter) != '') {
+                               $filterWhere = (((((' AND (' . (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($filter) ? ((('uid = ' . $filter) . ' OR pid = ') . $filter) . ' OR ' : '')) . $tcaCtrl['label']) . ' LIKE "%') . $this->escapeValueForLike($filter, $table)) . '%"') . ')';
+                       }
+                       // get the limit
+                       if ($this->limit != '') {
+                               // count the number of deleted records for this pid
+                               $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, (($deletedField . '<>0 AND pid = ') . $id) . $filterWhere);
+                               // split the limit
+                               $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
+                               $offset = $parts[0];
+                               $rowCount = $parts[1];
+                               // subtract the number of deleted records from the limit's offset
+                               $result = $offset - $deletedCount;
+                               // if the result is >= 0
+                               if ($result >= 0) {
+                                       // store the new offset in the limit and go into the next depth
+                                       $offset = $result;
+                                       $this->limit = implode(',', array($offset, $rowCount));
+                                       // do NOT query this depth; limit also does not need to be set, we set it anyways
+                                       $allowQuery = FALSE;
+                                       $allowDepth = TRUE;
+                                       $limit = '';
+                               } else {
+                                       // the offset for the temporary limit has to remain like the original offset
+                                       // in case the original offset was just crossed by the amount of deleted records
+                                       if ($offset != 0) {
+                                               $tempOffset = $offset;
+                                       } else {
+                                               $tempOffset = 0;
+                                       }
+                                       // set the offset in the limit to 0
+                                       $newOffset = 0;
+                                       // convert to negative result to the positive equivalent
+                                       $absResult = abs($result);
+                                       // if the result now is > limit's row count
+                                       if ($absResult > $rowCount) {
+                                               // use the limit's row count as the temporary limit
+                                               $limit = implode(',', array($tempOffset, $rowCount));
+                                               // set the limit's row count to 0
+                                               $this->limit = implode(',', array($newOffset, 0));
+                                               // do not go into new depth
+                                               $allowDepth = FALSE;
+                                       } else {
+                                               // if the result now is <= limit's row count
+                                               // use the result as the temporary limit
+                                               $limit = implode(',', array($tempOffset, $absResult));
+                                               // subtract the result from the row count
+                                               $newCount = $rowCount - $absResult;
+                                               // store the new result in the limit's row count
+                                               $this->limit = implode(',', array($newOffset, $newCount));
+                                               // if the new row count is > 0
+                                               if ($newCount > 0) {
+                                                       // go into new depth
+                                                       $allowDepth = TRUE;
+                                               } else {
+                                                       // if the new row count is <= 0 (only =0 makes sense though)
+                                                       // do not go into new depth
+                                                       $allowDepth = FALSE;
+                                               }
+                                       }
+                                       // allow query for this depth
+                                       $allowQuery = TRUE;
+                               }
+                       } else {
+                               $limit = '';
+                               $allowDepth = TRUE;
+                               $allowQuery = TRUE;
+                       }
+                       // query for actual deleted records
+                       if ($allowQuery) {
+                               $recordsToCheck = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField($table, $deletedField, '1', (' AND pid = ' . $id) . $filterWhere, '', '', $limit, FALSE);
+                               if ($recordsToCheck) {
+                                       $this->checkRecordAccess($table, $recordsToCheck);
+                               }
+                       }
+                       // go into depth
+                       if ($allowDepth && $depth >= 1) {
+                               // check recursively for elements beneath this page
+                               $resPages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . $id, '', 'sorting');
+                               if (is_resource($resPages)) {
+                                       while ($rowPages = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resPages)) {
+                                               $this->setData($rowPages['uid'], $table, $depth - 1, $tcaCtrl, $filter);
+                                               // some records might have been added, check if we still have the limit for further queries
+                                               if ('' != $this->limit) {
+                                                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
+                                                       // abort loop if LIMIT 0,0
+                                                       if ($parts[0] == 0 && $parts[1] == 0) {
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                                       $GLOBALS['TYPO3_DB']->sql_free_result($resPages);
+                               }
+                       }
+                       $this->label[$table] = $tcaCtrl['label'];
+                       $this->title[$table] = $tcaCtrl['title'];
+               }
+       }
+
+       /**
+        * Checks whether the current backend user has access to the given records.
+        *
+        * @param       string          $table: Name of the table
+        * @param       array           $rows: Record row
+        * @return      void
+        */
+       protected function checkRecordAccess($table, array $rows) {
+               foreach ($rows as $key => $row) {
+                       if (\TYPO3\CMS\Recycler\Utility\RecyclerUtility::checkAccess($table, $row)) {
+                               $this->setDeletedRows($table, $row);
+                       }
+               }
+       }
+
+       /**
+        * Escapes a value to be used for like in a database query.
+        * There is a special handling for the characters '%' and '_'.
+        *
+        * @param       string          $value: The value to be escaped for like conditions
+        * @paran       string          $tableName: The name of the table the query should be used for
+        * @return      string          The escaped value to be used for like conditions
+        */
+       protected function escapeValueForLike($value, $tableName) {
+               return $GLOBALS['TYPO3_DB']->escapeStrForLike($GLOBALS['TYPO3_DB']->quoteStr($value, $tableName), $tableName);
+       }
+
+       /************************************************************
+        * DELETE FUNCTIONS
+        ************************************************************/
+       /**
+        * Delete element from any table
+        *
+        * @param       string          $recordArray: Representation of the records
+        * @return      void
+        */
+       public function deleteData($recordsArray) {
+               $recordsArray = json_decode($recordsArray);
+               if (is_array($recordsArray)) {
+                       $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
+                       $tce->start('', '');
+                       $tce->disableDeleteClause();
+                       foreach ($recordsArray as $key => $record) {
+                               $tce->deleteEl($record[0], $record[1], TRUE, TRUE);
+                       }
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /************************************************************
+        * UNDELETE FUNCTIONS
+        ************************************************************/
+       /**
+        * Undelete records
+        * If $recursive is TRUE all records below the page uid would be undelete too
+        *
+        * @param       string          $recordArray: Representation of the records
+        * @param       boolean         $recursive: TRUE/FALSE
+        * @return      boolean
+        */
+       public function undeleteData($recordsArray, $recursive = FALSE) {
+               require_once PATH_t3lib . 'class.t3lib_tcemain.php';
+               $result = FALSE;
+               $depth = 999;
+               $recordsArray = json_decode($recordsArray);
+               if (is_array($recordsArray)) {
+                       $this->deletedRows = array();
+                       $cmd = array();
+                       foreach ($recordsArray as $key => $row) {
+                               $cmd[$row[0]][$row[1]]['undelete'] = 1;
+                               if ($row[0] == 'pages' && $recursive == TRUE) {
+                                       $this->loadData($row[1], '', $depth, '');
+                                       $childRecords = $this->getDeletedRows();
+                                       if (count($childRecords) > 0) {
+                                               foreach ($childRecords as $table => $childRows) {
+                                                       foreach ($childRows as $childKey => $childRow) {
+                                                               $cmd[$table][$childRow['uid']]['undelete'] = 1;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       if ($cmd) {
+                               $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
+                               $tce->start(array(), $cmd);
+                               $tce->process_cmdmap();
+                               $result = TRUE;
+                       }
+               }
+               return $result;
+       }
+
+       /************************************************************
+        * SETTER FUNCTIONS
+        ************************************************************/
+       /**
+        * Set deleted rows
+        *
+        * @param       string          $table: Tablename
+        * @param       array           $row: Deleted record row
+        * @return      void
+        */
+       public function setDeletedRows($table, array $row) {
+               $this->deletedRows[$table][] = $row;
+       }
+
+       /************************************************************
+        * GETTER FUNCTIONS
+        ************************************************************/
+       /**
+        * Get deleted Rows
+        *
+        * @return      array           $this->deletedRows: Array with all deleted rows from TCA
+        */
+       public function getDeletedRows() {
+               return $this->deletedRows;
+       }
+
+       /**
+        * Get table
+        *
+        * @return      array           $this->table: Array with table from TCA
+        */
+       public function getTable() {
+               return $this->table;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Domain/Model/Tables.php b/typo3/sysext/recycler/Classes/Domain/Model/Tables.php
new file mode 100644 (file)
index 0000000..efb40e1
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+namespace TYPO3\CMS\Recycler\Domain\Model;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+
+/**
+ * Model class for the 'recycler' extension.
+ *
+ * @author     Julian Kleinhans <typo3@kj187.de>
+ * @package    TYPO3
+ * @subpackage         tx_recycler
+ */
+class Tables {
+
+       /**
+        * Get tables for menu example
+        *
+        * @param       string          $format: Return format (example: json)
+        * @param       boolean         $withAllOption: 0 no, 1 return tables with a "all" option
+        * @param       integer         $id: UID from selected page
+        * @param       integer         $depth: How many levels recursive
+        * @return      string          The tables to be displayed
+        */
+       public function getTables($format, $withAllOption = 0, $startUid, $depth = 0) {
+               $deletedRecordsTotal = 0;
+               $tables = array();
+               foreach (array_keys($GLOBALS['TCA']) as $tableName) {
+                       $deletedField = \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getDeletedField($tableName);
+                       if ($deletedField) {
+                               // Determine whether the table has deleted records:
+                               $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $tableName, $deletedField . '<>0');
+                               if ($deletedCount) {
+                                       $deletedDataObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
+                                       $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
+                                       if (isset($deletedData[$tableName])) {
+                                               if ($deletedRecordsInTable = count($deletedData[$tableName])) {
+                                                       $deletedRecordsTotal += $deletedRecordsInTable;
+                                                       $tables[] = array(
+                                                               $tableName,
+                                                               $deletedRecordsInTable,
+                                                               $tableName,
+                                                               \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$tableName]['ctrl']['title']))
+                                                       );
+                                               }
+                                       }
+                               }
+                       }
+               }
+               $jsonArray = $tables;
+               if ($withAllOption) {
+                       array_unshift($jsonArray, array(
+                               '',
+                               $deletedRecordsTotal,
+                               '',
+                               $GLOBALS['LANG']->sL('LLL:EXT:recycler/mod1/locallang.xml:label_alltables')
+                       ));
+               }
+               $output = json_encode($jsonArray);
+               return $output;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php b/typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php
new file mode 100644 (file)
index 0000000..9325a93
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+namespace TYPO3\CMS\Recycler\Utility;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+/**
+ * Helper class for the 'recycler' extension.
+ *
+ * @author     Julian Kleinhans <typo3@kj187.de>
+ * @package    TYPO3
+ * @subpackage         tx_recycler
+ */
+class RecyclerUtility {
+
+       /************************************************************
+        * USER ACCESS
+        *
+        *
+        ************************************************************/
+       /**
+        * Checks the page access rights (Code for access check mostly taken from alt_doc.php)
+        * as well as the table access rights of the user.
+        *
+        * @param       string          $cmd: The command that sould be performed ('new' or 'edit')
+        * @param       string          $table: The table to check access for
+        * @param       string          $theUid: The record uid of the table
+        * @return      boolean         Returns TRUE is the user has access, or FALSE if not
+        */
+       static public function checkAccess($table, $row) {
+               // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
+               // First, resetting flags.
+               $hasAccess = 0;
+               $calcPRec = $row;
+               \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($table, $calcPRec);
+               if (is_array($calcPRec)) {
+                       if ($table == 'pages') {
+                               // If pages:
+                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
+                               $hasAccess = $CALC_PERMS & 2 ? 1 : 0;
+                       } else {
+                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $calcPRec['pid']));
+                               // Fetching pid-record first.
+                               $hasAccess = $CALC_PERMS & 16 ? 1 : 0;
+                       }
+                       // Check internals regarding access:
+                       if ($hasAccess) {
+                               $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
+                       }
+               }
+               if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
+                       $hasAccess = 0;
+               }
+               return $hasAccess ? TRUE : FALSE;
+       }
+
+       /**
+        * Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
+        * Each part of the path will be limited to $titleLimit characters
+        * Deleted pages are filtered out.
+        *
+        * @param       integer         Page uid for which to create record path
+        * @param       string          $clause is additional where clauses, eg.
+        * @param       integer         Title limit
+        * @param       integer         Title limit of Full title (typ. set to 1000 or so)
+        * @return      mixed           Path of record (string) OR array with short/long title if $fullTitleLimit is set.
+        */
+       static public function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0) {
+               $loopCheck = 100;
+               $output = ($fullOutput = '/');
+               while ($uid != 0 && $loopCheck > 0) {
+                       $loopCheck--;
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', ('uid=' . intval($uid)) . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
+                       if (is_resource($res)) {
+                               $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
+                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+                               \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $row);
+                               if (is_array($row)) {
+                                       \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid('pages', $row);
+                                       $uid = $row['pid'];
+                                       $output = ('/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit))) . $output;
+                                       if ($row['deleted']) {
+                                               $output = ('<span class="deletedPath">' . $output) . '</span>';
+                                       }
+                                       if ($fullTitleLimit) {
+                                               $fullOutput = ('/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit))) . $fullOutput;
+                                       }
+                               } else {
+                                       break;
+                               }
+                       } else {
+                               break;
+                       }
+               }
+               if ($fullTitleLimit) {
+                       return array($output, $fullOutput);
+               } else {
+                       return $output;
+               }
+       }
+
+       /**
+        * Gets the name of the field with the information whether a record is deleted.
+        *
+        * @param       string          $tableName: Name of the table to get the deleted field for
+        * @return      string          Name of the field with the information whether a record is deleted
+        */
+       static public function getDeletedField($tableName) {
+               $TCA = self::getTableTCA($tableName);
+               if (($TCA && isset($TCA['ctrl']['delete'])) && $TCA['ctrl']['delete']) {
+                       return $TCA['ctrl']['delete'];
+               }
+       }
+
+       /**
+        * Gets the TCA of the table used in the current context.
+        *
+        * @param       string          $tableName: Name of the table to get TCA for
+        * @return      mixed           TCA of the table used in the current context (array)
+        */
+       static public function getTableTCA($tableName) {
+               $TCA = FALSE;
+               if (isset($GLOBALS['TCA'][$tableName])) {
+                       $TCA = $GLOBALS['TCA'][$tableName];
+               }
+               return $TCA;
+       }
+
+       /**
+        * Gets the current backend charset.
+        *
+        * @return      string          The current backend charset
+        */
+       static public function getCurrentCharset() {
+               return $GLOBALS['LANG']->csConvObj->parse_charset($GLOBALS['LANG']->charSet);
+       }
+
+       /**
+        * Determines whether the current charset is not UTF-8
+        *
+        * @return      boolean         Whether the current charset is not UTF-8
+        */
+       static public function isNotUtf8Charset() {
+               return self::getCurrentCharset() !== 'utf-8';
+       }
+
+       /**
+        * Gets an UTF-8 encoded string (only if the current charset is not UTF-8!).
+        *
+        * @param       string          $string: String to be converted to UTF-8 if required
+        * @return      string          UTF-8 encoded string
+        */
+       static public function getUtf8String($string) {
+               if (self::isNotUtf8Charset()) {
+                       $string = $GLOBALS['LANG']->csConvObj->utf8_encode($string, self::getCurrentCharset());
+               }
+               return $string;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/helper/class.tx_recycler_helper.php b/typo3/sysext/recycler/Classes/helper/class.tx_recycler_helper.php
new file mode 100644 (file)
index 0000000..f5688f7
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_recycler_helper and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Utility/RecyclerUtility.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/model/class.tx_recycler_model_deletedRecords.php b/typo3/sysext/recycler/Classes/model/class.tx_recycler_model_deletedRecords.php
new file mode 100644 (file)
index 0000000..315dbe5
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/helper/class.tx_recycler_helper.php');
+/*
+ * @deprecated since 6.0, the classname tx_recycler_model_deletedRecords and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Domain/Model/DeletedRecords.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/model/class.tx_recycler_model_tables.php b/typo3/sysext/recycler/Classes/model/class.tx_recycler_model_tables.php
new file mode 100644 (file)
index 0000000..1f7c591
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/model/class.tx_recycler_model_deletedRecords.php');
+/*
+ * @deprecated since 6.0, the classname tx_recycler_model_tables and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/recycler/Classes/Domain/Model/Tables.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Domain/Model/Tables.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/Classes/view/class.tx_recycler_view_deletedRecords.php b/typo3/sysext/recycler/Classes/view/class.tx_recycler_view_deletedRecords.php
new file mode 100644 (file)
index 0000000..f2b09a5
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
+ ***************************************************************/
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'Classes/helper/class.tx_recycler_helper.php');
+/*
+ * @deprecated since 6.0, the classname tx_recycler_view_deletedRecords and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Controller/DeletedRecordsController.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/Domain/Model/DeletedRecords.php b/typo3/sysext/recycler/classes/Domain/Model/DeletedRecords.php
deleted file mode 100644 (file)
index 91494d0..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Domain\Model;
-
-/**
- * Model class for the 'recycler' extension.
- *
- * @author     Julian Kleinhans <typo3@kj187.de>
- * @package    TYPO3
- * @subpackage         tx_recycler
- */
-class DeletedRecords {
-
-       /**
-        * Array with all deleted rows
-        *
-        * @var         array
-        */
-       protected $deletedRows = array();
-
-       /**
-        * String with the global limit
-        *
-        * @var         string
-        */
-       protected $limit = '';
-
-       /**
-        * Array with all avaiable FE tables
-        *
-        * @var         array
-        */
-       protected $table = array();
-
-       /**
-        * Object from helper class
-        *
-        * @var \TYPO3\CMS\Recycler\Utility\RecyclerUtility
-        */
-       protected $recyclerHelper;
-
-       /**
-        * Array with all label fields drom different tables
-        *
-        * @var         array
-        */
-       public $label;
-
-       /**
-        * Array with all title fields drom different tables
-        *
-        * @var         array
-        */
-       public $title;
-
-       /************************************************************
-        * GET DATA FUNCTIONS
-        *
-        *
-        ************************************************************/
-       /**
-        * Load all deleted rows from $table
-        * If table is not set, it iterates the TCA tables
-        *
-        * @param       integer         $id: UID from selected page
-        * @param       string          $table: Tablename
-        * @param       integer         $depth: How many levels recursive
-        * @param       integer         $limit: MySQL LIMIT
-        * @param       string          $filter: Filter text
-        * @return      recycler_model_delRecords
-        */
-       public function loadData($id, $table, $depth, $limit = '', $filter = '') {
-               // set the limit
-               $this->limit = trim($limit);
-               if ($table) {
-                       if (array_key_exists($table, $GLOBALS['TCA'])) {
-                               $this->table[] = $table;
-                               $this->setData($id, $table, $depth, $GLOBALS['TCA'][$table]['ctrl'], $filter);
-                       }
-               } else {
-                       foreach ($GLOBALS['TCA'] as $tableKey => $tableValue) {
-                               // only go into this table if the limit allows it
-                               if ($this->limit != '') {
-                                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
-                                       // abort loop if LIMIT 0,0
-                                       if ($parts[0] == 0 && $parts[1] == 0) {
-                                               break;
-                                       }
-                               }
-                               $this->table[] = $tableKey;
-                               $this->setData($id, $tableKey, $depth, $tableValue['ctrl'], $filter);
-                       }
-               }
-               return $this;
-       }
-
-       /**
-        * Find the total count of deleted records
-        *
-        * @param       integer         $id: UID from record
-        * @param       string          $table: Tablename from record
-        * @param       integer         $depth: How many levels recursive
-        * @param       string          $filter: Filter text
-        * @return      void
-        */
-       public function getTotalCount($id, $table, $depth, $filter) {
-               $deletedRecords = $this->loadData($id, $table, $depth, '', $filter)->getDeletedRows();
-               $countTotal = 0;
-               foreach ($this->table as $tableName) {
-                       $countTotal += count($deletedRecords[$tableName]);
-               }
-               return $countTotal;
-       }
-
-       /**
-        * Set all deleted rows
-        *
-        * @param       integer         $id: UID from record
-        * @param       string          $table: Tablename from record
-        * @param       integer         $depth: How many levels recursive
-        * @param       array           $ctrl: TCA CTRL Array
-        * @param       string          $filter: Filter text
-        * @return      void
-        */
-       protected function setData($id = 0, $table, $depth, $tcaCtrl, $filter) {
-               $id = intval($id);
-               if (array_key_exists('delete', $tcaCtrl)) {
-                       // find the 'deleted' field for this table
-                       $deletedField = \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getDeletedField($table);
-                       // create the filter WHERE-clause
-                       if (trim($filter) != '') {
-                               $filterWhere = (((((' AND (' . (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($filter) ? ((('uid = ' . $filter) . ' OR pid = ') . $filter) . ' OR ' : '')) . $tcaCtrl['label']) . ' LIKE "%') . $this->escapeValueForLike($filter, $table)) . '%"') . ')';
-                       }
-                       // get the limit
-                       if ($this->limit != '') {
-                               // count the number of deleted records for this pid
-                               $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, (($deletedField . '<>0 AND pid = ') . $id) . $filterWhere);
-                               // split the limit
-                               $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
-                               $offset = $parts[0];
-                               $rowCount = $parts[1];
-                               // subtract the number of deleted records from the limit's offset
-                               $result = $offset - $deletedCount;
-                               // if the result is >= 0
-                               if ($result >= 0) {
-                                       // store the new offset in the limit and go into the next depth
-                                       $offset = $result;
-                                       $this->limit = implode(',', array($offset, $rowCount));
-                                       // do NOT query this depth; limit also does not need to be set, we set it anyways
-                                       $allowQuery = FALSE;
-                                       $allowDepth = TRUE;
-                                       $limit = '';
-                               } else {
-                                       // the offset for the temporary limit has to remain like the original offset
-                                       // in case the original offset was just crossed by the amount of deleted records
-                                       if ($offset != 0) {
-                                               $tempOffset = $offset;
-                                       } else {
-                                               $tempOffset = 0;
-                                       }
-                                       // set the offset in the limit to 0
-                                       $newOffset = 0;
-                                       // convert to negative result to the positive equivalent
-                                       $absResult = abs($result);
-                                       // if the result now is > limit's row count
-                                       if ($absResult > $rowCount) {
-                                               // use the limit's row count as the temporary limit
-                                               $limit = implode(',', array($tempOffset, $rowCount));
-                                               // set the limit's row count to 0
-                                               $this->limit = implode(',', array($newOffset, 0));
-                                               // do not go into new depth
-                                               $allowDepth = FALSE;
-                                       } else {
-                                               // if the result now is <= limit's row count
-                                               // use the result as the temporary limit
-                                               $limit = implode(',', array($tempOffset, $absResult));
-                                               // subtract the result from the row count
-                                               $newCount = $rowCount - $absResult;
-                                               // store the new result in the limit's row count
-                                               $this->limit = implode(',', array($newOffset, $newCount));
-                                               // if the new row count is > 0
-                                               if ($newCount > 0) {
-                                                       // go into new depth
-                                                       $allowDepth = TRUE;
-                                               } else {
-                                                       // if the new row count is <= 0 (only =0 makes sense though)
-                                                       // do not go into new depth
-                                                       $allowDepth = FALSE;
-                                               }
-                                       }
-                                       // allow query for this depth
-                                       $allowQuery = TRUE;
-                               }
-                       } else {
-                               $limit = '';
-                               $allowDepth = TRUE;
-                               $allowQuery = TRUE;
-                       }
-                       // query for actual deleted records
-                       if ($allowQuery) {
-                               $recordsToCheck = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField($table, $deletedField, '1', (' AND pid = ' . $id) . $filterWhere, '', '', $limit, FALSE);
-                               if ($recordsToCheck) {
-                                       $this->checkRecordAccess($table, $recordsToCheck);
-                               }
-                       }
-                       // go into depth
-                       if ($allowDepth && $depth >= 1) {
-                               // check recursively for elements beneath this page
-                               $resPages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . $id, '', 'sorting');
-                               if (is_resource($resPages)) {
-                                       while ($rowPages = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resPages)) {
-                                               $this->setData($rowPages['uid'], $table, $depth - 1, $tcaCtrl, $filter);
-                                               // some records might have been added, check if we still have the limit for further queries
-                                               if ('' != $this->limit) {
-                                                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->limit);
-                                                       // abort loop if LIMIT 0,0
-                                                       if ($parts[0] == 0 && $parts[1] == 0) {
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                                       $GLOBALS['TYPO3_DB']->sql_free_result($resPages);
-                               }
-                       }
-                       $this->label[$table] = $tcaCtrl['label'];
-                       $this->title[$table] = $tcaCtrl['title'];
-               }
-       }
-
-       /**
-        * Checks whether the current backend user has access to the given records.
-        *
-        * @param       string          $table: Name of the table
-        * @param       array           $rows: Record row
-        * @return      void
-        */
-       protected function checkRecordAccess($table, array $rows) {
-               foreach ($rows as $key => $row) {
-                       if (\TYPO3\CMS\Recycler\Utility\RecyclerUtility::checkAccess($table, $row)) {
-                               $this->setDeletedRows($table, $row);
-                       }
-               }
-       }
-
-       /**
-        * Escapes a value to be used for like in a database query.
-        * There is a special handling for the characters '%' and '_'.
-        *
-        * @param       string          $value: The value to be escaped for like conditions
-        * @paran       string          $tableName: The name of the table the query should be used for
-        * @return      string          The escaped value to be used for like conditions
-        */
-       protected function escapeValueForLike($value, $tableName) {
-               return $GLOBALS['TYPO3_DB']->escapeStrForLike($GLOBALS['TYPO3_DB']->quoteStr($value, $tableName), $tableName);
-       }
-
-       /************************************************************
-        * DELETE FUNCTIONS
-        ************************************************************/
-       /**
-        * Delete element from any table
-        *
-        * @param       string          $recordArray: Representation of the records
-        * @return      void
-        */
-       public function deleteData($recordsArray) {
-               $recordsArray = json_decode($recordsArray);
-               if (is_array($recordsArray)) {
-                       $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
-                       $tce->start('', '');
-                       $tce->disableDeleteClause();
-                       foreach ($recordsArray as $key => $record) {
-                               $tce->deleteEl($record[0], $record[1], TRUE, TRUE);
-                       }
-                       return TRUE;
-               }
-               return FALSE;
-       }
-
-       /************************************************************
-        * UNDELETE FUNCTIONS
-        ************************************************************/
-       /**
-        * Undelete records
-        * If $recursive is TRUE all records below the page uid would be undelete too
-        *
-        * @param       string          $recordArray: Representation of the records
-        * @param       boolean         $recursive: TRUE/FALSE
-        * @return      boolean
-        */
-       public function undeleteData($recordsArray, $recursive = FALSE) {
-               require_once PATH_t3lib . 'class.t3lib_tcemain.php';
-               $result = FALSE;
-               $depth = 999;
-               $recordsArray = json_decode($recordsArray);
-               if (is_array($recordsArray)) {
-                       $this->deletedRows = array();
-                       $cmd = array();
-                       foreach ($recordsArray as $key => $row) {
-                               $cmd[$row[0]][$row[1]]['undelete'] = 1;
-                               if ($row[0] == 'pages' && $recursive == TRUE) {
-                                       $this->loadData($row[1], '', $depth, '');
-                                       $childRecords = $this->getDeletedRows();
-                                       if (count($childRecords) > 0) {
-                                               foreach ($childRecords as $table => $childRows) {
-                                                       foreach ($childRows as $childKey => $childRow) {
-                                                               $cmd[$table][$childRow['uid']]['undelete'] = 1;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       if ($cmd) {
-                               $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
-                               $tce->start(array(), $cmd);
-                               $tce->process_cmdmap();
-                               $result = TRUE;
-                       }
-               }
-               return $result;
-       }
-
-       /************************************************************
-        * SETTER FUNCTIONS
-        ************************************************************/
-       /**
-        * Set deleted rows
-        *
-        * @param       string          $table: Tablename
-        * @param       array           $row: Deleted record row
-        * @return      void
-        */
-       public function setDeletedRows($table, array $row) {
-               $this->deletedRows[$table][] = $row;
-       }
-
-       /************************************************************
-        * GETTER FUNCTIONS
-        ************************************************************/
-       /**
-        * Get deleted Rows
-        *
-        * @return      array           $this->deletedRows: Array with all deleted rows from TCA
-        */
-       public function getDeletedRows() {
-               return $this->deletedRows;
-       }
-
-       /**
-        * Get table
-        *
-        * @return      array           $this->table: Array with table from TCA
-        */
-       public function getTable() {
-               return $this->table;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/Domain/Model/Tables.php b/typo3/sysext/recycler/classes/Domain/Model/Tables.php
deleted file mode 100644 (file)
index 96c25b9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Domain\Model;
-
-/**
- * Model class for the 'recycler' extension.
- *
- * @author     Julian Kleinhans <typo3@kj187.de>
- * @package    TYPO3
- * @subpackage         tx_recycler
- */
-class Tables {
-
-       /**
-        * Get tables for menu example
-        *
-        * @param       string          $format: Return format (example: json)
-        * @param       boolean         $withAllOption: 0 no, 1 return tables with a "all" option
-        * @param       integer         $id: UID from selected page
-        * @param       integer         $depth: How many levels recursive
-        * @return      string          The tables to be displayed
-        */
-       public function getTables($format, $withAllOption = 0, $startUid, $depth = 0) {
-               $deletedRecordsTotal = 0;
-               $tables = array();
-               foreach (array_keys($GLOBALS['TCA']) as $tableName) {
-                       $deletedField = \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getDeletedField($tableName);
-                       if ($deletedField) {
-                               // Determine whether the table has deleted records:
-                               $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $tableName, $deletedField . '<>0');
-                               if ($deletedCount) {
-                                       $deletedDataObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
-                                       $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
-                                       if (isset($deletedData[$tableName])) {
-                                               if ($deletedRecordsInTable = count($deletedData[$tableName])) {
-                                                       $deletedRecordsTotal += $deletedRecordsInTable;
-                                                       $tables[] = array(
-                                                               $tableName,
-                                                               $deletedRecordsInTable,
-                                                               $tableName,
-                                                               \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$tableName]['ctrl']['title']))
-                                                       );
-                                               }
-                                       }
-                               }
-                       }
-               }
-               $jsonArray = $tables;
-               if ($withAllOption) {
-                       array_unshift($jsonArray, array(
-                               '',
-                               $deletedRecordsTotal,
-                               '',
-                               $GLOBALS['LANG']->sL('LLL:EXT:recycler/mod1/locallang.xml:label_alltables')
-                       ));
-               }
-               $output = json_encode($jsonArray);
-               return $output;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/Utility/RecyclerUtility.php b/typo3/sysext/recycler/classes/Utility/RecyclerUtility.php
deleted file mode 100644 (file)
index 9325a93..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Utility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
- ***************************************************************/
-/**
- * Helper class for the 'recycler' extension.
- *
- * @author     Julian Kleinhans <typo3@kj187.de>
- * @package    TYPO3
- * @subpackage         tx_recycler
- */
-class RecyclerUtility {
-
-       /************************************************************
-        * USER ACCESS
-        *
-        *
-        ************************************************************/
-       /**
-        * Checks the page access rights (Code for access check mostly taken from alt_doc.php)
-        * as well as the table access rights of the user.
-        *
-        * @param       string          $cmd: The command that sould be performed ('new' or 'edit')
-        * @param       string          $table: The table to check access for
-        * @param       string          $theUid: The record uid of the table
-        * @return      boolean         Returns TRUE is the user has access, or FALSE if not
-        */
-       static public function checkAccess($table, $row) {
-               // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
-               // First, resetting flags.
-               $hasAccess = 0;
-               $calcPRec = $row;
-               \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($table, $calcPRec);
-               if (is_array($calcPRec)) {
-                       if ($table == 'pages') {
-                               // If pages:
-                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
-                               $hasAccess = $CALC_PERMS & 2 ? 1 : 0;
-                       } else {
-                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $calcPRec['pid']));
-                               // Fetching pid-record first.
-                               $hasAccess = $CALC_PERMS & 16 ? 1 : 0;
-                       }
-                       // Check internals regarding access:
-                       if ($hasAccess) {
-                               $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
-                       }
-               }
-               if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
-                       $hasAccess = 0;
-               }
-               return $hasAccess ? TRUE : FALSE;
-       }
-
-       /**
-        * Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
-        * Each part of the path will be limited to $titleLimit characters
-        * Deleted pages are filtered out.
-        *
-        * @param       integer         Page uid for which to create record path
-        * @param       string          $clause is additional where clauses, eg.
-        * @param       integer         Title limit
-        * @param       integer         Title limit of Full title (typ. set to 1000 or so)
-        * @return      mixed           Path of record (string) OR array with short/long title if $fullTitleLimit is set.
-        */
-       static public function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0) {
-               $loopCheck = 100;
-               $output = ($fullOutput = '/');
-               while ($uid != 0 && $loopCheck > 0) {
-                       $loopCheck--;
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', ('uid=' . intval($uid)) . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
-                       if (is_resource($res)) {
-                               $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                               \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $row);
-                               if (is_array($row)) {
-                                       \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid('pages', $row);
-                                       $uid = $row['pid'];
-                                       $output = ('/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit))) . $output;
-                                       if ($row['deleted']) {
-                                               $output = ('<span class="deletedPath">' . $output) . '</span>';
-                                       }
-                                       if ($fullTitleLimit) {
-                                               $fullOutput = ('/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit))) . $fullOutput;
-                                       }
-                               } else {
-                                       break;
-                               }
-                       } else {
-                               break;
-                       }
-               }
-               if ($fullTitleLimit) {
-                       return array($output, $fullOutput);
-               } else {
-                       return $output;
-               }
-       }
-
-       /**
-        * Gets the name of the field with the information whether a record is deleted.
-        *
-        * @param       string          $tableName: Name of the table to get the deleted field for
-        * @return      string          Name of the field with the information whether a record is deleted
-        */
-       static public function getDeletedField($tableName) {
-               $TCA = self::getTableTCA($tableName);
-               if (($TCA && isset($TCA['ctrl']['delete'])) && $TCA['ctrl']['delete']) {
-                       return $TCA['ctrl']['delete'];
-               }
-       }
-
-       /**
-        * Gets the TCA of the table used in the current context.
-        *
-        * @param       string          $tableName: Name of the table to get TCA for
-        * @return      mixed           TCA of the table used in the current context (array)
-        */
-       static public function getTableTCA($tableName) {
-               $TCA = FALSE;
-               if (isset($GLOBALS['TCA'][$tableName])) {
-                       $TCA = $GLOBALS['TCA'][$tableName];
-               }
-               return $TCA;
-       }
-
-       /**
-        * Gets the current backend charset.
-        *
-        * @return      string          The current backend charset
-        */
-       static public function getCurrentCharset() {
-               return $GLOBALS['LANG']->csConvObj->parse_charset($GLOBALS['LANG']->charSet);
-       }
-
-       /**
-        * Determines whether the current charset is not UTF-8
-        *
-        * @return      boolean         Whether the current charset is not UTF-8
-        */
-       static public function isNotUtf8Charset() {
-               return self::getCurrentCharset() !== 'utf-8';
-       }
-
-       /**
-        * Gets an UTF-8 encoded string (only if the current charset is not UTF-8!).
-        *
-        * @param       string          $string: String to be converted to UTF-8 if required
-        * @return      string          UTF-8 encoded string
-        */
-       static public function getUtf8String($string) {
-               if (self::isNotUtf8Charset()) {
-                       $string = $GLOBALS['LANG']->csConvObj->utf8_encode($string, self::getCurrentCharset());
-               }
-               return $string;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/controller/DeletedRecordsController.php b/typo3/sysext/recycler/classes/controller/DeletedRecordsController.php
deleted file mode 100644 (file)
index c426f8c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Controller;
-
-/**
- * Deleted Records View
- *
- * @author Erik Frister <erik_frister@otq-solutions.com>
- * @author Julian Kleinhans <typo3@kj187.de>
- * @package TYPO3
- * @subpackage tx_recycler
- */
-class DeletedRecordsController {
-
-       /**
-        * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
-        *
-        * @param array     $rows   Array with table as key and array with all deleted rows
-        * @param integer       $totalDeleted: Number of deleted records in total, for PagingToolbar
-        * @return string   JSON Array
-        */
-       public function transform($deletedRowsArray, $totalDeleted) {
-               $total = 0;
-               $jsonArray = array(
-                       'rows' => array()
-               );
-               // iterate
-               if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
-                       foreach ($deletedRowsArray as $table => $rows) {
-                               $total += count($deletedRowsArray[$table]);
-                               foreach ($rows as $row) {
-                                       $backendUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
-                                       $jsonArray['rows'][] = array(
-                                               'uid' => $row['uid'],
-                                               'pid' => $row['pid'],
-                                               'table' => $table,
-                                               'crdate' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]),
-                                               'tstamp' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]),
-                                               'owner' => htmlspecialchars($backendUser['username']),
-                                               'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']],
-                                               'tableTitle' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
-                                               'title' => htmlspecialchars(\TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row))),
-                                               'path' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getRecordPath($row['pid'])
-                                       );
-                               }
-                       }
-               }
-               $jsonArray['total'] = $totalDeleted;
-               return json_encode($jsonArray);
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/controller/RecyclerAjaxController.php b/typo3/sysext/recycler/classes/controller/RecyclerAjaxController.php
deleted file mode 100644 (file)
index cedd614..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Controller;
-
-/**
- * Controller class for the 'recycler' extension. Handles the AJAX Requests
- *
- * @author             Julian Kleinhans <typo3@kj187.de>
- * @author     Erik Frister <erik_frister@otq-solutions.com>
- * @package            TYPO3
- * @subpackage         tx_recycler
- */
-class RecyclerAjaxController {
-
-       /**
-        * Stores the content for the ajax output
-        *
-        * @var         string
-        */
-       protected $content;
-
-       /**
-        * Command to be processed
-        *
-        * @var         string
-        */
-       protected $command;
-
-       /**
-        * Stores relevant data from extJS
-        * Example: Json format
-        * [ ["pages",1],["pages",2],["tt_content",34] ]
-        *
-        * @var         string
-        */
-       protected $data;
-
-       /**
-        * Initialize method
-        *
-        * @return void
-        */
-       public function init() {
-               $this->mapCommand();
-               $this->getContent();
-       }
-
-       /**
-        * Maps the command to the correct Model and View
-        *
-        * @return void
-        */
-       public function mapCommand() {
-               $this->command = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd');
-               $this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('data');
-               // check params
-               if (!is_string($this->command)) {
-                       // @TODO make devlog output
-                       return FALSE;
-               }
-               // Create content
-               $this->createContent();
-       }
-
-       /**
-        * Creates the content
-        *
-        * @return void
-        */
-       protected function createContent() {
-               $str = '';
-               switch ($this->command) {
-               case 'getDeletedRecords':
-                       $table = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table') : \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tableDefault');
-                       $limit = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('limit') ? (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('limit') : (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pagingSizeDefault');
-                       $start = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('start') ? (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('start') : 0;
-                       $filter = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filterTxt') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filterTxt') : '';
-                       $startUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') : '';
-                       $depth = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') : '';
-                       $this->setDataInSession('tableSelection', $table);
-                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
-                       $model->loadData($startUid, $table, $depth, ($start . ',') . $limit, $filter);
-                       $deletedRowsArray = $model->getDeletedRows();
-                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
-                       $totalDeleted = $model->getTotalCount($startUid, $table, $depth, $filter);
-                       // load view
-                       $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Controller\\DeletedRecordsController');
-                       $str = $view->transform($deletedRowsArray, $totalDeleted);
-                       break;
-               case 'doDelete':
-                       $str = FALSE;
-                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
-                       if ($model->deleteData($this->data)) {
-                               $str = TRUE;
-                       }
-                       break;
-               case 'doUndelete':
-                       $str = FALSE;
-                       $recursive = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('recursive');
-                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
-                       if ($model->undeleteData($this->data, $recursive)) {
-                               $str = TRUE;
-                       }
-                       break;
-               case 'getTables':
-                       $depth = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('depth') : 0;
-                       $startUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('startUid') : '';
-                       $this->setDataInSession('depthSelection', $depth);
-                       $model = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\Tables');
-                       $str = $model->getTables('json', 1, $startUid, $depth);
-                       break;
-               default:
-                       $str = 'No command was recognized.';
-                       break;
-               }
-               $this->content = $str;
-       }
-
-       /**
-        * Returns the content that was created in the mapCommand method
-        *
-        * @return string
-        */
-       public function getContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Sets data in the session of the current backend user.
-        *
-        * @param       string          $identifier: The identifier to be used to set the data
-        * @param       string          $data: The data to be stored in the session
-        * @return      void
-        */
-       protected function setDataInSession($identifier, $data) {
-               $GLOBALS['BE_USER']->uc['tx_recycler'][$identifier] = $data;
-               $GLOBALS['BE_USER']->writeUC();
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/controller/RecyclerModuleController.php b/typo3/sysext/recycler/classes/controller/RecyclerModuleController.php
deleted file mode 100644 (file)
index 3174aeb..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recycler\Controller;
-
-// This checks permissions and exits if the users has no permission for entry.
-/**
- * Module 'Recycler' for the 'recycler' extension.
- *
- * @author     Julian Kleinhans <typo3@kj187.de>
- * @package    TYPO3
- * @subpackage         tx_recycler
- */
-class RecyclerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
-
-       /**
-        * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
-        */
-       public $doc;
-
-       protected $relativePath;
-
-       protected $pageRecord = array();
-
-       protected $isAccessibleForCurrentUser = FALSE;
-
-       protected $allowDelete = FALSE;
-
-       protected $recordsPageLimit = 50;
-
-       /**
-        * @var t3lib_pageRenderer
-        */
-       protected $pageRenderer;
-
-       /**
-        * Initializes the Module
-        *
-        * @return      void
-        */
-       public function initialize() {
-               parent::init();
-               $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
-               $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'mod1/mod_template.html');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->setExtDirectStateProvider();
-               $this->pageRenderer = $this->doc->getPageRenderer();
-               $this->relativePath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('recycler');
-               $this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
-               $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin();
-               //don't access in workspace
-               if ($GLOBALS['BE_USER']->workspace !== 0) {
-                       $this->isAccessibleForCurrentUser = FALSE;
-               }
-               //read configuration
-               $modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler');
-               if ($this->isCurrentUserAdmin()) {
-                       $this->allowDelete = TRUE;
-               } else {
-                       $this->allowDelete = $modTS['properties']['allowDelete'] == '1';
-               }
-               if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) {
-                       $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']);
-               }
-       }
-
-       /**
-        * Renders the content of the module.
-        *
-        * @return      void
-        */
-       public function render() {
-               $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
-               $this->content .= $this->doc->section('', $GLOBALS['LANG']->getLL('description'));
-               if ($this->isAccessibleForCurrentUser) {
-                       $this->loadHeaderData();
-                       // div container for renderTo
-                       $this->content .= '<div id="recyclerContent"></div>';
-               } else {
-                       // If no access or if ID == zero
-                       $this->content .= $this->doc->spacer(10);
-               }
-       }
-
-       /**
-        * Flushes the rendered content to browser.
-        *
-        * @return      void
-        */
-       public function flush() {
-               $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $this->getTemplateMarkers());
-               // Renders the module page
-               $content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $content);
-               $this->content = NULL;
-               $this->doc = NULL;
-               echo $content;
-       }
-
-       /**
-        * Determines whether the current user is admin.
-        *
-        * @return      boolean         Whether the current user is admin
-        */
-       protected function isCurrentUserAdmin() {
-               return (bool) $GLOBALS['BE_USER']->user['admin'];
-       }
-
-       /**
-        * Loads data in the HTML head section (e.g. JavaScript or stylesheet information).
-        *
-        * @return      void
-        */
-       protected function loadHeaderData() {
-               // Load CSS Stylesheets:
-               $this->pageRenderer->addCssFile($this->relativePath . 'res/css/customExtJs.css');
-               // Load Ext JS:
-               $this->pageRenderer->loadExtJS();
-               $this->pageRenderer->enableExtJSQuickTips();
-               // Integrate dynamic JavaScript such as configuration or lables:
-               $this->pageRenderer->addInlineSettingArray('Recycler', $this->getJavaScriptConfiguration());
-               $this->pageRenderer->addInlineLanguageLabelArray($this->getJavaScriptLabels());
-               // Load Recycler JavaScript:
-               // Load Plugins
-               $uxPath = $this->doc->backpath . '../t3lib/js/extjs/ux/';
-               $this->pageRenderer->addJsFile($uxPath . 'Ext.grid.RowExpander.js');
-               $this->pageRenderer->addJsFile($uxPath . 'Ext.app.SearchField.js');
-               $this->pageRenderer->addJsFile($uxPath . 'Ext.ux.FitToParent.js');
-               // Load main script
-               $this->pageRenderer->addJsFile($this->relativePath . 'res/js/t3_recycler.js');
-       }
-
-       /**
-        * Gets the JavaScript configuration for the Ext JS interface.
-        *
-        * @return      array           The JavaScript configuration
-        */
-       protected function getJavaScriptConfiguration() {
-               $configuration = array(
-                       'pagingSize' => $this->recordsPageLimit,
-                       'showDepthMenu' => 1,
-                       'startUid' => $this->id,
-                       'tableDefault' => 'pages',
-                       'renderTo' => 'recyclerContent',
-                       'isSSL' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL'),
-                       'ajaxController' => $this->doc->backPath . 'ajax.php?ajaxID=tx_recycler::controller',
-                       'deleteDisable' => $this->allowDelete ? 0 : 1,
-                       'depthSelection' => $this->getDataFromSession('depthSelection', 0),
-                       'tableSelection' => $this->getDataFromSession('tableSelection', 'pages'),
-                       'States' => $GLOBALS['BE_USER']->uc['moduleData']['web_recycler']['States']
-               );
-               return $configuration;
-       }
-
-       /**
-        * Gets the labels to be used in JavaScript in the Ext JS interface.
-        *
-        * @return      array           The labels to be used in JavaScript
-        */
-       protected function getJavaScriptLabels() {
-               $coreLabels = array(
-                       'title' => $GLOBALS['LANG']->getLL('title'),
-                       'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path'),
-                       'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table'),
-                       'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xml:Depth'),
-                       'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
-                       'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
-                       'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
-                       'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
-                       'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
-                       'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
-               );
-               $extensionLabels = $this->getJavaScriptLabelsFromLocallang('js.', 'label_');
-               $javaScriptLabels = array_merge($coreLabels, $extensionLabels);
-               return $javaScriptLabels;
-       }
-
-       /**
-        * Gets labels to be used in JavaScript fetched from the current locallang file.
-        *
-        * @param       string          $selectionPrefix: Prefix to select the correct labels (default: 'js.')
-        * @param       string          $stripFromSelectionName: Sub-prefix to be removed from label names in the result (default: '')
-        * @return      array           Lables to be used in JavaScript of the current locallang file
-        * @todo        Check, whether this method can be moved in a generic way to $GLOBALS['LANG']
-        */
-       protected function getJavaScriptLabelsFromLocallang($selectionPrefix = 'js.', $stripFromSelectionName = '') {
-               $extraction = array();
-               $labels = array_merge((array) $GLOBALS['LOCAL_LANG']['default'], (array) $GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang]);
-               // Regular expression to strip the selection prefix and possibly something from the label name:
-               $labelPattern = ((('#^' . preg_quote($selectionPrefix, '#')) . '(') . preg_quote($stripFromSelectionName, '#')) . ')?#';
-               // Iterate through all locallang lables:
-               foreach ($labels as $label => $value) {
-                       if (strpos($label, $selectionPrefix) === 0) {
-                               $key = preg_replace($labelPattern, '', $label);
-                               $extraction[$key] = $value;
-                       }
-               }
-               return $extraction;
-       }
-
-       /**
-        * Gets the buttons that shall be rendered in the docHeader.
-        *
-        * @return      array           Available buttons for the docHeader
-        */
-       protected function getDocHeaderButtons() {
-               $buttons = array(
-                       'csh' => \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']),
-                       'shortcut' => $this->getShortcutButton(),
-                       'save' => ''
-               );
-               // SAVE button
-               $buttons['save'] = '';
-               //<input type="image" class="c-inputButton" name="submit" value="Update"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
-               return $buttons;
-       }
-
-       /**
-        * Gets the button to set a new shortcut in the backend (if current user is allowed to).
-        *
-        * @return      string          HTML representation of the shortcut button
-        */
-       protected function getShortcutButton() {
-               $result = '';
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
-                       $result = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
-               }
-               return $result;
-       }
-
-       /**
-        * Gets the filled markers that are used in the HTML template.
-        *
-        * @return      array           The filled marker array
-        */
-       protected function getTemplateMarkers() {
-               $markers = array(
-                       'FUNC_MENU' => $this->getFunctionMenu(),
-                       'CONTENT' => $this->content,
-                       'TITLE' => $GLOBALS['LANG']->getLL('title')
-               );
-               return $markers;
-       }
-
-       /**
-        * Gets the function menu selector for this backend module.
-        *
-        * @return      string          The HTML representation of the function menu selector
-        */
-       protected function getFunctionMenu() {
-               return \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
-       }
-
-       /**
-        * Gets data from the session of the current backend user.
-        *
-        * @param       string          $identifier: The identifier to be used to get the data
-        * @param       string          $default: The default date to be used if nothing was found in the session
-        * @return      string          The accordant data in the session of the current backend user
-        */
-       protected function getDataFromSession($identifier, $default = NULL) {
-               $sessionData =& $GLOBALS['BE_USER']->uc['tx_recycler'];
-               if (isset($sessionData[$identifier]) && $sessionData[$identifier]) {
-                       $data = $sessionData[$identifier];
-               } else {
-                       $data = $default;
-               }
-               return $data;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/controller/class.tx_recycler_controller_ajax.php b/typo3/sysext/recycler/classes/controller/class.tx_recycler_controller_ajax.php
deleted file mode 100644 (file)
index b1a7d64..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
- ***************************************************************/
-// Pre-Include all models and views
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/model/class.tx_recycler_model_deletedRecords.php');
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/model/class.tx_recycler_model_tables.php');
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/view/class.tx_recycler_view_deletedRecords.php');
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/helper/class.tx_recycler_helper.php');
-/*
- * @deprecated since 6.0, the classname tx_recycler_controller_ajax and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Controller/RecyclerAjaxController.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/helper/class.tx_recycler_helper.php b/typo3/sysext/recycler/classes/helper/class.tx_recycler_helper.php
deleted file mode 100644 (file)
index f5688f7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_recycler_helper and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Utility/RecyclerUtility.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/model/class.tx_recycler_model_deletedRecords.php b/typo3/sysext/recycler/classes/model/class.tx_recycler_model_deletedRecords.php
deleted file mode 100644 (file)
index 1c4e63e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
- ***************************************************************/
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/helper/class.tx_recycler_helper.php');
-/*
- * @deprecated since 6.0, the classname tx_recycler_model_deletedRecords and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Domain/Model/DeletedRecords.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/model/class.tx_recycler_model_tables.php b/typo3/sysext/recycler/classes/model/class.tx_recycler_model_tables.php
deleted file mode 100644 (file)
index 6550a1e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
- ***************************************************************/
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/model/class.tx_recycler_model_deletedRecords.php');
-/*
- * @deprecated since 6.0, the classname tx_recycler_model_tables and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/recycler/Classes/Domain/Model/Tables.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Domain/Model/Tables.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/recycler/classes/view/class.tx_recycler_view_deletedRecords.php b/typo3/sysext/recycler/classes/view/class.tx_recycler_view_deletedRecords.php
deleted file mode 100644 (file)
index ba0c14e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Julian Kleinhans <typo3@kj187.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 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!
- ***************************************************************/
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler', 'classes/helper/class.tx_recycler_helper.php');
-/*
- * @deprecated since 6.0, the classname tx_recycler_view_deletedRecords and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'Classes/Controller/DeletedRecordsController.php';
-?>
\ No newline at end of file
index 91540f6..87160f0 100644 (file)
@@ -2,5 +2,5 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
-$TYPO3_CONF_VARS['BE']['AJAX']['tx_recycler::controller'] = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'classes/controller/class.tx_recycler_controller_ajax.php:TYPO3\\CMS\\Recycler\\Controller\\RecyclerAjaxController->init';
+$TYPO3_CONF_VARS['BE']['AJAX']['RecyclerAjaxController::init'] = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'Classes/Controller/class.tx_recycler_controller_ajax.php:TYPO3\\CMS\\Recycler\\Controller\\RecyclerAjaxController->init';
 ?>
\ No newline at end of file