[Customisation Database Commits] r799 - in /trunk/titania: common.php includes/core/object_message.php includes/objects/post.php includes/objects/queue.php includes/tools/posting.php install.php language/en/manage.php manage/queue.php styles/default/template/manage/queue_validate.html

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


Author: exreaction
Date: Sat Mar 20 23:53:23 2010
New Revision: 799

Log:
Validation Reason now works (what is submitted in the PM to the author)

Validating items in the queue now should be done (all except the copy to the styles demo which moltendorf is working on)

Added:
    trunk/titania/styles/default/template/manage/queue_validate.html
Modified:
    trunk/titania/common.php
    trunk/titania/includes/core/object_message.php
    trunk/titania/includes/objects/post.php
    trunk/titania/includes/objects/queue.php
    trunk/titania/includes/tools/posting.php
    trunk/titania/install.php
    trunk/titania/language/en/manage.php
    trunk/titania/manage/queue.php

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Sat Mar 20 23:53:23 2010
***************
*** 17,23 ****
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.50');
  
  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.51');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))

Modified: trunk/titania/includes/core/object_message.php
==============================================================================
*** trunk/titania/includes/core/object_message.php (original)
--- trunk/titania/includes/core/object_message.php Sat Mar 20 23:53:23 2010
***************
*** 37,42 ****
--- 37,49 ----
  	public $message_parsed_for_storage = false;
  
  	/**
+ 	* This allows us to have multiple message items for a single object
+ 	*
+ 	* @var string
+ 	*/
+ 	public $message_fields_prefix = 'message';
+ 
+ 	/**
  	* Catch submits and make sure we parse messages for storage
  	*/
  	public function submit()
