ispman/lib/ISPMan HostMan.pm,1.17,1.18

Joerg Delker <[email protected]> Mon, 02 Oct 2006 22:23:58 +0000
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32090/lib/ISPMan

Modified Files:
	HostMan.pm 
Log Message:
fixed [ 1553409 ] Web UI: Configure->Hosts and Configure->HostGroups

Index: HostMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/HostMan.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- HostMan.pm	5 Jun 2004 12:45:24 -0000	1.17
+++ HostMan.pm	2 Oct 2006 22:23:56 -0000	1.18
@@ -28,6 +28,7 @@
 @ISA    = qw(ISPMan Exporter AutoLoader);
 @EXPORT = qw(
   addHost
+  addHostForm
   manageHosts
   getHosts
   editHost
@@ -65,11 +66,18 @@
     my $self = shift;
     my $r    = shift;
 
-    $self->add_host(
-        $r->param('ispmanHostName'),  $r->param('ispmanHostIp'),
-        $r->param('ispmanHostAlias'), $r->param('ispmanHostInfo')
-    );
-    $self->manageHosts();
+    if (
+        $self->add_host(
+            $r->param('ispmanHostName'),  $r->param('ispmanHostIp'),
+            $r->param('ispmanHostAlias'), $r->param('ispmanHostInfo')
+        )
+      )
+    {
+        $self->manageHosts();
+    }
+    else {
+        $self->addHostForm();
+    }
 }
 
 sub add_host {
@@ -82,7 +90,7 @@
 
     if ( !$ip || !$hostname ) {
         print "ERROR: No hostname or ip specified";
-        return;
+        return 0;
     }
 
     my $data;
@@ -96,11 +104,7 @@
       "ispmanHostName=$hostname, ou=hosts, @{[$self->getConf('ldapBaseDN')]}";
     $self->addNewEntryWithData( $dn, $data );
 
-#removing for the time being. will come back to this by 0.9
-#$self->addProcessToGroup('ISPMAN_INTERNAL', "monitoringgroup", "AddHostToNetsaint",
-#   join ',', ($hostname, $cn, $ip, $description, $hosttype)
-#   ) if $self->getConf("useNetSaint");
-
+    return 1;
 }
 
 sub modifyHost {
@@ -173,6 +177,14 @@
         "objectclass=ispmanHost" );
 }
 
+sub addHostForm {
+    my $self       = shift;
+    my ($hostname) = @_;
+    my $template   = $self->getTemplate("hosts/addHost.tmpl");
+    print $template->fill_in( PACKAGE => "ISPMan" );
+
+}
+
 sub editHost {
     my $self       = shift;
     my ($hostname) = @_;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV