sortByGroup();
if ($config->flatIndex) {
// Create the flat view
$projects = $config->getRepositories();
$i = 0;
$listing = array();
foreach ($projects as $project) {
if ($project->hasReadAccess("/", true)) {
$url = $config->getURL($project, '', 'dir');
$listing[$i]["rowparity"] = $i % 2;
$listing[$i]["projlink"] = "".$project->getDisplayName()."";
$i++;
}
}
$vars["flatview"] = true;
$vars["treeview"] = false;
} else {
// Create the tree view
$projects = $config->getRepositories();
reset($projects);
$i = 0;
$listing = array();
$curgroup = NULL;
$parity = 0;
foreach ($projects as $project) {
if ($project->hasReadAccess("/", true)) {
$listing[$i] = array();
if ($curgroup != $project->group) {
// TODO: this should be de-soupified
if (!empty($curgroup)) {
// Close the switchcontent div
$listing[$i]["listitem"] = "\n";
} else {
$listing[$i]["listitem"] = "";
}
$listing[$i]["isprojlink"] = false;
$listing[$i]["isgrouphead"] = true;
$curgroup = $project->group;
$id = strtr(base64_encode('grp'.$curgroup), array('+' => '-', '/' => '_', '=' => ''));
$listing[$i]["listitem"] .= "
";
$i++;
$listing[$i] = array();
}
$listing[$i]["isgrouphead"] = false;
$listing[$i]["isprojlink"] = true;
$url = $config->getURL($project, '', 'dir');
$listing[$i]["listitem"] = "
".$project->name."\n";
$listing[$i]["rowparity"] = $parity % 2;
$parity++;
$i++;
}
}
if (!empty($curgroup)) {
// Close the switchcontent div
$listing[$i]["isprojlink"] = false;
$listing[$i]["isgrouphead"] = false;
$listing[$i]["listitem"] = "
";
}
$vars["flatview"] = false;
$vars["treeview"] = true;
$vars["opentree"] = $config->openTree;
}
if (!$config->multiViews) {
$vars['indexurl'] = $config->getURL($rep, '', 'index');
}
$vars["version"] = $version;
parseTemplate($config->getTemplatePath()."header.tmpl", $vars, $listing);
parseTemplate($config->getTemplatePath()."index.tmpl", $vars, $listing);
parseTemplate($config->getTemplatePath()."footer.tmpl", $vars, $listing);