Index: ChangeLog
===================================================================
--- ChangeLog	(Revision 6115)
+++ ChangeLog	(Revision 6122)
@@ -1,3 +1,14 @@
+2009-10-09  Kasper Sk�rh�j <kasper@typo3.org>
+	* Tiny bug with date function in t3lib_befunc. Casted timestamp to integer.
+	* Added User TSconfig option "options.checkPageLanguageOverlay" so flexforms only show language fields for languages available on the page.
+	* Fixed problem with notification emails to users when a workspace review rejection happens. Now it works
+	* Added possibility to reset the diff-information for localizations so translators or admins can click a button that will mark a record so it appears to be in need of translation again.
+	* Fixed problem with "Save and view" for new pages: Simply removed the button for new pages because it didn't choose the right PID anyway.
+	* Implemented an override of allowed language per workspace. This is an expert feature available as a USER TSconfig option "options.workspaces.allowed_languages" 
+	* Expanded the feature that disables/enables login in a branch so now you can allow a login but force the usergroups to be "0,-2" (basically, that no usergroups are set for the user). This can help to reduce multiple caching of similar pages in case of many usergroup combinations in a system. 
+	* Implemented a simple hook after retrieval of a page from cache.
+	* Fixed bug in Addwizard: It didn't work properly with wizard for other pages. Took the wrong table name. Thanks to Hassan AIT ABDELLAH, Dassault Systemes, for the fix.
+
 2009-10-08  Rupert Germann  <rupi@gmx.li>
 
 	* Fixed bug #12121: "Installation Type: L" - tell the user, what's "L" (thanks to Steffen Gebert)
Index: t3lib/class.t3lib_tceforms.php
===================================================================
--- t3lib/class.t3lib_tceforms.php	(Revision 6115)
+++ t3lib/class.t3lib_tceforms.php	(Revision 6122)
@@ -2419,10 +2419,26 @@
 			$langDisabled = $dataStructArray['meta']['langDisable'] ? 1 : 0;
 
 			$editData['meta']['currentLangId']=array();
