function go($url)
{
- echo "admin page";
+ error_log("repo:go called");
+
+ if(isset($_REQUEST["action"])) {
+ switch($_REQUEST["action"]) {
+ case "addrepo":
+ GLCASpageBuilder($this,"doAddRepoForm");
+ return;
+ break;
+ case "scanrepo":
+ break;
+ }
+ }
+ GLCASpageBuilder($this, "body");
}
+ function body($url)
+ {
+ // for the main admin body, we hae the following components
+
+ // 1. list of currently available repos and stuff
+
+ // 2. way to add a repo direct
+
+ // 3. way to scan for a repo given a url
+
+ // so first, lets do the main body
+ $this->mainBody($url);
+ }
+
+ function doAddRepoForm($url)
+ {
+ $myRep = new GLCASRepo($this->config);
+
+ $wasyum = false;
+ if($_REQUEST["repotype"] == "yumbase") {
+ $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"]);
+ $wasyum = true;
+ } else if($_REQUEST["repotype"] == "yummirrorlist") {
+ $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"], true);
+ $wasyum = true;
+ } else if($_REQUEST["repotype"] == "apt") {
+ $glt = $myRep->getRepoDetailsApt($_REQUEST["repourl"]);
+ }
+
+
+ if($wasyum) {
+ $os = $glt["OS"];
+ $version = $glt["version"];
+ $arch = $glt["arch"];
+ echo "<form method=\"post\" action=\"repoaddreal\">";
+ echo "OS: <input type=\"text\" name=\"OS\" value=\"$os\"><br>";
+ echo "Version: <input type=\"text\" name=\"version\" value=\"$version\"><br>";
+ echo "Architecture: <input type=\"text\" name=\"Architecture\" value=\"$arch\"><br>";
+ echo "Short URL <input type=\"text\" name=\"shorturl\"><br>";
+ echo "URL Prefix (blank for none) <input type=\"text\" name=\"shorturl\"><br>";
+ echo "<input type=\"submit\" name=\"Add\" value=\"add\"><br>";
+ echo "</form>";
+ } else {
+ // apt is much tricker cause one repo can provide multiple versions, OS's and architectures.
+ }
+ }
+
+ function mainBody($url)
+ {
+ // first, list available repos
+ echo "<h3>Repositories</h3><br><table>";
+ echo "<tr><th>Name</th><th>Type</th><th>Version</th><th>Browse</th><th>Control</th></tr>";
+ echo "</table><br><hr>";
+
+ // wrap all this in a table
+ echo "<table><tr><td valign=\"top\">";
+ // now, add a repo
+ echo "<h3>Add A Repo</h3>";
+ echo "<form method=\"post\" action=\"?action=addrepo\">";
+ echo "Type <select name=\"repotype\">";
+ echo "<option value=\"yumbase\">YUM (Base URL)</option>";
+ echo "<option value=\"yummirrorlist\">YUM (Mirror List)</option>";
+ echo "<option value=\"apt\">APT</option>";
+ echo "</select><br>";
+ echo "URL <input type=\"text\" name=\"repourl\"><br>";
+ echo "<input type=\"submit\" name=\"Add\" value=\"Add\"><br>";
+ echo "</form><hr>";
+
+ echo "</td><td valign=\"top\">";
+
+ // now scan for a repo
+ echo "<h3>Scan For Repos</h3>";
+ echo "<form method=\"post\" action=\"?action=scanrepo\">";
+ echo "Hint <select name=\"repohint\">";
+ echo "<option value=\"fedora\">Fedora</option>";
+ echo "<option value=\"centos\">Centos</option>";
+ echo "<option value=\"ubuntu\">Ubuntu</option>";
+ echo "</select><br>";
+ echo "URL <input type=\"text\" name=\"repourl\"><br>";
+ echo "<input type=\"submit\" name=\"Scan\" value=\"Scan\"><br>";
+ echo "</form>";
+
+ echo "</td></tr></table>";
+ }
+
private $config;
}