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