* Feature added to disable automatic update of diff data for translation when saving...
authorKasper Skårhøj <kasper@typo3.org>
Fri, 1 Feb 2008 23:14:30 +0000 (23:14 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 1 Feb 2008 23:14:30 +0000 (23:14 +0000)
* Added option for custom message in the logout message for workspace previews.
* Fixed a bug in TTLhours for preview links.

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3011 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php
t3lib/config_default.php
typo3/alt_doc.php
typo3/gfx/translationsavedok.gif [new file with mode: 0644]
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/lang/locallang_core.xml
typo3/sysext/version/cm1/index.php

index 2c5f11a..1205cb2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-01  Kasper Sk\8crh¿j <kasper2008@typo3.com>
+       
+       * Feature added to disable automatic update of diff data for translation when saving records. Instead a button is added to explicitly do this. Feature is called "explicitConfirmationOfTranslation" in $TYPO3_CONF_VARS
+       * Added option for custom message in the logout message for workspace previews. 
+       * Fixed a bug in TTLhours for preview links.
+
 2008-02-01  Bernhard Kraft  <kraftb@kraftb.at>
 
        * added feature #7337: stdWrap for "range" and "entryLevel" in class.tslib_menu.php (patch by Georg Ringer)
@@ -14,8 +20,7 @@
        * added feature #7267: Shortcut manager - shortcut icon should reflect record type
        * added Event.stop() to toggle functions of the toolbar items to prevent adding a # to the browser's location bar
 
-2008-01-31  Kasper Sk�rh�j <kasper2008@typo3.com>
-
+2008-01-31  Kasper Sk\8crh¿j <kasper2008@typo3.com>
        * Bugfixes to MM-relations, among other in workspaces (Bugs 3531 / 3907 solved)
 
        class.t3lib_tcemain.php
index 0000b26..8886f1c 100755 (executable)
@@ -256,6 +256,8 @@ class t3lib_TCEmain {
        var $deleteTree = FALSE;                                // Boolean. If this is set, then a page is deleted by deleting the whole branch under it (user must have deletepermissions to it all). If not set, then the page is deleted ONLY if it has no branch
        var $neverHideAtCopy = FALSE;                   // Boolean. If set, then the 'hideAtCopy' flag for tables will be ignored.
        var $dontProcessTransformations = FALSE;        // Boolean: If set, then transformations are NOT performed on the input.
+       var $clear_flexFormData_vDEFbase = FALSE;       // Boolean: If set, .vDEFbase values are unset in flexforms.
+       var $updateModeL10NdiffData = TRUE;             // Boolean/Mixed: TRUE: (traditional) Updates when record is saved. For flexforms, updates if change is made to the localized value. FALSE: Will not update anything. "FORCE_FFUPD" (string): Like TRUE, but will force update to the FlexForm Field
        var $bypassWorkspaceRestrictions = FALSE;       // Boolean: If true, workspace restrictions are bypassed on edit an create actions (process_datamap()). YOU MUST KNOW what you do if you use this feature!
        var $bypassFileHandling = FALSE;                        // Boolean: If true, file handling of attached files (addition, deletion etc) is bypassed - the value is saved straight away. YOU MUST KNOW what you are doing with this feature!
        var $bypassAccessCheckForRecords = FALSE;       // Boolean: If true, access check, check for deleted etc. for records is bypassed. YOU MUST KNOW what you are doing if you use this feature!
@@ -390,6 +392,10 @@ class t3lib_TCEmain        {
                if ($GLOBALS['BE_USER']->uc['recursiveDelete'])    {
                        $this->deleteTree = 1;
                }
+               
+               if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation'] && $this->updateModeL10NdiffData===TRUE)     {
+                       $this->updateModeL10NdiffData = FALSE;
+               }
 
                        // Initializing default permissions for pages
                $defaultPermissions = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPermissions'];
@@ -1095,7 +1101,7 @@ class t3lib_TCEmain       {
                                                                        $fieldArray[$field]=$res['value'];
 
                                                                                // Add the value of the original record to the diff-storage content:
-                                                                       if ($TCA[$table]['ctrl']['transOrigDiffSourceField'])   {
+                                                                       if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField'])  {
                                                                                $originalLanguage_diffStorage[$field] = $originalLanguageRecord[$field];
                                                                                $diffStorageFlag = TRUE;
                                                                        }
@@ -2285,7 +2291,9 @@ class t3lib_TCEmain       {
 
                                                                // Finally, check if new and old values are different (or no .vDEFbase value is found) and if so, we record the vDEF value for diff'ing.
                                                                // We do this after $dataValues has been updated since I expect that $dataValues_current holds evaluated values from database (so this must be the right value to compare with).
-                                                       if ($GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && $vKey!=='vDEF' && (strcmp($dataValues[$key][$vKey],$dataValues_current[$key][$vKey]) || !isset($dataValues_current[$key][$vKey.'.vDEFbase'])))   {
+                                                       if ($this->clear_flexFormData_vDEFbase) {
+                                                               $dataValues[$key][$vKey.'.vDEFbase'] = '';
+                                                       } elseif ($this->updateModeL10NdiffData && $GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && $vKey!=='vDEF' && (strcmp($dataValues[$key][$vKey],$dataValues_current[$key][$vKey]) || !isset($dataValues_current[$key][$vKey.'.vDEFbase']) || $this->updateModeL10NdiffData==='FORCE_FFUPD'))   {
                                                                        // Now, check if a vDEF value is submitted in the input data, if so we expect this has been processed prior to this operation (normally the case since those fields are higher in the form) and we can use that:
                                                                if (isset($dataValues[$key]['vDEF']))   {
                                                                        $diffValue = $dataValues[$key]['vDEF'];
@@ -5086,7 +5094,7 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
                }
                return $res;
        }
-
+       
        /**
         * Checks if a table is allowed on a certain page id according to allowed tables set for the page "doktype" and its [ctrl][rootLevel]-settings if any.
         *
index b2e144e..b0ad88c 100755 (executable)
@@ -170,6 +170,7 @@ $TYPO3_CONF_VARS = Array(
                'niceFlexFormXMLtags' => TRUE,                  // If set, the flexform XML will be stored with meaningful tags which can be validated with DTD/schema. If you rely on custom reading of the XML from pre-4.0 versions you should set this to false if you don't like to change your reader code (internally it is insignificant since t3lib_div::xml2array() doesn't care for the tags if the index-attribute value is set)
                'flexFormXMLincludeDiffBase' => TRUE,   // If set, an additional tag with index "vXX.vDEFbase" is created for translations in flexforms holding the value of the default language when translation was changed. Used to show diff of value. This setting will change whether the system thinks flexform XML looks clean. For example when FALSE XX.vDEFbase fields will be removed in cleaning while accepted if TRUE (of course)
                'compactFlexFormXML' => 0,                              // If set, the flexform XML will not contain indentation spaces making XML more compact
+               'explicitConfirmationOfTranslation' => FALSE,   // If set, the the diff-data of localized records is not saved automatically when updated by requires that a translator clicks the special finish_translation/save/close button that becomes available.
                'elementVersioningOnly' => FALSE,               // If true, only element versioning is allowed in the backend. This is recommended for new installations of TYPO3 4.2+ since "page" and "branch" versioning types are known for the drawbacks of loosing ids and "element" type versions supports moving now.
                'AJAX' => array(                                // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information.
                        'SC_alt_db_navframe::expandCollapse'   => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
@@ -232,7 +233,8 @@ $TYPO3_CONF_VARS = Array(
                'hidePagesIfNotTranslatedByDefault' => FALSE,   // If TRUE, pages that has no translation will be hidden by default. Basically this will inverse the effect of the page localization setting "Hide page if no translation for current language exists" to "Show page even if no translation exists"
                'eID_include' => array(),                               // Array of key/value pairs where key is "tx_[ext]_[optional suffix]" and value is relative filename of class to include. Key is used as "?eID=" for index_ts.php to include the code file which renders the page from that point. (Useful for functionality that requires a low initialization footprint, eg. frontend ajax applications)
                'XCLASS' => Array(),                                    // See 'Inside TYPO3' document for more information.
-               'pageCacheToExternalFiles' => FALSE             // If set, page cache entries will be stored in typo3temp/cache_pages/ab/ instead of the database. Still, "cache_pages" will be filled in database but the "HTML" field will be empty. When the cache is flushed the files in cache_pages/ab/ will not be flush - you will have to garbage clean manually once in a while.
+               'pageCacheToExternalFiles' => FALSE,    // If set, page cache entries will be stored in typo3temp/cache_pages/ab/ instead of the database. Still, "cache_pages" will be filled in database but the "HTML" field will be empty. When the cache is flushed the files in cache_pages/ab/ will not be flush - you will have to garbage clean manually once in a while.
+               'workspacePreviewLogoutTemplate' => ''  // If set, points to an HTML file relative to the TYPO3_site root which will be read and outputted as template for this message. Example: fileadmin/templates/template_workspace_preview_logout.html. Inside you can put the marker %1$s to insert the URL to go back to. Use this in <a href="%1$s">Go back...</a> links
        ),
        'MODS' => Array(                // Backend Module Configuration (obsolete, make extension instead)
        ),
index c9d4602..bd198bb 100755 (executable)
@@ -252,7 +252,7 @@ class SC_alt_doc {
         * @return      boolean         True, then save the document (data submitted)
         */
        function doProcessData()        {
-               $out = $this->doSave || isset($_POST['_savedok_x']) || isset($_POST['_saveandclosedok_x']) || isset($_POST['_savedokview_x']) || isset($_POST['_savedoknew_x']);
+               $out = $this->doSave || isset($_POST['_savedok_x']) || isset($_POST['_saveandclosedok_x']) || isset($_POST['_savedokview_x']) || isset($_POST['_savedoknew_x']) || isset($_POST['_translation_savedok_x']);
                return $out;
        }
 
@@ -278,6 +278,9 @@ class SC_alt_doc {
                        // Only options related to $this->data submission are included here.
                $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                $tce->stripslashes_values=0;
+               if (isset($_POST['_translation_savedok_x']))    {
+                       $tce->updateModeL10NdiffData = 'FORCE_FFUPD';
+               }
 
                        // Setting default values specific for the user:
                $TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
@@ -838,6 +841,11 @@ class SC_alt_doc {
 
                                // SAVE / CLOSE
                        $buttons['save_close'] = '<input type="image" class="c-inputButton" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
+                       
+                               // FINISH TRANSLATION / SAVE / CLOSE
+                       if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation'])     {
+                               $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/translationsavedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDoc',1).'" />';
+                       }
                }
 
                        // CLOSE button:
@@ -964,7 +972,7 @@ class SC_alt_doc {
        <!-- Page header with buttons for saving & closing and path details -->
        <div id="typo3-docheader">
                <div id="typo3-docheader-row1">
-                       <div class="buttonsleft">'.$btns['save'].$btns['save_view'].$btns['save_close'].$btns['save_new'].'</div>
+                       <div class="buttonsleft">'.$btns['save'].$btns['save_view'].$btns['save_close'].$btns['save_new'].$btns['translation_save'].'</div>
                        <div class="buttonsright">'.$docSel.$cMenu.$btns['delete'].$btns['shortcut'].$btns['history'].$buttons['columns_only'].$btns['undo'].$btns['close'].'</div>
                </div>
                ';
diff --git a/typo3/gfx/translationsavedok.gif b/typo3/gfx/translationsavedok.gif
new file mode 100644 (file)
index 0000000..bb5c9a0
Binary files /dev/null and b/typo3/gfx/translationsavedok.gif differ
index 7bb8ef4..97d1369 100755 (executable)
 
                        if ($inputCode=='LOGOUT') {     // "log out":
                                SetCookie('ADMCMD_prev', '', 0);
-                               die("You logged out from Workspace preview mode. Click the preview link you were given to log in again.");
+                               if ($this->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'])     {
+                                       if (@is_file(PATH_site.$this->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'])) {
+                                               $message = t3lib_div::getUrl(PATH_site.$this->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']);
+                                       } else {
+                                               $message = '<b>ERROR!</b><br>Template File "'.$this->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'].'" configured with $TYPO3_CONF_VARS["FE"]["workspacePreviewLogoutTemplate"] not found. Please contact webmaster about this problem.';
+                                       }
+                               } else {
+                                       $message = 'You logged out from Workspace preview mode. Click this link to <a href="%1$s">go back to the website</a>';
+                               } 
+                               die(sprintf($message,
+                                       htmlspecialchars(ereg_replace('\&?ADMCMD_prev=[[:alnum:]]+','',t3lib_div::_GET('returnUrl')))
+                                       ));
                        }
 
                                // Look for keyword configuration record:
@@ -3276,7 +3287,7 @@ if (version == "n3") {
        function previewInfo()  {
                if ($this->fePreview)   {
                                if ($this->fePreview==2)        {
-                                       $onclickForStoppingPreview = 'document.location="'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev=LOGOUT";return false;';
+                                       $onclickForStoppingPreview = 'document.location="'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev=LOGOUT&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'";return false;';
                                        $text = 'Preview of workspace "'.$this->whichWorkspace(TRUE).'" ('.$this->whichWorkspace().')';
                                        $html = $this->doWorkspacePreview() ? '<br/><input name="_" type="submit" value="Stop preview" onclick="'.htmlspecialchars($onclickForStoppingPreview).'" />' : '';
                                } else {
index b9b85d3..a382653 100755 (executable)
@@ -139,6 +139,7 @@ Would you like to save now in order to refresh the display?</label>
                        <label index="rm.saveDoc">Save document</label>
                        <label index="rm.saveDocShow">Save document and view page</label>
                        <label index="rm.saveCloseDoc">Save and close document</label>
+                       <label index="rm.translationSaveDoc">Translation finished and save</label>
                        <label index="rm.saveCloseAllDocs">Save and close all documents</label>
                        <label index="rm.saveNewDoc">Save document and create a new one</label>
                        <label index="rm.closeDoc">Close document</label>
index a37ed23..7dae1bc 100755 (executable)
@@ -681,7 +681,7 @@ class tx_version_cm1 extends t3lib_SCbase {
                        $ttlHours = ($ttlHours ? $ttlHours : 24*2);
 
                        $params = 'id='.$this->id.'&ADMCMD_previewWS='.$GLOBALS['BE_USER']->workspace;
-                       $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.t3lib_BEfunc::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'],$ttlHours);
+                       $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.t3lib_BEfunc::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'],60*60*$ttlHours);
 
                        $this->content.= $this->doc->section('Preview Url:','You can preview this page from the workspace using this link for the next '.$ttlHours.' hours (does not require backend login):<br/><br/><a target="_blank" href="'.htmlspecialchars($previewUrl).'">'.$previewUrl.'</a>',0,1);
                }