Code

Added arp-alert device handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 16 Oct 2007 10:36:50 +0000 (10:36 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 16 Oct 2007 10:36:50 +0000 (10:36 +0000)
gosa.conf
    <arpnewdevicetabs>
        <tab class="ArpNewDevice" name="Generic" />
    </arpnewdevicetabs>

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7570 594d385d-05f5-0310-b6e9-bd551577e9d8

contrib/gosa.conf
plugins/admin/systems/ArpNewDevice.tpl [new file with mode: 0644]
plugins/admin/systems/class_ArpNewDevice.inc [new file with mode: 0644]
plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/tabs_arpnewdevice.inc [new file with mode: 0644]

index 027f781e4285f104388c3ee0380dc3b8652ed773..2018dd81600e8d108f7fbfdd34889dfd64a91b78 100644 (file)
                <tab class="reference" name="References" />
        </macrotabs>
 
+<!--
+       <arpnewdevicetabs>
+               <tab class="ArpNewDevice" name="Generic" />
+       </arpnewdevicetabs>
+-->
+
        <termtabs>
                <tab class="termgeneric" name="Generic" />
                <tab class="termstartup" name="Startup" />
diff --git a/plugins/admin/systems/ArpNewDevice.tpl b/plugins/admin/systems/ArpNewDevice.tpl
new file mode 100644 (file)
index 0000000..a508326
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png">{t}Properties{/t}</h2>
+<table summary="">
+<tr>
+ <td style>
+  <LABEL for="cn">
+   {t}Terminal name{/t}
+  </LABEL>
+ </td>
+ <td>
+  <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
+ </td>
+</tr>
+<tr>
+ <td style>
+  <LABEL for="description">
+   {t}Description{/t}
+  </LABEL>
+ </td>
+ <td>
+  <input name="description" id="description" size=18 maxlength=60 value="{$description}">
+ </td>
+</tr>
+</table>
+{$netconfig}
+
+<input type='hidden' name='ArpNewDevice_posted' value='1'>
+
diff --git a/plugins/admin/systems/class_ArpNewDevice.inc b/plugins/admin/systems/class_ArpNewDevice.inc
new file mode 100644 (file)
index 0000000..fb8275b
--- /dev/null
@@ -0,0 +1,69 @@
+<?php 
+class ArpNewDevice extends plugin
+{
+  var $cn= "";
+  var $description = "";
+  var $netConfigDNS = NULL;
+  var $attributes= array("cn","description");
+  var $objectclasses = array("gotoHard");
+
+  var $ignore_account = TRUE;
+
+  function ArpNewDevice ($config, $dn= NULL, $parent= NULL)
+  {
+    plugin :: plugin($config,$dn);
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
+    $this->acl = "#all#";
+    $this->netConfigDNS->acl = $this->acl;
+  }
+
+  function execute()
+  {
+    /* Display sub dialog from network settings */
+    $this->netConfigDNS->acl = $this->acl;
+    if($this->netConfigDNS->dialog){
+      $this->dialog = TRUE;
+      return($this->netConfigDNS->execute());
+    }else{
+      $this->dialog = FALSE;
+    }
+
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $this->netConfigDNS->cn= $this->cn;
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
+    return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE)));
+  }
+
+  function check()
+  {
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+    return($message);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['ArpNewDevice_posted'])){
+      plugin::save_object();
+      $this->netConfigDNS->save_object();
+    }
+  }
+
+  function save()
+  {
+    $this->netConfigDNS->acl = $this->acl;
+    plugin::save();
+    $this->netConfigDNS->cn = $this->cn;    
+    $this->netConfigDNS->save($this->dn);
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->rmdir_recursive($this->dn);
+    show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration."));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 33985e164afae8fede1086f45413dc36e9f7077b..32c68d3b3cd41e07e40a4c1db5b14963f67aa5ee 100644 (file)
@@ -136,9 +136,9 @@ class divListSystem extends MultiSelectWindow
 
     $cnts = array("component" => 0 , "terminal" => 0 , "workstation" => 0 , 
                   "printer" => 0 , "phone" => 0 , "server" => 0,
-                  "NewDevice" => 0, "winstation"=> 0);
+                  "NewDevice" => 0, "winstation"=> 0,"ArpNewDevice"=>0);
 
-    // Test Every Entry and generate divlist Array
+     // Test Every Entry and generate divlist Array
     foreach($terminals as $key => $val){
 
       $acl= get_permissions ($val['dn'], $this->ui->subtreeACL);
@@ -238,7 +238,7 @@ class divListSystem extends MultiSelectWindow
     $str.= "<img class='center' src='images/select_component.png'
               title='".$num_com_str."' alt='".$num_com_str."'>&nbsp;".$cnts['component']."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='images/select_newsystem.png'
-              title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
+              title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".($cnts['NewDevice']+$cnts['ArpNewDevice'])."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='images/select_winstation.png'
               title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='images/folder.png'
index 3ccb872a2b3555b1890b1bc7fd8bb256eaea58d1..37d2aadc50cb20393df256045dbcc1580e37853f 100644 (file)
@@ -24,6 +24,7 @@ require "tabs_phone.inc";
 require "tabs_server.inc";
 require "tabs_component.inc";
 require "tabs_winstation.inc";
+require "tabs_arpnewdevice.inc";
 
 
 class systems extends plugin
@@ -205,7 +206,9 @@ class systems extends plugin
           "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs"));
 
 
-      if($type == "NewDevice"){
+      if($type == "ArpNewDevice"){
+        $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
+      }elseif($type == "NewDevice"){
         $this->systab = new SelectDeviceType($this->config,$this->dn) ;
       }elseif(isset($tabs[$type])){
 
@@ -845,6 +848,8 @@ class systems extends plugin
       $type= "phone";
     }elseif (in_array_ics('goServer', $classes)){
       $type= "server";
+    }elseif (in_array_ics('GOhard', $classes)&& !in_array('gotoMode', $classes)){
+      $type= "ArpNewDevice";
     }elseif (in_array_ics('GOhard', $classes)){
       $type= "NewDevice";
     }elseif (in_array_ics('sambaAccount', $classes) ||
diff --git a/plugins/admin/systems/tabs_arpnewdevice.inc b/plugins/admin/systems/tabs_arpnewdevice.inc
new file mode 100644 (file)
index 0000000..f815a5a
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+class ArpNewDeviceTabs extends tabs
+{
+
+  function save()
+  {
+    tabs::save(TRUE);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>