Code

added seperated dns class for network devices
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 Jan 2006 08:52:22 +0000 (08:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 Jan 2006 08:52:22 +0000 (08:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2607 594d385d-05f5-0310-b6e9-bd551577e9d8

19 files changed:
plugins/admin/systems/class_componentGeneric.inc
plugins/admin/systems/class_phoneGeneric.inc
plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_servDB.inc
plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/class_servGeneric.inc
plugins/admin/systems/class_termDNS.inc [new file with mode: 0644]
plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_winGeneric.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/component.tpl
plugins/admin/systems/phone.tpl
plugins/admin/systems/printer.tpl
plugins/admin/systems/servdns.tpl
plugins/admin/systems/server.tpl
plugins/admin/systems/termdns.tpl [new file with mode: 0644]
plugins/admin/systems/terminal.tpl
plugins/admin/systems/wingeneric.tpl
plugins/admin/systems/workstation.tpl

index c3edb7590b5cdf721309ef332222f92d32d55f80..164b4aa7cd10683407f23e14d2560549414090db 100644 (file)
@@ -14,14 +14,13 @@ class componentGeneric extends plugin
   /* Needed values and lists */
   var $base= "";
   var $cn= "";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $description= "";
   var $orig_dn= "";
 
   /* attribute list for save action */
-  var $attributes= array("cn", "description", "macAddress", "ipHostNumber");
+  var $attributes= array("cn", "description");
   var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
+  var $netConfigDNS;
 
   function componentgeneric ($config, $dn= NULL)
   {
@@ -35,7 +34,7 @@ class componentGeneric extends plugin
     } else {
       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
     }
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
   }
@@ -63,11 +62,8 @@ class componentGeneric extends plugin
     }
     $smarty->assign("base_select", $this->base);
 
-    /* Show Asterisk for required attribute ipHostNumber and macAddress */
-    $smarty->assign("staticAddress", "<font class=\"must\">*</font>");
-    
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     return($smarty->fetch (get_template_path('component.tpl', TRUE)));
   }
 
@@ -86,7 +82,7 @@ class componentGeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -95,6 +91,8 @@ class componentGeneric extends plugin
   {
     plugin::save_object();
 
+    $this->netConfigDNS->save_object();
+
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -106,18 +104,14 @@ class componentGeneric extends plugin
   function check()
   {
     $message= array();
+
+    $message = array_merge($message,$this->netConfigDNS->check());
+
     $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
 
-    /* must: cn, macAddress, ipHostNumber */
     if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
       $message[]= _("The required field 'Component name' is not set.");
     }
-    if ($this->macAddress == "" && chkacl ($this->acl, "macAddress") == ""){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
-      $message[]= _("The required field 'IP-address' is not set.");
-    }
 
     $ui= get_userinfo();
     $acl= get_permissions ($this->dn, $ui->subtreeACL);
@@ -178,6 +172,9 @@ class componentGeneric extends plugin
       $ldap->modify($this->attrs);
       $this->handle_post_events("modify");
     }
+
+    $this->netConfigDNS->save($this->dn);
+
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */
index 13fa101e9c681bb199396f27ecff570115becbf0..97325ea6709d5f071d8cbde8dea27c19b85f8467 100644 (file)
@@ -14,8 +14,6 @@ class phoneGeneric extends plugin
   /* Needed values and lists */
   var $base             = "";
   var $cn               = "";
-  var $macAddress       = "";
-  var $ipHostNumber     = "";
   var $description      = "";
   var $orig_dn          = "";
   var $goFonType        = "";
@@ -33,23 +31,24 @@ class phoneGeneric extends plugin
   var $goFonAccountCode = "";
   var $goFonMSN         = "";
   var $selected_categorie    = 0;
+  var $netConfigDNS;
 
   /* attribute list for save action */
