Implemented versioning API, phase 1 (tcemain). See changelog
[Packages/TYPO3.CMS.git] / typo3 / alt_doc.php
index 81d1619..9543079 100755 (executable)
@@ -73,7 +73,7 @@
 
 require('init.php');
 require('template.php');
-$LANG->includeLLFile('EXT:lang/locallang_alt_doc.php');
+$LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
 require_once (PATH_t3lib.'class.t3lib_tceforms.php');
 require_once (PATH_t3lib.'class.t3lib_clipboard.php');
 
@@ -375,7 +375,7 @@ class SC_alt_doc {
                $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
 
                        // Create an instance of the document template object
-               $this->doc = t3lib_div::makeInstance('bigDoc');
+               $this->doc = t3lib_div::makeInstance('mediumDoc');
                $this->doc->bodyTagMargins['x']=5;
                $this->doc->bodyTagMargins['y']=5;
                $this->doc->backPath = $BACK_PATH;
@@ -414,7 +414,7 @@ class SC_alt_doc {
                                return false;
                        }
                '.(isset($HTTP_POST_VARS['_savedokview_x']) && $this->popViewId ? t3lib_BEfunc::viewOnClick($this->popViewId,'',t3lib_BEfunc::BEgetRootLine($this->popViewId),'',$this->viewUrl) : '')
-               );
+               ).$this->doc->getDynTabMenuJScode();
 
                        // Setting up the context sensitive menu:
                $CMparts = $this->doc->getContextMenuCode();
@@ -446,6 +446,7 @@ class SC_alt_doc {
                        $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
                        $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
                        $this->tceforms->enableClickMenu = TRUE;
+                       $this->tceforms->enableTabMenu = TRUE;
 
                                // Clipboard is initialized:
                        $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');          // Start clipboard
@@ -481,7 +482,7 @@ class SC_alt_doc {
                                $this->content.= $this->functionMenus();
 
                                        // Add CSH:
-                               $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|');
+                               $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|',FALSE,'margin-top: 20px;');
 
                                $this->content.= $this->shortCutLink();
 
@@ -557,8 +558,9 @@ class SC_alt_doc {
                                                                // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
                                                                // First, resetting flags.
                                                        $hasAccess = 1;
-                                                       $deleteAccess=0;
-                                                       $this->viewId=0;
+                                                       $deniedAccessReason = '';
+                                                       $deleteAccess = 0;
+                                                       $this->viewId = 0;
 
                                                                // If the command is to create a NEW record...:
                                                        if ($cmd=='new')        {
@@ -586,7 +588,8 @@ class SC_alt_doc {
                                                                }
                                                                $this->dontStoreDocumentRef=1;          // Don't save this document title in the document selector if the document is new.
                                                        } else {        // Edit:
-                                                               $calcPRec=t3lib_BEfunc::getRecord($table,$theUid);
+                                                               $calcPRec = t3lib_BEfunc::getRecord($table,$theUid);
+                                                               t3lib_BEfunc::fixVersioningPid($table,$calcPRec);
                                                                if (is_array($calcPRec))        {
                                                                        if ($table=='pages')    {       // If pages:
                                                                                $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
@@ -599,7 +602,13 @@ class SC_alt_doc {
                                                                                $deleteAccess = $CALC_PERMS&16 ? 1 : 0;
                                                                                $this->viewId = $calcPRec['pid'];
                                                                        }
-                                                               } else $hasAccess=0;
+
+                                                                               // Check internals regarding access:
+                                                                       if ($hasAccess) {
+                                                                               $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
+                                                                               $deniedAccessReason = $BE_USER->errorMsg;
+                                                                       }
+                                                               } else $hasAccess = 0;
                                                        }
 
                                                        // AT THIS POINT we have checked the access status of the editing/creation of records and we can now proceed with creating the form elements:
@@ -641,6 +650,9 @@ class SC_alt_doc {
                                                                                $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
                                                                        }
 
+                                                                               // Register default language labels, if any:
+                                                                       $this->tceforms->registerDefaultLanguageData($table,$rec);
+
                                                                                // Create form for the record (either specific list of fields or the whole record):
                                                                        $panel = '';
                                                                        if ($this->columnsOnly) {
@@ -679,7 +691,8 @@ class SC_alt_doc {
                                                                $thePrevUid = $rec['uid'];
                                                        } else {
                                                                $this->errorC++;
-                                                               $editForm.=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission',1).'<br /><br />';
+                                                               $editForm.=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission',1).'<br /><br />'.
+                                                                                       ($deniedAccessReason ? 'Reason: '.htmlspecialchars($deniedAccessReason).'<br/><br/>' : '');
                                                        }
                                                }
                                        }
@@ -802,7 +815,7 @@ class SC_alt_doc {
                                $docSel='<select name="_docSelector" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
 
                                        // Add CSH:
-                               $docSel.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_docSelector', $GLOBALS['BACK_PATH'],'');
+                               $docSel.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_docSelector', $GLOBALS['BACK_PATH'],'', TRUE);
                        }
                } else $docSel='';
                return $docSel;
@@ -822,7 +835,7 @@ class SC_alt_doc {
                        $cMenu = $this->doc->clearCacheMenu(intval($this->viewId),!$this->modTSconfig['properties']['disableDocSelector']);
 
                                // Add CSH:
-                       $cMenu.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'],'');
+                       $cMenu.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'],'', TRUE);
                } else $cMenu ='';
                return $cMenu;
        }