[Customisation Database Commits] r937 - in /trunk/titania: includes/objects/category.php manage/categories.php styles/default/template/common/category_list.html styles/default/theme/common.css

Tom Catullo tom at phpbb.com
Tue Mar 30 02:21:50 BST 2010


Author: Tom
Date: Tue Mar 30 02:21:50 2010
New Revision: 937

Log:
Just committing more work that has been done on the Category Management system over the past few days. Still quite a bit left to do, but the base of it is done.

Modified:
    trunk/titania/includes/objects/category.php
    trunk/titania/manage/categories.php
    trunk/titania/styles/default/template/common/category_list.html
    trunk/titania/styles/default/theme/common.css

Modified: trunk/titania/includes/objects/category.php
==============================================================================
*** trunk/titania/includes/objects/category.php (original)
--- trunk/titania/includes/objects/category.php Tue Mar 30 02:21:50 2010
***************
*** 126,131 ****
--- 126,154 ----
  	}
  
  	/**
+ 	* Check if a category has child categories
+ 	*
+ 	* @param int $category_id The category id (category_id)
+ 	*
+ 	* @return bool True if the category has child categories, false if not
+ 	*/
+ 	public function get_children($category_id)
+ 	{
+ 		$sql = 'SELECT * FROM ' . $this->sql_table . ' WHERE parent_id = ' . (int) $category_id;
+ 
+ 		$result = phpbb::$db->sql_query($sql);
+ 		$this->sql_data = phpbb::$db->sql_fetchrow($result);
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		if (empty($this->sql_data))
+ 		{
+ 			return false;
+ 		}
+ 
+ 		return true;
+ 	}
+ 
+ 	/**
  	* Build view URL for a category
  	*/
  	public function get_url()
