X-Git-Url: http://git.pjr.cc/?p=glcas.git;a=blobdiff_plain;f=plugins%2Fhosts.php;h=f2e8e44b26c9c92efda261e1dae2ade0b0c408c0;hp=3634682eb4d1f4de9e86da7c6a4d5b5635887539;hb=28961382f5b6b9d0b97408af8bcce52fe214db22;hpb=155c0a1bc81dff4fc1bb4bcebb754c961e457499
diff --git a/plugins/hosts.php b/plugins/hosts.php
index 3634682..f2e8e44 100644
--- a/plugins/hosts.php
+++ b/plugins/hosts.php
@@ -35,6 +35,12 @@ class GLCASHosts {
case "scanrange":
GLCASpageBuilder($this, "scanIPRange");
return;
+ case "delgroup":
+ GLCASpageBuilder($this, "deleteGroup");
+ return;
+ case "dooperation":
+ GLCASpageBuilder($this, "doOperation");
+ return;
}
}
@@ -43,6 +49,57 @@ class GLCASHosts {
}
+ function doOperation($url)
+ {
+ $operation = $_REQUEST["operation"];
+ $groupop = $_REQUEST["groupop"];
+ $hosts = $this->config->getData("hosts");
+ $groups = $this->config->getData("hostgroups");
+
+ // first check if nogroup is selected
+ if(isset($_REQUEST["nonegroup-selected"])) {
+ echo "nonegroup operation
";
+ }
+
+ foreach($hosts as $key=>$val) {
+ $hname = $val["category"];
+ $hip = $val["name"];
+ $hg = $val["val"];
+ if(isset($_REQUEST["$hname-selecthost"])) {
+ echo "Select host, $hname true
";
+ }
+ }
+
+ foreach($groups as $key=>$val) {
+ $grpname = $val["category"];
+ if(isset($_REQUEST["$grpname-selectgroup"])) {
+ echo "Select group, $grpname true
";
+ }
+ }
+
+ }
+
+ function deleteGroup($url)
+ {
+ $grpname = $_REQUEST["grpname"];
+ $this->config->delData("hostgroups", "$grpname");
+ $hosts = $this->config->getData("hosts");
+ foreach($hosts as $key=>$val) {
+ $hname = $val["category"];
+ $hip = $val["name"];
+ $hg = $val["val"];
+
+ if($hg == $grpname) {
+ $this->config->delData("hosts", "$hname", "$hip", "$hg");
+ $this->config->addData("hosts", "$hname", "$hip", "");
+ }
+ }
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/hosts");
+
+ }
+
function scanIPRange($url)
{
$iprange = $_REQUEST["scanip"];
@@ -153,37 +210,68 @@ class GLCASHosts {
$hosts = $this->config->getData("hosts");
$groups = $this->config->getData("hostgroups");
- echo "
Hosts
";
- if($hosts) {
- echo "Host | IP | Host Group | Last Seen | Control |
";
- foreach($hosts as $key => $val) {
- $hname = $val["category"];
- $hip = $val["name"];
- $hg = $val["val"];
- if($hg == "") $hg = "-";
- echo "$hname | $hip | $hg | ... | Delete |
";
- }
- echo "
";
- } else {
- echo "No hosts defined yet
";
+ $gs = 0;
+ echo "Hosts and Groups
";
+ echo "";
+
echo "
";
+
echo "";
// the add hosts dialog
|