X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=htdocs%2Flib%2FPHPGitWeb.class.php;h=fc278afc2af1318a57b054a35b2c7c766a3d6784;hb=5a1b314c0a0ab8ed9be7b857c7996d8a3f87e7ed;hp=8d16d7ba2b0fdcc80e7ee0b6b8f31217754b1e6d;hpb=bb1fc2c20c1ec39257c6e89cae030636c15edad3;p=phpgitweb.git diff --git a/htdocs/lib/PHPGitWeb.class.php b/htdocs/lib/PHPGitWeb.class.php index 8d16d7b..fc278af 100644 --- a/htdocs/lib/PHPGitWeb.class.php +++ b/htdocs/lib/PHPGitWeb.class.php @@ -19,8 +19,13 @@ define("PHPGITWEB_VERSION", "0.0.1"); require_once("lib/ContentProvider.class.php"); require_once("lib/ProjectLoader.class.php"); +require_once("lib/CommitLoader.class.php"); require_once("lib/GitCommand.class.php"); require_once("lib/Tools.class.php"); +require_once("lib/Validation.class.php"); +require_once("lib/PageClasses.difftree.class.php"); +require_once("lib/PageClasses.shortlog.class.php"); +require_once("lib/PageClasses.diff.class.php"); require_once("lib/graph.class.php"); class PHPGitWeb { @@ -29,12 +34,14 @@ class PHPGitWeb { public function __construct() { $this->rendertime = microtime(true); + session_start(); $this->page = new ContentProvider('main', 'main'); set_error_handler(array($this, "error_handler")); $this->append_header_nav('projects', '?a=projects', false); $this->page->set('git_version', GitCommand::core_version()); $this->project_loader = new ProjectLoader(); + $this->page->append('title', GitConfig::GITWEB_TITLE); } public function get_project_loader() { @@ -45,11 +52,13 @@ class PHPGitWeb { $this->project = $this->project_loader->getProject($project); if(!$this->project) - $this->page->append('content', new ContentProvider('main', 'project_error')); + $this->page->append('content', new ContentProvider('main', 'err404_project')); else { ContentProvider::overall_set('project', $this->project['name']); - ContentProvider::overall_set('project_head', "HEAD"); + ContentProvider::overall_set('commit_base_id', "all"); + ContentProvider::overall_set('commit_id', "HEAD"); $this->append_header_nav($this->project['name'], '?p='.$this->project['name'].'&a=summary', true); + $this->append_title(" - ".$this->project['name'], false); $this->project_header = new ContentProvider('main', 'project_header'); $this->project_header->set('sub_nav', ""); $this->page->append('content', $this->project_header); @@ -73,12 +82,12 @@ class PHPGitWeb { } else $this->page->append('content', file_get_contents('pages/404.html')); if($this->project_header) { - $this->project_header->set('nav_summary', new ContentProvider('main', ($page == 'summary' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "summary", 'link' => "summary"))); - $this->project_header->set('nav_shortlog', new ContentProvider('main', ($page == 'shortlog' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "shortlog", 'link' => "shortlog"))); - $this->project_header->set('nav_log', new ContentProvider('main', ($page == 'log' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "log", 'link' => "log"))); - $this->project_header->set('nav_commit', new ContentProvider('main', ($page == 'commit' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commit", 'link' => "commit"))); - $this->project_header->set('nav_commitdiff', new ContentProvider('main', ($page == 'commitdiff' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commitdiff", 'link' => "commitdiff"))); - $this->project_header->set('nav_tree', new ContentProvider('main', ($page == 'tree' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "tree", 'link' => "tree"))); + $this->project_header->set('nav_summary', new ContentProvider('main', ($page == 'summary' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "summary", 'link' => "summary", 'link_add' => ""))); + $this->project_header->set('nav_shortlog', new ContentProvider('main', ($page == 'shortlog' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "shortlog", 'link' => "shortlog", 'link_add' => "&h=%commit_base_id%"))); + $this->project_header->set('nav_log', new ContentProvider('main', ($page == 'log' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "log", 'link' => "log", 'link_add' => "&h=%commit_base_id%"))); + $this->project_header->set('nav_commit', new ContentProvider('main', ($page == 'commit' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commit", 'link' => "commit", 'link_add' => "&h=%commit_id%"))); + $this->project_header->set('nav_commitdiff', new ContentProvider('main', ($page == 'commitdiff' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commitdiff", 'link' => "commitdiff", 'link_add' => "&h=%commit_id%"))); + $this->project_header->set('nav_tree', new ContentProvider('main', ($page == 'tree' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "tree", 'link' => "tree", 'link_add' => "&h=%commit_id%"))); } } @@ -91,6 +100,17 @@ class PHPGitWeb { $this->page->append('header_nav', $name); } + public function append_title($name, $prepend_slash = true) { + if($prepend_slash) + $this->page->append('title', '/'); + $this->page->append('title', $name); + } + + public function append_sub_nav($html) { + if($this->project_header) + $this->project_header->append('sub_nav', $html); + } + public function load_extension($extension) { switch($extension) { case "graph":