moved page helper classes to own files
[phpgitweb.git] / htdocs / pages / commit.class.php
index 17f5678758cf9312409876c3ec94ce5838a1fb4b..55ece54f49056402c5b6b5718c11dc8ed563e071 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
  */
 
-require_once('pages/shortlog.class.php');
-
 class page_commit {
     private $page, $phpgitweb;
-       private $commitid;
        
     public function main($phpgitweb, $project) {
                $this->phpgitweb = $phpgitweb;
@@ -29,19 +26,14 @@ class page_commit {
                $project['refs'] = $phpgitweb->get_project_loader()->getProjectRefs($project);
                $phpgitweb->append_header_nav("commit", null, true);
                $phpgitweb->append_title("commit");
+               CommitLoader::parse();
                
                $commit_loader = new CommitLoader($project);
-               
-               if(array_key_exists('h', $_GET))
-                       $commitid = $_GET['h'];
-               else
-                       $commitid = "HEAD";
-               
-               $commit = $commit_loader->load($commitid);
+               $commit = $commit_loader->load();
                if(!$commit)
                        return new ContentProvider('main', 'err404_object');
                
-               ContentProvider::overall_set('project_head', $commit['id']);
+               ContentProvider::overall_set('commit_id', $commit['id']);
                
                
                $this->page = new ContentProvider('commit', 'main');
@@ -64,12 +56,14 @@ class page_commit {
                else
                        $this->page->set('committer_local_date', gmdate('H:i', $committer_local_time));
                $this->page->set('committer_timezone', $commit['committer_timezone']);
-               $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 50, 5)));
+               $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 80, 5)));
                $this->page->set('full_message', htmlentities($commit['text']));
                $this->page->set('tree_hash', $commit['tree']);
                foreach($commit['parent'] as $parent) {
                        $this->page->append('parents', new ContentProvider('commit', 'parent', array('hash' => $parent, 'head' => $commit['id'])));
                }
+               if(count($commit['parent']) == 0)
+                       $this->page->set('parents', '');
                
                $refs = new ContentProvider('commit', 'commit_refs');
                $found = false;
@@ -89,9 +83,14 @@ class page_commit {
                }
                $this->page->set('refs', ($found ? $refs : ""));
                
+               $difftree = new difftree();
+               $this->page->set('difftree', $difftree->generate_difftree($project, $commit, false));
+               
                return $this->page;
        }
        
+       
+       
 }
 
 ?>
\ No newline at end of file