-  var $attributes= array("cn", "description", "macAddress", "ipHostNumber"
-                         ,"goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
+  var $attributes= array("cn", "description", 
+                          "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
                           "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
                           "goFonTrunk","goFonAccountCode","goFonMSN","selected_categorie","goFonPermit","goFonDeny" 
                          );
 
   /* this array defines which attributes are schown / saved for the different type of phones */ 
-  var $usedattrs =    array( "0"=>array("cn", "description", "macAddress", "ipHostNumber",
+  var $usedattrs =    array( "0"=>array("cn", "description", 
                                   "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
                                   "goFonQualify"),
-                             "1"=>array("cn", "description", "macAddress", "ipHostNumber",
+                             "1"=>array("cn", "description", 
                                   "goFonType","goFonHost","goFonDefaultIP",
                                   "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
                                   "goFonTrunk","goFonAccountCode","selected_categorie","goFonPermit","goFonDeny"),
-                             "2"=>array("cn", "description", "macAddress", "ipHostNumber","goFonMSN"));
+                             "2"=>array("cn", "description", "goFonMSN"));
   
 
   var $objectclasses= array("top", "goFonHardware");
@@ -57,6 +56,7 @@ class phoneGeneric extends plugin
   function phonegeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
 
     /* Set base */
     if ($this->dn == "new"){
@@ -197,11 +197,8 @@ class phoneGeneric extends plugin
    
     $smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings")));
  
-    /* Show Asterisk for required attribute ipHostNumber and macAddress */
-    $smarty->assign("staticAddress", "<font class=\"must\">*</font>");
-        
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     $smarty->assign("phonesettings", dirname(__FILE__)."/phonesettings.tpl");
     return($smarty->fetch (get_template_path('phone.tpl', TRUE)));
   }
@@ -230,7 +227,7 @@ class phoneGeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -238,7 +235,7 @@ class phoneGeneric extends plugin
   function save_object()
   {
     plugin::save_object();
-
+    $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -249,7 +246,7 @@ class phoneGeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message= $this->netConfigDNS->check();
     $this->dn= "cn=".$this->cn.",ou=phones,ou=systems,".$this->base;
 
     /* To check for valid ip*/
@@ -268,27 +265,12 @@ class phoneGeneric extends plugin
 //      } 
 //    }
 
-    /* must: cn, macAddress, ipHostNumber */
     if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
       $message[]= _("The required field 'Phone name' is not set.");
     }
     if ($this->cn == "0" && chkacl ($this->acl, "cn") == ""){
       $message[]= _("The 'Phone name' '0' is reserved and cannot be used.");
     }
-    if ($this->macAddress == "" && chkacl ($this->acl, "macAddress") == ""){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
-      $message[]= _("The required field 'IP-address' is not set.");
-    }
-    if (!preg_match("/^$num\\.$num\\.$num\\.$num$/", $this->ipHostNumber)){
-       $message[]= _("Wrong IP format in field IP-address.");
-    }
-    
-    $tr = count(split(":",$this->macAddress));
-    if($tr!=6){
-      $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
-    }
 
     $ui= get_userinfo();
     $acl= get_permissions ($this->dn, $ui->subtreeACL);
@@ -354,7 +336,7 @@ class phoneGeneric extends plugin
     }
 
     if($this->goFonDefaultIP!="dynamic"){
-      $this->attrs['goFonDefaultIP'] = $this->ipHostNumber;
+      $this->attrs['goFonDefaultIP'] = $this->netConfigDNS->ipHostNumber;
     }    
 
     /* Write back to ldap */
@@ -383,6 +365,9 @@ class phoneGeneric extends plugin
       }
       $this->handle_post_events("modify");
     }
+    
+    $this->netConfigDNS->save($this->dn);
+
     show_ldap_error($ldap->get_error());
     /* Optionally execute a command after we're done */
     $this->postcreate();
index 24fe12cf057acbee5ddc243475a043dc437aba20..95d2a983c63cc854a0604697e84f23c1ea29612e 100644 (file)
@@ -14,8 +14,6 @@ class printgeneric extends plugin
   /* Needed values and lists */
   var $base             = "";
   var $cn               = "";
-  var $macAddress       = "";
-  var $ipHostNumber     = "";
   var $l                = "";
   var $description      = "";
   var $labeledURI       = "";
@@ -40,14 +38,19 @@ class printgeneric extends plugin
   var $type             = "";
   var $dialog           =NULL;
 
+  var $netConfigDNS;
+
   /* attribute list for save action */
-  var $attributes     = array("cn", "description", "l", "labeledURI", "macAddress", "ipHostNumber","gotoPrinterPPD");
+  var $attributes     = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD");
   var $objectclasses  = array("top", "gotoPrinter");
 
   function printgeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
     $ldap= $this->config->get_ldap_link();
