Unify shortlog template
Unify shortlog template

--- a/include/display.git_shortlog.php
+++ b/include/display.git_shortlog.php
@@ -25,57 +25,38 @@
 	$tpl->clear_all_assign();
 	$tpl->assign("project",$project);
 	$tpl->assign("hash",$hash);
-	$tpl->display("shortlog_nav.tpl");
+	$tpl->assign("head",$head);
+
+	if ($page)
+		$tpl->assign("page",$page);
 
 	$revlist = git_read_revlist($projectroot . $project, $hash, 101, ($page * 100));
 
-	if (($hash != $head) || $page)
-		$tpl->assign("headlink",TRUE);
-	if ($page > 0) {
-		$tpl->assign("prevlink",TRUE);
-		$tpl->assign("prevpage",$page-1);
-	}
-	if (count($revlist) > 100) {
-		$tpl->assign("nextlink",TRUE);
-		$tpl->assign("nextpage",$page+1);
-	}
-	$tpl->display("shortlog_pagenav.tpl");
+	$revlistcount = count($revlist);
+	$tpl->assign("revlistcount",$revlistcount);
 
-	$alternate = FALSE;
+	$commitlines = array();
 	$commitcount = min(100,count($revlist));
 	for ($i = 0; $i < $commitcount; $i++) {
-		$tpl->clear_all_assign();
 		$commit = $revlist[$i];
 		if (strlen(trim($commit)) > 0) {
+			$commitline = array();
 			if (isset($refs[$commit]))
-				$tpl->assign("commitref",$refs[$commit]);
+				$commitline["commitref"] = $refs[$commit];
 			$co = git_read_commit($projectroot . $project, $commit);
 			$ad = date_str($co['author_epoch']);
-			if ($alternate)
-				$tpl->assign("class","dark");
-			else
-				$tpl->assign("class","light");
-			$alternate = !$alternate;
-			$tpl->assign("project",$project);
-			$tpl->assign("commit",$commit);
-			$tpl->assign("agestringage",$co['age_string_age']);
-			$tpl->assign("agestringdate",$co['age_string_date']);
-			$tpl->assign("authorname",$co['author_name']);
-			$tpl->assign("title_short",$co['title_short']);
+			$commitline["commit"] = $commit;
+			$commitline["agestringage"] = $co['age_string_age'];
+			$commitline["agestringdate"] = $co['age_string_date'];
+			$commitline["authorname"] = $co['author_name'];
+			$commitline["title_short"] = $co['title_short'];
 			if (strlen($co['title_short']) < strlen($co['title']))
-				$tpl->assign("title",$co['title']);
-			$tpl->display("shortlog_item.tpl");
+				$commitline["title"] = $co['title'];
+			$commitlines[] = $commitline;
 		}
 	}
-
-	$tpl->clear_all_assign();
-	$tpl->assign("project",$project);
-	$tpl->assign("hash",$hash);
-	if (count($revlist) > 100) {
-		$tpl->assign("nextlink",TRUE);
-		$tpl->assign("nextpage",$page+1);
-	}
-	$tpl->display("shortlog_footer.tpl");
+	$tpl->assign("commitlines",$commitlines);
+	$tpl->display("shortlog.tpl");
 }
 
 ?>

--- a/templates/search.tpl
+++ b/templates/search.tpl
@@ -5,6 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
+{* Nav *}
 <div class="page_nav">
   <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h={$hash}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$hash}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$treehash}&hb={$hash}">tree</a>
   <br />
@@ -31,7 +32,7 @@
   <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}" class="title">{$title}</a>
 </div>
 <table cellspacing="0">
-
+  {* Print each match *}
   {section name=match loop=$commitlines}
     <tr class="{cycle values="light,dark"}">
       <td title="{$commitlines[match].agestringage}"><i>{$commitlines[match].agestringdate}</i></td>

--- a/templates/searchfiles.tpl
+++ b/templates/searchfiles.tpl
@@ -5,6 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
+{* Nav *}
 <div class="page_nav">
   <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h={$hash}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$hash}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$treehash}&hb={$hash}">tree</a>
   <br />
@@ -31,7 +32,7 @@
   <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}" class="title">{$title}</a>
 </div>
 <table cellspacing="0">
-
+  {* Print each match *}
   {section name=match loop=$filesearchlines}
     <tr class="{cycle values="light,dark"}">
       <td>

