added a apt repo updater... that doesnt work
[glcas.git] / plugins / admin.php
index 13121c3..492ed29 100644 (file)
@@ -162,19 +162,22 @@ class GLCASAdmin {
                        $version = $glt["versions"];
                        $archs = $glt["arch"];
                        
-                       echo "<pre>";
-                       print_r($glt);
-                       echo "</pre>";
+                       //echo "<pre>";
+                       //print_r($glt);
+                       //echo "</pre>";
                        
+                       echo "The joy of apt is that there could be a million distro's under the root of an apt mirror";
+                       echo "if it doesn't list here, but you know its there, its still usable for glcas";
                        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=\"provides\" value=\"Multiple\">";
                        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>";
-                       // TODO change this "provides" bit with a bit that allows us to choose which versions
-                       // of ubuntu will be made available from the ones we found
-                       echo "<tr><td>Provides (tick those you wish to BLOCK)</td><td>";
+                       
+                       // TODO: deal with block bit
+                       echo "<tr><td>Provides (tick those you wish to BLOCK - not implemented)</td><td>";
                        foreach($glt["knownrepo"] as $key => $val) {
                                $reponame = $kos["apt"][$val["name"]];
                                $a = "";
@@ -183,7 +186,7 @@ class GLCASAdmin {
                                if($glt["knownrepo"][$key]["amd64"]) $b = "x86_64";
                                if($a != "" && $b != "") $archs = "$a/$b";
                                else $archs = "$a$b"; 
-                               echo "<input type=\"checkbox\" name=\"$val\"> $reponame ($archs)<br>";
+                               echo "<input type=\"checkbox\" name=\"blocked-".$val["name"]."\"> $reponame ($archs)<br>";
                        }
                        
                        echo "</td></tr>";
@@ -236,9 +239,26 @@ class GLCASAdmin {
                $init = false;
                if(isset($_REQUEST["initial"])) $init = true;
                
+               $blocklist = null;
+               $bn = 0;
+               foreach($_REQUEST as $key => $val) {
+                       if(preg_match("/^blocked-*/", $key)) {
+                               $blocked = preg_replace("/^blocked-/", "", $key);
+                               //echo "<br>got block for $blocked<br>";
+                               $blocklist[$bn] = "dists\/$blocked.*";
+                               $bn++;
+                       }
+               }
                
+               //echo "<pre>";
+               //print_r($_REQUEST);
+               //echo "</pre>";
                
-               $repo->addRepo($desc, $OS, $version, $arch, "-", $shorturl, $prefix, $repurl, "APT", $init, $expiretime);
+               //exit(0);
+               
+               $repo->addRepo($desc, $OS, $version, $arch, "-", $shorturl, $prefix, $repurl, "APT", $init, $expiretime, $blocklist);
+               
+               // next we need to deal with that "blocked" bit
                
                global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
                header("Location: $BASE_URL/admin/");
@@ -271,6 +291,8 @@ class GLCASAdmin {
        function doUpdateRepo($url)
        {
                $rkey = $_REQUEST["repo"];
+
+               error_log("would update for repo");
                
                $repo = new GLCASRepo($this->config);
                
@@ -338,13 +360,12 @@ class GLCASAdmin {
                //echo "</pre>";
                
                // wrap all this in a table
-               echo "<table><tr><td valign=\"top\">";
+               echo "<table border=\"1\"><tr><td valign=\"top\">";
                // now, add a repo
                echo "<h3>Add A Repo</h3>";
                echo "<form method=\"post\" action=\"?action=reponext\">";
                echo "Type <select name=\"repotype\">";
                        echo "<option value=\"yumbase\">YUM (Base URL)</option>";
-                       echo "<option value=\"yummirrorlist\">YUM (Mirror List) - not implemented</option>";
                        echo "<option value=\"apt\">APT</option>";
                        echo "</select><br>";
                echo "URL <input type=\"text\" name=\"repourl\"><br>";
@@ -359,19 +380,37 @@ class GLCASAdmin {
                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><hr>";
+               echo "</td><td valign=\"top\">";
+               
+               // now for mirror lists
+               echo "<h3>Via Mirrolist - not implemented</h3>";
+               echo "<form method=\"post\" action=\"?action=mirrorlist\">";
+               echo "Distro <select name=\"mirrordistro\">";
+                       echo "<option value=\"fedora\">Fedora</option>";
+                       echo "<option value=\"centos\">Centos</option>";
+                       echo "</select><br>";
+               echo "Architecture <select name=\"arch\">";
+                       echo "<option value=\"x86_64\">64 bit</option>";
+                       echo "<option value=\"i386\">32 bit</option>";
+                       echo "</select><br>";
+               echo "Version <input type=\"text\" name=\"version\"><br>";
+               echo "Get updates too <input type=\"checkbox\" name=\"getupdates\"><br>";
+               echo "<input type=\"submit\" name=\"Scan\" value=\"Scan\"><br>";
+               echo "</form>";
+               
+               
+               echo "</td></tr></table>";
                
                // repo storage location
                echo "<h3>Storage<h3><br>";
                echo "<form method=\"post\" action=\"?action=setstorage\">";
                $storloc = $this->config->getConfigVar("storagelocation");
-               echo "<input type=\"text\" name=\"storageloc\" value=\"$storloc\" size=\"100\">";
+               echo "<input class=\"storage\" type=\"text\" name=\"storageloc\" value=\"$storloc\" size=\"100\">";
                echo "<input type=\"submit\" name=\"Set\" value=\"Set\">";
                echo "</form>";
        }