***************
*** 58,63 ****
--- 65,77 ----
  	{
  		$post_data = $message->request_data();
  
+ 		// Handle different field usage
+ 		if ($this->message_fields_prefix != 'message')
+ 		{
+ 			$post_data[$this->message_fields_prefix] = $post_data['message'];
+ 			unset($post_data['message']);
+ 		}
+ 
  		foreach ($this->object_config as $field => $options)
  		{
  			if (isset($options['message_field']) && isset($post_data[$options['message_field']]))
***************
*** 146,164 ****
  			{
  				switch ($options['message_field'])
  				{
! 					case 'message' :
  						$message = $this->$field;
  					break;
  
! 					case 'message_uid' :
  						$message_uid = $this->$field;
  					break;
  
! 					case 'message_bitfield' :
  						$message_bitfield = $this->$field;
  					break;
  
! 					case 'message_options' :
  						$message_options = $this->$field;
  					break;
  				}
--- 160,178 ----
  			{
  				switch ($options['message_field'])
  				{
! 					case $this->message_fields_prefix :
  						$message = $this->$field;
  					break;
  
! 					case $this->message_fields_prefix . '_uid' :
  						$message_uid = $this->$field;
  					break;
  
! 					case $this->message_fields_prefix . '_bitfield' :
  						$message_bitfield = $this->$field;
  					break;
  
! 					case $this->message_fields_prefix . '_options' :
  						$message_options = $this->$field;
  					break;
  				}
***************
*** 174,192 ****
  			{
  				switch ($options['message_field'])
  				{
! 					case 'message' :
  						$this->$field = $message;
  					break;
  
! 					case 'message_uid' :
  						$this->$field = $message_uid;
  					break;
  
! 					case 'message_bitfield' :
  						$this->$field = $message_bitfield;
  					break;
  
! 					case 'message_options' :
  						$this->$field = $message_options;
  					break;
  				}
--- 188,206 ----
  			{
  				switch ($options['message_field'])
  				{
! 					case $this->message_fields_prefix :
  						$this->$field = $message;
  					break;
  
! 					case $this->message_fields_prefix . '_uid' :
  						$this->$field = $message_uid;
  					break;
  
! 					case $this->message_fields_prefix . '_bitfield' :
  						$this->$field = $message_bitfield;
  					break;
  
! 					case $this->message_fields_prefix . '_options' :
  						$this->$field = $message_options;
  					break;
  				}

Modified: trunk/titania/includes/objects/post.php
==============================================================================
*** trunk/titania/includes/objects/post.php (original)
--- trunk/titania/includes/objects/post.php Sat Mar 20 23:53:23 2010
***************
*** 137,145 ****
  				$this->post_access = $topic->topic_access;
  			}
  		}
! 		else if (is_int($topic))
  		{
! 			$this->topic = new titania_topic($topic);
  			if (!$this->topic->load())
  			{
  				trigger_error('NO_TOPIC');
--- 137,145 ----
  				$this->post_access = $topic->topic_access;
  			}
  		}
! 		else if (is_numeric($topic))
  		{
! 			$this->topic = new titania_topic((int) $topic);
  			if (!$this->topic->load())
  			{
  				trigger_error('NO_TOPIC');

Modified: trunk/titania/includes/objects/queue.php
==============================================================================
*** trunk/titania/includes/objects/queue.php (original)
--- trunk/titania/includes/objects/queue.php Sat Mar 20 23:53:23 2010
***************
*** 72,77 ****
--- 72,82 ----
  			'queue_notes_uid'		=> array('default' => '',	'message_field' => 'message_uid'),
  			'queue_notes_options'	=> array('default' => 7,	'message_field' => 'message_options'),
  
+ 			'queue_validation_notes'			=> array('default' => '',	'message_field' => 'message_validation'),
+ 			'queue_validation_notes_bitfield'	=> array('default' => '',	'message_field' => 'message_validation_bitfield'),
+ 			'queue_validation_notes_uid'		=> array('default' => '',	'message_field' => 'message_validation_uid'),
+ 			'queue_validation_notes_options'	=> array('default' => 7,	'message_field' => 'message_validation_options'),
+ 
  			'mpv_results'			=> array('default' => ''),
  			'mpv_results_bitfield'	=> array('default' => ''),
  			'mpv_results_uid'		=> array('default' => ''),
***************
*** 236,242 ****
  
  		if ($teams_only)
  		{
! 			$post_access = TITANIA_ACCESS_TEAMS;
  		}
  
  		$post->generate_text_for_storage(true, true, true);
--- 241,285 ----
  
  		if ($teams_only)
  		{
! 			$post->post_access = TITANIA_ACCESS_TEAMS;
! 		}
! 
! 		$post->generate_text_for_storage(true, true, true);
! 		$post->submit();
! 	}
! 
! 	/**
! 	* Reply to the discussion topic with a message
! 	*
! 	* @param string $message
! 	*/
! 	public function discussion_reply($message, $teams_only = false)
! 	{
! 		titania::add_lang('manage');
! 
! 		$message = (isset(phpbb::$user->lang[$message])) ? phpbb::$user->lang[$message] : $message;
! 
! 		$sql = 'SELECT topic_id FROM ' . TITANIA_TOPICS_TABLE . '
! 			WHERE parent_id = ' . $this->contrib_id . '
! 				AND topic_type = ' . TITANIA_QUEUE_DISCUSSION;
! 		phpbb::$db->sql_query($sql);
! 		$topic_id = phpbb::$db->sql_fetchfield('topic_id');
! 		phpbb::$db->sql_freeresult();
! 
! 		if (!$topic_id)
! 		{
! 			return;
! 		}
! 
! 		$post = new titania_post(TITANIA_QUEUE_DISCUSSION, $topic_id);
! 		$post->__set_array(array(
! 			'post_subject'		=> 'Re: ' . $post->topic->topic_subject,
! 			'post_text'			=> $message,
! 		));
! 
! 		if ($teams_only)
! 		{
! 			$post->post_access = TITANIA_ACCESS_TEAMS;
  		}
  
  		$post->generate_text_for_storage(true, true, true);
***************
*** 297,303 ****
  
  	public function approve()
  	{
! 		$this->topic_reply('QUEUE_REPLY_APPROVED', false);
  
  		// Update the revisions table
  		$sql_ary = array(
--- 340,353 ----
  
  	public function approve()
  	{
! 		// Reply to the queue topic and discussion with the message
! 		titania::add_lang('manage');
! 		$revision = $this->get_revision();
! 		$notes = $this->queue_validation_notes;
! 		decode_message($notes, $this->queue_validation_notes_uid);
! 		$message = sprintf(phpbb::$user->lang['QUEUE_REPLY_APPROVED'], $revision->revision_version, $notes);
! 		$this->topic_reply($message, false);
! 		$this->discussion_reply($message);
  
  		// Update the revisions table
  		$sql_ary = array(
***************
*** 327,347 ****
  		$this->submit(false);
  
  		// Send notification message
! 		$this->send_approve_deny_notification();
  	}
  
  	public function deny()
  	{
! 		$this->topic_reply('QUEUE_REPLY_DENIED', false);
! 
! 		// Send notification message
! 		$this->send_approve_deny_notification(false);
  
  		// Self-updating
  		$this->queue_status = TITANIA_QUEUE_DENIED;
  		$this->queue_close_time = titania::$time;
  		$this->queue_close_user = phpbb::$user->data['user_id'];
  		$this->submit(false);
  	}
  
  	/**
--- 377,404 ----
  		$this->submit(false);
  
  		// Send notification message
! 		$this->send_approve_deny_notification(false);
  	}
  
  	public function deny()
  	{
! 		// Reply to the queue topic and discussion with the message
! 		titania::add_lang('manage');
! 		$revision = $this->get_revision();
! 		$notes = $this->queue_validation_notes;
! 		decode_message($notes, $this->queue_validation_notes_uid);
! 		$message = sprintf(phpbb::$user->lang['QUEUE_REPLY_DENIED'], $revision->revision_version, $notes);
! 		$this->topic_reply($message, false);
! 		$this->discussion_reply($message);
  
  		// Self-updating
  		$this->queue_status = TITANIA_QUEUE_DENIED;
  		$this->queue_close_time = titania::$time;
  		$this->queue_close_user = phpbb::$user->data['user_id'];
  		$this->submit(false);
+ 
+ 		// Send notification message
+ 		$this->send_approve_deny_notification(false);
  	}
  
  	/**
***************
*** 374,381 ****
  		$subject = sprintf(phpbb::$user->lang[titania_types::$types[$contrib->contrib_type]->validation_subject], $contrib->contrib_name, $revision->revision_version);
  
  		// Message
! 		$notes = $this->queue_notes;
! 		decode_message($notes, $this->queue_notes_uid);
  		if ($approve)
  		{
  			$message = titania_types::$types[$contrib->contrib_type]->validation_message_approve;
--- 431,438 ----
  		$subject = sprintf(phpbb::$user->lang[titania_types::$types[$contrib->contrib_type]->validation_subject], $contrib->contrib_name, $revision->revision_version);
  
  		// Message
! 		$notes = $this->queue_validation_notes;
! 		decode_message($notes, $this->queue_validation_notes_uid);
  		if ($approve)
  		{
  			$message = titania_types::$types[$contrib->contrib_type]->validation_message_approve;
***************
*** 408,411 ****
--- 465,490 ----
  		// Submit Plz
  		submit_pm('post', $subject, $data, false);
  	}
+ 
+ 	/**
+ 	* Get the revision object for this queue
+ 	*/
+ 	public function get_revision()
+ 	{
+ 		$sql = 'SELECT * FROM ' . TITANIA_REVISIONS_TABLE . '
+ 			WHERE contrib_id = ' . $this->contrib_id . '
+ 				AND revision_id = ' . $this->revision_id;
+ 		$result = phpbb::$db->sql_query($sql);
+ 		$row = phpbb::$db->sql_fetchrow($result);
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		if ($row)
+ 		{
+ 			$revision = new titania_revision(contribs_overlord::get_contrib_object($this->contrib_id, true), $this->revision_id);
+ 			$revision->__set_array($row);
+ 			return $revision;
+ 		}
+ 
+ 		return false;
+ 	}
  }

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Sat Mar 20 23:53:23 2010
***************
*** 384,395 ****
  				{
  					$post_object->topic->topic_sticky = true;
  				}
! 				else
  				{
! 					if (!phpbb::$auth->acl_get('u_titania_post_approved'))
! 					{
! 						$post_object->post_approved = false;
! 					}
  				}
  
  				$post_object->submit();
--- 384,393 ----
  				{
  					$post_object->topic->topic_sticky = true;
  				}
! 
! 				if (!phpbb::$auth->acl_get('u_titania_post_approved'))
  				{
! 					$post_object->post_approved = false;
  				}
  
  				$post_object->submit();

Modified: trunk/titania/install.php
==============================================================================
*** trunk/titania/install.php (original)
--- trunk/titania/install.php Sat Mar 20 23:53:23 2010
***************
*** 806,811 ****
--- 806,820 ----
  		),
  	),
  
+ 	'0.1.51' => array(
+ 		'table_column_add' => array(
+ 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes', array('MTEXT_UNI', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_bitfield', array('VCHAR:255', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_uid', array('VCHAR:8', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_options', array('UINT:11', 7)),
+ 		),
+ 	),
+ 
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  

Modified: trunk/titania/language/en/manage.php
==============================================================================
*** trunk/titania/language/en/manage.php (original)
--- trunk/titania/language/en/manage.php Sat Mar 20 23:53:23 2010
***************
*** 52,59 ****
  	'UNKNOWN'				=> 'Unknown',
  	'QUEUE_REPLY_IN_PROGRESS'	=> 'Marked as in-progress',
  	'QUEUE_REPLY_NO_PROGRESS'	=> 'Marked as not in-progress',
! 	'QUEUE_REPLY_APPROVED'	=> 'Approved',
! 	'QUEUE_REPLY_DENIED'	=> 'Denied',
  	'VALIDATION_QUEUE'		=> 'Validation Queue',
  	'VALIDATION_NOTES'		=> 'Validation Notes',
  	'VALIDATION_MPV'		=> 'MPV Notes',
--- 52,59 ----
  	'UNKNOWN'				=> 'Unknown',
  	'QUEUE_REPLY_IN_PROGRESS'	=> 'Marked as in-progress',
  	'QUEUE_REPLY_NO_PROGRESS'	=> 'Marked as not in-progress',
! 	'QUEUE_REPLY_APPROVED'	=> 'Revision %1$s <strong>approved</strong for reason:<br /><br />[quote]%2$s[/quote]',
! 	'QUEUE_REPLY_DENIED'	=> 'Revision %1$s <strong>denied</strong> for reason:<br /><br />[quote]%2$s[/quote]',
  	'VALIDATION_QUEUE'		=> 'Validation Queue',
  	'VALIDATION_NOTES'		=> 'Validation Notes',
  	'VALIDATION_MPV'		=> 'MPV Notes',
***************
*** 77,85 ****
  	'MOVE_QUEUE_CONFIRM'	=> 'Select the new queue location and confirm.',
  	'EDIT_VALIDATION_NOTES'	=> 'Edit Validation Notes',
  	'APPROVE_QUEUE'			=> 'Approve',
! 	'APPROVE_QUEUE_CONFIRM'	=> 'Are you sure you want to <strong>approve</strong> this item?  The notes below will be sent in a PM to the author notifying them.',
  	'DENY_QUEUE' 			=> 'Deny',
! 	'DENY_QUEUE_CONFIRM'	=> 'Are you sure you want to <strong>deny</strong> this item?  The notes below will be sent in a PM to the author notifying them.',
  	'MOD_VALIDATION'		=> '[phpBB MOD-Validation] %1$s %2$s',
  	'STYLE_VALIDATION'		=> '[phpBB Style-Validation] %1$s %2$s',
  	'MOD_VALIDATION_MESSAGE_APPROVE'	=> 'Thank you for submitting your modication to the phpBB.com modifications database. After careful inspection by the MOD Team your MOD has been approved and released into our modifications database.
--- 77,86 ----
  	'MOVE_QUEUE_CONFIRM'	=> 'Select the new queue location and confirm.',
  	'EDIT_VALIDATION_NOTES'	=> 'Edit Validation Notes',
  	'APPROVE_QUEUE'			=> 'Approve',
! 	'APPROVE_QUEUE_CONFIRM'	=> 'Are you sure you want to <strong>approve</strong> this item?',
  	'DENY_QUEUE' 			=> 'Deny',
! 	'DENY_QUEUE_CONFIRM'	=> 'Are you sure you want to <strong>deny</strong> this item?',
! 	'VALIDATION_MESSAGE' => 'Validation Message/Reason',
  	'MOD_VALIDATION'		=> '[phpBB MOD-Validation] %1$s %2$s',
  	'STYLE_VALIDATION'		=> '[phpBB Style-Validation] %1$s %2$s',
  	'MOD_VALIDATION_MESSAGE_APPROVE'	=> 'Thank you for submitting your modication to the phpBB.com modifications database. After careful inspection by the MOD Team your MOD has been approved and released into our modifications database.

Modified: trunk/titania/manage/queue.php
==============================================================================
*** trunk/titania/manage/queue.php (original)
--- trunk/titania/manage/queue.php Sat Mar 20 23:53:23 2010
***************
*** 120,127 ****
--- 120,140 ----
  				titania::needs_auth();
  			}
  
+ 			// Load the message object for the validation reason
+ 			$queue->message_fields_prefix = 'message_validation';
+ 			$message_object = new titania_message($queue);
+ 			$message_object->set_auth(array(
+ 				'bbcode'		=> phpbb::$auth->acl_get('u_titania_bbcode'),
+ 				'smilies'		=> phpbb::$auth->acl_get('u_titania_smilies'),
+ 			));
+ 			$message_object->set_settings(array(
+ 				'display_subject'	=> false,
+ 			));
+ 
  			if (titania::confirm_box(true))
  			{
+ 				$queue->post_data($message_object);
+ 
  				if ($action == 'approve')
  				{
  					$queue->approve();
***************
*** 133,140 ****
  			}
  			else
  			{
  				phpbb::$template->assign_var('CONFIRM_EXTRA', $queue->generate_text_for_display());
! 				titania::confirm_box(false, (($action == 'approve') ? 'APPROVE_QUEUE' : 'DENY_QUEUE'));
  			}
  			redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id)));
  		break;
--- 146,154 ----
  			}
  			else
  			{
+ 				$message_object->display();
  				phpbb::$template->assign_var('CONFIRM_EXTRA', $queue->generate_text_for_display());
! 				titania::confirm_box(false, (($action == 'approve') ? 'APPROVE_QUEUE' : 'DENY_QUEUE'), '', array(), 'manage/queue_validate.html');
  			}
  			redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id)));
  		break;

