WIP: Tree browsing at HEAD with no commit_id.
[viewgit.git] / templates / tree.php
blob4c32eb609c2b198b4a8d7f8f83336134a05a1e15
1 <table class="tree">
2 <thead>
3 <tr>
4 <th class="perm">Permissions</th>
5 <th class="name">Name</th>
6 <th class="dl">Download</th>
7 </tr>
8 </thead>
9 <tbody>
10 <?php
11 foreach ($page['entries'] as $e) {
12 if (strlen($page['path']) > 0) {
13 $path = $page['path'] .'/'. $e['name'];
15 else {
16 $path = $e['name'];
18 if ($e['type'] === 'blob') {
19 echo "<tr>\n";
20 echo "\t<td>$e[mode]</td>\n";
21 echo "\t<td><a href=\"". makelink(array('a' => 'viewblob', 'p' => $page['project'], 'h' => $e['hash'], 'hb' => $page['commit_id'], 'f' => $path)) ."\">". htmlspecialchars($e['name']) ."</a></td>\n";
22 echo "\t<td><a href=\"". makelink(array('a' => 'blob', 'p' => $page['project'], 'h' => $e['hash'], 'n' => $e['name'])) ."\">blob</a></td>\n";
24 else {
25 echo "<tr class=\"dir\">\n";
26 echo "\t<td>$e[mode]</td>\n";
27 echo "\t<td><a href=\"" .makelink(array('a' => 'tree', 'p' => $page['project'], 'h' => $e['hash'], 'hb' => $page['commit_id'], 'f' => $path)) ."\">". htmlspecialchars($e['name']) ."/</a></td>\n";
28 echo "\t<td><a href=\"". makelink(array('a' => 'archive', 'p' => $page['project'], 'h' => $e['hash'], 't' => 'targz', 'n' => $e['name'])) ."\">tar.gz</a> / <a href=\"". makelink(array('a' => 'archive', 'p' => $page['project'], 'h' => $e['hash'], 't' => 'zip', 'n' => $e['name'])) ."\">zip</a></td>\n";
30 echo "</tr>\n";
33 </tbody>
34 </table>
36 <p>Download as <a href="<?php echo makelink(array('a' => 'archive', 'p' => $page['project'], 'h' => $page['tree_id'], 't' => 'targz')) ?>">tar.gz</a> or <a href="<?php echo makelink(array('a' => 'archive', 'p' => $page['project'], 'h' => $page['tree_id'], 't' => 'zip')) ?>">zip</a>. Browse this tree at the <a href="<?php echo makelink(array('a' => 'tree', 'p' => $page['project'], 'hb' => 'HEAD', 'f' => $page['path'])); ?>">HEAD</a>.</p>