Fixed hook & action calls.
[viewgit.git] / templates / header.php
blob317104646d988a6f87c0cec9b139f6e685889b24
1 <?php
2 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
3 ?>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <head>
7 <title><?php echo $page['title']; ?></title>
8 <link rel="stylesheet" href="default.css" type="text/css" />
9 <link rel="icon" type="image/png" href="favicon.png" />
10 <?php
11 if (isset($page['project'])) {
12 echo "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"". htmlentities($page['project']) ." log\" href=\"". makelink(array('a' => 'rss-log', 'p' => $page['project'])) ."\" />\n";
15 <meta name="generator" content="ViewGit" />
16 <?php VGPlugin::call_hooks('header'); ?>
17 </head>
18 <body>
20 <?php
21 VGPlugin::call_hooks('page_start');
22 if (isset($page['notices'])) {
23 echo '<div class="notices">';
24 foreach ($page['notices'] as $n) {
25 echo "<p class=\"$n[class]\">$n[message]</p>";
27 echo '</div>';
31 <div class="nav">
32 <a href=".">Index</a>
33 <?php
34 if (isset($page['project'])) {
35 echo " &raquo; <a href=\"". makelink(array('a' => 'summary', 'p' => $page['project'])) ."\">$page[project]</a>";
37 // TODO: move this out of here
38 if ($page['action'] === 'summary') {
39 echo " : Summary";
41 elseif ($page['action'] === 'commit') {
42 echo " : Commit ". substr($page['commit_id'], 0, 6);
44 elseif ($page['action'] === 'commitdiff') {
45 echo " : Commitdiff ". substr($page['commit_id'], 0, 6);
47 elseif ($page['action'] === 'shortlog') {
48 echo " : Shortlog";
50 elseif ($page['action'] === 'tree') {
51 echo " : Tree ". substr($page['tree_id'], 0, 6);
53 elseif ($page['action'] === 'viewblob') {
54 echo " : Blob ". substr($page['hash'], 0, 6);
57 if (isset($page['path'])) {
58 if (isset($page['pathinfo'])) {
59 echo ' ';
60 $f = '';
61 foreach ($page['pathinfo'] as $p) {
62 if (strlen($f) > 0) { $f .= '/'; }
63 $f .= "$p[name]";
64 echo "/ <a href=\"". makelink(array('a' => ($p['type'] === 'tree' ? 'tree' : 'viewblob'), 'p' => $page['project'], 'h' => $p['hash'], 'hb' => $page['commit_id'], 'f' => $f)) ."\">$p[name]</a> ";
69 </div>
71 <?php if (isset($page['project'])) { ?>
72 <div class="pagenav">
73 <?php
74 $links = array(
75 'summary' => array(),
76 'shortlog' => array(),
77 'commit' => array('h' => $page['commit_id']),
78 'commitdiff' => array('h' => $page['commit_id']),
79 'tree' => array('h' => $page['tree_id'], 'hb' => $page['commit_id']),
81 $first = true;
82 foreach ($links as $link => $params) {
83 if (!$first) { echo " | "; }
84 if ($page['action'] === $link) { echo '<span class="cur">'; }
85 echo "<a href=\"". makelink(array_merge(array('a' => $link, 'p' => $page['project']), $params)) ."\">". ucfirst($link) . "</a>";
86 if ($page['action'] === $link) { echo '</span>'; }
87 $first = false;
89 VGPlugin::call_hooks('pagenav');
92 <form action="?" type="get" class="search">
93 <input type="hidden" name="a" value="search" />
94 <input type="hidden" name="p" value="<?php echo $page['project']; ?>" />
95 <select name="st">
96 <?php
97 $opts = array('commit', 'change', 'author', 'committer');
98 foreach ($opts as $opt) {
99 echo "\t<option";
100 if (isset($page['search_t']) && $opt == $page['search_t']) {
101 echo ' selected="selected"';
103 echo ">$opt</option>\n";
106 </select>
107 <input type="text" name="s"<?php if (isset($page['search_s'])) { echo ' value="'. htmlentities($page['search_s']) .'"'; } ?> />
108 </form>
109 </div>
110 <?php } ?>