Added: trunk/titania/styles/default/template/manage/queue_validate.html
==============================================================================
*** trunk/titania/styles/default/template/manage/queue_validate.html (added)
--- trunk/titania/styles/default/template/manage/queue_validate.html Sat Mar 20 23:53:23 2010
***************
*** 0 ****
--- 1,27 ----
+ <!-- INCLUDE common/overall_header.html -->
+ 
+ <form id="{POSTING_FORM_NAME}" method="post" action="{S_CONFIRM_ACTION}" {S_FORM_ENCTYPE}>
+ <div class="panel">
+ 	<div class="inner"><span class="corners-top"><span></span></span>
+ 
+ 	<h2>{MESSAGE_TITLE}</h2>
+ 	<p>{MESSAGE_TEXT}</p>
+ 
+ 	<fieldset>
+ 		<dl>
+ 			<dt><label for="{POSTING_TEXT_NAME}">{L_VALIDATION_MESSAGE}:</label></dt>
+ 		</dl>
+ 	</fieldset>
+ 	<!-- INCLUDE posting/posting_basic_editor.html -->
+ 
+ 	<fieldset class="submit-buttons">
+ 		{S_HIDDEN_FIELDS}
+ 		<input type="submit" name="confirm" value="{L_YES}" class="button2" />&nbsp;
+ 		<input type="submit" name="cancel" value="{L_NO}" class="button2" />
+ 	</fieldset>
+ 
+ 	<span class="corners-bottom"><span></span></span></div>
+ </div>
+ </form>
+ 
+ <!-- INCLUDE common/overall_footer.html -->




More information about the customisationdb-commits mailing list