From f3e79f026d51bf6327165373a2f3f064ea325a9a Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 3 Aug 2006 03:27:27 +0000 Subject: [PATCH] Added acls to gofonaccount git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4367 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 82 +++++------ plugins/gofon/phoneaccount/generic.tpl | 131 ++++++++++-------- 2 files changed, 116 insertions(+), 97 deletions(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 5b70424b8..dd5d5591d 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -36,7 +36,8 @@ class phoneAccount extends plugin /* attribute list for save action */ var $CopyPasteVars = array("phoneNumbers"); var $attributes = array("goFonDeliveryMode", "goFonFormat","uid","cn", - "goFonHardware","goFonPIN","goFonVoicemailPIN","telephoneNumber", "goFonMacro","macro"); + "goFonHardware","goFonPIN","goFonVoicemailPIN", + "telephoneNumber", "goFonMacro","macro"); var $objectclasses= array("goFonAccount"); function phoneAccount ($config, $dn= NULL) @@ -694,12 +695,17 @@ class phoneAccount extends plugin $choosen = $paras['choosen'] ; $str = $default; + $dis = ""; + if(!$this->acl_is_writeable("goFonMacro")){ + $dis = " disabled "; + } + /* in case of a combo box display a combobox with selected attr */ $macrotab.= ""; switch ($type){ case "combo": - $str= "acl, "goFonMacro")." ".$dis.">"; foreach(split(":",$default) as $choice){ if($choosen==$choice){ $str.= "\n"; @@ -713,15 +719,15 @@ class phoneAccount extends plugin case "bool": if(!$choosen){ - $str="\nacl, "goFonMacro")." >"; + $str="\nacl, "goFonMacro")." ".$dis.">"; }else{ - $str="\nacl, "goFonMacro").">"; + $str="\nacl, "goFonMacro")." ".$dis.">"; } $macrotab.= "$str ".base64_decode($name).""; break; case "string": - $str="acl, "goFonMacro")." style='width:340px;'>"; + $str="acl, "goFonMacro")." style='width:340px;' ".$dis.">"; $macrotab.= "".base64_decode($name)."$str"; break; @@ -783,7 +789,7 @@ class phoneAccount extends plugin /* Transfer ACL's */ foreach($this->attributes as $val){ - $smarty->assign($val."ACL", chkacl($this->acl,$val)); + $smarty->assign($val."ACL",$this->getacl($val)); if(isset($this->$val)){ $smarty->assign($val,$this->$val); }else{ @@ -798,14 +804,22 @@ class phoneAccount extends plugin } else { $smarty->assign ("phoneNumbers", $this->phoneNumbers); } - $hl= "\n"; foreach ($this->hardware_list as $cn => $description){ + if ($cn == $this->goFonHardware){ $selected= "selected"; } else { $selected= ""; } + if (isset($this->used_hardware[$cn])){ $color= "style=\"color:#A0A0A0\""; } else { @@ -828,19 +842,6 @@ class phoneAccount extends plugin if (isset($_POST["phoneTab"])){ plugin::save_object(); - /* Save checkbox */ - if (isset($_POST['fon_to_mail'])){ - $tmp= "[M]"; - } else { - $tmp= "[]"; - } - if (chkacl ($this->acl, "goFonDeliveryMode") == ""){ - if ($this->goFonDeliveryMode != $tmp){ - $this->is_modified= TRUE; - } - $this->goFonDeliveryMode= $tmp; - } - /* Every macro in the select box are available */ if((isset($_POST['macro']))){ $this->macrostillavailable=true; @@ -855,22 +856,24 @@ class phoneAccount extends plugin } /* get all Postvars */ - if(isset($this->macroarray[$this->macro])){ - foreach($this->macroarray[$this->macro] as $key => $paras){ - if(isset($_POST[$paras['var']])){ - $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; - } - - /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code - We need this code below to read and save checkboxes correct - */ + if(isset($this->macroarray[$this->macro])){ + if($this->acl_is_writeable("goFonMarco")){ + foreach($this->macroarray[$this->macro] as $key => $paras){ + if(isset($_POST[$paras['var']])){ + $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; + } - if(isset($_POST['post_success'])){ - if($this->macroarray[$this->macro][$key]['type']=="bool"){ - if(isset($_POST[$this->macroarray[$this->macro][$key]['var']])) { - $this->macroarray[$this->macro][$key]['choosen']=$_POST[$paras['var']]; - }else{ - $this->macroarray[$this->macro][$key]['choosen']=false; + /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code + We need this code below to read and save checkboxes correct + */ + + if(isset($_POST['post_success'])){ + if($this->macroarray[$this->macro][$key]['type']=="bool"){ + if(isset($_POST[$this->macroarray[$this->macro][$key]['var']])) { + $this->macroarray[$this->macro][$key]['choosen']=$_POST[$paras['var']]; + }else{ + $this->macroarray[$this->macro][$key]['choosen']=false; + } } } } @@ -1209,12 +1212,11 @@ class phoneAccount extends plugin "plOptions" => array(), "plProvidedAcls" => array( - "goFonDeliveryMode" => _("Delivery mode"), + "telephoneNumber" => _("Telephone number"), + "goFonMacro" => _("Macro settings"), "goFonHardware" => _("Phone hardware"), "goFonPIN" => _("Telephone pin"), - "goFonVoicemailPIN" => _("Voicemail pin"), - "telephoneNumber" => _("Telephone number"), - "goFonMacro" => _("Macro settings")) + "goFonVoicemailPIN" => _("Voicemail pin")) )); } } diff --git a/plugins/gofon/phoneaccount/generic.tpl b/plugins/gofon/phoneaccount/generic.tpl index dd2bfb62f..33e494d84 100644 --- a/plugins/gofon/phoneaccount/generic.tpl +++ b/plugins/gofon/phoneaccount/generic.tpl @@ -1,78 +1,95 @@ - - -
-

 {t}Phone numbers{/t}

- -
- -   - +

+ +  {t}Phone numbers{/t} +

+{render acl=$telephoneNumberACL} + +{/render} +
+{render acl=$telephoneNumberACL} + +{/render} +{render acl=$telephoneNumberACL} +   +{/render} +{render acl=$telephoneNumberACL} + +{/render}
- +
- - - - - - - -

 {t}Telephone hardware{/t}

- - - - +
{t}Telephone{/t}{$hardware_list}
+ + + + + + + + + + + + +
{t}Telephone{/t}{$hardware_list}
+ + +{render acl=$goFonVoicemailPINACL} + +{/render} +
+ + +{render acl=$goFonPINACL} + +{/render} +
+
- - - -
- - - -
- -   +   - -

 {t}Phone macro{/t}

- - - - -
- - {if $javascript eq 'false'} - - {/if} -
-
- {$macrotab} - + +

+ +  {t}Phone macro{/t} +

+ + + + +
+{render acl=$goFonMacroACL} + +{/render} + {if $javascript eq 'false'} +{render acl=$goFonMacroACL} + +{/render} + {/if} +
+
+ {$macrotab} + -- 2.30.2