+++ /dev/null
-<?php
-/**
- * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Anil Madhavapeddy <anil@recoil.org>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Chora
- */
-
-require_once dirname(__FILE__) . '/lib/base.php';
-
-if (!$atdir && !$VC->isFile($fullname)) {
- Chora::fatal(sprintf(_("$fullname: no such file or directory"), $where), '404 Not Found');
-}
-
-/* Scripts needed for both dirs and files. */
-Horde::addScriptFile('prototype.js', 'horde', true);
-Horde::addScriptFile('tables.js', 'horde', true);
-
-if ($atdir) {
- $rev = $VC->hasFeature('snapshots')
- ? Util::getFormData('rev')
- : null;
-
- try {
- $atticFlags = (bool)$acts['sa'];
- $dir = $VC->getDirObject($where, array('quicklog' => true, 'rev' => $rev, 'showattic' => $atticFlags));
- $dir->applySort($acts['sbt'], $acts['ord']);
- $dirList = $dir->queryDirList();
- $fileList = $dir->queryFileList($atticFlags);
- } catch (Horde_Vcs_Exception $e) {
- Chora::fatal($e);
- }
-
- /* Decide what title to display. */
- $title = ($where == '')
- ? $conf['options']['introTitle']
- : sprintf(_("Source Directory of /%s"), $where);
-
- $extraLink = $VC->hasFeature('deleted')
- ? Horde::widget(Chora::url('browse', $where . '/', array('sa' => ($acts['sa'] ? 0 : 1))), $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"), 'widget', '', '', $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files"))
- : '';
-
- $umap = array(
- 'age' => Horde_Vcs::SORT_AGE,
- 'rev' => Horde_Vcs::SORT_REV,
- 'name' => Horde_Vcs::SORT_NAME,
- 'author' => Horde_Vcs::SORT_AUTHOR
- );
-
- foreach ($umap as $key => $val) {
- $arg = array('sbt' => $val);
- if ($acts['sbt'] == $val) {
- $arg['ord'] = !$acts['ord'];
- }
- $url[$key] = Chora::url('browse', $where . '/', $arg);
- }
-
- /* Print out the directory header. */
- $printAllCols = count($fileList);
-
- require CHORA_TEMPLATES . '/common-header.inc';
- require CHORA_TEMPLATES . '/menu.inc';
- require CHORA_TEMPLATES . '/headerbar.inc';
- require CHORA_TEMPLATES . '/directory/header.inc';
-
- /* Unless we're at the top, display the 'back' bar. */
- if ($where != '') {
- $url = Chora::url('browse', preg_replace('|[^/]+$|', '', $where));
- require CHORA_TEMPLATES . '/directory/back.inc';
- }
-
- /* Display all the directories first. */
- if ($dirList) {
- echo '<tbody>';
- foreach ($dirList as $currentDir) {
- if ($conf['hide_restricted'] && Chora::isRestricted($currentDir)) {
- continue;
- }
- $url = Chora::url('browse', $where . '/' . $currentDir . '/');
- $currDir = Text::htmlAllSpaces($currentDir);
- require CHORA_TEMPLATES . '/directory/dir.inc';
- }
- echo '</tbody>';
- }
-
- /* Display all of the files in this directory */
- if ($fileList) {
- echo '<tbody>';
- foreach ($fileList as $currFile) {
- if ($conf['hide_restricted'] &&
- Chora::isRestricted($currFile->queryName())) {
- continue;
- }
- $lg = $currFile->queryLastLog();
- $realname = $currFile->queryName();
- $mimeType = Horde_Mime_Magic::filenameToMIME($realname);
-
- $icon = Horde_Mime_Viewer::getIcon($mimeType);
-
- $author = Chora::showAuthorName($lg->queryAuthor());
- $head = $currFile->queryHead();
- $date = $lg->queryDate();
- $log = $lg->queryLog();
- $attic = $currFile->isDeleted();
- $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname;
- $name = Text::htmlAllSpaces($realname);
- $url = Chora::url('browse', $fileName);
- $readableDate = Chora::readableTime($date);
- if ($log) {
- $shortLog = str_replace("\n", ' ', trim(substr($log, 0, $conf['options']['shortLogLength'] - 1)));
- if (strlen($log) > 80) {
- $shortLog .= '...';
- }
- }
- require CHORA_TEMPLATES . '/directory/file.inc';
- }
- echo '</tbody>';
- }
-
- echo '</table>';
- require $registry->get('templates', 'horde') . '/common-footer.inc';
- exit;
-}
-
-/* Showing a file. */
-$onb = Util::getFormData('onb');
-try {
- $fl = $VC->getFileObject($where, array('branch' => $onb));
-} catch (Horde_Vcs_Exception $e) {
- Chora::fatal($e);
-}
-
-$title = sprintf(_("Revisions for %s"), $where);
-
-$extraLink = Chora::getFileViews($where, 'browse');
-$logs = $fl->queryLogs();
-$first = end($logs);
-$diffValueLeft = $first->queryRevision();
-$diffValueRight = $fl->queryRevision();
-
-$sel = '';
-foreach ($fl->querySymbolicRevisions() as $sm => $rv) {
- $sel .= '<option value="' . $rv . '">' . $sm . '</option>';
-}
-
-$selAllBranches = '';
-if ($VC->hasFeature('branches')) {
- foreach (array_keys($fl->queryBranches()) as $sym) {
- $selAllBranches .= '<option value="' . $sym . '"' . (($sym === $onb) ? ' selected="selected"' : '' ) . '>' . $sym . '</option>';
- }
-}
-
-Horde::addScriptFile('QuickFinder.js', 'horde', true);
-Horde::addScriptFile('revlog.js', 'chora', true);
-require CHORA_TEMPLATES . '/common-header.inc';
-require CHORA_TEMPLATES . '/menu.inc';
-require CHORA_TEMPLATES . '/headerbar.inc';
-require CHORA_TEMPLATES . '/log/header.inc';
-
-$i = 0;
-reset($logs);
-while (list(,$lg) = each($logs)) {
- $rev = $lg->queryRevision();
- $branch_info = $lg->queryBranch();
-
- $textUrl = Chora::url('co', $where, array('r' => $rev));
- $commitDate = Chora::formatDate($lg->queryDate());
- $readableDate = Chora::readableTime($lg->queryDate(), true);
-
- $author = Chora::showAuthorName($lg->queryAuthor(), true);
- $tags = Chora::getTags($lg, $where);
-
- if ($prevRevision = $fl->queryPreviousRevision($lg->queryRevision())) {
- $diffUrl = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev));
- } else {
- $diffUrl = '';
- }
-
- $logMessage = Chora::formatLogMessage($lg->queryLog());
-
- require CHORA_TEMPLATES . '/log/rev.inc';
-
- if (($i++ > 100) && !Util::getFormData('all')) {
- break;
- }
-}
-require CHORA_TEMPLATES . '/log/footer.inc';
-require $registry->get('templates', 'horde') . '/common-footer.inc';
--- /dev/null
+<?php
+/**
+ * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Anil Madhavapeddy <anil@recoil.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @package Chora
+ */
+
+require_once dirname(__FILE__) . '/lib/base.php';
+
+if (!$atdir) {
+ require CHORA_BASE . '/browsefile.php';
+ exit;
+}
+
+$rev = $VC->hasFeature('snapshots')
+ ? Util::getFormData('rev')
+ : null;
+
+try {
+ $atticFlags = (bool)$acts['sa'];
+ $dir = $VC->getDirObject($where, array('quicklog' => true, 'rev' => $rev, 'showattic' => $atticFlags));
+ $dir->applySort($acts['sbt'], $acts['ord']);
+ $dirList = $dir->queryDirList();
+ $fileList = $dir->queryFileList($atticFlags);
+} catch (Horde_Vcs_Exception $e) {
+ Chora::fatal($e);
+}
+
+/* Decide what title to display. */
+$title = ($where == '')
+ ? $conf['options']['introTitle']
+ : sprintf(_("Source Directory of /%s"), $where);
+
+$extraLink = $VC->hasFeature('deleted')
+ ? Horde::widget(Chora::url('browsedir', $where . '/', array('sa' => ($acts['sa'] ? 0 : 1))), $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"), 'widget', '', '', $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files"))
+ : '';
+
+$umap = array(
+ 'age' => Horde_Vcs::SORT_AGE,
+ 'rev' => Horde_Vcs::SORT_REV,
+ 'name' => Horde_Vcs::SORT_NAME,
+ 'author' => Horde_Vcs::SORT_AUTHOR
+);
+
+foreach ($umap as $key => $val) {
+ $arg = array('sbt' => $val);
+ if ($acts['sbt'] == $val) {
+ $arg['ord'] = !$acts['ord'];
+ }
+ $url[$key] = Chora::url('browsedir', $where . '/', $arg);
+}
+
+/* Print out the directory header. */
+$printAllCols = count($fileList);
+
+Horde::addScriptFile('prototype.js', 'horde', true);
+Horde::addScriptFile('tables.js', 'horde', true);
+require CHORA_TEMPLATES . '/common-header.inc';
+require CHORA_TEMPLATES . '/menu.inc';
+require CHORA_TEMPLATES . '/headerbar.inc';
+require CHORA_TEMPLATES . '/directory/header.inc';
+
+/* Unless we're at the top, display the 'back' bar. */
+if ($where != '') {
+ $url = Chora::url('browsedir', preg_replace('|[^/]+$|', '', $where));
+ require CHORA_TEMPLATES . '/directory/back.inc';
+}
+
+/* Display all the directories first. */
+if ($dirList) {
+ echo '<tbody>';
+ foreach ($dirList as $currentDir) {
+ if ($conf['hide_restricted'] && Chora::isRestricted($currentDir)) {
+ continue;
+ }
+ $url = Chora::url('browsedir', $where . '/' . $currentDir . '/');
+ $currDir = Text::htmlAllSpaces($currentDir);
+ require CHORA_TEMPLATES . '/directory/dir.inc';
+ }
+ echo '</tbody>';
+}
+
+/* Display all of the files in this directory */
+if ($fileList) {
+ echo '<tbody>';
+ foreach ($fileList as $currFile) {
+ if ($conf['hide_restricted'] &&
+ Chora::isRestricted($currFile->queryName())) {
+ continue;
+ }
+ $lg = $currFile->queryLastLog();
+ $realname = $currFile->queryName();
+ $mimeType = Horde_Mime_Magic::filenameToMIME($realname);
+
+ $icon = Horde_Mime_Viewer::getIcon($mimeType);
+
+ $author = Chora::showAuthorName($lg->queryAuthor());
+ $head = $currFile->queryHead();
+ $date = $lg->queryDate();
+ $log = $lg->queryLog();
+ $attic = $currFile->isDeleted();
+ $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname;
+ $name = Text::htmlAllSpaces($realname);
+ $url = Chora::url('browsefile', $fileName);
+ $readableDate = Chora::readableTime($date);
+ if ($log) {
+ $shortLog = str_replace("\n", ' ', trim(substr($log, 0, $conf['options']['shortLogLength'] - 1)));
+ if (strlen($log) > 80) {
+ $shortLog .= '...';
+ }
+ }
+ require CHORA_TEMPLATES . '/directory/file.inc';
+ }
+ echo '</tbody>';
+}
+
+echo '</table>';
+require $registry->get('templates', 'horde') . '/common-footer.inc';
--- /dev/null
+<?php
+/**
+ * Browse view (for files).
+ *
+ * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Anil Madhavapeddy <anil@recoil.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @package Chora
+ */
+
+require_once dirname(__FILE__) . '/lib/base.php';
+
+if ($atdir) {
+ require CHORA_BASE . '/browsedir.php';
+ exit;
+}
+
+if (!$VC->isFile($fullname)) {
+ Chora::fatal(sprintf(_("$fullname: no such file or directory"), $where), '404 Not Found');
+}
+
+$onb = Util::getFormData('onb');
+try {
+ $fl = $VC->getFileObject($where, array('branch' => $onb));
+} catch (Horde_Vcs_Exception $e) {
+ Chora::fatal($e);
+}
+
+$title = sprintf(_("Revisions for %s"), $where);
+
+$extraLink = Chora::getFileViews($where, 'browsefile');
+$logs = $fl->queryLogs();
+$first = end($logs);
+$diffValueLeft = $first->queryRevision();
+$diffValueRight = $fl->queryRevision();
+
+$sel = '';
+foreach ($fl->querySymbolicRevisions() as $sm => $rv) {
+ $sel .= '<option value="' . $rv . '">' . $sm . '</option>';
+}
+
+$selAllBranches = '';
+if ($VC->hasFeature('branches')) {
+ foreach (array_keys($fl->queryBranches()) as $sym) {
+ $selAllBranches .= '<option value="' . $sym . '"' . (($sym === $onb) ? ' selected="selected"' : '' ) . '>' . $sym . '</option>';
+ }
+}
+
+Horde::addScriptFile('QuickFinder.js', 'horde', true);
+Horde::addScriptFile('revlog.js', 'chora', true);
+require CHORA_TEMPLATES . '/common-header.inc';
+require CHORA_TEMPLATES . '/menu.inc';
+require CHORA_TEMPLATES . '/headerbar.inc';
+require CHORA_TEMPLATES . '/log/header.inc';
+
+$i = 0;
+reset($logs);
+while (list(,$lg) = each($logs)) {
+ $rev = $lg->queryRevision();
+ $branch_info = $lg->queryBranch();
+
+ $textUrl = Chora::url('co', $where, array('r' => $rev));
+ $commitDate = Chora::formatDate($lg->queryDate());
+ $readableDate = Chora::readableTime($lg->queryDate(), true);
+
+ $author = Chora::showAuthorName($lg->queryAuthor(), true);
+ $tags = Chora::getTags($lg, $where);
+
+ if ($prevRevision = $fl->queryPreviousRevision($lg->queryRevision())) {
+ $diffUrl = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev));
+ } else {
+ $diffUrl = '';
+ }
+
+ $logMessage = Chora::formatLogMessage($lg->queryLog());
+
+ require CHORA_TEMPLATES . '/log/rev.inc';
+
+ if (($i++ > 100) && !Util::getFormData('all')) {
+ break;
+ }
+}
+require CHORA_TEMPLATES . '/log/footer.inc';
+require $registry->get('templates', 'horde') . '/common-footer.inc';
/* If we know we're at a directory, just go to browse.php. */
if ($atdir) {
- require CHORA_BASE . '/browse.php';
+ require CHORA_BASE . '/browsedir.php';
exit;
}
);
if ($VC->hasFeature('snapshots')) {
$snapdir = dirname($file->queryPath());
- $views[] = Horde::widget(Chora::url('browse', $snapdir == '.' ? '' : $snapdir, array('rev' => $r)), _("Snapshot"), 'widget', '', '', _("_Snapshot"));
+ $views[] = Horde::widget(Chora::url('browsedir', $snapdir == '.' ? '' : $snapdir, array('rev' => $r)), _("Snapshot"), 'widget', '', '', _("_Snapshot"));
}
$extraLink = _("View:") . ' ' . implode(' | ', $views);
// Exit if cvsgraph isn't active or it's not supported.
if (empty($conf['paths']['cvsgraph']) || !$VC->hasFeature('branches')) {
- header('Location: ' . Chora::url('browse', $where));
+ header('Location: ' . Chora::url('browsefile', $where));
exit;
}
'M' => 'graphMap',
'r' => $root,
'0' => '&',
- '1' => Chora::url('browse', $where, array('dummy' => 'true')),
+ '1' => Chora::url('browsefile', $where, array('dummy' => 'true')),
'2' => Chora::url('diff', $where, array('dummy' =>'true')),
'3' => Chora::url('co', $where, array('dummy' => 'true')),
);
/* Exit if it's not supported. */
if (!$VC->hasFeature('branches')) {
- header('Location: ' . Chora::url('browse', $where));
+ header('Location: ' . Chora::url('browsefile', $where));
exit;
}
array('sourceroots.php' => 'This file defines all of the source repositories that you wish Chora to display.'));
}
-require CHORA_BASE . '/browse.php';
+require CHORA_BASE . '/browsedir.php';
array(
'icon' => 'folder.png',
'icondir' => $GLOBALS['registry']->getImageDir('horde') . '/tree',
- 'url' => Chora::url('browse', '', array('rt' => $key))
+ 'url' => Chora::url('browsedir', '', array('rt' => $key))
)
);
}
foreach ($dirs as $i => $dir) {
if (!empty($dir)) {
- $bar .= '/ <a href="' . self::url('browse', $dir . ($i == $dir_count ? '' : '/')) . '">'. Text::htmlallspaces($dir) . '</a> ';
+ $bar .= '/ <a href="' . self::url('browsedir', $dir . ($i == $dir_count ? '' : '/')) . '">'. Text::htmlallspaces($dir) . '</a> ';
}
}
$script .= '.php';
if ($GLOBALS['conf']['options']['urls'] == 'rewrite') {
- if ($script == 'browse.php') {
+ if (in_array($script, array('browse.php', 'browsedir.php'))) {
$script = $uri;
if (substr($script, 0, 1) == '/') {
$script = substr($script, 1);
$arr = array();
foreach ($sourceroots as $key => $val) {
if ($GLOBALS['sourceroot'] != $key) {
- $arr[] = '<option value="' . self::url('browse', '', array('rt' => $key)) . '">' . $val['name'] . '</option>';
+ $arr[] = '<option value="' . self::url('browsedir', '', array('rt' => $key)) . '">' . $val['name'] . '</option>';
}
}
{
require_once 'Horde/Menu.php';
$menu = new Menu();
- $menu->add(self::url('browse'), _("_Browse"), 'chora.png');
+ $menu->add(self::url('browsedir'), _("_Browse"), 'chora.png');
return $menu->render();
}
* Generate the link used for various file-based views.
*
* @param string $where The current file path.
- * @param string $current The current view ('browse', 'patchsets',
+ * @param string $current The current view ('browsefile', 'patchsets',
* 'history', 'cvsgraph', or 'stats').
*
* @return array An array of file view links.
*/
static public function getFileViews($where, $current)
{
- $views = ($current == 'browse')
+ $views = ($current == 'browsefile')
? array('<em class="widget">' . _("Logs") . '</em>')
- : array(Horde::widget(self::url('browse', $where), _("Logs"), 'widget', '', '', _("_Logs")));
+ : array(Horde::widget(self::url('browsefile', $where), _("Logs"), 'widget', '', '', _("_Logs")));
if ($GLOBALS['VC']->hasFeature('patchsets')) {
$views[] = ($current == 'patchsets')
$tags = array();
foreach ($lg->querySymbolicBranches() as $symb => $bra) {
- $tags[] = '<a href="' . self::url('browse', $where, array('onb' => $bra)) . '">'. htmlspecialchars($symb) . '</a>';
+ $tags[] = '<a href="' . self::url('browsefile', $where, array('onb' => $bra)) . '">'. htmlspecialchars($symb) . '</a>';
}
foreach ($lg->queryTags() as $tag) {
// Exit if patchset feature is not available.
if (!$GLOBALS['VC']->hasFeature('patchsets')) {
- header('Location: ' . Chora::url('browse', $where));
+ header('Location: ' . Chora::url('browsefile', $where));
exit;
}
<?php if (!empty($branch_info)): ?>
<li><?php echo _("Branch:") ?>
<?php foreach ($branch_info as $val): ?>
- <strong><a href="<?php echo Chora::url('browse', $where, array('onb' => $val)) ?>"><?php echo $val ?></a></strong>
+ <strong><a href="<?php echo Chora::url('browsefile', $where, array('onb' => $val)) ?>"><?php echo $val ?></a></strong>
<?php endforeach; ?>
</li>
<?php endif; ?>
<?php if (!empty($val['branchinfo'])): ?>
<li><?php echo _("Branch:") ?>
<?php foreach ($val['branchinfo'] as $branchname): ?>
- <strong><a href="<?php echo Chora::url('browse', $where, array('onb' => $branchname)) ?>"><?php echo $branchname ?></a></strong>
+ <strong><a href="<?php echo Chora::url('browsefile', $where, array('onb' => $branchname)) ?>"><?php echo $branchname ?></a></strong>
<?php endforeach; ?>
</li>
<?php endif; ?>
<tr>
<td>
<?php echo _("Location:") ?>
- <strong>[ <a href="<?php echo Chora::url('browse') ?>"><?php echo $conf['options']['sourceRootName'] ?></a> ]
+ <strong>[ <a href="<?php echo Chora::url('browsedir') ?>"><?php echo $conf['options']['sourceRootName'] ?></a> ]
<?php echo Chora::whereMenu($where) ?></strong>
<?php if (!empty($onb)): ?>
<em>(<?php echo _("Tracking Branch") ?> <strong><?php echo $onb ?></strong>)</em>
<td style="background:<?php echo $bg ?>; text-align:center">
<?php echo _("Branching to") ?>:<br />
-<a href="<?php echo Chora::url('browse', $where, array('onb' => $rev)); ?>">
+<a href="<?php echo Chora::url('browsefile', $where, array('onb' => $rev)); ?>">
<?php echo $symname ?></a>
<br />
<em>(<?php printf(_("revision %s"), $rev) ?>)</em>
<td id="rev<?php echo $rev ?>" style="background:<?php echo $bg ?>">
- <a href="<?php echo Chora::url('browse', $where, array('r'=>$rev), "rev$rev") ?>">
+ <a href="<?php echo Chora::url('browsefile', $where, array('r' => $rev), 'rev' . $rev) ?>">
<?php echo $rev ?></a> <?php printf(_("by %s"), $author) ?>
<br />
<em><?php echo $date ?></em>
<?php if (!empty($selAllBranches)): ?>
<td>
- <form method="get" action="browse.php">
+ <form method="get" action="browsefile.php">
<?php echo Chora::formInputs() ?>
<input type="hidden" name="f" value="<?php echo htmlspecialchars(Util::getFormData('f')) ?>" />
<?php echo _("Show Branch:") ?>
</td>
<td><a href="<?php echo $textUrl ?>" title="<?php echo htmlspecialchars($rev) ?>"><?php echo htmlspecialchars($VC->abbrev($rev)) ?></a>
<?php foreach (array_diff($branch_info, array($onb)) as $val): ?>
- <span class="branch"><?php echo Horde::link(Chora::url('browse', $where, array('onb' => $val))) . htmlspecialchars($val) ?></a></span>
+ <span class="branch"><?php echo Horde::link(Chora::url('browsefile', $where, array('onb' => $val))) . htmlspecialchars($val) ?></a></span>
<?php endforeach; ?>
<?php if (!empty($lg->lines)): ?>
<small>(<?php printf('%s lines', $lg->lines) ?>)</small>