[TYPO3-core] RFC: Feature #7572: Extend $TSFE for FeUsers in table sys_lockedrecords

Stefan Geith typo3dev2008.nospam1 at geithware.de
Wed Oct 29 13:58:47 CET 2008


Hi Oliver,

Oliver Hader schrieb:
>>> Type: New feature
>>>
>>> Bugtracker references:
>>>    http://bugs.typo3.org/view.php?id=7572
>>>    (http://bugs.typo3.org/view.php?id=7571)
>>>    and
>>>    old: http://bugs.typo3.org/view.php?id=4655
>>>
>>> Branches:
>>>    4.2, Trunk
>>>
>>> Problem:
>>>    Manage locked records also for Fe-User Editing - TSFE-Part
>>>
>>> Solution:
>>>    Add 3 functions to TSFE for
>>>    - locking a record
>>>    - unlocking a record
>>>    - checking if record is already locked
>>>
>>> Notes:
>>>    A Test-Extension can be found in the BT.
> 
> Some annotations to your patch:
> * please define the function access "public function ..."
> * call "lockRecords" further "setRecordEditLock"
> * call "unlockRecords" further "removeRecordEditLocks"

OK; and renamed isRecordLoced to getRecordEditLockState()

> * integrate boolean return values for the set/remove methods that state
> whether the actions was successful
> * please use TYPO3_DB->fullQuoteStr() to escape strings for database
> disposal
> * instead of checking an FE-user array that might not exist, you can
> pre-check this by using $TSFE->loginUser

OK

> * a method name beginning with "is" should return a boolean value in
> general - if information should be returned this can be done by calling
> a method with an array as reference that will be filled if available,
> e.g methodName($table, $uid, &$information = NULL)

I renamed it to getRecordEditLockState(,,&$information)
because it returns a status-code -1|0|1
   0 = record is not locked
  -1 = record ist locked, but only my myself
   1 = record is locked by 1 or more other fe/beusers
$information can be string or array for getting more or less detailed 
information.

> * inside isRecordLocked() you select all items of sys_lockedrecords and
> recude it later to the requested table name and its uid - this can be
> improved - I know that it's the same in t3lib_BEfunc, but that's no
> reason for copy&paste

I first tought, I should do it the same way t3lib_BEfunc duest it - 
because of compatibility. But I now think it makes more sense the way I 
did it now; Please check this.

- - -

I have also a Plugin added to BT for testing this patch:
   http://bugs.typo3.org/file_download.php?file_id=5844&type=bug

Place this plugin on a page and you can lock / unlock / test records.

Notes:
- Naturally it only works, if your are logged in to the FE !
- Open some content-elements in the BE (!) and let them open (!!)
- In FE: Enter tt_content and the UID of the content-elements that you 
just opend in the BE and click on 'check if record is locked' and see 
the results
- In FE: Enter tt_content and the UID of a content-element and click on 
'lock record' and check in the BE, if exclamation-mark ist set on these 
records.
- In FE: log in as ANOTHER user and check the same record: should be 
locked (if you check as the SAME FeUser, then you will not get a 
'locked'-Message)

> I hope that you're still motivated to enhance your patch after my
> pedantic review. Thanks so far for the almost finished new feature!

More annotations - even 'pedantic reviews' - are welcome ;)

-

Stefan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0007572-TSFE-sys_lockedrecords-v2.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20081029/6ec1a9af/attachment.txt 


More information about the TYPO3-team-core mailing list