+    
+    $this->netConfigDNS = new termDNS($this->config, $this->dn,$this->objectclasses);
+
 
     /* Set base */
     if ($this->dn == "new"){
@@ -371,10 +374,6 @@ class printgeneric extends plugin
       return $display;
     }
 
-    /* Don't show Asterisk for non-required attribute ipHostNumber and macAddress */
-    $smarty->assign("staticAddress", "");
-
-
     require_once ("class_ppdManager.inc");
 
     if((isset($_SESSION['config']->data['MAIN']['PPD_PATH']))&&(is_dir($_SESSION['config']->data['MAIN']['PPD_PATH']))){
@@ -422,7 +421,7 @@ class printgeneric extends plugin
     $smarty->assign("AdminMember"    ,$this->AdminMember);
     $smarty->assign("AdminMembers"   ,$adminlist);
     $smarty->assign("AdminMemberKeys",array_flip($adminlist));
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
 
     return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
   }
@@ -446,14 +445,16 @@ class printgeneric extends plugin
           unset($og->member[$this->dn]);
           $og->save ();
         }
+    
+        $this->netConfigDNS->remove_from_parent();
       }
     }
   }
-    /* Save data to object */
-    function save_object()
+  /* Save data to object */
+  function save_object()
   {
     plugin::save_object();
-
+    $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -463,7 +464,7 @@ class printgeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message= $this->netConfigDNS->check();
 
     if(isset($this->parent->by_name['workgeneric'])){
       if($this->parent->by_object['workgeneric']->cn == "wdefault"){
@@ -620,6 +621,8 @@ class printgeneric extends plugin
     }
     show_ldap_error($ldap->get_error());
 
+    $this->netConfigDNS->save($this->dn);
+
     /* Optionally execute a command after we're done */
     $this->postcreate();
   }
index 2ee9f873de7001fedb1e3852cd3d82533e282cd2..de62146352b771630dc1d21bb810415ef51eea58 100644 (file)
@@ -83,9 +83,6 @@ class servdb extends plugin
       $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
     }
 
-    /* Don't show Asterisk for non-required attribute ipHostNumber and macAddress */
-    $smarty->assign("staticAddress", "");
-
     /* Classes... */
     foreach ($this->additionaloc as $oc => $dummy){
       if (isset($this->objectclasses[$oc])){
index ab9342ead7de8de3f4fd932561ec56947616d6b1..fa48534c49945a75f4d6f3b004538c37d51fae9c 100644 (file)
@@ -9,12 +9,124 @@ class servdns extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes= array();
+  var $attributes= array("zoneName","relativeDomainName","dNSTTL","dNSClass","sOARecord"); 
   var $objectclasses= array("whatever");
 
+  var $RecordTypes = array();
+  var $usedRecords = array();
+
+  var $Zones = array();
+  var $editMode = false;
+
   function servdns ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
+    
+    $RecordTypes['ARecord']     ['name']  ="A Record";
+    $RecordTypes['ARecord']     ['type']  ="string";
+    $RecordTypes['MDRecord']    ['name']  ="MD Record";
+    $RecordTypes['MDRecord']    ['type']  ="string";
+    $RecordTypes['MXRecord']    ['name']  ="MX Record";
+    $RecordTypes['MXRecord']    ['type']  ="string";
+    $RecordTypes['NSRecord']    ['name']  ="NS Record";
+    $RecordTypes['NSRecord']    ['type']  ="string";
+    $RecordTypes['CNAMERecord'] ['name']  ="CNAME Record";
+    $RecordTypes['CNAMERecord'] ['type']  ="string";
+    $RecordTypes['PTRRecord']   ['name']  ="PTR Record";
+    $RecordTypes['PTRRecord']   ['type']  ="string";
+    $RecordTypes['HINFORecord'] ['name']  ="HINFO Record";
+    $RecordTypes['HINFORecord'] ['type']  ="string";
+    $RecordTypes['MINFORecord'] ['name']  ="MINFO Record";
+    $RecordTypes['MINFORecord'] ['type']  ="string";
+    $RecordTypes['TXTRecord']   ['name']  ="TXT Record";
+    $RecordTypes['TXTRecord']   ['type']  ="string";
+    $RecordTypes['AFSDBRecord'] ['name']  ="AFSDB Record";
+    $RecordTypes['AFSDBRecord'] ['type']  ="string";
+    $RecordTypes['SIGRecord']   ['name']  ="SIG Record";
+    $RecordTypes['SIGRecord']   ['type']  ="string";
+    $RecordTypes['KEYRecord']   ['name']  ="KEY Record";
+    $RecordTypes['KEYRecord']   ['type']  ="string";
+    $RecordTypes['AAAARecord']  ['name']  ="AAAA Record";
+    $RecordTypes['AAAARecord']  ['type']  ="string";
+    $RecordTypes['LOCRecord']   ['name']  ="LOC Record";
+    $RecordTypes['LOCRecord']   ['type']  ="string";
+    $RecordTypes['NXTRecord']   ['name']  ="NXT Record";
+    $RecordTypes['NXTRecord']   ['type']  ="string";
+    $RecordTypes['SRVRecord']   ['name']  ="SRV Record";
+    $RecordTypes['SRVRecord']   ['type']  ="string";
+    $RecordTypes['NAPTRRecord'] ['name']  ="NAPTR Record";
+    $RecordTypes['NAPTRRecord'] ['type']  ="string";
+    $RecordTypes['KXRecord']    ['name']  ="KX Record";
+    $RecordTypes['KXRecord']    ['type']  ="string";
+    $RecordTypes['CERTRecord']  ['name']  ="CERT Record";
+    $RecordTypes['CERTRecord']  ['type']  ="string";
+    $RecordTypes['A6Record']    ['name']  ="A6 Record";
+    $RecordTypes['A6Record']    ['type']  ="string";
+    $RecordTypes['DNAMERecord'] ['name']  ="DBNAME Record";
+    $RecordTypes['DNAMERecord'] ['type']  ="string";
+    $RecordTypes['DSRecord']    ['name']  ="DS Record";
+    $RecordTypes['DSRecord']    ['type']  ="string";
+    $RecordTypes['SSHFPRecord'] ['name']  ="SSHFP Record";
+    $RecordTypes['SSHFPRecord'] ['type']  ="string";
+    $RecordTypes['RRSIGRecord'] ['name']  ="RRSIG Record";
+    $RecordTypes['RRSIGRecord'] ['type']  ="string";
+    $RecordTypes['NSECRecord']  ['name']  ="NSEC Record";
+    $RecordTypes['NSECRecord']  ['type']  ="string";
+    $RecordTypes['mXRecord']  ['name']  ="MX Record";
+    $RecordTypes['mXRecord']  ['type']  ="string";
+    $RecordTypes['nSRecord']  ['name']  ="nS Record";
+    $RecordTypes['nSRecord']  ['type']  ="string";
+
+    $this->RecordTypes = $RecordTypes;
+
+    $attrs  = $this->attributes;
+    foreach($RecordTypes as $name => $att){
+      $attrs2[] = $name;
+    } 
+    $attrs3 = array_merge($attrs,$attrs2);
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->search("(&(objectClass=dNSZone)(sOARecord=*))",$attrs3);
+    while($zone = $ldap->fetch()){
+      $tmp = array();
+      foreach($attrs as $att){
+        if(isset($zone[$att]['count'])&&(is_array($zone[$att])))
+        unset($zone[$att]['count']);
+        
+        if(isset($zone[$att])){ 
+          $tmp[$att] = $zone[$att][0];
+        }else{
+          $tmp[$att] = "";
+        }
+      }
+
+      if(isset($tmp['sOARecord'])){
+        $tmp2 = split("\ ",$tmp['sOARecord']);
+        unset($tmp['sOARecord']);
+        $tmp['sOARecord'] = array();
+        $tmp['sOARecord']['sOAprimary'] = $tmp2[0];
+        $tmp['sOARecord']['sOAmail']    = $tmp2[1];
+        $tmp['sOARecord']['sOAserial']  = $tmp2[2];
+        $tmp['sOARecord']['sOArefresh'] = $tmp2[3];
+        $tmp['sOARecord']['sOAretry']   = $tmp2[4];
+        $tmp['sOARecord']['sOAexpire']  = $tmp2[5];
+        $tmp['sOARecord']['sOAttl']     = $tmp2[6];
+      }
+
+      $tmp['usedRecords'] = array();
+      foreach($attrs2 as $name){
+        if(isset($zone[$name])){
+          for($i = 0 ; $i < $zone[$name]['count'] ; $i++ ){
+            $tmp['usedRecords'][] =  array("type"=> $name,"value"=>$zone[$name][$i]);
+          }
+        }
+      }
+      $this->Zones[$zone['zoneName'][0]] = $tmp;
+    }
+    if(count($this->Zones > 0)){
+      $this->is_account = true;
+    }
   }
 
   function execute()
@@ -41,6 +153,43 @@ class servdns extends plugin
       return ($display);
     }
 