--- /dev/null
+++ b/templates/shortlog.tpl
@@ -1,1 +1,56 @@
+{*
+ *  shortlog.tpl
+ *  gitphp: A PHP git repository browser
+ *  Component: Shortlog view template
+ *
+ *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
+ *}
+ <div class="page_nav">
+   <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | shortlog | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h={$hash}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$hash}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$hash}&hb={$hash}">tree</a>
+   <br />
+   {if ($hash != $head) || $page}
+     <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">HEAD</a>
+   {else}
+     HEAD
+   {/if}
+     &sdot; 
+   {if $page > 0}
+     <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$page-1}" accesskey="p" title="Alt-p">prev</a>
+   {else}
+     prev
+   {/if}
+     &sdot; 
+   {if $revlistcount > 100}
+     <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$page+1}" accesskey="n" title="Alt-n">next</a>
+   {else}
+     next
+   {/if}
+   <br />
+ </div>
+ <div>
+   <a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a>
+ </div>
+ <table cellspacing="0">
+   {section name=log loop=$commitlines}
+     <tr class="{cycle values="light,dark"}">
+       <td title="{$commitlines[log].agestringage}"><i>{$commitlines[log].agestringdate}</i></td>
+       <td><i>{$commitlines[log].authorname}</i></td>
+       <td>
+         <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$commitlines[log].commit}" class="list" {if $commitlines[log].title}title="{$commitlines[log].title}"{/if}><b>{$commitlines[log].title_short}
+         {if $commitlines[log].commitref}
+           <span class="tag">{$commitlines[log].commitref}</span>
+         {/if}
+         </b>
+       </td>
+       <td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$commitlines[log].commit}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$commitlines[log].commit}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$commitlines[log].commit}&hb={$commitlines[log].commit}">tree</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$commitlines[log].commit}">snapshot</a>
+       </td>
+     </tr>
+   {/section}
 
+   {if $revlistcount > 100}
+     <tr>
+       <td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$page+1}" title="Alt-n">next</a></td>
+     </tr>
+   {/if}
+ </table>
+

--- a/templates/shortlog_footer.tpl
+++ /dev/null
@@ -1,12 +1,1 @@
-{*
- *  shortlog_footer.tpl
- *  gitphp: A PHP git repository browser
- *  Component: Shortlog view footer template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
- {if $nextlink}
- <tr><td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$nextpage}" title="Alt-n">next</a></td></tr>
- {/if}
- </table>
 

--- a/templates/shortlog_item.tpl
+++ /dev/null
@@ -1,21 +1,1 @@
-{*
- *  shortlog_item.tpl
- *  gitphp: A PHP git repository browser
- *  Component: Shortlog view item template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
- <tr class="{$class}">
- <td title="{$agestringage}"><i>{$agestringdate}</i></td>
- <td><i>{$authorname}</i></td>
- <td>
- <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$commit}" class="list" {if $title}title="{$title}"{/if}><b>{$title_short}
- {if $commitref}
- <span class="tag">{$commitref}</span>
- {/if}
- </b>
- </td>
- <td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$commit}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$commit}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$commit}&hb={$commit}">tree</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$commit}">snapshot</a>
- </td>
- </tr>
 

--- a/templates/shortlog_nav.tpl
+++ /dev/null
@@ -1,11 +1,1 @@
-{*
- *  shortlog_nav.tpl
- *  gitphp: A PHP git repository browser
- *  Component: Shortlog view nav template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
- <div class="page_nav">
- <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | shortlog | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h={$hash}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$hash}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$hash}&hb={$hash}">tree</a>
- <br />
 

--- a/templates/shortlog_pagenav.tpl
+++ /dev/null
@@ -1,15 +1,1 @@
-{*
- *  shortlog_pagenav.tpl
- *  gitphp: A PHP git repository browser
- *  Component: Shortlog view page nav template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
- {if $headlink}<a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">{/if}HEAD{if $headlink}</a>{/if} &sdot; {if $prevlink}<a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$prevpage}" accesskey="p" title="Alt-p">{/if}prev{if $prevlink}</a>{/if} &sdot; {if $nextlink}<a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h={$hash}&pg={$nextpage}" accesskey="n" title="Alt-n">{/if}next{if $nextlink}</a>{/if}
- <br />
- </div>
- <div>
- <a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a>
- </div>
- <table cellspacing="0">
 

comments