Code

Added acls to gofonaccount
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Aug 2006 03:27:27 +0000 (03:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Aug 2006 03:27:27 +0000 (03:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4367 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc
plugins/gofon/phoneaccount/generic.tpl

index 5b70424b812920c3a01c825ae4ca4ecd1dee5484..dd5d5591d42403258e2249ce5f204dac019d155a 100644 (file)
@@ -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.= "<tr>";
         switch ($type){
 
           case "combo":
-            $str= "<select name='".$var."' ".chkacl($this->acl, "goFonMacro")." >";
+            $str= "<select name='".$var."' ".chkacl($this->acl, "goFonMacro")." ".$dis.">";
           foreach(split(":",$default) as $choice){
             if($choosen==$choice){
               $str.= "\n<option value='".$choice."' selected>".$choice."&nbsp;</option>";
@@ -713,15 +719,15 @@ class phoneAccount extends plugin
 
           case "bool":
             if(!$choosen){
-              $str="\n<input type='checkbox' name='".$var."' value='1' ".chkacl($this->acl, "goFonMacro")." >";
+              $str="\n<input type='checkbox' name='".$var."' value='1' ".chkacl($this->acl, "goFonMacro")." ".$dis.">";
             }else{
-              $str="\n<input type='checkbox' name='".$var."' value='1' checked  ".chkacl($this->acl, "goFonMacro").">";
+              $str="\n<input type='checkbox' name='".$var."' value='1' checked  ".chkacl($this->acl, "goFonMacro")." ".$dis.">";
             }
           $macrotab.= "<td colspan='2'>$str&nbsp;".base64_decode($name)."";
           break;
 
           case "string":
-            $str="<input name='".$var."' value='".$choosen."' ".chkacl($this->acl, "goFonMacro")." style='width:340px;'>";
+            $str="<input name='".$var."' value='".$choosen."' ".chkacl($this->acl, "goFonMacro")." style='width:340px;' ".$dis.">";
           $macrotab.= "<td>".base64_decode($name)."</td><td>$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= "<select size=\"1\" name=\"goFonHardware\" title=\"".
-      _("Choose your private phone")."\" ".chkacl($this->acl, "goFonHardware").">\n";
+
+
+    $dis = "";
+    if(!$this->acl_is_writeable("goFonHardware")){
+      $dis= " disabled ";
+    }
+    $hl= "<select size=\"1\" name=\"goFonHardware\" ".$dis." title=\"".
+      _("Choose your private phone")." >\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"))
             ));
   }
 }
index dd2bfb62f332431a8d2f7ff0d9866e1428a6e263..33e494d8405d60964ccbc3b2572b33807c55c4ef 100644 (file)
@@ -1,78 +1,95 @@
 <table summary="{t}Phone numbers{/t}" style="width:100%">
  <tr>
   <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
-   <h2><img class="center" alt="" align="middle" src="images/banana.png" />&nbsp;{t}Phone numbers{/t}</h2>
-      <select style="width:100%;" name="phonenumber_list[]" size=7 multiple {$telephoneNumberACL}>
-       {html_options options=$phoneNumbers}
-               <option disabled>
-                       &nbsp;
-                       </option>
-      </select>
-      <br>
-      <input name="phonenumber" size=20 align=middle maxlength=60 {$telephoneNumberACL} value="">
-      <input type="submit" value="{t}Add{/t}" name="add_phonenumber"
-       {$telephoneNumberACL}>&nbsp;
-      <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber"
-        {$telephoneNumberACL}>
+   <h2>
+    <img class="center" alt="" align="middle" src="images/banana.png" />
+    &nbsp;{t}Phone numbers{/t}
+   </h2>
+{render acl=$telephoneNumberACL}
+   <select style="width:100%;" name="phonenumber_list[]" size=7 multiple>
+    {html_options options=$phoneNumbers}
+    <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br>
+{render acl=$telephoneNumberACL}
+   <input name="phonenumber" size=20 align=middle maxlength=60 value="">
+{/render}
+{render acl=$telephoneNumberACL}
+   <input type="submit" value="{t}Add{/t}" name="add_phonenumber">&nbsp;
+{/render}
+{render acl=$telephoneNumberACL}
+      <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber">
+{/render}
   </td>
