[TYPO3-core] RFC: highlight with page/branch versioning

Kasper Skårhøj kasper.typo3 at gmail.com
Thu Jun 28 09:58:57 CEST 2007


-1!

Lets discuss this offline.

- kasper



On Jun 26, 2007, at 16:16 , Dmitry Dulepov wrote:

> Hi!
>
> This is SVN patch request.
>
> Branches: 4.1 & trunk
>
> Problem: when elements in workspace are versioned with "Element"  
> versioning type, corresponding elements (source/versioned) should  
> highlighted when mouse goes over them in Workspace module. This is  
> quite critical when there are many elements on a page and there are  
> no titles for elements. Currently highlight does not work because  
> link to source element is missing in versioned element.
>
> Solution: correctly fill t3ver_oid when copying page content in  
> "Page" and "Branch" modes. I talked about this with Kasper,
>
> This bug fix is required for one future fix for much worse bug (to  
> be posted later this week).
>
> The picture shows highlighted elements (darker gray). Just for your  
> convenience.
>
> Note: since this is a workspace patch... Well, you all know already  
> what I usually write here :)
>
> -- 
> Dmitry Dulepov
> TYPO3 freelancer / TYPO3 core team member
> Web: http://typo3bloke.net/
> Skype: callto:liels_bugs
> Index: t3lib/class.t3lib_tcemain.php
> ===================================================================
> --- t3lib/class.t3lib_tcemain.php	(revision 2367)
> +++ t3lib/class.t3lib_tcemain.php	(working copy)
> @@ -2757,12 +2757,21 @@
>  		if ($new_pid)	{
>  			foreach($copyTablesArray as $table)	{
>  				if ($table && is_array($TCA[$table]) && $table!='pages')	{	//  
> all records under the page is copied.
> -					$mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table,  
> 'pid='.intval($old_pid).$this->deleteClause($table));
> +					$mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery 
> ('uid,t3ver_id', $table, 'pid='.intval($old_pid).$this->deleteClause 
> ($table));
>  					while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres))	{
>  							// Check, if this record has already been copied by a  
> parent record as relation:
>  						if (!$this->copyMappingArray[$table][$row['uid']]) {
>  								// Copying each of the underlying records (method RAW)
> -							$this->copyRecord_raw($table,$row['uid'],$new_pid);
> +
> +							$nextVer = $this->getNextVersionNumber($table, $row['uid']);
> +							$subVer = $row['t3ver_id'].'.'.$nextVer;
> +
> +								// Set up the values to override when making a raw-copy:
> +							$overrideArray = array(
> +								't3ver_id' => $nextVer,
> +								't3ver_oid' => $row['uid'],
> +								't3ver_label' => $subVer.' / '.date('d-m-Y H:m:s'));
> +							$this->copyRecord_raw($table, $row['uid'], $new_pid,  
> $overrideArray);
>  						}
>  					}
>  					$GLOBALS['TYPO3_DB']->sql_free_result($mres);
> @@ -3812,24 +3821,13 @@
>  						if ($row['pid']>=0)	{	// record must be online record
>  							if (!$delete || !$this->cannotDeleteRecord($table,$id)) {
>
> -									// Look for next version number:
> -								$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
> -									't3ver_id',
> -									$table,
> -									'(t3ver_oid='.$id.' OR uid='.$id.')'.$this->deleteClause 
> ($table),
> -									'',
> -									't3ver_id DESC',
> -									'1'
> -								);
> -								list($highestVerNumber) = $GLOBALS['TYPO3_DB']- 
> >sql_fetch_row($res);
> -								$GLOBALS['TYPO3_DB']->sql_free_result($res);
> -
>  									// Look for version number of the current:
> -								$subVer = $row['t3ver_id'].'.'.($highestVerNumber+1);
> +								$nextVer = $this->getNextVersionNumber($table, $id);
> +								$subVer = $row['t3ver_id'].'.'.$nextVer;
>
>  									// Set up the values to override when making a raw-copy:
>  								$overrideArray = array(
> -									't3ver_id' => $highestVerNumber+1,
> +									't3ver_id' => $nextVer,
>  									't3ver_oid' => $id,
>  									't3ver_label' => ($label ? $label : $subVer.' / '.date('d- 
> m-Y H:m:s')),
>  									't3ver_wsid' => $this->BE_USER->workspace,
> @@ -6611,6 +6609,27 @@
>  		}
>  		return $result;
>  	}
> +
> +	/**
> +	 * Returns next version number for the record.
> +	 *
> +	 * @param	string	$table	Table name
> +	 * @param	int	$id	ID of the record
> +	 * @return	int	Next version number
> +	 */
> +	function getNextVersionNumber($table, $id) {
> +		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
> +			't3ver_id',
> +			$table,
> +			'(t3ver_oid='.$id.' OR uid='.$id.')'.$this->deleteClause($table),
> +			'',
> +			't3ver_id DESC',
> +			'1'
> +		);
> +		list($highestVerNumber) = $GLOBALS['TYPO3_DB']->sql_fetch_row 
> ($res);
> +		$GLOBALS['TYPO3_DB']->sql_free_result($res);
> +		return $highestVerNumber + 1;
> +	}
>  }
>
>
> <workspace-oid-patch.png>
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-core

- kasper

----------------------------
NOTICE: NEW EMAIL for 2007: kasper2007 at typo3.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070628/3b73609d/attachment-0001.html 


More information about the TYPO3-team-core mailing list