[TASK] Migrate ext:belog to extbase
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 13 Mar 2012 07:09:22 +0000 (08:09 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 10 Apr 2012 13:27:46 +0000 (15:27 +0200)
Change-Id: I1d61119394d00417a9a033f25146fc0d5096d853
Resolves: #34772
Releases: 6.0
Reviewed-on: http://review.typo3.org/9729
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
57 files changed:
t3lib/class.t3lib_bedisplaylog.php
t3lib/stddb/tables.php
t3lib/stddb/tables.sql
t3lib/stddb/tbl_be.php
typo3/sysext/belog/Classes/Controller/AbstractController.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Controller/ToolsController.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Controller/WebInfoController.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Model/BackendUser.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Model/Constraint.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Model/HistoryEntry.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Model/LogEntry.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Model/Workspace.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Repository/BackendUserRepository.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Repository/HistoryEntryRepository.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php [new file with mode: 0644]
typo3/sysext/belog/Classes/Domain/Repository/WorkspaceRepository.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/Be/AddJsFileViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/Be/InlineSettingsArrayViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/Be/PagePathViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/Form/TranslateLabelSelectViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/FormatDetailsViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/HistoryEntryViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/UsernameViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/ViewHelpers/WorkspaceTitleViewHelper.php [new file with mode: 0644]
typo3/sysext/belog/Classes/class.tx_belog_webinfo_bootstrap.php [new file with mode: 0644]
typo3/sysext/belog/Configuration/TypoScript/setup.txt [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/.htaccess [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Language/locallang.xlf [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Language/locallang_mod.xlf [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Layouts/DocHeader.html [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Partials/Content.html [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html [new file with mode: 0644]
typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html [new file with mode: 0644]
typo3/sysext/belog/Tests/Unit/Domain/Model/LogEntryTest.php [new file with mode: 0644]
typo3/sysext/belog/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php [new file with mode: 0644]
typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php [new file with mode: 0644]
typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php [new file with mode: 0644]
typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php [new file with mode: 0644]
typo3/sysext/belog/class.tx_belog_webinfo.php [deleted file]
typo3/sysext/belog/doc/TODO.txt [deleted file]
typo3/sysext/belog/ext_emconf.php
typo3/sysext/belog/ext_tables.php
typo3/sysext/belog/ext_typoscript_setup.txt [new file with mode: 0644]
typo3/sysext/belog/locallang.xlf [deleted file]
typo3/sysext/belog/mod/clear.gif [deleted file]
typo3/sysext/belog/mod/conf.php [deleted file]
typo3/sysext/belog/mod/index.php [deleted file]
typo3/sysext/belog/mod/locallang.xlf [deleted file]
typo3/sysext/belog/mod/locallang_mod.xlf [deleted file]
typo3/sysext/belog/mod/log.gif [deleted file]
typo3/sysext/install/updates/class.tx_coreupdates_installfluidextbase.php
typo3/sysext/lang/locallang_tca.xlf
typo3/template.php

index a004e08..95f93b0 100644 (file)
@@ -42,6 +42,7 @@
  * @package TYPO3
  * @subpackage t3lib
  * @see tx_belog_webinfo, SC_mod_tools_log_index
+ * @deprecated and unused since TYPO3 6.0, will be removed two versions later
  */
 class t3lib_BEDisplayLog {
        var $lastTimeLabel = '';
@@ -63,6 +64,15 @@ class t3lib_BEDisplayLog {
        var $be_user_Array = array(); // Username array (set externally)
 
        /**
+        * Default constructor logs deprecation
+        *
+        * @deprecated since TYPO3 6.0, will be removed in two versions.
+        */
+       public function __construct() {
+               t3lib_div::logDeprecatedFunction();
+       }
+
+       /**
         * Initialize the log table array with header labels.
         *
         * @return      array
index 83c05dd..adfa1fe 100644 (file)
@@ -312,6 +312,23 @@ $TCA['sys_collection'] = array(
 );
 
 /**
+ * Table "sys_history":
+ * Holds history records, the config part is defined in t3lib/stddb/tbl_be.php
+ */
+$TCA['sys_history'] = array(
+       'ctrl' => array(
+               'title' => 'LLL:EXT:lang/locallang_tca.xlf:sys_history',
+               'label' => 'tablename',
+               'tstamp' => 'tstamp',
+               'adminOnly' => TRUE,
+               'rootLevel' => TRUE,
+               'hideTable' => TRUE,
+               'default_sortby' => 'uid DESC',
+               'dynamicConfigFile' => 'T3LIB:tbl_be.php',
+       ),
+);
+
+/**
  * Table "sys_languages":
  * Defines possible languages used for translation of records in the system
  * This is only the 'header' part (ctrl). The full configuration is found in t3lib/stddb/tbl_be.php
@@ -335,6 +352,22 @@ $TCA['sys_language'] = array(
        )
 );
 
+/**
+ * Table "sys_log":
+ * Holds log records, the config part is defined in t3lib/stddb/tbl_be.php
+ */
+$TCA['sys_log'] = array(
+       'ctrl' => array(
+               'title' => 'LLL:EXT:lang/locallang_tca.xlf:sys_log',
+               'label' => 'details',
+               'tstamp' => 'tstamp',
+               'adminOnly' => TRUE,
+               'rootLevel' => TRUE,
+               'hideTable' => TRUE,
+               'default_sortby' => 'uid DESC',
+               'dynamicConfigFile' => 'T3LIB:tbl_be.php',
+       ),
+);
 
 /**
  * Table "sys_news":
index d297190..bc60488 100644 (file)
@@ -308,6 +308,7 @@ CREATE TABLE sys_collection_entries (
 #
 CREATE TABLE sys_history (
   uid int(11) unsigned NOT NULL auto_increment,
+  pid int(11) unsigned DEFAULT '0' NOT NULL,
   sys_log_uid int(11) DEFAULT '0' NOT NULL,
   history_data mediumtext,
   fieldlist text,
@@ -317,6 +318,7 @@ CREATE TABLE sys_history (
   history_files mediumtext,
   snapshot tinyint(4) DEFAULT '0' NOT NULL,
   PRIMARY KEY (uid),
+  KEY parent (pid),
   KEY recordident_1 (tablename,recuid),
   KEY recordident_2 (tablename,tstamp),
   KEY sys_log_uid (sys_log_uid)
@@ -366,6 +368,7 @@ CREATE TABLE sys_refindex (
 #
 CREATE TABLE sys_log (
   uid int(11) unsigned NOT NULL auto_increment,
+  pid int(11) unsigned DEFAULT '0' NOT NULL,
   userid int(11) unsigned DEFAULT '0' NOT NULL,
   action tinyint(4) unsigned DEFAULT '0' NOT NULL,
   recuid int(11) unsigned DEFAULT '0' NOT NULL,
@@ -382,6 +385,7 @@ CREATE TABLE sys_log (
   workspace int(11) DEFAULT '0' NOT NULL,
   NEWid varchar(20) DEFAULT '' NOT NULL,
   PRIMARY KEY (uid),
+  KEY parent (pid),
   KEY event (userid,event_pid),
   KEY recuidIdx (recuid,uid),
   KEY user_auth (type,action,tstamp)
index 304ebc1..6412bd2 100644 (file)
@@ -867,6 +867,68 @@ $TCA['sys_collection'] = array(
 );
 
 /**
+ * System log history - keeps a trail of record edits
+ */
+$TCA['sys_history'] = array(
+       'ctrl' => $TCA['sys_history']['ctrl'],
+       'columns' => array(
+               'sys_log_uid' => array(
+                       'label' => 'sys_log_uid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'history_data' => array(
+                       'label' => 'history_data',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'fieldlist' => array(
+                       'label' => 'fieldlist',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'recuid' => array(
+                       'label' => 'recuid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'tablename' => array(
+                       'label' => 'tablename',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'tstamp' => array(
+                       'label' => 'tstamp',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'history_files' => array(
+                       'label' => 'history_files',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'snapshot' => array(
+                       'label' => 'snapshot',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+       ),
+       'types' => array(
+               '1' => array(
+                       'showitem' => 'sys_log_uid, history_data, fieldlist, recuid, tablename, tstamp, history_files, snapshot',
+               ),
+       ),
+);
+
+/**
  * System languages - Defines possible languages used for translation of records in the system
  */
 $TCA['sys_language'] = array(
@@ -927,6 +989,109 @@ $TCA['sys_language'] = array(
        )
 );
 
+/**
+ * System log
+ */
+$TCA['sys_log'] = array(
+       'ctrl' => $TCA['sys_log']['ctrl'],
+       'columns' => array(
+               'tstamp' => array(
+                       'label' => 'tstamp',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'userid' => array(
+                       'label' => 'userid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'action' => array(
+                       'label' => 'action',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'recuid' => array(
+                       'label' => 'recuid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'tablename' => array(
+                       'label' => 'tablename',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'recpid' => array(
+                       'label' => 'recpid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'error' => array(
+                       'label' => 'error',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'details' => array(
+                       'label' => 'details',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'type' => array(
+                       'label' => 'type',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'detail_nr' => array(
+                       'label' => 'detail_nr',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'IP' => array(
+                       'label' => 'IP',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'log_data' => array(
+                       'label' => 'log_data',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'event_pid' => array(
+                       'label' => 'event_pid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'workspace' => array(
+                       'label' => 'workspace',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+               'NEWid' => array(
+                       'label' => 'NEWid',
+                       'config' => array(
+                               'type' => 'input',
+                       ),
+               ),
+       ),
+       'types' => array(
+               '1' => array(
+                       'showitem' => 'tstamp, userid, action, recuid, tablename, recpid, error, details, type, details_nr, IP, log_data, event_pid, workspace, NEWid',
+               ),
+       ),
+);
 
 /**
  * System News (displayed on Login screen)
diff --git a/typo3/sysext/belog/Classes/Controller/AbstractController.php b/typo3/sysext/belog/Classes/Controller/AbstractController.php
new file mode 100644 (file)
index 0000000..15d2a07
--- /dev/null
@@ -0,0 +1,405 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Abstract class to show log entries from sys_log
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+abstract class Tx_Belog_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController {
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_THISWEEK = 0;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_LASTWEEK = 1;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_LASTSEVENDAYS = 2;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_THISMONTH = 10;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_LASTMONTH = 11;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_LAST31DAYS = 12;
+       /**
+        * @var integer
+        */
+       const TIMEFRAME_CUSTOM = 30;
+
+       /**
+        * whether plugin is running in page context (sub module of Web > Info)
+        *
+        * @var boolean
+        */
+       protected $isInPageContext = FALSE;
+
+       /**
+        * page ID in page context
+        *
+        * @var integer
+        */
+       protected $pageId = 0;
+
+       /**
+        * @var Tx_Belog_Domain_Repository_LogEntryRepository
+        */
+       protected $logEntryRepository = NULL;
+
+       /**
+        * Injects the log entry repository.
+        *
+        * @param Tx_Belog_Domain_Repository_LogEntryRepository $logEntryRepository
+        * @return void
+        */
+       public function injectLogEntryRepository(Tx_Belog_Domain_Repository_LogEntryRepository $logEntryRepository) {
+               $this->logEntryRepository = $logEntryRepository;
+       }
+
+       /**
+        * Initialize index action
+        *
+        * @return void
+        */
+       public function initializeIndexAction() {
+                       // @TODO: Extbase backend modules rely on frontend TypoScript for view, persistence
+                       // and settings. Thus, we need a TypoScript root template, that then loads the
+                       // ext_typoscript_setup.txt file of this module. This is nasty, but can not be
+                       // circumvented until there is a better solution in extbase.
+                       // For now we throw an exception if no settings are detected.
+               if (empty($this->settings)) {
+                       throw new RuntimeException(
+                               'No settings detected. This usually happens if there is no frontend TypoScript template with root flag set. ' .
+                                       'Please create one.',
+                               1333650506
+                       );
+               }
+
+               if (!isset($this->settings['dateFormat'])) {
+                       $this->settings['dateFormat'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
+               }
+               if (!isset($this->settings['timeFormat'])) {
+                       $this->settings['timeFormat'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
+               }
+
+                       // @TODO: The dateTime property mapper throws exceptions that cannot be caught
+                       // if the property is not given in the expected format. This is documented with
+                       // issue http://forge.typo3.org/issues/33861. Depending on the outcome of the
+                       // ticket, the code below might have to be adapted again.
+                       // @TODO: There is a second solution to hint the property mapper with fluid on the expected
+                       // format: <f:form.hidden property="manualDateStart.dateFormat" value="..." />. This
+                       // could make the method below obsolete.
+               $this->configurePropertyMapperForDateTimeFormat($this->arguments['constraint']->getPropertyMappingConfiguration()->forProperty('manualDateStart'));
+               $this->configurePropertyMapperForDateTimeFormat($this->arguments['constraint']->getPropertyMappingConfiguration()->forProperty('manualDateStop'));
+       }
+
+       /**
+        * Show general information and the installed modules
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return void
+        */
+       public function indexAction(Tx_Belog_Domain_Model_Constraint $constraint = NULL) {
+                       // Constraint object handling:
+                       // If there is none from GET, try to get it from BE user data, else create new
+               if ($constraint === NULL) {
+                       $constraint = $this->getConstraintFromBeUserData();
+                       if ($constraint === NULL) {
+                               $constraint = $this->objectManager->create('Tx_Belog_Domain_Model_Constraint');
+                       }
+               } else {
+                       $this->persistConstraintInBeUserData($constraint);
+               }
+               $constraint->setIsInPageContext($this->isInPageContext);
+               $constraint->setPageId($this->pageId);
+               $this->setStartAndEndTimeFromTimeSelector($constraint);
+               $this->forceWorkspaceSelectionIfInWorkspace($constraint);
+
+               $logEntries = $this->logEntryRepository->findByConstraint($constraint);
+               $groupedLogEntries = $this->groupLogEntriesByPageAndDay($logEntries, $constraint->getGroupByPage());
+
+               $this->view
+                       ->assign('groupedLogEntries', $groupedLogEntries)
+                       ->assign('constraint', $constraint)
+                       ->assign('userGroups', $this->createUserAndGroupListForSelectOptions())
+                       ->assign('workspaces', $this->createWorkspaceListForSelectOptions())
+                       ->assign('pageDepths', $this->createPageDepthOptions());
+       }
+
+       /**
+        * Get module states (the constraint object) from user data
+        *
+        * @return Tx_Belog_Domain_Model_Constraint|NULL
+        */
+       protected function getConstraintFromBeUserData() {
+               $serializedConstraint = $GLOBALS['BE_USER']->getModuleData(get_class($this));
+               if (!is_string($serializedConstraint) || empty($serializedConstraint)) {
+                       return NULL;
+               }
+
+               return @unserialize($serializedConstraint);
+       }
+
+       /**
+        * Save current constraint object in be user settings (uC)
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return void
+        */
+       protected function persistConstraintInBeUserData(Tx_Belog_Domain_Model_Constraint $constraint) {
+               $GLOBALS['BE_USER']->pushModuleData(get_class($this), serialize($constraint));
+       }
+
+       /**
+        * Create a sorted array for day and page view from
+        * the query result of the sys log repository.
+        *
+        * If group by page is FALSE, pid is always -1 (will render a flat list),
+        * otherwise the output is splitted by pages.
+        * '12345' is a sub array to split entries by day, number is first second of day
+        *
+        * [pid][dayTimestamp][items]
+        *
+        * @param Tx_Extbase_Persistence_QueryResult<Tx_Belog_Domain_Model_LogEntry> $logEntries
+        * @param boolean $groupByPage Wether or not log entries should be grouped by page
+        * @return array
+        */
+       protected function groupLogEntriesByPageAndDay(Tx_Extbase_Persistence_QueryResult $logEntries, $groupByPage = FALSE) {
+               $targetStructure = array();
+
+                       /** @var $entry Tx_Belog_Domain_Model_LogEntry */
+               foreach ($logEntries as $entry) {
+                               // Create page split list or flat list
+                       if ($groupByPage) {
+                               $pid = $entry->getEventPid();
+                       } else {
+                               $pid = -1;
+                       }
+
+                               // Create array if it is not defined yet
+                       if (!is_array($targetStructure[$pid])) {
+                               $targetStructure[$pid] = array();
+                       }
+
+                               // Get day timestamp of log entry and create sub array if needed
+                       $timestampDay = strtotime(strftime('%d.%m.%Y', $entry->getTstamp()));
+                       if (!is_array($targetStructure[$pid][$timestampDay])) {
+                               $targetStructure[$pid][$timestampDay] = array();
+                       }
+
+                               // Add row
+                       $targetStructure[$pid][$timestampDay][] = $entry;
+               }
+
+               ksort($targetStructure);
+
+               return $targetStructure;
+       }
+
+       /**
+        * Configure the property mapper to expect date strings in configured BE format
+        *
+        * @param Tx_Extbase_Property_PropertyMappingConfiguration $propertyMapperDate
+        * @return void
+        */
+       protected function configurePropertyMapperForDateTimeFormat(Tx_Extbase_Property_PropertyMappingConfiguration $propertyMapperDate) {
+               $propertyMapperDate->setTypeConverterOption(
+                       'Tx_Extbase_Property_TypeConverter_DateTimeConverter',
+                       Tx_Extbase_Property_TypeConverter_DateTimeConverter::CONFIGURATION_DATE_FORMAT,
+                       $this->settings['dateFormat'] . ' ' . $this->settings['timeFormat']
+               );
+       }
+
+       /**
+        * Create options for the user / group drop down.
+        * This is not moved to a repository by intention to not mix up this 'meta' data
+        * with real repository work
+        *
+        * @return array Key is the option name, value its label
+        */
+       protected function createUserAndGroupListForSelectOptions() {
+               $userGroupArray = array();
+
+                       // Two meta entries: 'all' and 'self'
+               $userGroupArray[0] = Tx_Extbase_Utility_Localization::translate('allUsers', 'Belog');
+               $userGroupArray[-1] = Tx_Extbase_Utility_Localization::translate('self', 'Belog');
+
+                       // List of groups, key is gr-'uid'
+               $groups = t3lib_BEfunc::getGroupNames();
+               foreach ($groups as $group) {
+                       $userGroupArray['gr-' . $group['uid']] = Tx_Extbase_Utility_Localization::translate('group', 'Belog') . ' ' . $group['title'];
+               }
+
+                       // List of users, key is us-'uid'
+               $users = t3lib_BEfunc::getUserNames();
+               foreach ($users as $user) {
+                       $userGroupArray['us-' . $user['uid']] = Tx_Extbase_Utility_Localization::translate('user', 'Belog') . ' ' . $user['username'];
+               }
+
+               return $userGroupArray;
+       }
+
+       /**
+        * Create options for the workspace selector
+        *
+        * @return array Key is uid of workspace, value its label
+        */
+       protected function createWorkspaceListForSelectOptions() {
+               if (!t3lib_extMgm::isLoaded('workspaces')) {
+                       return array();
+               }
+
+               $workspaceArray = array();
+                       // Two meta entries: 'all' and 'live'
+               $workspaceArray[-99] = Tx_Extbase_Utility_Localization::translate('any', 'Belog');
+               $workspaceArray[0] = Tx_Extbase_Utility_Localization::translate('live', 'Belog');
+
+               $workspaces = $this->objectManager->get('Tx_Belog_Domain_Repository_WorkspaceRepository')->findAll();
+                       /** @var $workspace Tx_Belog_Domain_Model_Workspace */
+               foreach ($workspaces as $workspace) {
+                       $workspaceArray[$workspace->getUid()] = $workspace->getUid() . ': ' . $workspace->getTitle();
+               }
+
+               return $workspaceArray;
+       }
+
+       /**
+        * If the user is in a workspace different than LIVE,
+        * we force to show only log entries from the selected workspace,
+        * and the workspace selector is not shown.
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return void
+        */
+       protected function forceWorkspaceSelectionIfInWorkspace(Tx_Belog_Domain_Model_Constraint $constraint) {
+               if ($GLOBALS['BE_USER']->workspace !== 0) {
+                       $constraint->setWorkspaceUid($GLOBALS['BE_USER']->workspace);
+                       $this->view->assign('showWorkspaceSelector', FALSE);
+               } else {
+                       $this->view->assign('showWorkspaceSelector', TRUE);
+               }
+       }
+
+       /**
+        * Create options for the 'depth of page levels' selector.
+        * This is shown if the module is displayed in page -> info
+        *
+        * @return array Key is depth identifier (1 = One level), value the localized select option label
+        */
+       protected function createPageDepthOptions() {
+               $options = array(
+                       0 => Tx_Extbase_Utility_Localization::translate(
+                               'LLL:EXT:lang/locallang_mod_web_info.xlf:depth_0',
+                               'lang'
+                       ),
+                       1 => Tx_Extbase_Utility_Localization::translate(
+                               'LLL:EXT:lang/locallang_mod_web_info.xlf:depth_1',
+                               'lang'
+                       ),
+                       2 => Tx_Extbase_Utility_Localization::translate(
+                               'LLL:EXT:lang/locallang_mod_web_info.xlf:depth_2',
+                               'lang'
+                       ),
+                       3 => Tx_Extbase_Utility_Localization::translate(
+                               'LLL:EXT:lang/locallang_mod_web_info.xlf:depth_3',
+                               'lang'
+                       )
+               );
+
+               return $options;
+       }
+
+       /**
+        * Calculate the start- and end timestamp from the different time selector options
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return void
+        */
+       protected function setStartAndEndTimeFromTimeSelector(Tx_Belog_Domain_Model_Constraint $constraint) {
+               $startTime = 0;
+               $endTime = $GLOBALS['EXEC_TIME'];
+
+                       // @TODO: Refactor this construct
+               switch ($constraint->getTimeFrame()) {
+                       case self::TIMEFRAME_THISWEEK:
+                                       // This week
+                               $week = (date('w') ?: 7) - 1;
+                               $startTime = mktime(0, 0, 0) - $week * 3600 * 24;
+                               break;
+                       case self::TIMEFRAME_LASTWEEK:
+                                       // Last week
+                               $week = (date('w') ?: 7) - 1;
+                               $startTime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24;
+                               $endTime = mktime(0, 0, 0) - $week * 3600 * 24;
+                               break;
+                       case self::TIMEFRAME_LASTSEVENDAYS:
+                                       // Last 7 days
+                               $startTime = mktime(0, 0, 0) - 7 * 3600 * 24;
+                               break;
+                       case self::TIMEFRAME_THISMONTH:
+                                       // This month
+                               $startTime = mktime(0, 0, 0, date('m'), 1);
+                               break;
+                       case self::TIMEFRAME_LASTMONTH:
+                                       // Last month
+                               $startTime = mktime(0, 0, 0, date('m') - 1, 1);
+                               $endTime = mktime(0, 0, 0, date('m'), 1);
+                               break;
+                       case self::TIMEFRAME_LAST31DAYS:
+                                       // Last 31 days
+                               $startTime = mktime(0, 0, 0) - 31 * 3600 * 24;
+                               break;
+                       case self::TIMEFRAME_CUSTOM:
+                               if ($constraint->getManualDateStart() instanceof DateTime) {
+                                       $startTime = $constraint->getManualDateStart()->format('U');
+                                       if ($constraint->getManualDateStop() instanceof DateTime) {
+                                               $manualEndTime = $constraint->getManualDateStop()->format('U');
+                                               if ($manualEndTime > $startTime) {
+                                                       $endTime = $manualEndTime;
+                                               }
+                                       } else {
+                                               $endTime = $GLOBALS['EXEC_TIME'];
+                                       }
+                               }
+                               break;
+                       default:
+               }
+               $constraint->setStartTimestamp($startTime);
+               $constraint->setEndTimestamp($endTime);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Controller/ToolsController.php b/typo3/sysext/belog/Classes/Controller/ToolsController.php
new file mode 100644 (file)
index 0000000..cfa5e3c
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Show log entries from table sys_log
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Controller_ToolsController extends Tx_Belog_Controller_AbstractController {
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Controller/WebInfoController.php b/typo3/sysext/belog/Classes/Controller/WebInfoController.php
new file mode 100644 (file)
index 0000000..caa09de
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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 for log entry listings in Web->Info module
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Controller_WebInfoController extends Tx_Belog_Controller_AbstractController {
+       /**
+        * Set context to 'in page mode'
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               $this->isInPageContext = TRUE;
+               $this->pageId = intval(t3lib_div::_GP('id'));
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Model/BackendUser.php b/typo3/sysext/belog/Classes/Domain/Model/BackendUser.php
new file mode 100644 (file)
index 0000000..0edd0f7
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Stub model for backend users - only properties required for belog module are added currently
+ * @TODO: This should be extended and put at some more central place
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Model_BackendUser extends Tx_Extbase_DomainObject_AbstractEntity {
+       /**
+        * name of the BE user
+        *
+        * @var string
+        */
+       protected $username = '';
+
+       /**
+        * Set backend username
+        *
+        * @param string $username
+        * @return void
+        */
+       public function setUsername($username) {
+               $this->username = $username;
+       }
+
+       /**
+        * Get backend username
+        *
+        * @return string
+        */
+       public function getUsername() {
+               return $this->username;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Model/Constraint.php b/typo3/sysext/belog/Classes/Domain/Model/Constraint.php
new file mode 100644 (file)
index 0000000..dcb23a1
--- /dev/null
@@ -0,0 +1,379 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Constraints for log entries
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Model_Constraint extends Tx_Extbase_DomainObject_AbstractEntity {
+       /**
+        * Selected user/group; possible values are "gr-<uid>" for a group, "us-<uid>" for a user or -1 for "all users"
+        *
+        * @var string
+        */
+       protected $userOrGroup = '0';
+
+       /**
+        * number of log rows to show
+        *
+        * @var integer
+        */
+       protected $number = 20;
+
+       /**
+        * UID of selected workspace
+        *
+        * @var integer
+        */
+       protected $workspaceUid = Tx_Belog_Domain_Model_Workspace::UID_ANY_WORKSPACE;
+
+       /**
+        * selected time frame
+        *
+        * @var integer
+        */
+       protected $timeFrame = 0;
+
+       /**
+        * selected action
+        *
+        * @var integer
+        */
+       protected $action = 0;
+
+       /**
+        * whether rows should be grouped by page
+        *
+        * @var boolean
+        */
+       protected $groupByPage = FALSE;
+
+       /**
+        * manual date start
+        *
+        * @var DateTime
+        */
+       protected $manualDateStart = NULL;
+
+       /**
+        * manual date stop
+        *
+        * @var DateTime
+        */
+       protected $manualDateStop = NULL;
+
+       /**
+        * calculated start timestamp
+        *
+        * @var integer
+        */
+       protected $startTimestamp = 0;
+
+       /**
+        * calculated end timestamp
+        *
+        * @var integer
+        */
+       protected $endTimestamp = 0;
+
+       /**
+        * whether the plugin is called in page context (submodule of Web > Info)
+        *
+        * @var boolean
+        */
+       protected $isInPageContext = FALSE;
+
+       /**
+        * selected page ID in page context
+        *
+        * @var integer
+        */
+       protected $pageId = 0;
+
+       /**
+        * page level depth
+        *
+        * @var integer
+        */
+       protected $depth = 0;
+
+       /**
+        * Default constructor
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Set user
+        *
+        * @param string $user
+        * @return void
+        */
+       public function setUserOrGroup($user) {
+               $this->userOrGroup = $user;
+       }
+
+       /**
+        * Get user
+        *
+        * @return string
+        */
+       public function getUserOrGroup() {
+               return $this->userOrGroup;
+       }
+
+       /**
+        * Set number of log rows to show
+        *
+        * @param integer $number
+        * @return void
+        */
+       public function setNumber($number) {
+               $this->number = intval($number);
+       }
+
+       /**
+        * Get number of log entries to show
+        *
+        * @return integer
+        */
+       public function getNumber() {
+               return $this->number;
+       }
+
+       /**
+        * Set workspace
+        *
+        * @param string $workspace
+        * @return void
+        */
+       public function setWorkspaceUid($workspace) {
+               $this->workspaceUid = $workspace;
+       }
+
+       /**
+        * Get workspace
+        *
+        * @return string
+        */
+       public function getWorkspaceUid() {
+               return $this->workspaceUid;
+       }
+
+       /**
+        * Set time frame
+        *
+        * @param integer $timeFrame
+        * @return void
+        */
+       public function setTimeFrame($timeFrame) {
+               $this->timeFrame = $timeFrame;
+       }
+
+       /**
+        * Get time frame
+        *
+        * @return integer
+        */
+       public function getTimeFrame() {
+               return intval($this->timeFrame);
+       }
+
+       /**
+        * Set action
+        *
+        * @param integer $action
+        * @return void
+        */
+       public function setAction($action) {
+               $this->action = $action;
+       }
+
+       /**
+        * Get action
+        *
+        * @return integer
+        */
+       public function getAction() {
+               return intval($this->action);
+       }
+
+       /**
+        * Set group by page
+        *
+        * @param boolean $groupByPage
+        * @return void
+        */
+       public function setGroupByPage($groupByPage) {
+               $this->groupByPage = $groupByPage;
+       }
+
+       /**
+        * Get group by page
+        *
+        * @return boolean
+        */
+       public function getGroupByPage() {
+               return (boolean)$this->groupByPage;
+       }
+
+       /**
+        * Set manual date start
+        *
+        * @param DateTime $manualDateStart
+        * @return void
+        */
+       public function setManualDateStart(DateTime $manualDateStart) {
+               $this->manualDateStart = $manualDateStart;
+       }
+
+       /**
+        * Get manual date start
+        *
+        * @return DateTime
+        */
+       public function getManualDateStart() {
+               return $this->manualDateStart;
+       }
+
+       /**
+        * Set manual date stop
+        *
+        * @param DateTime $manualDateStop
+        * @return void
+        */
+       public function setManualDateStop(DateTime $manualDateStop) {
+               $this->manualDateStop = $manualDateStop;
+       }
+
+       /**
+        * Get manual date stop
+        *
+        * @return DateTime
+        */
+       public function getManualDateStop() {
+               return $this->manualDateStop;
+       }
+
+       /**
+        * Set calculated start timestamp from query constraints
+        *
+        * @param integer $timestamp
+        * @return void
+        */
+       public function setStartTimestamp($timestamp) {
+               $this->startTimestamp = intval($timestamp);
+       }
+
+       /**
+        * Get calculated start timestamp from query constraints
+        *
+        * @return integer
+        */
+       public function getStartTimestamp() {
+               return $this->startTimestamp;
+       }
+
+       /**
+        * Set calculated end timestamp from query constraints
+        *
+        * @param integer $timestamp
+        * @return void
+        */
+       public function setEndTimestamp($timestamp) {
+               $this->endTimestamp = intval($timestamp);
+       }
+
+       /**
+        * Get calculated end timestamp from query constraints
+        *
+        * @return integer
+        */
+       public function getEndTimestamp() {
+               return $this->endTimestamp;
+       }
+
+       /**
+        * Set page context
+        *
+        * @param boolean $pageContext
+        * @return void
+        */
+       public function setIsInPageContext($pageContext) {
+               $this->isInPageContext = $pageContext;
+       }
+
+       /**
+        * Get page context
+        *
+        * @return boolean
+        */
+       public function getIsInPageContext() {
+               return (boolean)$this->isInPageContext;
+       }
+
+       /**
+        * Set page id
+        *
+        * @param integer $id
+        * @return void
+        */
+       public function setPageId($id) {
+               $this->pageId = intval($id);
+       }
+
+       /**
+        * Get page id
+        *
+        * @return integer
+        */
+       public function getPageId() {
+               return $this->pageId;
+       }
+
+       /**
+        * Set page level depth
+        *
+        * @param integer $depth
+        * @return void
+        */
+       public function setDepth($depth) {
+               $this->depth = $depth;
+       }
+
+       /**
+        * Get page level depth
+        *
+        * @return integer
+        */
+       public function getDepth() {
+               return intval($this->depth);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Model/HistoryEntry.php b/typo3/sysext/belog/Classes/Domain/Model/HistoryEntry.php
new file mode 100644 (file)
index 0000000..24e973f
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Stub model for sys history - only properties required for belog module are added currently
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Model_HistoryEntry extends Tx_Extbase_DomainObject_AbstractEntity {
+       /**
+        * list of changed fields
+        *
+        * @var string
+        */
+       protected $fieldlist = '';
+
+       /**
+        * Set list of changed fields
+        *
+        * @param string $fieldlist
+        * @return void
+        */
+       public function setFieldlist($fieldlist) {
+               // TODO think about exploding this to an array
+               $this->fieldlist = $fieldlist;
+       }
+
+       /**
+        * Get field list
+        *
+        * @return string
+        */
+       public function getFieldlist() {
+               return $this->fieldlist;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Model/LogEntry.php b/typo3/sysext/belog/Classes/Domain/Model/LogEntry.php
new file mode 100644 (file)
index 0000000..bb8beb3
--- /dev/null
@@ -0,0 +1,466 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * A sys log entry
+ * This model is 'complete': All current database properties are in there.
+ * @TODO: This should be stuffed to some more central place
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Model_LogEntry extends Tx_Extbase_DomainObject_AbstractEntity {
+       /**
+        * storage page ID of the log entry
+        *
+        * @var integer
+        */
+       protected $pid = 0;
+
+       /**
+        * This is not a relation to BeUser model, since the user does
+        * not always exist, but we want the uid in then anyway.
+        * This case is ugly in extbase, the best way we
+        * have found now is to resolve the username (if it exists) in a
+        * view helper and just use the uid of the be user here.
+        *
+        * @var integer
+        */
+       protected $backendUserUid = 0;
+
+       /**
+        * action ID of the action that happened, for example 3 was a file action
+        *
+        * @var integer
+        */
+       protected $action = 0;
+
+       /**
+        * UID of the record the event happened to
+        *
+        * @var integer
+        */
+       protected $recordUid = 0;
+
+       /**
+        * table name
+        *
+        * @var string
+        */
+       protected $tableName = 0;
+
+       /**
+        * PID of the record the event happened to
+        *
+        * @var integer
+        */
+       protected $recordPid = 0;
+
+       /**
+        * error code
+        *
+        * @var integer
+        */
+       protected $error = 0;
+
+       /**
+        * This is the log message itself, but possibly with %s substitutions.
+        *
+        * @var string
+        */
+       protected $details = '';
+
+       /**
+        * timestamp when the log entry was written
+        *
+        * @var integer
+        */
+       protected $tstamp = 0;
+
+       /**
+        * type code
+        *
+        * @var integer
+        */
+       protected $type = 0;
+
+       /**
+        * details number
+        *
+        * @var integer
+        */
+       protected $detailsNumber = 0;
+
+       /**
+        * IP address of client
+        *
+        * @var string
+        */
+       protected $ip = '';
+
+       /**
+        * Serialized log data. This is a serialized array with substitutions for $this->details.
+        *
+        * @var string
+        */
+       protected $logData = '';
+
+       /**
+        * event PID
+        *
+        * @var integer
+        */
+       protected $eventPid = 0;
+
+       /**
+        * This is only the UID and not the full workspace object for the same reason as in $beUserUid.
+        *
+        * @var integer
+        */
+       protected $workspaceUid = 0;
+
+       /**
+        * new ID
+        *
+        * @var string
+        */
+       protected $newId = 0;
+
+       /**
+        * Set pid
+        *
+        * @param integer $pid
+        * @return void
+        */
+       public function setPid($pid) {
+               $this->pid = intval($pid);
+       }
+
+       /**
+        * Get pid
+        *
+        * @return integer
+        */
+       public function getPid() {
+               return $this->pid;
+       }
+
+       /**
+        * Set backend user uid
+        *
+        * @param integer $beUserUid
+        * @return void
+        */
+       public function setBackendUserUid($beUserUid) {
+               $this->backendUserUid = $beUserUid;
+       }
+
+       /**
+        * Get backend user id
+        *
+        * @return integer
+        */
+       public function getBackendUserUid() {
+               return $this->backendUserUid;
+       }
+
+       /**
+        * Set action
+        *
+        * @param integer $action
+        * @return void
+        */
+       public function setAction($action) {
+               $this->action = $action;
+       }
+
+       /**
+        * Get action
+        *
+        * @return integer
+        */
+       public function getAction() {
+               return intval($this->action);
+       }
+
+       /**
+        * Set record uid
+        *
+        * @param integer $recordUid
+        * @return void
+        */
+       public function setRecordUid($recordUid) {
+               $this->recordUid = $recordUid;
+       }
+
+       /**
+        * Get record uid
+        *
+        * @return integer
+        */
+       public function getRecordUid() {
+               return intval($this->recordUid);
+       }
+
+       /**
+        * Set table name
+        *
+        * @param string $tableName
+        * @return void
+        */
+       public function setTableName($tableName) {
+               $this->tableName = $tableName;
+       }
+
+       /**
+        * Get table name
+        *
+        * @return string
+        */
+       public function getTableName() {
+               return $this->tableName;
+       }
+
+       /**
+        * Set record pid
+        *
+        * @param integer $recordPid
+        * @return void
+        */
+       public function setRecordPid($recordPid) {
+               $this->recordPid = $recordPid;
+       }
+
+       /**
+        * Get record pid
+        *
+        * @return integer
+        */
+       public function getRecordPid() {
+               return intval($this->recordPid);
+       }
+
+       /**
+        * Set error
+        *
+        * @param integer $error
+        * @return void
+        */
+       public function setError($error) {
+               $this->error = $error;
+       }
+
+       /**
+        * Get error
+        *
+        * @return integer
+        */
+       public function getError() {
+               return intval($this->error);
+       }
+
+       /**
+        * Set details
+        *
+        * @param string $details
+        * @return void
+        */
+       public function setDetails($details) {
+               $this->details = $details;
+       }
+
+       /**
+        * Get details
+        *
+        * @return string
+        */
+       public function getDetails() {
+               return $this->details;
+       }
+
+       /**
+        * Set tstamp
+        *
+        * @param integer $tstamp
+        * @return void
+        */
+       public function setTstamp($tstamp) {
+               $this->tstamp = $tstamp;
+       }
+
+       /**
+        * Get tstamp
+        *
+        * @return integer
+        */
+       public function getTstamp() {
+               return intval($this->tstamp);
+       }
+
+       /**
+        * Set type
+        *
+        * @param integer $type
+        * @return void
+        */
+       public function setType($type) {
+               $this->type = $type;
+       }
+
+       /**
+        * Get type
+        *
+        * @return integer
+        */
+       public function getType() {
+               return intval($this->type);
+       }
+
+       /**
+        * Set details number
+        *
+        * @param integer $detailsNumber
+        * @return void
+        */
+       public function setDetailsNumber($detailsNumber) {
+               $this->detailsNumber = $detailsNumber;
+       }
+
+       /**
+        * Get details number
+        *
+        * @return integer
+        */
+       public function getDetailsNumber() {
+               return intval($this->detailsNumber);
+       }
+
+       /**
+        * Set ip
+        *
+        * @param string $ip
+        * @return void
+        */
+       public function setIp($ip) {
+               $this->ip = $ip;
+       }
+
+       /**
+        * Get ip
+        *
+        * @return string
+        */
+       public function getIp() {
+               return $this->ip;
+       }
+
+       /**
+        * Set log data
+        *
+        * @param string $logData
+        * @return void
+        */
+       public function setLogData($logData) {
+               $this->logData = $logData;
+       }
+
+       /**
+        * Get log data
+        *
+        * @return array
+        */
+       public function getLogData() {
+               if ($this->logData === '') {
+                       return array();
+               }
+
+               $logData = @unserialize($this->logData);
+               if (!is_array($logData)) {
+                       $logData = array();
+               }
+
+               return $logData;
+       }
+
+       /**
+        * Set event pid
+        *
+        * @param integer $eventPid
+        * @return void
+        */
+       public function setEventPid($eventPid) {
+               $this->eventPid = $eventPid;
+       }
+
+       /**
+        * Get event pid
+        *
+        * @return integer
+        */
+       public function getEventPid() {
+               return intval($this->eventPid);
+       }
+
+       /**
+        * Set workspace uid
+        *
+        * @param integer $workspaceUid
+        * @return void
+        */
+       public function setWorkspaceUid($workspaceUid) {
+               $this->workspaceUid = $workspaceUid;
+       }
+
+       /**
+        * Get workspace
+        *
+        * @return integer
+        */
+       public function getWorkspaceUid() {
+               return intval($this->workspaceUid);
+       }
+
+       /**
+        * Set new id
+        *
+        * @param string $newId
+        * @return void
+        */
+       public function setNewId($newId) {
+               $this->newId = $newId;
+       }
+
+       /**
+        * Get new id
+        *
+        * @return string
+        */
+       public function getNewId() {
+               return $this->newId;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Model/Workspace.php b/typo3/sysext/belog/Classes/Domain/Model/Workspace.php
new file mode 100644 (file)
index 0000000..c1e0370
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Stub model for workspaces - only properties required for belog module are added currently
+ * @TODO: This should be extended and put at some more central place
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Model_Workspace extends Tx_Extbase_DomainObject_AbstractEntity {
+       /**
+        * @var integer
+        */
+       const UID_LIVE_WORKSPACE = 0;
+       /**
+        * @var integer
+        */
+       const UID_ANY_WORKSPACE = -99;
+
+       /**
+        * title of the workspace
+        *
+        * @var string
+        */
+       protected $title = '';
+
+       /**
+        * Set workspace title
+        *
+        * @param string $title
+        * @return void
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+       }
+
+       /**
+        * Get workspace title
+        *
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Repository/BackendUserRepository.php b/typo3/sysext/belog/Classes/Domain/Repository/BackendUserRepository.php
new file mode 100644 (file)
index 0000000..a5334b5
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Backend user repository
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_BackendUserRepository extends Tx_Extbase_Persistence_Repository {
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Repository/HistoryEntryRepository.php b/typo3/sysext/belog/Classes/Domain/Repository/HistoryEntryRepository.php
new file mode 100644 (file)
index 0000000..40b230d
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Find system history entries
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_HistoryEntryRepository extends Tx_Extbase_Persistence_Repository {
+       /**
+        * Initializes the repository.
+        *
+        * @return void
+        */
+       public function initializeObject() {
+               /** @var $querySettings Tx_Extbase_Persistence_QuerySettingsInterface */
+               $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_QuerySettingsInterface');
+               $querySettings->setRespectStoragePage(FALSE);
+               $this->setDefaultQuerySettings($querySettings);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php b/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php
new file mode 100644 (file)
index 0000000..06ba44d
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Sys log entry repository
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_LogEntryRepository extends Tx_Extbase_Persistence_Repository {
+       /**
+        * backend users, with UID as key
+        *
+        * @var array
+        */
+       protected $beUserList = array();
+
+       /**
+        * Initialize some local variables to be used during creation of objects
+        *
+        * @return void
+        */
+       public function initializeObject() {
+               $this->beUserList = t3lib_BEfunc::getUserNames();
+
+               /** @var $defaultQuerySettings Tx_Extbase_Persistence_QuerySettingsInterface */
+               $defaultQuerySettings = $this->objectManager->create('Tx_Extbase_Persistence_QuerySettingsInterface');
+               $defaultQuerySettings->setRespectStoragePage(FALSE);
+               $this->setDefaultQuerySettings($defaultQuerySettings);
+       }
+
+       /**
+        * Finds all log entries that match all given constraints.
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return Tx_Extbase_Persistence_QueryResult<Tx_Belog_Domain_Model_LogEntry>
+        */
+       public function findByConstraint(Tx_Belog_Domain_Model_Constraint $constraint) {
+               $query = $this->createQuery();
+
+               $queryConstraints = $this->createQueryConstraints($query, $constraint);
+               if (!empty($queryConstraints)) {
+                       $query->matching(
+                               $query->logicalAnd($queryConstraints)
+                       );
+               }
+               $query->setOrderings(array('uid' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING));
+               $query->setLimit($constraint->getNumber());
+
+               return $query->execute();
+       }
+
+       /**
+        * Create an array of query constraints from constraint object
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @return array<Tx_Extbase_Persistence_QOM_Constraint>
+        */
+       protected function createQueryConstraints(Tx_Extbase_Persistence_QueryInterface $query, Tx_Belog_Domain_Model_Constraint $constraint) {
+               $queryConstraints = array();
+
+                       // User / group handling
+               $this->addUsersAndGroupsToQueryConstraints($constraint, $query, $queryConstraints);
+
+                       // Workspace
+               if ($constraint->getWorkspaceUid() != Tx_Belog_Domain_Model_Workspace::UID_ANY_WORKSPACE) {
+                       $queryConstraints[] = $query->equals('workspace', $constraint->getWorkspaceUid());
+               }
+
+                       // Action (type):
+               if ($constraint->getAction() > 0) {
+                       $queryConstraints[] = $query->equals('type', $constraint->getAction());
+               } elseif ($constraint->getAction() == -1) {
+                       $queryConstraints[] = $query->equals('error', 0);
+               }
+
+                       // Start / endtime handling: The timestamp calculation was already done
+                       // in the controller, since we need those calculated values in the view as well.
+               $queryConstraints[] = $query->greaterThanOrEqual('tstamp', $constraint->getStartTimestamp());
+               $queryConstraints[] = $query->lessThan('tstamp', $constraint->getEndTimestamp());
+
+                       // Page and level constraint if in page context
+               $this->addPageTreeConstraintsToQuery($constraint, $query, $queryConstraints);
+
+               return $queryConstraints;
+       }
+
+       /**
+        * Adds constraints for the page(s) to the query; this could be one single page or a whole subtree beneath a given
+        * page.
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @param array &$queryConstraints the query constraints to add to, will be modified
+        * @return void
+        */
+       protected function addPageTreeConstraintsToQuery(Tx_Belog_Domain_Model_Constraint $constraint,
+               Tx_Extbase_Persistence_QueryInterface $query, array &$queryConstraints) {
+
+               if (!$constraint->getIsInPageContext()) {
+                       return;
+               }
+
+               $pageIds = array();
+
+                       // check if we should get a whole tree of pages and not only a single page
+               if ($constraint->getDepth() > 0) {
+                       /** @var $pageTree t3lib_pageTree */
+                       $pageTree = t3lib_div::makeInstance('t3lib_pageTree');
+                       $pageTree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
+                       $pageTree->makeHTML = 0;
+                       $pageTree->fieldArray = array('uid');
+                       $pageTree->getTree($constraint->getPageId(), $constraint->getDepth());
+                       $pageIds = $pageTree->ids;
+               }
+
+               $pageIds[] = $constraint->getPageId();
+
+               $queryConstraints[] = $query->in('eventPid', $pageIds);
+       }
+
+       /**
+        * Adds users and groups to the query constraints.
+        *
+        * @param Tx_Belog_Domain_Model_Constraint $constraint
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @param array &$queryConstraints the query constraints to add to, will be modified
+        * @return void
+        */
+       protected function addUsersAndGroupsToQueryConstraints(
+               Tx_Belog_Domain_Model_Constraint $constraint, Tx_Extbase_Persistence_QueryInterface $query, array &$queryConstraints
+       ) {
+
+               $userOrGroup = $constraint->getUserOrGroup();
+               if ($userOrGroup === '') {
+                       return;
+               }
+
+                       // Constraint for a group
+               if (substr($userOrGroup, 0, 3) === 'gr-') {
+                       $groupId = intval(substr($userOrGroup, 3));
+                       $userIds = array();
+                       foreach ($this->beUserList as $userId => $userData) {
+                               if (t3lib_div::inList($userData['usergroup_cached_list'], $groupId)) {
+                                       $userIds[] = $userId;
+                               }
+                       }
+                       if (!empty($userIds)) {
+                               $queryConstraints[] = $query->in('userid', $userIds);
+                       } else {
+                                       // If there are no group members -> use -1 as constraint to not find anything
+                               $queryConstraints[] = $query->in('userid', array(-1));
+                       }
+
+                       // Constraint for a single user
+               } elseif (substr($userOrGroup, 0, 3) === 'us-') {
+                       $queryConstraints[] = $query->equals('userid', intval(substr($userOrGroup, 3)));
+
+                       // Constraint for all users
+               } elseif ($userOrGroup === '-1') {
+                       $queryConstraints[] = $query->equals('userid', intval($GLOBALS['BE_USER']->user['uid']));
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/Domain/Repository/WorkspaceRepository.php b/typo3/sysext/belog/Classes/Domain/Repository/WorkspaceRepository.php
new file mode 100644 (file)
index 0000000..6f24bbb
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Repository for workspaces
+ *
+ * TODO this should be moved to EXT:workspaces if EXT:belog works no matter if workspaces are installed or not
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_WorkspaceRepository extends Tx_Extbase_Persistence_Repository {
+       /**
+        * Initializes the repository.
+        *
+        * @return void
+        */
+       public function initializeObject() {
+               /** @var $querySettings Tx_Extbase_Persistence_QuerySettingsInterface */
+               $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_QuerySettingsInterface');
+               $querySettings->setRespectStoragePage(FALSE);
+               $this->setDefaultQuerySettings($querySettings);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/Be/AddJsFileViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/Be/AddJsFileViewHelper.php
new file mode 100644 (file)
index 0000000..3e9a97e
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * View helper to add a additional javascript file to the backend header
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_Be_AddJsFileViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
+       /**
+        * Includes a JavaScript file into the to-be-rendered page
+        *
+        * @param string $file Custom JavaScript file to be loaded. Can be a file path inside the TYPO3 installation
+        * @return void
+        * @see template
+        * @see t3lib_PageRenderer
+        */
+       public function render($file) {
+               $doc = $this->getDocInstance();
+               $pageRenderer = $doc->getPageRenderer();
+               $pageRenderer->addJsFile($file);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/Be/InlineSettingsArrayViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/Be/InlineSettingsArrayViewHelper.php
new file mode 100644 (file)
index 0000000..8a43731
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * View helper to add a additional javascript settings to the backend header
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_Be_InlineSettingsArrayViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
+       /**
+        * Render additional javascript to page
+        *
+        * @param array $settings Custom JavaScript settings to be added
+        * @return void
+        * @see template
+        * @see t3lib_PageRenderer
+        */
+       public function render(array $settings) {
+               $doc = $this->getDocInstance();
+               $pageRenderer = $doc->getPageRenderer();
+               $pageRenderer->addInlineSettingArray('', $settings);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/Be/PagePathViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/Be/PagePathViewHelper.php
new file mode 100644 (file)
index 0000000..29a8253
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Get page path string from page id
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_Be_PagePathViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
+       /**
+        * Resolve page id to page path string (with automatic cropping to maximum given length).
+        *
+        * @param integer $pid Pid of the page
+        * @param integer $titleLimit Limit of the page title
+        * @return string Page path string
+        */
+       public function render($pid, $titleLimit = 20) {
+               return t3lib_BEfunc::getRecordPath($pid, '', $titleLimit);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php
new file mode 100644 (file)
index 0000000..c5db379
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Display error icon from error integer value
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_ErrorIconViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+       /**
+        * Renders an error icon link as known from the TYPO3 backend.
+        * Error codes 2 and three are mapped to "error", -1 and 1 are mapped to "warning".
+        *
+        * @param integer $errorNumber The error number (-1 ... 3)
+        * @return string the rendered error icon link
+        */
+       public function render($errorNumber = 0) {
+               return $GLOBALS['SOBE']->doc->icons($errorNumber >= 2 ? template::STATUS_ICON_ERROR : template::STATUS_ICON_WARNING);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/Form/TranslateLabelSelectViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/Form/TranslateLabelSelectViewHelper.php
new file mode 100644 (file)
index 0000000..bf7e0c3
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Extends the usual select view helper, but additionally translates
+ * the select option labels
+ *
+ * Example:
+ * <belog:form.translateLabelSelect property="number" options="{settings.selectableNumberOfLogEntries}" optionLabelPrefix="numbers"
+ *
+ * Will lookup number.200 (or whatever optionValue is given) in locallang database
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_Form_TranslateLabelSelectViewHelper extends Tx_Fluid_ViewHelpers_Form_SelectViewHelper {
+       /**
+        * Initialize arguments.
+        *
+        * @return void
+        * @api
+        */
+       public function initializeArguments() {
+               parent::initializeArguments();
+               $this->registerArgument('optionLabelPrefix', 'string', 'Prefix for locallang lookup');
+       }
+
+       /**
+        * Render the option tags.
+        *
+        * Extend the default handling by iterating over calculated options array and
+        * try to translate the value
+        *
+        * @return array an associative array of options, key will be the value of the option tag
+        */
+       protected function getOptions() {
+               $options = parent::getOptions();
+
+               foreach ($options as $value => $label) {
+                       $options[$value] = $this->translateLabel($label);
+               }
+               return $options;
+       }
+
+       /**
+        * Fetches the translation for a given label. If no translation is found, the label is returned unchanged.
+        *
+        * @param string $label The label to translate
+        * @return string
+        */
+       protected function translateLabel($label) {
+               if ($label === '') {
+                       return '';
+               }
+
+               $labelKey = $this->hasArgument('optionLabelPrefix') ? $this->arguments['optionLabelPrefix'] . $label : $label;
+               $translatedLabel = Tx_Extbase_Utility_Localization::translate(
+                       $labelKey,
+                       $this->controllerContext->getRequest()->getControllerExtensionName()
+               );
+               return $translatedLabel ? $translatedLabel : $label;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/FormatDetailsViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/FormatDetailsViewHelper.php
new file mode 100644 (file)
index 0000000..0894c0f
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Create detail string from log entry
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_FormatDetailsViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+       /**
+        * Create formatted detail string from log row.
+        *
+        * The method handles two properties of the model: details and logData
+        * Details is a string with possible %s placeholders, and logData an array
+        * with the substitutions.
+        * Furthermore, possible files in logData are stripped to their basename if
+        * the action logged was a file action
+        *
+        * This method was crafted from getDetails() of class t3lib_bedisplaylog.
+        *
+        * @param Tx_Belog_Domain_Model_LogEntry $logEntry
+        * @return string Formatted details
+        */
+       public function render(Tx_Belog_Domain_Model_LogEntry $logEntry) {
+               $detailString = $logEntry->getDetails();
+               $substitutes = $logEntry->getLogData();
+
+                       // Strip pathes from file names if the log was a file action
+               if ($logEntry->getType() === 2) {
+                       $substitutes = $this->stripPathFromFilenames($substitutes);
+               }
+
+                       // Substitute
+               $detailString = vsprintf($detailString, $substitutes);
+
+                       // Remove possible pending other %s
+               $detailString = str_replace('%s', '', $detailString);
+
+               return htmlspecialchars($detailString);
+       }
+
+       /**
+        * Strips path from array of file names
+        *
+        * @param array $files
+        * @return array
+        */
+       protected function stripPathFromFilenames(array $files = array()) {
+               foreach ($files as $key => $file) {
+                       $files[$key] = basename($file);
+               }
+               return $files;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/HistoryEntryViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/HistoryEntryViewHelper.php
new file mode 100644 (file)
index 0000000..437d3bd
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Get history entry from for log entry
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_HistoryEntryViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+       /**
+        * @var Tx_Belog_Domain_Repository_HistoryEntryRepository
+        */
+       protected $historyEntryRepository;
+
+       /**
+        * Inject the system history entry repository.
+        *
+        * @param Tx_Belog_Domain_Repository_HistoryEntryRepository $historyEntryRepository
+        * @return void
+        */
+       public function injectHistoryEntryRepository(Tx_Belog_Domain_Repository_HistoryEntryRepository $historyEntryRepository) {
+               $this->historyEntryRepository = $historyEntryRepository;
+       }
+
+       /**
+        * Get system history record
+        *
+        * @param integer $uid Uid of the log entry
+        * @return string Formatted history entry if one exists, else empty string
+        */
+       public function render($uid) {
+               /** @var $historyEntry Tx_Belog_Domain_Model_HistoryEntry */
+               $historyEntry = $this->historyEntryRepository->findOneBySysLogUid($uid);
+
+               if (!($historyEntry instanceof Tx_Belog_Domain_Model_HistoryEntry)) {
+                       return '';
+               }
+
+               $historyLabel = Tx_Extbase_Utility_Localization::translate(
+                       'changesInFields',
+                       $this->controllerContext->getRequest()->getControllerExtensionName(),
+                       array($historyEntry->getFieldlist())
+               );
+               $historyIcon = t3lib_iconWorks::getSpriteIcon(
+                       'actions-document-history-open',
+                       array(
+                               'title' => Tx_Extbase_Utility_Localization::translate(
+                                       'showHistory',
+                                       $this->controllerContext->getRequest()->getControllerExtensionName()
+                               )
+                       )
+               );
+               $historyHref = 'show_rechis.php?sh_uid=' . $historyEntry->getUid() . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
+               $historyLink = '<a href="' . htmlspecialchars($historyHref) . '">' . $historyIcon . '</a>';
+
+               return $historyLabel . '&nbsp;' . $historyLink;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php
new file mode 100644 (file)
index 0000000..6ee9786
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Returns true, if a specific extension is loaded
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_IsExtensionLoadedViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+       /**
+        * Checks whether an extension is loaded.
+        *
+        * @param string $extensionKey The extension's key
+        * @return boolean TRUE if extension is loaded, FALSE otherwise
+        */
+       public function render($extensionKey) {
+               return t3lib_extMgm::isLoaded($extensionKey);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/UsernameViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/UsernameViewHelper.php
new file mode 100644 (file)
index 0000000..dba3d48
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Get username from backend user id
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_UsernameViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+       /**
+        * @var Tx_Belog_Domain_Repository_BackendUserRepository
+        */
+       protected $backendUserRepository = NULL;
+
+       /**
+        * Inject the backend user repository
+        *
+        * @param Tx_Belog_Domain_Repository_BackendUserRepository $backendUserRepository
+        * @return void
+        */
+       public function injectBeUserRepository(Tx_Belog_Domain_Repository_BackendUserRepository $backendUserRepository) {
+               $this->backendUserRepository = $backendUserRepository;
+       }
+
+       /**
+        * Resolve user name from backend user id.
+        *
+        * @param integer $uid Uid of the user
+        * @return string Username or an empty string if there is no user with that UID
+        */
+       public function render($uid) {
+               /** @var $user Tx_Belog_Domain_Model_BackendUser */
+               $user = $this->backendUserRepository->findByUid($uid);
+               if ($user === NULL) {
+                       return '';
+               }
+
+               return $user->getUsername();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/WorkspaceTitleViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/WorkspaceTitleViewHelper.php
new file mode 100644 (file)
index 0000000..7ae2753
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ * Get workspace title from workspace id
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_ViewHelpers_WorkspaceTitleViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+       /**
+        * @var Tx_Belog_Domain_Repository_WorkspaceRepository
+        */
+       protected $workspaceRepository = NULL;
+
+       /**
+        * Inject the workspace repository
+        *
+        * @param Tx_Belog_Domain_Repository_WorkspaceRepository $workspaceRepository
+        * @return void
+        */
+       public function injectWorkspaceRepository(Tx_Belog_Domain_Repository_WorkspaceRepository $workspaceRepository) {
+               $this->workspaceRepository = $workspaceRepository;
+       }
+
+       /**
+        * Resolve workspace title from UID.
+        *
+        * @param integer $uid UID of the workspace
+        * @return string username or UID
+        */
+       public function render($uid) {
+               if ($uid === 0) {
+                       return Tx_Extbase_Utility_Localization::translate(
+                               'live', $this->controllerContext->getRequest()->getControllerExtensionName()
+                       );
+               }
+               if (!t3lib_extMgm::isLoaded('workspaces')) {
+                       return '';
+               }
+
+               /** @var $workspace Tx_Belog_Domain_Model_Workspace */
+               $workspace = $this->workspaceRepository->findByUid($uid);
+               if ($workspace !== NULL) {
+                       $title =  $workspace->getTitle();
+               } else {
+                       $title = '';
+               }
+
+               return $title;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Classes/class.tx_belog_webinfo_bootstrap.php b/typo3/sysext/belog/Classes/class.tx_belog_webinfo_bootstrap.php
new file mode 100644 (file)
index 0000000..8908175
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *  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 class is a wrapper for WebInfo controller of belog.
+ * It is registered in ext_tables.php with t3lib_extMgm::insertModuleFunction() and called by the
+ * info extension via SCbase functionality.
+ *
+ * Extbase currently provides no way to register a "TBE_MODULES_EXT" module directly,
+ * therefore we need to bootstrap extbase on our own here to jump to the WebInfo controller.
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class tx_belog_WebInfo_Bootstrap {
+       /**
+        * Dummy method, called by SCbase external object handling
+        *
+        * @return void
+        */
+       public function init() {
+       }
+
+       /**
+        * Dummy method, called by SCbase external object handling
+        *
+        * @return void
+        */
+       public function checkExtObj() {
+       }
+
+       /**
+        * Bootstrap extbase and jump to WebInfo controller
+        *
+        * @return string
+        */
+       public function main() {
+               $configuration = array(
+                       'extensionName' => 'Belog',
+                       'pluginName' => 'tools_BelogLog',
+               );
+
+                       // Yeah, this is ugly. But currently, there is no other direct way
+                       // in extbase to force a specific controller in backend mode.
+                       // Overwriting $_GET was the most simple solution here until extbase
+                       // provides a clean way to solve this.
+               $_GET['tx_belog_tools_beloglog']['controller'] = 'WebInfo';
+
+                       /** @var $extbaseBootstrap Tx_Extbase_Core_Bootstrap */
+               $extbaseBootstrap = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
+               return $extbaseBootstrap->run('', $configuration);
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Configuration/TypoScript/setup.txt b/typo3/sysext/belog/Configuration/TypoScript/setup.txt
new file mode 100644 (file)
index 0000000..c698962
--- /dev/null
@@ -0,0 +1,68 @@
+module.tx_belog {
+       features.rewrittenPropertyMapper = 1
+
+       persistence.classes {
+               Tx_Belog_Domain_Model_LogEntry {
+                       mapping {
+                               tableName = sys_log
+                               columns {
+                                       userid.mapOnProperty = backendUserUid
+                                       recuid.mapOnProperty = recordUid
+                                       tablename.mapOnProperty = tableName
+                                       recpid.mapOnProperty = recordPid
+                                       details_nr.mapOnProperty = detailsNumber
+                                       IP.mapOnProperty = ip
+                                       NEWid.mapOnProperty = newId
+                               }
+                       }
+               }
+               Tx_Belog_Domain_Model_Workspace {
+                       mapping {
+                               tableName = sys_workspace
+                       }
+               }
+               Tx_Belog_Domain_Model_BackendUser {
+                       mapping {
+                               tableName = be_users
+                       }
+               }
+               Tx_Belog_Domain_Model_HistoryEntry {
+                       mapping {
+                               tableName = sys_history
+                       }
+               }
+       }
+
+       settings {
+               selectableNumberOfLogEntries {
+                       20 = 20
+                       50 = 50
+                       100 = 100
+                       200 = 200
+                       500 = 500
+                       1000 = 1000
+                       1000000 = any
+               }
+
+               selectableTimeFrames {
+                       0 = thisWeek
+                       1 = lastWeek
+                       2 = last7Days
+                       10 = thisMonth
+                       11 = lastMonth
+                       12 = last31Days
+                       20 = noLimit
+                       30 = userDefined
+               }
+
+               selectableActions {
+                       0 = any
+                       1 = actionDatabase
+                       2 = actionFile
+                       3 = actionCache
+                       254 = actionSettings
+                       255 = actionLogin
+                       -1 = actionErrors
+               }
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/.htaccess b/typo3/sysext/belog/Resources/Private/.htaccess
new file mode 100644 (file)
index 0000000..3418e55
--- /dev/null
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Language/locallang.xlf b/typo3/sysext/belog/Resources/Private/Language/locallang.xlf
new file mode 100644 (file)
index 0000000..cce9eba
--- /dev/null
@@ -0,0 +1,356 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="belog">
+               <header/>
+               <body>
+                       <trans-unit id="adminLog" xml:space="preserve">
+                               <source>Administration log</source>
+                       </trans-unit>
+                       <trans-unit id="allUsers" xml:space="preserve">
+                               <source>[All users]</source>
+                       </trans-unit>
+                       <trans-unit id="any" xml:space="preserve">
+                               <source>[Any]</source>
+                       </trans-unit>
+                       <trans-unit id="live" xml:space="preserve">
+                               <source>LIVE</source>
+                       </trans-unit>
+                       <trans-unit id="draft" xml:space="preserve">
+                               <source>Draft</source>
+                       </trans-unit>
+                       <trans-unit id="self" xml:space="preserve">
+                               <source>Self</source>
+                       </trans-unit>
+                       <trans-unit id="userGroup" xml:space="preserve">
+                               <source>Group:</source>
+                       </trans-unit>
+                       <trans-unit id="thisWeek" xml:space="preserve">
+                               <source>This week</source>
+                       </trans-unit>
+                       <trans-unit id="lastWeek" xml:space="preserve">
+                               <source>Last week</source>
+                       </trans-unit>
+                       <trans-unit id="last7Days" xml:space="preserve">
+                               <source>Last 7 days</source>
+                       </trans-unit>
+                       <trans-unit id="thisMonth" xml:space="preserve">
+                               <source>This month</source>
+                       </trans-unit>
+                       <trans-unit id="lastMonth" xml:space="preserve">
+                               <source>Last month</source>
+                       </trans-unit>
+                       <trans-unit id="last31Days" xml:space="preserve">
+                               <source>Last 31 days</source>
+                       </trans-unit>
+                       <trans-unit id="noLimit" xml:space="preserve">
+                               <source>No limit</source>
+                       </trans-unit>
+                       <trans-unit id="userDefined" xml:space="preserve">
+                               <source>User defined</source>
+                       </trans-unit>
+                       <trans-unit id="set" xml:space="preserve">
+                               <source>Set</source>
+                       </trans-unit>
+                       <trans-unit id="20" xml:space="preserve">
+                               <source>20</source>
+                       </trans-unit>
+                       <trans-unit id="50" xml:space="preserve">
+                               <source>50</source>
+                       </trans-unit>
+                       <trans-unit id="100" xml:space="preserve">
+                               <source>100</source>
+                       </trans-unit>
+                       <trans-unit id="200" xml:space="preserve">
+                               <source>200</source>
+                       </trans-unit>
+                       <trans-unit id="500" xml:space="preserve">
+                               <source>500</source>
+                       </trans-unit>
+                       <trans-unit id="1000" xml:space="preserve">
+                               <source>1000</source>
+                       </trans-unit>
+                       <trans-unit id="actionAll" xml:space="preserve">
+                               <source>All</source>
+                       </trans-unit>
+                       <trans-unit id="actionDatabase" xml:space="preserve">
+                               <source>Database</source>
+                       </trans-unit>
+                       <trans-unit id="actionFile" xml:space="preserve">
+                               <source>File</source>
+                       </trans-unit>
+                       <trans-unit id="actionCache" xml:space="preserve">
+                               <source>Cache</source>
+                       </trans-unit>
+                       <trans-unit id="actionSettings" xml:space="preserve">
+                               <source>Settings</source>
+                       </trans-unit>
+                       <trans-unit id="actionLogin" xml:space="preserve">
+                               <source>Login</source>
+                       </trans-unit>
+                       <trans-unit id="actionErrors" xml:space="preserve">
+                               <source>Errors</source>
+                       </trans-unit>
+                       <trans-unit id="group" xml:space="preserve">
+                               <source>Group:</source>
+                       </trans-unit>
+                       <trans-unit id="user" xml:space="preserve">
+                               <source>User:</source>
+                       </trans-unit>
+                       <trans-unit id="users" xml:space="preserve">
+                               <source>Users:</source>
+                       </trans-unit>
+                       <trans-unit id="time" xml:space="preserve">
+                               <source>Time:</source>
+                       </trans-unit>
+                       <trans-unit id="max" xml:space="preserve">
+                               <source>Max:</source>
+                       </trans-unit>
+                       <trans-unit id="changesInFields" xml:space="preserve">
+                               <source>Changes in fields: %s.</source>
+                       </trans-unit>
+                       <trans-unit id="showHistory" xml:space="preserve">
+                               <source>Show History</source>
+                       </trans-unit>
+                       <trans-unit id="action" xml:space="preserve">
+                               <source>Action:</source>
+                       </trans-unit>
+                       <trans-unit id="workspace" xml:space="preserve">
+                               <source>Workspace:</source>
+                       </trans-unit>
+                       <trans-unit id="groupByPage" xml:space="preserve">
+                               <source>Group by page:</source>
+                       </trans-unit>
+                       <trans-unit id="pagenameWithUID" xml:space="preserve">
+                               <source>%s" [UID: %s]</source>
+                       </trans-unit>
+                       <trans-unit id="overview" xml:space="preserve">
+                               <source>Overview</source>
+                       </trans-unit>
+                       <trans-unit id="timeInfo" xml:space="preserve">
+                               <source>These pages have log messages from %s to %s</source>
+                       </trans-unit>
+                       <trans-unit id="forNonPageRelatedActions" xml:space="preserve">
+                               <source>for NON-PAGE related actions</source>
+                       </trans-unit>
+                       <trans-unit id="forRootLevel" xml:space="preserve">
+                               <source>for ROOT LEVEL</source>
+                       </trans-unit>
+                       <trans-unit id="forPage" xml:space="preserve">
+                               <source>for PAGE "%s" (UID: %s)</source>
+                       </trans-unit>
+                       <trans-unit id="logForNonPageRelatedActionsOrRootLevelOrPage" xml:space="preserve">
+                               <source>Log %s from %s to %s</source>
+                       </trans-unit>
+                       <trans-unit id="type_1" xml:space="preserve">
+                               <source>DB</source>
+                       </trans-unit>
+                       <trans-unit id="action_1_1" xml:space="preserve">
+                               <source>Insert</source>
+                       </trans-unit>
+                       <trans-unit id="action_1_2" xml:space="preserve">
+                               <source>Update</source>
+                       </trans-unit>
+                       <trans-unit id="action_1_3" xml:space="preserve">
+                               <source>Delete</source>
+                       </trans-unit>
+                       <trans-unit id="action_1_4" xml:space="preserve">
+                               <source>Check</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_0_1" xml:space="preserve">
+                               <source>Referer host '%s' and server host '%s' did not match!</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_1_11" xml:space="preserve">
+                               <source>Attempt to insert record on page '%s' (%s) where this table, %s, is not allowed</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_1_12" xml:space="preserve">
+                               <source>Attempt to insert a record on page '%s' (%s) from table '%s' without permissions. Or non-existing page.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_2_1" xml:space="preserve">
+                               <source>Attempt to modify table '%s' without permission</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_2_2" xml:space="preserve">
+                               <source>Attempt to modify record '%s' (%s) without permission. Or non-existing page.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_2_10" xml:space="preserve">
+                               <source>Record '%s' (%s) was updated.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_2_12" xml:space="preserve">
+                               <source>MySQL error: '%s' (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_1" xml:space="preserve">
+                               <source>Attempt to move record '%s' (%s) to after a non-existing record (uid=%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_2" xml:space="preserve">
+                               <source>Moved record '%s' (%s) to page '%s' (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_3" xml:space="preserve">
+                               <source>Moved record '%s' (%s) from page '%s' (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_4" xml:space="preserve">
+                               <source>Moved record '%s' (%s) on page '%s' (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_10" xml:space="preserve">
+                               <source>Attempt to move page '%s' (%s) to inside of its own rootline (at page '%s' (%s))</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_11" xml:space="preserve">
+                               <source>Attempt to insert record on page '%s' (%s) where this table, %s, is not allowed</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_12" xml:space="preserve">
+                               <source>Attempt to insert a record on page '%s' (%s) from table '%s' without permissions. Or non-existing page.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_13" xml:space="preserve">
+                               <source>Attempt to move record '%s' (%s) to after another record, although the table has no sorting row.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_4_14" xml:space="preserve">
+                               <source>Attempt to move record '%s' (%s) without having permissions to do so</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_1" xml:space="preserve">
+                               <source>You cannot change the 'doktype' of page '%s' to the desired value.</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_2" xml:space="preserve">
+                               <source>'doktype' of page '%s' could not be changed because the page contains records from disallowed tables; %s</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_3" xml:space="preserve">
+                               <source>Too few items in the list of values. (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_10" xml:space="preserve">
+                               <source>Could not delete file '%s' (does not exist). (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_11" xml:space="preserve">
+                               <source>Copying file '%s' failed!: No destination file (%s) possible!. (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_12" xml:space="preserve">
+                               <source>File extension '%s' is not allowed. (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_13" xml:space="preserve">
+                               <source>File size (%s) of file '%s' exceeds limit (%s). (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_14" xml:space="preserve">
+                               <source>The destination (%s) or the source file (%s) does not exist. (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_15" xml:space="preserve">
+                               <source>Copying to file '%s' failed! (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="msg_1_5_16" xml:space="preserve">
+                               <source>Copying file '%s' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)</source>
+                       </trans-unit>
+                       <trans-unit id="type_2" xml:space="preserve">
+                               <source>FILE</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_1" xml:space="preserve">
+                               <source>Upload</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_2" xml:space="preserve">
+                               <source>Copy</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_3" xml:space="preserve">
+                               <source>Move</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_4" xml:space="preserve">
+                               <source>Delete</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_5" xml:space="preserve">
+                               <source>Rename</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_6" xml:space="preserve">
+                               <source>New</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_7" xml:space="preserve">
+                               <source>Unzip</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_8" xml:space="preserve">
+                               <source>New file</source>
+                       </trans-unit>
+                       <trans-unit id="action_2_9" xml:space="preserve">
+                               <source>Edit</source>
+                       </trans-unit>
+                       <trans-unit id="msg_2_9_1" xml:space="preserve">
+                               <source>File saved to '%s', bytes: %s, MD5: %s </source>
+                       </trans-unit>
+                       <trans-unit id="type_3" xml:space="preserve">
+                               <source>CACHE</source>
+                       </trans-unit>
+                       <trans-unit id="action_3_1" xml:space="preserve">
+                               <source><![CDATA[Clear&nbsp;Cache]]></source>
+                       </trans-unit>
+                       <trans-unit id="type_254" xml:space="preserve">
+                               <source>SETTING</source>
+                       </trans-unit>
+                       <trans-unit id="action_254_1" xml:space="preserve">
+                               <source>Change</source>
+                       </trans-unit>
+                       <trans-unit id="type_255" xml:space="preserve">
+                               <source>LOGIN</source>
+                       </trans-unit>
+                       <trans-unit id="action_255_1" xml:space="preserve">
+                               <source>LOGIN</source>
+                       </trans-unit>
+                       <trans-unit id="action_255_2" xml:space="preserve">
+                               <source>LOGOUT</source>
+                       </trans-unit>
+                       <trans-unit id="action_255_3" xml:space="preserve">
+                               <source>ATTEMPT</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_title" xml:space="preserve">
+                               <source>Admin Changelog</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_users_0" xml:space="preserve">
+                               <source>All users</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_users_-1" xml:space="preserve">
+                               <source>Self</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_0" xml:space="preserve">
+                               <source>This week</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_1" xml:space="preserve">
+                               <source>Last week</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_2" xml:space="preserve">
+                               <source>Last 7 days</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_10" xml:space="preserve">
+                               <source>This month</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_11" xml:space="preserve">
+                               <source>Last month</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_12" xml:space="preserve">
+                               <source>Last 31 days</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_time_20" xml:space="preserve">
+                               <source>No limit</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_time" xml:space="preserve">
+                               <source>Time</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_user" xml:space="preserve">
+                               <source>User</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_error" xml:space="preserve">
+                               <source>E</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_action" xml:space="preserve">
+                               <source>Action</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_types" xml:space="preserve">
+                               <source>Type</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_table" xml:space="preserve">
+                               <source>Table</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_l_details" xml:space="preserve">
+                               <source>Details</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_menuUsers" xml:space="preserve">
+                               <source>Users</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_menuDepth" xml:space="preserve">
+                               <source>Depth:</source>
+                       </trans-unit>
+                       <trans-unit id="chLog_menuTime" xml:space="preserve">
+                               <source>Time</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Language/locallang_mod.xlf b/typo3/sysext/belog/Resources/Private/Language/locallang_mod.xlf
new file mode 100644 (file)
index 0000000..fa9de5a
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="belog">
+               <header/>
+               <body>
+                       <trans-unit id="mlang_labels_tablabel" xml:space="preserve">
+                               <source>Viewing log</source>
+                       </trans-unit>
+                       <trans-unit id="mlang_labels_tabdescr" xml:space="preserve">
+                               <source>Allows you access to the full backend changelog in TYPO3.&lt;br /&gt;&lt;em&gt;Access for 'admin' users only!&lt;/em&gt;</source>
+                       </trans-unit>
+                       <trans-unit id="mlang_tabs_tab" xml:space="preserve">
+                               <source>Log</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Layouts/DocHeader.html b/typo3/sysext/belog/Resources/Private/Layouts/DocHeader.html
new file mode 100644 (file)
index 0000000..c7a6840
--- /dev/null
@@ -0,0 +1,14 @@
+<f:be.container loadExtJs="1">
+       <div class="typo3-fullDoc">
+               <div id="typo3-docheader">
+                       <div id="typo3-docheader-row1">&nbsp;</div>
+                       <div id="typo3-docheader-row2">&nbsp;</div>
+               </div>
+
+               <div id="typo3-docbody">
+                       <div id="typo3-inner-docbody">
+                               <f:render section="Content" />
+                       </div>
+               </div>
+       </div>
+</f:be.container>
diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content.html b/typo3/sysext/belog/Resources/Private/Partials/Content.html
new file mode 100644 (file)
index 0000000..f48a8d1
--- /dev/null
@@ -0,0 +1,17 @@
+<h2>
+       <f:translate key="adminLog" />
+</h2>
+
+<div>
+       <f:render
+               partial="Content/Filter"
+               arguments="{_all}"
+       />
+</div>
+
+<div class="divider"></div>
+
+<f:render
+       partial="Content/LogEntries"
+       arguments="{_all}"
+/>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html b/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html
new file mode 100644 (file)
index 0000000..0f64025
--- /dev/null
@@ -0,0 +1,174 @@
+{namespace belog=Tx_Belog_ViewHelpers}
+
+<belog:be.addJsFile file="../t3lib/js/extjs/tceforms.js" />
+<belog:be.addJsFile file="../t3lib/js/extjs/ux/Ext.ux.DateTimePicker.js" />
+
+<belog:be.inlineSettingsArray
+       settings="{
+               datePickerUSmode: 0,
+               dateFormat: {0:settings.dateFormat, 1:'{settings.dateFormat} {settings.timeFormat}'}
+       }"
+/>
+
+<f:comment>
+       This is an ugly workaround.
+       The function module in Web->Info already renders a form tag, and there is
+       no easy way to circumvent this. The page id is needed for the info module
+       that is not extbase based to figure the permissions. Thus, we have to add
+       the page Id manually to hint the info module about that.
+</f:comment>
+<f:if condition="{constraint.isInPageContext}">
+       <input type="hidden" name="id" value="{constraint.pageId}" />
+</f:if>
+
+<f:form object="{constraint}" action="index" name="constraint">
+       <table border="0" cellpadding="0" cellspacing="0">
+               <tbody>
+                       <tr>
+                               <th>
+                                       <f:translate key="users" />
+                               </th>
+                               <td>
+                                       <f:form.select
+                                               property="userOrGroup"
+                                               options="{userGroups}"
+                                               additionalAttributes="{onchange : 'submit()'}"
+                                       />
+                               </td>
+
+                               <th>
+                                       <f:translate key="max" />
+                               </th>
+                               <td>
+                                       <belog:form.translateLabelSelect
+                                               property="number"
+                                               options="{settings.selectableNumberOfLogEntries}"
+                                               optionLabelPrefix="LLL:EXT:belog/Resources/Private/Language/locallang.xlf:"
+                                               additionalAttributes="{onchange : 'submit()'}"
+                                       />
+                               </td>
+
+                               <f:if condition="{belog:isExtensionLoaded(extensionKey:'workspaces')}">
+                                       <f:then>
+                                               <f:if condition="{showWorkspaceSelector}">
+                                                       <f:then>
+                                                               <th>
+                                                                       <f:translate key="workspace" />
+                                                               </th>
+                                                               <td>
+                                                                       <f:form.select
+                                                                               property="workspaceUid"
+                                                                               options="{workspaces}"
+                                                                               additionalAttributes="{onchange : 'submit()'}"
+                                                                       />
+                                                               </td>
+                                                       </f:then>
+                                                       <f:else>
+                                                               <th></th><td></td>
+                                                       </f:else>
+                                               </f:if>
+                                       </f:then>
+                                       <f:else>
+                                               <th></th><td></td>
+                                       </f:else>
+                               </f:if>
+
+                               <f:if condition="{constraint.isInPageContext}">
+                                       <f:then>
+                                               <th>
+                                                       <f:translate key="chLog_menuDepth" />
+                                               </th>
+                                               <td>
+                                                       <f:form.select
+                                                               property="depth"
+                                                               options="{pageDepths}"
+                                                               additionalAttributes="{onchange : 'submit()'}"
+                                                       />
+                                               </td>
+                                       </f:then>
+                                       <f:else>
+                                               <th></th><td></td>
+                                       </f:else>
+                               </f:if>
+                       </tr>
+
+                       <tr>
+                               <th>
+                                       <f:translate key="time" />
+                               </th>
+                               <td>
+                                       <belog:form.translateLabelSelect
+                                               property="timeFrame"
+                                               options="{settings.selectableTimeFrames}"
+                                               optionLabelPrefix="LLL:EXT:belog/Resources/Private/Language/locallang.xlf:"
+                                               additionalAttributes="{onchange : 'submit()'}"
+                                       />
+
+                                       <f:comment>
+                                               Date time fields for manual date selection
+                                       </f:comment>
+                                       <f:if condition="{constraint.timeFrame} == 30">
+                                               <br />
+
+                                               <f:translate key="LLL:EXT:lang/locallang_common.xml:from" />&nbsp;
+                                               <f:form.textfield
+                                                       property="manualDateStart"
+                                                       value="{constraint.manualDateStart -> f:format.date(format:'{settings.dateFormat} {settings.timeFormat}')}"
+                                                       id="tceforms-datetimefield-manualDateStart"
+                                                       style="margin:4px 2px; padding:1px; vertical-align:middle; width: 115px;"
+                                               />
+                                               <span
+                                                       style="cursor:pointer;"
+                                                       id="picker-tceforms-datetimefield-manualDateStart"
+                                                       class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-pick-date"
+                                               >
+                                                       &nbsp;
+                                               </span>
+
+                                               <f:translate key="LLL:EXT:lang/locallang_common.xml:to" />&nbsp;
+                                               <f:form.textfield
+                                                       property="manualDateStop"
+                                                       value="{constraint.manualDateStop -> f:format.date(format:'{settings.dateFormat} {settings.timeFormat}')}"
+                                                       id="tceforms-datetimefield-manualDateStop"
+                                                       style="margin:4px 2px; padding:1px; vertical-align:middle; width: 115px;"
+                                               />
+                                               <span
+                                                       style="cursor:pointer;"
+                                                       id="picker-tceforms-datetimefield-manualDateStop"
+                                                       class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-pick-date"
+                                               >
+                                                       &nbsp;
+                                               </span>
+
+                                               <f:form.submit value="{f:translate(key:'set')}" />
+                                       </f:if>
+                               </td>
+
+                               <th>
+                                       <f:translate key="action" />
+                               </th>
+                               <td>
+                                       <belog:form.translateLabelSelect
+                                               property="action"
+                                               options="{settings.selectableActions}"
+                                               optionLabelPrefix="LLL:EXT:belog/Resources/Private/Language/locallang.xlf:"
+                                               additionalAttributes="{onchange : 'submit()'}"
+                                       />
+                               </td>
+
+                               <th>
+                                       <f:translate key="groupByPage" />
+                               </th>
+                               <td>
+                                       <f:form.checkbox
+                                               property="groupByPage"
+                                               value="1"
+                                               additionalAttributes="{onchange : 'submit()'}"
+                                       />
+                               </td>
+
+                               <th></th><td></td>
+                       </tr>
+               </tbody>
+       </table>
+</f:form>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html b/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html
new file mode 100644 (file)
index 0000000..bea5d74
--- /dev/null
@@ -0,0 +1,221 @@
+{namespace belog=Tx_Belog_ViewHelpers}
+
+<f:if condition="{constraint.groupByPage}">
+       <div class="divider">
+               <h3>
+                       <f:translate key="overview" />
+               </h3>
+               <f:translate
+                       key="timeInfo"
+                       arguments="{
+                               0: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.startTimestamp}\')}',
+                               1: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.endTimestamp}\')}'
+                       }"
+               />
+               <br />
+               <f:for each="{groupedLogEntries}" as="pidEntry" key="pid">
+                       <f:if condition="{pid} > 0">
+                               <br />
+                               <f:translate
+                                       key="pagenameWithUID"
+                                       arguments="{
+                                               0: '{belog:be.pagePath(pid:\'{pid}\')}',
+                                               1: '{pid}'
+                                       }"
+                               />
+                       </f:if>
+               </f:for>
+       </div>
+</f:if>
+
+<f:for each="{groupedLogEntries}" as="pidEntry" key="pid">
+       <div>
+               <div style="padding-top: 10px;"></div>
+               <h3>
+                       <f:if condition="{constraint.groupByPage}">
+                               <f:then>
+                                       <f:if condition="{pid} < 1">
+                                               <f:then>
+                                                       <f:if condition="{pid} == -1">
+                                                               <f:translate
+                                                                       key="logForNonPageRelatedActionsOrRootLevelOrPage"
+                                                                       arguments="{
+                                                                               0: '{f:translate(key:\'forNonPageRelatedActions\')}',
+                                                                               1: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.startTimestamp}\')}',
+                                                                               2: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.endTimestamp}\')}'
+                                                                       }"
+                                                               />
+                                                       </f:if>
+                                                       <f:if condition="{pid} == 0">
+                                                               <f:translate
+                                                                       key="logForNonPageRelatedActionsOrRootLevelOrPage"
+                                                                       arguments="{
+                                                                               0: '{f:translate(key:\'forRootLevel\')}',
+                                                                               1: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.startTimestamp}\')}',
+                                                                               2: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.endTimestamp}\')}'
+                                                                       }"
+                                                               />
+                                                       </f:if>
+                                               </f:then>
+                                               <f:else>
+                                                       <f:comment>
+                                                               Nest view helpers three times:
+                                                               1. Feed pid as argument to be.pagePath
+                                                               2. Use this as argument for 'forPage' translate
+                                                               3. Use this as argument for 'logForNonPageRelatedActionsOrRootLevelOrPage' translate
+                                                       </f:comment>
+                                                       <f:translate
+                                                               key="logForNonPageRelatedActionsOrRootLevelOrPage"
+                                                               arguments="{
+                                                                       0: '{f:translate(
+                                                                               key:\'forPage\',
+                                                                               htmlEscape:\'0\',
+                                                                               arguments:\'{
+                                                                                       0:\\\'{belog:be.pagePath(pid:\\\\\\\'{pid}\\\\\\\')}\\\',
+                                                                                       1:\\\'{pid}\\\'
+                                                                               }\'
+                                                                       )}',
+                                                                       1: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.startTimestamp}\')}',
+                                                                       2: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.endTimestamp}\')}'
+                                                               }"
+                                                       />
+                                               </f:else>
+                                       </f:if>
+                               </f:then>
+                               <f:else>
+                                       <f:translate
+                                               key="logForNonPageRelatedActionsOrRootLevelOrPage"
+                                               arguments="{
+                                                       0: '',
+                                                       1: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.startTimestamp}\')}',
+                                                       2: '{f:format.date(format:\'{settings.dateFormat} H:i\', date:\'@{constraint.endTimestamp}\')}'
+                                               }"
+                                       />
+                               </f:else>
+                       </f:if>
+               </h3>
+               <f:for each="{pidEntry}" as="day" key="dayTimestamp">
+                       <h4 class="uppercase">
+                               <f:format.date format="{settings.dateFormat}">@{dayTimestamp}</f:format.date>
+                       </h4>
+                       <table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist">
+                               <thead>
+                                       <tr>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:translate key="chLog_l_error" />
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:translate key="chLog_l_time" />
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:translate key="chLog_l_user" />
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:if condition="{constraint.isInPageContext}">
+                                                                       <f:then>
+                                                                               <f:translate key="chLog_l_table" />
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <f:translate key="chLog_l_types" />
+                                                                       </f:else>
+                                                               </f:if>
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:translate key="chLog_l_action" />
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                               <th valign="top" class="t3-row-header">
+                                                       <strong>
+                                                               <f:translate key="chLog_l_details" />
+                                                       </strong>
+                                               </th>
+                                               <th class="t3-row-header"><img src="clear.gif" width="10" height="1" alt="" /></th>
+                                       </tr>
+                               </thead>
+                               <tbody>
+                                       <f:for each="{day}" as="logItem">
+                                               <tr>
+                                                       <td valign="top">
+                                                               <belog:ErrorIcon errorNumber="{logItem.error}" />
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+
+                                                       <td valign="top">
+                                                               <f:format.date format="H:i:s">@{logItem.tstamp}</f:format.date>
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+
+                                                       <td valign="top">
+                                                               <f:if condition="{belog:username(uid:logItem.backendUserUid)}">
+                                                                       <f:then><belog:username uid="{logItem.backendUserUid}" /></f:then>
+                                                                       <f:else>[{logItem.backendUserUid}]</f:else>
+                                                               </f:if>@<f:if condition="{belog:workspaceTitle(uid:logItem.workspaceUid)}">
+                                                                       <f:then><belog:workspaceTitle uid="{logItem.workspaceUid}" /></f:then>
+                                                                       <f:else>[{logItem.workspaceUid}]</f:else>
+                                                               </f:if>
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+
+                                                       <td valign="top">
+                                                               <f:if condition="{constraint.isInPageContext}">
+                                                                       <f:then>
+                                                                               {logItem.tableName}
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <f:if condition="{f:translate(key:'type_{logItem.type}')}">
+                                                                                       <f:then>
+                                                                                               <f:translate key="type_{logItem.type}" />
+                                                                                       </f:then>
+                                                                                       <f:else>
+                                                                                               [{logItem.type}]
+                                                                                       </f:else>
+                                                                               </f:if>
+                                                                       </f:else>
+                                                               </f:if>
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+
+                                                       <td valign="top">
+                                                               <f:if condition="{f:translate(key:'action_{logItem.type}_{logItem.action}')}">
+                                                                       <f:then>
+                                                                               <f:translate
+                                                                                       key="action_{logItem.type}_{logItem.action}"
+                                                                                       htmlEscape="0"
+                                                                               />
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               [{logItem.action}]
+                                                                       </f:else>
+                                                               </f:if>
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+
+                                                       <td valign="top">
+                                                               <belog:formatDetails logEntry="{logItem}" />
+                                                               <belog:historyEntry uid="{logItem.uid}" />
+                                                               <f:if condition="{logItem.detailsNumber} > 0">
+                                                                       (msg#{logItem.type}.{logItem.action}.{logItem.detailsNumber})
+                                                               </f:if>
+                                                       </td>
+                                                       <td><img src="clear.gif" width="10" height="1" alt="" /></td>
+                                               </tr>
+                                       </f:for>
+                               </tbody>
+                       </table>
+               </f:for>
+       </div>
+</f:for>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html b/typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html
new file mode 100644 (file)
index 0000000..1f58e6a
--- /dev/null
@@ -0,0 +1,8 @@
+<f:layout name="DocHeader" />
+
+<f:section name="Content">
+       <f:render
+               partial="Content"
+               arguments="{_all}"
+       />
+</f:section>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html b/typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html
new file mode 100644 (file)
index 0000000..6510dc0
--- /dev/null
@@ -0,0 +1,4 @@
+<f:render
+       partial="Content"
+       arguments="{_all}"
+/>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Model/LogEntryTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Model/LogEntryTest.php
new file mode 100644 (file)
index 0000000..75837de
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Oliver Klee <typo3-coding@oliverklee.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!
+ ***************************************************************/
+
+/**
+ * Testcase for the Tx_Belog_Domain_Model_LogEntry class.
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_LogEntryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+       /**
+        * @var Tx_Belog_Domain_Model_LogEntry
+        */
+       private $fixture = NULL;
+
+       public function setUp() {
+               $this->fixture = new Tx_Belog_Domain_Model_LogEntry();
+       }
+
+       public function tearDown() {
+               unset($this->fixture);
+       }
+
+       /**
+        * @test
+        */
+       public function getLogDataInitiallyReturnsEmptyArray() {
+               $this->assertSame(
+                       array(),
+                       $this->fixture->getLogData()
+               );
+       }
+
+       /**
+        * @test
+        */
+       public function getLogDataForEmptyStringLogDataReturnsEmptyArray() {
+               $this->fixture->setLogData('');
+
+               $this->assertSame(
+                       array(),
+                       $this->fixture->getLogData()
+               );
+       }
+
+       /**
+        * @test
+        */
+       public function getLogDataForGarbageStringLogDataReturnsEmptyArray() {
+               $this->fixture->setLogData('foo bar');
+
+               $this->assertSame(
+                       array(),
+                       $this->fixture->getLogData()
+               );
+       }
+
+       /**
+        * @test
+        */
+       public function getLogDataForSerializedArrayReturnsThatArray() {
+               $logData = array('foo', 'bar');
+
+               $this->fixture->setLogData(serialize($logData));
+
+               $this->assertSame(
+                       $logData,
+                       $this->fixture->getLogData()
+               );
+       }
+
+       /**
+        * @test
+        */
+       public function getLogDataForSerializedObjectReturnsEmptyArray() {
+               $this->fixture->setLogData(new stdClass());
+
+               $this->assertSame(
+                       array(),
+                       $this->fixture->getLogData()
+               );
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php
new file mode 100644 (file)
index 0000000..a615efb
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Oliver Klee <typo3-coding@oliverklee.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!
+ ***************************************************************/
+
+/**
+ * Testcase for the Tx_Belog_Domain_Repository_BackEndUserRepository class.
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_BackendUserRepositoryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+       public function setUp() {
+               $this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+       }
+
+       public function tearDown() {
+               unset($this->objectManager);
+       }
+
+       /**
+        * @test
+        */
+       public function classCanBeInstantiated() {
+       }
+
+       /**
+        * @test
+        */
+       public function initializeObjectSetsRespectStoragePidToFalse() {
+               $this->assertInstanceOf(
+                       'Tx_Belog_Domain_Repository_BackendUserRepository',
+                       new Tx_Belog_Domain_Repository_BackendUserRepository($this->objectManager)
+               );
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php
new file mode 100644 (file)
index 0000000..c28e2fe
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Oliver Klee <typo3-coding@oliverklee.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!
+ ***************************************************************/
+
+/**
+ * Testcase for the Tx_Belog_Domain_Repository_HistoryEntryRepository class.
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_HistoryEntryRepositoryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+       /**
+        * @var Tx_Extbase_Persistence_Typo3QuerySettings
+        */
+       private $querySettings = NULL;
+
+       public function setUp() {
+               $this->querySettings = $this->getMock('Tx_Extbase_Persistence_QuerySettingsInterface');
+
+               $this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+               $this->objectManager->expects($this->any())->method('create')
+                       ->with('Tx_Extbase_Persistence_QuerySettingsInterface')
+                       ->will($this->returnValue($this->querySettings));
+       }
+
+       public function tearDown() {
+               unset($this->querySettings, $this->objectManager);
+       }
+
+       /**
+        * @test
+        */
+       public function initializeObjectSetsRespectStoragePidToFalse() {
+               $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
+
+               $fixture = $this->getMock(
+                       'Tx_Belog_Domain_Repository_HistoryEntryRepository',
+                       array('setDefaultQuerySettings'), array($this->objectManager)
+               );
+               $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
+
+               $fixture->initializeObject();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php
new file mode 100644 (file)
index 0000000..aa42f92
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Oliver Klee <typo3-coding@oliverklee.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!
+ ***************************************************************/
+
+/**
+ * Testcase for the Tx_Belog_Domain_Repository_LogEntryRepository class.
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_LogEntryRepositoryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+       /**
+        * @var Tx_Extbase_Persistence_Typo3QuerySettings
+        */
+       private $querySettings = NULL;
+
+       public function setUp() {
+               $this->querySettings = $this->getMock('Tx_Extbase_Persistence_QuerySettingsInterface');
+
+               $this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+               $this->objectManager->expects($this->any())->method('create')
+                       ->with('Tx_Extbase_Persistence_QuerySettingsInterface')
+                       ->will($this->returnValue($this->querySettings));
+       }
+
+       public function tearDown() {
+               unset($this->querySettings, $this->objectManager);
+       }
+
+       /**
+        * @test
+        */
+       public function initializeObjectSetsRespectStoragePidToFalse() {
+               $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
+
+               $fixture = $this->getMock(
+                       'Tx_Belog_Domain_Repository_LogEntryRepository',
+                       array('setDefaultQuerySettings'), array($this->objectManager)
+               );
+               $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
+
+               $fixture->initializeObject();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php
new file mode 100644 (file)
index 0000000..7aa433b
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Oliver Klee <typo3-coding@oliverklee.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!
+ ***************************************************************/
+
+/**
+ * Testcase for the Tx_Belog_Domain_Repository_WorkspaceRepository class.
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ * @package TYPO3
+ * @subpackage belog
+ */
+class Tx_Belog_Domain_Repository_WorkspaceRepositoryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+       /**
+        * @var Tx_Extbase_Persistence_Typo3QuerySettings
+        */
+       private $querySettings = NULL;
+
+       public function setUp() {
+               $this->querySettings = $this->getMock('Tx_Extbase_Persistence_QuerySettingsInterface');
+
+               $this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
+               $this->objectManager->expects($this->any())->method('create')
+                       ->with('Tx_Extbase_Persistence_QuerySettingsInterface')
+                       ->will($this->returnValue($this->querySettings));
+       }
+
+       public function tearDown() {
+               unset($this->querySettings, $this->objectManager);
+       }
+
+       /**
+        * @test
+        */
+       public function initializeObjectSetsRespectStoragePidToFalse() {
+               $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
+
+               $fixture = $this->getMock(
+                       'Tx_Belog_Domain_Repository_WorkspaceRepository',
+                       array('setDefaultQuerySettings'), array($this->objectManager)
+               );
+               $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
+
+               $fixture->initializeObject();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/class.tx_belog_webinfo.php b/typo3/sysext/belog/class.tx_belog_webinfo.php
deleted file mode 100755 (executable)
index 57eddaf..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  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!
-***************************************************************/
-/**
- * Extension classes for log display in Web > Info and Tools > Log modules
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-
-
-
-/**
- * Extending for Tools > Log. Just setting labels correctly
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_belog
- */
-class logFunctions_ext extends t3lib_BEDisplayLog {
-
-       /**
-        * Initialize the log table array with header labels.
-        *
-        * @return      array
-        */
-       function initArray()    {
-               $codeArr = array();
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_time');
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_user');
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_error');
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_action');
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_table');
-               $codeArr[0][] = $GLOBALS['LANG']->getLL('chLog_l_details');
-               return $codeArr;
-       }
-}
-
-
-
-
-/**
- * Extending for Web>Info
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_belog
- */
-class tx_belog_webinfo extends t3lib_extobjbase {
-       var $localLangFile = 'locallang.php';
-
-       /**
-        * Setting up function menu
-        *
-        * @return      array           Menu items
-        */
-       function modMenu()      {
-
-               return array(
-                       'log_users' => array(
-                               0 => $GLOBALS['LANG']->getLL('chLog_users_0'),
-                               '-1' => $GLOBALS['LANG']->getLL('chLog_users_-1')
-                       ),
-                       'log_time' => array(
-                               0 => $GLOBALS['LANG']->getLL('chLog_time_0'),
-                               1 => $GLOBALS['LANG']->getLL('chLog_time_1'),
-                               2 => $GLOBALS['LANG']->getLL('chLog_time_2'),
-                               10 => $GLOBALS['LANG']->getLL('chLog_time_10'),
-                               11 => $GLOBALS['LANG']->getLL('chLog_time_11'),
-                               12 => $GLOBALS['LANG']->getLL('chLog_time_12'),
-                               20 => $GLOBALS['LANG']->getLL('chLog_time_20')
-                       ),
-                       'depth' => array(
-                               0 => $GLOBALS['LANG']->getLL('depth_0'),
-                               1 => $GLOBALS['LANG']->getLL('depth_1'),
-                               2 => $GLOBALS['LANG']->getLL('depth_2'),
-                               3 => $GLOBALS['LANG']->getLL('depth_3')
-                       )
-               );
-       }
-
-       /**
-        * Include locallang file
-        *
-        * @return      void
-        */
-       function localLang()    {
-               $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile('EXT:belog/mod/locallang.xml',FALSE);
-
-               $GLOBALS['LOCAL_LANG']=t3lib_div::array_merge_recursive_overrule($GLOBALS['LOCAL_LANG'],$LOCAL_LANG);
-       }
-
-       /**
-        * Show the log entries for page
-        *
-        * @return      string          HTML output
-        */
-       function main() {
-
-               $this->localLang();
-
-               $displayLogInstance = t3lib_div::makeInstance('logFunctions_ext');
-
-               $theOutput='';
-               $menu='';
-               $menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('chLog_menuUsers') . ': ' .
-                       t3lib_BEfunc::getFuncMenu(
-                               $this->pObj->id,
-                               'SET[log_users]',
-                               $this->pObj->MOD_SETTINGS['log_users'],
-                               $this->pObj->MOD_MENU['log_users']
-                       );
-               $menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('chLog_menuDepth') . ': ' .
-                       t3lib_BEfunc::getFuncMenu(
-                               $this->pObj->id,
-                               'SET[depth]',
-                               $this->pObj->MOD_SETTINGS['depth'],
-                               $this->pObj->MOD_MENU['depth']
-                       );
-               $menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('chLog_menuTime') . ': ' .
-                       t3lib_BEfunc::getFuncMenu(
-                               $this->pObj->id,
-                               'SET[log_time]',
-                               $this->pObj->MOD_SETTINGS['log_time'],
-                               $this->pObj->MOD_MENU['log_time']
-                       );
-               $theOutput .= $this->pObj->doc->header($GLOBALS['LANG']->getLL('chLog_title'));
-               $theOutput .= $this->pObj->doc->section(
-                       '',
-                       '<span class="nobr">' . $menu . '</span>',
-                       0,
-                       1
-               );
-
-                       // Build query
-               $where_part='';
-
-                       // Get the id-list of pages for the tree structure.
-               $tree = t3lib_div::makeInstance('t3lib_pageTree');
-               $tree->init('AND '.$this->pObj->perms_clause);
-               $tree->makeHTML=0;
-               $tree->fieldArray = array('uid');
-               if ($this->pObj->MOD_SETTINGS['depth']) {
-                       $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
-               }
-               $tree->ids[]=$this->pObj->id;
-               $idList = implode($tree->ids,',');
-
-               $where_part.=' AND (event_pid in ('.$idList.'))';               // DB
-
-                       // Time:
-               $starttime=0;
-               $endtime = $GLOBALS['EXEC_TIME'];
-               switch($this->pObj->MOD_SETTINGS['log_time'])           {
-                       case 0:
-                               // This week
-                               $week = (date('w') ? date('w') : 7)-1;
-                               $starttime = mktime (0,0,0)-$week*3600*24;
-                       break;
-                       case 1:
-                               // Last week
-                               $week = (date('w') ? date('w') : 7)-1;
-                               $starttime = mktime (0,0,0)-($week+7)*3600*24;
-                               $endtime = mktime (0,0,0)-$week*3600*24;
-                       break;
-                       case 2:
-                               // Last 7 days
-                               $starttime = mktime (0,0,0)-7*3600*24;
-                       break;
-                       case 10:
-                               // This month
-                               $starttime = mktime (0,0,0, date('m'),1);
-                       break;
-                       case 11:
-                               // Last month
-                               $starttime = mktime (0,0,0, date('m')-1,1);
-                               $endtime = mktime (0,0,0, date('m'),1);
-                       break;
-                       case 12:
-                               // Last 31 days
-                               $starttime = mktime (0,0,0)-31*3600*24;
-                       break;
-               }
-               if ($starttime) {
-                       $where_part.=' AND tstamp>='.$starttime.' AND tstamp<'.$endtime;
-               }
-
-               $where_part.=' AND type=1';             // DB
-
-
-                       // Users
-               $this->pObj->be_user_Array = t3lib_BEfunc::getUserNames();
-               if (!$this->pObj->MOD_SETTINGS['log_users'])    {       // All users
-                               // Get usernames and groupnames
-                       if (!$GLOBALS['BE_USER']->isAdmin())            {
-                               $groupArray = explode(',',$GLOBALS['BE_USER']->user['usergroup_cached_list']);
-                               $this->pObj->be_user_Array = t3lib_BEfunc::blindUserNames($this->pObj->be_user_Array,$groupArray,1);
-                       }
-
-                       if (is_array($this->pObj->be_user_Array))       {
-                               foreach ($this->pObj->be_user_Array as $val) {
-                                       $selectUsers[]=$val['uid'];
-                               }
-                       }
-                       $selectUsers[] = $GLOBALS['BE_USER']->user['uid'];
-                       $where_part.=' AND userid in ('.implode($selectUsers,',').')';
-               } else {
-                       $where_part.=' AND userid='.$GLOBALS['BE_USER']->user['uid'];   // Self user
-               }
-               $displayLogInstance->be_user_Array = &$this->pObj->be_user_Array;
-
-               if ($GLOBALS['BE_USER']->workspace!==0) {
-                       $where_part.=' AND workspace='.intval($GLOBALS['BE_USER']->workspace);
-               }
-
-
-                       // Select 100 recent log entries:
-               $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1'.$where_part, '', 'uid DESC', 100);
-
-               $codeArr = $displayLogInstance->initArray();
-               $oldHeader = '';
-               $i = 0;
-               while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log))       {
-                       $header = $this->pObj->doc->formatTime($row['tstamp'],10);
-                       if (!$oldHeader)        $oldHeader = $header;
-
-                       if ($header!=$oldHeader)        {
-                               $theOutput.=$this->pObj->doc->spacer(10);
-                               $theOutput.=$this->pObj->doc->section($oldHeader,$this->pObj->doc->table($codeArr));
-                               $codeArr = $displayLogInstance->initArray();
-                               $oldHeader=$header;
-                               $displayLogInstance->reset();
-                       }
-
-                       $i++;
-                       $codeArr[$i][] = $displayLogInstance->getTimeLabel($row['tstamp']);
-                       $codeArr[$i][] = $displayLogInstance->getUserLabel($row['userid'], $row['workspace']);
-                       $codeArr[$i][] = $row['error'] ? $displayLogInstance->getErrorIcon($row['error']) : '';
-                       $codeArr[$i][] = $displayLogInstance->getActionLabel($row['type'] . '_' . $row['action']);
-                       $codeArr[$i][] = $row['tablename'];
-                       $codeArr[$i][] = $displayLogInstance->formatDetailsForList($row);
-               }
-               $theOutput.=$this->pObj->doc->spacer(10);
-               $theOutput.=$this->pObj->doc->section($header,$this->pObj->doc->table($codeArr));
-
-               $GLOBALS['TYPO3_DB']->sql_free_result($log);
-
-               return $theOutput;
-       }
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/belog/class.tx_belog_webinfo.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/belog/class.tx_belog_webinfo.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/doc/TODO.txt b/typo3/sysext/belog/doc/TODO.txt
deleted file mode 100755 (executable)
index 44bd093..0000000
+++ /dev/null
@@ -1 +0,0 @@
-BUG: No usernames shown in the log-listing
index bbf9531..15de878 100755 (executable)
@@ -15,7 +15,7 @@ $EM_CONF[$_EXTKEY] = array(
        'description' => 'Displays backend log, both per page and systemwide. Available as the module Tools>Log (system wide overview) and Web>Info/Log (page relative overview).',
        'category' => 'module',
        'shy' => 1,
-       'dependencies' => '',
+       'dependencies' => 'extbase,fluid',
        'conflicts' => '',
        'priority' => '',
        'loadOrder' => '',
@@ -33,12 +33,14 @@ $EM_CONF[$_EXTKEY] = array(
        'author_company' => 'Curby Soft Multimedia',
        'CGLcompliance' => '',
        'CGLcompliance_note' => '',
-       'version' => '1.1.0',
+       'version' => '2.0.0',
        '_md5_values_when_last_written' => 'a:11:{s:26:"class.tx_belog_webinfo.php";s:4:"19c3";s:12:"ext_icon.gif";s:4:"691d";s:14:"ext_tables.php";s:4:"694b";s:13:"locallang.xlf";s:4:"0d9a";s:12:"doc/TODO.txt";s:4:"1631";s:13:"mod/clear.gif";s:4:"cc11";s:12:"mod/conf.php";s:4:"0186";s:13:"mod/index.php";s:4:"85a8";s:17:"mod/locallang.xlf";s:4:"e5a8";s:21:"mod/locallang_mod.xlf";s:4:"ddba";s:11:"mod/log.gif";s:4:"70bb";}',
        'constraints' => array(
                'depends' => array(
                        'php' => '5.3.0-0.0.0',
-                       'typo3' => '4.6.0-0.0.0',
+                       'typo3' => '6.0.0-0.0.0',
+                       'extbase' => '1.4.0-0.0.0', // TODO adjust before final 6.0 release
+                       'fluid' => '1.5.0-0.0.0', // TODO adjust before final 6.0 release
                ),
                'conflicts' => array(
                ),
index 23dd975..4205793 100755 (executable)
@@ -1,13 +1,33 @@
 <?php
-if (!defined ('TYPO3_MODE'))   die ('Access denied.');
+if (!defined ('TYPO3_MODE')) {
+       die ('Access denied.');
+}
 
-if (TYPO3_MODE=='BE')  {
-       t3lib_extMgm::addModule('tools','log','',t3lib_extMgm::extPath($_EXTKEY).'mod/');
+       // Register backend modules, but not in frontend or within upgrade wizards
+if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
+               // Module Web->Info->Log
        t3lib_extMgm::insertModuleFunction(
                'web_info',
-               'tx_belog_webinfo',
-               t3lib_extMgm::extPath($_EXTKEY).'class.tx_belog_webinfo.php',
+               'tx_belog_WebInfo_Bootstrap',
+               t3lib_extMgm::extPath($_EXTKEY) . 'Classes/class.tx_belog_webinfo_bootstrap.php',
                'Log'
        );
+
+               // Module Tools->Log
+       Tx_Extbase_Utility_Extension::registerModule(
+               $_EXTKEY,
+               'tools',
+               'log',
+               '',
+               array(
+                       'Tools' => 'index',
+                       'WebInfo' => 'index',
+               ),
+               array(
+                       'access' => 'admin',
+                       'icon' => 'EXT:belog/ext_icon.gif',
+                       'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xlf',
+               )
+       );
 }
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/ext_typoscript_setup.txt b/typo3/sysext/belog/ext_typoscript_setup.txt
new file mode 100644 (file)
index 0000000..037126a
--- /dev/null
@@ -0,0 +1 @@
+<INCLUDE_TYPOSCRIPT: source="FILE:EXT:belog/Configuration/TypoScript/setup.txt">
\ No newline at end of file
diff --git a/typo3/sysext/belog/locallang.xlf b/typo3/sysext/belog/locallang.xlf
deleted file mode 100644 (file)
index 72a8d0d..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="belog">
-               <header/>
-               <body>
-                       <trans-unit id="chLog_title" xml:space="preserve">
-                               <source>Admin Changelog</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_users_0" xml:space="preserve">
-                               <source>All users</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_users_-1" xml:space="preserve">
-                               <source>Self</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_0" xml:space="preserve">
-                               <source>This week</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_1" xml:space="preserve">
-                               <source>Last week</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_2" xml:space="preserve">
-                               <source>Last 7 days</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_10" xml:space="preserve">
-                               <source>This month</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_11" xml:space="preserve">
-                               <source>Last month</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_12" xml:space="preserve">
-                               <source>Last 31 days</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_time_20" xml:space="preserve">
-                               <source>No limit</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_time" xml:space="preserve">
-                               <source>Time</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_user" xml:space="preserve">
-                               <source>User</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_error" xml:space="preserve">
-                               <source>E</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_action" xml:space="preserve">
-                               <source>Action</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_table" xml:space="preserve">
-                               <source>Table</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_l_details" xml:space="preserve">
-                               <source>Details</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_menuUsers" xml:space="preserve">
-                               <source>Users</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_menuDepth" xml:space="preserve">
-                               <source>Depth</source>
-                       </trans-unit>
-                       <trans-unit id="chLog_menuTime" xml:space="preserve">
-                               <source>Time</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
diff --git a/typo3/sysext/belog/mod/clear.gif b/typo3/sysext/belog/mod/clear.gif
deleted file mode 100755 (executable)
index 9ed1269..0000000
Binary files a/typo3/sysext/belog/mod/clear.gif and /dev/null differ
diff --git a/typo3/sysext/belog/mod/conf.php b/typo3/sysext/belog/mod/conf.php
deleted file mode 100755 (executable)
index 279031e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-#define('TYPO3_MOD_PATH', 'sysext/belog/mod/');
-#$BACK_PATH='../../../';
-
-$MLANG['default']['tabs_images']['tab'] = 'log.gif';
-$MLANG['default']['ll_ref']='LLL:EXT:belog/mod/locallang_mod.xml';
-
-$MCONF['script']='_DISPATCH';
-$MCONF['access']='admin';
-$MCONF['name']='tools_log';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/mod/index.php b/typo3/sysext/belog/mod/index.php
deleted file mode 100755 (executable)
index 6bf3680..0000000
+++ /dev/null
@@ -1,563 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  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.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  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!
-***************************************************************/
-/**
- * Module: Log-viewing
- *
- * This module lets you view the changelog.
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-
-
-$GLOBALS['LANG']->includeLLFile('EXT:belog/mod/locallang.xml');
-
-$BE_USER->modAccess($MCONF, 1);
-
-
-
-
-/**
- * Tools log script class
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_belog
- */
-class SC_mod_tools_log_index {
-       var $MCONF = array();
-       var $MOD_MENU = array();
-       var $MOD_SETTINGS = array();
-
-       /**
-        * Document template object
-        *
-        * @var template
-        */
-       var $doc;
-
-       var $content;
-
-       /**
-        * @var t3lib_BEDisplayLog
-        */
-       var $displayLogInstance;
-       var $be_user_Array;
-
-       var $theTime = 0;
-       var $theTime_end = 0;
-       protected $dateFormat;
-
-       /**
-        * Initialize module
-        *
-        * @return void
-        */
-       function init() {
-               $this->MCONF = $GLOBALS['MCONF'];
-
-               $this->displayLogInstance = t3lib_div::makeInstance('t3lib_BEDisplayLog');
-
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->setModuleTemplate('templates/belog.html');
-
-                       // Load necessary JavaScript
-               /** @var $pageRenderer t3lib_PageRenderer */
-               $pageRenderer = $this->doc->getPageRenderer();
-               $pageRenderer->loadExtJS();
-               $pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/tceforms.js');
-               $pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.ux.DateTimePicker.js');
-
-                       // Define settings for Date Picker
-               $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
-               $this->dateFormat = $dateFormat . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
-               $typo3Settings = array(
-                       'datePickerUSmode' => 0,
-                       'dateFormat'       => array($dateFormat, $this->dateFormat),
-               );
-               $pageRenderer->addInlineSettingArray('', $typo3Settings);
-
-               $this->doc->JScode = '
-               <script language="javascript" type="text/javascript">
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               window.location.href = URL;
-                       }
-               </script>
-               ';
-
-               $this->doc->tableLayout = Array (
-                       '0' => Array (
-                               'defCol' => array('<td valign="top" class="t3-row-header"><strong>', '</strong></td><td class="t3-row-header"><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td>')
-                       ),
-                       'defRow' => Array (
-                               '0' => Array('<td valign="top">','</td>'),
-                               'defCol' => Array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')
-                       )
-               );
-               $this->doc->table_TABLE = '<table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist">';
-               $this->doc->form = '<form action="" method="post">';
-
-               $this->menuConfig();
-               $this->be_user_Array = t3lib_BEfunc::getUserNames();
-               $this->displayLogInstance->be_user_Array = &$this->be_user_Array;
-       }
-
-       /**
-        * Menu configuration
-        *
-        * @return void
-        */
-       function menuConfig() {
-
-                       // MENU-ITEMS:
-                       // If array, then it's a selector box menu
-                       // If empty string it's just a variable, that'll be saved.
-                       // Values NOT in this array will not be saved in the settings-array for the module.
-               $this->MOD_MENU = array(
-                       'users' => array(
-                               0 => $GLOBALS['LANG']->getLL('any'),
-                               '-1' => $GLOBALS['LANG']->getLL('self')
-                       ),
-                       'workspaces' => array(
-                               '-99' => $GLOBALS['LANG']->getLL('any'),
-                               0 => $GLOBALS['LANG']->getLL('live'),
-                       ),
-                       'time' => array(
-                               0 => $GLOBALS['LANG']->getLL('thisWeek'),
-                               1 => $GLOBALS['LANG']->getLL('lastWeek'),
-                               2 => $GLOBALS['LANG']->getLL('last7Days'),
-                               10 => $GLOBALS['LANG']->getLL('thisMonth'),
-                               11 => $GLOBALS['LANG']->getLL('lastMonth'),
-                               12 => $GLOBALS['LANG']->getLL('last31Days'),
-                               20 => $GLOBALS['LANG']->getLL('noLimit'),
-                               30 => $GLOBALS['LANG']->getLL('userdefined')
-                       ),
-                       'max' => array(
-                               20 => $GLOBALS['LANG']->getLL('20'),
-                               50 => $GLOBALS['LANG']->getLL('50'),
-                               100 => $GLOBALS['LANG']->getLL('100'),
-                               200 => $GLOBALS['LANG']->getLL('200'),
-                               500 => $GLOBALS['LANG']->getLL('500'),
-                               1000 => $GLOBALS['LANG']->getLL('1000'),
-                               1000000 => $GLOBALS['LANG']->getLL('any')
-                       ),
-                       'action' => array(
-                               0 => $GLOBALS['LANG']->getLL('any'),
-                               1 => $GLOBALS['LANG']->getLL('actionDatabase'),
-                               2 => $GLOBALS['LANG']->getLL('actionFile'),
-                               3 => $GLOBALS['LANG']->getLL('actionCache'),
-                               254 => $GLOBALS['LANG']->getLL('actionSettings'),
-                               255 => $GLOBALS['LANG']->getLL('actionLogin'),
-                               '-1' => $GLOBALS['LANG']->getLL('actionErrors')
-                       ),
-                       'manualdate' => '',
-                       'manualdate_end' => '',
-                       'groupByPage' => '',
-               );
-
-                       // Add custom workspaces (selecting all, filtering by BE_USER check):
-               if (t3lib_extMgm::isLoaded('workspaces')) {
-                       $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                               'uid,title',
-                               'sys_workspace',
-                               'pid = 0' . t3lib_BEfunc::deleteClause('sys_workspace'),
-                               '',
-                               'title'
-                       );
-                       if (count($workspaces)) {
-                               foreach ($workspaces as $rec) {
-                                       $this->MOD_MENU['workspaces'][$rec['uid']] = $rec['uid'] . ': ' . $rec['title'];
-                               }
-                       }
-               }
-
-                       // Adding groups to the users_array
-               $groups = t3lib_BEfunc::getGroupNames();
-               if (is_array($groups)) {
-                       foreach ($groups as $grVals) {
-                               $this->MOD_MENU['users']['gr-' . $grVals['uid']] = $GLOBALS['LANG']->getLL('group') . ' ' . $grVals['title'];
-                       }
-               }
-
-               $users = t3lib_BEfunc::getUserNames();
-               if (is_array($users)) {
-                       foreach ($users as $grVals) {
-                               $this->MOD_MENU['users']['us-' . $grVals['uid']] = $GLOBALS['LANG']->getLL('user') . ' ' . $grVals['username'];
-                       }
-               }
-
-                       // Cleanse settings
-               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
-
-                       // manual dates
-               if ($this->MOD_SETTINGS['time'] == 30) {
-                       if (!trim($this->MOD_SETTINGS['manualdate'])) {
-                               $this->theTime = $this->MOD_SETTINGS['manualdate'] = 0;
-                       } else {
-                               $this->theTime = $this->parseDate($this->MOD_SETTINGS['manualdate']);
-                               if (!$this->theTime) {
-                                       $this->MOD_SETTINGS['manualdate'] = '';
-                               } else {
-                                       $this->MOD_SETTINGS['manualdate'] = date($this->dateFormat, $this->theTime);
-                               }
-                       }
-
-                       if (!trim($this->MOD_SETTINGS['manualdate_end'])) {
-                               $this->theTime_end = $this->MOD_SETTINGS['manualdate_end'] = 0;
-                       } else {
-                               $this->theTime_end = $this->parseDate($this->MOD_SETTINGS['manualdate_end']);
-                               if (!$this->theTime_end) {
-                                       $this->MOD_SETTINGS['manualdate_end'] = '';
-                               } else {
-                                       $this->MOD_SETTINGS['manualdate_end'] = date($this->dateFormat, $this->theTime_end);
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Main function
-        *
-        * @return void
-        */
-       function main() {
-               $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('adminLog'));
-               $this->content .= $this->doc->spacer(5);
-
-                       // Menu compiled:
-               $menuU = t3lib_BEfunc::getFuncMenu(0, 'SET[users]', $this->MOD_SETTINGS['users'], $this->MOD_MENU['users']);
-               $menuM = t3lib_BEfunc::getFuncMenu(0, 'SET[max]', $this->MOD_SETTINGS['max'], $this->MOD_MENU['max']);
-               $menuT = t3lib_BEfunc::getFuncMenu(0, 'SET[time]', $this->MOD_SETTINGS['time'], $this->MOD_MENU['time']);
-               $menuA = t3lib_BEfunc::getFuncMenu(0, 'SET[action]', $this->MOD_SETTINGS['action'], $this->MOD_MENU['action']);
-               $menuW = t3lib_BEfunc::getFuncMenu(0, 'SET[workspaces]', $this->MOD_SETTINGS['workspaces'], $this->MOD_MENU['workspaces']);
-
-               $groupByPage = t3lib_BEfunc::getFuncCheck(0, 'SET[groupByPage]', $this->MOD_SETTINGS['groupByPage']);
-               $style = ' style="margin:4px 2px;padding:1px;vertical-align:middle;width: 115px;"';
-
-               $inputDate = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate'] ?: '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate"' . $style . ' />';
-               $pickerInputDate = t3lib_iconWorks::getSpriteIcon(
-                       'actions-edit-pick-date',
-                       array(
-                               'style' => 'cursor:pointer;',
-                               'id' => 'picker-tceforms-datetimefield-manualdate'
-                       )
-               );
-
-               $inputDate_end = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate_end'] ?: '') .'" name="SET[manualdate]" id="tceforms-datetimefield-manualdate_end"' . $style . ' />';
-               $pickerInputDate_end = t3lib_iconWorks::getSpriteIcon(
-                       'actions-edit-pick-date',
-                       array(
-                               'style' => 'cursor:pointer;',
-                               'id' => 'picker-tceforms-datetimefield-manualdate_end'
-                       )
-               );
-
-               $setButton = '<input type="button" value="' . $GLOBALS['LANG']->getLL('set') . '" onclick="jumpToUrl(\'mod.php?&amp;id=0&amp;M=tools_log&amp;SET[manualdate]=\'+escape($(\'tceforms-datetimefield-manualdate\').value)+\'&amp;SET[manualdate_end]=\'+escape($(\'tceforms-datetimefield-manualdate_end\').value),this);" />';
-
-               $this->content .= $this->doc->section('', $this->doc->menuTable(
-                       array(
-                               array($GLOBALS['LANG']->getLL('users'), $menuU),
-                               array($GLOBALS['LANG']->getLL('time'), $menuT . ($this->MOD_SETTINGS['time'] == 30 ?
-                               '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:from', TRUE) . ' ' . $inputDate . $pickerInputDate .
-                               ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:to', TRUE) . ' ' . $inputDate_end . $pickerInputDate_end . '&nbsp;' . $setButton : ''))
-                       ),
-                       array(
-                               array($GLOBALS['LANG']->getLL('max'), $menuM),
-                               array($GLOBALS['LANG']->getLL('action'), $menuA)
-                       ),
-                       array(
-                               $GLOBALS['BE_USER']->workspace !== 0 ? array($GLOBALS['LANG']->getLL('workspace'), '<strong>' . $GLOBALS['BE_USER']->workspace . '</strong>') : array($GLOBALS['LANG']->getLL('workspace'), $menuW),
-                               array($GLOBALS['LANG']->getLL('groupByPage'), $groupByPage)
-                       )
-               ));
-
-
-               $codeArr = $this->displayLogInstance->initArray();
-               $oldHeader = '';
-               $c = 0;
-
-                       // Action (type):
-               $where_part = '';
-               if ($this->MOD_SETTINGS['action'] > 0) {
-                       $where_part .= ' AND type = ' . intval($this->MOD_SETTINGS['action']);
-               } elseif ($this->MOD_SETTINGS['action'] == -1) {
-                       $where_part .= ' AND error != 0';
-               }
-
-
-               $starttime = 0;
-               $endtime = $GLOBALS['EXEC_TIME'];
-
-                       // Time:
-               switch($this->MOD_SETTINGS['time']) {
-                       case 0:
-                                       // This week
-                               $week = (date('w') ?: 7) - 1;
-                               $starttime = mktime(0, 0, 0) - $week * 3600 * 24;
-                       break;
-                       case 1:
-                                       // Last week
-                               $week = (date('w') ?: 7) - 1;
-                               $starttime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24;
-                               $endtime = mktime(0, 0, 0) - $week * 3600 * 24;
-                       break;
-                       case 2:
-                                       // Last 7 days
-                               $starttime = mktime(0, 0, 0) - 7 * 3600 * 24;
-                       break;
-                       case 10:
-                                       // This month
-                               $starttime = mktime(0, 0, 0, date('m'), 1);
-                       break;
-                       case 11:
-                                       // Last month
-                               $starttime = mktime(0, 0, 0, date('m') - 1, 1);
-                               $endtime = mktime(0, 0, 0, date('m'), 1);
-                       break;
-                       case 12:
-                                       // Last 31 days
-                               $starttime = mktime(0, 0, 0) - 31 * 3600 * 24;
-                       break;
-                       case 30:
-                               $starttime = $this->theTime;
-                               if ($this->theTime_end) {
-                                       $endtime = $this->theTime_end;
-                               } else {
-                                       $endtime = $GLOBALS['EXEC_TIME'];
-                               }
-               }
-
-               if ($starttime) {
-                       $where_part .= ' AND tstamp >= ' . $starttime . ' AND tstamp < ' . $endtime;
-               }
-
-
-                       // Users
-               $selectUsers = array();
-               if (substr($this->MOD_SETTINGS['users'], 0, 3) == 'gr-') {
-                               // All users
-                       $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, array(substr($this->MOD_SETTINGS['users'], 3)), 1);
-                       if (is_array($this->be_user_Array)) {
-                               foreach ($this->be_user_Array as $val) {
-                                       if ($val['uid'] != $GLOBALS['BE_USER']->user['uid']) {
-                                               $selectUsers[] = $val['uid'];
-                                       }
-                               }
-                       }
-                       $selectUsers[] = 0;
-                       $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
-               } elseif (substr($this->MOD_SETTINGS['users'], 0, 3) == 'us-') {
-                               // All users
-                       $selectUsers[] = intval(substr($this->MOD_SETTINGS['users'], 3));
-                       $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
-               } elseif ($this->MOD_SETTINGS['users'] == -1) {
-                               // Self user
-                       $where_part .= ' AND userid = ' . intval($GLOBALS['BE_USER']->user['uid']);
-               }
-
-                       // Workspace
-               if ($GLOBALS['BE_USER']->workspace !== 0) {
-                       $where_part .= ' AND workspace=' . intval($GLOBALS['BE_USER']->workspace);
-               } elseif ($this->MOD_SETTINGS['workspaces'] != -99) {
-                       $where_part .= ' AND workspace = ' . intval($this->MOD_SETTINGS['workspaces']);
-               }
-
-                       // Finding out which page ids are in the log:
-               $logPids = array();
-               if ($this->MOD_SETTINGS['groupByPage']) {
-                       $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('event_pid', 'sys_log', '1 = 1' . $where_part, 'event_pid');
-                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
-                               $logPids[] = $row['event_pid'];
-                       }
-
-                               // Overview:
-                       $overviewList = array();
-                       foreach($logPids as $pid) {
-                               if ((int)$pid > 0) {
-                                       $overviewList[] = htmlspecialchars(
-                                               sprintf(
-                                                       $GLOBALS['LANG']->getLL('pagenameWithUID'),
-                                                       t3lib_BEfunc::getRecordPath($pid, '', 20),
-                                                       $pid
-                                               )
-                                       );
-                               }
-                       }
-                       sort($overviewList);
-                       $this->content .= $this->doc->divider(5);
-                       $this->content .= $this->doc->section(
-                               $GLOBALS['LANG']->getLL('overview'),
-                               sprintf($GLOBALS['LANG']->getLL('timeInfo'),
-                                       date($this->dateFormat, $starttime),
-                                       date($this->dateFormat, $endtime)) .
-                               '<br /><br /><br />' . implode('<br />', $overviewList),
-                               1, 1, 0
-                       );
-
-                       $this->content .= $this->doc->spacer(30);
-               } else $logPids[] = '_SINGLE';
-
-
-               foreach($logPids as $pid) {
-                       $codeArr = $this->displayLogInstance->initArray();
-                       $this->displayLogInstance->reset();
-                       $oldHeader = '';
-
-                       $this->content .= $this->doc->divider(5);
-                       switch($pid) {
-                               case '_SINGLE':
-                                       $insertMsg = '';
-                               break;
-                               case '-1':
-                                       $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forNonPageRelatedActions') . ' ';
-                               break;
-                               case '0':
-                                       $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forRootLevel') . ' ';
-                               break;
-                               default:
-                                       $insertMsg = ' ' . sprintf($GLOBALS['LANG']->getLL('forPage'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid) . ' ';
-                               break;
-                       }
-                       $this->content .= $this->doc->section(
-                               sprintf($GLOBALS['LANG']->getLL('logForNonPageRelatedActionsOrRootLevelOrPage'),
-                                       $insertMsg,
-                                       date($this->dateFormat, $starttime),
-                                       date($this->dateFormat, $endtime)
-                               ),
-                               '', 1, 1, 0
-                       );
-
-                       $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1'.$where_part.($pid!='_SINGLE'?' AND event_pid='.intval($pid):''), '', 'uid DESC', intval($this->MOD_SETTINGS['max']));
-
-                       $i = 0;
-                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
-                               $header = $this->doc->formatTime($row['tstamp'],10);
-                               if (!$oldHeader) $oldHeader = $header;
-
-                               if ($header != $oldHeader) {
-                                       $this->content .= $this->doc->spacer(10);
-                                       $this->content .= $this->doc->section($oldHeader, $this->doc->table($codeArr));
-                                       $codeArr = $this->displayLogInstance->initArray();
-                                       $oldHeader = $header;
-                                       $this->displayLogInstance->reset();
-                               }
-
-                               $i++;
-                               $codeArr[$i][] = $row['error'] ? $this->displayLogInstance->getErrorIcon($row['error']) : '';
-                               $codeArr[$i][] = $this->displayLogInstance->getTimeLabel($row['tstamp']);
-                               $codeArr[$i][] = $this->displayLogInstance->getUserLabel($row['userid'], $row['workspace']);
-                               $codeArr[$i][] = $this->displayLogInstance->getTypeLabel($row['type']);
-                               $codeArr[$i][] = $this->displayLogInstance->getActionLabel($row['type'] . '_' . $row['action']);
-                               $codeArr[$i][] = $this->displayLogInstance->formatDetailsForList($row);
-                       }
-                       $this->content .= $this->doc->spacer(10);
-                       $this->content .= $this->doc->section($header, $this->doc->table($codeArr));
-
-                       $GLOBALS['TYPO3_DB']->sql_free_result($log);
-               }
-
-                       // Setting up the buttons and markers for docheader
-               $docHeaderButtons = $this->getButtons();
-               //$markers['CSH'] = $docHeaderButtons['csh'];
-               $markers['CONTENT'] = $this->content;
-
-                       // Build the <body> for the module
-               $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
-                       // Renders the module page
-               $this->content = $this->doc->render(
-                       $GLOBALS['LANG']->getLL('adminLog'),
-                       $this->content
-               );
-
-       }
-
-       /**
-        * Parse the manual date
-        *
-        * @param string $date
-        * @return int timestamp
-        */
-       function parseDate($date) {
-               if (strpos($date, ' ') === FALSE) {
-                       $date .= ' 0:00';
-               }
-               $parts = t3lib_div::trimExplode(' ', $date, TRUE);
-
-               $dateParts = preg_split('/[-\.\/]/', $parts[0]);
-               if (count($dateParts) < 3) {
-                       return 0;
-               }
-               $timeParts = preg_split('/[\.:]/', $parts[1]);
-               return mktime($timeParts[0], $timeParts[1], 0, $dateParts[1], $dateParts[0], $dateParts[2]);
-       }
-
-       /**
-        * Output content
-        *
-        * @return string HTML
-        */
-       function printContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Create the panel of buttons for submitting the form or otherwise perform operations.
-        *
-        * @return array all available buttons as an assoc. array
-        */
-       protected function getButtons() {
-
-               $buttons = array(
-                       'csh' => '',
-                       'shortcut' => ''
-               );
-                       // CSH
-               //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
-
-                       // Shortcut
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
-                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('','users,time,max,action',$this->MCONF['name']);
-               }
-
-               return $buttons;
-       }
-}
-
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/belog/mod/index.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/belog/mod/index.php']);
-}
-
-
-
-// Make instance:
-$SOBE = t3lib_div::makeInstance('SC_mod_tools_log_index');
-$SOBE->init();
-$SOBE->main();
-$SOBE->printContent();
-?>
\ No newline at end of file
diff --git a/typo3/sysext/belog/mod/locallang.xlf b/typo3/sysext/belog/mod/locallang.xlf
deleted file mode 100644 (file)
index d8622fc..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="belog">
-               <header/>
-               <body>
-                       <trans-unit id="adminLog" xml:space="preserve">
-                               <source>Administration log</source>
-                       </trans-unit>
-                       <trans-unit id="allUsers" xml:space="preserve">
-                               <source>[All users]</source>
-                       </trans-unit>
-                       <trans-unit id="any" xml:space="preserve">
-                               <source>[Any]</source>
-                       </trans-unit>
-                       <trans-unit id="live" xml:space="preserve">
-                               <source>LIVE</source>
-                       </trans-unit>
-                       <trans-unit id="draft" xml:space="preserve">
-                               <source>Draft</source>
-                       </trans-unit>
-                       <trans-unit id="self" xml:space="preserve">
-                               <source>Self</source>
-                       </trans-unit>
-                       <trans-unit id="userGroup" xml:space="preserve">
-                               <source>Group:</source>
-                       </trans-unit>
-                       <trans-unit id="thisWeek" xml:space="preserve">
-                               <source>This week</source>
-                       </trans-unit>
-                       <trans-unit id="lastWeek" xml:space="preserve">
-                               <source>Last week</source>
-                       </trans-unit>
-                       <trans-unit id="last7Days" xml:space="preserve">
-                               <source>Last 7 days</source>
-                       </trans-unit>
-                       <trans-unit id="thisMonth" xml:space="preserve">
-                               <source>This month</source>
-                       </trans-unit>
-                       <trans-unit id="lastMonth" xml:space="preserve">
-                               <source>Last month</source>
-                       </trans-unit>
-                       <trans-unit id="last31Days" xml:space="preserve">
-                               <source>Last 31 days</source>
-                       </trans-unit>
-                       <trans-unit id="noLimit" xml:space="preserve">
-                               <source>No limit</source>
-                       </trans-unit>
-                       <trans-unit id="userdefined" xml:space="preserve">
-                               <source>User defined</source>
-                       </trans-unit>
-                       <trans-unit id="set" xml:space="preserve">
-                               <source>Set</source>
-                       </trans-unit>
-                       <trans-unit id="20" xml:space="preserve">
-                               <source>20</source>
-                       </trans-unit>
-                       <trans-unit id="50" xml:space="preserve">
-                               <source>50</source>
-                       </trans-unit>
-                       <trans-unit id="100" xml:space="preserve">
-                               <source>100</source>
-                       </trans-unit>
-                       <trans-unit id="200" xml:space="preserve">
-                               <source>200</source>
-                       </trans-unit>
-                       <trans-unit id="500" xml:space="preserve">
-                               <source>500</source>
-                       </trans-unit>
-                       <trans-unit id="1000" xml:space="preserve">
-                               <source>1000</source>
-                       </trans-unit>
-                       <trans-unit id="actionAll" xml:space="preserve">
-                               <source>All</source>
-                       </trans-unit>
-                       <trans-unit id="actionDatabase" xml:space="preserve">
-                               <source>Database</source>
-                       </trans-unit>
-                       <trans-unit id="actionFile" xml:space="preserve">
-                               <source>File</source>
-                       </trans-unit>
-                       <trans-unit id="actionCache" xml:space="preserve">
-                               <source>Cache</source>
-                       </trans-unit>
-                       <trans-unit id="actionSettings" xml:space="preserve">
-                               <source>Settings</source>
-                       </trans-unit>
-                       <trans-unit id="actionLogin" xml:space="preserve">
-                               <source>Login</source>
-                       </trans-unit>
-                       <trans-unit id="actionErrors" xml:space="preserve">
-                               <source>Errors</source>
-                       </trans-unit>
-                       <trans-unit id="group" xml:space="preserve">
-                               <source>Group:</source>
-                       </trans-unit>
-                       <trans-unit id="user" xml:space="preserve">
-                               <source>User:</source>
-                       </trans-unit>
-                       <trans-unit id="users" xml:space="preserve">
-                               <source>Users:</source>
-                       </trans-unit>
-                       <trans-unit id="time" xml:space="preserve">
-                               <source>Time:</source>
-                       </trans-unit>
-                       <trans-unit id="max" xml:space="preserve">
-                               <source>Max:</source>
-                       </trans-unit>
-                       <trans-unit id="changesInFields" xml:space="preserve">
-                               <source>Changes in fields: %s.</source>
-                       </trans-unit>
-                       <trans-unit id="showHistory" xml:space="preserve">
-                               <source>Show History</source>
-                       </trans-unit>
-                       <trans-unit id="action" xml:space="preserve">
-                               <source>Action:</source>
-                       </trans-unit>
-                       <trans-unit id="workspace" xml:space="preserve">
-                               <source>Workspace:</source>
-                       </trans-unit>
-                       <trans-unit id="groupByPage" xml:space="preserve">
-                               <source>Group by page:</source>
-                       </trans-unit>
-                       <trans-unit id="pagenameWithUID" xml:space="preserve">
-                               <source>%s" [UID: %s]</source>
-                       </trans-unit>
-                       <trans-unit id="overview" xml:space="preserve">
-                               <source>Overview</source>
-                       </trans-unit>
-                       <trans-unit id="timeInfo" xml:space="preserve">
-                               <source>These pages have log messages from %s to %s</source>
-                       </trans-unit>
-                       <trans-unit id="forNonPageRelatedActions" xml:space="preserve">
-                               <source>for NON-PAGE related actions</source>
-                       </trans-unit>
-                       <trans-unit id="forRootLevel" xml:space="preserve">
-                               <source>for ROOT LEVEL</source>
-                       </trans-unit>
-                       <trans-unit id="forPage" xml:space="preserve">
-                               <source>for PAGE "%s" (UID: %s)</source>
-                       </trans-unit>
-                       <trans-unit id="logForNonPageRelatedActionsOrRootLevelOrPage" xml:space="preserve">
-                               <source>Log %s from %s to %s</source>
-                       </trans-unit>
-                       <trans-unit id="type_1" xml:space="preserve">
-                               <source>DB</source>
-                       </trans-unit>
-                       <trans-unit id="action_1_1" xml:space="preserve">
-                               <source>Insert</source>
-                       </trans-unit>
-                       <trans-unit id="action_1_2" xml:space="preserve">
-                               <source>Update</source>
-                       </trans-unit>
-                       <trans-unit id="action_1_3" xml:space="preserve">
-                               <source>Delete</source>
-                       </trans-unit>
-                       <trans-unit id="action_1_4" xml:space="preserve">
-                               <source>Check</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_0_1" xml:space="preserve">
-                               <source>Referer host '%s' and server host '%s' did not match!</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_1_11" xml:space="preserve">
-                               <source>Attempt to insert record on page '%s' (%s) where this table, %s, is not allowed</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_1_12" xml:space="preserve">
-                               <source>Attempt to insert a record on page '%s' (%s) from table '%s' without permissions. Or non-existing page.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_2_1" xml:space="preserve">
-                               <source>Attempt to modify table '%s' without permission</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_2_2" xml:space="preserve">
-                               <source>Attempt to modify record '%s' (%s) without permission. Or non-existing page.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_2_10" xml:space="preserve">
-                               <source>Record '%s' (%s) was updated.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_2_12" xml:space="preserve">
-                               <source>MySQL error: '%s' (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_1" xml:space="preserve">
-                               <source>Attempt to move record '%s' (%s) to after a non-existing record (uid=%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_2" xml:space="preserve">
-                               <source>Moved record '%s' (%s) to page '%s' (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_3" xml:space="preserve">
-                               <source>Moved record '%s' (%s) from page '%s' (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_4" xml:space="preserve">
-                               <source>Moved record '%s' (%s) on page '%s' (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_10" xml:space="preserve">
-                               <source>Attempt to move page '%s' (%s) to inside of its own rootline (at page '%s' (%s))</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_11" xml:space="preserve">
-                               <source>Attempt to insert record on page '%s' (%s) where this table, %s, is not allowed</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_12" xml:space="preserve">
-                               <source>Attempt to insert a record on page '%s' (%s) from table '%s' without permissions. Or non-existing page.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_13" xml:space="preserve">
-                               <source>Attempt to move record '%s' (%s) to after another record, although the table has no sorting row.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_4_14" xml:space="preserve">
-                               <source>Attempt to move record '%s' (%s) without having permissions to do so</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_1" xml:space="preserve">
-                               <source>You cannot change the 'doktype' of page '%s' to the desired value.</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_2" xml:space="preserve">
-                               <source>'doktype' of page '%s' could not be changed because the page contains records from disallowed tables; %s</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_3" xml:space="preserve">
-                               <source>Too few items in the list of values. (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_10" xml:space="preserve">
-                               <source>Could not delete file '%s' (does not exist). (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_11" xml:space="preserve">
-                               <source>Copying file '%s' failed!: No destination file (%s) possible!. (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_12" xml:space="preserve">
-                               <source>File extension '%s' is not allowed. (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_13" xml:space="preserve">
-                               <source>File size (%s) of file '%s' exceeds limit (%s). (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_14" xml:space="preserve">
-                               <source>The destination (%s) or the source file (%s) does not exist. (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_15" xml:space="preserve">
-                               <source>Copying to file '%s' failed! (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="msg_1_5_16" xml:space="preserve">
-                               <source>Copying file '%s' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)</source>
-                       </trans-unit>
-                       <trans-unit id="type_2" xml:space="preserve">
-                               <source>FILE</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_1" xml:space="preserve">
-                               <source>Upload</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_2" xml:space="preserve">
-                               <source>Copy</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_3" xml:space="preserve">
-                               <source>Move</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_4" xml:space="preserve">
-                               <source>Delete</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_5" xml:space="preserve">
-                               <source>Rename</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_6" xml:space="preserve">
-                               <source>New</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_7" xml:space="preserve">
-                               <source>Unzip</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_8" xml:space="preserve">
-                               <source>New file</source>
-                       </trans-unit>
-                       <trans-unit id="action_2_9" xml:space="preserve">
-                               <source>Edit</source>
-                       </trans-unit>
-                       <trans-unit id="msg_2_9_1" xml:space="preserve">
-                               <source>File saved to '%s', bytes: %s, MD5: %s </source>
-                       </trans-unit>
-                       <trans-unit id="type_3" xml:space="preserve">
-                               <source>CACHE</source>
-                       </trans-unit>
-                       <trans-unit id="action_3_1" xml:space="preserve">
-                               <source>Clear Cache</source>
-                       </trans-unit>
-                       <trans-unit id="type_254" xml:space="preserve">
-                               <source>SETTING</source>
-                       </trans-unit>
-                       <trans-unit id="action_254_1" xml:space="preserve">
-                               <source>Change</source>
-                       </trans-unit>
-                       <trans-unit id="type_255" xml:space="preserve">
-                               <source>LOGIN</source>
-                       </trans-unit>
-                       <trans-unit id="action_255_1" xml:space="preserve">
-                               <source>LOGIN</source>
-                       </trans-unit>
-                       <trans-unit id="action_255_2" xml:space="preserve">
-                               <source>LOGOUT</source>
-                       </trans-unit>
-                       <trans-unit id="action_255_3" xml:space="preserve">
-                               <source>ATTEMPT</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
diff --git a/typo3/sysext/belog/mod/locallang_mod.xlf b/typo3/sysext/belog/mod/locallang_mod.xlf
deleted file mode 100644 (file)
index 3afe060..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="belog">
-               <header/>
-               <body>
-                       <trans-unit id="mlang_labels_tablabel" xml:space="preserve">
-                               <source>Viewing log</source>
-                       </trans-unit>
-                       <trans-unit id="mlang_labels_tabdescr" xml:space="preserve">
-                               <source>Allows you access to the full backend changelog in TYPO3.&lt;br /&gt;&lt;em&gt;Access for 'admin' users only!&lt;/em&gt;</source>
-                       </trans-unit>
-                       <trans-unit id="mlang_tabs_tab" xml:space="preserve">
-                               <source>Log</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
diff --git a/typo3/sysext/belog/mod/log.gif b/typo3/sysext/belog/mod/log.gif
deleted file mode 100755 (executable)
index a6bc7cf..0000000
Binary files a/typo3/sysext/belog/mod/log.gif and /dev/null differ
index 3c77023..d27f25a 100644 (file)
@@ -44,7 +44,8 @@ class tx_coreupdates_installFluidExtbase extends Tx_Install_Updates_Base {
        protected $extensionsDependingOnFluidExtbase = array(
                'about',
                'aboutmodules',
-               'workspaces'
+               'workspaces',
+               'belog',
        );
 
        /**
index c769d01..320bef3 100644 (file)
                        <trans-unit id="sys_filemounts.base_relative" xml:space="preserve">
                                <source>relative ../fileadmin/</source>
                        </trans-unit>
+                       <trans-unit id="sys_log" xml:space="preserve">
+                               <source>System Log</source>
+                       </trans-unit>
                        <trans-unit id="sys_news" xml:space="preserve">
                                <source>System News</source>
                        </trans-unit>
index e85f2e4..cdc7504 100644 (file)
@@ -159,6 +159,11 @@ class template {
         */
        public $showFlashMessages = TRUE;
 
+       const STATUS_ICON_ERROR = 3;
+       const STATUS_ICON_WARNING = 2;
+       const STATUS_ICON_NOTIFICATION = 1;
+       const STATUS_ICON_OK = -1;
+
        /**
         * Constructor
         * Imports relevant parts from global $GLOBALS['TBE_STYLES'] (colorscheme)
@@ -1210,16 +1215,16 @@ $str.=$this->docBodyTagBegin().
         */
        function icons($type, $styleAttribValue='')     {
                switch($type)   {
-                       case '3':
+                       case self::STATUS_ICON_ERROR:
                                $icon = 'status-dialog-error';
                        break;
-                       case '2':
+                       case self::STATUS_ICON_WARNING:
                                $icon = 'status-dialog-warning';
                        break;
-                       case '1':
+                       case self::STATUS_ICON_NOTIFICATION:
                                $icon = 'status-dialog-notification';
                        break;
-                       case '-1':
+                       case self::STATUS_ICON_OK:
                                $icon = 'status-dialog-ok';
                        break;
                        default: