diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc
index 30e26827326b18a174f5715dcd0499d774b076cd..8453ae794e3322bd5fd1e648f050131246d5f74c 100644 (file)
var $disableDialog = false; // Dialog will be disabled, if this zone is new
- function servDNSeditZoneEntries ($config,$dn, $zoneObject)
+ function servDNSeditZoneEntries (&$config,$dn, &$zoneObject)
{
plugin::plugin ($config, $dn);
if(isset($this->RecordTypes['nSRecord'])){
unset($this->RecordTypes['nSRecord']);
}
+ /* Remove nSRecord from listed types */
+ if(isset($this->RecordTypes['pTRRecord'])){
+ unset($this->RecordTypes['pTRRecord']);
+ }
/* Get ldap connection
*/
{
plugin::execute();
-
-
/* Fill templating stuff */
$smarty= get_smarty();
$display= "";
/* Check posts for operations ...
*/
$once = true;
+ $ptr_updates = array();
foreach($_POST as $name => $value){
/* Add a new Record in given object
if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
unset($this->Devices[$Name]['RECORDS'][$RecordID]);
}
- }
- /* Add PTR record
- */
- if((preg_match("/^AddPtr_/",$name)) && ($once)){
- $once = false;
- if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
- $tmp = $this->Devices[$Name]['RECORDS'][$RecordID];
- $ip = $tmp['value'];
- $match = preg_replace("/^[^\/]*+\//","",$this->reverseName);
- $ip = preg_replace("/^".normalizePreg($match)."/","",$ip);
- $ip = preg_replace("/^\./","",$ip);
- $tmp['type'] = "pTRRecord";
- $tmp['value'] = $ip;
- $this->Devices[$Name]['RECORDS'][] = $tmp;
+ /* Check if there is at least one visible record. Else remove complete entry */
+ $visible = false;
+ foreach($this->Devices[$Name]['RECORDS'] as $rec){
+ if(in_array($rec['type'],$this->RecordTypes)){
+ $visible = true;
+ break;
+ }
+ }
+ if(!$visible && isset($this->Devices[$Name]['RECORDS'])){
+ $this->Devices[$Name]['RECORDS'] = array();
}
}
}
*/
if(preg_match("/ValueSelection_/",$name)){
if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
+
+ /* Update value */
+ $old = $this->Devices[$Name]['RECORDS'][$RecordID]['value'];
$this->Devices[$Name]['RECORDS'][$RecordID]['value'] = $value;
+
+ /* Handle pTRRecord */
+ if(!isset($ptr_updates[$Name]) && $this->Devices[$Name]['RECORDS'][$RecordID]['type'] == "aRecord"){
+
+ $found = false;
+ $ip = $value;
+ $match = preg_replace("/^[^\/]*+\//","",$this->reverseName);
+ $ip = preg_replace("/^".normalizePreg($match)."/","",$ip);
+ $ip = preg_replace("/^\./","",$ip);
+
+ foreach($this->Devices[$Name]['RECORDS'] as $key => $dev){
+ if($dev['type'] == "pTRRecord"){
+ $ptr_updates[$Name] = $Name;
+ $this->Devices[$Name]['RECORDS'][$key]['value'] = $ip;
+ $found = true;
+ break;
+ }
+ }
+ if(!$found){
+ $dev = array('type'=> 'pTRRecord', 'value' => $ip);
+ $this->Devices[$Name]['RECORDS'][] = $dev;
+ }
+ }
}
}
if(!isset($tmp[$Rec['type']])){
$tmp[$Rec['type']] = "";
}else{
- $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$type);
+ $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$Rec['type']);
}
}
$todo = array();
+
/* Create todolist
*/
foreach($this->Devices as $name => $dev){
$str.= "<table cellspacing='0' cellpadding='0'>";
foreach($obj['RECORDS'] as $id => $record){
+ /* Skip not selectable entries */
+ if(!isset($this->RecordTypes [$record['type']])) {
+ continue;
+ }
+
/* Create unique post name
*/
$name = base64_encode($objKey)."|".$id;
<input type='image' name='RemoveRecord_".$name."' src='images/edittrash.png' alt='"._("Remove")."' title='"._("Remove")."'>
";
- if($record['type'] == "aRecord"){
- $str .="<input type='image' name='AddPtr_".$name."' src='images/network.png'
- alt='"._("Add PTR")."' title='"._("Add PTR record")."'>";
- }else{
- $str .= "<img src='images/empty.png' alt=''>";
- }
+# if($record['type'] == "aRecord"){
+# $str .="<input type='image' name='AddPtr_".$name."' src='images/network.png'
+# alt='"._("Add PTR")."' title='"._("Add PTR record")."'>";
+# }else{
+# $str .= "<img src='images/empty.png' alt=''>";
+# }
$str.=
"</td>