GLCASpageBuilder($this,"doRepoNextForm");
return;
break;
+ case "addrepoapt":
+ GLCASpageBuilder($this,"doAddRepoApt");
+ return;
case "addrepoyum":
GLCASpageBuilder($this,"doAddRepoYum");
return;
} else {
//echo "Looks like an apt repo, but I cant find any known distro's<br>";
}
+ //$existing_repos["distros"] = "Ubuntu, Debian";
+ //$existing_repos["versions"] = "8.04LTS, 9.10, 10.04LTS, 10.10, 11.04, 11.10";
+ //$existing_repos["arch"] = "x86_64, i386";
+
+
+ $distros = $glt["distros"];
+ $version = $glt["versions"];
+ $archs = $glt["arch"];
echo "<form method=\"post\" action=\"?action=addrepoapt\">";
echo "<input type=\"hidden\" name=\"repourl\" value=\"$repourl\">";
+ echo "<input type=\"hidden\" name=\"distro\" value=\"$distros\">";
+ echo "<input type=\"hidden\" name=\"version\" value=\"$version\">";
+ echo "<input type=\"hidden\" name=\"arch\" value=\"$archs\">";
echo "<table>";
echo "<tr><td>Description</td><td><input type=\"text\" name=\"desc\" value=\"APT Repo$extratext\"></td>";
- echo "<tr><td>Provides</td><td><textarea name=\"provides\">$provides</text area></td></tr>";
+ echo "<tr><td>Provides</td><td><textarea name=\"provides\" rows=\"".$glt["nrepos"]."\" cols=\"100\">$provides</textarea></td></tr>";
echo "<tr><td>Short URL</td><td><input type=\"text\" name=\"shorturl\"></td></tr>";
echo "<tr><td>URL Prefix (blank for none)</td><td><input type=\"text\" name=\"prefix\"></td></tr>";
- echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\"> days</td></tr>";
+ echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\" value=\"3\"> days</td></tr>";
+ echo "<tr><td><input type=\"submit\" name=\"Add\" value=\"Add\"></td></tr>";
echo "</table>";
echo "</form>";
return true;
echo "<tr><td>Short URL</td><td><input type=\"text\" name=\"shorturl\"></td></tr>";
echo "<tr><td>URL Prefix (blank for none)</td><td><input type=\"text\" name=\"prefix\"></td></tr>";
echo "<tr><td>Do Initial Update (can take a while, but done in background)</td><td><input type=\"checkbox\" name=\"initial\" checked></td></tr>";
- echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\"> days</td></tr>";
+ echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\" value=\"3\"> days</td></tr>";
echo "<tr><td><input type=\"submit\" name=\"Add\" value=\"Add\"></td></tr>";
echo "</table>";
echo "</form>";
}
}
+
+ function doAddRepoApt($url)
+ {
+ $repo = new GLCASRepo($this->config);
+
+ $desc = $_REQUEST["desc"];
+ $OS = $_REQUEST["distro"];
+ $version = $_REQUEST["version"];
+ $arch = $_REQUEST["arch"];
+ $shorturl = $_REQUEST["shorturl"];
+ $prefix = $_REQUEST["prefix"];
+ $repurl = $_REQUEST["repourl"];
+ $expiretime = $REQUEST["expiretime"];
+ $init = false;
+ if(isset($_REQUEST["initial"])) $init = true;
+
+
+
+ $repo->addRepo($desc, $OS, $version, $arch, "-", $shorturl, $prefix, $repurl, "APT", $init, $expiretime);
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/admin/");
+ }
function doAddRepoYum($url)
{
$content .= "<table>";
$dh = opendir($dir);
while(($file = readdir($dh))!==false) {
- if($file != "." && $file != "..") $content .= "<tr><td><a href=\"$uri/$file\">$file</a></td></tr>";
+ if($file != "." && $file != "..") {
+ if(is_dir("$dir/$file")) {
+ $fsize = "";
+ $icon = "/icons/folder.png";
+ } else {
+ $fsize = filesize("$dir/$file");
+ $icon = "/icons/text.png";
+ }
+ $content .= "<tr><td><img src=\"$icon\"></td><td><a href=\"$uri/$file\">$file</a></td><td>$fsize</td></tr>";
+ }
}
$content .= "</table></body></html>";
}
}
$existing_repos["nrepos"] = $repos;
+
+ // TODO: these need to be "calculated"
$existing_repos["distros"] = "Ubuntu, Debian";
+ $existing_repos["versions"] = "8.04LTS, 9.10, 10.04LTS, 10.10, 11.04, 11.10";
+ $existing_repos["arch"] = "x86_64, i386";
return $existing_repos;