Project

General

Profile

Task #11153 ยป 11153.patch

Sonja Schubert, 2010-12-19 18:17

View differences:

Classes/Service/Stages.php (revision )
// go through custom stages records
foreach ($workspaceStageRecs as $workspaceStageRec) {
// check if the user has permissions to the custom stage
if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($this->encodeStageUid($workspaceStageRec['uid']))) {
if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($workspaceStageRec['uid'])) {
// yes, so add to return array
$stagesForWSUserData[] = array(
'uid' => $this->encodeStageUid($workspaceStageRec['uid']),
'uid' => $workspaceStageRec['uid'],
'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':actionSendToStage') . ' ' . $workspaceStageRec['title']);
} else if ($workspaceStageRec['uid'] == self::STAGE_PUBLISH_EXECUTE_ID) {
if ($GLOBALS['BE_USER']->workspacePublishAccess($this->getWorkspaceId())) {
......
}
/**
* converts from versioning stage id to stage record UID
*
* @return int UID of the database record
*/
public function resolveStageUid($ver_stage) {
return $ver_stage;
//return $ver_stage - $this->raiseStageIdAmount;
}
/**
* converts from stage record UID to versioning stage id
*
* @param int UID of the stage database record
* @return int versioning stage id
*/
public function encodeStageUid($stage_uid) {
return $stage_uid;
//return $stage_uid + $this->raiseStageIdAmount;
}
/**
* Gets the title of a stage.
*
* @param integer $ver_stage
......
* @return array
*/
public function getStageRecord($stageid) {
return t3lib_BEfunc::getRecord('sys_workspace_stage', $this->resolveStageUid($stageid));
return t3lib_BEfunc::getRecord('sys_workspace_stage', $stageid);
}
/**
......
reset($workspaceStageRecs);
while (!is_null($workspaceStageRecKey = key($workspaceStageRecs))) {
$workspaceStageRec = current($workspaceStageRecs);
if ($workspaceStageRec['uid'] == $this->resolveStageUid($stageId)) {
if ($workspaceStageRec['uid'] == $stageId) {
$nextStage = next($workspaceStageRecs);
break;
}
......
end($workspaceStageRecs);
while (!is_null($workspaceStageRecKey = key($workspaceStageRecs))) {
$workspaceStageRec = current($workspaceStageRecs);
if ($workspaceStageRec['uid'] == $this->resolveStageUid($stageid)) {
if ($workspaceStageRec['uid'] == $stageid) {
$prevStage = prev($workspaceStageRecs);
break;
}
......
throw new InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:error.stageId.integer'));
}
if ($stageId != self::STAGE_PUBLISH_ID && $stageId != self::STAGE_EDIT_ID) {
$stageId = $this->resolveStageUid($stageId);
}
$workspaceStage = t3lib_BEfunc::getRecord(self::TABLE_STAGE, $stageId);
if (is_array($workspaceStage) && isset($workspaceStage[$property])) {
ChangeLog (revision )
2010-12-19 Sonja Scholz <ss@cabag.ch>
* Fixed bug: #11153: Determine whether Tx_Workspaces_Service_Stages::encodeStageUid and resolveStageUid are required
2010-12-19 Tolleiv Nietsch <typo3@tolleiv.de>
* Followup-to #9819: Workspace preview window - "live" and "workspace" buttons are clickable now
Classes/Service/Tcemain.php (revision )
* @return void
*/
protected function resetStageOfElements($stageId) {
$service = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
// @todo: remove the encode/decode functionality
$pseudoStageId = $service->encodeStageUid($stageId);
$fields = array('t3ver_stage' => Tx_Workspaces_Service_Stages::STAGE_EDIT_ID);
foreach ($this->getTcaTables() as $tcaTable) {
if (t3lib_BEfunc::isTableWorkspaceEnabled($tcaTable)) {
$where = 't3ver_stage = ' . intval($pseudoStageId);
$where = 't3ver_stage = ' . intval($stageId);
$where .= ' AND t3ver_wsid > 0 AND pid=-1';
$where .= t3lib_BEfunc::deleteClause($tcaTable);
    (1-1/1)