Initial support for viewing directories as exist in a branch
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 5 Feb 2009 06:42:13 +0000 (23:42 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 5 Feb 2009 06:49:15 +0000 (23:49 -0700)
chora/browsedir.php
chora/templates/directory/file.inc
chora/templates/directory/header.inc

index 8fe1f48..e1fb277 100644 (file)
@@ -55,8 +55,13 @@ foreach ($umap as $key => $val) {
     $url[$key] = Chora::url('browsedir', $where . '/', $arg);
 }
 
+if ($VC->hasFeature('branches')) {
+    $branches = $dir->getBranches();
+}
+
 /* Print out the directory header. */
 $printAllCols = count($fileList);
+$sortdirclass = $acts['sbt'] ? 'sortdown' : 'sortup';
 
 Horde::addScriptFile('prototype.js', 'horde', true);
 Horde::addScriptFile('tables.js', 'horde', true);
@@ -93,6 +98,7 @@ if ($fileList) {
             Chora::isRestricted($currFile->queryName())) {
             continue;
         }
+
         $lg = $currFile->queryLastLog();
         $realname = $currFile->queryName();
         $mimeType = Horde_Mime_Magic::filenameToMIME($realname);
@@ -100,7 +106,7 @@ if ($fileList) {
         $icon = Horde_Mime_Viewer::getIcon($mimeType);
 
         $author = Chora::showAuthorName($lg->queryAuthor());
-        $head = $currFile->queryHead();
+        $filerev = $lg->queryRevision();
         $date = $lg->queryDate();
         $log = $lg->queryLog();
         $attic = $currFile->isDeleted();
index 0169bf7..a4bf75a 100644 (file)
@@ -9,18 +9,18 @@
 <?php if ($conf['filename_linkto'] == 'revlog'): ?>
    <a href="<?php echo $url ?>">
 <?php else: ?>
-   <a href="<?php echo Chora::url('co', $fileName, array('r' => $head)) ?>">
+   <a href="<?php echo Chora::url('co', $fileName, array('r' => $filerev)) ?>">
 <?php endif; ?>
 <?php echo $name ?></a>
   </td>
   <td>
    <strong>
 <?php if ($conf['filename_linkto'] == 'revlog'): ?>
-    <a href="<?php echo Chora::url('co', $fileName, array('r' => $head)) ?>" title="<?php echo htmlspecialchars($head) ?>">
+    <a href="<?php echo Chora::url('co', $fileName, array('r' => $filerev)) ?>" title="<?php echo htmlspecialchars($filerev) ?>">
 <?php else: ?>
-    <a href="<?php echo $url ?>" title="<?php echo htmlspecialchars($head) ?>">
+    <a href="<?php echo $url ?>" title="<?php echo htmlspecialchars($filerev) ?>">
 <?php endif; ?>
-<?php echo htmlspecialchars($VC->abbrev($head)) ?></a></strong>
+<?php echo htmlspecialchars($VC->abbrev($filerev)) ?></a></strong>
   </td>
 <?php else: ?>
   <td>
@@ -31,7 +31,7 @@
 <?php endif; ?>
    <?php echo $name ?>
   </td>
-  <td><strong><?php echo htmlspecialchars($VC->abbrev($head)) ?></strong></td>
+  <td><strong><?php echo htmlspecialchars($VC->abbrev($filerev)) ?></strong></td>
 <?php endif; ?>
   <td><?php echo $author ?></td>
   <td sortval="<?php echo (int)$date ?>">
index 07fe867..f2b6027 100644 (file)
@@ -1,4 +1,23 @@
-<?php $sortdirclass = $acts['sbt'] ? 'sortdown' : 'sortup' ?>
+<?php if (count($branches) > 1): ?>
+<table class="options" cellspacing="0">
+ <tr>
+  <td>
+   <form method="get" action="browsedir.php">
+   <?php echo _("View Branch:") ?>
+    <?php echo Chora::formInputs() ?>
+    <input type="hidden" name="f" value="<?php echo htmlspecialchars(Util::getFormData('f')) ?>" />
+    <select name="rev" onchange="this.form.submit()">
+<?php foreach (array_map('htmlspecialchars', $branches) as $val): ?>
+     <option value="<?php echo $val ?>"<?php echo ($val == $rev) ? ' selected="selected"' : '' ?>><?php echo $val ?></option>
+<?php endforeach; ?>
+    </select>
+    <noscript><input class="button" type="submit" value="<?php echo _("View") ?>" /></noscript>
+   </form>
+  </td>
+ </tr>
+</table>
+<?php endif; ?>
+
 <table id="browse" cellspacing="0" class="browse sortable striped nowrap">
 <thead>
  <tr>