Adding PHPUnit tests
[viewsvn.git] / browse.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'browse_node',
24 'browse',
25 'property'
26 );
27
28 require_once('./global.php');
29
30 $navbar = $controller->construct_breadcrumb();
31
32 // ###################################################################
33
34 $latest = $controller->cachev->fetch_node();
35
36 $link['log'] = $controller->href_compound('log.php');
37
38 $show['head'] = ($latest['revision'] != $controller->revctx);
39 if ($show['head'])
40 {
41 $link['gohead'] = $controller->href_compound('browse.php', null, Paths::fetch_rev_str(false, 'HEAD'));
42 $link['diffhead'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, 'HEAD', $controller->revctx));
43 }
44
45 $show['prev'] = ($controller->cachev->fetch_prev_revision($controller->revctx) != -1);
46 if ($show['prev'])
47 {
48 $link['diffprev'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(false, $controller->revctx));
49 }
50
51 // ###################################################################
52
53 $show['props'] = false;
54 $proplist = '';
55 if (sizeof($latest['properties']) > 0)
56 {
57 $show['props'] = true;
58 foreach ($latest['properties'] AS $propname => $propval)
59 {
60 $data = sprintf($lang->string('Property <strong>%1$s</strong> set to <em>%2$s</em>'), $propname, $propval);
61 eval('$proplist .= "' . $template->fetch('property') . '";');
62 }
63 }
64
65 // ###################################################################
66
67 $revinfo = $controller->cachev->fetch_revision($controller->revctx);
68
69 $revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']);
70 $revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']);
71
72 $listing = $controller->library->command('ls');
73
74 $nodes = '';
75
76 foreach ($listing AS $item)
77 {
78 if ($item[ strlen($item) - 1 ] == '/')
79 {
80 $show['directory'] = true;
81 $browse = $controller->href_compound('browse.php', $item);
82 }
83 else
84 {
85 $show['directory'] = false;
86 $view = $controller->href_compound('view.php', $item);
87 $blame = $controller->href_compound('blame.php', $item);
88 }
89
90 $log = $controller->href_compound('log.php', $item);
91
92 eval('$nodes .= "' . $template->fetch('browse_node') . '";');
93 }
94
95 // ###################################################################
96
97 eval('$template->flush("' . $template->fetch('browse') . '");');
98
99 /*=====================================================================*\
100 || ###################################################################
101 || # $HeadURL$
102 || # $Id$
103 || ###################################################################
104 \*=====================================================================*/
105 ?>