Code

Moved directories
[gosa.git] / gosa-plugins / goto / admin / systems / services / terminal / class_goTerminalServer.inc
1 <?php
3 class goTerminalServer extends goService{
4         
5   var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
6   var $cli_description  = "Some longer text\nfor help";
7   var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9   /* This plugin only writes its objectClass */
10   var $objectclasses    = array("goTerminalServer");
11   var $attributes       = array("goXdmcpIsEnabled", "goFontPath");
12   var $StatusFlag       = "goTerminalServerStatus";
13  
14   /* This class can't be assigned twice so it conflicts with itsself */
15   var $conflicts        = array("goTerminalServer");
17   var $DisplayName      = "";
18   var $dn               = NULL;
19   var $acl;
20   var $cn                      = "";
21   var $goTerminalServerStatus  = "";
22   var $goXdmcpIsEnabled        = false;  
23   var $goFontPath              = "";
24   var $view_logged  =FALSE;
27   function goTerminalServer(&$config,$dn)
28   {
29     goService::goService($config,$dn);
30     $this->DisplayName = _("Terminal service");
31   }
34   function execute()
35   { 
36     $smarty = get_smarty();
38     if($this->is_account && !$this->view_logged){
39       $this->view_logged = TRUE;
40       new log("view","server/".get_class($this),$this->dn);
41     }
43   
44     $tmp = $this->plinfo();
45     foreach($tmp['plProvidedAcls'] as $name => $translation){
46       $smarty->assign($name."ACL",$this->getacl($name));
47     }
49     foreach($this->attributes as $attr){
50       $smarty->assign($attr,$this->$attr);
51     }
52     return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
53   }
56   function getListEntry()
57   {
58     $fields               = goService::getListEntry();
59     $fields['Message']    = _("Terminal service");
60     $fields['AllowEdit']  = true;
61     return($fields);
62   }
65   function save()
66   {
67     plugin::save();
69     if(!$this->goXdmcpIsEnabled){
70       $this->attrs['goXdmcpIsEnabled'] = "0";
71     }
73     /* Check if this is a new entry ... add/modify */
74     $ldap = $this->config->get_ldap_link();
75     $ldap->cat($this->dn,array("objectClass"));
76     if($ldap->count()){
77       $ldap->cd($this->dn);
78       $ldap->modify($this->attrs);
79     }else{
80       $ldap->cd($this->dn);
81       $ldap->add($this->attrs);
82     }
83     show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn));
84     if($this->initially_was_account){
85       $this->handle_post_events("modify");
86       new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
87     }else{
88       $this->handle_post_events("add");
89       new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
90     }
91   }
94   function check()
95   { 
96     $message = plugin::check();
97     if(empty($this->goFontPath)){
98       $message[]=_("Terminal server, must have fontpath specified.");
99     }
101     return($message);
102   }
105   function save_object()
106   {
107     if(isset($_POST['goTerminalServerPosted'])){
108       plugin::save_object();
109       if($this->acl_is_writeable("goXdmcpIsEnabled")){
110         if(isset($_POST['goXdmcpIsEnabled'])){
111           $this->goXdmcpIsEnabled = true;
112         }else{
113           $this->goXdmcpIsEnabled = false;
114         }
115       }
116     }
117   } 
120   /* Return plugin informations for acl handling */
121   static function plInfo()
122   {
123     return (array(
124           "plShortName"   => _("Terminal service"),
125           "plDescription" => _("Terminal service")." ("._("Services").")",
126           "plSelfModify"  => FALSE,
127           "plDepends"     => array(),
128           "plPriority"    => 87,
129           "plSection"     => array("administration"),
130           "plCategory"    => array("server"),
132           "plProvidedAcls"=> array(
133             "goXdmcpIsEnabled"  => _("Temporary disable login"),
134             "goFontPath"        => _("Font path"))
135           ));
136   }
140 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
141 ?>