1 <?php
3 require_once("class_goService.inc");
5 class goTerminalServer extends goService{
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";
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 plugin::plugin($config,$dn);
31 $this->DisplayName = _("Terminal service");
32 }
35 function execute()
36 {
37 $smarty = get_smarty();
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 }else{
82 $this->handle_post_events("add");
83 }
84 }
87 function check()
88 {
89 $message = plugin::check();
90 if(empty($this->goFontPath)){
91 $message[]=_("Terminal server, must have fontpath specified.");
92 }
94 return($message);
95 }
98 function save_object()
99 {
100 if(isset($_POST['goTerminalServerPosted'])){
101 plugin::save_object();
102 if($this->acl_is_writeable("goXdmcpIsEnabled")){
103 if(isset($_POST['goXdmcpIsEnabled'])){
104 $this->goXdmcpIsEnabled = true;
105 }else{
106 $this->goXdmcpIsEnabled = false;
107 }
108 }
109 }
110 }
113 /* Return plugin informations for acl handling */
114 function plInfo()
115 {
116 return (array(
117 "plShortName" => _("Terminal service"),
118 "plDescription" => _("Terminal service")." ("._("Services").")",
119 "plSelfModify" => FALSE,
120 "plDepends" => array(),
121 "plPriority" => 87,
122 "plSection" => array("administration"),
123 "plCategory" => array("server"),
125 "plProvidedAcls"=> array(
126 "goXdmcpIsEnabled" => _("Temporary disable login"),
127 "goFontPath" => _("Font path"))
128 ));
129 }
132 }
133 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
134 ?>