Fixed Bug #9415 - "Do" Dropdown in Workspace module doesn't respect users rights...
authorBenni Mack <benni.mack@typo3.org>
Fri, 26 Jun 2009 16:44:21 +0000 (16:44 +0000)
committerBenni Mack <benni.mack@typo3.org>
Fri, 26 Jun 2009 16:44:21 +0000 (16:44 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5639 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/mod/user/ws/class.wslib_gui.php
typo3/sysext/lang/locallang_mod_user_ws.xml

index bdd40f9..d875638 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-26  Benjamin Mack  <benni@typo3.org>
+
+       * Fixed Bug #9415 - "Do" Dropdown in Workspace module doesn't respect users rights (Thanks to Franz Koch)
+
 2009-06-26  Christian Kuhn  <lolli@schwarzbu.ch>
 
        * Added feature #8601: Hook for debug_typo3PrintError
index ac7ddb0..f69e3e2 100644 (file)
@@ -182,33 +182,42 @@ class wslib_gui {
                        $browse.= '<br />';
                }
                $browse.= '<br />';
-
+               
                $workspaceOverviewList = $this->displayWorkspaceOverview_list($pArray);
                if ($workspaceOverviewList || $this->alwaysDisplayHeader) {
                        // Make header of overview:
                        $tableRows = array();
-                       $tableRows[] = '
+                       $tableHeader = '
                                <tr class="bgColor5 tableheader">
                                        <td nowrap="nowrap" width="100">' . $LANG->getLL('label_pagetree') . '</td>
                                        <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_live_version') . '</td>
                                        <td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_draft_versions') . '</td>
                                        <td nowrap="nowrap">' . $LANG->getLL('label_stage') . '</td>
                                        <td nowrap="nowrap">' . $LANG->getLL('label_publish') . '</td>
-                                       <td><select name="_with_selected_do" onchange="if (confirm(\'Sure you want to perform this action with selected elements?\')) {document.forms[0].submit();}">
-                                               <option value="_">Do:</option>
-                                               <option value="publish">Publish</option>
-                                               <option value="swap">Swap</option>
-                                               <option value="release">Release</option>
-                                               <option value="stage_-1">Stage: Reject</option>
-                                               <option value="stage_0">Stage: Editing</option>
-                                               <option value="stage_1">Stage: Review</option>
-                                               <option value="stage_10">Stage: Publish</option>
-                                               <option value="flush">Flush (Delete)</option>
+                                       <td><select name="_with_selected_do" onchange="if (confirm(\'' . $LANG->getLL('submit_apply_action_on_selected_elements') . '\')) {document.forms[0].submit();}">
+                                               <option value="_">' . $LANG->getLL('label_doaction_default') . '</option>';
+                       
+                       if ($this->publishAccess && !($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1)) {
+                               $tableHeader .= '<option value="publish">' . $LANG->getLL('label_doaction_publish') . '</option>';
+                               if ($GLOBALS['BE_USER']->workspaceSwapAccess()) {
+                                       $tableHeader .= '<option value="swap">' . $LANG->getLL('label_doaction_swap') . '</option>';
+                               }
+                       }                                               
+                       if ($GLOBALS['BE_USER']->workspace !== 0) {
+                               $tableHeader .= '<option value="release">' . $LANG->getLL('label_doaction_release') . '</option>';
+                       }
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('-1') ? '<option value="stage_-1">' . $LANG->getLL('label_doaction_stage_reject') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('0') ? '<option value="stage_0">' . $LANG->getLL('label_doaction_stage_editing') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('1') ? '<option value="stage_1">' . $LANG->getLL('label_doaction_stage_review') . '</option>' : '';
+                       $tableHeader .= $GLOBALS['BE_USER']->workspaceCheckStageForCurrent('10') ? '<option value="stage_10">' . $LANG->getLL('label_doaction_stage_publish') . '</option>' : '';
+                       
+                       $tableHeader .= '<option value="flush">' . $LANG->getLL('label_doaction_flush') . '</option>
                                        </select></td>
                                        <td>' . $LANG->getLL('label_lifecycle') . '</td>
                                        '.($this->showWorkspaceCol ? '<td>' . $LANG->getLL('label_workspace') . '</td>' : '').'
                                </tr>';
-
+                       $tableRows[] = $tableHeader;
+                       
                        // Add lines from overview:
                        $tableRows = array_merge($tableRows, $workspaceOverviewList);
 
@@ -432,12 +441,11 @@ class wslib_gui {
                                                                                        $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_newrecord') . '<br />';
                                                                                        $diffCode.= $diffHTML;
                                                                                } elseif ($rec_off['t3ver_state']==2)   {
-                                                                                       $diffCode.= $this->doc->icons(2) . 'Deleted element<br />';
-                                                                                       $diffCode.= $this->doc->icons(2) . $LANG->getLL('label_deletedrecord') . '<br />';
+                                                                                       $diffCode.= $this->doc->icons(2) . $LANG->getLL('label_deletedrecord') . '<br/>';
                                                                                } elseif ($rec_on['t3ver_state']==3)    {
-                                                                                       $diffCode.= $this->doc->icons(1) . 'Move-to placeholder (destination)<br />';
+                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_placeholder') . '<br/>';
                                                                                } elseif ($rec_off['t3ver_state']==4)   {
-                                                                                       $diffCode.= $this->doc->icons(1) . 'Move-to pointer (source)<br />';
+                                                                                       $diffCode.= $this->doc->icons(1) . $LANG->getLL('label_moveto_pointer') . '<br/>';
                                                                                } else {
                                                                                        $diffCode.= ($diffPct<0 ? 'N/A' : ($diffPct ? $diffPct.'% change:' : ''));
                                                                                        $diffCode.= ($diffPct<0 ? $LANG->getLL('label_notapplicable') : ($diffPct ? sprintf($LANG->getLL('label_percentchange'), $diffPct) : ''));
@@ -1252,7 +1260,7 @@ class wslib_gui {
 
                $raiseOk = !$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off);
 
-               if ($raiseOk && $rec_off['t3ver_stage']!=-1)    {
+               if ($raiseOk && $rec_off['t3ver_stage'] != -1 && $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($sId))      {
                        $onClick = 'var commentTxt=window.prompt("'.$LANG->getLL('explain_reject').'","");
                                                        if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(
                        '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
@@ -1274,7 +1282,7 @@ class wslib_gui {
                $actionLinks.= '<span style="background-color: '.$color.'; color: white;">'.$sLabel.'</span>';
 
                // Raise
-               if ($raiseOk)   {
+               if ($raiseOk && $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($sId))       {
                        $onClick = 'var commentTxt=window.prompt("'.$label.'","");
                                                        if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(
                        '&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.
@@ -1300,4 +1308,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/u
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/class.wslib_gui.php']);
 }
 
-?>
\ No newline at end of file
+?>
index 3370617..efa2595 100755 (executable)
@@ -30,6 +30,7 @@
                        <label index="submit_swap_workspace">Swap workspace</label>
                        <label index="submit_swap_workspace_confirmation_1">Are you sure you want to publish (swap) all content in &quot;Publish&quot; stage from the workspace?</label>
                        <label index="submit_swap_workspace_confirmation_2">Are you sure you want to publish (swap) all content from the workspace?</label>
+                       <label index="submit_apply_action_on_selected_elements">Sure you want to perform this action with selected elements?</label>
                        <label index="no_publish_permission">You are not permitted to publish from this workspace</label>
                        <label index="label_workspace">Workspace:</label>
                        <label index="label_description">Description:</label>
                        <label index="label_allWSes">All workspaces</label>
                        <label index="label_notapplicable">n/a</label>
                        <label index="label_percentchange">%%% change:</label>
+                       <label index="label_doaction_default">Do:</label>
+                       <label index="label_doaction_publish">Publish</label>
+                       <label index="label_doaction_swap">Swap</label>
+                       <label index="label_doaction_release">Remove this version</label>
+                       <label index="label_doaction_stage_reject">Reject changes</label>
+                       <label index="label_doaction_stage_editing">Send to stage: Editing</label>
+                       <label index="label_doaction_stage_review">Send to stage: Review</label>
+                       <label index="label_doaction_stage_publish">Send to stage: Publish</label>
+                       <label index="label_doaction_flush">Flush ALL changes/versions</label>
+                       <label index="label_moveto_placeholder">Move-to placeholder (destination)</label>
+                       <label index="label_moveto_pointer">Move-to pointer (source)</label>
                </languageKey>
        </data>
 </T3locallang>