Added feature #7571: FeUsers in table sys_lockedrecords
authorOliver Hader <oliver.hader@typo3.org>
Tue, 28 Oct 2008 18:03:44 +0000 (18:03 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 28 Oct 2008 18:03:44 +0000 (18:03 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4364 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
t3lib/stddb/tables.sql
typo3/sysext/lang/locallang_core.xml

index 3b5cad9..16c583c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
        * Fixed bug #9623: Flexform sections are not working anymore since script.aculo.us is not loaded
        * Fixed bug #9665: t3lib_BEfunc has a lot of hanging SQL record sets
        * Fixed bug #9664: EM fails on retrieving files of uppercase extension keys (thanks to Marcus Krause)
+       * Added feature #7571: FeUsers in table sys_lockedrecords (thanks to Stefan Geith)
 
 2008-10-24  Oliver Hader  <oliver@typo3.org>
 
index 9391753..ecdf2e8 100755 (executable)
@@ -2896,6 +2896,7 @@ final class t3lib_BEfunc {
                if ($table && $uid) {
                        $fields_values = array(
                                'userid' => $user_id,
+                               'feuserid' => 0,
                                'tstamp' => $GLOBALS['EXEC_TIME'],
                                'record_table' => $table,
                                'record_uid' => $uid,
@@ -2930,16 +2931,34 @@ final class t3lib_BEfunc {
                                                                AND sys_lockedrecords.tstamp > '.($GLOBALS['EXEC_TIME']-2*3600)
                                                );
                        while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                                       // Get the type of the user that locked this record: 
+                               if ($row['userid']) {
+                                       $userTypeLabel = 'beUser';
+                               } elseif ($row['feuserid']) {
+                                       $userTypeLabel = 'feUser';
+                               } else {
+                                       $userTypeLabel = 'user';
+                               }
+                               $userType = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.' . $userTypeLabel);
+                                       // Get the username (if available):
+                               if ($row['username']) {
+                                       $userName = $row['username'];
+                               } else {
+                                       $userName = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.unknownUser');
+                               }
+
                                $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']] = $row;
                                $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']]['msg'] = sprintf(
-                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord'),
-                                       $row['username'],
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecordUser'),
+                                       $userType,
+                                       $userName,
                                        t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
                                );
                                if ($row['record_pid'] && !isset($LOCKED_RECORDS[$row['record_table'].':'.$row['record_pid']])) {
                                        $LOCKED_RECORDS['pages:'.$row['record_pid']]['msg'] = sprintf(
-                                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord_content'),
-                                               $row['username'],
+                                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecordUser_content'),
+                                               $userType,
+                                               $userName,
                                                t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
                                        );
                                }
index 273e2c0..1b5cad9 100755 (executable)
@@ -289,6 +289,7 @@ CREATE TABLE sys_lockedrecords (
   record_uid int(11) DEFAULT '0' NOT NULL,
   record_pid int(11) DEFAULT '0' NOT NULL,
   username varchar(20) DEFAULT '' NOT NULL,
+  feuserid int(11) unsigned DEFAULT '0' NOT NULL,
   PRIMARY KEY (uid),
   KEY event (userid,tstamp)
 );
index b8c7553..7f553d5 100755 (executable)
                        <label index="labels.makeShortcut">Create a shortcut to this page?</label>
                        <label index="labels.lockedRecord">The user '%s' began to edit this record %s ago.</label>
                        <label index="labels.lockedRecord_content">The user '%s' began to edit content on this page %s ago.</label>
+                       <label index="labels.lockedRecordUser">The %s '%s' began to edit this record %s ago.</label>
+                       <label index="labels.lockedRecordUser_content">The %s '%s' began to edit content on this page %s ago.</label>
+                       <label index="labels.user">User</label>
+                       <label index="labels.beUser">BE-User</label>
+                       <label index="labels.feUser">FE-User</label>
+                       <label index="labels.unknownUser">-Unknown-</label>
                        <label index="labels.showRecords">Show records</label>
                        <label index="labels.path">Path</label>
                        <label index="labels.table">Table</label>