-
   <td style="vertical-align:top; width:50%;">
-<table summary="" style="width:100%" border=0>
+   <table summary="" style="width:100%" border=0>
  <tr>
 
   <td style="vertical-align:top;">
    <h2><img class="center" alt="" align="middle" src="images/hardware.png" />&nbsp;{t}Telephone hardware{/t}</h2>
 
-   <table summary="{t}Telephone{/t}" border=0>
-    <tr>
-     <td>{t}Telephone{/t}</td>
-     <td>{$hardware_list}</td>
+      <table summary="{t}Telephone{/t}" border=0>
+       <tr>
+        <td>{t}Telephone{/t}</td>
+        <td>{$hardware_list}</td>
+       </tr>
+      <tr>
+       <td>
+        <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
+       </td>
+       <td>
+{render acl=$goFonVoicemailPINACL}
+        <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPIN" value="{$goFonVoicemailPIN}">
+{/render}
+      </td>
+      </tr>
+      <tr>
+       <td>
+        <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
+       </td>
+       <td>
+{render acl=$goFonPINACL}
+        <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}">
+{/render}
+      </td>
+      </tr>
+      </table>
+     </td>
     </tr>
-                       <tr>
-                               <td>
-                                       <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
-                               </td>
-                               <td>
-                                       <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPIN" value="{$goFonVoicemailPIN}" {$goFonVoicemailPINACL}>
-                       </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
-                               </td>
-                               <td>
-                                       <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}" {$goFonPINACL}>
-                       </td>
-                       </tr>
    </table>
   </td>
- </tr>
-</table>
-  </td>
 
  </tr>
  <tr>
      <td style="vertical-align:top; border-top:1px solid #A0A0A0; width:50%" colspan="2">&nbsp;</td>
+ <td style="vertical-align:top; border-top:1px solid #A0A0A0; width:50%" colspan="2">&nbsp;</td>
  </tr>
  <tr style="vertical-align:top; border-top:1px solid #A0A0A0;">
-       <td colspan=2 style="vertical-align:top;width:50%">
-               <h2><img class="center" alt="" src="images/select_macro.png" align="middle" />&nbsp;{t}Phone macro{/t}</h2>
-               <table summary="{t}Phone macro{/t}">
-                       <tr>
-                               <td colspan=2>
-                                        <select name="macro" onchange="document.mainform.submit()" {$goFonMacroACL}>
-                                          {html_options options=$macros selected=$macro}
-                               <option disabled>&nbsp;</option>
-                                        </select>
-                                       {if $javascript eq 'false'}
-                                        <input type="submit" name="refresh" value="{t}Refresh{/t}" {$goFonMacroACL}>
-                                       {/if}
-                               </td>
-                       </tr>
-               </table>
-               <br>
-               {$macrotab}
-       </td>
+ <td colspan=2 style="vertical-align:top;width:50%">
+  <h2>
+   <img class="center" alt="" src="images/select_macro.png" align="middle" />
+   &nbsp;{t}Phone macro{/t}
+  </h2>
+  <table summary="{t}Phone macro{/t}">
+   <tr>
+    <td colspan=2>
+{render acl=$goFonMacroACL}
+     <select name="macro" onchange="document.mainform.submit()">
+      {html_options options=$macros selected=$macro}
+      <option disabled>&nbsp;</option>
+     </select>
+{/render}
+     {if $javascript eq 'false'}
+{render acl=$goFonMacroACL}
+      <input type="submit" name="refresh" value="{t}Refresh{/t}">
+{/render}
+     {/if}
+    </td>
+   </tr>
+  </table>
+  <br>
+  {$macrotab}
+ </td>
  </tr>
 </table>
 <input type="hidden" name="phoneTab" value="phoneTab">