Somehow I forgot the tag page
Somehow I forgot the tag page

--- a/include/display.git_summary.php
+++ b/include/display.git_summary.php
@@ -89,8 +89,12 @@
 				$tpl->assign("tagtype",$tag['type']);
 				$tpl->assign("refid",$tag['refid']);
 				$tpl->assign("reftype",$tag['reftype']);
-				if (isset($tag['comment']))
-					$tpl->assign("comment",$tag['comment']);
+				if (isset($tag['comment'])) {
+					$com = trim($tag['comment'][0]);
+					if (strlen($com) > GITPHP_TRIM_LENGTH)
+						$com = substr($trimmed,0,GITPHP_TRIM_LENGTH) . "...";
+					$tpl->assign("comment",$com);
+				}
 			} else
 				$tpl->assign("truncate",TRUE);
 			$tpl->display("project_taglist_item.tpl");

--- /dev/null
+++ b/include/display.git_tag.php
@@ -1,1 +1,45 @@
+<?php
+/*
+ *  display.git_tag.php
+ *  gitphp: A PHP git repository browser
+ *  Component: Display - tag
+ *
+ *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
+ */
 
+ require_once('util.date_str.php');
+ require_once('gitutil.git_read_tag.php');
+ require_once('gitutil.git_read_head.php');
+
+function git_tag($projectroot, $project, $hash)
+{
+	global $tpl;
+
+	$head = git_read_head($projectroot . $project);
+	$tpl->clear_all_assign();
+	$tpl->assign("project",$project);
+	$tpl->assign("head",$head);
+	$tpl->display("tag_nav.tpl");
+
+	$tag = git_read_tag($projectroot . $project, $hash);
+
+	$tpl->clear_all_assign();
+	$tpl->assign("project", $project);
+	$tpl->assign("hash", $hash);
+	$tpl->assign("title",$tag['name']);
+	$tpl->assign("type",$tag['type']);
+	$tpl->assign("object",$tag['object']);
+	if (isset($tag['author'])) {
+		$tpl->assign("author",$tag['author']);
+		$ad = date_str($tag['epoch'],$tag['tz']);
+		$tpl->assign("adrfc2822",$ad['rfc2822']);
+		$tpl->assign("adhourlocal",$ad['hour_local']);
+		$tpl->assign("adminutelocal",$ad['minute_local']);
+		$tpl->assign("adtzlocal",$ad['tz_local']);
+	}
+	$tpl->assign("comment",$tag['comment']);
+	$tpl->display("tag_data.tpl");
+}
+
+?>
+

--- a/include/gitutil.git_read_tag.php
+++ b/include/gitutil.git_read_tag.php
@@ -27,7 +27,7 @@
 			$tag['author'] = $regs[1];
 			$tag['epoch'] = $regs[2];
 			$tag['tz'] = $regs[3];
-		} else if (ereg("--BEGIN",$tok)) {
+		} else {
 			while ($tok !== false) {
 				$comment[] = $tok;
 				$tok = strtok("\n");

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -132,6 +132,10 @@
 						git_search($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL),(isset($_GET['s']) ? $_GET['s'] : NULL),(isset($_GET['st']) ? $_GET['st'] : "commit"),(isset($_GET['pg']) ? $_GET['pg'] : 0));
 					}
 					break;
+				case "tag":
+					require_once('include/display.git_tag.php');
+					git_tag($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
+					break;
 				default:
 					echo "Unknown action";
 					break;

--- /dev/null
+++ b/templates/tag_data.tpl
@@ -1,1 +1,26 @@
+{*
+ *  tag_data.tpl
+ *  gitphp: A PHP git repository browser
+ *  Component: Tag view data template
+ *
+ *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
+ *}
+ <div>
+   <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$hash}" class="title">{$title}</a>
+ </div>
+ <div class="title_text">
+ <table cellspacing="0">
+ <tr><td>object</td><td class="monospace"><a href="{$SCRIPT_NAME}?p={$project}&a={$type}&h={$object}" class="list">{$object}</a></td><td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a={$type}&h={$object}">{$type}</a></td></tr>
+ {if $author}
+ <tr><td>author</td><td>{$author}</td></tr>
+ <tr><td></td><td> {$adrfc2822} ({if $adhourlocal < 6}<span class="latenight">{/if}{$adhourlocal}:{$adminutelocal}{if $adhourlocal < 6}</span>{/if} {$adtzlocal})
+ </td></tr>
+ {/if}
+ </table>
+ </div>
+ <div class="page_body">
+ {foreach from=$comment item=line}
+ {$line}<br />
+ {/foreach}
+ </div>
 

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

comments