1. Josh Carrier
  2. phpHgAdmin

Commits

joshjcarrier  committed f145419

Stripped out majority of Phil Sturgeon's templater (sorry Phil), to be fully replaced by theme packs akin to Wordpress

  • Participants
  • Parent commits 5fe318e
  • Branches default

Comments (0)

Files changed (15)

File README.txt

View file
 -- Disclaimer --
 This application contains code written by other developers
 - EllisLab, Inc. (CodeIgniter)
-- Philip Sturgeon (CodeIgniter Template Class)
 - Selenic (Mercurial theme stylesheets and logo)
 This application is provided as-is, without warranty or held liabilities of any kind 
 and by using this software you are accepting all subjected licence agreements. 

File admin/application/config/autoload.php

View file
 |	$autoload['libraries'] = array('database', 'session', 'xmlrpc');
 */
 
-$autoload['libraries'] = array('Template', 'session', 'mantis_auth', 'phphgadmin', 'form_validation');
+$autoload['libraries'] = array('session', 'mantis_auth', 'phphgadmin', 'form_validation');
 
 
 /*
 |	$autoload['helper'] = array('url', 'file');
 */
 
-$autoload['helper'] = array('language', 'form', 'url');
+$autoload['helper'] = array('language', 'form', 'url', 'hg_template');
 
 
 /*

File admin/application/config/template.php

-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-
-/*
-|--------------------------------------------------------------------------
-| Parser Enabled
-|--------------------------------------------------------------------------
-|
-| Should the Parser library be used for the entire page?
-|
-| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
-|
-|   Default: TRUE
-|
-*/
-
-$config['parser_enabled'] = TRUE;
-
-/*
-|--------------------------------------------------------------------------
-| Parser Enabled for Body
-|--------------------------------------------------------------------------
-|
-| If the parser is enabled, do you want it to parse the body or not?
-|
-| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
-|
-|   Default: FALSE
-|
-*/
-
-$config['parser_body_enabled'] = FALSE;
-
-/*
-|--------------------------------------------------------------------------
-| Title Separator
-|--------------------------------------------------------------------------
-|
-| What string should be used to separate title segments sent via $this->template->title('Foo', 'Bar');
-|
-|   Default: ' | '
-|
-*/
-
-$config['title_separator'] = ' | ';
-
-/*
-|--------------------------------------------------------------------------
-| Theme
-|--------------------------------------------------------------------------
-|
-| Which theme to use by default?
-|
-| Can be overriden with $this->template->set_theme('foo');
-|
-|   Default: ''
-|
-*/
-
-$config['theme'] = 'mercurial';
-
-/*
-|--------------------------------------------------------------------------
-| Theme
-|--------------------------------------------------------------------------
-|
-| Where should we expect to see themes?
-|
-|	Default: array(APPPATH.'themes/' => '../themes/')
-|
-*/
-
-$config['theme_locations'] = array(
-	'themes/' => '../../themes/',
-);
-
-?>

File admin/application/controllers/hgdir.php

View file
 			$this->delete();
 		}		
 		
-		$this->template->title(lang('hgphp_title_directory'), 'Mercurial Repository Manager');
+		$this->load->vars(array('title'=>lang('hgphp_title_directory') . ' | ' . HGPHP_NAME));
 
 		// view the latest repository listings, updating the OF lock
 		$this->phphgadmin->start_tx($this->ofl_lock_hgwebconf, $dummy='');
 		// error handling
 		if(!is_array($lsdir))
 		{
-			$this->template->inject_partial('user_err', lang('hgphp_msg_hgwebconf_read_err_absdirs'));
+			$this->load->vars(array('user_err'=>lang('hgphp_msg_hgwebconf_read_err_absdirs')));
 		}
 		
 		$this->session->set_flashdata('ofl_hgwebconf', $this->ofl_lock_hgwebconf);
+		
+		$this->load->vars(array('pagetype'=>'directory'));
 
-		$this->template->build('repo_directory');
+		$this->load->view('../../themes/paper/index');
 	}
 	
 	function create()
 		
 		if ($this->form_validation->run() == FALSE)
 		{
-			$this->template->inject_partial('user_err', lang('hgphp_msg_hgwebconf_create_err_validname'));
+			$this->load->vars(array('user_err'=>lang('hgphp_msg_hgwebconf_create_err_validname')));
 		}
 		else if($r_name == $blacklist)
 		{
-			$this->template->inject_partial('user_err', lang(''));
+			$this->load->vars(array('user_err'=>lang('hgphp_msg_hgwebconf_create_err_blacklistname')));
 		}
 		else
 		{
 			
 			switch($action_status){
 				case HGPHP_OK:
-					$this->template->inject_partial('user_msg', $r_name.': '. lang('hgphp_msg_hgwebconf_create_success'));
+					$this->load->vars(array('user_msg'=>$r_name.': '. lang('hgphp_msg_hgwebconf_create_success')));
 					break;
 				case HGPHP_ERR_PERM_USR:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_create_err_permuser'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_create_err_permuser')));
 					break;
 				case HGPHP_ERR_PERM_SYS_REPODIR:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_create_err_permsys'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_create_err_permsys')));
 					break;
 				case -100:
-					$this->template->inject_partial('user_msg', 'Repository "'. $r_name .'" RESTORE UNSUPPORTED.');
+					$this->load->vars(array('user_err'=>$r_name.': '.'" RESTORE UNSUPPORTED.'));
 					break;
 				case HGPHP_ERR_FS_PREEXISTS:
-					$this->template->inject_partial('user_err', 'Repository "'. $r_name .': ' . lang('hgphp_msg_hgwebconf_create_err_preexists'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_create_err_preexists')));
 					break;	
 				case OFL_ERR_LOCKING:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_create_err_locking') . ' <a href="'.site_url('/hgdir').'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>');
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_create_err_locking') . ' <a href="'.site_url('/hgdir').'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>'));
 					break;			
 				default:
-					$this->template->inject_partial('user_err', $r_name .': '. lang('hgphp_msg_unknown_err') . $action_status);
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_unknown_err'). $action_status));
 					break;
 			}
 		}
 			
 		if ($this->form_validation->run() == FALSE)
 		{
-			$this->template->inject_partial('user_err', lang('hgphp_msg_hgwebconf_delete_err_unspecified_name'));
+			$this->load->vars(array('user_err'=>lang('hgphp_msg_hgwebconf_delete_err_unspecified_name')));
 		}
 		else
 		{
-//			$r_name = base64_decode($r_key);
 			$this->phphgadmin->start_tx($this->ofl_lock_hgwebconf, $dummy='');
 			$action_status = $this->phphgadmin->delete_repository($r_name);
 			$this->phphgadmin->end_tx();
 			
 			switch($action_status){
 				case HGPHP_OK:
-					$this->template->inject_partial('user_msg', $r_name.': '. lang('hgphp_msg_hgwebconf_delete_success'));
+					$this->load->vars(array('user_msg'=>$r_name.': '. lang('hgphp_msg_hgwebconf_delete_success')));
 					break;
 				case HGPHP_ERR_PERM_USR:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_delete_err_permuser'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_delete_err_permuser')));
 					break;
 				case HGPHP_ERR_PERM_SYS_REPODIR:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_delete_err_permsys'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_delete_err_permsys')));
 					break;
 				case HGPHP_ERR_FS_PREEXISTS:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_delete_err_preexists'));
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_delete_err_preexists')));
 					break;	
 				case OFL_ERR_LOCKING:
-					$this->template->inject_partial('user_err', $r_name .': ' . lang('hgphp_msg_hgwebconf_delete_err_locking') . ' <a href="'.site_url('/hgdir').'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>');
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_hgwebconf_delete_err_locking') . ' <a href="'.site_url('/hgdir').'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>'));
 					break;			
 				default:
-					$this->template->inject_partial('user_err', $r_name .': '. lang('hgphp_msg_unknown_err') . $action_status);
+					$this->load->vars(array('user_err'=>$r_name.': '. lang('hgphp_msg_unknown_err') . $action_status));
 					break;
 			}
 		}

File admin/application/controllers/hgrepo.php

View file
 			return;
 		}
 		
-		$this->template->title($repositoryName, 'Mercurial Repository Editor');
-		$this->template->build('repo_browse');
+		$this->load->vars(array('title'=>$repositoryName . ' | ' . HGPHP_NAME));
+		$this->load->vars(array('pagetype'=>'browse'));
+
+		$this->load->view('../../themes/paper/index');
 	}
 	
 	function manage()
 				switch($save_status)
 				{
 					case HGPHP_OK:
-						$this->template->inject_partial('user_msg', lang('hgphp_msg_hgrc_save_success'));
+						$this->load->vars(array('user_msg'=>lang('hgphp_msg_hgrc_save_success')));
 						break;
 					case OFL_ERR_LOCKING:
-						$this->template->inject_partial('user_err', lang('hgphp_msg_hgrc_save_err_locking') . '<a href="'.site_url('/hgrepo/manage/'.$repositoryName).'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>');
+						$this->load->vars(array('user_err'=>lang('hgphp_msg_hgrc_save_err_locking') . '<a href="'.site_url('/hgrepo/manage/'.$repositoryName).'" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span>'.lang('hgphp_action_reload').'</a>'));
 						break;	
 					default:
-						$this->template->inject_partial('user_err', lang('hgphp_msg_unknown_err') . $save_status);
+						$this->load->vars(array('user_err'=>lang('hgphp_msg_unknown_err') . $save_status));
 						break;
 				}
 			}
 			else
 			{
-				$this->template->inject_partial('user_err', lang('hgphp_msg_hgrc_save_err_validation').'=');
+				$this->load->vars(array('user_err'=>lang('hgphp_msg_hgrc_save_err_validation').'='));
 			}
 		}
 		
-		$this->template->title($repositoryName, 'Mercurial Repository Editor');
+		$this->load->vars(array('title'=>$repositoryName . ' | ' . HGPHP_NAME));
 		
 		$this->phphgadmin->start_tx($dummy='', $ofl_lock_hgrc);
 		$hgrc = $this->phphgadmin->stat_repository($repositoryName);
 			switch($hgrc)
 			{
 				case OFL_ERR_READING: 
-					$this->template->inject_partial('user_err', lang('hgphp_msg_hgrc_read_err'));
+					$this->load->vars(array('user_err'=>lang('hgphp_msg_hgrc_read_err')));
 					break;
 				default:
-					$this->template->inject_partial('user_err', lang('hgphp_msg_hgrc_save_err_notfound') . $hgrc);
+					$this->load->vars(array('user_err'=>lang('hgphp_msg_hgrc_save_err_notfound') . $hgrc));
 					break;
 			}
 		}
 		}
 		
 		$this->session->set_flashdata('ofl_hgrc_' . $repositoryName, $ofl_lock_hgrc);
-		$this->template->build('repository', 
-			array(
-					'hgrc_bools_arr'=>$this->config->item('hgrc_bools_arr'),
-					'hgrc_form' => $hgrc_form
-			));	
+		
+		$this->load->vars(array('pagetype'=>'config', 'hgrc_bools_arr'=>$this->config->item('hgrc_bools_arr'), 'hgrc_form' => $hgrc_form));
+
+		$this->load->view('../../themes/paper/index');
 	}
 	
 	function index()

