fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11153] property: images from external url


From: Sigurd Nes
Subject: [Fmsystem-commits] [11153] property: images from external url
Date: Thu, 06 Jun 2013 13:20:39 +0000

Revision: 11153
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11153
Author:   sigurdne
Date:     2013-06-06 13:20:35 +0000 (Thu, 06 Jun 2013)
Log Message:
-----------
property: images from external url

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   2013-06-06 09:28:37 UTC (rev 
11152)
+++ trunk/property/inc/class.uientity.inc.php   2013-06-06 13:20:35 UTC (rev 
11153)
@@ -473,6 +473,31 @@
                        if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
 
+
+///// integration
+/*
+                       integration_tab
+                       integration_height
+                       integration_url
+                       integration_parametres
+                       integration_action
+                       integration_action_view
+                       integration_action_edit
+                       integration_auth_key_name
+                       integration_auth_url
+                       integration_auth_hash_name
+                       integration_auth_hash_value
+                       integration_location_data
+ */
+
+
+
+
+                       $_integration_set = array();
+
+///// integration
+
+
                                $datatable['menu']                              
                =       $this->bocommon->get_menu($this->type_app[$this->type]);
 
                                $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
@@ -766,8 +791,45 @@
                                        }
                                }
 
-                               $code = 'var ' . implode(',', $button_def)  . 
";\n";
+
+                               $NormalButton_def[] = "oNormalButton_0";
+                               $NormalButton_def[] = "oNormalButton_1";
+                               $NormalButton_def[] = "oNormalButton_2";
+                               $NormalButton_inner[] = "{order:0, 
name:'btn_search',funct:'onSearchClick'}";
+                               $NormalButton_inner[] = "{order:1, 
name:'btn_new',      funct:'onNewClick'}";
+                               $NormalButton_inner[] = "{order:2, 
name:'btn_export',funct:'onDownloadClick'}";
+
+
+                               foreach ($_integration_set as $i => 
$_integration)
+                               {       
+
+                                       $NormalButton_def[] = 'oNormalButton_' 
. ($i + 3); 
+                                       $NormalButton_inner[] = "{order:" . ($i 
+ 3)  .", name:'btn_integration_{$i}',funct:'onIntegrationClick_{$i}'}";
+
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                       (
+                                               'type'  => 'button',
+                                               'id'    => 
"btn_integration_{$i}",
+                                               'value' => 
$_integration['name'],
+                                               'tab_index' => 10 + $i
+                                       );
+
+                                       $_js_functions .= <<<JS
+                                               this.onIntegrationClick_{$i} = 
function()
+                                               {
+                                                       
window.open(values_ds.integrationurl_{$i},'window');
+                                               }
+JS;
+                               }
+
+                               $code = 'var ' . implode(',', 
$NormalButton_def)  . ";\n";
+                               $code .= 'var normalButtons = [' . "\n" . 
implode(",\n",$NormalButton_inner) . "\n];";
+
+
+                               $code .= 'var ' . implode(',', $button_def)  . 
";\n";
                                $code .= 'var selectsButtons = [' . "\n" . 
implode(",\n",$code_inner) . "\n];";
+                               //new
+                               $code .= $_js_functions;
 
                                $GLOBALS['phpgw']->js->add_code('', $code);
 
@@ -827,20 +889,58 @@
                        $uicols['sortable'][]   = false;
                        $uicols['sort_field'][] = '';
                        $uicols['format'][]             = '';
-                       $uicols['formatter'][]  = 'show_picture';
                        $uicols['input_type'][] = '';
 
-                       $vfs = CreateObject('phpgwapi.vfs');
-                       $vfs->override_acl = 1;
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+                       $custom_config  = 
CreateObject('admin.soconfig',$location_id);
+                       $_config = isset($custom_config->config_data) && 
$custom_config->config_data ? $custom_config->config_data : array();
 
+                       $remote_image_in_table = false;
+                       foreach ($_config as $_config_section => 
$_config_section_data)
+                       {
 
-                       $img_types = array
-                       (
-                               'image/jpeg',
-                               'image/png',
-                               'image/gif'
-                       );
+                               if($_config_section_data['image_in_table'])
+                               {
+                       
+                                       $remote_image_in_table = true;
+                                       $js = <<<JS
+       var show_picture_remote = function(elCell, oRecord, oColumn, oData)
+       {
+               if(oRecord.getData('img_id'))
+               {
+                       sUrl = '{$_config_section_data['url']}';
+                       sUrl += '&{$_config_section_data['img_key_remote']}=' + 
oRecord.getData('img_id');
+                       elCell.innerHTML =  "<a href=\""+sUrl+"\" 
title=\""+oRecord.getData('file_name')+"\" id=\""+oRecord.getData('img_id')+"\" 
rel=\"colorbox\" target=\"_blank\"><img 
src=\""+sUrl+"&{$_config_section_data['thumbnail_flag']}\" 
alt=\""+oRecord.getData('file_name')+"\" /></a>";
+               }
+       }
+JS;
+                                       $GLOBALS['phpgw']->js->add_code('', 
$js);
 
+                                       break;
+                               }
+                       }
+
+
+                       if(!$remote_image_in_table)
+                       {
+
+                               $uicols['formatter'][]  = 'show_picture';
+
+                               $vfs = CreateObject('phpgwapi.vfs');
+                               $vfs->override_acl = 1;
+
+                               $img_types = array
+                               (
+                                       'image/jpeg',
+                                       'image/png',
+                                       'image/gif'
+                               );
+                       }
+                       else
+                       {
+                               $uicols['formatter'][]  = 
'show_picture_remote';                        
+                       }
+
                        $content = array();
                        $j=0;
                        if (isset($entity_list) && is_array($entity_list))
@@ -849,11 +949,11 @@
                                {
                                        $_loc1 = isset($entity_entry['loc1']) 
&& $entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
 
-                                       if(false)
+                                       if($remote_image_in_table)
                                        {
-                                               $entity_entry['file_name']      
= $entity_entry['museumsnr'];
-                                               $entity_entry['directory']      
= urlencode('external_source');
-                                               $entity_entry['img_id']         
= $entity_entry['museumsnr'];
+                                               $entity_entry['file_name']      
= $entity_entry[$_config_section_data['img_key_local']];
+                                       //      $entity_entry['directory']      
= urlencode('external_source');
+                                               $entity_entry['img_id']         
= $entity_entry[$_config_section_data['img_key_local']];
                                        }
                                        else
                                        {

Modified: trunk/property/js/yahoo/entity.index.js
===================================================================
--- trunk/property/js/yahoo/entity.index.js     2013-06-06 09:28:37 UTC (rev 
11152)
+++ trunk/property/js/yahoo/entity.index.js     2013-06-06 13:20:35 UTC (rev 
11153)
@@ -12,14 +12,16 @@
        {order:4, var_URL:'criteria_id', 
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
        ]
 */
+
        // define buttons
+/*
        var oNormalButton_0, oNormalButton_1, oNormalButton_2;
        var normalButtons = [
        {order:0, name:'btn_search',funct:"onSearchClick"},
        {order:1, name:'btn_new',       funct:"onNewClick"},
        {order:2, name:'btn_export',funct:"onDownloadClick"}
        ]
-
+*/
     var toolTips = [
     {name:'btn_export', title:'download', description:'Download table to your 
browser',ColumnDescription:''}
     ]




reply via email to

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