2 /***************************************************************
5 * (c) 2004-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
27 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
30 * [CLASS/FUNCTION INDEX of SCRIPT]
34 * 102: class tx_version_cm1 extends t3lib_SCbase
36 * SECTION: Standard module initialization
37 * 138: function menuConfig()
38 * 175: function main()
39 * 236: function jumpToUrl(URL)
40 * 296: function printContent()
42 * SECTION: Versioning management
43 * 322: function versioningMgm()
44 * 485: function pageSubContent($pid,$c=0)
45 * 539: function lookForOwnVersions($table,$uid)
46 * 556: function adminLinks($table,$row)
48 * SECTION: Workspace management
49 * 628: function workspaceMgm()
50 * 688: function displayWorkspaceOverview()
51 * 758: function displayWorkspaceOverview_list($pArray)
52 * 923: function displayWorkspaceOverview_setInPageArray(&$pArray,$table,$row)
53 * 936: function displayWorkspaceOverview_allStageCmd()
55 * SECTION: Helper functions (REDUNDANT FROM user/ws/index.php - someone could refactor this...)
56 * 986: function formatVerId($verId)
57 * 996: function formatWorkspace($wsid)
58 * 1023: function formatCount($count)
59 * 1050: function versionsInOtherWS($table,$uid)
60 * 1080: function showStageChangeLog($table,$id,$stageCommands)
61 * 1129: function subElements($uid,$treeLevel,$origId=0)
62 * 1232: function subElements_getNonPageRecords($tN, $uid, &$recList)
63 * 1262: function subElements_renderItem(&$tCell,$tN,$uid,$rec,$origId,$iconMode,$HTMLdata)
64 * 1331: function markupNewOriginals()
65 * 1353: function createDiffView($table, $diff_1_record, $diff_2_record)
66 * 1470: function displayWorkspaceOverview_stageCmd($table,&$rec_off)
67 * 1557: function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType)
68 * 1627: function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId)
71 * 1683: function publishAction()
74 * (This index is automatically created/updated by the extension "extdeveval")
79 // DEFAULT initialization of a module [BEGIN]
82 require ($BACK_PATH.'init.php');
83 require ($BACK_PATH.'template.php');
84 $LANG->includeLLFile('EXT:version/locallang.xml');
85 // DEFAULT initialization of a module [END]
87 require_once(PATH_typo3
.'mod/user/ws/class.wslib.php');
92 * Versioning module, including workspace management
94 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
98 class tx_version_cm1
extends t3lib_SCbase
{
100 // Default variables for backend modules
101 var $MCONF = array(); // Module configuration
102 var $MOD_MENU = array(); // Module menu items
103 var $MOD_SETTINGS = array(); // Module session settings
106 * document template object
111 var $content; // Accumulated content
115 var $showWorkspaceCol = 0;
116 var $formatWorkspace_cache = array();
117 var $formatCount_cache = array();
118 var $targets = array(); // Accumulation of online targets.
119 var $pageModule = ''; // Name of page module
120 var $publishAccess = FALSE;
121 var $be_user_Array = array();
122 var $stageIndex = array();
123 var $recIndex = array();
130 /*********************************
132 * Standard module initialization
134 *********************************/
137 * Initialize menu configuration
141 function menuConfig() {
144 $this->MOD_MENU
= array(
146 1 => $GLOBALS['LANG']->getLL('filter_drafts'),
147 2 => $GLOBALS['LANG']->getLL('filter_archive'),
148 0 => $GLOBALS['LANG']->getLL('filter_all'),
151 0 => $GLOBALS['LANG']->getLL('liveWorkspace'),
152 -98 => $GLOBALS['LANG']->getLL('draftWorkspaces'),
153 -99 => $GLOBALS['LANG']->getLL('filter_all'),
154 -1 => $GLOBALS['LANG']->getLL('defaultDraft')
160 if ($GLOBALS['BE_USER']->workspace
===0) { // Spend time on this only in online workspace because it might take time:
161 $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','pid=0'.t3lib_BEfunc
::deleteClause('sys_workspace'),'','title');
162 foreach($workspaces as $rec) {
163 if ($GLOBALS['BE_USER']->checkWorkspace($rec)) {
164 $this->MOD_MENU
['display'][$rec['uid']] = '['.$rec['uid'].'] '.$rec['title'];
170 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, t3lib_div
::_GP('SET'), $this->MCONF
['name'], 'ses');
174 * Main function of the module. Write the content to $this->content
179 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
189 // Setting module configuration:
190 $this->MCONF
= $GLOBALS['MCONF'];
192 $this->REQUEST_URI
= str_replace('&sendToReview=1','',t3lib_div
::getIndpEnv('REQUEST_URI'));
195 $this->doc
= t3lib_div
::makeInstance('template');
196 $this->doc
->backPath
= $BACK_PATH;
197 $this->doc
->setModuleTemplate('templates/version.html');
200 $this->doc
->inDocStylesArray
[$GLOBALS['MCONF']['name']] = '
201 .version-diff-1 { background-color: green; }
202 .version-diff-2 { background-color: red; }
205 // Setting up the context sensitive menu:
206 $this->doc
->getContextMenuCode();
208 // Getting input data:
209 $this->id
= intval(t3lib_div
::_GP('id')); // Page id. If set, indicates activation from Web>Versioning module
211 $this->uid
= intval(t3lib_div
::_GP('uid')); // Record uid. Goes with table name to indicate specific record
212 $this->table
= t3lib_div
::_GP('table'); // Record table. Goes with uid to indicate specific record
214 $this->uid
= $this->id
;
215 $this->table
= 'pages';
217 $this->details
= t3lib_div
::_GP('details'); // Page id. If set, indicates activation from Web>Versioning module
218 $this->diffOnly
= t3lib_div
::_GP('diffOnly'); // Flag. If set, shows only the offline version and with diff-view
220 // Force this setting:
221 $this->MOD_SETTINGS
['expandSubElements'] = TRUE;
222 $this->MOD_SETTINGS
['diff'] = $this->details ||
$this->MOD_SETTINGS
['diff']?
1:0;
224 // Reading the record:
225 $record = t3lib_BEfunc
::getRecord($this->table
,$this->uid
);
226 if ($record['pid']==-1) {
227 $record = t3lib_BEfunc
::getRecord($this->table
,$record['t3ver_oid']);
230 $this->recordFound
= is_array($record);
232 $pidValue = $this->table
==='pages' ?
$this->uid
: $record['pid'];
234 // Checking access etc.
235 if ($this->recordFound
&& $TCA[$this->table
]['ctrl']['versioningWS']) {
236 $this->doc
->form
='<form action="" method="post">';
237 $this->uid
= $record['uid']; // Might have changed if new live record was found!
240 // The page will show only if there is a valid page and if this page may be viewed by the user
241 $this->pageinfo
= t3lib_BEfunc
::readPageAccess($pidValue,$this->perms_clause
);
242 $access = is_array($this->pageinfo
) ?
1 : 0;
244 if (($pidValue && $access) ||
($BE_USER->user
['admin'] && !$pidValue)) {
247 $this->doc
->JScode
.= '
248 <script language="javascript" type="text/javascript">
250 function jumpToUrl(URL) {
251 window.location.href = URL;
254 function hlSubelements(origId, verId, over, diffLayer) { //
256 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
257 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
259 document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
262 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
263 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
265 document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
272 // If another page module was specified, replace the default Page module with the new one
273 $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
274 $this->pageModule
= t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
276 // Setting publish access permission for workspace:
277 $this->publishAccess
= $BE_USER->workspacePublishAccess($BE_USER->workspace
);
281 $this->workspaceMgm();
283 $this->versioningMgm();
287 $this->content
.=$this->doc
->spacer(10);
289 // Setting up the buttons and markers for docheader
290 $docHeaderButtons = $this->getButtons();
291 $markers['CSH'] = $docHeaderButtons['csh'];
292 $markers['FUNC_MENU'] = t3lib_BEfunc
::getFuncMenu($this->id
, 'SET[function]', $this->MOD_SETTINGS
['function'], $this->MOD_MENU
['function']);
293 $markers['WS_MENU'] = $this->workspaceMenu();
294 $markers['CONTENT'] = $this->content
;
296 // If no access or id value, create empty document
297 $this->content
= $this->doc
->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
299 // Setting up the buttons and markers for docheader
300 $docHeaderButtons = $this->getButtons();
301 $markers['CONTENT'] = $this->content
;
303 // Build the <body> for the module
304 $this->content
= $this->doc
->startPage($LANG->getLL('title'));
305 $this->content
.= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
306 $this->content
.= $this->doc
->endPage();
307 $this->content
= $this->doc
->insertStylesAndJS($this->content
);
311 * Outputs accumulated module content to browser.
315 function printContent() {
320 * Create the panel of buttons for submitting the form or otherwise perform operations.
322 * @return array all available buttons as an assoc. array
324 protected function getButtons() {
325 global $TCA, $LANG, $BACK_PATH, $BE_USER;
334 //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_txversionM1', '', $GLOBALS['BACK_PATH']);
336 if ($this->recordFound
&& $TCA[$this->table
]['ctrl']['versioningWS']) {
338 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::viewOnClick($this->pageinfo
['uid'], $BACK_PATH, t3lib_BEfunc
::BEgetRootLine($this->pageinfo
['uid']))) . '">' .
339 '<img' . t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="" />' .
343 if ($BE_USER->mayMakeShortcut()) {
344 $buttons['shortcut'] = $this->doc
->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU
)), $this->MCONF
['name']);
347 // If access to Web>List for user, then link to that module.
348 if ($BE_USER->check('modules','web_list')) {
349 $href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo
['uid'] . '&returnUrl=' . rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'));
350 $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' .
351 '<img' . t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' .
365 /******************************
367 * Versioning management
369 ******************************/
372 * Management of versions for record
376 function versioningMgm() {
380 $diff_1 = t3lib_div
::_POST('diff_1');
381 $diff_2 = t3lib_div
::_POST('diff_2');
382 if (t3lib_div
::_POST('do_diff')) {
384 $content.='<h3>' . $GLOBALS['LANG']->getLL('diffing') . ':</h3>';
385 if ($diff_1 && $diff_2) {
386 $diff_1_record = t3lib_BEfunc
::getRecord($this->table
, $diff_1);
387 $diff_2_record = t3lib_BEfunc
::getRecord($this->table
, $diff_2);
389 if (is_array($diff_1_record) && is_array($diff_2_record)) {
390 t3lib_div
::loadTCA($this->table
);
391 $t3lib_diff_Obj = t3lib_div
::makeInstance('t3lib_diff');
395 <tr class="bgColor5 tableheader">
396 <td>' . $GLOBALS['LANG']->getLL('fieldname') . '</td>
397 <td width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</td>
400 foreach($diff_1_record as $fN => $fV) {
401 if ($TCA[$this->table
]['columns'][$fN] && $TCA[$this->table
]['columns'][$fN]['config']['type']!='passthrough' && !t3lib_div
::inList('t3ver_label',$fN)) {
402 if (strcmp($diff_1_record[$fN],$diff_2_record[$fN])) {
404 $diffres = $t3lib_diff_Obj->makeDiffDisplay(
405 t3lib_BEfunc
::getProcessedValue($this->table
,$fN,$diff_2_record[$fN],0,1),
406 t3lib_BEfunc
::getProcessedValue($this->table
,$fN,$diff_1_record[$fN],0,1)
410 <tr class="bgColor4">
412 <td width="98%">'.$diffres.'</td>
419 if (count($tRows)>1) {
420 $content .= '<table border="0" cellpadding="1" cellspacing="1" width="100%">' . implode('', $tRows) . '</table><br /><br />';
422 $content .= $GLOBALS['LANG']->getLL('recordsMatchesCompletely');
424 } else $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound');
426 $content .= $GLOBALS['LANG']->getLL('errorDiffSources');
431 $record = t3lib_BEfunc
::getRecord($this->table
,$this->uid
);
432 $recordIcon = t3lib_iconWorks
::getIconImage($this->table
,$record,$this->doc
->backPath
,'class="absmiddle"');
433 $recTitle = t3lib_BEfunc
::getRecordTitle($this->table
,$record,TRUE);
437 '.$recordIcon.$recTitle.'
438 <form name="theform" action="'.str_replace('&sendToReview=1','',$this->REQUEST_URI
).'" method="post">
439 <table border="0" cellspacing="1" cellpadding="1">';
441 <tr class="bgColor5 tableheader">
444 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</td>
445 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</td>
446 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</td>
447 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</td>
448 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</td>
449 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</td>
450 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</td>
451 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</td>
452 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</td>
453 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</td>
454 <td colspan="2"><input type="submit" name="do_diff" value="' . $GLOBALS['LANG']->getLL('diff') . '" /></td>
457 $versions = t3lib_BEfunc
::selectVersionsOfRecord($this->table
, $this->uid
, '*', $GLOBALS['BE_USER']->workspace
);
458 foreach($versions as $row) {
459 $adminLinks = $this->adminLinks($this->table
,$row);
462 <tr class="'.($row['uid']!=$this->uid ?
'bgColor4' : 'bgColor2 tableheader').'">
463 <td>'.($row['uid']!=$this->uid ?
'<a href="'.$this->doc
->issueCommand('&cmd['.$this->table
.']['.$this->uid
.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table
.']['.$this->uid
.'][version][action]=swap').'">'.
464 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/insert1.gif','width="14" height="14"').' alt="" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent') . '" />'.
466 $this->table == 'pages' ?
467 '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][action]=swap&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][swapContent]=1').'">'.
468 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert2.gif','width="14" height="14"').' alt="" title="Publish page AND content!" />'.
470 '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][action]=swap&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][swapContent]=ALL').'">'.
471 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert4.gif','width="14" height="14"').' alt="" title="Publish page AND content! - AND ALL SUBPAGES!" />'.
472 '</a>' : '') */ : '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/blinkarrow_left.gif','width="5" height="9"').' alt="" title="' . $GLOBALS['LANG']->getLL('currentOnlineVersion') . '"/>').'</td>
473 <td nowrap="nowrap">'.$adminLinks.'</td>
474 <td nowrap="nowrap">'.t3lib_BEfunc
::getRecordTitle($this->table
,$row,TRUE).'</td>
475 <td>'.$row['uid'].'</td>
476 <td>'.$row['t3ver_oid'].'</td>
477 <td>'.$row['t3ver_id'].'</td>
478 <td>'.$row['t3ver_wsid'].'</td>
479 <td>'.$row['t3ver_state'].'</td>
480 <td>'.$row['t3ver_stage'].'</td>
481 <td>'.$row['t3ver_count'].'</td>
482 <td>'.$row['pid'].'</td>
483 <td nowrap="nowrap"><a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::editOnClick('&edit['.$this->table
.']['.$row['uid'].']=edit&columnsOnly=t3ver_label',$this->doc
->backPath
)).'"><img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/edit2.gif','width="11" height="12"').' alt="" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.edit'). '"/></a>' . htmlspecialchars($row['t3ver_label']).'</td>
484 <td class="version-diff-1"><input type="radio" name="diff_1" value="'.$row['uid'].'"'.($diff_1==$row['uid'] ?
' checked="checked"':'').'/></td>
485 <td class="version-diff-2"><input type="radio" name="diff_2" value="'.$row['uid'].'"'.($diff_2==$row['uid'] ?
' checked="checked"':'').'/></td>
488 // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;)
489 if ($this->table
== 'pages' && $row['uid']!=$this->uid
) {
490 $sub = $this->pageSubContent($row['uid']);
497 <td colspan="10">'.$sub.'</td>
498 <td colspan="2"></td>
503 $content.='</table></form>';
505 $this->content
.=$this->doc
->section('',$content,0,1);
511 <form action="'.$this->doc
->backPath
.'tce_db.php" method="post">
512 ' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . ': <input type="text" name="cmd[' . $this->table
. '][' . $this->uid
. '][version][label]" /><br />
513 '.($this->table
== 'pages' ?
'<select name="cmd['.$this->table
.']['.$this->uid
.'][version][treeLevels]">
514 '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0) ?
'<option value="0">' . $GLOBALS['LANG']->getLL('cmdPid0') . '</option>' : '').'
515 '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(1) ?
'<option value="100">' . $GLOBALS['LANG']->getLL('cmdPid100') . '</option>' : '').'
516 '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(-1) ?
'<option value="-1">' . $GLOBALS['LANG']->getLL('cmdPid1') . '</option>' : '').'
518 <br /><input type="hidden" name="cmd[' . $this->table
. '][' . $this->uid
. '][version][action]" value="new" />
519 <input type="hidden" name="prErr" value="1" />
520 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->REQUEST_URI
).'" />
521 <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
527 $this->content
.=$this->doc
->spacer(15);
528 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('createNewVersion'), $content,0,1);
533 * Recursively look for children for page version with $pid
535 * @param integer UID of page record for which to look up sub-elements following that version
536 * @param integer Counter, do not set (limits to 100 levels)
537 * @return string Table with content if any
539 function pageSubContent($pid,$c=0) {
542 $tableNames = t3lib_div
::removeArrayEntryByValue(array_keys($TCA),'pages');
543 $tableNames[] = 'pages';
545 foreach($tableNames as $tN) {
546 // Basically list ALL tables - not only those being copied might be found!
547 #if ($TCA[$tN]['ctrl']['versioning_followPages'] || $tN=='pages') {
548 $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tN, 'pid='.intval($pid).t3lib_BEfunc
::deleteClause($tN), '', ($TCA[$tN]['ctrl']['sortby'] ?
$TCA[$tN]['ctrl']['sortby'] : ''));
550 if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) {
553 <td colspan="4" class="'.($TCA[$tN]['ctrl']['versioning_followPages'] ?
'bgColor6' : ($tN=='pages' ?
'bgColor5' : 'bgColor-10')).'"'.(!$TCA[$tN]['ctrl']['versioning_followPages'] && $tN!='pages' ?
' style="color: #666666; font-style:italic;"':'').'>'.$tN.'</td>
555 while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
556 $ownVer = $this->lookForOwnVersions($tN,$subrow['uid']);
559 <td>'.$this->adminLinks($tN,$subrow).'</td>
560 <td>'.$subrow['uid'].'</td>
561 '.($ownVer>1 ?
'<td style="font-weight: bold; background-color: yellow;"><a href="index.php?table='.rawurlencode($tN).'&uid='.$subrow['uid'].'">'.($ownVer-1).'</a></td>' : '<td></td>').'
562 <td width="98%">'.t3lib_BEfunc
::getRecordTitle($tN,$subrow,TRUE).'</td>
565 if ($tN == 'pages' && $c<100) {
566 $sub = $this->pageSubContent($subrow['uid'],$c+
1);
574 <td width="98%">'.$sub.'</td>
583 return $content ?
'<table border="1" cellpadding="1" cellspacing="0" width="100%">'.$content.'</table>' : '';
587 * Look for number of versions of a record
589 * @param string Table name
590 * @param integer Record uid
591 * @return integer Number of versions for record, false if none.
593 function lookForOwnVersions($table,$uid) {
596 $versions = t3lib_BEfunc
::selectVersionsOfRecord($table, $uid, 'uid');
597 if (is_array($versions)) {
598 return count($versions);
604 * Administrative links for a table / record
606 * @param string Table name
607 * @param array Record for which administrative links are generated.
608 * @return string HTML link tags.
610 function adminLinks($table,$row) {
614 $adminLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::editOnClick('&edit['.$table.']['.$row['uid'].']=edit',$this->doc
->backPath
)).'">'.
615 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/edit2.gif','width="11" height="12"').' alt="" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.edit'). '"/>'.
619 $adminLink.= '<a href="'.htmlspecialchars($this->doc
->issueCommand('&cmd['.$table.']['.$row['uid'].'][delete]=1')).'">'.
620 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/garbage.gif','width="11" height="12"').' alt="" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.delete'). '"/>'.
625 if ($table == 'pages') {
627 // If another page module was specified, replace the default Page module with the new one
628 $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
629 $pageModule = t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
631 // Perform some acccess checks:
632 $a_wl = $BE_USER->check('modules','web_list');
633 $a_wp = t3lib_extMgm
::isLoaded('cms') && $BE_USER->check('modules',$pageModule);
635 $adminLink.='<a href="#" onclick="top.loadEditId('.$row['uid'].');top.goToModule(\''.$pageModule.'\'); return false;">'.
636 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,t3lib_extMgm
::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="" alt="" />'.
638 $adminLink.='<a href="#" onclick="top.loadEditId('.$row['uid'].');top.goToModule(\'web_list\'); return false;">'.
639 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'mod/web/list/list.gif','width="14" height="12"').' title="" alt="" />'.
642 // "View page" icon is added:
643 $adminLink.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::viewOnClick($row['uid'],$this->doc
->backPath
,t3lib_BEfunc
::BEgetRootLine($row['uid']))).'">'.
644 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'.
647 if ($row['pid']==-1) {
648 $getVars = '&ADMCMD_vPrev['.rawurlencode($table.':'.$row['t3ver_oid']).']='.$row['uid'];
650 // "View page" icon is added:
651 $adminLink.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::viewOnClick($row['_REAL_PID'],$this->doc
->backPath
,t3lib_BEfunc
::BEgetRootLine($row['_REAL_PID']),'','',$getVars)).'">'.
652 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'.
670 /******************************
672 * Workspace management
674 ******************************/
677 * Management of workspace for page ID
678 * Called when $this->id is set.
682 function workspaceMgm() {
684 // Perform workspace publishing action if buttons are pressed:
685 $errors = $this->publishAction();
687 // Generate workspace overview:
688 $WSoverview = $this->displayWorkspaceOverview();
690 // Buttons for publish / swap:
691 $actionLinks = '<br />';
692 if ($GLOBALS['BE_USER']->workspace
!==0) {
693 if ($this->publishAccess
) {
694 $actionLinks.= '<input type="submit" name="_publish" value="' . $GLOBALS['LANG']->getLL('publishPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('publishPageQuestion'), $GLOBALS['BE_USER']->workspaceRec
['publish_access'] & 1 ?
$GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');"/>';
695 if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
696 $actionLinks.= '<input type="submit" name="_swap" value="' . $GLOBALS['LANG']->getLL('swapPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('swapPageQuestion'), $GLOBALS['BE_USER']->workspaceRec
['publish_access'] & 1 ?
$GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');" />';
699 $actionLinks.= $this->doc
->icons(1) . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:no_publish_permission');
703 $actionLinks.= '<input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('refresh') . '" />';
704 $actionLinks.= '<input type="submit" name="_previewLink" value="' . $GLOBALS['LANG']->getLL('previewLink') . '" />';
705 $actionLinks.= $this->displayWorkspaceOverview_allStageCmd();
707 if ($actionLinks ||
count($errors)) {
708 $this->content
.= $this->doc
->section('', $actionLinks . (count($errors) ?
'<h3>' . $GLOABLS['LANG']->getLL('errors') . '</h3><br />' . implode('<br />', $errors) . '<hr />' : ''), 0, 1);
711 if (t3lib_div
::_POST('_previewLink')) {
712 $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
713 $ttlHours = ($ttlHours ?
$ttlHours : 24*2);
715 if (t3lib_div
::_POST('_previewLink_wholeWorkspace')) {
716 $previewUrl = t3lib_div
::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.t3lib_BEfunc
::compilePreviewKeyword('', $GLOBALS['BE_USER']->user
['uid'],60*60*$ttlHours,$GLOBALS['BE_USER']->workspace
).'&id='.intval($this->id
);
718 $params = 'id='.$this->id
.'&ADMCMD_previewWS='.$GLOBALS['BE_USER']->workspace
;
719 $previewUrl = t3lib_div
::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.t3lib_BEfunc
::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user
['uid'],60*60*$ttlHours);
721 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('previewUrl'), sprintf($GLOBALS['LANG']->getLL('previewInstruction'), $ttlHours) . '<br /><br /><a target="_blank" href="' . htmlspecialchars($previewUrl) . '">' . $previewUrl . '</a>', 0, 1);
724 // Output overview content:
725 $this->content
.= $this->doc
->spacer(15);
726 $this->content
.= $this->doc
->section($this->details ?
$GLOBALS['LANG']->getLL('versionDetails') : $GLOBALS['LANG']->getLL('wsManagement'), $WSoverview,0,1);
730 function workspaceMenu() {
733 if ($GLOBALS['BE_USER']->workspace
===0) {
734 $menu.= t3lib_BEfunc
::getFuncMenu($this->id
,'SET[filter]',$this->MOD_SETTINGS
['filter'],$this->MOD_MENU
['filter']);
735 $menu.= t3lib_BEfunc
::getFuncMenu($this->id
,'SET[display]',$this->MOD_SETTINGS
['display'],$this->MOD_MENU
['display']);
737 if (!$this->details
&& $GLOBALS['BE_USER']->workspace
&& !$this->diffOnly
) {
738 $menu.= t3lib_BEfunc
::getFuncCheck($this->id
,'SET[diff]',$this->MOD_SETTINGS
['diff'],'','','id="checkDiff"').' <label for="checkDiff">' . $GLOBALS['LANG']->getLL('showDiffView') . '</label>';
748 * Rendering the overview of versions in the current workspace
750 * @return string HTML (table)
751 * @see typo3/mod/user/ws/index.php for sister function!
753 function displayWorkspaceOverview() {
755 // Initialize variables:
756 $this->showWorkspaceCol
= $GLOBALS['BE_USER']->workspace
===0 && $this->MOD_SETTINGS
['display']<=-98;
758 // Get usernames and groupnames
759 $be_group_Array = t3lib_BEfunc
::getListGroupNames('title,uid');
760 $groupArray = array_keys($be_group_Array);
761 $this->be_user_Array
= t3lib_BEfunc
::getUserNames();
762 if (!$GLOBALS['BE_USER']->isAdmin()) $this->be_user_Array
= t3lib_BEfunc
::blindUserNames($this->be_user_Array
,$groupArray,1);
764 // Initialize Workspace ID and filter-value:
765 if ($GLOBALS['BE_USER']->workspace
===0) {
766 $wsid = $this->details ?
-99 : $this->MOD_SETTINGS
['display']; // Set wsid to the value from the menu (displaying content of other workspaces)
767 $filter = $this->details ?
0 : $this->MOD_SETTINGS
['filter'];
769 $wsid = $GLOBALS['BE_USER']->workspace
;
773 // Initialize workspace object and request all pending versions:
774 $wslibObj = t3lib_div
::makeInstance('wslib');
776 // Selecting ALL versions belonging to the workspace:
777 $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid
); // $this->uid is the page id of LIVE record.
779 // Traverse versions and build page-display array:
781 foreach($versions as $table => $records) {
782 foreach($records as $rec) {
783 $pageIdField = $table==='pages' ?
't3ver_oid' : 'realpid';
784 $this->displayWorkspaceOverview_setInPageArray(
792 // Make header of overview:
793 $tableRows = array();
794 if (count($pArray)) {
796 <tr class="bgColor5 tableheader">
797 '.($this->diffOnly?
'':'<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('liveVersion') . '</td>').'
798 <td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('wsVersions') . '</td>
799 <td nowrap="nowrap"'.($this->diffOnly?
' colspan="2"':' colspan="4"').'>' . $GLOBALS['LANG']->getLL('controls') . '</td>
802 // Add lines from overview:
803 $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray));
805 $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">'.implode('',$tableRows).'</table>';
808 $linkBack = t3lib_div
::_GP('returnUrl') ?
'<a href="' . htmlspecialchars(t3lib_div
::_GP('returnUrl')) . '" class="typo3-goBack"><img' . t3lib_iconWorks
::skinImg($this->doc
->backPath
, 'gfx/goback.gif', 'width="14" height="14"') . ' alt="" />' . $GLOBALS['LANG']->getLL('goBack') . '</a><br /><br />' : '';
809 $resetDiffOnly = $this->diffOnly ?
'<a href="index.php?id=' . intval($this->id
) . '" class="typo3-goBack">' . $GLOBALS['LANG']->getLL('showAllInformation') . '</a><br /><br />' : '';
811 $versionSelector = $GLOBALS['BE_USER']->workspace ?
$this->doc
->getVersionSelector($this->id
) : '';
813 return $versionSelector.$linkBack.$resetDiffOnly.$table.$this->markupNewOriginals();
817 * Rendering the content for the publish / review overview:
818 * (Made for internal recursive calling)
820 * @param array Storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())
821 * @return array Table rows, see displayWorkspaceOverview()
823 function displayWorkspaceOverview_list($pArray) {
826 // If there ARE elements on this level, print them:
827 $warnAboutVersions_nonPages = FALSE;
828 $warnAboutVersions_page = FALSE;
829 if (is_array($pArray)) {
830 foreach($pArray as $table => $oidArray) {
831 foreach($oidArray as $oid => $recs) {
833 // Get CURRENT online record and icon based on "t3ver_oid":
834 $rec_on = t3lib_BEfunc
::getRecord($table,$oid);
835 $icon = t3lib_iconWorks
::getIconImage($table, $rec_on, $this->doc
->backPath
,' align="top" title="'.t3lib_BEfunc
::getRecordIconAltText($rec_on,$table).'"');
836 if ($GLOBALS['BE_USER']->workspace
===0) { // Only edit online records if in ONLINE workspace:
837 $icon = $this->doc
->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 1, '', '+edit,view,info,delete');
840 // Online version display:
841 // Create the main cells which will span over the number of versions there is.
842 $verLinkUrl = $TCA[$table]['ctrl']['versioningWS'];
843 $origElement = $icon.
844 ($verLinkUrl ?
'<a href="'.htmlspecialchars('index.php?table='.$table.'&uid='.$rec_on['uid']).'">' : '').
845 t3lib_BEfunc
::getRecordTitle($table,$rec_on,TRUE).
846 ($verLinkUrl ?
'</a>' : '');
847 $mainCell_rowSpan = count($recs)>1 ?
' rowspan="'.count($recs).'"' : '';
849 <td align="center"'.$mainCell_rowSpan.'>'.$this->formatVerId($rec_on['t3ver_id']).'</td>
850 <td nowrap="nowrap"'.$mainCell_rowSpan.'>'.
852 '###SUB_ELEMENTS###'. // For substitution with sub-elements, if any.
855 // Offline versions display:
856 // Traverse the versions of the element
857 foreach($recs as $rec) {
859 // Get the offline version record and icon:
860 $rec_off = t3lib_BEfunc
::getRecord($table,$rec['uid']);
862 // Prepare swap-mode values:
863 if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1) {
864 if ($rec_off['t3ver_swapmode']>0) {
874 $icon = t3lib_iconWorks
::getIconImage($table, $rec_off, $this->doc
->backPath
, ' align="top" title="'.t3lib_BEfunc
::getRecordIconAltText($rec_off,$table).'"');
875 $tempUid = ($table != 'pages' ||
$vType==='branch' ||
$GLOBALS['BE_USER']->workspace
===0 ?
$rec_off['uid'] : $rec_on['uid']);
876 $icon = $this->doc
->wrapClickMenuOnIcon($icon, $table, $tempUid, 1, '', '+edit,' . ($table == 'pages' ?
'view,info,' : '') . 'delete');
878 // Prepare diff-code:
879 if ($this->MOD_SETTINGS
['diff'] ||
$this->diffOnly
) {
881 list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on);
882 if ($rec_on['t3ver_state']==1) { // New record:
883 $diffCode.= $this->doc
->icons(1) . $GLOBALS['LANG']->getLL('newElement') . '<br />';
884 $diffCode.= $diffHTML;
885 } elseif ($rec_off['t3ver_state']==2) {
886 $diffCode.= $this->doc
->icons(2) . $GLOBALS['LANG']->getLL('deletedElement') . '<br />';
887 } elseif ($rec_on['t3ver_state']==3) {
888 $diffCode.= $this->doc
->icons(1) . $GLOBALS['LANG']->getLL('moveToPlaceholder') . '<br />';
889 } elseif ($rec_off['t3ver_state']==4) {
890 $diffCode.= $this->doc
->icons(1) . $GLOBALS['LANG']->getLL('moveToPointer') . '<br />';
892 $diffCode.= ($diffPct<0 ?
$GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ?
$diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : ''));
893 $diffCode.= $diffHTML;
895 } else $diffCode = '';
899 $swapLabel = $GLOBALS['LANG']->getLL('element');
900 $swapClass = 'ver-element';
901 $warnAboutVersions_nonPages = $warnAboutVersions_page; // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!)
904 $swapLabel = $GLOBALS['LANG']->getLL('page');
905 $swapClass = 'ver-page';
906 $warnAboutVersions_page = !$this->showWorkspaceCol
; // This value is true only if multiple workspaces are shown and we need the opposite here.
909 $swapLabel = $GLOBALS['LANG']->getLL('branch');
910 $swapClass = 'ver-branch';
914 // Modify main cell based on first version shown:
915 $subElements = array();
916 if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1 && $mainCell) { // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version)
917 $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']);
918 $subElements['off'] = $this->subElements($rec_off['uid'],$rec_off['t3ver_swapmode'],$rec_on['uid']);
920 $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell);
922 // Create version element:
923 $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']);
924 $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace
!== 0 ?
'<br />' . $this->doc
->icons(2) . $GLOBALS['LANG']->getLL('otherVersions') . $versionsInOtherWS : '';
925 $multipleWarning = (!$mainCell && $GLOBALS['BE_USER']->workspace
!== 0 ?
'<br />' . $this->doc
->icons(3) . '<b>' . $GLOBALS['LANG']->getLL('multipleVersions') . '</b>' : '');
926 $verWarning = $warnAboutVersions ||
($warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages']) ?
'<br />' . $this->doc
->icons(3) . '<b>' . $GLOBALS['LANG']->getLL('versionInVersion') . '</b>' : '';
928 (!$this->details ?
'<a href="'.htmlspecialchars($this->doc
->backPath
.t3lib_extMgm
::extRelPath('version').'cm1/index.php?id='.($table==='pages'?
$rec_on['uid']:$rec_on['pid']).'&details='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode($this->REQUEST_URI
)).'">' : '').
929 t3lib_BEfunc
::getRecordTitle($table,$rec_off,TRUE).
930 (!$this->details ?
'</a>' : '').
931 $versionsInOtherWSWarning.
936 <td nowrap="nowrap">'.$this->showStageChangeLog($table,$rec_off['uid'],$this->displayWorkspaceOverview_stageCmd($table,$rec_off)).'</td>
937 <td nowrap="nowrap" class="'.$swapClass.'">'.
938 $this->displayWorkspaceOverview_commandLinks($table,$rec_on,$rec_off,$vType).
939 htmlspecialchars($swapLabel).
941 '.(!$this->diffOnly?
'<td nowrap="nowrap"><b>' . $GLOBALS['LANG']->getLL('lifecycle') . ':</b> '.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'. // Lifecycle
942 ($this->showWorkspaceCol ?
'
943 <td nowrap="nowrap"> <b>' . $GLOBALS['LANG']->getLL('workspace') . ':</b> '.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : ''):'');
946 $verElement = $verElement.'
947 <br /><b>' . $GLOBALS['LANG']->getLL('diffToLiveElement') . '</b>
948 <table border="0" cellpadding="0" cellspacing="0" class="ver-verElement">
950 <td class="c-diffCell">'.$diffCode.'</td>
956 // Create version cell:
958 <td align="center">'.$this->formatVerId($rec_off['t3ver_id']).'</td>
959 <td nowrap="nowrap">'.
965 // Compile table row:
967 <tr class="bgColor4">
969 ($this->diffOnly?
'':$mainCell).
975 // Reset the main cell:
987 * Building up of the $pArray
990 * @param array Array that is built up with the page tree structure
991 * @param string Table name
992 * @param array Table row
993 * @return void $pArray is passed by reference and modified internally
995 function displayWorkspaceOverview_setInPageArray(&$pArray,$table,$row) {
996 if (!$this->details ||
$this->details
==$table.':'.$row['uid']) {
997 $pArray[$table][$row['t3ver_oid']][] = $row;
1002 * Links to stage change of a version
1004 * @param string Table name
1005 * @param array Offline record (version)
1006 * @return string HTML content, mainly link tags and images.
1008 function displayWorkspaceOverview_allStageCmd() {
1010 $table = t3lib_div
::_GP('table');
1011 if ($table && $table!='pages') {
1012 $uid = t3lib_div
::_GP('uid');
1013 if ($rec_off = t3lib_BEfunc
::getRecordWSOL($table,$uid)) {
1014 $uid = $rec_off['_ORIG_uid'];
1019 if ($uid && $this->recIndex
[$table][$uid]) {
1020 $sId = $this->recIndex
[$table][$uid];
1023 $label = $GLOBALS['LANG']->getLL('commentForReviewer');
1026 $label = $GLOBALS['LANG']->getLL('commentForPublisher');
1031 if (count($this->stageIndex
[1])) { // Review:
1034 $label = $GLOBALS['LANG']->getLL('sendItemsToReview') . $GLOBALS['LANG']->getLL('commentForReviewer');
1035 $titleAttrib = $GLOBALS['LANG']->getLL('sendAllToReview');
1036 } elseif(count($this->stageIndex
[10])) { // Publish:
1039 $label = $GLOBALS['LANG']->getLL('approveToPublish') . $GLOBALS['LANG']->getLL('commentForPublisher');
1040 $titleAttrib = $GLOBALS['LANG']->getLL('approveAllToPublish');
1050 if ($table && $uid && $this->recIndex
[$table][$uid]) {
1051 $issueCmd.='&cmd['.$table.']['.$uid.'][version][action]=setStage';
1052 $issueCmd.='&cmd['.$table.']['.$uid.'][version][stageId]='.$this->recIndex
[$table][$uid];
1054 foreach($this->stageIndex
[$sId] as $table => $uidArray) {
1055 $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][action]=setStage';
1056 $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][stageId]='.$sId;
1057 $itemCount+
=count($uidArray);
1061 $onClick = 'var commentTxt=window.prompt("'.sprintf($label,$itemCount).'","");
1062 if (commentTxt!=null) {window.location.href="'.$this->doc
->issueCommand($issueCmd,$this->REQUEST_URI
).'&generalComment="+escape(commentTxt);}';
1064 if (t3lib_div
::_GP('sendToReview')) {
1065 $onClick.= ' else {window.location.href = "'.$this->REQUEST_URI
.'"}';
1067 $this->doc
->wrapScriptTags($onClick);
1069 $onClick.= ' return false;';
1071 '<input type="submit" name="_" value="'.htmlspecialchars($titleAttrib).'" onclick="'.htmlspecialchars($onClick).'" />';
1073 } elseif (t3lib_div
::_GP('sendToReview')) {
1074 $onClick = 'window.location.href = "'.$this->REQUEST_URI
.'";';
1076 $this->doc
->wrapScriptTags($onClick);
1077 } else $actionLinks = '';
1079 return $actionLinks;
1087 /**************************************
1089 * Helper functions (REDUNDANT FROM user/ws/index.php - someone could refactor this...)
1091 *************************************/
1094 * Formatting the version number for HTML output
1096 * @param integer Version number
1097 * @return string Version number for output
1099 function formatVerId($verId) {
1104 * Formatting workspace ID into a visual label
1106 * @param integer Workspace ID
1107 * @return string Workspace title
1109 function formatWorkspace($wsid) {
1111 // Render, if not cached:
1112 if (!isset($this->formatWorkspace_cache
[$wsid])) {
1115 $this->formatWorkspace_cache
[$wsid] = $GLOBALS['LANG']->getLL('offline');
1118 $this->formatWorkspace_cache
[$wsid] = ''; // Does not output anything for ONLINE because it might confuse people to think that the elemnet IS online which is not the case - only that it exists as an offline version in the online workspace...
1121 list($titleRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_workspace','uid='.intval($wsid).t3lib_BEfunc
::deleteClause('sys_workspace'));
1122 $this->formatWorkspace_cache
[$wsid] = '['.$wsid.'] '.$titleRec['title'];
1127 return $this->formatWorkspace_cache
[$wsid];
1131 * Format publishing count for version (lifecycle state)
1133 * @param integer t3ver_count value (number of times it has been online)
1134 * @return string String translation of count.
1136 function formatCount($count) {
1138 // Render, if not cached:
1139 if (!isset($this->formatCount_cache
[$count])) {
1142 $this->formatCount_cache
[$count] = $GLOBALS['LANG']->getLL('draft');
1145 $this->formatCount_cache
[$count] = $GLOBALS['LANG']->getLL('archive');
1148 $this->formatCount_cache
[$count] = sprintf($GLOBALS['LANG']->getLL('publishedXTimes'), $count);
1153 return $this->formatCount_cache
[$count];
1157 * Looking for versions of a record in other workspaces than the current
1159 * @param string Table name
1160 * @param integer Record uid
1161 * @return string List of other workspace IDs
1163 function versionsInOtherWS($table,$uid) {
1165 // Check for duplicates:
1166 // Select all versions of record NOT in this workspace:
1167 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1171 AND t3ver_oid='.intval($uid).'
1172 AND t3ver_wsid!='.intval($GLOBALS['BE_USER']->workspace
).'
1173 AND (t3ver_wsid=-1 OR t3ver_wsid>0)'.
1174 t3lib_BEfunc
::deleteClause($table),
1181 return implode(',',array_keys($rows));
1186 * Looks up stage changes for version and displays a formatted view on mouseover.
1188 * @param string Table name
1189 * @param integer Record ID
1190 * @param string HTML string to wrap the mouseover around (should be stage change links)
1191 * @return string HTML code.
1193 function showStageChangeLog($table,$id,$stageCommands) {
1194 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1195 'log_data,tstamp,userid',
1197 'action=6 and details_nr=30
1198 AND tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_log').'
1199 AND recuid='.intval($id)
1203 foreach($rows as $dat) {
1204 $data = unserialize($dat['log_data']);
1205 $username = $this->be_user_Array
[$dat['userid']] ?
$this->be_user_Array
[$dat['userid']]['username'] : '['.$dat['userid'].']';
1207 switch($data['stage']) {
1209 $text = $GLOBALS['LANG']->getLL('stage.sentToReview');
1212 $text = $GLOBALS['LANG']->getLL('stage.approvedForPublish');
1215 $text = $GLOBALS['LANG']->getLL('stage.rejectedElement');
1218 $text = $GLOBALS['LANG']->getLL('stage.resetToEdit');
1221 $text = $GLOBALS['LANG']->getLL('stage.undefined');
1224 $text = t3lib_BEfunc
::dateTime($dat['tstamp']).': "'.$username.'" '.$text;
1225 $text.= ($data['comment'] ?
'<br />' . $GLOBALS['LANG']->getLL('userComment') . ': <em>' . htmlspecialchars($data['comment']) . '</em>' : '');
1230 return count($entry) ?
'<span onmouseover="document.getElementById(\'log_'.$table.$id.'\').style.visibility = \'visible\';" onmouseout="document.getElementById(\'log_'.$table.$id.'\').style.visibility = \'hidden\';">'.$stageCommands.' ('.count($entry).')</span>'.
1231 '<div class="logLayer" style="visibility: hidden; position: absolute;" id="log_'.$table.$id.'">'.implode('<hr/>',array_reverse($entry)).'</div>' : $stageCommands;
1235 * Creates display of sub elements of a page when the swap mode is either "Page" or "Branch" (0 / ALL)
1237 * @param integer Page uid (for either online or offline version, but it MUST have swapmode/treeLevel set to >0 (not -1 indicating element versioning)
1238 * @param integer The treeLevel value, >0 indicates "branch" while 0 means page+content. (-1 would have meant element versioning, but that should never happen for a call to this function!)
1239 * @param integer For offline versions; This is t3ver_oid, the original ID of the online page.
1240 * @return string HTML content.
1242 function subElements($uid,$treeLevel,$origId=0) {
1245 if (!$this->details
&& ($GLOBALS['BE_USER']->workspace
===0 ||
!$this->MOD_SETTINGS
['expandSubElements'])) { // In online workspace we have a reduced view because otherwise it will bloat the listing:
1247 <img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/ol/joinbottom.gif','width="18" height="16"').' align="top" alt="" title="" />'.
1249 '<a href="'.htmlspecialchars($this->doc
->backPath
.t3lib_extMgm
::extRelPath('version').'cm1/index.php?id='.$uid.'&details='.rawurlencode('pages:'.$uid).'&returnUrl='.rawurlencode($this->REQUEST_URI
)).'">'.
1250 '<span class="typo3-dimmed"><em>' . $GLOBALS['LANG']->getLL('subElementsClick') . '</em><span></a>' :
1251 '<span class="typo3-dimmed"><em>' . $GLOBALS['LANG']->getLL('subElements') . '</em><span>');
1252 } else { // For an offline workspace, show sub elements:
1256 // Find records that follow pages when swapping versions:
1258 foreach($TCA as $tN => $tCfg) {
1259 if ($tN!='pages' && ($treeLevel>0 ||
$TCA[$tN]['ctrl']['versioning_followPages'])) {
1260 $this->subElements_getNonPageRecords($tN, $uid, $recList);
1264 // Render records collected above:
1265 $elCount = count($recList)-1;
1266 foreach($recList as $c => $comb) {
1267 list($tN,$rec) = $comb;
1269 $this->subElements_renderItem(
1275 $c==$elCount && $treeLevel==0 ?
1 : 0, // If true, will show bottom-join icon.
1280 // For branch, dive into the subtree:
1284 $tree = t3lib_div
::makeInstance('t3lib_pageTree');
1285 $tree->init('AND '.$GLOBALS['BE_USER']->getPagePermsClause(1));
1286 $tree->makeHTML
= 2; // 2=Also rendering depth-data into the result array
1287 $tree->getTree($uid, 99, '');
1289 // Traverse page tree:
1290 foreach($tree->tree
as $data) {
1292 // Render page in table cell:
1293 $this->subElements_renderItem(
1297 t3lib_BEfunc
::getRecord('pages',$data['row']['uid']), // Needs all fields, at least more than what is given in $data['row']...
1299 2, // 2=the join icon and icon for the record is not rendered for pages (where all is in $data['HTML']
1303 // Find all records from page and collect in $recList:
1305 foreach($TCA as $tN => $tCfg) {
1306 if ($tN!=='pages') {
1307 $this->subElements_getNonPageRecords($tN, $data['row']['uid'], $recList);
1311 // Render records collected above:
1312 $elCount = count($recList)-1;
1313 foreach($recList as $c => $comb) {
1314 list($tN,$rec) = $comb;
1316 $this->subElements_renderItem(
1322 $c==$elCount?
1:0, // If true, will show bottom-join icon.
1323 $data['HTML_depthData']
1330 <!-- Sub-element tree for versions -->
1331 <table border="0" cellpadding="0" cellspacing="1" class="ver-subtree">
1332 '.implode('',$tCell).'
1338 * Select records from a table and add them to recList
1340 * @param string Table name (from TCA)
1341 * @param integer PID to select records from
1342 * @param array Array where records are accumulated, passed by reference
1345 function subElements_getNonPageRecords($tN, $uid, &$recList) {
1348 $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1351 'pid='.intval($uid).
1352 ($TCA[$tN]['ctrl']['versioningWS'] ?
' AND t3ver_state=0' : '').
1353 t3lib_BEfunc
::deleteClause($tN),
1355 $TCA[$tN]['ctrl']['sortby'] ?
$TCA[$tN]['ctrl']['sortby'] : $GLOBALS['TYPO3_DB']->stripOrderBy($TCA[$tN]['ctrl']['default_sortby'])
1358 foreach($records as $rec) {
1359 $recList[] = array($tN,$rec);
1364 * Render a single item in a subelement list into a table row:
1366 * @param array Table rows, passed by reference
1367 * @param string Table name
1368 * @param integer Page uid for which the subelements are selected/shown
1369 * @param array Row of element in list
1370 * @param integer The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
1371 * @param integer Mode of icon display: 0=not the last, 1= is the last in list (make joinbottom icon then), 2=do not shown icons are all (for pages from the page tree already rendered)
1372 * @param string Prefix HTML data (icons for tree rendering)
1373 * @return void (Content accumulated in $tCell!)
1375 function subElements_renderItem(&$tCell,$tN,$uid,$rec,$origId,$iconMode,$HTMLdata) {
1379 $origUidFields = $TCA[$tN]['ctrl']['origUid'];
1382 if ($origUidFields) { // If there is a field for this table with original uids we will use that to connect records:
1383 if (!$origId) { // In case we are displaying the online originals:
1384 $this->targets
['orig_'.$uid.'_'.$tN.'_'.$rec['uid']] = $rec; // Build up target array (important that
1385 $tdParams = ' id="orig_'.$uid.'_'.$tN.'_'.$rec['uid'].'" class="typo3-ver"'; // Setting ID of the table row
1386 } else { // Version branch:
1387 if ($this->targets
['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]]) { // If there IS a corresponding original record...:
1389 // Prepare Table row parameters:
1390 $tdParams = ' onmouseover="hlSubelements(\''.$origId.'_'.$tN.'_'.$rec[$origUidFields].'\', \''.$uid.'_'.$tN.'_'.$rec[$origUidFields].'\', 1, '.($this->MOD_SETTINGS
['diff']==2?
1:0).');"'.
1391 ' onmouseout="hlSubelements(\''.$origId.'_'.$tN.'_'.$rec[$origUidFields].'\', \''.$uid.'_'.$tN.'_'.$rec[$origUidFields].'\', 0, '.($this->MOD_SETTINGS
['diff']==2?
1:0).');"'.
1392 ' id="ver_'.$uid.'_'.$tN.'_'.$rec[$origUidFields].'" class="typo3-ver"';
1394 // Create diff view:
1395 if ($this->MOD_SETTINGS
['diff']) {
1396 list($diffHTML,$diffPct) = $this->createDiffView($tN, $rec, $this->targets
['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]]);
1398 if ($this->MOD_SETTINGS
['diff']==2) {
1400 ($diffPct ?
'<span class="nobr">'.$diffPct.'% change</span>' : '-').
1401 '<div style="visibility: hidden; position: absolute;" id="diff_'.$uid.'_'.$tN.'_'.$rec[$origUidFields].'" class="diffLayer">'.
1406 ($diffPct<0 ?
$GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ?
$diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : '')).
1411 // Unsetting the target fields allows us to mark all originals without a version in the subtree (see ->markupNewOriginals())
1412 unset($this->targets
['orig_'.$origId.'_'.$tN.'_'.$rec[$origUidFields]]);
1413 } else { // No original record, so must be new:
1414 $tdParams = ' class="typo3-ver-new"';
1417 } else { // If no original uid column is supported for this table we are forced NOT to display any diff or highlighting.
1418 $tdParams = ' class="typo3-ver-noComp"';
1421 // Compile the cell:
1424 <td class="iconTitle">'.
1427 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/ol/join'.($iconMode ?
'bottom' : '').'.gif','width="18" height="16"').' alt="" />'.
1428 t3lib_iconWorks
::getIconImage($tN, $rec, $this->doc
->backPath
,'') : '').
1429 t3lib_BEfunc
::getRecordTitle($tN, $rec, TRUE).
1431 <td class="cmdCell">'.
1432 $this->displayWorkspaceOverview_commandLinksSub($tN,$rec,$origId).
1433 '</td>'.($origId ?
'<td class="diffCell">'.
1440 * JavaScript code to mark up new records that are online (in sub element lists)
1442 * @return string HTML javascript section
1444 function markupNewOriginals() {
1446 if (count($this->targets
)) {
1448 foreach($this->targets
as $key => $rec) {
1450 document.getElementById(\''.$key.'\').attributes.getNamedItem("class").nodeValue = \'typo3-ver-new\';
1454 return $this->doc
->wrapScriptTags($scriptCode);
1459 * Create visual difference view of two records. Using t3lib_diff library
1461 * @param string Table name
1462 * @param array New version record (green)
1463 * @param array Old version record (red)
1464 * @return array Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
1466 function createDiffView($table, $diff_1_record, $diff_2_record) {
1472 // Check that records are arrays:
1473 if (is_array($diff_1_record) && is_array($diff_2_record)) {
1475 // Load full table description and initialize diff-object:
1476 t3lib_div
::loadTCA($table);
1477 $t3lib_diff_Obj = t3lib_div
::makeInstance('t3lib_diff');
1482 <tr class="bgColor5 tableheader">
1483 <td>' . $GLOBALS['LANG']->getLL('fieldname') . ':</td>
1484 <td width="98%" nowrap="nowrap">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</td>
1488 // Initialize variables to pick up string lengths in:
1492 // Traversing the first record and process all fields which are editable:
1493 foreach($diff_1_record as $fN => $fV) {
1494 if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type']!='passthrough' && !t3lib_div
::inList('t3ver_label',$fN)) {
1496 // Check if it is files:
1498 if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN])) &&
1499 $TCA[$table]['columns'][$fN]['config']['type']=='group' &&
1500 $TCA[$table]['columns'][$fN]['config']['internal_type']=='file') {
1503 $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
1504 $files1 = array_flip(t3lib_div
::trimExplode(',', $diff_1_record[$fN],1));
1505 $files2 = array_flip(t3lib_div
::trimExplode(',', $diff_2_record[$fN],1));
1507 // Traverse filenames and read their md5 sum:
1508 foreach($files1 as $filename => $tmp) {
1509 $files1[$filename] = @is_file
(PATH_site
.$uploadFolder.'/'.$filename) ?
md5(t3lib_div
::getUrl(PATH_site
.$uploadFolder.'/'.$filename)) : $filename;
1511 foreach($files2 as $filename => $tmp) {
1512 $files2[$filename] = @is_file
(PATH_site
.$uploadFolder.'/'.$filename) ?
md5(t3lib_div
::getUrl(PATH_site
.$uploadFolder.'/'.$filename)) : $filename;
1515 // Implode MD5 sums and set flag:
1516 $diff_1_record[$fN] = implode(' ',$files1);
1517 $diff_2_record[$fN] = implode(' ',$files2);
1521 // If there is a change of value:
1522 if (strcmp(trim($diff_1_record[$fN]),trim($diff_2_record[$fN]))) {
1525 // Get the best visual presentation of the value and present that:
1526 $val1 = t3lib_BEfunc
::getProcessedValue($table,$fN,$diff_2_record[$fN],0,1);
1527 $val2 = t3lib_BEfunc
::getProcessedValue($table,$fN,$diff_1_record[$fN],0,1);
1529 // Make diff result and record string lenghts:
1530 $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1,$val2,$isFiles?
'div':'span');
1531 $diffStrLen+
= $t3lib_diff_Obj->differenceLgd
;
1532 $allStrLen+
= strlen($val1.$val2);
1534 // If the compared values were files, substituted MD5 hashes:
1536 $allFiles = array_merge($files1,$files2);
1537 foreach($allFiles as $filename => $token) {
1538 if (strlen($token)==32 && strstr($diffres,$token)) {
1540 t3lib_BEfunc
::thumbCode(array($fN=>$filename),$table,$fN,$this->doc
->backPath
).
1542 $diffres = str_replace($token,$filename,$diffres);
1547 // Add table row with result:
1549 <tr class="bgColor4">
1550 <td>'.htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel($table,$fN))).'</td>
1551 <td width="98%">'.$diffres.'</td>
1555 // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
1556 $allStrLen+
=strlen($diff_1_record[$fN].$diff_2_record[$fN]);
1561 // Calculate final change percentage:
1562 $pctChange = $allStrLen ?
ceil($diffStrLen*100/$allStrLen) : -1;
1564 // Create visual representation of result:
1565 if (count($tRows)>1) {
1566 $content.= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">'.implode('',$tRows).'</table>';
1568 $content.= '<span class="nobr">'.$this->doc
->icons(1) . $GLOBALS['LANG']->getLL('completeMatch') . '</span>';
1570 } else $content.= $this->doc
->icons(3) . $GLOBALS['LANG']->getLL('errorRecordsNotFound');
1573 return array($content,$pctChange);
1577 * Links to stage change of a version
1579 * @param string Table name
1580 * @param array Offline record (version)
1581 * @return string HTML content, mainly link tags and images.
1583 function displayWorkspaceOverview_stageCmd($table,&$rec_off) {
1584 #debug($rec_off['t3ver_stage']);
1585 switch((int)$rec_off['t3ver_stage']) {
1588 $sLabel = $GLOBALS['LANG']->getLL('editing');
1590 $label = $GLOBALS['LANG']->getLL('commentForReviewer');
1591 $titleAttrib = $GLOBALS['LANG']->getLL('sendToReview');
1595 $sLabel = $GLOBALS['LANG']->getLL('review');
1597 $label = $GLOBALS['LANG']->getLL('commentForPublisher');
1598 $titleAttrib = $GLOBALS['LANG']->getLL('approveForPublishing');
1601 $sLabel = $GLOBALS['LANG']->getLL('publish');
1605 $sLabel = $this->doc
->icons(2) . $GLOBALS['LANG']->getLL('rejected');
1608 $label = $GLOBALS['LANG']->getLL('comment');
1609 $titleAttrib = $GLOBALS['LANG']->getLL('resetStage');
1612 $sLabel = $GLOBALS['LANG']->getLL('undefined');
1619 $raiseOk = !$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off);
1621 if ($raiseOk && $rec_off['t3ver_stage']!=-1) {
1622 $onClick = 'var commentTxt=window.prompt("' . $GLOBALS['LANG']->getLL('rejectExplain') . '","");
1623 if (commentTxt!=null) {window.location.href="'.$this->doc
->issueCommand(
1624 '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
1625 '&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]=-1'
1626 ).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.
1630 '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
1631 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/down.gif','width="14" height="14"').' alt="" align="top" title="' . $GLOBALS['LANG']->getLL('reject') . '" />'.
1636 '<img src="'.$this->doc
->backPath
.'gfx/clear.gif" width="14" height="14" alt="" align="top" title="" />';
1639 $actionLinks.= '<span style="background-color: '.$color.'; color: white;">'.$sLabel.'</span>';
1643 $onClick = 'var commentTxt=window.prompt("'.$label.'","");
1644 if (commentTxt!=null) {window.location.href="'.$this->doc
->issueCommand(
1645 '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
1646 '&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]='.$sId
1647 ).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.
1649 if ($rec_off['t3ver_stage']!=10) {
1651 '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
1652 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/up.gif','width="14" height="14"').' alt="" align="top" title="'.htmlspecialchars($titleAttrib).'" />'.
1655 $this->stageIndex
[$sId][$table][] = $rec_off['uid'];
1656 $this->recIndex
[$table][$rec_off['uid']] = $sId;
1659 return $actionLinks;
1663 * Links to publishing etc of a version
1665 * @param string Table name
1666 * @param array Online record
1667 * @param array Offline record (version)
1668 * @param string Swap type, "branch", "page" or "element"
1669 * @return string HTML content, mainly link tags and images.
1671 function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType) {
1672 if ($this->publishAccess
&& (!($GLOBALS['BE_USER']->workspaceRec
['publish_access']&1) ||
(int)$rec_off['t3ver_stage']===10)) {
1674 '<a href="'.htmlspecialchars($this->doc
->issueCommand(
1675 '&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.
1676 '&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid']
1678 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/insert1.gif','width="14" height="14"').' alt="" align="top" title="' . $GLOBALS['LANG']->getLL('publish') . '" />'.
1680 if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
1682 '<a href="'.htmlspecialchars($this->doc
->issueCommand(
1683 '&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.
1684 '&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid'].
1685 '&cmd['.$table.']['.$rec_on['uid'].'][version][swapIntoWS]=1'
1687 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/swap.png','width="14" height="14"').' alt="" align="top" title="' . $GLOBALS['LANG']->getLL('swap') . '" />'.
1692 if (!$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off)) {
1695 '<a href="'.htmlspecialchars($this->doc
->issueCommand('&cmd['.$table.']['.$rec_off['uid'].'][version][action]=clearWSID')).'" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('removeFromWorkspace') . '?\');">'.
1696 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/group_clear.gif','width="14" height="14"').' alt="" align="top" title="' . $GLOBALS['LANG']->getLL('removeFromWorkspace') . '" />'.
1700 if ($table==='pages' && $vType!=='element') {
1701 $tempUid = ($vType==='branch' ||
$GLOBALS['BE_USER']->workspace
===0 ?
$rec_off['uid'] : $rec_on['uid']);
1703 '<a href="#" onclick="top.loadEditId('.$tempUid.');top.goToModule(\''.$this->pageModule
.'\'); return false;">'.
1704 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,t3lib_extMgm
::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_page'). '" alt="" />'.
1707 $params = '&edit['.$table.']['.$rec_off['uid'].']=edit';
1709 '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::editOnClick($params,$this->doc
->backPath
)).'">'.
1710 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/edit2.gif','width="12" height="12"').' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_element'). '" alt="" />'.
1717 '<a href="'.htmlspecialchars($this->doc
->backPath
.'show_rechis.php?element='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode($this->REQUEST_URI
)).'">'.
1718 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/history2.gif','width="13" height="12"').' title="' . $GLOBALS['LANG']->getLL('showLog') . '" alt="" />'.
1722 if ($table==='pages') {
1723 $tempUid = ($vType==='branch' ||
$GLOBALS['BE_USER']->workspace
===0 ?
$rec_off['uid'] : $rec_on['uid']);
1725 '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::viewOnClick($tempUid,$this->doc
->backPath
,t3lib_BEfunc
::BEgetRootLine($tempUid))).'">'.
1726 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'.
1730 return $actionLinks;
1734 * Links to publishing etc of a version
1736 * @param string Table name
1737 * @param array Record
1738 * @param integer The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
1739 * @return string HTML content, mainly link tags and images.
1741 function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId) {
1743 if ($origId ||
$GLOBALS['BE_USER']->workspace
===0) {
1744 if (!$GLOBALS['BE_USER']->workspaceCannotEditRecord($table,$rec)) {
1746 if ($table==='pages') {
1748 '<a href="#" onclick="top.loadEditId('.$uid.');top.goToModule(\''.$this->pageModule
.'\'); return false;">'.
1749 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,t3lib_extMgm
::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_page'). '" alt="" />'.
1752 $params = '&edit['.$table.']['.$uid.']=edit';
1754 '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::editOnClick($params,$this->doc
->backPath
)).'">'.
1755 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/edit2.gif','width="12" height="12"').' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_element'). '" alt="" />'.
1762 '<a href="'.htmlspecialchars($this->doc
->backPath
.'show_rechis.php?element='.rawurlencode($table.':'.$uid).'&returnUrl='.rawurlencode($this->REQUEST_URI
)).'">'.
1763 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/history2.gif','width="13" height="12"').' title="' . $GLOBALS['LANG']->getLL('showLog') . '" alt="" />'.
1768 if ($table==='pages') {
1770 '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::viewOnClick($uid,$this->doc
->backPath
,t3lib_BEfunc
::BEgetRootLine($uid))).'">'.
1771 '<img'.t3lib_iconWorks
::skinImg($this->doc
->backPath
,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'.
1775 return $actionLinks;
1786 /**********************************
1790 **********************************/
1793 * Will publish workspace if buttons are pressed
1797 function publishAction() {
1799 // If "Publish" or "Swap" buttons are pressed:
1800 if (t3lib_div
::_POST('_publish') || t3lib_div
::_POST('_swap')) {
1802 if ($this->table
==='pages') { // Making sure ->uid is a page ID!
1803 // Initialize workspace object and request all pending versions:
1804 $wslibObj = t3lib_div
::makeInstance('wslib');
1805 $cmd = $wslibObj->getCmdArrayForPublishWS($GLOBALS['BE_USER']->workspace
, t3lib_div
::_POST('_swap'),$this->uid
);
1807 // Execute the commands:
1808 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
1809 $tce->stripslashes_values
= 0;
1810 $tce->start(array(), $cmd);
1811 $tce->process_cmdmap();
1813 t3lib_BEfunc
::getSetUpdateSignal('updatePageTree');
1815 return $tce->errorLog
;
1823 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/version/cm1/index.php']) {
1824 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/version/cm1/index.php']);
1831 $SOBE = t3lib_div
::makeInstance('tx_version_cm1');
1836 $SOBE->printContent();