Code

Some template && acl fixes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Oct 2006 09:29:07 +0000 (09:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Oct 2006 09:29:07 +0000 (09:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4950 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/addressbook/address_info.tpl
plugins/addons/addressbook/class_addressbook.inc

index d6cf405d5aec0cc51a73b64eaeff149e32983c62..3bb3a2242a432e43d0ae36831b5c8ecec81003dc 100644 (file)
 <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
-<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-<td align=left width="100%">{$storage_info}</td>
-<td><a href="{$url}">X</a></td>
-</tr>
-<tr style="background-color: white">
-<td colspan=2>
+ <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+  <td align=left width="100%">{$storage_info}
+  </td>
+  <td>
+   <a href="{$url}">X</a>
+  </td>
+ </tr>
 
-<table summary="" width="100%" cellspacing=2 cellpadding=4>
-<tr>
-<td style="width:50%; vertical-align:top; background-color: #F0F0F0">
- <h2><img class="center" alt="" src="{$personal_image}" align=middle> {t}Personal{/t}</h2>
+ <tr style="background-color: white">
+  <td colspan=2>
+
+   <table summary="" width="100%" cellspacing=2 cellpadding=4>
+    <tr>
+     <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
+      <h2>
+       <img class="center" alt="" src="{$personal_image}" align=middle> 
+       {t}Personal{/t}
+      </h2>
  
- <table summary="" width="100%">
-  <tr>
-   <td>{t}Name{/t}</td><td><i>{$info_sn}, {$info_givenName}</i></td>
-  </tr>
-  <tr>
-   <td>{t}Initials{/t}</td><td><i>{$info_initials}</i></td>
-  </tr>
-  <tr>
-   <td>{t}Personal title{/t}</td><td><i>{$info_title}</i></td>
-  </tr>
- </table>
+      <table summary="" width="100%">
+       <tr>
+        <td style='width:40%;'>
+         {t}Name{/t}
+        </td> 
+        <td>
+         <i>{$info_sn}, {$info_givenName}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Initials{/t}
+        </td> 
+        <td>
+         <i>{$info_initials}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Personal title{/t}
+        </td>
+        <td>
+         <i>{$info_title}</i>
+        </td>
+       </tr>
+      </table>
 
-</td>
+     </td>
+     <td style="vertical-align:top; background-color: #E8E8E8">
 
-<td style="width:50%; vertical-align:top; background-color: #E8E8E8">
- <h2><img class="center" alt="" src="{$home_image}" align=middle> {t}Private{/t}</h2>
+      <h2>
+       <img class="center" alt="" src="{$home_image}" align=middle> 
+       {t}Private{/t}
+      </h2>
 
- <table summary="" width="100%">
-  <tr>
-   <td>{t}Address{/t}<br><br></td>
-   <td style="vertical-align:top;"><i>{$info_homePostalAddress}</i></td>
-  </tr>
-  <tr>
-   <td>{t}Phone{/t}</td><td><i>{$info_homePhone}</i></td>
-  </tr>
-  <tr>
-   <td>{t}Mobile{/t}</td><td><i>{$info_mobile}</i></td>
-  </tr>
-  <tr>
-   <td>{t}Email{/t}</td><td><i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i></td>
-  </tr>
- </table>
+      <table summary="" width="100%">
+        <tr>
+         <td style='vertical-align:top; width: 40%;'>
+          {t}Address{/t}
+         </td>
+         <td style="vertical-align:top;">
+          <i>{$info_homePostalAddress}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Phone{/t}
+         </td>
+         <td>
+          <i>{$info_homePhone}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Mobile{/t}
+         </td>
+         <td>
+          <i>{$info_mobile}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Email{/t}
+         </td>
+         <td>
+          <i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i>
+         </td>
+        </tr>
+       </table>
 
-</td>
+      </td>
+     </tr>
 
-</tr>
+     <tr>
+      <td style="vertical-align:top; background-color: #E4E4E4" colspan=2>
 
-<tr>
-<td style="width:100%; vertical-align:top; background-color: #E4E4E4" colspan=2>
- <h2><img class="center" alt="" src="{$company_image}" align=middle> {t}Organizational{/t}</h2>
+       <h2>
+        <img class="center" alt="" src="{$company_image}" align=middle> 
+        {t}Organizational{/t}
+       </h2>
 
- <table summary="" width="100%">
-  <tr>
-   <td>
      <table summary="" width="100%">
+        <tr>
+         <td width='50%'>
   
-    <table summary="" width="100%">
-     <tr>
-      <td>{t}Company{/t}</td><td><i>{$info_o}</i></td>
-     </tr>
-     <tr>
-      <td>{t}Department{/t}</td><td><i>{$info_ou}</i></td>
-     </tr>
-     <tr>
-      <td>{t}City{/t}</td><td><i>{$info_l}</i></td>
-     </tr>
-     <tr>
-      <td>{t}Postal code{/t}</td><td><i>{$info_postalCode}</i></td>
-     </tr>
-     <tr>
-      <td>{t}Country{/t}</td><td><i>{$info_st}</i></td>
-     </tr>
-    </table>
-   </td>
-   <td style="vertical-align:top">
+          <table summary="" width="100%">
+           <tr>
+            <td style='width:40%;'>
+             {t}Company{/t}
+            </td>
+            <td>
+             <i>{$info_o}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Department{/t}
+            </td>
+            <td>
+             <i>{$info_ou}</i>
+            </td>
+           </tr>
+           <tr>
+            <td> 
+             {t}City{/t}
+            </td>
+            <td>
+             <i>{$info_l}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Postal code{/t}
+            </td>
+            <td>
+             <i>{$info_postalCode}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Country{/t}
+            </td>
+            <td>
+             <i>{$info_st}</i>
+            </td>
+           </tr>
+          </table>
 
-    <table summary="" width="100%">
-     <tr>
-      <td>{t}Address{/t}<br><br></td><td style="vertical-align:top;"><i>{$info_postalAddress}</i></td>
-     </tr>
-     <tr>
-      <td>{t}Phone{/t}</td><td><i>{$info_telephoneNumber}</i></td>
-     </tr>
-     <tr>
-      <td>{t}FAX{/t}</td><td><i>{$info_facsimileTelephoneNumber}</i></td>
-     </tr>
-     <tr>
-      <td>{t}Pager{/t}</td><td><i>{$info_pager}</i></td>
+         </td>
+         <td style="vertical-align:top">
+
+          <table summary="" width="100%">
+           <tr>
+            <td style='vertical_align:top; width:40%;'>
+             {t}Address{/t}
+            </td>
+            <td style="vertical-align:top;">
+             <i>{$info_postalAddress}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Phone{/t}
+            </td>
+            <td>
+             <i>{$info_telephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}FAX{/t}
+            </td>
+            <td>
+             <i>{$info_facsimileTelephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Pager{/t}
+            </td>
+            <td>
+             <i>{$info_pager}</i>
+            </td>
+           </tr>
+          </table>
+         </td>
+        </tr>
+       </table>
+
+      </td> 
      </tr>
     </table>
-   </td>
-  </tr>
- </table>
 
-</td>
-</tr>
-</table>
-
-</td>
-</tr>
+   </td>
+ </tr>
 </table>
index d3c2b9f3aec6313fa0983f87977c3106920cea85..1f1dff6be1d2d5b698627daf1d6950011cb95114 100644 (file)
@@ -410,7 +410,7 @@ class addressbook extends plugin
     
           $acls = $this->get_entry_acls($attrs['dn'],$attr);  
           if(!preg_match("/r/",$acls)){
-            $attrs[$attr][0] = "Not allowed";
+            $attrs[$attr][0] = "";
           }else{
             $any = true;
           }
@@ -444,12 +444,15 @@ class addressbook extends plugin
             <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
             </a>";
 
-          if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
-            $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
-            $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
 
-              "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
-              "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
+          if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){
+            if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
+              $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
+              $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
+
+                "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
+                "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
+            }
           }
           $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= "</td>";
         }
@@ -494,19 +497,33 @@ class addressbook extends plugin
       $smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&amp;close=1");
 
       $tmp = $this->plInfo();
-      foreach($tmp['plProvidedAcls'] as $name => $translated){
-        $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
-      }
+
+      
 
       switch ($_SESSION['show_info']){
 
         case "ADD":
+
+          $a_bases = $this->get_allowed_bases();
+  
+          if(!in_array_ics($this->storage_base,$a_bases)){
+            $base = key($this->get_allowed_bases());
+            $this->storage_base = $base;
+          } 
+
           $smarty->assign ('storage_base', $this->storage_base);
           $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
+
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name));
+          }
         break;
 
         default:
           $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
+          }
         break;
       }
 
@@ -516,6 +533,12 @@ class addressbook extends plugin
         $info= $ldap->fetch();
       }
       foreach ($this->attributes as $name){
+
+        /* Skip entries we are not allowed to read */
+        if(!preg_match("/r/",$this->get_entry_acls($_SESSION['show_info'],$name))){
+          $smarty->assign("info_$name", "");
+        }else
+
         if ($_SESSION['show_info'] != "ADD" && isset($info["$name"][0])){
           error_reporting(0);
           /* Special treatment for phone attributes */