+    $once = false;
+    foreach( $_POST as $name => $value){
+      if(preg_match("/^editZone_/",$name)&&!$once){
+        $once =true;
+        $tmp = preg_replace("/^editZone_/","",$name);
+        $tmp = base64_decode(preg_replace("/_.*$/","...",$tmp));
+        $this->editMode = $this->Zones[$tmp];
+      }
+    }
+
+
+    $smarty->assign("editMode",$this->editMode);
+    if($this->editMode){
+
+      foreach($this->attributes as $attrs){
+        $smarty->assign($attrs,$this->editMode[$attrs]);
+      }
+      
+      foreach($this->editMode['sOARecord'] as $name => $value){
+        $smarty->assign($name,$value);
+      }
+      $smarty->assign("records","");
+
+    }else{
+      $ZoneList = new divSelectBox("dNSZones");
+      $ZoneList -> SetHeight(254);
+
+      $editImg = "<input type='image' src='images/edit.png' name='editZone_%s'>";
+
+      foreach($this->Zones as $zone => $values ){
+        $ZoneList->AddEntry(array(array("string" => $zone.str_replace("%s",base64_encode($zone),$editImg))));
+      }    
+
+
+      $smarty->assign("ZoneList",$ZoneList->DrawList());
+    }
+
     $display.= $smarty->fetch(get_template_path('servdns.tpl', TRUE));
     return($display);
   }
@@ -54,7 +203,22 @@ class servdns extends plugin
   /* Save data to object */
   function save_object()
   {
-    plugin::save_object();
+    //plugin::save_object();
+
+    if(!$this->editMode){return;}
+
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->editMode[$attr] = $_POST[$attr];
+      }
+    }
+
+    foreach($this->editMode['sOARecord'] as $name => $value){
+      if(isset($_POST[$name])){
+        $this->editMode['sOARecord'][$name] = $_POST[$name];
+      }
+    }
+
   }
 
 
index b85d9c834acfad10647d435721ebd3500e23d48e..0c7c0d99e1ab6dc1619639032ec911d159a57ac6 100644 (file)
@@ -15,15 +15,15 @@ class servgeneric extends plugin
   var $base= "";
   var $cn= "";
   var $l= "";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $description= "";
   var $orig_dn= "";
 
   /* attribute list for save action */
-  var $attributes= array("cn", "description", "macAddress", "ipHostNumber");
+  var $attributes= array("cn", "description");
   var $objectclasses= array("top", "goServer");
 
+  var $netConfigDNS;
+
   function servgeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -36,7 +36,7 @@ class servgeneric extends plugin
     } else {
       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
     }
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
   }
@@ -61,7 +61,7 @@ class servgeneric extends plugin
           if ($cmd == ""){
             print_red(_("No WAKECMD definition found in your gosa.conf"));
           } else {
-            exec ($cmd." ".$this->macAddress, $dummy, $retval);
+            exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval);
             if ($retval != 0){
               print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
             }
@@ -119,7 +119,7 @@ class servgeneric extends plugin
 
 
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
 
     return($smarty->fetch (get_template_path('server.tpl', TRUE)));
   }
@@ -138,7 +138,7 @@ class servgeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
     $this->handle_post_events("remove");
   }
 
@@ -147,7 +147,7 @@ class servgeneric extends plugin
   function save_object()
   {
     plugin::save_object();
-
+    $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -158,7 +158,7 @@ class servgeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message= $this->netConfigDNS->check();
     $this->dn= "cn=".$this->cn.",ou=servers,ou=systems,".$this->base;
 
     /* must: cn */
@@ -235,6 +235,7 @@ class servgeneric extends plugin
       $ldap->modify($this->attrs);
       $mode= "modify";
     }
