1 <?php
3 require_once("class_goService.inc");
5 class goFonServer 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("goFonServer");
13 var $attributes = array("goFonAdmin", "goFonPassword","goFonAreaCode", "goFonCountryCode");
14 var $StatusFlag = "goFonServerStatus";
16 /* This class can't be assigned twice so it conflicts with itsself */
17 var $conflicts = array("goFonServer");
19 var $DisplayName = "";
20 var $dn = NULL;
21 var $cn ="";
22 var $acl;
24 var $goFonServerStatus = "";
25 var $goFonPassword = "";
26 var $goFonAdmin = "";
27 var $goFonAreaCode = "";
28 var $goFonCountryCode = "";
31 function goFonServer($config,$dn)
32 {
33 plugin::plugin($config,$dn);
34 $this->DisplayName = _("VoIP service");
35 }
38 function execute()
39 {
40 $smarty = get_smarty();
41 foreach($this->attributes as $attr){
42 $smarty->assign($attr,$this->$attr);
43 }
45 /* Assign acls */
46 $tmp = $this->plInfo();
47 foreach($tmp['plProvidedAcls'] as $name => $translation){
48 $smarty->assign($name."ACL",$this->getacl($name));
49 }
51 return($smarty->fetch(get_template_path("goFonServer.tpl",TRUE,dirname(__FILE__))));
52 }
55 function getListEntry()
56 {
57 $fields = goService::getListEntry();
58 $fields['Message'] = _("VoIP service - Asterisk management");
59 $fields['AllowEdit'] = true;
60 return($fields);
61 }
63 function check()
64 {
65 $message = plugin::check();
66 if (empty($this->goFonAdmin)){
67 $message[]= _("The attribute DB user is empty or contains invalid characters.");
68 }
69 if (empty($this->goFonPassword)){
70 $message[]= _("The attribute password is empty or contains invalid characters.");
71 }
72 if (empty($this->goFonAreaCode)){
73 $message[]= _("The attribute local dial prefix is empty or contains invalid characters.");
74 }
75 if (empty($this->goFonCountryCode)){
76 $message[]= _("The attribute country dial prefix is empty or contains invalid characters.");
77 }
78 return($message);
79 }
82 function save_object()
83 {
84 if(isset($_POST['goFonServerPosted'])){
85 plugin::save_object();
86 }
87 }
89 /* Return plugin informations for acl handling */
90 function plInfo()
91 {
92 return (array(
93 "plShortName" => _("VoIP service"),
94 "plDescription" => _("VoIP - asterisk management")." ("._("Services").")",
95 "plSelfModify" => FALSE,
96 "plDepends" => array(),
97 "plPriority" => 92,
98 "plSection" => array("administration"),
99 "plCategory" => array("server"),
101 "plProvidedAcls"=> array(
102 "start" => _("Start"),
103 "stop" => _("Stop"),
104 "restart" => _("Restart"),
106 "goFonAdmin" => _("Admin"),
107 "goFonPassword" => _("Password"),
108 "goFonAreaCode" => _("Area code"),
109 "goFonCountryCode"=> _("Country code"))
110 ));
111 }
112 }
113 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
114 ?>