Code

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