From: hickert Date: Tue, 27 Jul 2010 09:17:43 +0000 (+0000) Subject: Updated several service dialogs, fixed typos, string, html, post handling and more. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ff87510608e0500804b82ec4099d3ddba41ee217;p=gosa.git Updated several service dialogs, fixed typos, string, html, post handling and more. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19155 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpTSigKey.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpTSigKey.inc index 900df1113..b2de172b3 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpTSigKey.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpTSigKey.inc @@ -1,161 +1,168 @@ new){ - $this->dhcpKeyAlgorithm= $attrs['dhcpKeyAlgorithm'][0]; - $this->dhcpKeySecret= $attrs['dhcpKeySecret'][0]; - } - - } + /* Used attributes */ + var $dhcpKeyAlgorithm=""; + var $dhcpKeySecret=""; - function execute() - { - $smarty= get_smarty(); - $smarty->assign("cn", $this->cn); - $dhcpKeyAlgorithm=preg_replace('/\s.*$/', '', $this->dhcpKeyAlgorithm); - $smarty->assign("dhcpKeyAlgorithm",$dhcpKeyAlgorithm); - $smarty->assign("dhcpKeyAlgorithms",array("HMAC-MD5" => _("HMAC-MD5"),"RSAMD5" => _("RSAMD5"),"RSASHA1" => _("RSASHA1"),"DSA" => _("DSA"),"DH" => _("DH"))); - $smarty->assign("dhcpKeySecret",$this->dhcpKeySecret); + /* attribute list for save action */ + var $objectclasses= array("top", "dhcpTSigKey"); - /* Assign ACLs */ - $smarty->assign("acl",$this->parent->getacl("")); + function dhcpTSigKey($parent,$attrs) + { + dhcpPlugin::dhcpPlugin($parent,$attrs); + /* Load attributes */ + if (!$this->new){ + $this->dhcpKeyAlgorithm= $attrs['dhcpKeyAlgorithm'][0]; + $this->dhcpKeySecret= $attrs['dhcpKeySecret'][0]; + } - /* Show main page */ - $display= $smarty->fetch(get_template_path('dhcp_tsigkey.tpl', TRUE,dirname(__FILE__))); + } + function execute() + { + $smarty= get_smarty(); + $smarty->assign("cn", set_post($this->cn)); + $dhcpKeyAlgorithm=preg_replace('/\s.*$/', '', $this->dhcpKeyAlgorithm); + $smarty->assign("dhcpKeyAlgorithm",$dhcpKeyAlgorithm); + $smarty->assign("dhcpKeyAlgorithms", + set_post( + array( + "HMAC-MD5" => _("HMAC-MD5"), + "RSAMD5" => _("RSAMD5"), + "RSASHA1" => _("RSASHA1"), + "DSA" => _("DSA"), + "DH" => _("DH")))); + $smarty->assign("dhcpKeySecret", set_post($this->dhcpKeySecret)); + + /* Assign ACLs */ + $smarty->assign("acl",$this->parent->getacl("")); + + + /* Show main page */ + $display= $smarty->fetch(get_template_path('dhcp_tsigkey.tpl', TRUE,dirname(__FILE__))); + + + /* Add footer */ + $display.= "
"; + if(preg_match("/w/",$this->parent->getacl(""))){ + $display.= " "; + } + $display.= ""; + $display.= "
"; - /* Add footer */ - $display.= "
"; - if(preg_match("/w/",$this->parent->getacl(""))){ - $display.= " "; + return ($display); } - $display.= ""; - $display.= "
"; - return ($display); - } + + function remove_from_parent() + { + } - function remove_from_parent() - { - } + /* Save data to object */ + function save_object() + { + /* Save remaining attributes */ + if (isset($_POST['dhcp_tsigkey_posted']) && preg_match("/w/",$this->parent->getacl(""))){ + if (isset($_POST['dhcpKeyAlgorithm'])){ + $this->dhcpKeyAlgorithm=get_post('dhcpKeyAlgorithm'); + } - /* Save data to object */ - function save_object() - { - /* Save remaining attributes */ - if (isset($_POST['dhcp_tsigkey_posted']) && preg_match("/w/",$this->parent->getacl(""))){ + if (isset($_POST['dhcpKeySecret'])){ + $this->dhcpKeySecret=get_post('dhcpKeySecret'); + } + if (isset($_POST['cn'])){ + $this->cn=get_post('cn'); + } - if (isset($_POST['dhcpKeyAlgorithm'])){ - $this->dhcpKeyAlgorithm=get_post('dhcpKeyAlgorithm'); - } + } - if (isset($_POST['dhcpKeySecret'])){ - $this->dhcpKeySecret=get_post('dhcpKeySecret'); - } - if (isset($_POST['cn'])){ - $this->cn=get_post('cn'); - } - + dhcpPlugin::save_object(); } - dhcpPlugin::save_object(); - } + /* Check values */ + function check() + { + $message= array(); - /* Check values */ - function check() - { - $message= array(); + $cache = array(); + if(isset($this->parent) && isset($this->parent->dhcpObjectCache)){ + $cache = $this->parent->dhcpObjectCache; + } - $cache = array(); - if(isset($this->parent) && isset($this->parent->dhcpObjectCache)){ - $cache = $this->parent->dhcpObjectCache; - } - - /* All required fields are set? */ - if ($this->cn == ""){ - $message[]= msgPool::required(_("Key name")); - } + /* All required fields are set? */ + if ($this->cn == ""){ + $message[]= msgPool::required(_("Key name")); + } - if ($this->dhcpKeySecret == ""){ - $message[]= msgPool::required(_("Key")); - } - - - /* cn already used? */ - if ($this->orig_cn != $this->cn || $this->new){ - - foreach($cache as $dn => $dummy){ - if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){ - $message[]= msgPool::duplicated(_("Key name")); - break; + if ($this->dhcpKeySecret == ""){ + $message[]= msgPool::required(_("Key")); } - } - } - - /* Check external plugins */ - $net= $this->network->check(); - $adv= $this->advanced->check(); - $message= array_merge($message, $net, $adv); - return $message; - } + /* cn already used? */ + if ($this->orig_cn != $this->cn || $this->new){ + + foreach($cache as $dn => $dummy){ + if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){ + $message[]= msgPool::duplicated(_("Key name")); + break; + } + } + } - /* Save to LDAP */ - function save() - { - dhcpPlugin::save(); + /* Check external plugins */ + $net= $this->network->check(); + $adv= $this->advanced->check(); + $message= array_merge($message, $net, $adv); - if ($this->dhcpKeyAlgorithm != ""){ - $this->attrs['dhcpKeyAlgorithm']= array($this->dhcpKeyAlgorithm); - } else { - $this->attrs['dhcpKeyAlgorithm']= array(); + return $message; } - if ($this->dhcpKeySecret != ""){ - $this->attrs['dhcpKeySecret']= array($this->dhcpKeySecret); - } else { - $this->attrs['dhcpKeySecret']= array(); - } + /* Save to LDAP */ + function save() + { + dhcpPlugin::save(); - return ($this->attrs); - } + if ($this->dhcpKeyAlgorithm != ""){ + $this->attrs['dhcpKeyAlgorithm']= array($this->dhcpKeyAlgorithm); + } else { + $this->attrs['dhcpKeyAlgorithm']= array(); + } + + + if ($this->dhcpKeySecret != ""){ + $this->attrs['dhcpKeySecret']= array($this->dhcpKeySecret); + } else { + $this->attrs['dhcpKeySecret']= array(); + } + + return ($this->attrs); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: