From 8d6d1654977499824b8da93abc3a9863640eb0c2 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 21 Apr 2007 18:24:37 +0000 Subject: [PATCH] Adding links in browse.php and view.php to view the changes and go to the head revision (if not already at it) to make browsing slightly easier --- browse.php | 17 ++++++++++++++++- templates/default/browse.tpl | 5 ++--- templates/default/view.tpl | 5 ++--- view.php | 17 ++++++++++++++++- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/browse.php b/browse.php index 907b9b1..2831dc9 100644 --- a/browse.php +++ b/browse.php @@ -33,7 +33,22 @@ $navbar = ConstructNavbar(); // ################################################################### -$revision = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']); +$revision = $headRev = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']); +if ($input->in['rev']) +{ + $headRev = new Revision($input->in['repos'], 0, $input->in['path']); + if ($headRev->revision != $revision->revision) + { + $show['head'] = true; + $link['gohead'] = ConstructLink('browse', $input->in['repos'], $input->in['path'], 0); + } +} + +if ($revision->revision - 1 > 0) +{ + $show['diff'] = true; + $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $revision->revision); +} // ################################################################### diff --git a/templates/default/browse.tpl b/templates/default/browse.tpl index 37274a5..0135165 100644 --- a/templates/default/browse.tpl +++ b/templates/default/browse.tpl @@ -24,11 +24,10 @@ $header - {@"Go to HEAD"} - - {@"Diff to HEAD"} - - - {@"Diff to PREV"} + + - {@"View Changes"} ) diff --git a/templates/default/view.tpl b/templates/default/view.tpl index b55337f..de560fa 100644 --- a/templates/default/view.tpl +++ b/templates/default/view.tpl @@ -24,11 +24,10 @@ $navbar {@"View Log"} - {@"Go to HEAD"} - - {@"Diff to HEAD"} - - - {@"Diff to PREV"} + + - {@"View Changes"} ) diff --git a/view.php b/view.php index 4475bc8..e0635c5 100644 --- a/view.php +++ b/view.php @@ -32,7 +32,22 @@ $navbar = ConstructNavbar(); // ################################################################### -$revision = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']); +$revision = $headRev = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']); +if ($input->in['rev']) +{ + $headRev = new Revision($input->in['repos'], 0, $input->in['path']); + if ($headRev->revision != $revision->revision) + { + $show['head'] = true; + $link['gohead'] = ConstructLink('browse', $input->in['repos'], $input->in['path'], 0); + } +} + +if ($revision->revision - 1 > 0) +{ + $show['diff'] = true; + $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $revision->revision); +} // ################################################################### -- 2.43.5