[Customisation Database Commits] r863 - in /trunk/titania: contributions/faq.php includes/objects/faq.php

Nathan Guse exreaction at phpbb.com
Wed Mar 24 02:29:15 GMT 2010


Author: exreaction
Date: Wed Mar 24 02:29:14 2010
New Revision: 863

Log:
FAQ move was good except for a few small issues.

Needed to keep the left/right ids moved around to be within the contrib_id it is for.

With the order reversed the move up/down was going the wrong way too

Modified:
    trunk/titania/contributions/faq.php
    trunk/titania/includes/objects/faq.php

Modified: trunk/titania/contributions/faq.php
==============================================================================
*** trunk/titania/contributions/faq.php (original)
--- trunk/titania/contributions/faq.php Wed Mar 24 02:29:14 2010
***************
*** 84,90 ****
  				$faq->submit();
  				$message->submit($faq->faq_id);
  
! 				$sql = 'SELECT right_id FROM ' . TITANIA_CONTRIB_FAQ_TABLE . ' ORDER BY right_id DESC LIMIT 1';
  				$result = phpbb::$db->sql_query($sql);
  				$right_id = (string) phpbb::$db->sql_fetchfield('right_id');
  				phpbb::$db->sql_freeresult($result);
--- 84,92 ----
  				$faq->submit();
  				$message->submit($faq->faq_id);
  
! 				$sql = 'SELECT right_id FROM ' . TITANIA_CONTRIB_FAQ_TABLE . '
! 					WHERE contrib_id = ' . titania::$contrib->contrib_id . '
! 					ORDER BY right_id DESC LIMIT 1';
  				$result = phpbb::$db->sql_query($sql);
  				$right_id = (string) phpbb::$db->sql_fetchfield('right_id');
  				phpbb::$db->sql_freeresult($result);

Modified: trunk/titania/includes/objects/faq.php
==============================================================================
*** trunk/titania/includes/objects/faq.php (original)
--- trunk/titania/includes/objects/faq.php Wed Mar 24 02:29:14 2010
***************
*** 149,155 ****
  	 * @return void
  	 */
  	public function submit()
! 	{		
  		titania_search::index(TITANIA_FAQ, $this->faq_id, array(
  			'title'			=> $this->faq_subject,
  			'text'			=> $this->faq_text,
--- 149,155 ----
  	 * @return void
  	 */
  	public function submit()
! 	{
  		titania_search::index(TITANIA_FAQ, $this->faq_id, array(
  			'title'			=> $this->faq_subject,
  			'text'			=> $this->faq_text,
***************
*** 186,194 ****
  		* faq will move as far as possible
  		*/
  		$sql = 'SELECT faq_id, left_id, right_id
! 			FROM ' . $this->sql_table . "
! 			WHERE " . (($action == 'move_down') ? "right_id < {$faq_row['right_id']} ORDER BY right_id DESC" : "left_id > {$faq_row['left_id']} ORDER BY left_id ASC");
! 		
  		$result = phpbb::$db->sql_query_limit($sql, $steps);
  
  		$target = array();
--- 186,195 ----
  		* faq will move as far as possible
  		*/
  		$sql = 'SELECT faq_id, left_id, right_id
! 			FROM ' . $this->sql_table . '
! 			WHERE contrib_id = ' . $this->contrib_id . '
! 				AND ' . (($action == 'move_up') ? "right_id < {$faq_row['right_id']} ORDER BY right_id DESC" : "left_id > {$faq_row['left_id']} ORDER BY left_id ASC");
! 
  		$result = phpbb::$db->sql_query_limit($sql, $steps);
  
  		$target = array();
***************
*** 211,217 ****
  		* $move_up_left and $move_up_right define the scope of the nodes that are moving
  		* up. Other nodes in the scope of ($left_id, $right_id) are considered to move down.
  		*/
! 		if ($action == 'move_down')
  		{
  			$left_id = $target['left_id'];
  			$right_id = $faq_row['right_id'];
--- 212,218 ----
  		* $move_up_left and $move_up_right define the scope of the nodes that are moving
  		* up. Other nodes in the scope of ($left_id, $right_id) are considered to move down.
  		*/
! 		if ($action == 'move_up')
  		{
  			$left_id = $target['left_id'];
  			$right_id = $faq_row['right_id'];
***************
*** 244,250 ****
  				WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
  				ELSE {$diff_down}
  			END
! 			WHERE left_id BETWEEN {$left_id} AND {$right_id}
  				AND right_id BETWEEN {$left_id} AND {$right_id}";
  		phpbb::$db->sql_query($sql);
  
--- 245,252 ----
  				WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
  				ELSE {$diff_down}
  			END
! 			WHERE contrib_id = " . $this->contrib_id . "
! 				AND left_id BETWEEN {$left_id} AND {$right_id}
  				AND right_id BETWEEN {$left_id} AND {$right_id}";
  		phpbb::$db->sql_query($sql);
  
***************
*** 268,272 ****
  			WHERE faq_id = ' . (int) $this->faq_id;
  		phpbb::$db->sql_query($sql);
  	}
! 	
  }
--- 270,274 ----
  			WHERE faq_id = ' . (int) $this->faq_id;
  		phpbb::$db->sql_query($sql);
  	}
! 
  }




More information about the customisationdb-commits mailing list