Added a $ sign at the end of the regular expression and fixed indenting in the new...
[Packages/TYPO3.CMS.git] / typo3 / alt_shortcut.php
index 7cfae03..f88c3be 100755 (executable)
@@ -262,6 +262,9 @@ class SC_alt_shortcut {
                        function changeWorkspacePreview(newstate)       {       //
                                window.location.href="alt_shortcut.php?changeWorkspacePreview="+newstate;
                        }
+                       function refreshShortcuts() { 
+                               window.location.href = document.URL;
+                       }
 
                        ');
                $this->content.=$this->doc->startPage('Shortcut frame');
@@ -418,9 +421,12 @@ class SC_alt_shortcut {
                                                        </tr>
                                                </table>
                                        </td>
-                                       <td align="right">
-                                               '.$this->workspaceSelector().
-                                                       t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'],'',TRUE).'
+                                       <td align="right">';
+               if ($this->hasWorkspaceAccess()) {
+                       $this->content .= $this->workspaceSelector() .
+                                                               t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'],'',TRUE);
+               }
+               $this->content .= '
                                        </td>
                                </tr>
                        </table>
@@ -516,7 +522,7 @@ class SC_alt_shortcut {
 
                if (count($this->lines))        {
                        if (!$BE_USER->getTSConfigVal('options.mayNotCreateEditShortcuts'))     {
-                               $this->lines=array_merge(array('<td><input type="checkbox" id="editShortcut_check" name="editShortcut_check" value="1"'.($this->editSC?' checked="checked"':'').' /><label for="editShortcut_check">'.$LANG->getLL('shortcut_edit',1).'</label>&nbsp;</td>'),$this->lines);
+                               $this->lines=array_merge(array('<td><input type="checkbox" id="editShortcut_check" name="editShortcut_check" value="1"'.($this->editSC?' checked="checked"':'').' /> <label for="editShortcut_check">'.$LANG->getLL('shortcut_edit',1).'</label>&nbsp;</td>'),$this->lines);
                                $this->lines[]='<td>'.$manageForm.'</td>';
                        }
                        $this->lines[]='<td><img src="clear.gif" width="10" height="1" alt="" /></td>';
@@ -535,7 +541,7 @@ class SC_alt_shortcut {
                if (!t3lib_extMgm::isLoaded('cms'))     return;
 
                        // EDIT page:
-               $this->editPage = trim(strtolower($this->editPage));
+               $this->editPage = trim($LANG->csConvObj->conv_case($LANG->charSet,$this->editPage,'toLower'));
                $this->editError = '';
                $this->theEditRec = '';
                $this->searchFor = '';
@@ -653,13 +659,15 @@ class SC_alt_shortcut {
                $selector = '';
                        // Preview:
                if ($BE_USER->workspace!==0)    {
-                       $selector.= 'Frontend Preview: <input type="checkbox" onclick="changeWorkspacePreview('.($BE_USER->user['workspace_preview'] ? 0 : 1).')"; '.($BE_USER->user['workspace_preview'] ? 'checked="checked"' : '').'/>&nbsp;';
+                       $selector.= '<label for="workspacePreview">Frontend Preview:</label> <input type="checkbox" name="workspacePreview" id="workspacePreview" onclick="changeWorkspacePreview('.($BE_USER->user['workspace_preview'] ? 0 : 1).')"; '.($BE_USER->user['workspace_preview'] ? 'checked="checked"' : '').'/>&nbsp;';
                }
 
                $selector.= '<a href="mod/user/ws/index.php" target="content">'.
                                        t3lib_iconWorks::getIconImage('sys_workspace',array(),$this->doc->backPath,'align="top"').
-                                       '</a>'.
-                                       '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">'.implode('',$options).'</select>';
+                                       '</a>';
+               if (count($options) > 1) {
+                       $selector .= '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">'.implode('',$options).'</select>';
+               }
 
                return $selector;
        }
@@ -748,6 +756,17 @@ class SC_alt_shortcut {
        function getLinkedPageId($url)  {
                return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
        }
+
+       /**
+        * Checks if user has access to Workspace module.
+        *
+        * @return      boolean         Returns true if user has access to workspace module.
+        */
+       function hasWorkspaceAccess() {
+               $MCONF = array();
+               include('mod/user/ws/conf.php');
+               return $GLOBALS['BE_USER']->modAccess($MCONF, false);
+       }
 }
 
 // Include extension?