[Customisation Database Commits] r738 - in /trunk/titania: common.php includes/functions_install.php includes/objects/queue.php includes/objects/topic.php includes/overlords/topics.php includes/tools/posting.php includes/tools/sync.php install.php

Nathan Guse exreaction at phpbb.com
Sat Mar 13 20:53:38 GMT 2010


Author: exreaction
Date: Sat Mar 13 20:53:38 2010
New Revision: 738

Log:
Use the topic category for queue discussion and only allow users to see the queue discussions for contrib types they have permission for

Modified:
    trunk/titania/common.php
    trunk/titania/includes/functions_install.php
    trunk/titania/includes/objects/queue.php
    trunk/titania/includes/objects/topic.php
    trunk/titania/includes/overlords/topics.php
    trunk/titania/includes/tools/posting.php
    trunk/titania/includes/tools/sync.php
    trunk/titania/install.php

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Sat Mar 13 20:53:38 2010
***************
*** 17,23 ****
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.46');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))
--- 17,23 ----
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.47');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))

Modified: trunk/titania/includes/functions_install.php
==============================================================================
*** trunk/titania/includes/functions_install.php (original)
--- trunk/titania/includes/functions_install.php Sat Mar 13 20:53:38 2010
***************
*** 42,47 ****
--- 42,52 ----
  					$sync = new titania_sync;
  					$sync->queue('revision_queue_id');
  				break;
+ 
+ 				case '0.1.47' :
+ 					$sync = new titania_sync;
+ 					$sync->topics('queue_discussion_category');
+ 				break;
  			}
  		break;
  

Modified: trunk/titania/includes/objects/queue.php
==============================================================================
*** trunk/titania/includes/objects/queue.php (original)
--- trunk/titania/includes/objects/queue.php Sat Mar 13 20:53:38 2010
***************
*** 113,118 ****
--- 113,119 ----
  				$post = new titania_post(TITANIA_QUEUE_DISCUSSION);
  				$post->topic->__set_array(array(
  					'parent_id'			=> $row['contrib_id'],
+ 					'topic_category'	=> $row['contrib_type'],
  					'topic_url'			=> titania_types::$types[$row['contrib_type']]->url . '/' . $row['contrib_name_clean'] . '/support/',
  					'topic_sticky'		=> true,
  				));

Modified: trunk/titania/includes/objects/topic.php
==============================================================================
*** trunk/titania/includes/objects/topic.php (original)
--- trunk/titania/includes/objects/topic.php Sat Mar 13 20:53:38 2010
***************
*** 67,73 ****
  			'parent_id'						=> array('default' => 0), // contrib_id most of the time
  			'topic_type'					=> array('default' => 0), // Post Type, Main TITANIA_ constants
  			'topic_access'					=> array('default' => TITANIA_ACCESS_PUBLIC), // Access level, TITANIA_ACCESS_ constants
! 			'topic_category'				=> array('default' => 0), // Category for the topic. For the Tracker
  			'topic_url'						=> array('default' => ''), // URL for the topic (simple unbuilt URL)
  
  			'topic_status'					=> array('default' => 0), // Topic Status, use tags from the DB
--- 67,73 ----
  			'parent_id'						=> array('default' => 0), // contrib_id most of the time
  			'topic_type'					=> array('default' => 0), // Post Type, Main TITANIA_ constants
  			'topic_access'					=> array('default' => TITANIA_ACCESS_PUBLIC), // Access level, TITANIA_ACCESS_ constants
! 			'topic_category'				=> array('default' => 0), // Category for the topic. For the Tracker and stores the contrib_type for queue_discussion topics
  			'topic_url'						=> array('default' => ''), // URL for the topic (simple unbuilt URL)
  
  			'topic_status'					=> array('default' => 0), // Topic Status, use tags from the DB

Modified: trunk/titania/includes/overlords/topics.php
==============================================================================
*** trunk/titania/includes/overlords/topics.php (original)
--- trunk/titania/includes/overlords/topics.php Sat Mar 13 20:53:38 2010
***************
*** 259,264 ****
--- 259,272 ----
  				$page_url = titania_url::build_url('manage/queue_discussion');
  				$sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_QUEUE_DISCUSSION;
  
+ 				// Only display those in which the users are authed
+ 				$authed = titania_types::find_authed('queue_discussion');
+ 				if (!sizeof($authed))
+ 				{
+ 					return;
+ 				}
+ 				$sql_ary['WHERE'] .= ' AND ' . phpbb::$db->sql_in_set('t.topic_category', $authed);
+ 
  				// Additional tracking fields
  				titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
  				$topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Sat Mar 13 20:53:38 2010
***************
*** 117,122 ****
--- 117,138 ----
  				}
  			}
  		}
+ 		else if ($post_type == TITANIA_QUEUE_DISCUSSION)
+ 		{
+ 			if (is_object(titania::$contrib) && titania::$contrib->contrib_id == $parent_id && titania::$contrib->is_author || titania::$contrib->is_active_coauthor)
+ 			{
+ 				$post_object->topic->topic_category = titania::$contrib->contrib_type;
+ 			}
+ 			else if (!is_object(titania::$contrib) || !titania::$contrib->contrib_id == $parent_id)
+ 			{
+ 				$contrib = new titania_contribution();
+ 				$contrib->load((int) $parent_id);
+ 				if (titania::$contrib->is_author || titania::$contrib->is_active_coauthor)
+ 				{
+ 					$post_object->topic->topic_category = titania::$contrib->contrib_type;
+ 				}
+ 			}
+ 		}
  
  		// Load the message object
  		$message_object = new titania_message($post_object);

Modified: trunk/titania/includes/tools/sync.php
==============================================================================
*** trunk/titania/includes/tools/sync.php (original)
--- trunk/titania/includes/tools/sync.php Sat Mar 13 20:53:38 2010
***************
*** 207,212 ****
--- 207,229 ----
  				}
  				phpbb::$db->sql_freeresult($result);
  			break;
+ 
+ 			case 'queue_discussion_category' :
+ 				$sql = 'SELECT t.topic_id, c.contrib_type FROM ' . TITANIA_TOPICS_TABLE . ' t, ' . TITANIA_CONTRIBS_TABLE . ' c
+ 					WHERE c.contrib_id = t.parent_id
+ 						AND t.topic_type = ' . TITANIA_QUEUE_DISCUSSION .
+ 						(($topic_id) ? ' AND topic_id = ' . (int) $topic_id : '') . '
+ 					ORDER BY topic_id ASC';
+ 				$result = phpbb::$db->sql_query($sql);
+ 				while ($row = phpbb::$db->sql_fetchrow($result))
+ 				{
+ 					$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
+ 						SET topic_category = ' . $row['contrib_type'] . '
+ 						WHERE topic_id = ' . $row['topic_id'];
+ 					phpbb::$db->sql_query($sql);
+ 				}
+ 				phpbb::$db->sql_freeresult($result);
+ 			break;
  		}
  	}
  

Modified: trunk/titania/install.php
==============================================================================
*** trunk/titania/install.php (original)
--- trunk/titania/install.php Sat Mar 13 20:53:38 2010
***************
*** 780,785 ****
--- 780,789 ----
  		),
  	),
  
+ 	'0.1.47' => array(
+ 		'custom' => 'titania_custom',
+ 	),
+ 
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  




More information about the customisationdb-commits mailing list