X-Git-Url: http://git.pjr.cc/?p=glcas.git;a=blobdiff_plain;f=plugins%2Fadmin.php;h=e6dea41268f81c3485a393b97b1be8e43201f3ed;hp=af5ed85612d29a2d12b129c0f9c3bbd04e42f9e5;hb=b0651723ae8487b4791b01cfbdcebf2d76907bed;hpb=f3bb1ef4d1fb0297498f8a1a30c2332e2e5905e8
diff --git a/plugins/admin.php b/plugins/admin.php
index af5ed85..e6dea41 100644
--- a/plugins/admin.php
+++ b/plugins/admin.php
@@ -19,10 +19,26 @@ class GLCASAdmin {
if(isset($_REQUEST["action"])) {
switch($_REQUEST["action"]) {
- case "addrepo":
- GLCASpageBuilder($this,"doAddRepoForm");
+ case "updaterepo":
+ error_log("in updaterepo");
+ GLCASpageBuilder($this,"doUpdateRepo");
+ return;
+ case "reponext":
+ error_log("in reponext");
+ GLCASpageBuilder($this,"doRepoNextForm");
return;
break;
+ case "addrepoyum":
+ GLCASpageBuilder($this,"doAddRepoYum");
+ return;
+ case "deleterepo":
+ error_log("call delete repo");
+ GLCASpageBuilder($this, "doRemoveRepo");
+ return;
+ case "setstorage":
+ error_log("call setstorage");
+ GLCASpageBuilder($this, "setStorage");
+ return;
case "scanrepo":
break;
}
@@ -44,7 +60,26 @@ class GLCASAdmin {
$this->mainBody($url);
}
- function doAddRepoForm($url)
+ function doRemoveRepo($url)
+ {
+ $repo = $_REQUEST["repo"];
+ $myRep = new GLCASRepo($this->config);
+
+
+ error_log("called delete repo on $repo");
+ $myRep->deleteRepo($repo);
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/admin/");
+ }
+
+
+ function setStorage($url)
+ {
+
+ }
+
+ function doRepoNextForm($url)
{
$myRep = new GLCASRepo($this->config);
@@ -64,44 +99,128 @@ class GLCASAdmin {
$os = $glt["OS"];
$version = $glt["version"];
$arch = $glt["arch"];
- echo "
";
} else {
// apt is much tricker cause one repo can provide multiple versions, OS's and architectures.
}
}
+ function doAddRepoYum($url)
+ {
+ $repo = new GLCASRepo($this->config);
+
+ $desc = $_REQUEST["desc"];
+ $OS = $_REQUEST["OS"];
+ $version = $_REQUEST["version"];
+ $arch = $_REQUEST["arch"];
+ $other = $_REQUEST["other"];
+ $shorturl = $_REQUEST["shorturl"];
+ $prefix = $_REQUEST["prefix"];
+ $repurl = $_REQUEST["repourl"];
+ $init = false;
+ if(isset($_REQUEST["initial"])) $init = true;
+
+
+
+ $repo->addRepo($desc, $OS, $version, $arch, $other, $shorturl, $prefix, $repurl, "YUM", $init);
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/admin/");
+ }
+
+ function doUpdateRepo($url)
+ {
+ $rkey = $_REQUEST["repo"];
+
+ $repo = new GLCASRepo($this->config);
+
+ $repo->updateRepo($rkey);
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/admin/");
+ }
+
function mainBody($url)
{
// first, list available repos
- echo "Repositories
";
- echo "Name | Type | Version | Browse | Control |
";
+ echo "Repositories
";
+ echo "
";
+ echo "Name | Type | OS | Version | Architecture | Other | Prefix | Short URL | Browse | Control |
";
+
+ // now iterate thru the repos and print them
+ $repo = new GLCASRepo($this->config);
+ $repos = $repo->getRepos();
+
+ foreach($repos as $rkey => $rval) {
+ $desc = $rval["desc"];
+ $os = $rval["os"];
+ $version = $rval["version"];
+ $arch = $rval["arch"];
+ $other = $rval["other"];
+ $repotype = $rval["repotype"];
+ $prefix = $rval["prefix"];
+ $shorturl = $rval["shorturl"];
+ if($prefix == "") $prefix = "-";
+ if($shorturl == "") $shorturl = "-";
+ echo "$desc | $repotype | $os | $version | $arch | $other | $prefix | $shorturl | ";
+
+ // get url
+ echo "Browse | ";
+
+ // Edit
+ echo "Edit ";
+ // update
+ echo "Update ";
+ // freeze
+ echo "Freeze ";
+ // deactivate
+ echo "Disable ";
+ // clean
+ echo "Clean ";
+ // Remove
+ echo "Delete";
+
+ echo " | ";
+ echo "
";
+ }
+
echo "
";
+ //echo "";
+ //if($repos !== false) print_r($repos);
+ //echo "
";
// wrap all this in a table
echo "";
// now, add a repo
echo "Add A Repo";
- echo " ";
+ echo "";
echo " | ";
// now scan for a repo
- echo "Scan For Repos";
+ echo "Scan For Repos - not implemented";
echo "";
- echo " |
";
+ echo "
";
+
+ // repo storage location
+ echo "Storage
";
+ echo "
";
}
private $config;