From: hickert Date: Fri, 24 Aug 2007 09:07:14 +0000 (+0000) Subject: Updated totomasses. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7aba2cf1ec275ed0df56573d22ebd6f444e85764;p=gosa.git Updated totomasses. DNS and DHCP settings will be stored onced for each task, not for each target git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7128 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/addons/gotomasses/class_goto_task.inc b/plugins/addons/gotomasses/class_goto_task.inc index 6ea40603e..dc4652f3e 100644 --- a/plugins/addons/gotomasses/class_goto_task.inc +++ b/plugins/addons/gotomasses/class_goto_task.inc @@ -28,7 +28,7 @@ class goto_task extends plugin var $Initial_Target = array(); var $Actions = array(); var $new = FALSE; - var $attributes = array("OGroup","Minute","Hour","Day","Month","Weekday","Action","Comment","Target","Initial_Target"); + var $attributes = array("Zone","Section","OGroup","Minute","Hour","Day","Month","Weekday","Action","Comment","Target","Initial_Target"); var $configure_dhcp = FALSE; var $configure_dns = FALSE; @@ -54,6 +54,13 @@ class goto_task extends plugin $this->new = TRUE; } + if(!empty($this->Zone) && !preg_match("/^\"\"$/",$this->Zone)){ + $this->configure_dns = TRUE; + } + if(!empty($this->Section) && !preg_match("/^\"\"$/",$this->Section)){ + $this->configure_dhcp = TRUE; + } + /* Set dns and dhcp attributes */ foreach(getAvailableZones($this->config) as $zone){ $name = preg_replace("#^[^/]+/#","",$zone); @@ -119,8 +126,7 @@ class goto_task extends plugin $DHCP = $_POST['Section']; } if(is_mac($MAC)){ - $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME, - "ZONE" => $DNS , "SECTION" => $DHCP); + $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME); } } } @@ -135,7 +141,7 @@ class goto_task extends plugin $line = fgets($fp,512); $tmp = preg_split("/(,|;)/",$line); - $MAC = $IP = $NAME = $ZONE = $SECTION =""; + $MAC = $IP = $NAME; if(isset($tmp[0])){ $MAC = trim($tmp[0]); } @@ -145,14 +151,8 @@ class goto_task extends plugin if(isset($tmp[2])){ $NAME = trim($tmp[2]); } - if(isset($tmp[3])){ - $ZONE = trim($tmp[3]); - } - if(isset($tmp[4])){ - $SECTION = trim($tmp[4]); - } if(is_mac($MAC)){ - $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME,"ZONE"=> $ZONE,"SECTION"=>$SECTION); + $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME); } } } @@ -209,29 +209,13 @@ class goto_task extends plugin $divlist->SetHeader(array( array("string" => _("Target systems") ,"attach" => "style='width:120px;'"), array("string" => _("IP") , "attach" => "style='width:90px;'"), - array("string" => _("DNS") ), - array("string" => _("DHCP") , "attach" => "style='width:120px;'"), array("string" => _("Name") , "attach" => "style='width:150px;'"), array("string" => _("Actions") , "attach" => "style='width:44px;border-right:0px;text-align:right;'"))); foreach($this->Initial_Target as $key => $target){ $field1 = array("string" => $target['MAC'] ,"attach" => "style='width:120px;'"); $field2 = array("string" => $target['IP'] ,"attach" => "style='width:90px;'"); - if(isset($this->Zones[$target['ZONE']])){ - $field2a = array("string" =>"
". - $this->Zones[$target['ZONE']]."
"); - }else{ - $field2a = array("string" => "
". - $target['ZONE']."
"); - } - if(isset($this->Sections[$target['SECTION']])){ - $field2b = array("string" => "
". - $this->Sections[$target['SECTION']]."
","attach" => "style='width:120px;'"); - }else{ - $field2b = array("string" => "
". - $target['SECTION']."
" ,"attach" => "style='width:120px;'"); - } $field3 = array("string" => $target['NAME'] ,"attach" => "style='width:150px;'"); - $divlist->AddEntry(array($field1,$field2,$field2a,$field2b,$field3,preg_replace("/%KEY%/",$key,$field_del))); + $divlist->AddEntry(array($field1,$field2,$field3,preg_replace("/%KEY%/",$key,$field_del))); } }else{ $divlist->SetHeader(array( @@ -273,7 +257,7 @@ class goto_task extends plugin } - function create_tree($arr,$base,$current = "") + function create_tree($arr,$base,$current = "") { $ret = array(); foreach($arr as $r => $name){ @@ -364,6 +348,7 @@ class goto_task extends plugin $this->Zone = get_post("Zone"); } }else{ + $this->Zone = "\"\""; $this->configure_dns = FALSE; } @@ -374,6 +359,7 @@ class goto_task extends plugin } }else{ $this->configure_dhcp = FALSE; + $this->Section = "\"\""; } foreach($this->attributes as $attr){ @@ -411,6 +397,12 @@ class goto_task extends plugin foreach($this->attributes as $attr){ $tmp[$attr] = $this->$attr; } + if(!$this->configure_dns){ + $tmp['Zone'] = "\"\""; + } + if(!$this->configure_dhcp){ + $tmp['Section'] = "\"\""; + } return($tmp); } diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index 037ac99b6..df9512cac 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -316,7 +316,7 @@ class gotomasses extends plugin $row = preg_replace('/ */umi'," ",$row); $parts = split(" ",$row); - if(count($parts) != 8){ + if(count($parts) != 10){ print_red(_("Entry broken, skipped.")); }else{ @@ -328,16 +328,16 @@ class gotomasses extends plugin $entry['Weekday'] = $parts[4]; $entry['Action'] = $parts[5]; $entry['OGroup'] = $parts[6]; + $entry['Zone'] = $parts[7]; + $entry['Section'] = $parts[8]; if($entry['Action'] == "initial_install"){ - $tmp2 = split(";",$parts[7]); + $tmp2 = split(";",$parts[9]); foreach($tmp2 as $target){ $tmp = split(",",$target); $entry['Initial_Target'][] = array( "MAC" => $tmp[0], "IP" => $tmp[1], - "NAME" => $tmp[2], - "ZONE" => $tmp[3], - "SECTION" => $tmp[4]); + "NAME" => $tmp[2]); } $entry['Target'] = array(); }else{ @@ -368,10 +368,11 @@ class gotomasses extends plugin } $str .= str_pad($task['Action'] ,5," ")." "; $str .= str_pad($task['OGroup'] ,5," ")." "; + $str .= str_pad($task['Zone'] ,5," ")." "; + $str .= str_pad($task['Section'],5," ")." "; if($task['Action'] == "initial_install"){ foreach($task['Initial_Target'] as $target){ - $str .= trim($target['MAC']).",".trim($target['IP']).",".trim($target['NAME']).",". - trim($target['ZONE']).",".trim($target['SECTION']).";"; + $str .= trim($target['MAC']).",".trim($target['IP']).",".trim($target['NAME']).";"; } }else{ foreach($task['Target'] as $target){ diff --git a/plugins/addons/gotomasses/goto_task.tpl b/plugins/addons/gotomasses/goto_task.tpl index fde439624..8a4139e95 100644 --- a/plugins/addons/gotomasses/goto_task.tpl +++ b/plugins/addons/gotomasses/goto_task.tpl @@ -25,6 +25,28 @@ + + + + + + + + + + + + + + + + @@ -85,28 +107,6 @@ {t}IP address{/t} - - - - - - - - - - - - - - - -