fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [8767] property: view picture


From: Sigurd Nes
Subject: [Fmsystem-commits] [8767] property: view picture
Date: Thu, 02 Feb 2012 13:00:58 +0000

Revision: 8767
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8767
Author:   sigurdne
Date:     2012-02-02 13:00:58 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
property: view picture

Modified Paths:
--------------
    trunk/property/inc/class.uientity.inc.php
    trunk/property/js/yahoo/entity.index.js

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2012-02-02 12:44:06 UTC (rev 
8766)
+++ trunk/property/inc/class.uientity.inc.php   2012-02-02 13:00:58 UTC (rev 
8767)
@@ -715,14 +715,80 @@
 
                        $uicols = $this->bo->uicols;
 
+                       $uicols['name'][]               = 'img_id';
+                       $uicols['descr'][]              = 'dummy';
+                       $uicols['sortable'][]   = false;
+                       $uicols['sort_field'][] = '';
+                       $uicols['format'][]             = '';
+                       $uicols['formatter'][]  = '';
+                       $uicols['input_type'][] = 'hidden';
+
+                       $uicols['name'][]               = 'directory';
+                       $uicols['descr'][]              = 'directory';
+                       $uicols['sortable'][]   = false;
+                       $uicols['sort_field'][] = '';
+                       $uicols['format'][]             = '';
+                       $uicols['formatter'][]  = '';
+                       $uicols['input_type'][] = 'hidden';
+
+                       $uicols['name'][]               = 'file_name';
+                       $uicols['descr'][]              = lang('name');
+                       $uicols['sortable'][]   = false;
+                       $uicols['sort_field'][] = '';
+                       $uicols['format'][]             = '';
+                       $uicols['formatter'][]  = '';
+                       $uicols['input_type'][] = 'hidden';
+
+                       $uicols['name'][]               = 'picture';
+                       $uicols['descr'][]              = '';
+                       $uicols['sortable'][]   = false;
+                       $uicols['sort_field'][] = '';
+                       $uicols['format'][]             = '';
+                       $uicols['formatter'][]  = 'show_picture';
+                       $uicols['input_type'][] = '';
+
+                       $vfs = CreateObject('phpgwapi.vfs');
+                       $vfs->override_acl = 1;
+
+
+                       $img_types = array
+                       (
+                               'image/jpeg',
+                               'image/png',
+                               'image/gif'
+                       );
+
                        $content = array();
                        $j=0;
                        if (isset($entity_list) && is_array($entity_list))
                        {
-                               foreach($entity_list as $entity_entry)
+                               foreach($entity_list as &$entity_entry)
                                {
+                                       $_loc1 = isset($entity_entry['loc1']) 
&& $entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
+
+                                       $_files = $vfs->ls(array(
+                                               'string' => 
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
+                                               'relatives' => 
array(RELATIVE_NONE)));
+       
+                                       if(isset($_files[0]) && $_files[0] && 
in_array($_files[0]['mime_type'], $img_types))
+                                       {
+                                               $entity_entry['file_name']      
= urlencode($_files[0]['name']);
+                                               $entity_entry['directory']      
= urlencode($_files[0]['directory']);
+                                               $entity_entry['img_id']         
= $_files[0]['file_id'];
+                                       }
+
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
+
+                                               switch ($uicols['name'][$i])
+                                               {
+                                                       case 'num':
+                                                       case 'loc1':
+                                                       case 'loc1_name':
+                                                               
$uicols['input_type'][$i] = 'hidden';
+                                                               break;
+                                               }
+
                                                
if($uicols['input_type'][$i]!='hidden')
                                                {
                                                        
if(isset($entity_entry['query_location'][$uicols['name'][$i]]))
@@ -763,7 +829,7 @@
                                        $j++;
                                }
                        }
-
+                       $vfs->override_acl = 0;
                        //indica que de la fila seleccionada escogera de la 
columna "id" el valor "id". Para agregarlo al URL
                        $parameters = array
                                (

Modified: trunk/property/js/yahoo/entity.index.js
===================================================================
--- trunk/property/js/yahoo/entity.index.js     2012-02-02 12:44:06 UTC (rev 
8766)
+++ trunk/property/js/yahoo/entity.index.js     2012-02-02 13:00:58 UTC (rev 
8767)
@@ -109,6 +109,17 @@
                }
 
        }
+
+       var show_picture = function(elCell, oRecord, oColumn, oData)
+       {
+               if(oRecord.getData('img_id'))
+               {
+                       var oArgs = {menuaction:'property.uigallery.view_file', 
file:oRecord.getData('directory') + '/' + oRecord.getData('file_name')};
+                       var sUrl = phpGWLink('index.php', oArgs);
+                       elCell.innerHTML =  "<a href=\""+sUrl+"\" 
title=\""+oRecord.getData('file_name')+"\" id=\""+oRecord.getData('img_id')+"\" 
rel=\"colorbox\" target=\"_blank\"><img src=\""+sUrl+"&thumb=1\" 
alt=\""+oRecord.getData('file_name')+"\" /></a>";
+               }
+       }
+
 
/****************************************************************************************/
 
        this.myParticularRenderEvent = function()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]