Project

General

Profile

Feature #16445 » 3998.patch

Administrator Admin, 2006-08-08 16:08

View differences:

typo3_src-4.0/typo3/mod/user/ws/class.wslib.php 2006-08-02 11:37:53.000000000 +0200
* @param integer Lifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple), anything else selects all.
* @param integer Stage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10"
* @param integer Page id: Live page for which to find versions in workspace!
* @param integer user filter: Only select versions created by that user
* @return array Array of all records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid, t3ver_oid and t3ver_swapmode fields. The REAL pid of the online record is found as "realpid"
*/
function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1) {
function selectVersionsInWorkspace($wsid,$filter=0,$stage=-99,$pageId=-1,$limit_cruser=0) {
global $TCA;
$wsid = intval($wsid);
......
// Traversing all tables supporting versioning:
foreach($TCA as $table => $cfg) {
if ($TCA[$table]['ctrl']['versioningWS']) {
// Select all records from this table in the database from the workspace
// This joins the online version with the offline version as tables A and B
$output[$table] = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows (
'A.uid, A.t3ver_oid,'.($table==='pages' ? ' A.t3ver_swapmode,':'').' B.pid AS realpid',
'A.uid, A.t3ver_oid,'.($table==='pages' ? ' A.t3ver_swapmode,A.cruser_id,':'').' B.pid AS realpid',
$table.' A,'.$table.' B',
'A.pid=-1'. // Table A is the offline version and pid=-1 defines offline
($pageId!=-1 ? ($table==='pages' ? ' AND B.uid='.intval($pageId) : ' AND B.pid='.intval($pageId)) : '').
......
($stage!=-99 ? ' AND A.t3ver_stage='.intval($stage) : '').
' AND B.pid>=0'. // Table B (online) must have PID >= 0 to signify being online.
' AND A.t3ver_oid=B.uid'. // ... and finally the join between the two tables.
(($TCA[$table]['ctrl']['cruser_id'] != '' && $limit_cruser > 0) ? ' AND A.cruser_id='.$limit_cruser : ''). // limit
t3lib_BEfunc::deleteClause($table,'A').
t3lib_BEfunc::deleteClause($table,'B'),
'',
typo3_src-4.0/typo3/mod/user/ws/index.php 2006-08-03 15:30:45.692638356 +0200
2 => $LANG->getLL('diff_show_popup'),
),
'expandSubElements' => '',
'onlyMyChanges' => '',
);
// Add workspaces:
......
if ($GLOBALS['BE_USER']->workspace!==0) {
$menu.= t3lib_BEfunc::getFuncCheck(0,'SET[expandSubElements]',$this->MOD_SETTINGS['expandSubElements']).' '.$LANG->getLL('label_showsubelements').' ';
}
$menu.= t3lib_BEfunc::getFuncCheck(0,'SET[onlyMyChanges]',$this->MOD_SETTINGS['onlyMyChanges']).' '.$LANG->getLL('label_onlymychanges').' - ';
// Create header:
$title = '';
......
$wslibObj = t3lib_div::makeInstance('wslib');
// Selecting ALL versions belonging to the workspace:
$versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter);
if ($this->MOD_SETTINGS['onlyMyChanges'] == true) {
$versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, -1, $GLOBALS['BE_USER']->user['uid']);
} else {
$versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter);
}
// Traverse versions and build page-display array:
$pArray = array();
(1-1/3)