continued :)
[phpgitweb.git] / htdocs / lib / PHPGitWeb.class.php
index 8d16d7ba2b0fdcc80e7ee0b6b8f31217754b1e6d..5789d1f098152191c09d38bd4d2f013fd9451d1f 100644 (file)
 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/graph.class.php");
 
 class PHPGitWeb {
@@ -35,6 +37,7 @@ class PHPGitWeb {
                $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 +48,12 @@ 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");
                        $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);
@@ -91,6 +95,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":