130 |
kaklik |
1 |
<?php |
|
|
2 |
# vim:et:ts=3:sts=3:sw=3:fdm=marker: |
|
|
3 |
|
|
|
4 |
// WebSVN - Subversion repository viewing via the web using PHP |
|
|
5 |
// Copyright © 2004-2006 Tim Armes, Matt Sicker |
|
|
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; either version 2 of the License, or |
|
|
10 |
// (at your option) any later version. |
|
|
11 |
// |
|
|
12 |
// This program is distributed in the hope that it will be useful, |
|
|
13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
15 |
// GNU General Public License for more details. |
|
|
16 |
// |
|
|
17 |
// You should have received a copy of the GNU General Public License |
|
|
18 |
// along with this program; if not, write to the Free Software |
|
|
19 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
20 |
// |
|
|
21 |
// -- |
|
|
22 |
// |
|
|
23 |
// index.php |
|
|
24 |
// |
|
|
25 |
// Main page. Lists all the projects |
|
|
26 |
|
|
|
27 |
require_once("include/setup.inc"); |
|
|
28 |
require_once("include/svnlook.inc"); |
|
|
29 |
require_once("include/template.inc"); |
|
|
30 |
|
|
|
31 |
$vars["action"] = $lang["PROJECTS"]; |
|
|
32 |
$vars["repname"] = ""; |
|
|
33 |
$vars["rev"] = 0; |
|
|
34 |
$vars["path"] = ""; |
|
|
35 |
|
|
|
36 |
// Sort the repositories by group |
|
|
37 |
$config->sortByGroup(); |
|
|
38 |
|
|
|
39 |
if ($config->flatIndex) |
|
|
40 |
{ |
|
|
41 |
// Create the flat view |
|
|
42 |
|
|
|
43 |
$projects = $config->getRepositories(); |
|
|
44 |
$i = 0; |
|
|
45 |
$listing = array (); |
|
|
46 |
foreach ($projects as $project) |
|
|
47 |
{ |
|
|
48 |
if ($project->hasReadAccess("/", true)) |
|
|
49 |
{ |
|
|
50 |
$url = $config->getURL($project, "/", "dir"); |
|
|
51 |
|
|
|
52 |
$listing[$i]["rowparity"] = $i % 2; |
|
|
53 |
$listing[$i++]["projlink"] = "<a href=\"${url}sc=0\">".$project->getDisplayName()."</a>"; |
|
|
54 |
} |
|
|
55 |
} |
|
|
56 |
$vars["flatview"] = true; |
|
|
57 |
$vars["treeview"] = false; |
|
|
58 |
} |
|
|
59 |
else |
|
|
60 |
{ |
|
|
61 |
// Create the tree view |
|
|
62 |
|
|
|
63 |
$projects = $config->getRepositories(); |
|
|
64 |
reset($projects); |
|
|
65 |
$i = 0; |
|
|
66 |
$listing = array (); |
|
|
67 |
$curgroup = NULL; |
|
|
68 |
$parity = 0; |
|
|
69 |
foreach ($projects as $project) |
|
|
70 |
{ |
|
|
71 |
if ($project->hasReadAccess("/", true)) |
|
|
72 |
{ |
|
|
73 |
$listing[$i]["rowparity"] = $parity % 2; |
|
|
74 |
$url = $config->getURL($project, "/", "dir"); |
|
|
75 |
if ($curgroup != $project->group) |
|
|
76 |
{ |
|
|
77 |
if (!empty($curgroup)) |
|
|
78 |
$listing[$i]["listitem"] = "</div>\n"; // Close the switchcontent div |
|
|
79 |
else |
|
|
80 |
$listing[$i]["listitem"] = ""; |
|
|
81 |
|
|
|
82 |
$listing[$i]["isprojlink"] = false; |
|
|
83 |
$listing[$i]["isgrouphead"] = true; |
|
|
84 |
|
|
|
85 |
$curgroup = $project->group; |
|
|
86 |
$listing[$i++]["listitem"] .= "<div class=\"groupname\" onclick=\"expandcontent(this, '$curgroup');\" style=\"cursor:hand; cursor:pointer\"><div class=\"a\"><span class=\"showstate\"></span>$curgroup</div></div>\n<div id=\"$curgroup\" class=\"switchcontent\">"; |
|
|
87 |
} |
|
|
88 |
|
|
|
89 |
$parity++; |
|
|
90 |
$listing[$i]["isgrouphead"] = false; |
|
|
91 |
$listing[$i]["isprojlink"] = true; |
|
|
92 |
$listing[$i++]["listitem"] = "<a href=\"${url}sc=0\">".$project->name."</a>\n"; |
|
|
93 |
} |
|
|
94 |
} |
|
|
95 |
|
|
|
96 |
if (!empty($curgroup)) |
|
|
97 |
$listing[$i]["isprojlink"] = false; |
|
|
98 |
$listing[$i]["isgrouphead"] = false; |
|
|
99 |
$listing[$i]["listitem"] = "</div>"; // Close the switchcontent div |
|
|
100 |
|
|
|
101 |
$vars["flatview"] = false; |
|
|
102 |
$vars["treeview"] = true; |
|
|
103 |
$vars["opentree"] = $config->openTree; |
|
|
104 |
} |
|
|
105 |
|
|
|
106 |
$vars["version"] = $version; |
|
|
107 |
parseTemplate($config->getTemplatePath()."header.tmpl", $vars, $listing); |
|
|
108 |
parseTemplate($config->getTemplatePath()."index.tmpl", $vars, $listing); |
|
|
109 |
parseTemplate($config->getTemplatePath()."footer.tmpl", $vars, $listing); |
|
|
110 |
|
|
|
111 |
?> |