From: hickert Date: Mon, 26 Jul 2010 15:47:13 +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=95da18e97b3328be0e2f49a28edad0004141d5dc;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@19135 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc b/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc index 64e55d70f..760b2d0af 100644 --- a/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc +++ b/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc @@ -1,196 +1,196 @@ DisplayName = _("Logging"); - $this->initial_use_database = $this->use_database = - isset($this->attrs['objectClass']) &&in_array("goLogDBServer", $this->attrs['objectClass']); - - if($this->use_database){ - foreach($this->db_attributes as $attr){ - if(isset($this->attrs[$attr][0])){ - $this->$attr = $this->attrs[$attr][0]; + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goSyslogServer"); + var $attributes = array(); + var $db_attributes = array("gosaLogDB","goLogAdmin","goLogPassword"); + var $StatusFlag = ""; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goSyslogServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $acl; + var $cn = ""; + var $use_database = FALSE; + var $initial_use_database = FALSE; + var $gosaLogDB = "Syslog"; + var $goLogAdmin = "rsyslog"; + var $goLogPassword = ""; + var $view_logged = FALSE; + + + function rSyslogServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Logging"); + $this->initial_use_database = $this->use_database = + isset($this->attrs['objectClass']) &&in_array("goLogDBServer", $this->attrs['objectClass']); + + if($this->use_database){ + foreach($this->db_attributes as $attr){ + if(isset($this->attrs[$attr][0])){ + $this->$attr = $this->attrs[$attr][0]; + } + } } - } } - } - function execute() - { - $smarty = get_smarty(); + function execute() + { + $smarty = get_smarty(); - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + foreach($this->db_attributes as $attr){ + $smarty->assign($attr,set_post($this->$attr)); + } + $smarty->assign("use_database" , $this->use_database); + return($smarty->fetch(get_template_path("rSyslogServer.tpl",TRUE,dirname(__FILE__)))); } - foreach($this->db_attributes as $attr){ - $smarty->assign($attr,$this->$attr); + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Logging service"); +#$fields['AllowEdit'] = true; +#$fields['AllowStart'] = FALSE; +#$fields['AllowStop'] = FALSE; +#$fields['AllowRestart'] = FALSE; + return($fields); } - $smarty->assign("use_database" , $this->use_database); - return($smarty->fetch(get_template_path("rSyslogServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Logging service"); - #$fields['AllowEdit'] = true; - #$fields['AllowStart'] = FALSE; - #$fields['AllowStop'] = FALSE; - #$fields['AllowRestart'] = FALSE; - return($fields); - } - - - function check() - { - $message = plugin::check(); - if($this->use_database){ - if (empty($this->goLogAdmin)){ - $message[]= msgPool::required(_("User")); - } - if (empty($this->gosaLogDB)){ - $message[]= msgPool::required(_("Database")); - } - if (empty($this->goLogPassword)){ - $message[]= msgPool::required(_("Password")); - } + + + function check() + { + $message = plugin::check(); + if($this->use_database){ + if (empty($this->goLogAdmin)){ + $message[]= msgPool::required(_("User")); + } + if (empty($this->gosaLogDB)){ + $message[]= msgPool::required(_("Database")); + } + if (empty($this->goLogPassword)){ + $message[]= msgPool::required(_("Password")); + } + } + return($message); } - return($message); - } - function save_object() - { - if(isset($_POST['rSyslogServerPosted'])){ - plugin::save_object(); + function save_object() + { + if(isset($_POST['rSyslogServerPosted'])){ + plugin::save_object(); - foreach($this->db_attributes as $attr){ - if(isset($_POST[$attr])){ - $this->$attr = get_post($attr); + foreach($this->db_attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + $this->use_database = isset($_POST['use_database']); } - } - $this->use_database = isset($_POST['use_database']); - } - } + } - function save() - { - // Store rSyslog database connection info if enabled. - if($this->use_database){ - $this->attributes = array('gosaLogDB','goLogAdmin','goLogPassword'); - $this->objectclasses = array('goSyslogServer','goLogDBServer'); - }else{ - $this->attributes = array(); - $this->objectclasses = array('goSyslogServer'); + function save() + { + // Store rSyslog database connection info if enabled. + if($this->use_database){ + $this->attributes = array('gosaLogDB','goLogAdmin','goLogPassword'); + $this->objectclasses = array('goSyslogServer','goLogDBServer'); + }else{ + $this->attributes = array(); + $this->objectclasses = array('goSyslogServer'); - } + } - plugin::save(); + plugin::save(); - if(!$this->use_database && $this->initial_use_database){ - $this->attrs['objectClass'] = array_remove_entries(array('goLogDBServer'),$this->attrs['objectClass']); - $this->attrs['objectClass'] = array_values($this->attrs['objectClass']); - foreach($this->db_attributes as $attr){ - $this->attrs[$attr] = array(); - } - } + if(!$this->use_database && $this->initial_use_database){ + $this->attrs['objectClass'] = array_remove_entries(array('goLogDBServer'),$this->attrs['objectClass']); + $this->attrs['objectClass'] = array_values($this->attrs['objectClass']); + foreach($this->db_attributes as $attr){ + $this->attrs[$attr] = array(); + } + } - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - if($this->initially_was_account){ - new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - $this->handle_post_events("modify"); - }else{ - $this->handle_post_events("add"); - new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + /* Check if this is a new entry ... add/modify */ + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + }else{ + $ldap->cd($this->dn); + $ldap->add($this->attrs); + } + if($this->initially_was_account){ + new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + $this->handle_post_events("modify"); + }else{ + $this->handle_post_events("add"); + new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } } - } - - - /* Remove service */ - function remove_from_parent() - { - // Store rSyslog database connection info if enabled. - if($this->initial_use_database){ - $this->attributes = array('gosaLogDB','goLogAdmin','goLogPassword'); - $this->objectclasses = array('goSyslogServer','goLogDBServer'); - }else{ - $this->attributes = array(); - $this->objectclasses = array('goSyslogServer'); + + + /* Remove service */ + function remove_from_parent() + { + // Store rSyslog database connection info if enabled. + if($this->initial_use_database){ + $this->attributes = array('gosaLogDB','goLogAdmin','goLogPassword'); + $this->objectclasses = array('goSyslogServer','goLogDBServer'); + }else{ + $this->attributes = array(); + $this->objectclasses = array('goSyslogServer'); + } + + goService::remove_from_parent(); } - goService::remove_from_parent(); - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Logging service"), - "plDescription" => _("Logging service")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 99, - "plRequirements"=> array( - 'ldapSchema' => array('goSyslogServer' => '>=2.7','goLogDBServer' => '>=2.7'), - 'onFailureDisablePlugin' => array(get_class(),'rsyslog'), - ), - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "gosaLogDB" => _("Database"), - "goLogAdmin" => _("User"), - "goLogPassword" => _("Password"), - "viewEntries" => _("Allow view of entries on this server")) - )); - } + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Logging service"), + "plDescription" => _("Logging service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 99, + "plRequirements"=> array( + 'ldapSchema' => array('goSyslogServer' => '>=2.7','goLogDBServer' => '>=2.7'), + 'onFailureDisablePlugin' => array(get_class(),'rsyslog'), + ), + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "gosaLogDB" => _("Database"), + "goLogAdmin" => _("User"), + "goLogPassword" => _("Password"), + "viewEntries" => _("Allow view of entries on this server")) + )); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>