Extracted HTML from files and into templates
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 1 Sep 2005 00:46:38 +0000 (00:46 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 1 Sep 2005 00:46:38 +0000 (00:46 +0000)
21 files changed:
blame.php
browse.php
diff.php
includes/init.php
index.php
log.php
templates/default/blame.tpl [new file with mode: 0644]
templates/default/blame_line.tpl [new file with mode: 0644]
templates/default/browse.tpl [new file with mode: 0644]
templates/default/browse_node.tpl [new file with mode: 0644]
templates/default/diff.tpl [new file with mode: 0644]
templates/default/diff_file.tpl [new file with mode: 0644]
templates/default/diff_hunk.tpl [new file with mode: 0644]
templates/default/diff_line.tpl [new file with mode: 0644]
templates/default/index.tpl [new file with mode: 0644]
templates/default/index_node.tpl [new file with mode: 0644]
templates/default/log.tpl [new file with mode: 0644]
templates/default/log_node.tpl [new file with mode: 0644]
templates/default/log_prop.tpl [new file with mode: 0644]
templates/default/view.tpl [new file with mode: 0644]
view.php

index 53d5645d02a73594c541d3a7b1177726971e9560..f05e6f766813d3bf7820b7ce0c335197c5d9fc54 100644 (file)
--- a/blame.php
+++ b/blame.php
 
 require_once('./global.php');
 
-echo $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
 
-echo '<br />';
+// ###################################################################
 
-echo '<a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path) . '">View Log</a>';
+$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
 
-if ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD')
+$show['head'] = ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD');
+if ($show['head'])
 {
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path) . '">Go to HEAD</a>';
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path) . '">Diff to HEAD</a>';
+       $link['gohead'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path);
+       $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path);
 }
 
-$prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num());
-if ($prev != -1)
+$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false);
+if ($show['prev'])
 {
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path) . '">Diff to PREV</a>';
+       $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path);
 }
 
+// ###################################################################
+
 $blame = new SVNBlame($repos, $relpath, $viewsvn->paths->fetch_rev_num());
 
-echo '<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF; font: 11px monospace" width="100%">';
+$lines = '';
 
 foreach ($blame->fetch() AS $entry)
 {
-       echo '
-       <tr style="background-color: white">
-               <td>' . $entry['rev'] . '</td>
-               <td>' . $entry['author'] . '</td>
-               <td>' . str_replace(array(' ', "\t"), array('&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'), htmlspecialchars($entry['line'])) . '</td>
-       </tr>';
+       $entry['line_clean'] = $viewsvn->svn->format($entry['line']);
+       eval('$lines .= "' . $template->fetch('blame_line') . '";');
 }
 
-echo '
-</table>';
+// ###################################################################
+
+eval('$template->flush("' . $template->fetch('blame') . '");');
 
 /*=====================================================================*\
 || ###################################################################
index c7c00ee7307ae616c0bd9d1895d5c233a9307934..ebb5ed656a70cc0260e6fbf837303172a4283b9b 100644 (file)
 
 require_once('./global.php');
 
-echo $viewsvn->paths->construct_breadcrumb($path);
+$navbar = $viewsvn->paths->construct_breadcrumb($path);
 
-echo '<br />';
+// ###################################################################
 
-$prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num());
+$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
 
-if ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD')
+$show['head'] = ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD');
+if ($show['head'])
 {
-       echo '<a href="/viewsvn/' . $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path) . '">Go to HEAD</a>' . 
-       ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path) . '">Diff to HEAD</a>';
+       $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path);
+       $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path);
 }
 
-echo ($prev != -1 ? ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path) . '">Diff to PREV</a>' : '') . 
-' - <a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path) . '">View Log</a>';
+$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false);
+if ($show['prev'])
+{
+       $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path);
+}
 
+// ###################################################################
+
+// #*# finish extracting this tpl
 echo '<pre>' . print_r($viewsvn->svn->common->fetch_log($path, $viewsvn->paths->fetch_rev_num()), true) . '</pre>';
 
 $listing = $viewsvn->svn->ls($repos, $relpath, @$viewsvn->in['rev']);
 
-echo '<ul>';
-echo "\n";
+$nodes = '';
 
 foreach ($listing AS $item)
 {
-       echo '<li>';
        if ($item{ strlen($item) - 1 } == '/')
        {
-               echo '<a href="/viewsvn/' . $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">' . $item . '</a>';
+               $show['directory'] = true;
+               $browse = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(), $path . $item);
        }
        else
        {
-               echo '<a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">'. $item . '</a>';
-               echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">Blame</a>';
+               $show['directory'] = false;
+               $view = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item);
+               $blame = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(), $path . $item);
        }
        
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">View Log</a>';
-       //echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num()), $path . $item) . '">Diff to PREV</a>';
+       $log = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item);
        
-       echo '</li>';
-       echo "\n";
+       eval('$nodes .= "' . $template->fetch('browse_node') . '";');
 }
 
-echo '</ul>';
+// ###################################################################
+
+eval('$template->flush("' . $template->fetch('browse') . '");');
 
 /*=====================================================================*\
 || ###################################################################
index ad462556d3b2b8749ec97ca5127a2e5938d265d2..1e1424762ffaf565e1ce98a5d3d17a8ddabe6917 100644 (file)
--- a/diff.php
+++ b/diff.php
 
 require_once('./global.php');
 
-echo $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
+
+// ###################################################################
+
+$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
+
+// ###################################################################
 
 $revs = $viewsvn->paths->fetch_rev_num(true);
 $high = $revs['high'];
@@ -32,79 +38,55 @@ $diff = new SVNDiff($repos, $relpath, $low, $high);
 
 $isdir = (bool)$viewsvn->svn->common->isdir($path);
 
-echo <<<HTML
-<style type="text/css">
-<!--
-       
-       .diff_add
-       {
-               background-color: #99EE99;
-       }
-       
-       .diff_del
-       {
-               background-color: #EE9999;
-       }
-       
-       table
-       {
-               font: normal 11px monospace;
-       }
-       
-//-->
-</style>
-HTML;
+$changes = '';
 
 foreach ($diff->fetch() AS $filename => $file)
 {
-       echo '<h2>' . $filename . '</h2>';
+       $hunktpl = '';
        
        foreach ($file AS $hunk)
        {
-               echo '<table cellspacing="1" cellpadding="1" width="100%">';
-               
+               $lines = '';
                foreach ($hunk AS $key => $line)
                {
+                       $show['hunk'] = false;
                        if ($key == 'hunk' AND isset($line['old']))
                        {
                                $filepath = ($isdir ? $path . $filename : $path);
-                               echo '
-                       <tr style="background-color: #F7F7F7">
-                               <td><a href="/viewsvn/' . $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $low), $filepath) . '">r' . $low . '</a></td>
-                               <td><a href="/viewsvn/' . $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $high), $filepath) . '">r' . $high . '</a></td>
-                               <td>&nbsp;</td>
-                       </tr>';
-                               continue;
-                       }
-                       
-                       if ($line['act'] == '+')
-                       {
-                               $color = '#DDFFDD';
-                       }
-                       else if ($line['act'] == '-')
-                       {
-                               $color = '#FFDDDD';
+                               $rlow = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $low), $filepath);
+                               $rhigh = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $high), $filepath);
+                               $show['hunk'] = true;
                        }
                        else
                        {
-                               $color = 'white';
+                               if ($line['act'] == '+')
+                               {
+                                       $color = '#DDFFDD';
+                               }
+                               else if ($line['act'] == '-')
+                               {
+                                       $color = '#FFDDDD';
+                               }
+                               else
+                               {
+                                       $color = 'white';
+                               }
+                               
+                               $line['line_clean'] = $viewsvn->svn->format($line['line']);
                        }
                        
-                       echo '
-                       <tr style="background-color: #EEEEDD; border-width: 0px 1px 1px 0px">
-                               <td>' . $line['oldlineno'] . '</td>
-                               <td>' . $line['newlineno'] . '</td>
-                               <td style="background-color: ' . $color . '">' . $viewsvn->svn->format($line['line']) . '</td>
-                       </tr>';
+                       eval('$lines .= "' . $template->fetch('diff_line') . '";');
                }
-               
-               echo '
-               </table>';
+               eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
        }
        
-       echo '<hr />';
+       eval('$changes .= "' . $template->fetch('diff_file') . '";');
 }
 
+// ###################################################################
+
+eval('$template->flush("' . $template->fetch('diff') . '");');
+
 /*=====================================================================*\
 || ###################################################################
 || # $HeadURL$
index f1959a1dc483aaf4348b512c7fcad52dec45f359..424e54e31d11fc8e12c455722442c886eadf25da 100644 (file)
@@ -41,6 +41,11 @@ $viewsvn->sourcepath = $viewsvn->fetch_sourcepath($issopath);
 $viewsvn->load('functions');
 $viewsvn->exec_sanitize_data();
 
+// ###################################################################
+// handle template system
+$viewsvn->load('template_fs');
+$template->templatedir = $viewsvn->fetch_sourcepath('./templates/' . $templatedir);
+
 // ###################################################################
 // imaginary reporter
 require_once('./includes/imaginary.php');
index 31e235a6e09995c2cddacdf4f81b2548366cd549..50eb9eef59602e8f93c761c23f1f10d92126f937 100644 (file)
--- a/index.php
+++ b/index.php
@@ -14,16 +14,19 @@ define('PATH_OVERRIDE', 1);
 
 require_once('./global.php');
 
-echo '<ul>';
-echo "\n";
+// ###################################################################
+
+$nodes = '';
 
 foreach ($viewsvn->repos->fetch_list() AS $repos)
 {
-       echo '<li><a href="' . $viewsvn->paths->out('browse.php', $repos . '/') . '">' . $repos . '</a></li>';
-       echo "\n";
+       $link = $viewsvn->paths->out('browse.php', $repos . '/');
+       eval('$nodes .= "' . $template->fetch('index_node') . '";');
 }
 
-echo '</ul>';
+// ###################################################################
+
+eval('$template->flush("' . $template->fetch('index') . '");');
 
 /*=====================================================================*\
 || ###################################################################
diff --git a/log.php b/log.php
index a81313fe8b3ab19b092500897e920c0ebbc15337..74232982a94844faca299d1a94814af8d5b9efd2 100644 (file)
--- a/log.php
+++ b/log.php
 
 require_once('./global.php');
 
-echo $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
 
-echo '<br />';
+// ###################################################################
 
 // this is NOT supposed to allow for revision ranges
 $logs = new SVNLog($repos, $relpath, 0, $viewsvn->paths->fetch_rev_num());
 
 $isdir = $viewsvn->svn->common->isdir($path);
 
-echo '<ul>';
-echo "\n";
+$nodes = '';
 
 foreach ($logs->fetch() AS $log)
 {
+       $props = '';
+       
        $prev = $viewsvn->svn->common->fetch_prev_rev($path, $log['rev']);
-       echo '<li>' . $log['rev'] .
-               (!$isdir ? ' - <a href="/viewsvn/' . $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path) . '">View</a>' : '') . 
-               ' - <a href="/viewsvn/' . $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path) . '">Blame</a>' .
-               ($viewsvn->svn->common->fetch_head_rev($path) != $log['rev'] ? ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $log['rev']), $path) . '">Diff to HEAD</a>' : '') .
-               ($prev != -1 ? ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $log['rev'], $prev), $path) . '">Diff to PREV</a>' : '');
-       echo "\n";
-       echo '<ul>';
-       echo "\n";
+       
+       $link['view'] = (!$isdir ? $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path) : '');
+       $link['blame'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path);
+       
+       $show['diffhead'] = $viewsvn->svn->common->fetch_head_rev($path) != $log['rev'];
+       if ($show['diffhead'])
+       {
+               $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $log['rev']), $path);
+       }
+       
+       $show['diffprev'] = $prev != -1;
+       if ($show['diffprev'])
+       {
+               $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $log['rev'], $prev), $path);
+       }
+
        foreach ($log AS $key => $val)
        {
-               if ($key == 'files')
-               {
-                       echo "\n";
-                       echo '<li>files:</li>';
-                       echo "\n";
-                       echo '<ul>';
-                       echo "\n";
-                       foreach ($val AS $file)
-                       {
-                               echo '<li>' . $file['action'] . ' : ' . $file['file'] . '</li>';
-                               echo "\n";
-                       }
-                       echo '</ul>';
-                       echo "\n";
-               }
-               else
+               if ($key != 'files')
                {
-                       echo '<li>' . $key . ': ' . nl2br(htmlspecialchars($val)) . '</li>';
+                       $val = $viewsvn->svn->format($val);
+                       eval('$props .= "' . $template->fetch('log_prop') . '";');
                }
-               echo "\n";
        }
-       echo '</ul>';
-       echo "\n";
-       echo '</li>';
-       echo "\n";
+       
+       eval('$nodes .= "' . $template->fetch('log_node') . '";');
 }
 
-echo '</ul>';
+// ###################################################################
+
+eval('$template->flush("' . $template->fetch('log') . '");');
 
 /*=====================================================================*\
 || ###################################################################
diff --git a/templates/default/blame.tpl b/templates/default/blame.tpl
new file mode 100644 (file)
index 0000000..8b5e3e8
--- /dev/null
@@ -0,0 +1,18 @@
+$navbar
+
+<br />
+
+<a href="/viewsvn/$link[log]">View Log<a>
+
+<if condition="$show['head']">
+       - <a href="/viewsvn/$link[gohead]">Go to HEAD</a>
+       - <a href="/viewsvn/$link[diffhead]">Diff to HEAD</a>
+</if>
+
+<if condition="$show['prev']">
+       - <a href="/viewsvn/$link[diffprev]">Diff to PREV</a>
+</if>
+
+<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF; font: 11px monospace" width="100%">
+$lines
+</table>
\ No newline at end of file
diff --git a/templates/default/blame_line.tpl b/templates/default/blame_line.tpl
new file mode 100644 (file)
index 0000000..0400e1e
--- /dev/null
@@ -0,0 +1,5 @@
+       <tr style="background-color: white">
+               <td>$entry[rev]</td>
+               <td>$entry[author]</td>
+               <td>$entry[line_clean]</td>
+       </tr>
diff --git a/templates/default/browse.tpl b/templates/default/browse.tpl
new file mode 100644 (file)
index 0000000..4550fe4
--- /dev/null
@@ -0,0 +1,18 @@
+$navbar
+
+<br />
+
+<a href="/viewsvn/$link[log]">View Log<a>
+
+<if condition="$show['head']">
+       - <a href="/viewsvn/$link[gohead]">Go to HEAD</a>
+       - <a href="/viewsvn/$link[diffhead]">Diff to HEAD</a>
+</if>
+
+<if condition="$show['prev']">
+       - <a href="/viewsvn/$link[diffprev]">Diff to PREV</a>
+</if>
+
+<ul>
+$nodes
+</ul>
\ No newline at end of file
diff --git a/templates/default/browse_node.tpl b/templates/default/browse_node.tpl
new file mode 100644 (file)
index 0000000..b74ecaa
--- /dev/null
@@ -0,0 +1,9 @@
+       <li>
+               <if condition="$show['directory']">
+                       <a href="/viewsvn/$browse">$item</a>
+               <else />
+                       <a href="/viewsvn/$view">$item</a>
+                       - <a href="/viewsvn/$blame">Blame</a>
+               </if>
+               - <a href="/viewsvn/$log">View Log</a>
+       </li>
diff --git a/templates/default/diff.tpl b/templates/default/diff.tpl
new file mode 100644 (file)
index 0000000..b631ab4
--- /dev/null
@@ -0,0 +1,28 @@
+$navbar
+
+<br />
+
+<a href="/viewsvn/$link[log]">View Log<a>
+
+<style type="text/css">
+<!--
+       
+       .diff_add
+       {
+               background-color: #99EE99;
+       }
+       
+       .diff_del
+       {
+               background-color: #EE9999;
+       }
+       
+       table
+       {
+               font: normal 11px monospace;
+       }
+       
+//-->
+</style>
+
+$changes
\ No newline at end of file
diff --git a/templates/default/diff_file.tpl b/templates/default/diff_file.tpl
new file mode 100644 (file)
index 0000000..fdd371a
--- /dev/null
@@ -0,0 +1,5 @@
+<h2>$filename</h2>
+
+$hunktpl
+
+<hr />
diff --git a/templates/default/diff_hunk.tpl b/templates/default/diff_hunk.tpl
new file mode 100644 (file)
index 0000000..6fd47da
--- /dev/null
@@ -0,0 +1,3 @@
+<table cellspacing="1" cellpadding="1" width="100%">
+$lines
+</table>
\ No newline at end of file
diff --git a/templates/default/diff_line.tpl b/templates/default/diff_line.tpl
new file mode 100644 (file)
index 0000000..523d796
--- /dev/null
@@ -0,0 +1,13 @@
+<if condition="$show['hunk']">
+       <tr style="background-color: #F7F7F7">
+               <td><a href="/viewsvn/$rlow">r$low</a></td>
+               <td><a href="/viewsnv/$rhigh">r$high</a></td>
+               <td>&nbsp;</td>
+       </tr>
+<else />
+       <tr style="background-color: #EEEEDD; border-width: 0px 1px 1px 0px">
+               <td>$line[oldlineno]</td>
+               <td>$line[newlineno]</td>
+               <td style="background-color: $color">$line[line_clean]</td>
+       </tr>
+</if>
\ No newline at end of file
diff --git a/templates/default/index.tpl b/templates/default/index.tpl
new file mode 100644 (file)
index 0000000..f26253f
--- /dev/null
@@ -0,0 +1,5 @@
+Repositories:
+
+<ul>
+$nodes
+</ul>
\ No newline at end of file
diff --git a/templates/default/index_node.tpl b/templates/default/index_node.tpl
new file mode 100644 (file)
index 0000000..126d632
--- /dev/null
@@ -0,0 +1 @@
+       <li><a href="/viewsvn/$link">$repos</a></li>
diff --git a/templates/default/log.tpl b/templates/default/log.tpl
new file mode 100644 (file)
index 0000000..07523cf
--- /dev/null
@@ -0,0 +1,7 @@
+$navbar
+
+<br />
+
+<ul>
+$nodes
+</ul>
\ No newline at end of file
diff --git a/templates/default/log_node.tpl b/templates/default/log_node.tpl
new file mode 100644 (file)
index 0000000..a64dd55
--- /dev/null
@@ -0,0 +1,10 @@
+<li>
+       r$log[rev]
+       <if condition="$isdir">- <a href="/viewsvn/$link[view]">View</a></if>
+       - <a href="/viewsvn/$link[blame]">Blame</a>
+       <if condition="$show['diffhead']">- <a href="/viewsvn/$link[diffhead]">Diff to HEAD</a></if>
+       <if condition="$show['diffprev']">- <a href="/viewsvn/$link[diffprev]">Diff to PREV</a></if>
+       <ul>
+$props
+       </ul>
+</li>
diff --git a/templates/default/log_prop.tpl b/templates/default/log_prop.tpl
new file mode 100644 (file)
index 0000000..41e6e7b
--- /dev/null
@@ -0,0 +1 @@
+               <li>$key : $val</li>
\ No newline at end of file
diff --git a/templates/default/view.tpl b/templates/default/view.tpl
new file mode 100644 (file)
index 0000000..20be49b
--- /dev/null
@@ -0,0 +1,24 @@
+$navbar
+
+<br />
+
+<a href="/viewsvn/$link[log]">View Log<a>
+
+<if condition="$show['head']">
+       - <a href="/viewsvn/$link[gohead]">Go to HEAD</a>
+       - <a href="/viewsvn/$link[diffhead]">Diff to HEAD</a>
+</if>
+
+<if condition="$show['prev']">
+       - <a href="/viewsvn/$link[diffprev]">Diff to PREV</a>
+</if>
+
+<pre>$logmsg</pre>
+
+<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF; font: 11px monospace" width="100%">
+       <tr style="background-color: white">
+               <td>
+$catdata
+               </td>
+       </tr>
+</table>
\ No newline at end of file
index 48fa1cabfc40328c5081037866dfd0436f137038..a8c902d3dde0af5fc409d7b59a768271888005ee 100644 (file)
--- a/view.php
+++ b/view.php
 
 require_once('./global.php');
 
-echo $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = $viewsvn->paths->construct_breadcrumb($path);
 
-echo '<br />';
+// ###################################################################
 
-echo '<a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path) . '">View Log</a>';
+$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
 
-if ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD')
+$show['head'] = ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD');
+if ($show['head'])
 {
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path) . '">Go to HEAD</a>';
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path) . '">Diff to HEAD</a>';
+       $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path);
+       $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path);
 }
 
-$prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num());
-if ($prev != -1)
+$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false);
+if ($show['prev'])
 {
-       echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path) . '">Diff to PREV</a>';
+       $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path);
 }
 
+// ###################################################################
+
 $logmsg = $viewsvn->svn->common->fetch_log($path, $viewsvn->paths->fetch_rev_num());
 unset($logmsg['files']);
-echo '<pre>' . print_r($logmsg, true) . '</pre>';
 
-echo '<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF; font: 11px monospace" width="100%">
-       <tr style="background-color: white">
-               <td>';
+$logmsg = print_r($logmsg, true);
+
+$catdata = $viewsvn->svn->format(implode("\n", $viewsvn->svn->cat($repos, $relpath, @$viewsvn->in['rev'])));
 
-echo $viewsvn->svn->format(implode("\n", $viewsvn->svn->cat($repos, $relpath, @$viewsvn->in['rev'])));
+// ###################################################################
 
-echo '
-               </td>
-       </tr>
-</table>';
+eval('$template->flush("' . $template->fetch('view') . '");');
 
 /*=====================================================================*\
 || ###################################################################