Commits

joshjcarrier  committed 5b56c9c

Profile selection complete.

  • Participants
  • Parent commits 3cdaf49

Comments (0)

Files changed (7)

File admin/application/controllers/hgdir.php

 			$this->delete();
 		}		
 		
-		$this->load->vars(array('title'=>lang('hgphp_title_directory') . ' | ' . HGPHP_NAME));
+		$this->load->vars(array('title'=>current_profile() . ' ' . lang('hgphp_title_directory') .' | ' . HGPHP_NAME));
 
 		// view the latest repository listings, updating the OF lock
 		$this->phphgadmin->start_tx($this->ofl_lock_hgwebconf, $dummy='');

File admin/application/controllers/hgrepo.php

 			return;
 		}
 		
-		$this->load->vars(array('title'=>$repositoryName . ' | ' . HGPHP_NAME));
+		$this->load->vars(array('title'=>$repositoryName . '@' . current_profile() .' | ' . HGPHP_NAME));
 		$this->load->vars(array('pagetype'=>'browser'));
 
 		$this->render_view();
 			}
 		}
 		
-		$this->load->vars(array('title'=>$repositoryName . ' | ' . HGPHP_NAME));
+		$this->load->vars(array('title'=>$repositoryName . '@' . current_profile() .' | ' . HGPHP_NAME));
 		
 		$this->phphgadmin->start_tx($dummy='', $ofl_lock_hgrc);
 		$hgrc = $this->phphgadmin->stat_repository($repositoryName);

File admin/application/controllers/prefs.php

+<?php
+
+class Prefs extends Private_Controller {
+
+	function Prefs()
+	{
+		parent::Private_Controller();
+		$this->load->helper('url');
+	}
+	
+	function index()
+	{
+		redirect('/hgdir');
+		return;
+	}
+	
+	function profile()
+	{
+		$pref_value = $this->input->post('prefs_profile');
+		if(preg_match('/^([a-z0-9]+)$/', $pref_value) == 1)
+		{
+			$this->session->set_userdata('prefs_profile', $pref_value);
+		}
+		$this->index();
+	}
+	
+	
+}

File admin/application/helpers/hg_template_helper.php

 	get_theme_resource('header.php');
 }
 
+function get_sidebar()
+{
+	get_theme_resource('sidebar.php');
+}
+
 function get_footer()
 {
 	get_theme_resource('footer.php');
 	phphginfo('title');
 }
 
+function user_profiles()
+{
+	$ci =& get_instance();
+	$profiles = $ci->config->item('profile');
+	$profile_arr = array();
+	foreach($profiles as $p_name => $profile)
+	{
+		$profiles_arr[$p_name] = $p_name;
+	}
+	return $profiles_arr;
+}
+
+function current_profile()
+{
+	return get_phphginfo('profile');
+}
+
 function phphginfo($item)
 {
 	echo get_phphginfo($item);

File admin/application/libraries/phphg_Controller.php

 	private $theme_name;
 	function phphg_Controller() {
 		parent :: Controller();
-//		$this->phphgadmin->set_profile('test');
+		
+		// profile load
+		$prefs_profile = $this->session->userdata('prefs_profile');
+		if(!empty($prefs_profile))
+		{
+			$this->phphgadmin->set_profile($prefs_profile);
+		}
+		else
+		{
+			$prefs_profile = $this->config->item('default_profile');
+			$this->phphgadmin->set_profile($prefs_profile);
+		}
+		
+		// theme set
 		$this->theme_name = $this->config->item('theme');
-		$this->load->vars(array('title'=>HGPHP_NAME, 'theme_name'=>$this->theme_name,'stylesheet_url'=>base_url().'themes/paper/style.css'));
+		
+		// load shared variables
+		$this->load->vars(array('title'=>HGPHP_NAME, 'theme_name'=>$this->theme_name,'stylesheet_url'=>base_url().'themes/paper/style.css', 'profile'=>$prefs_profile));
 	}
 	
 	function render_view()

File admin/themes/paper/index.php

 <?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 hgserve_url(); ?>"><?php echo lang('hgphp_title_listingshome'); ?></a></li> 
-</ul> 
-<ul> 
- 
-</ul> 
-</div> 
+
+<?php get_sidebar(); ?>
  
 <div class="main"> 
 <h2><?php echo htmlentities(the_title()); ?></h2> 

File admin/themes/paper/sidebar.php

+<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> 
+<form action="/admin/prefs/profile" method="post">
+<?php echo form_dropdown('prefs_profile', user_profiles(), current_profile(), 'onchange="javascript:this.form.submit();"'); ?>
+</form>
+<li><a href="<?php echo hgserve_url(); ?>"><?php echo lang('hgphp_title_listingshome'); ?></a></li> 
+</ul> 
+<ul> 
+ 
+</ul> 
+
+</div>