+    $this->netConfigDNS->save($this->dn);
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */
diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc
new file mode 100644 (file)
index 0000000..f3cfc4e
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+
+class termDNS extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes= array("ipHostNumber","macAddress");
+  var $objectclasses= array("whatever");
+
+  var $ipHostNumber ="";
+  var $macAddress ="";  
+
+  function termDNS ($config, $dn,$objectClasses)
+  {
+    $this->objectclasses= $objectClasses;
+    plugin::plugin ($config, $dn);
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+    $smarty= get_smarty();
+    $display= "";
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+    $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* This cannot be removed... */
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save($dn)
+  {
+    $org_dn = $dn;
+    $this->dn = $dn;
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 5c825dcaead8423c96fba623721c7baf0c7f3af0..e6a949ab3e8b677588bb39666b7cc24f348e99e4 100644 (file)
@@ -18,8 +18,6 @@ class termgeneric extends plugin
   var $gotoCdromEnable= "";
   var $ghCpuType= "-";
   var $ghMemSize= "-";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $ghUsbSupport= "-";
   var $ghNetNic= array();
   var $ghIdeDev= array();
@@ -27,7 +25,7 @@ class termgeneric extends plugin
   var $ghGfxAdapter= "-";
   var $ghSoundAdapter= "-";
   var $gotoLastUser= "-";
-
+  var $netConfigDNS;
   /* Needed values and lists */
   var $base= "";
   var $cn= "";
@@ -38,17 +36,17 @@ class termgeneric extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes= array("gotoMode", "gotoTerminalPath", "macAddress",
+  var $attributes= array("gotoMode", "gotoTerminalPath", 
       "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
-      "ghCpuType", "ghMemSize", "ipHostNumber", "ghUsbSupport",
+      "ghCpuType", "ghMemSize","ghUsbSupport",
       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
   var $objectclasses= array("top", "gotoTerminal", "GOhard");
 
   function termgeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Read arrays */
     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
       if (!isset($this->attrs[$val])){
@@ -91,7 +89,7 @@ class termgeneric extends plugin
           if ($cmd == ""){
             print_red(_("No WAKECMD definition found in your gosa.conf"));
           } else {
-            exec ($cmd." ".$this->macAddress, $dummy, $retval);
+            exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval);
             if ($retval != 0){
               print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
             }
@@ -182,11 +180,9 @@ class termgeneric extends plugin
       $smarty->assign($val."_select", $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
-    $smarty->assign("ipHostNumber", $this->ipHostNumber);
-    $smarty->assign("macAddress", $this->macAddress);
 
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     $smarty->assign("actionACL", chkacl($this->acl, 'action'));
     return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
   }
@@ -213,6 +209,7 @@ class termgeneric extends plugin
         unset($og->member[$this->dn]);
         $og->save ();
       }
+      $this->netConfigDNS->remove_from_parent();
     }
   }
 
@@ -221,7 +218,7 @@ class termgeneric extends plugin
   function save_object()
   {
     plugin::save_object();
-
+    $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -236,7 +233,7 @@ class termgeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message= $this->netConfigDNS->check();
 
     /* Permissions for that base? */
     $this->dn= "cn=".$this->cn."ou=terminals,ou=systems,".$this->base;
@@ -322,6 +319,7 @@ class termgeneric extends plugin
       $ldap->modify($this->attrs);
       $this->handle_post_events("modify");
     }
+    $this->netConfigDNS->save($this->dn);
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */
index 82b847a796a17f1617bb9746cd58972f05f543f4..4fc4ab92e44123b194729f50189e631c33096344 100644 (file)
@@ -34,7 +34,7 @@ class wingeneric extends plugin
   var $sambaNTPassword="";
   var $sambaPwdLastSet="";
   var $sambaAcctFlags="";
-
+  var $netConfigDNS;
   /* attribute list for save action */
   var $ignore_account= TRUE;
   var $attributes   = array("cn", "description","shadowLastChange",
@@ -48,7 +48,7 @@ class wingeneric extends plugin
   function wingeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Set base */
     if ($this->dn == "new"){
       $ui= get_userinfo();
@@ -78,9 +78,6 @@ class wingeneric extends plugin
     $smarty= get_smarty();
 
     // Undefined index in wingeneric.tpl ... 
-    $smarty->assign("macAddress","");
-    $smarty->assign("ipHostNumber","");
-
     $smarty->assign("bases", $this->config->idepartments);
 
     /* Assign attributes */
@@ -89,13 +86,10 @@ class wingeneric extends plugin
       $smarty->assign("$attr", $this->$attr);
     }
     
-    /* Show Asterisk for required attribute ipHostNumber and macAddress */
-    $smarty->assign("staticAddress", "<font class=\"must\">*</font>");
-    
     $smarty->assign("base_select", $this->base);
 
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     return($smarty->fetch (get_template_path('wingeneric.tpl', TRUE)));
   }
 
@@ -114,7 +108,7 @@ class wingeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -122,7 +116,7 @@ class wingeneric extends plugin
   function save_object()
   {
     plugin::save_object();
-
+    $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -133,22 +127,9 @@ class wingeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message=$this->netConfigDNS->check();
     $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
 
-
-    /* must: cn, macAddress */
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
-      $message[]= _("The required field 'Component name' is not set.");
-    }
-
-/*    if ($this->macAddress == "" && chkacl ($this->acl, "macAddress") == ""){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
-      $message[]= _("The required field 'IP-address' is not set.");
-    }
-*/
     $ui= get_userinfo();
     $acl= get_permissions ($this->dn, $ui->subtreeACL);
     $acl= get_module_permission($acl, "component", $this->dn);
@@ -208,6 +189,7 @@ class wingeneric extends plugin
       $ldap->modify($this->attrs);
       $this->handle_post_events("modify");
     }
+    $this->netConfigDNS->save($this->dn);
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */
index 33a49bcb040347a9de0ab30398f0989b91ac99b5..88abf046654cc65fea107de49e8fdad174eaba4b 100644 (file)
@@ -16,8 +16,6 @@ class workgeneric extends plugin
   var $gotoCdromEnable= "";
   var $ghCpuType= "-";
   var $ghMemSize= "-";
-  var $macAddress= "";
-  var $ipHostNumber= "";
   var $ghUsbSupport= "-";
   var $ghNetNic= array();
   var $ghIdeDev= array();
@@ -37,18 +35,20 @@ class workgeneric extends plugin
   /* Plugin side filled */
   var $modes= array();
 
+  var $netConfigDNS;
+
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes= array("gotoMode", "macAddress", "gotoSyslogServer", "gotoNtpServer",
+  var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
-      "ghCpuType", "ghMemSize", "ghUsbSupport", "ipHostNumber",
+      "ghCpuType", "ghMemSize", "ghUsbSupport",
       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
   var $objectclasses= array("top", "gotoWorkstation", "GOhard","FAIobject");
 
   function workgeneric ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
-
+    $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Load available modes */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd ($this->config->current['BASE']);
@@ -99,7 +99,7 @@ class workgeneric extends plugin
       if ($cmd == ""){
         print_red(_("No ACTIONCMD definition found in your gosa.conf"));
       } else {
-        exec ($cmd." ".$this->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
+        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
         if ($retval != 0){
           print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
         } else {
@@ -149,12 +149,10 @@ class workgeneric extends plugin
       $smarty->assign($val."_select", $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
-    $smarty->assign("ipHostNumber", $this->ipHostNumber);
-    $smarty->assign("macAddress", $this->macAddress);
     $smarty->assign("actionACL", chkacl($this->acl, 'action'));
 
     /* Show main page */
-    $smarty->assign("netconfig", dirname(__FILE__)."/network.tpl");
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
     return($smarty->fetch (get_template_path('workstation.tpl', TRUE)));
   }
 
@@ -175,7 +173,7 @@ class workgeneric extends plugin
       unset($og->member[$this->dn]);
       $og->save ();
     }
-
+    $this->netConfigDNS->remove_from_parent();
   }
 
 
@@ -188,13 +186,14 @@ class workgeneric extends plugin
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
     }
+    $this->netConfigDNS->save_object();
   }
 
 
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    $message=$this->netConfigDNS->check();
 
     $ui= get_userinfo();
     $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base;
@@ -282,6 +281,7 @@ class workgeneric extends plugin
         $this->handle_post_events("modify");
       }
     }