***************
*** 156,161 ****
--- 179,194 ----
  	}
  
  	/**
+ 	* Build view URL for a category in the Category Management panel
+ 	*/
+ 	public function get_manage_url()
+ 	{
+ 		$url = 'manage/categories/c_' . $this->category_id;
+ 
+ 		return $url;
+ 	}
+ 
+ 	/**
  	* Assign the common items to the template
  	*
  	* @param bool $return True to return the array of stuff to display and output yourself, false to output to the template automatically
***************
*** 167,173 ****
  			'CATEGORY_CONTRIBS'	=> $this->category_contribs,
  			'CATEGORY_TYPE'		=> $this->category_type,
  
! 			'U_VIEW_CATEGORY'	=> titania_url::build_url($this->get_url()),
  		);
  
  		if ($return)
--- 200,212 ----
  			'CATEGORY_CONTRIBS'	=> $this->category_contribs,
  			'CATEGORY_TYPE'		=> $this->category_type,
  
! 			'U_MOVE_UP'		=> titania_url::$root_url . $this->get_manage_url() . '-action_move_up',
! 			'U_MOVE_DOWN'		=> titania_url::$root_url . $this->get_manage_url() . '-action_move_down',
! 			'U_EDIT'		=> titania_url::$root_url . $this->get_manage_url() . '-action_edit',
! 			'U_DELETE'		=> titania_url::$root_url . $this->get_manage_url() . '-action_delete',
! 			'U_VIEW_CATEGORY'	=> titania_url::$root_url . $this->get_manage_url(),
! 
! 			'HAS_CHILDREN'		=> $this->get_children($this->category_id),
  		);
  
  		if ($return)

Modified: trunk/titania/manage/categories.php
==============================================================================
*** trunk/titania/manage/categories.php (original)
--- trunk/titania/manage/categories.php Tue Mar 30 02:21:50 2010
***************
*** 2,8 ****
  /**
   *
   * @package titania
!  * @version $Id: administration.php 839 2010-03-23 03:45:39Z exreaction $
   * @copyright (c) 2008 phpBB Customisation Database Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   *
--- 2,8 ----
  /**
   *
   * @package titania
!  * @version $Id: 
   * @copyright (c) 2008 phpBB Customisation Database Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   *
***************
*** 23,54 ****
  
  phpbb::$user->add_lang('acp/common');
  
! $category_id = request_var('c', 0);
  $submit = (isset($_POST['submit'])) ? true : false;
  $action = request_var('action', '');
  
  switch ($action)
  {
! 	case 'test' :
! 		$test = 'Testing';
  		phpbb::$template->assign_vars(array(
  			'U_TEST'		=> $test,
  		));
  	break;
  	default :
! 		titania::_include('functions_display', 'titania_display_categories');
  
! 		// Get the category_id
! 		$category = request_var('c', '');
! 		$category_ary = explode('-', $category);
! 		if ($category_ary)
! 		{
! 			$category_id = array_pop($category_ary);
! 		}
! 		else
! 		{
! 			$category_id = (int) $category;
! 		}
  
  		titania_display_categories($category_id);
  
--- 23,61 ----
  
  phpbb::$user->add_lang('acp/common');
  
! $category_id = request_var('c', '0');
  $submit = (isset($_POST['submit'])) ? true : false;
  $action = request_var('action', '');
  
  switch ($action)
  {
! 	case 'add' :
! 	case 'edit' :
! 		$test = "Testing";
  		phpbb::$template->assign_vars(array(
  			'U_TEST'		=> $test,
+ 			'S_CATEGORY' 		=> $category_id,
+ 		));
+ 	break;
+ 	case 'move_up' :
+ 	case 'move_down' :
+ 		$test = "Testing";
+ 		phpbb::$template->assign_vars(array(
+ 			'U_TEST'		=> $test,
+ 			'S_CATEGORY' 		=> $category_id,
+ 		));
+ 	break;
+ 	case 'delete' :
+ 		$test = "Testing";
+ 		phpbb::$template->assign_vars(array(
+ 			'U_TEST'		=> $test,
+ 			'S_CATEGORY' 		=> $category_id,
  		));
  	break;
  	default :
! 		$phpbb_admin_path = titania::$config->phpbb_script_path . 'adm/';
  
! 		titania::_include('functions_display', 'titania_display_categories');
  
  		titania_display_categories($category_id);
  
***************
*** 63,85 ****
  			{
  				$category_object->__set_array($categories_ary[$row['category_id']]);
  				titania::generate_breadcrumbs(array(
! 					((isset(phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']])) ? phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']] : $categories_ary[$row['category_id']]['category_name'])	=> titania_url::build_url($category_object->get_manage_url()),
  				));
  			}
  
  			// Self
  			$category_object->__set_array($categories_ary[$category_id]);
  			titania::generate_breadcrumbs(array(
! 				((isset(phpbb::$user->lang[$categories_ary[$category_id]['category_name']])) ? phpbb::$user->lang[$categories_ary[$category_id]['category_name']] : $categories_ary[$category_id]['category_name'])	=> titania_url::build_url($category_object->get_manage_url()),
  			));
  			unset($categories_ary, $category_object);
- 
- 			contribs_overlord::display_contribs('category', $category_id);
  		}
  
  		phpbb::$template->assign_vars(array(
! 			'U_CREATE_CONTRIBUTION'		=> (phpbb::$auth->acl_get('u_titania_contrib_submit')) ? titania_url::build_url('author/' . phpbb::$user->data['username_clean'] . '/create') : '',
! 			'S_MANAGE' 					=> true,
  		));
  	break;
  }
--- 70,98 ----
  			{
  				$category_object->__set_array($categories_ary[$row['category_id']]);
  				titania::generate_breadcrumbs(array(
! 					((isset(phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']])) ? phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']] : $categories_ary[$row['category_id']]['category_name'])	=> titania_url::$root_url . $category_object->get_manage_url(),
  				));
  			}
  
  			// Self
  			$category_object->__set_array($categories_ary[$category_id]);
  			titania::generate_breadcrumbs(array(
! 				((isset(phpbb::$user->lang[$categories_ary[$category_id]['category_name']])) ? phpbb::$user->lang[$categories_ary[$category_id]['category_name']] : $categories_ary[$category_id]['category_name'])	=> titania_url::$root_url . $category_object->get_manage_url(),
  			));
  			unset($categories_ary, $category_object);
  		}
  
  		phpbb::$template->assign_vars(array(
! 			'ICON_MOVE_UP'				=> '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
! 			'ICON_MOVE_UP_DISABLED'		=> '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
! 			'ICON_MOVE_DOWN'			=> '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
! 			'ICON_MOVE_DOWN_DISABLED'	=> '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
! 			'ICON_EDIT'					=> '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
! 			'ICON_EDIT_DISABLED'		=> '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
! 			'ICON_DELETE'				=> '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
! 			'ICON_DELETE_DISABLED'		=> '<img src="' . $phpbb_admin_path . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
! 
! 			'S_MANAGE' 			=> true,
  		));
  	break;
  }

Modified: trunk/titania/styles/default/template/common/category_list.html
==============================================================================
*** trunk/titania/styles/default/template/common/category_list.html (original)
--- trunk/titania/styles/default/template/common/category_list.html Tue Mar 30 02:21:50 2010
***************
*** 6,11 ****
--- 6,14 ----
  			<dl>
  				<dt>{L_CATEGORY}</dt>
  				<dd class="general">{L_CONTRIBUTIONS}</dd>
+ 				<!-- IF S_MANAGE -->
+ 				<dd class="general" style="float: right;">{L_ACTIONS}</dd>
+ 				<!-- ENDIF -->
  			</dl>
  		</li>
  	</ul>
***************
*** 16,26 ****
  			<dl>
  				<dt title="{categories.FORUM_FOLDER_IMG_ALT}">
  					<!-- IF categories.FORUM_IMAGE --><span class="forum-image">{categories.FORUM_IMAGE}</span><!-- ENDIF -->
! 					<a href="{categories.U_VIEW_CATEGORY}" class="forumtitle">{categories.CATEGORY_NAME}</a><br />
  					{categories.FORUM_DESC}
  					<!-- IF categories.SUBFORUMS and categories.S_LIST_SUBFORUMS --><br /><strong>{categories.L_SUBFORUM_STR}</strong> {categories.SUBFORUMS}<!-- ENDIF -->
  				</dt>
  				<dd class="general">{categories.CATEGORY_CONTRIBS} <dfn>{L_CONTRIBUTIONS}</dfn></dd>
  			</dl>
  		</li>
  		<!-- END categories -->
--- 19,52 ----
  			<dl>
  				<dt title="{categories.FORUM_FOLDER_IMG_ALT}">
  					<!-- IF categories.FORUM_IMAGE --><span class="forum-image">{categories.FORUM_IMAGE}</span><!-- ENDIF -->
! 					<!-- IF S_MANAGE and not categories.HAS_CHILDREN -->
! 						<span class="content">{categories.CATEGORY_NAME}</span>
! 					<!-- ELSE -->
! 						<a href="{categories.U_VIEW_CATEGORY}" class="forumtitle">{categories.CATEGORY_NAME}</a>
! 					<!-- ENDIF --><br />
  					{categories.FORUM_DESC}
  					<!-- IF categories.SUBFORUMS and categories.S_LIST_SUBFORUMS --><br /><strong>{categories.L_SUBFORUM_STR}</strong> {categories.SUBFORUMS}<!-- ENDIF -->
  				</dt>
  				<dd class="general">{categories.CATEGORY_CONTRIBS} <dfn>{L_CONTRIBUTIONS}</dfn></dd>
+ 				<!-- IF S_MANAGE -->
+ 				<dd class="general" style="float: right;">
+ 					<!-- IF categories.S_FIRST_ROW && not categories.S_LAST_ROW -->
+ 						{ICON_MOVE_UP_DISABLED}
+ 						<a href="{categories.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ 					<!-- ELSEIF not categories.S_FIRST_ROW && not categories.S_LAST_ROW -->
+ 						<a href="{categories.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ 						<a href="{categories.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ 					<!-- ELSEIF categories.S_LAST_ROW && not categories.S_FIRST_ROW -->
+ 						<a href="{categories.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ 						{ICON_MOVE_DOWN_DISABLED}
+ 					<!-- ELSE -->
+ 						{ICON_MOVE_UP_DISABLED}
+ 						{ICON_MOVE_DOWN_DISABLED}
+ 					<!-- ENDIF -->
+ 					<a href="{categories.U_EDIT}">{ICON_EDIT}</a>
+ 					<a href="{categories.U_DELETE}">{ICON_DELETE}</a>
+ 				</dd>
+ 				<!-- ENDIF -->
  			</dl>
  		</li>
  		<!-- END categories -->

Modified: trunk/titania/styles/default/theme/common.css
==============================================================================
*** trunk/titania/styles/default/theme/common.css (original)
--- trunk/titania/styles/default/theme/common.css Tue Mar 30 02:21:50 2010
***************
*** 280,285 ****
--- 280,289 ----
  	font-size: 1.2em;
  }
  
+ #categories .content {
+ 	font-size: 1.2em;
+ }
+ 
  .container li.header dt, .container li.header dd {
  	color: #000000;
  	margin-bottom: 2px;
***************
*** 487,493 ****
  }
  
  #attention .content {
! 	font-size: 13px;
  	padding-bottom: 10px;
  }
  
--- 491,497 ----
  }
  
  #attention .content {
! 	font-size: 1.3em;
  	padding-bottom: 10px;
  }
  




More information about the customisationdb-commits mailing list