Lots of little changes, basic structure now looking pretty good
[glcas.git] / plugins / admin.php
index 4e24665..8b6c2a9 100644 (file)
@@ -15,9 +15,82 @@ class GLCASAdmin {
        
        function go($url)
        {
-               echo "admin page";
+               error_log("repo:go called");
+               
+               if(isset($_REQUEST["action"])) {
+                       switch($_REQUEST["action"]) {
+                               case "addrepo":
+                                       GLCASpageBuilder($this,"doAddRepo");
+                                       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 doAddRepo($url)
+       {
+               $myRep = new GLCASRepo($this->config);
+               
+               $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"]);
+               
+               echo "<pre>$glt</pre>";
        }
        
+       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;
 }