+    $this->netConfigDNS->save($this->dn);
     show_ldap_error($ldap->get_error());
   }
 
index ce04d6ffec7a9e853ec8f126384d099c65b51a74..a1581c2d5850f6877e63920675d5b8ef2a685530 100644 (file)
@@ -31,7 +31,7 @@
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{include file="$netconfig"}
+{$netconfig}
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
index a431d4c852ad2bf26bb281f7d56230d8b092fd96..f08591542a084afce61f9dc343bb5204248c5daf 100644 (file)
@@ -33,7 +33,7 @@
 {include file="$phonesettings"}
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-{include file="$netconfig"}
+{$netconfig}
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
index db4c23e388dc77e1f915b5d3a7a5f8f017fb4805..37b42402fd5384de569e385c6c35502e57521091 100644 (file)
@@ -95,7 +95,7 @@
 
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-{include file="$netconfig"}
+{$netconfig}
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
index 449ac7ba2f406bba81a7cb3fce958735fc5aa2e7..74251e2a46b851b521b88e66b48432f063ba80d5 100644 (file)
@@ -1 +1,126 @@
-DNS functionality here..
+{if $editMode == false}
+<h2>{t}Zones{/t}</h2>
+<table summary="" width="100%">
+<tr>
+       <td style="width:100%;vertical-align:top;">
+               {$ZoneList}
+               <input type="submit" name="AddZone" value="{t}Add{/t}">
+               <input type="submit" name="EditZone" value="{t}Edit{/t}">
+               <input type="submit" name="RemoveZone" value="{t}Remove{/t}">
+       </td>
+</tr>
+</table>
+{else}
+<h2>{t}Zone settings{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td style="width:50%;vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Zone name{/t}
+                                       </td>
+                                       <td><input type="text" name="zoneName" value="{$zoneName}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Subnet{/t}
+                                       </td>
+                                       <td><input type="text" name="subNet" value="">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<h2>{t}SOA record for this zone{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td style="vertical-align:top;width:50%">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Primary dns server for this zone{/t}
+                                       </td>
+                                       <td><input type="text" name="sOAprimary" value="{$sOAprimary}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Mail address{/t}
+                                       </td>
+                                       <td><input type="text" name="sOAmail" value="{$sOAmail}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Serialnumber (automatically generated){/t}
+                                       </td>
+                                       <td><input type="text" name="sOAserial" value="{$sOAserial}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Refresh{/t}
+                                       </td>
+                                       <td><input type="text" name="sOArefresh" value="{$sOArefresh}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Retry{/t}
+                                       </td>
+                                       <td><input type="text" name="sOAretry" value="{$sOAretry}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Expire{/t}
+                                       </td>
+                                       <td><input type="text" name="sOAexpire" value="{$sOAexpire}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}TTL{/t}
+                                       </td>
+                                       <td><input type="text" name="sOAttl" value="{$sOAttl}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+<table summary="" width="100%">
+       <tr>
+               <td style="vertical-align:top;width:50%;">
+                       <h2>{t}Parameter{/t}</h2>
+                       <table summary="">
+                               <tr>
+                                       <td>{t}DNS TTL{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="dNSTTL" value="{$dNSTTL}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}DNS Class{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="dNSClass" value="{$dNSClass}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <h2>{t}Records{/t}</h2>
+                       <table summary="">
+                         {$records}
+                       </table>
+               </td>
+       </tr>
+</table>
+{/if}
index 4d632c1ff26aabc2055a03f9e0995c0d341f164d..fe84f853c9859706f00b8ef12e9f36f17074adaf 100644 (file)
@@ -31,7 +31,7 @@
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{include file="$netconfig"}
+{$netconfig}
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
diff --git a/plugins/admin/systems/termdns.tpl b/plugins/admin/systems/termdns.tpl
new file mode 100644 (file)
index 0000000..cc03d4e
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+<h2></h2>
index 1d657366878b4eb40a76113acb758d175f1dfac0..2da3738a63e7e68d2a0ddd594ee2938afd43ac56 100644 (file)
@@ -93,7 +93,7 @@
 </table>
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{include file="$netconfig"}
+{$netconfig}
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 <h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
index 3b58f19c6d659d9a67f91df40e80b79fb6272e21..d7f69b66bfe8028f0b6ba37420b7813a08551ac6 100644 (file)
@@ -31,7 +31,7 @@
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{include file="$netconfig"}
+{$netconfig}
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
index ddb7cabb81f830d9e59c4cdbc5b387f7b5fafb12..d278f53140edc6febda01107a8805532fddc1aff 100644 (file)
@@ -72,7 +72,7 @@
 </table>
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{include file="$netconfig"}
+{$netconfig}
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 <h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>