Code

- Correcting spelling
[gosa.git] / plugins / admin / systems / class_servDHCP.inc
index 6390172a5e29219982fee87d728fbf361a885bba..d883bf4ae9173537b704eee070159493f9c8463d 100644 (file)
@@ -21,6 +21,7 @@ class servdhcp extends plugin
 
   var $dhcp_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
   var $take_over_id       = -1;
+  var $display_warning  = TRUE;
 
   function servdhcp ($config, $dn= NULL, $parent= NULL)
   {
@@ -55,12 +56,6 @@ class servdhcp extends plugin
   }
 
   
-  function take_over_service()
-  {
-    
-  }
-
-
   function get_list_of_dhcp_servers()
   {
     $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
@@ -83,20 +78,6 @@ class servdhcp extends plugin
   }  
 
 
-  function get_dhcp_info_string($id)
-  {
-    $ret = "";
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd("cn=dhcp,".$this->dhcp_server_list['ENTRIES'][$id]['dn']);
-    $ldap->search("(|(objectClass=dhcpSharedNetwork)(objectClass=dhcpSubnet)(objectClass=dhcpPool)(objectClass=dhcpGroup)(objectClass=dhcpHost))",array("dn","cn"));
-    $ldap->search("(objectClass=*)",array("dn","cn"));
-    while($attrs = $ldap->fetch()){
-      $ret .= $attrs['dn']."\n";
-    }
-    return($ret);
-  }
-
-
   function execute()
   {
     /* Call parent execute */
@@ -137,13 +118,15 @@ class servdhcp extends plugin
     if($this->take_over_id != -1){
       $this->dialog = FALSE;
       $id = $this->take_over_id;
-      $info = $this->get_dhcp_info_string($id);
       $smarty->assign("dns_take_over",TRUE);
-      $smarty->assign("info",$info);
-      $warning = sprintf(_("You are going to take over the dhcp setup from server '%s'."),$this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
-      $warning2 = _("The take over will be startet when you save this system. To abort this action, use the cancel button below."); 
-      $smarty->assign("warning",$warning);
-      $smarty->assign("warning2",$warning2);
+
+     $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),$this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
+     $warning.= " "._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
+
+      if($this->display_warning){
+        print_red($warning);
+        $this->display_warning = FALSE;
+      }
       return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
     }
 
@@ -295,6 +278,16 @@ class servdhcp extends plugin
 
     }
 
+    if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
+      $dn = base64_decode($_GET['id']);
+      if (isset($this->dhcpObjectCache[$dn])){
+        $section= $this->objectType($dn);
+        $this->current_object= $dn;
+        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+      }
+    }
+    
+
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
       $this->is_account= !$this->is_account;
@@ -352,7 +345,9 @@ class servdhcp extends plugin
        
     $tmp = new dhcpNewSectionDialog(NULL);
     foreach($this->dhcpSections as $section => $values ){
-       
+    
+      $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
+       
       if (count($tmp->sectionMap[$this->objectType($section)])){
         if ($this->objectType($section) == "dhcpService"){
           $DhcpList->AddEntry(array(