function GLCASMenuBuilder()
{
- global $BASE_URL;
+ global $BASE_URL, $MENU_ITEMS;
+
+ sort($MENU_ITEMS);
?>
-<a href="<?php echo $BASE_URL ?>">Home</a>
-<a href="<?php echo $BASE_URL."/admin/"?>">Admin</a>
-<a href="<?php echo $BASE_URL."/adhoc/"?>">Adhoc</a>
+ <table border="1"><tr><th>Menu</th><td>
+<a href="<?php echo $BASE_URL ?>">Home</a></td>
<?php
+ foreach($MENU_ITEMS as $key => $val) {
+ $link = $val["link"];
+ $name = $val["name"];
+ echo "<td><a href=$link>$name</a></td>";
+ }
+
+ echo "</table>";
}
function GLCASMessageBuilder()
global $URL_HANDLERS;
$URL_HANDLERS["adhoc.*"] = "GLCASAdhoc";
+global $BASE_URL, $MENU_ITEMS;
+$MENU_ITEMS["20adhoc"]["name"] = "Adhoc Packages";
+$MENU_ITEMS["20adhoc"]["link"] = "$BASE_URL/adhoc";
+
class GLCASAdhoc {
function __construct($config)
error_log("in updaterepo");
GLCASpageBuilder($this,"addPackage");
return;
+ case "deletepkg":
+ error_log("in delete pkg");
+ GLCASpageBuilder($this, "delPackage");
+ return;
}
}
}
+ function delPackage($url)
+ {
+ $repostore = $this->config->getConfigVar("storagelocation");
+
+ $pkgid = $_REQUEST["pkgid"];
+
+ $pkgs = unserialize($this->config->getConfigVar("adhocpackages"));
+
+ if(isset($pkgs[$pkgid])) {
+ unset($pkgs[$pkgid]);
+ $this->config->setConfigVar("adhocpackages", serialize($pkgs));
+ $this->config->saveConfig();
+ }
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/adhoc/");
+
+ }
+
function addPackage($url)
{
$repostore = $this->config->getConfigVar("storagelocation");
function mainBody($url)
{
echo "<h2>Packages</h2>";
-
- $kos = getKnownOSList();
-
- echo "<hr>";
- echo "<h3>Add a Package</h3><br>";
+
$pkgs = unserialize($this->config->getConfigVar("adhocpackages"));
+ echo "<table border=\"1\"><tr><th>Name</th><th>Package Types</th><th>Architecture</th><th>Control</th></tr>";
+
foreach($pkgs as $key => $var) {
$name = $var["pkgname"];
$arch = $var["arch"];
$type = $var["type"];
- echo "$key: $name $arch, $type<br>";
+ echo "<tr><td>$name</td><td>$type</td><td>$arch</td><td>Add another arch <a href=\"?action=deletepkg&pkgid=$key\">Delete</a></td></tr>";
}
+ echo "<table>";
+
+ $kos = getKnownOSList();
+
+ echo "<hr>";
+ echo "<h3>Add a Package</h3><br>";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"?action=addpackage\">";
- echo "Name <input type=\"text\" name=\"pkgname\"><br>";
+ echo "Name <input type=\"text\" name=\"pkgname\"> or Add version of <select name=\"origpkg\"></select><br>";
echo "Arch <select name=\"arch\">";
foreach($kos["pkgarch"] as $key => $val) {
echo "<option value=\"$key\">$val</option>";
echo "<input type=\"submit\" name=\"add\" value=\"Add\">";
echo "</form>";
}
+
+ private $config;
}
?>
error_log("admin loaded");
+global $BASE_URL, $MENU_ITEMS;
+$MENU_ITEMS["10admin"]["name"] = "Admin";
+$MENU_ITEMS["10admin"]["link"] = "$BASE_URL/admin";
+
global $URL_HANDLERS;
$URL_HANDLERS["admin.*"] = "GLCASAdmin";
global $CRON_CLASSES;
echo "</td></tr></table>";
// repo storage location
- echo "<h3>Storage<h3><br>";
+ echo "<h3>Storage</h3><br>";
echo "<form method=\"post\" action=\"?action=setstorage\">";
$storloc = $this->config->getConfigVar("storagelocation");
echo "<input class=\"storage\" type=\"text\" name=\"storageloc\" value=\"$storloc\" size=\"100\">";
echo "<input type=\"submit\" name=\"Set\" value=\"Set\">";
echo "</form>";
+
+ echo "<hr>";
+ echo "<h3>Proxy Config</h3><br>";
+ echo "<form method=\"post\" action=\"?action=setproxy\">";
+ $proxyaddress = $this->config->getConfigVar("proxyaddress");
+ $proxylogin = $this->config->getConfigVar("proxylogin");
+ $proxypass = $this->config->getConfigVar("proxypass");
+ echo "Proxy Address <input type=\"text\" name=\"proxyaddress\" value=\"$proxyaddress\" size=\"100\"><br>";
+ echo "Proxy Login <input type=\"text\" name=\"proxylogin\" value=\"$proxylogin\" size=\"100\"><br>";
+ echo "Proxy Password <input type=\"text\" name=\"proxypassword\" value=\"$proxypass\" size=\"100\"><br>";
+ echo "<input type=\"submit\" name=\"Set\" value=\"Set\">";
+ echo "</form>";
+
}
private $config;
--- /dev/null
+<?php
+
+error_log("hosts loaded");
+
+global $URL_HANDLERS;
+$URL_HANDLERS["hosts.*"] = "GLCASHosts";
+global $BASE_URL, $MENU_ITEMS;
+$MENU_ITEMS["30hosts"]["name"] = "Known Machines";
+$MENU_ITEMS["30hosts"]["link"] = "$BASE_URL/hosts";
+
+class GLCASHosts {
+ function __construct($config)
+ {
+ $this->config = $config;
+ error_log("constructor for GLCASHosts");
+
+ }
+
+ function go($url)
+ {
+ if(isset($_REQUEST["action"])) {
+ switch($_REQUEST["action"]) {
+ case "addpackage":
+ error_log("in updaterepo");
+ GLCASpageBuilder($this,"addPackage");
+ return;
+ case "deletepkg":
+ error_log("in delete pkg");
+ GLCASpageBuilder($this, "delPackage");
+ return;
+ }
+ }
+
+ GLCASpageBuilder($this,"mainBody");
+ return;
+
+ }
+
+ function mainBody($url)
+ {
+ echo "I am a hosts thingy";
+ }
+
+ private $config;
+}
+
+?>
\ No newline at end of file