+
+				// Look up page overlays:
+			$checkPageLanguageOverlay = $GLOBALS['BE_USER']->getTSConfigVal('options.checkPageLanguageOverlay')?TRUE:FALSE;
+			if ($checkPageLanguageOverlay)	{
+				$pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+					'*',
+					'pages_language_overlay',
+					'pid='.intval($row['pid']).
+						t3lib_BEfunc::deleteClause('pages_language_overlay').
+						t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'),
+					'',
+					'',
+					'',
+					'sys_language_uid'
+				);
+			}
 			$languages = $this->getAvailableLanguages();
 
 			foreach($languages as $lInfo)	{
-				if ($GLOBALS['BE_USER']->checkLanguageAccess($lInfo['uid']))	{
+				if ($GLOBALS['BE_USER']->checkLanguageAccess($lInfo['uid']) && (!$checkPageLanguageOverlay || $lInfo['uid']<=0 || is_array($pageOverlays[$lInfo['uid']])))	{
 					$editData['meta']['currentLangId'][] = 	$lInfo['ISOcode'];
 				}
 			}
Index: t3lib/class.t3lib_befunc.php
===================================================================
--- t3lib/class.t3lib_befunc.php	(Revision 6115)
+++ t3lib/class.t3lib_befunc.php	(Revision 6122)
@@ -1610,7 +1610,7 @@
 	 * @return	string		Formatted time
 	 */
 	public static function date($tstamp) {
-		return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $tstamp);
+		return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], (int)$tstamp);
 	}
 
 	/**
Index: t3lib/class.t3lib_userauthgroup.php
===================================================================
--- t3lib/class.t3lib_userauthgroup.php	(Revision 6115)
+++ t3lib/class.t3lib_userauthgroup.php	(Revision 6122)
@@ -1472,6 +1472,11 @@
 				$this->addFileMount($row['title'], $row['path'], $row['path'], $row['base']?1:0, '');
 			}
 		}
+
+		if ($allowed_languages = $this->getTSConfigVal('options.workspaces.allowed_languages.'.$this->workspace))	{
+			$this->groupData['allowed_languages'] = $allowed_languages;
+			$this->groupData['allowed_languages'] = t3lib_div::uniqueList($this->groupData['allowed_languages']);
+		}
 	}
 
 	/**
Index: t3lib/class.t3lib_tcemain.php
===================================================================
--- t3lib/class.t3lib_tcemain.php	(Revision 6115)
+++ t3lib/class.t3lib_tcemain.php	(Revision 6122)
@@ -249,6 +249,7 @@
 	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 $updateModeL10NdiffDataClear = FALSE;	// Boolean: If true, the translation diff. fields will in fact be reset so that they indicate that all needs to change again! It's meant as the opposite of declaring the record translated.	
 	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!
@@ -1114,7 +1115,7 @@
 
 									// Add the value of the original record to the diff-storage content:
 								if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField'])	{
-									$originalLanguage_diffStorage[$field] = $originalLanguageRecord[$field];
+									$originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field];
 									$diffStorageFlag = TRUE;
 								}
 
@@ -2415,7 +2416,7 @@
 										$diffValue = $dataValues_current[$key]['vDEF'];
 									}
 										// Setting the reference value for vDEF for this translation. This will be used for translation tools to make a diff between the vDEF and vDEFbase to see if an update would be fitting.
-									$dataValues[$key][$vKey.'.vDEFbase'] = $diffValue;
+									$dataValues[$key][$vKey.'.vDEFbase'] = $this->updateModeL10NdiffDataClear ? '' : $diffValue;
 								}
 							}
 						}
@@ -6895,8 +6896,8 @@
 								foreach($rows as $dat)	{
 									$data = unserialize($dat['log_data']);
 
-									debug($dat['userid'],'Adds user at stage: '.$data['stage']);
-									$emails = array_merge($emails,$this->notifyStageChange_getEmails($dat['userid']));
+									//debug($dat['userid'],'Adds user at stage: '.$data['stage']);
+									$emails = array_merge($emails,$this->notifyStageChange_getEmails($dat['userid'],TRUE));
 
 									if ($data['stage']==1)	{
 										break;
@@ -6967,6 +6968,8 @@
 					sprintf($subject,$elementName),
 					trim($message)
 				);
+				
+				$this->newlog2('Notification email for stage change was sent to "'.implode(', ',$emails).'"',$table,$id);
 			}
 		}
 	}
Index: typo3/gfx/translationsavedok_clear.gif
===================================================================
Kann nicht anzeigen: Dateityp ist als binär angegeben.
svn:mime-type = application/octet-stream

Eigenschaftsänderungen: typo3/gfx/translationsavedok_clear.gif
___________________________________________________________________
Hinzugefügt: svn:mime-type
   + application/octet-stream

Index: typo3/alt_doc.php
===================================================================
--- typo3/alt_doc.php	(Revision 6115)
+++ typo3/alt_doc.php	(Revision 6122)
@@ -246,7 +246,7 @@
 	 * @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']) || isset($_POST['_translation_savedok_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']) || isset($_POST['_translation_savedokclear_x']);
 		return $out;
 	}
 
@@ -272,9 +272,14 @@
 			// 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';
 		}
+		if (isset($_POST['_translation_savedokclear_x']))	{
+			$tce->updateModeL10NdiffData = 'FORCE_FFUPD';
+			$tce->updateModeL10NdiffDataClear = TRUE;
+		}
 
 			// Setting default values specific for the user:
 		$TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
@@ -663,7 +668,8 @@
 										$CALC_PERMS = $BE_USER->calcPerms($calcPRec);	// Permissions for the parent page
 										if ($table=='pages')	{	// If pages:
 											$hasAccess = $CALC_PERMS&8 ? 1 : 0;
-											$this->viewId = $calcPRec['pid'];
+											#$this->viewId = $calcPRec['pid'];
+											$this->viewId = 0;
 										} else {
 											$hasAccess = $CALC_PERMS&16 ? 1 : 0;
 											$this->viewId = $calcPRec['uid'];
@@ -811,7 +817,8 @@
 			'history' => '',
 			'columns_only' => '',
 			'csh' => '',
-			'translation_save' => ''
+			'translation_save' => '',
+			'translation_saveclear' => ''
 		);
 
 			// Render SAVE type buttons:
@@ -837,6 +844,7 @@
 				// FINISH TRANSLATION / SAVE / CLOSE
 			if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation'])	{
 				$buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDoc', 1) . '" />';
+				$buttons['translation_saveclear'] = '<input type="image" class="c-inputButton" name="_translation_savedokclear" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok_clear.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDocClear', 1) . '" />';
 			}
 		}
 
Index: typo3/wizard_add.php
===================================================================
--- typo3/wizard_add.php	(Revision 6115)
+++ typo3/wizard_add.php	(Revision 6122)
@@ -113,7 +113,7 @@
 		$this->table = $this->P['params']['table'];
 
 			// Get TSconfig for it.
-		$TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table,is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
+		$TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->P['table'],is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
 
 			// Set [params][pid]
 		if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###')	{
@@ -137,6 +137,10 @@
 
 					// ... and if everything seems OK we will register some classes for inclusion and instruct the object to perform processing later.
 				if ($this->P['params']['setValue'] && $cmd=='edit' && $this->id && $this->P['table'] && $this->P['field'] && $this->P['uid'])	{
+					
+					if ($LiveRec=t3lib_BEfunc::getLiveVersionOfRecord($this->table, $this->id, 'uid'))	{ $this->id=$LiveRec['uid'];}
+					
+					
 					$this->include_once[]=PATH_t3lib.'class.t3lib_loaddbgroup.php';
 					$this->include_once[]=PATH_t3lib.'class.t3lib_transferdata.php';
 					$this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
Index: typo3/templates/alt_doc.html
===================================================================
--- typo3/templates/alt_doc.html	(Revision 6115)
+++ typo3/templates/alt_doc.html	(Revision 6122)
@@ -33,7 +33,7 @@
 
 <!-- ###BUTTON_GROUPS_LEFT### -->
 <!-- ###BUTTON_GROUP1### -->###CLOSE###<!-- ###BUTTON_GROUP1### -->
-<!-- ###BUTTON_GROUP2### -->###SAVE######SAVE_VIEW######SAVE_CLOSE######SAVE_NEW######TRANSLATION_SAVE###<!-- ###BUTTON_GROUP2### -->
+<!-- ###BUTTON_GROUP2### -->###SAVE######SAVE_VIEW######SAVE_CLOSE######SAVE_NEW######TRANSLATION_SAVE######TRANSLATION_SAVECLEAR###<!-- ###BUTTON_GROUP2### -->
 <!-- ###BUTTON_GROUP3### -->###DELETE######UNDO######HISTORY###<!-- ###BUTTON_GROUP3### -->
 <!-- ###BUTTON_GROUPS_LEFT### -->
 
Index: typo3/sysext/lang/locallang_core.xml
===================================================================
--- typo3/sysext/lang/locallang_core.xml	(Revision 6115)
+++ typo3/sysext/lang/locallang_core.xml	(Revision 6122)
@@ -190,6 +190,7 @@
 			<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, save and close</label>
+			<label index="rm.translationSaveDocClear">Translation NOT finished, 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: typo3/sysext/cms/ext_tables.php
===================================================================
--- typo3/sysext/cms/ext_tables.php	(Revision 6115)
+++ typo3/sysext/cms/ext_tables.php	(Revision 6122)
@@ -483,7 +483,8 @@
 				'type' => 'select',
 				'items' => array (
 					array('', 0),
-					array('LLL:EXT:cms/locallang_tca.xml:pages.fe_login_mode.disable', 1),
+					array('LLL:EXT:cms/locallang_tca.xml:pages.fe_login_mode.disableall', 1),
+					array('LLL:EXT:cms/locallang_tca.xml:pages.fe_login_mode.disablegroups', 3),
 					array('LLL:EXT:cms/locallang_tca.xml:pages.fe_login_mode.enable', 2),
 				)
 			)
Index: typo3/sysext/cms/locallang_tca.xml
===================================================================
--- typo3/sysext/cms/locallang_tca.xml	(Revision 6115)
+++ typo3/sysext/cms/locallang_tca.xml	(Revision 6122)
@@ -73,8 +73,9 @@
 			<label index="pages.l18n_cfg.I.2">Hide page if no translation for current language exists</label>
 			<label index="pages.l18n_cfg.I.2a">Show page even if no translation exists</label>
 			<label index="pages.fe_login_mode">Login Mode:</label>
-			<label index="pages.fe_login_mode.disable">Disable</label>
-			<label index="pages.fe_login_mode.enable">Enable</label>
+			<label index="pages.fe_login_mode.disableall">Disable user login completely</label>
+			<label index="pages.fe_login_mode.disablegroups">Allow logins, but not usergroups</label>
+			<label index="pages.fe_login_mode.enable">(Re-)Enable logins</label>
 			<label index="tt_content">Pagecontent</label>
 			<label index="fe_users">Website user</label>
 			<label index="fe_users.username">Username:</label>
Index: typo3/sysext/cms/tslib/class.tslib_fe.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_fe.php	(Revision 6115)
+++ typo3/sysext/cms/tslib/class.tslib_fe.php	(Revision 6122)
@@ -231,6 +231,7 @@
 	var $beUserLogin='';				// Flag that indicates if a Backend user is logged in!
 	var $workspacePreview='';			// Integer, that indicates which workspace is being previewed.
 	var $loginAllowedInBranch = TRUE;	// Shows whether logins are allowed in branch
+	var $loginAllowedInBranch_mode = '';	// Shows specific mode (all or groups)
 	var $ADMCMD_preview_BEUSER_uid = 0;	// Integer, set to backend user ID to initialize when keyword-based preview is used.
 
 		// PREVIEW
@@ -697,7 +698,7 @@
 			// Clean up.
 		$gr_array = array_unique($gr_array);	// Make unique...
 		sort($gr_array);	// sort
-		if (count($gr_array))	{
+		if (count($gr_array) && !$this->loginAllowedInBranch_mode)	{
 			$this->gr_list.=','.implode(',',$gr_array);
 		}
 
@@ -852,11 +853,14 @@
 		$this->loginAllowedInBranch = $this->checkIfLoginAllowedInBranch();
 		if (!$this->loginAllowedInBranch)	{	// Logins are not allowed:
 			if ($this->isUserOrGroupSet())	{	// Only if there is a login will we run this...
+				if ($this->loginAllowedInBranch_mode=='all')	{
+						// Clear out user and group:
+					unset($this->fe_user->user);
+					$this->gr_list = '0,-1';
+				} else {
+					$this->gr_list = '0,-2';
+				}
 
-					// Clear out user and group:
-				unset($this->fe_user->user);
-				$this->gr_list = '0,-1';
-
 					// Fetching the id again, now with the preview settings reset.
 				$this->fetch_the_id();
 			}
@@ -1257,7 +1261,15 @@
 			if ($this->rootLine[$a]['fe_login_mode'] > 0)	{
 
 					// Determine state from value:
-				$disable = (int)$this->rootLine[$a]['fe_login_mode'] === 1 ? TRUE : FALSE;
+				if ((int)$this->rootLine[$a]['fe_login_mode'] === 1)	{
+					$disable = TRUE;
+					$this->loginAllowedInBranch_mode = 'all';
+				} elseif ((int)$this->rootLine[$a]['fe_login_mode'] === 3)	{
+					$disable = TRUE;
+					$this->loginAllowedInBranch_mode = 'groups';
+				} else {
+					$disable = FALSE;
+				}
 			}
 		}
 
@@ -1881,12 +1893,21 @@
 					if (is_array($row)) {
 							// Release this lock
 						$this->releasePageGenerationLock($this->pages_lockObj);
+
+							// Call hook when a page is retrieved from cache:
+						if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache']))	{
+							$_params = array('pObj' => &$this, 'cache_pages_row' => &$row);
+							foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'] as $_funcRef)	{
+								t3lib_div::callUserFunction($_funcRef,$_params,$this);
+							}
+						}
+
 						$this->config = (array)unserialize($row['cache_data']);		// Fetches the lowlevel config stored with the cached data
 						$this->content = (TYPO3_UseCachingFramework ? $row['content'] : $row['HTML']);	// Getting the content
 						$this->tempContent = $row['temp_content'];	// Flag for temp content
 						$this->cacheContentFlag = 1;	// Setting flag, so we know, that some cached content has been loaded
 						$this->cacheExpires = $row['expires'];
-
+						
 						if ($this->TYPO3_CONF_VARS['FE']['debug'] || (isset($this->config['config']['debug']) && $this->config['config']['debug'])) {
 							$dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
 							$timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
