Project

General

Profile

Bug #12307 » 12307_workspaces_v3.diff

Susanne Moog, 2011-01-19 15:36

View differences:

Resources/Public/JavaScript/grid.js (Arbeitskopie)
singleSelect: false,
hidden: true,
listeners: {
beforerowselect : function (selection, rowIndex, keep, rec) {
if (rec.json.allowedAction_nextStage || rec.json.allowedAction_prevStage) {
return true;
} else {
return false;
}
},
selectionchange: function (selection) {
var record = selection.grid.getSelectionModel().getSelections();
if (record.length > 0) {
......
}),
bbar : TYPO3.Workspaces.Toolbar.FullBottomBar,
tbar : TYPO3.Workspaces.Toolbar.FullTopToolbar
});
});
Resources/Public/JavaScript/component.js (Arbeitskopie)
TYPO3.Workspaces.RowExpander = new Ext.grid.RowExpander({
menuDisabled: true,
hideable: false,
getRowClass : function(record, rowIndex, p, ds) {
class = '';
if (!record.json.allowedAction_nextStage && !record.json.allowedAction_prevStage) {
class = 'typo3-workspaces-row-disabled ';
}
if(this.state[record.id]) {
class += 'x-grid3-row-expanded';
} else {
class += 'x-grid3-row-collapsed';
}
return class;
},
remoteDataMethod : function (record, index) {
TYPO3.Workspaces.RowDetail.rowDataStore.baseParams = {
uid: record.json.uid,
......
},
scope : this
}
});
});
Resources/Public/StyleSheet/module.css (Arbeitskopie)
div .t3-workspaces-comments-singleComment-content-title {
padding: 8px 0 8px 0;
font-weight: bold;
}
.typo3-workspaces-row-disabled .x-grid3-td-checker {
visibility: hidden;
}
Classes/Service/Stages.php (Arbeitskopie)
*/
public function getStagesForWSUser() {
// initiate return array of stages with edit stage
$stagesForWSUserData = array();
$allowedStages = array();
$orderedAllowedStages = array();
// get all stages for the current workspace
$workspaceStageRecs = $this->getStagesForWS();
if (is_array($workspaceStageRecs) && !empty($workspaceStageRecs)) {
// go through custom stages records
foreach ($workspaceStageRecs as $workspaceStageRec) {
// check if the user has permissions to the custom stage
if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($workspaceStageRec['uid'])) {
// yes, so add to return array
$stagesForWSUserData[] = array(
'uid' => $workspaceStageRec['uid'],
'title' => $workspaceStageRec['title']
);
} else if ($workspaceStageRec['uid'] == self::STAGE_PUBLISH_EXECUTE_ID) {
if ($GLOBALS['BE_USER']->workspacePublishAccess($this->getWorkspaceId())) {
$stagesForWSUserData[] = $workspaceStageRec;
}
if ($GLOBALS['BE_USER']->isAdmin()) {
$orderedAllowedStages = $workspaceStageRecs;
} else {
foreach ($workspaceStageRecs as $workspaceStageRec) {
if ($this->isStageAllowedForUser($workspaceStageRec['uid'])) {
$stagesForWSUserData[$workspaceStageRec['uid']] = $workspaceStageRec;
} else if ($workspaceStageRec['uid'] == self::STAGE_PUBLISH_EXECUTE_ID && $GLOBALS['BE_USER']->workspacePublishAccess($this->getWorkspaceId())) {
$allowedStages[] = $workspaceStageRec;
$stagesForWSUserData[$workspaceStageRec['uid']] = $workspaceStageRec;
}
}
foreach ($stagesForWSUserData as $allowedStage) {
$nextStage = $this->getNextStage($allowedStage['uid']);
$prevStage = $this->getPrevStage($allowedStage['uid']);
if (isset($nextStage['uid'])) {
$allowedStages[$nextStage['uid']] = $nextStage;
}
if (isset($prevStage['uid'])) {
$allowedStages[$prevStage['uid']] = $prevStage;
}
}
$orderedAllowedStages = array_values($allowedStages);
}
}
return $stagesForWSUserData;
return $orderedAllowedStages;
}
/**
......
// if there's no prev-stage the stageIds match,
// otherwise we've to check if the user is permitted to use the stage
if (!empty($prevStage) && $prevStage['uid'] != $stageId) {
$isAllowed = $this->isStageAllowedForUser($prevStage['uid']);
// if the current stage is allowed for the user, the user is also allowed to send to prev
$isAllowed = $this->isStageAllowedForUser($stageId);
}
} catch (Exception $e) {
// Exception raised - we're not allowed to go this way
......
// if there's no next-stage the stageIds match,
// otherwise we've to check if the user is permitted to use the stage
if (!empty($nextStage) && $nextStage['uid'] != $stageId) {
$isAllowed = $this->isStageAllowedForUser($nextStage['uid']);
// if the current stage is allowed for the user, the user is also allowed to send to next
$isAllowed = $this->isStageAllowedForUser($stageId);
}
} catch (Exception $e) {
// Exception raised - we're not allowed to go this way
......
$cacheKey = $this->getWorkspaceId() . '_' . $stageId;
$isAllowed = FALSE;
if (isset($this->workspaceStageAllowedCache[$cacheKey])) {
$isAllowed = $this->workspaceStageAllowedCache[$cacheKey];
$isAllowed = $this->workspaceStageAllowedCache[$cacheKey];
} else {
$isAllowed = $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($stageId);
$this->workspaceStageAllowedCache[$cacheKey] = $isAllowed;
$isAllowed = $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($stageId);
$this->workspaceStageAllowedCache[$cacheKey] = $isAllowed;
}
return $isAllowed;
}
(8-8/8)