File admin/application/helpers/hg_directory_helper.php

View file
 	
 	if($has_next)
 	{
-		$_lsdir_iter = $_lsdir[$_lsdir_iter_count];
-		$_lsdir_iter_count += 1;
+//		$_lsdir_iter = $_lsdir[$_lsdir_iter_count];
+//		$_lsdir_iter_count += 1;
 	}
 	else
 	{
 	return $has_next;
 }
 
+function the_repo()
+{
+	global $_lsdir, $_lsdir_iter, $_lsdir_iter_count;
+	
+	$has_next = have_repos();
+	
+	if($has_next)
+	{
+		$_lsdir_iter = $_lsdir[$_lsdir_iter_count];
+		$_lsdir_iter_count += 1;
+	}
+
+	return $_lsdir_iter;
+}
+
 function repo_name()
 {
 	global $_lsdir_iter;

File admin/application/helpers/hg_repo_helper.php

View file
 	$has_section = ($_section_iter_count < count($_section_iter_keys));
 	if($has_section)
 	{
-		$_section_hashname = $_section_iter_keys[$_section_iter_count];
-		$_items = $_sections[$_section_hashname];
-		$_item_iter_keys = array_keys($_items);
-		$_section_iter_count += 1;
+//		$_section_hashname = $_section_iter_keys[$_section_iter_count];
+//		$_items = $_sections[$_section_hashname];
+//		$_item_iter_keys = array_keys($_items);
+//		$_section_iter_count += 1;
 	}
 	else
 	{
 	return $has_section;
 }
 
+function the_section()
+{
+	global $_hgrc_ini64, $_sections, $_section_iter_keys, $_section_iter_count, $_section_hashname;
+	global $_items, $_item_iter_keys, $_item_iter_count;
+	
+	$has_section = has_sections();
+	
+	if($has_section)
+	{
+		$_section_hashname = $_section_iter_keys[$_section_iter_count];
+		$_items = $_sections[$_section_hashname];
+		$_item_iter_keys = array_keys($_items);
+		$_section_iter_count += 1;
+	}
+	
+	return $_items;
+}
+
 function section_name()
 {
 	global $_section_hashname;
 	$has_items = ($_item_iter_count < count($_item_iter_keys));
 	if($has_items)
 	{
-		$_item_hashname = $_item_iter_keys[$_item_iter_count];
-		$_item_iter_count += 1;
+//		$_item_hashname = $_item_iter_keys[$_item_iter_count];
+//		$_item_iter_count += 1;
 	}
 	else
 	{
 	return $has_items;
 }
 
+function the_item()
+{
+	global $_items, $_item_iter_keys, $_item_iter_count, $_item_hashname;
+	
+	$has_items = has_items();
+	
+	if($has_items)
+	{
+		$_item_hashname = $_item_iter_keys[$_item_iter_count];
+		$_item_iter_count += 1;
+	}
+	
+	return $_item_hashname;
+}
+
 function item_name()
 {
 	global $_item_hashname;
 {
 	global $_items, $_item_hashname;
 	return $_items[$_item_hashname];
+}
+
+function item_dirty_value()
+{
+	$hgrc_form = phphginfo('hgrc_form');
+	if(!empty($hgrc_form) && isset($hgrc_form[section_name()]) && isset($hgrc_form[section_name()][item_name()]))
+    {
+    	return $hgrc_form[section_name()][item_name()];
+    }
+    return item_current_value();
+}
+
+function item_is_boolean()
+{
+	$bools = phphginfo('hgrc_bools_arr');
+	return isset($bools[section_name()]) && in_array(item_name(), $bools[section_name()]);
 }

File admin/application/helpers/hg_template_helper.php

View file
+<?php 
+
+function get_header()
+{
+	include('C:\Users\joshjcarrier\workspace\hg-php.joshjcarrier.com\admin\themes\paper\header.php');
+}
+
+function get_footer()
+{
+	include('C:\Users\joshjcarrier\workspace\hg-php.joshjcarrier.com\admin\themes\paper\footer.php');
+}
+
+function is_directory()
+{
+	return phphginfo('pagetype') === 'directory';
+}
+
+function is_repo_config()
+{
+	return phphginfo('pagetype') === 'config';
+}
+
+function has_messages()
+{
+	return user_messages() !== FALSE;
+}
+
+function user_messages()
+{
+	return phphginfo('user_msg');
+}
+
+function has_errors()
+{
+	return user_errors() !== FALSE;
+}
+
+function user_errors()
+{
+	return phphginfo('user_err');
+}
+
+function the_title()
+{
+	return phphginfo('title');
+}
+
+function phphginfo($item)
+{
+	$ci =& get_instance();
+	if(isset($ci->load->_ci_cached_vars[$item]))
+	{
+		return $ci->load->_ci_cached_vars[$item];
+	}
+	return FALSE;
+}

File admin/application/libraries/MY_Controller.php

View file
 
 	function MY_Controller() {
 		parent :: Controller();
-		
-		/* Phil Sturgeon's Templating */
-		$CI = &get_instance();
-		
-//		$CI->config->load('hgphp', TRUE);
-//		if($CI->config->item('theme_layout', 'hgphp') != FALSE)
-//		{
-//			$CI->template->set_layout($CI->config->item('theme_layout', 'hgphp'));
-//		}
-//		else
-//		{
-			// a default
-			$CI->template->set_layout('paper');
-//		}
 	}
 }
 

File admin/application/libraries/Template.php

-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package        CodeIgniter
- * @author        Rick Ellis
- * @copyright    Copyright (c) 2006, EllisLab, Inc.
- * @license        http://www.codeignitor.com/user_guide/license.html
- * @link        http://www.codeigniter.com
- * @since        Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Template Class
- *
- * Build your CodeIgniter pages much easier with partials, breadcrumbs, layouts and themes
- *
- * @package        	CodeIgniter
- * @subpackage    	Libraries
- * @category    	Libraries
- * @author        	Philip Sturgeon
- * @editor			Josh Carrier - hacked for injection
- * @link
- */
-class Template
-{
-    private $_module = '';
-    private $_controller = '';
-    private $_method = '';
-
-    private $_theme = '';
-    private $_layout = FALSE; // By default, dont wrap the view with anything
-
-    private $_title = '';
-    private $_metadata = array();
-
-	private $_partials = array();
-	private $_injected = array();
-
-    private $_breadcrumbs = array();
-
-    private $_title_separator = ' | ';
-
-    private $_parser_enabled = TRUE;
-    private $_parser_body_enabled = TRUE;
-
-	private $_theme_locations = array();
-
-    // Seconds that cache will be alive for
-    private $cache_lifetime = 0;//7200;
-
-    private $_ci;
-
-    private $data = array();
-
-	/**
-	 * Constructor - Sets Preferences
-	 *
-	 * The constructor can be passed an array of config values
-	 */
-	function __construct($config = array())
-	{
-		if (!empty($config))
-		{
-			$this->initialize($config);
-		}
-
-        $this->_ci =& get_instance();
-        log_message('debug', 'Template class Initialized');
-
-    	// Work out the controller and method
-    	if( method_exists( $this->_ci->router, 'fetch_module' ) )
-    	{
-    		$this->_module 	= $this->_ci->router->fetch_module();
-    	}
-
-        $this->_controller	= $this->_ci->router->fetch_class();
-        $this->_method 		= $this->_ci->router->fetch_method();
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Initialize preferences
-	 *
-	 * @access	public
-	 * @param	array
-	 * @return	void
-	 */
-	function initialize($config = array())
-	{
-		foreach ($config as $key => $val)
-		{
-			$this->{'_'.$key} = $val;
-		}
-
-		if(empty($this->_theme_locations))
-		{
-			$this->_theme_locations = array(APPPATH . 'themes/' => '../themes/');
-		}
-	}
-
-    // --------------------------------------------------------------------
-
-    /**
-     * Set the mode of the creation
-     *
-     * @access    public
-     * @param    string
-
-     * @return    void
-     */
-    public function build($view = '', $data = array(), $return = FALSE)
-    {
-		// Set whatever values are given. These will be available to all view files
-    	$this->data = is_object($data) ? (array) $data : $data;
-
-        if(empty($this->_title))
-        {
-        	$this->_title = $this->_guess_title();
-        }
-
-        // Output template variables to the template
-        $template['title']	= $this->_title;
-        $template['breadcrumbs'] = $this->_breadcrumbs;
-        $template['metadata']	= implode("\n\t\t", $this->_metadata);
-    	$template['partials']	= array();
-
-    	// Assign by reference, as all loaded views will need access to partials
-        $this->data['template'] =& $template;
-
-    	foreach( $this->_partials as $name => $partial )
-    	{
-    		$template['partials'][$name] = $this->_load_view( $partial['view'] , $partial['search']);
-    	}
-    	
-    	// JOSH CARRIER HACKED HERE - added the direct injections kthx
-    	foreach( $this->_injected as $name => $partial )
-    	{
-    		$template['partials'][$name] = $partial;
-    	}
-
-        // Disable sodding IE7's constant cacheing!!
-        $this->_ci->output->set_header('Expires: Sat, 01 Jan 2000 00:00:01 GMT');
-        $this->_ci->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
-        $this->_ci->output->set_header('Cache-Control: post-check=0, pre-check=0, max-age=0');
-        $this->_ci->output->set_header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
-        $this->_ci->output->set_header('Pragma: no-cache');
-
-        // Let CI do the caching instead of the browser
-        $this->_ci->output->cache( $this->cache_lifetime );
-
-        // Test to see if this file
-    	$this->_body = $this->_load_view( $view, TRUE, $this->_parser_body_enabled );
-
-        // Want this file wrapped with a layout file?
-        if( $this->_layout )
-        {
-			$template['body'] = $this->_body;
-
-			// If using a theme, use the layout in the theme
-			foreach ($this->_theme_locations as $location => $offset)
-			{
-				if( $this->_theme && file_exists($location.$this->_theme.'/views/' . $this->_layout.EXT))
-				{
-					// If directory is set, use it
-					$this->data['theme_view_folder'] = $offset.$this->_theme.'/views/';
-					$layout_view = $this->data['theme_view_folder'].$this->_layout;
-
-					break;
-				}
-			}
-
-			// No theme layout file was found, lets use whatever they gave us
-			isset($layout_view) || $layout_view = $this->_layout;
-
-			// Parse if parser is enabled, or its a theme view
-			if($this->_parser_enabled === TRUE || $this->_theme)
-			{
-	    		$this->_ci->load->library('parser');
-				$this->_body = $this->_ci->parser->parse( $layout_view, $this->data, TRUE );
-			}
-
-			else
-			{
-				$this->_body = $this->_ci->load->view( $layout_view, $this->data, TRUE );
-			}
-        }
-
-        // Want it returned or output to browser?
-        if(!$return)
-        {
-            // Send it to output
-            $this->_ci->output->set_output($this->_body);
-        }
-
-        return $this->_body;
-    }
-
-
-    /**
-     * Set the title of the page
-     *
-     * @access    public
-     * @param    string
-     * @return    void
-     */
-    public function title()
-    {
-    	// If we have some segments passed
-    	if($title_segments =& func_get_args())
-    	{
-    		$this->_title = implode($this->_title_separator, $title_segments);
-    	}
-
-        return $this;
-    }
-
-
-    /**
-     * Put extra javascipt, css, meta tags, etc before all other head data
-     *
-     * @access    public
-     * @param     string	$line	The line being added to head
-     * @return    void
-     */
-    public function prepend_metadata($line)
-    {
-    	array_unshift($this->_metadata, $line);
-        return $this;
-    }
-
-
-	/**
-     * Put extra javascipt, css, meta tags, etc after other head data
-     *
-     * @access    public
-     * @param     string	$line	The line being added to head
-     * @return    void
-     */
-    public function append_metadata($line)
-    {
-    	$this->_metadata[] = $line;
-        return $this;
-    }
-
-
-    /**
-     * Set metadata for output later
-     *
-     * @access    public
-     * @param	  string	$name		keywords, description, etc
-     * @param	  string	$content	The content of meta data
-     * @param	  string	$type		Meta-data comes in a few types, links for example
-     * @return    void
-     */
-    public function set_metadata($name, $content, $type = 'meta')
-    {
-        $name = htmlspecialchars(strip_tags($name));
-        $content = htmlspecialchars(strip_tags($content));
-
-        // Keywords with no comments? ARG! comment them
-        if($name == 'keywords' && !strpos($content, ','))
-        {
-        	$content = preg_replace('/[\s]+/', ', ', trim($content));
-        }
-
-        switch($type)
-        {
-        	case 'meta':
-        		$meta = '<meta name="'.$name.'" content="'.$content.'" />';
-        	break;
-
-        	case 'link':
-        		$meta = '<link rel="'.$name.'" href="'.$content.'" />';
-        	break;
-        }
-
-    	$this->append_metadata($meta);
-
-        return $this;
-    }
-
-
-	/**
-	 * Which theme are we using here?
-	 *
-	 * @access	public
-	 * @param	string	$theme	Set a theme for the template library to use
-	 * @return	void
-	 */
-	public function set_theme($theme = '')
-	{
-		$this->_theme = $theme;
-		return $this;
-	}
-
-
-	/**
-	 * Which Template file are we using here?
-	 *
-	 * @access	public
-	 * @param	string	$view
-	 * @return	void
-	 */
-	public function set_layout($view = '')
-	{
-		$this->_layout = $view;
-		return $this;
-	}
-
-	/**
-	 * Set a view partial
-	 *
-	 * @access	public
-	 * @param	string
-	 * @param	string
-	 * @param	boolean
-	 * @return	void
-	 */
-	public function set_partial( $name, $view, $search = TRUE )
-	{
-		$this->_partials[$name] = array('view' => $view, 'search' => $search);
-		return $this;
-	}
-
-
-	/**
-	 * Returns a partial
-	 *
-	 * Instead of evaluating the partial internally
-	 * this method returns the value of the partial
-	 * in order for you to perform your own logic
-	 * on it, caching for instance.
-	 *
-	 * WARNING: Any variables pushed to the template
-	 * library after this point will NOT be available
-	 * in the specified partial, as it is parsed
-	 * immediately!
-	 *
-	 * @author	Per Sikker Hansen <lord@heavenquake.net>
-	 * @access	public
-	 * @param	string
-	 * @param	boolean
-	 * @return	string
-	 */
-	public function return_partial( $view, $data = array(), $search = TRUE )
-	{
-		$this->data = array_merge($this->data, $data);
-		return $this->_load_view( $view, $search );
-	}
-
-
-	/**
-	 * Inject output data directly
-	 *
-	 * Intended for use with data prepped after
-	 * return_partial(), but possible to use for
-	 * other purposes. Injects the data directly
-	 * into the partial tree.
-	 *
-	 * WARNING: Any variables pushed to the template
-	 * library after the injection will NOT be
-	 * available in the data you have injected as
-	 * the data is already parsed!
-	 *
-	 * @author	Per Sikker Hansen <lord@heavenquake.net>
-	 * @access	public
-	 * @param	string
-	 * @param	string
-	 * @return	void
-	 */
-	public function inject_partial( $name, $data )
-	{
-		$this->_injected[$name] = $data;
-		return $this;
-	}
-
-
-	/**
-	 * Helps build custom breadcrumb trails
-	 *
-	 * @access	public
-	 * @param	string	$name		What will appear as the link text
-	 * @param	string	$url_ref	The URL segment
-	 * @return	void
-	 */
-    public function set_breadcrumb($name, $uri = '')
-    {
-    	$this->_breadcrumbs[] = array('name' => $name, 'uri' => $uri );
-        return $this;
-    }
-
-
-    /**
-     * enable_parser
-     * Should be parser be used or the view files just loaded normally?
-     *
-     * @access    public
-     * @param     string	$view
-     * @return    void
-     */
-    public function enable_parser($bool)
-    {
-        $this->_parser_enabled = $bool;
-        return $this;
-    }
-
-    /**
-     * enable_parser_body
-     * Should be parser be used or the body view files just loaded normally?
-     *
-     * @access    public
-     * @param     string	$view
-     * @return    void
-     */
-    public function enable_parser_body($bool)
-    {
-        $this->_parser_body_enabled = $bool;
-        return $this;
-    }
-
-    /**
-     * theme_locations
-     * Should be parser be used or the view files just loaded normally?
-     *
-     * @access    public
-     * @param     string	$view
-     * @return    array
-     */
-    public function theme_locations()
-    {
-        return $this->_theme_locations;
-    }
-
-    /**
-     * theme_exists
-     * Check if a theme exists
-     *
-     * @access    public
-     * @param     string	$view
-     * @return    array
-     */
-	public function theme_exists()
-	{
-		foreach ($this->_theme_locations as $location => $offset)
-		{
-			if( is_dir($location.$this->_theme) )
-			{
-				return TRUE;
-			}
-		}
-
-		return FALSE;
-	}
-
-    // A module view file can be overriden in a theme
-    private function _load_view($view = '', $search = TRUE, $parse_view = TRUE)
-    {
-    	// Load exactly what we asked for, no f**king around!
-    	if($search !== TRUE)
-    	{
-    		if($this->_parser_enabled === TRUE && $parse_view === TRUE)
-			{
-				$this->_ci->load->library('parser');
-				return $this->_ci->parser->parse( $view, $this->data, TRUE );
-			}
-
-			else
-			{
-				return $this->_ci->load->view( $view, $this->data, TRUE );
-			}
-    	}
-
-		// Only bother looking in themes if there is a theme
-		if($this->_theme != '')
-		{
-			foreach ($this->_theme_locations as $location => $offset)
-			{
-				$theme_view = $this->_theme . '/views/modules/' . $this->_module . '/' . $view;
-
-				if( file_exists( $location . $theme_view . EXT ))
-				{
-					if($this->_parser_enabled === TRUE && $parse_view === TRUE)
-					{
-						$this->_ci->load->library('parser');
-						return $this->_ci->parser->parse( $offset.$theme_view, $this->data, TRUE );
-					}
-
-					else
-					{
-						return $this->_ci->load->view( $offset.$theme_view, $this->data, TRUE );
-					}
-				}
-			}
-		}
-
-		// Not found it yet? Just load, its either in the module or root view
-		if($this->_parser_enabled === TRUE && $parse_view === TRUE)
-		{
-			$this->_ci->load->library('parser');
-			return $this->_ci->parser->parse( $this->_module.'/'.$view, $this->data, TRUE );
-		}
-
-		else
-		{
-			return $this->_ci->load->view( $this->_module.'/'.$view, $this->data, TRUE );
-		}
-
-    }
-
-    private function _guess_title()
-    {
-        $this->_ci->load->helper('inflector');
-
-        // Obviously no title, lets get making one
-        $title_parts = array();
-
-        // If the method is something other than index, use that
-        if($this->_method != 'index')
-        {
-        	$title_parts[] = $this->_method;
-        }
-
-        // Make sure controller name is not the same as the method name
-        if(!in_array($this->_controller, $title_parts))
-        {
-        	$title_parts[] = $this->_controller;
-        }
-
-        // Is there a module? Make sure it is not named the same as the method or controller
-        if(!empty($this->_module) && !in_array($this->_module, $title_parts))
-        {
-        	$title_parts[] = $this->_module;
-        }
-
-        // Glue the title pieces together using the title separator setting
-        $title = humanize(implode($this->_title_separator, $title_parts));
-
-        return $title;
-    }
-
-}
-
-// END Template class

File admin/themes/paper/footer.php

View file
+
+  <tr>
+  	<td>
+<span style="background:#ffc;font-size:70%;">
+Processed in {elapsed_time} seconds. <?php echo HGPHP_NAME; ?> v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
+</span>  	
+  	</td>
+  </tr>
+</table>
+ 
+</div> 
+</body>
+</html>

File admin/themes/paper/header.php

View file
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> 
+<head> 
+<link rel="icon" href="<?php echo base_url(); ?>static/hgicon.png" type="image/png" /> 
+<meta name="robots" content="index, nofollow" /> 
+<link rel="stylesheet" href="<?php echo base_url(); ?>static/style-paper.css" type="text/css" /> 
+<link rel="stylesheet" href="<?php echo base_url(); ?>themes/mercurial/css/smoothness/jquery-ui-1.8.1.custom.css" type="text/css" /> 
+<script type="text/javascript" src="<?php echo base_url(); ?>themes/mercurial/js/jquery-1.4.2.min.js"></script>
+<script type="text/javascript" src="<?php echo base_url(); ?>themes/mercurial/js/jquery-ui-1.8.1.custom.min.js"></script>
+
+<title><?php echo the_title(); ?></title> 
+
+<style type="text/css">
+.dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative; font-size: 70%;}
+.dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
+.ui-dialog-content {font-size: 70%;}
+.ui-dialog-title {font-size: 70%;}
+.ui-dialog-buttonpane {font-size: 70%;}
+</style>
+</head> 
+<body> 

File admin/themes/paper/index.php

View file
+<?php get_header(); ?>
+
+<div class="container"> 
+<div class="menu"> 
+<div class="logo"> 
+<a href="http://mercurial.selenic.com/"> 
+<img src="<?php echo base_url(); ?>static/hglogo.png" alt="mercurial" /></a> 
+</div> 
+<ul> 
+<li class="active"><a href="<?php echo base_url()?>"><?php echo lang('hgphp_title_adminhome'); ?></a></li> 
+<li><a href="/"><?php echo lang('hgphp_title_listingshome'); ?></a></li> 
+</ul> 
+<ul> 
+ 
+</ul> 
+</div> 
+ 
+<div class="main"> 
+<h2><?php echo htmlentities(the_title()); ?></h2> 
+ 
+<table class="bigtable"> 
+
+<?php if(has_errors()): ?>
+  <tr>
+    <td>
+		<div class="ui-widget">
+			<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;font-size: 70%;"> 
+				<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
+				<strong><?php echo lang('hgphp_msg_err'); ?>:</strong> <?php echo user_errors(); ?></p>
+			</div>
+		</div>
+    </td>
+  </tr>
+<?php endif; ?>
+<?php if(has_messages()): ?>
+  <tr>
+    <td>
+		<div class="ui-widget">
+			<div class="ui-state-highlight ui-corner-all" style="padding: 0 .7em;font-size: 70%;"> 
+				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
+				<?php echo user_messages(); ?></p>
+			</div>
+		</div>
+    </td>
+  </tr>
+<?php endif; ?>
+  <tr>
+    <td> 
+<?php if(is_directory()){ include('repo_directory.php'); }?>
+<?php if(is_repo_config()){ include('repository.php'); }?>
+    </td>
+  </tr>
+
+<?php get_footer(); ?>

File admin/themes/paper/repo_directory.php

View file
+<script type="text/javascript">
+	$(function(){
+		// Dialog			
+		$('#dialog_create').dialog({
+			autoOpen: false,
+			width: 600,
+			modal: true,
+			buttons: {
+				"<?php echo lang('hgphp_action_ok'); ?>": function() { 
+					document.forms['form_create'].submit(); 
+				}, 
+				"<?php echo lang('hgphp_action_cancel'); ?>": function() { 
+					document.forms['form_create'].reset(); 
+					$(this).dialog("close"); 
+				} 
+			}
+		});
+		
+		$('#dialog_delete').dialog({
+			autoOpen: false,
+			width: 600,
+			modal: true,
+			buttons: {
+				"<?php echo lang('hgphp_action_ok'); ?>": function() { 
+					document.forms['form_delete'].submit(); 
+				}, 
+				"<?php echo lang('hgphp_action_cancel'); ?>": function() { 
+					document.forms['form_delete'].reset(); 
+					$(this).dialog("close"); 
+				} 
+			}
+		});		
+		
+		// Dialog Link
+		$('#dialog_link_create, #dialog_link2_create').click(function(){
+			$('#dialog_create').dialog('open');
+			document.forms['form_create'].form_create_name.focus();
+			return false;
+		});
+		
+		// Dialog Link
+		$('#dialog_link_delete, #dialog_link2_delete').click(function(){
+			document.forms['form_delete'].form_delete_name.focus();
+			$('#dialog_delete').dialog('open');
+			return false;
+		});		
+		
+		//hover states on the static widgets
+		$('.dialog_link, ul#icons li').hover(
+			function() { $(this).addClass('ui-state-hover'); }, 
+			function() { $(this).removeClass('ui-state-hover'); }
+		);
+		
+	});
+</script>
+<table class="bigtable" style="border-bottom: 0px">
+    <tr>
+	  <td colspan="4">
+		<p><a href="#" id="dialog_link_create" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php print lang('hgphp_action_create'); ?></a>
+		<a href="#" id="dialog_link_delete" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php print lang('hgphp_action_delete'); ?></a></p>
+	  </td>
+	</tr>
+    <tr> 
+        <th></th> 
+        <th width="100%"><?php echo lang('hgphp_title_repo'); ?></th> 
+        <th><?php echo lang('hgphp_title_status'); ?></th> 
+        <th></th> 
+    </tr> 
+<?php $parity=0; while(have_repos()): the_repo(); ?>
+	<tr class="parity<?php echo $parity; $parity=($parity+1)%2;?>">
+	  <td>
+		<input type="checkbox" disabled="disabled"/>
+	  </td>
+	  <td>
+	    <a href="<?php echo site_url('hgrepo/manage/'.repo_name()); ?>"><?php echo htmlentities(repo_name()); ?></a>
+	  </td>
+	  <td>
+	    <?php if(repo_status() == HGPHP_REPO_STATUS_ENABLED): echo lang('hgphp_repostatus_enabled'); ?>
+	    <?php elseif(repo_status() == HGPHP_REPO_STATUS_DISABLED): echo lang('hgphp_repostatus_disabled');?>
+	    <?php elseif(repo_status() == HGPHP_REPO_STATUS_MISSING): echo lang('hgphp_repostatus_missing');?>
+	    <?php endif; ?>
+	  </td>
+	  <td>
+	  	<?php if(repo_status() == HGPHP_REPO_STATUS_ENABLED): ?>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.repo_name()); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<?php endif; ?>
+	  </td>
+	</tr>
+<?php endwhile; ?>
+	<tr>
+	  <td colspan="4">
+		<p><a href="#" id="dialog_link2_create" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_create'); ?></a>
+		<a href="#" id="dialog_link2_delete" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_delete'); ?></a></p>
+	  </td>
+	</tr>
+</table>
+
+<!-- ui-dialog -->
+		<div id="dialog_create" class="dialog" title="<?php echo lang('hgphp_action_create'); ?>">
+			<form action="<?php echo site_url('hgdir'); ?>" method="post" id="form_create" name="form_create">
+			<table style="width: 100%">
+				<tr>
+					<td>
+						<?php echo lang('hgphp_dialog_repo_create'); ?>
+						<br />
+						<input type="hidden" name="form_action" value="create_repository" />
+						<input type="text" style="width:100%" name="form_create_name" id="form_create_name" autocomplete="off"/>
+					</td>
+				</tr>
+			</table>
+			</form>
+		</div>
+		<div id="dialog_delete" class="dialog" title="<?php echo lang('hgphp_action_delete'); ?>">
+			<form action="<?php echo site_url('hgdir'); ?>" method="post" id="form_delete" name="form_delete">
+			<table style="width: 100%">
+				<tr>
+					<td>
+					<input type="hidden" name="form_action" value="delete_repository" />
+						<?php echo lang('hgphp_dialog_repo_delete'); ?>
+						<br />
+						<select style="width:100%" name="form_delete_name" id="form_delete_name">
+							<option selected="selected" value=""></option>
+							<?php while(have_repos()): the_repo(); ?>
+							<option value="<?php echo repo_name(); ?>"><?php echo repo_name(); ?></option>
+							<?php endwhile; ?>
+						</select>
+						<br />
+					</td>
+				</tr>
+			</table>
+			</form>
+		</div>

File admin/themes/paper/repository.php

View file
+<script type="text/javascript">
+	$(function(){
+		// Dialog			
+		$('#dialog_save').dialog({
+			autoOpen: false,
+			width: 600,
+			modal: true,
+			buttons: {
+				"<?php echo lang('hgphp_action_ok'); ?>": function() { 
+					document.forms['form_hgrc'].form_action.value = "hgrc_save";
+					document.forms['form_hgrc'].submit(); 
+				}, 
+				"<?php echo lang('hgphp_action_cancel'); ?>": function() { 
+					document.forms['form_hgrc'].reset(); 
+					$(this).dialog("close"); 
+				} 
+			}
+		});
+	
+		// Dialog Link
+		$('#dialog_link_save, #dialog_link2_save').click(function(){
+			$('#dialog_save').dialog('open');
+			return false;
+		});
+	
+		//hover states on the static widgets
+		$('.dialog_link, ul#icons li').hover(
+			function() { $(this).addClass('ui-state-hover'); }, 
+			function() { $(this).removeClass('ui-state-hover'); }
+		);
+	});
+</script>
+
+<table class="bigtable" style="border-bottom: 0">
+<form action="<?php echo current_url(); ?>" method="post" id="form_hgrc" name="form_hgrc">
+	<input type="hidden" name="form_action" id="form_action" value="" />
+	<tr>
+	  <td colspan="3" align="right">
+	  	<p>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.the_name()); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<a href="<?php echo site_url('hgdir'); ?>" id="dialog_link_cancel" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_cancel'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.the_name()); ?>" id="dialog_link_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
+	  	<a href="#" id="dialog_link_save" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_save'); ?></a>
+	  	</p>
+	  </td>
+	</tr>    	
+    <?php 
+    
+        function restore_value($current_value, $hgrc_form, $section_name, $key_name)
+    	{
+    		if(!empty($hgrc_form) && isset($hgrc_form[$section_name]) && isset($hgrc_form[$section_name][$key_name]))
+    		{
+    			return $hgrc_form[$section_name][$key_name];
+    		}
+    		return $current_value;
+    	}
+    
+    ?> 
+    
+      <?php while(has_sections()): the_section(); ?>
+    <tr> 
+        <th><?php echo htmlentities(section_name()) ?></th> 
+        <th></th> 
+        <th><a href='<?php echo lang('hgphp_doclink_hgrc') . section_name() ?>' target="_blank"><?php echo lang('hgphp_title_help'); ?></a></th>  
+    </tr> 
+    
+    <?php $parity=0; while(has_items()): the_item(); ?>
+    <tr class="parity<?php echo $parity; $parity=($parity+1)%2;?>">
+      <td style="vertical-align:middle"><?php echo htmlentities(item_name()); ?></td>
+      <td style="vertical-align:middle;text-align:right">
+      <nobr>
+      <?php if(item_is_boolean()):?>
+      	<select name="hgrc[<?php echo section_name() ?>][<?php echo item_name(); ?>]">
+      		<option value="false" <?php if(restore_value(item_current_value(), $hgrc_form, section_name(), item_name()) === 'false'){echo 'selected="selected"';} ?>>false</option>
+      		<option value="true" <?php if(restore_value(item_current_value(), $hgrc_form, section_name(), item_name()) === 'true'){echo 'selected="selected"';} ?>>true</option>
+      	</select>
+      <?php else: ?>
+        <input type="text" name="hgrc[<?php echo section_name() ?>][<?php echo item_name(); ?>]" value="<?php echo restore_value(item_current_value(), $hgrc_form, section_name(), item_name()); ?>" style="width:70%"/>
+      <?php endif; ?> 
+      	<?php if(lang('hgphp_tooltip_hgrc_' . section_name() . '_' . item_name()) != FALSE):?>
+      	<a href="#" title="<?php echo htmlentities(lang('hgphp_tooltip_hgrc_' . section_name() . '_' . item_name())); ?>" class="ui-state-default ui-corner-all">&nbsp;&nbsp;?&nbsp;&nbsp;</a>
+      	<?php endif; ?>
+      </nobr>
+      </td>
+      <td style="vertical-align:middle"><?php echo htmlentities(item_current_value()); ?></td>
+    </tr>
+    <?php endwhile; endwhile; ?>
+ 
+	<tr>
+	  <td colspan="3" align="right">
+	  	<p>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.the_name()); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<a href="<?php echo site_url('hgdir'); ?>" id="dialog_link2_cancel" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_cancel'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.the_name()); ?>" id="dialog_link2_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
+	  	<a href="#" id="dialog_link2_save" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_save'); ?></a>
+	  	</p>
+	  </td>
+	</tr>
+</table>
+	<div id="dialog_save" class="dialog" title="<?php echo lang('hgphp_action_save'); ?>">
+		<?php echo lang('hgphp_dialog_repo_save'); ?>
+	</div>