Code

Updated workstation - Startup
[gosa.git] / plugins / admin / systems / class_gosaLogServer.inc
1 <?php
3 class gosaLogServer extends goService{
4         
5   /* This plugin only writes its objectClass */
6   var $objectclasses    = array("gosaLogServer");
7   var $attributes       = array("goLogDB","goLogDBUser","goLogDBPassword");
8   var $StatusFlag       = "";
10   /* This class can't be assigned twice so it conflicts with itsself */
11   var $conflicts        = array("gosaLogServer");
13   var $DisplayName      = "";
14   var $dn               = NULL;
15   var $acl;
16   var $cn                 = "";
17   var $goLogDBServerStatus= "";
18   var $goLogDBUser        = "";
19   var $goLogDBPassword    = "";  
20   var $goLogDB            = "";  
21   var $view_logged  =FALSE;
24   function gosaLogServer(&$config,$dn)
25   {
26     goService::goService($config,$dn);
27     $this->DisplayName = _("GOsa MySQL logging service");
28   }
31   function execute()
32   { 
33     $smarty = get_smarty(); 
35     if($this->is_account && !$this->view_logged){
36       $this->view_logged = TRUE;
37       new log("view","server/".get_class($this),$this->dn);
38     }
40     $tmp = $this->plInfo();
41     foreach($tmp['plProvidedAcls'] as $name => $translation){
42       $smarty->assign($name."ACL",$this->getacl($name));
43     }
45     foreach($this->attributes as $attr){
46       $smarty->assign($attr,$this->$attr);
47     }
48     return($smarty->fetch(get_template_path("gosaLogServer.tpl",TRUE,dirname(__FILE__))));
49   }
52   function getListEntry()
53   {
54     $fields = goService::getListEntry();
55     $fields['Message']      = _("GOsa MySQL logging service");
56     $fields['AllowEdit']    = true;
57     $fields['AllowStart']   = FALSE;
58     $fields['AllowStop']    = FALSE;
59     $fields['AllowRestart'] = FALSE;
60     return($fields);
61   }
64   function check()
65   { 
66     $message = plugin::check();
67     if (empty($this->goLogDBUser)){
68       $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
69     }
70     if (empty($this->goLogDBPassword)){
71       $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
72     }
73     if (empty($this->goLogDB)){
74       $message[]= sprintf_("The attribute database is empty or contains invalid characters.");
75     }
76     return($message);
77   }
80   function save_object()
81   {
82     if(isset($_POST['gosaLogServerPosted'])){
83       plugin::save_object();
84     }
85   } 
87   /* Return plugin informations for acl handling */
88   function plInfo()
89   {
90     return (array(
91           "plShortName"   => _("GOsa logging service"),
92           "plDescription" => _("GOsa logging service")." ("._("Services").")",
93           "plSelfModify"  => FALSE,
94           "plDepends"     => array(),
95           "plPriority"    => 98,
96           "plSection"     => array("administration"),
97           "plCategory"    => array("server"),
99           "plProvidedAcls"=> array(
100             "goLogDB"         => _("Database"),
101             "goLogDBUser"     => _("User"),
102             "goLogDBPassword" => _("Password"), 
103             "viewEntries"    => _("Allow view of entries on this server")) 
104           ));
105   }
107 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
108 ?>