From d30dd76da39b78bc9a689d39d5a714a3897e6881 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Jun 2006 10:45:36 +0000 Subject: [PATCH] Made dns serverService compatible git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3755 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servDNS.inc | 70 ++++++++++++++++++++++++- plugins/admin/systems/servdns.tpl | 9 ++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index 9bc83feef..2faa8a01e 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -19,12 +19,18 @@ class servdns extends plugin var $orig_dn = ""; var $DNSinitially_was_account; - + + /* ServerService tab vars */ + var $conflicts = array("servdns"); + var $DisplayName = ""; + var $StatusFlag = ""; function servdns ($config, $dn= NULL) { plugin::plugin ($config, $dn); + $this->DisplayName = _("Domain name system service"); + $this->orig_dn = $dn; /* Get record types for zones @@ -312,6 +318,68 @@ class servdns extends plugin show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); } } + + + /* Directly save new status flag */ + function setStatus($value) + { + if($value == "none") return; + if(!$this->initially_was_account) return; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + + $tmp = $ldap->fetch(); + for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ + $attrs['objectClass'][] = $tmp['objectClass'][$i]; + } + $flag = $this->StatusFlag; + $attrs[$flag] = $value; + $this->$flag = $value; + $ldap->modify($attrs); + show_ldap_error($ldap->get_error()); + $this->action_hook(); + } + } + + + function getListEntry() + { + $this->updateStatusState(); + $flag = $this->StatusFlag; + if(empty($flag)){ + $fields['Status'] = ""; + }else{ + $fields['Status'] = $this->$flag; + } + $fields['Message'] = _("DNS service"); + $fields['AllowStart'] = true; + $fields['AllowStop'] = true; + $fields['AllowRestart'] = true; + $fields['AllowRemove']= true; + $fields['AllowEdit'] = true; + return($fields); + } + + + /* Get updates for status flag */ + function updateStatusState() + { + if(empty($this->StatusFlag)) return; + + $attrs = array(); + $flag = $this->StatusFlag; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->cn); + $ldap->cat($this->dn,array($flag)); + if($ldap->count()){ + $attrs = $ldap->fetch(); + } + if(isset($attrs[$flag][0])){ + $this->$flag = $attrs[$flag][0]; + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/servdns.tpl b/plugins/admin/systems/servdns.tpl index ba5394088..9cd1d91b3 100644 --- a/plugins/admin/systems/servdns.tpl +++ b/plugins/admin/systems/servdns.tpl @@ -14,3 +14,12 @@ document.mainform.AddZone.focus(); --> + +

 

+

+

+ +   + +
+

-- 2.30.2