Code

Updated infoPage
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 1 Dec 2010 14:07:30 +0000 (14:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 1 Dec 2010 14:07:30 +0000 (14:07 +0000)
-Added iamge ACLs
-Added default image.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20491 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/ihtml/themes/default/infoPage.tpl
gosa-core/plugins/generic/infoPage/class_infoPage.inc

index f7f0b77edeb7fd97e5eb31b5568dd2754fc580f6..269135da0630da0c6c99e70999745a5b6619b1ee 100644 (file)
@@ -5,8 +5,12 @@
 
     <table width="100%">
         <tr>
-            <td>
-                    <img src="getbin.php?rand={$rand}" alt='' style='max-width:147px; max-height: 200px; vertical-align: middle;' >
+            <td style='width:147px; height:200px; background-color:gray; vertical-align: middle;' >
+                {if $jpegPhoto == ""}
+                    <img  src="plugins/users/images/default.jpg" alt=''>
+                {else}
+                    <img  src="getbin.php?rand={$rand}" alt='' style='max-width:147px; max-height: 200px; vertical-align: middle;' >
+                {/if}
             </td>
             <td style="width:33%">
                 <table>
index ce958029feebcc4312aacd636c6ec6ba1c82f51b..ec0aba6216b6b9ab02a6cb20fc21f804f2ac6f51 100644 (file)
@@ -135,21 +135,24 @@ class infoPage extends plugin
             }
         }
 
-        #TODO: Permission
-        if(!isset($this->attrs['jpegPhoto'])){
-            #echo "No image...";
-        }
-
         // Convert address
-        if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", "homePostalAddress")) && isset($this->attrs['homePostalAddress'][0])){
+        if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", "homePostalAddress")) && 
+                isset($this->attrs['homePostalAddress'][0])){
             $smarty->assign("homePostalAddress", preg_replace("/\n/", "<br>", $this->attrs['homePostalAddress'][0]));
         }
 
-        session::set('binary',$this->attrs['jpegPhoto'][0]);
-        session::set('binarytype',"image/jpeg");
+        // Assign JPEG Photo only if it is set and if we are allowed to view it.
+        $smarty->assign("jpegPhoto", "");
+        if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", "userPicture")) && 
+                isset($this->attrs['jpegPhoto'][0])){
+            session::set('binary',$this->attrs['jpegPhoto'][0]);
+            session::set('binarytype',"image/jpeg");
+            $smarty->assign("jpegPhoto", $this->attrs['jpegPhoto']);
+        }
 
         // Set date of birth
-        if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", "dateOfBirth")) && isset($this->attrs['dateOfBirth'][0])){
+        if(preg_match("/r/", $this->ui->get_permissions($this->ui->dn,"users/user", "dateOfBirth")) && 
+                isset($this->attrs['dateOfBirth'][0])){
             $smarty->assign("dateOfBirth", date('d.m.Y',strtotime($this->attrs['dateOfBirth'][0])));
         }