fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10280] property: autocomplete as custom field


From: Sigurd Nes
Subject: [Fmsystem-commits] [10280] property: autocomplete as custom field
Date: Sat, 20 Oct 2012 22:29:16 +0000

Revision: 10280
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10280
Author:   sigurdne
Date:     2012-10-20 22:29:16 +0000 (Sat, 20 Oct 2012)
Log Message:
-----------
property:  autocomplete as custom field

Modified Paths:
--------------
    trunk/property/inc/class.custom_fields.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.uiadmin_entity.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/templates/base/attributes_form.xsl

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2012-10-20 22:28:22 UTC 
(rev 10279)
+++ trunk/property/inc/class.custom_fields.inc.php      2012-10-20 22:29:16 UTC 
(rev 10280)
@@ -293,14 +293,7 @@
                                        }
 
                                        $insert_record_values[]                 
= $attributes['name'];
-                                       $lookup_link                            
        = $GLOBALS['phpgw']->link('/index.php',array(
-                                               'menuaction'                    
=> 'property.uilookup.custom',
-                                               'column'                        
        => $attributes['name'],
-                                               'get_list_function'             
=> $attributes['get_list_function'],
-                                               'get_list_function_input'       
=> urlencode(serialize($attributes['get_list_function_input']))
-                                       ));
 
-
                                        $_append_url = '';
                                        
if(isset($attributes['get_list_function_input']) && 
is_array($attributes['get_list_function_input']))
                                        {

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2012-10-20 22:28:22 UTC (rev 
10279)
+++ trunk/property/inc/class.soentity.inc.php   2012-10-20 22:29:16 UTC (rev 
10280)
@@ -167,7 +167,7 @@
                        $where= 'WHERE';
                        $filtermethod = '';
 
-                       $_config        = 
CreateObject('phpgwapi.config','property');
+                       $_config        = 
CreateObject('phpgwapi.config',$this->type_app[$this->type]);
                        $_config->read();
                        if(isset($_config->config_data['acl_at_location'])
                                && $_config->config_data['acl_at_location']
@@ -489,7 +489,7 @@
                        $filtermethod = "WHERE fm_bim_type.location_id = 
{$location_id}";
                        $where= 'AND';
 
-                       $_config        = 
CreateObject('phpgwapi.config','property');
+                       $_config        = 
CreateObject('phpgwapi.config',$this->type_app[$this->type]);
                        $_config->read();
                        if(isset($_config->config_data['acl_at_location'])
                                && $_config->config_data['acl_at_location']
@@ -732,7 +732,7 @@
 
                        $_sql = str_replace('__XML-ORDER__', '', $sql);
 
-//                     $cache_info = 
phpgwapi_cache::session_get('property',"{$location_id}_listing_metadata");
+//                     $cache_info = 
phpgwapi_cache::session_get($this->type_app[$this->type],"{$location_id}_listing_metadata");
 
                        if (!isset($cache_info['sql_hash']) || 
$cache_info['sql_hash'] != md5($_sql))
                        {
@@ -754,7 +754,7 @@
                                        'total_records'         => 
$this->db->f('cnt'),
                                        'sql_hash'                      => 
md5($_sql)
                                );
-                               
phpgwapi_cache::session_set('property',"{$location_id}_listing_metadata",$cache_info);
+                               
phpgwapi_cache::session_set($this->type_app[$this->type],"{$location_id}_listing_metadata",$cache_info);
                        }
 
                        $this->total_records    = $cache_info['total_records'];
@@ -1175,7 +1175,7 @@
                        $where= 'WHERE';
                        $filtermethod = '';
 
-                       $_config        = 
CreateObject('phpgwapi.config','property');
+                       $_config        = 
CreateObject('phpgwapi.config',$this->type_app[$this->type]);
                        $_config->read();
                        if(isset($_config->config_data['acl_at_location'])
                                && $_config->config_data['acl_at_location']
@@ -1397,7 +1397,7 @@
 
 //_debug_array($sql);
 
-                       $cache_info = 
phpgwapi_cache::session_get('property',"{$entity_table}_listing_metadata");
+                       $cache_info = 
phpgwapi_cache::session_get($this->type_app[$this->type],"{$entity_table}_listing_metadata");
 
                        if (!isset($cache_info['sql_hash']) || 
$cache_info['sql_hash'] != md5($sql))
                        {
@@ -1419,7 +1419,7 @@
                                        'total_records'         => 
$this->db->f('cnt'),
                                        'sql_hash'                      => 
md5($sql)
                                );
-                               
phpgwapi_cache::session_set('property',"{$entity_table}_listing_metadata",$cache_info);
+                               
phpgwapi_cache::session_set($this->type_app[$this->type],"{$entity_table}_listing_metadata",$cache_info);
                        }
 
                        $this->total_records    = $cache_info['total_records'];
@@ -1785,10 +1785,10 @@
                                {
                                        $p_category = 
$admin_entity->read_single_category($values_insert['p_entity_id'], 
$values_insert['p_cat_id']);
                                        $values_insert['p_id']                  
= (int) ltrim($values_insert['p_num'], $p_category['prefix']);
-                                       $values_insert['p_location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$values_insert['p_entity_id']}.{$values_insert['p_cat_id']}");
+                                       $values_insert['p_location_id'] = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$values_insert['p_entity_id']}.{$values_insert['p_cat_id']}");
                                }
 
-                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$entity_id}.{$cat_id}");
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                                $values['id'] = 
$this->_save_eav($values_insert, $location_id, 
".{$this->type}.{$entity_id}.{$cat_id}");
                        }
                        else
@@ -1814,7 +1814,7 @@
                                                (
                                                        'location1_id'          
=> $GLOBALS['phpgw']->locations->get_id('property', 
$values['origin'][0]['location']),
                                                        'location1_item_id' => 
$values['origin'][0]['data'][0]['id'],
-                                                       'location2_id'          
=> $GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$entity_id}.{$cat_id}"),
+                                                       'location2_id'          
=> $GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}"),
                                                        'location2_item_id' => 
$values['id'],
                                                        'account_id'            
=> $this->account
                                                );
@@ -1858,7 +1858,7 @@
                        $doc->loadXML( $xmldata );
                        $domElement = 
$doc->getElementsByTagName($location_name)->item(0);
                        $domAttribute = $doc->createAttribute('appname');
-                       $domAttribute->value = 'property';
+                       $domAttribute->value = $this->type_app[$this->type];
 
                        // Don't forget to append it to the element
                        $domElement->appendChild($domAttribute);
@@ -1922,7 +1922,7 @@
                        $doc->loadXML( $xmldata );
                        $domElement = 
$doc->getElementsByTagName($location_name)->item(0);
                        $domAttribute = $doc->createAttribute('appname');
-                       $domAttribute->value = 'property';
+                       $domAttribute->value = $this->type_app[$this->type];
 
                        // Don't forget to append it to the element
                        $domElement->appendChild($domAttribute);
@@ -2005,6 +2005,11 @@
                                }
                        }
 
+                       $admin_entity   = 
CreateObject('property.soadmin_entity');
+                       $admin_entity->type = $this->type;
+                       $category = 
$admin_entity->read_single_category($entity_id, $cat_id);
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
+
                        if (isset($values_attribute) AND 
is_array($values_attribute))
                        {
                                foreach($values_attribute as $entry)
@@ -2038,10 +2043,25 @@
 
                                        if($entry['history'] == 1)
                                        {
-                                               $this->db->query("SELECT 
{$entry['name']} FROM {$table} WHERE id = '{$values['id']}'",__LINE__,__FILE__);
-                                               $this->db->next_record();
-                                               $old_value = 
$this->db->f($entry['name'],true);
+                                               if(!$category['is_eav'])
+                                               {
+                                                       
$this->db->query("SELECT {$entry['name']} FROM {$table} WHERE id = 
'{$values['id']}'",__LINE__,__FILE__);
+                                                       
$this->db->next_record();
+                                                       $old_value = 
$this->db->f($entry['name'],true);
+                                               }
+                                               else
+                                               {
+                                                       $sql = "SELECT * FROM 
fm_bim_item WHERE fm_bim_item.id = {$values['id']} AND location_id = 
$location_id";                       
 
+                                                       
$this->db->query($sql,__LINE__,__FILE__);
+
+                                                       
$this->db->next_record();
+                                                       $xmldata = 
$this->db->f('xml_representation');
+                                                       $xml = new 
DOMDocument('1.0', 'utf-8');
+                                                       $xml->loadXML($xmldata);
+                                                       $old_value      = 
$xml->getElementsByTagName($entry['name'])->item(0)->nodeValue;
+                                               }
+
                                                if($entry['datatype'] == 'D')
                                                {
                                                        $old_value = 
date(phpgwapi_db::date_format(), strtotime($old_value));
@@ -2059,10 +2079,6 @@
                                }
                        }
 
-                       $admin_entity   = 
CreateObject('property.soadmin_entity');
-                       $admin_entity->type = $this->type;
-                       $category = 
$admin_entity->read_single_category($entity_id, $cat_id);
-
                        $this->db->transaction_begin();
 
                        if($category['is_eav'])
@@ -2071,10 +2087,9 @@
                                {
                                        $p_category = 
$admin_entity->read_single_category($value_set['p_entity_id'], 
$value_set['p_cat_id']);
                                        $value_set['p_id']                      
= (int) ltrim($value_set['p_num'], $p_category['prefix']);
-                                       $value_set['p_location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$value_set['p_entity_id']}.{$value_set['p_cat_id']}");
+                                       $value_set['p_location_id'] = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$value_set['p_entity_id']}.{$value_set['p_cat_id']}");
                                }
 
-                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$entity_id}.{$cat_id}");
                                $this->_edit_eav($value_set, $location_id, 
".{$this->type}.{$entity_id}.{$cat_id}", $values['id']);
                        }
                        else
@@ -2083,7 +2098,7 @@
                                $this->db->query("UPDATE $table set $value_set 
WHERE id=" . $values['id'],__LINE__,__FILE__);
                        }
 
-                       if (isset($history_set) AND is_array($history_set))
+                       if (isset($history_set) && is_array($history_set))
                        {
                                $historylog     = 
CreateObject('property.historylog',"{$this->type}_{$entity_id}_{$cat_id}");
                                foreach ($history_set as $attrib_id => $history)

Modified: trunk/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_entity.inc.php     2012-10-20 22:28:22 UTC 
(rev 10279)
+++ trunk/property/inc/class.uiadmin_entity.inc.php     2012-10-20 22:29:16 UTC 
(rev 10280)
@@ -2375,12 +2375,14 @@
                                case 'LB':
                                        $multiple_choice = true;
                                        break;
-                               case 'custom1';
+                               case 'custom1':
                                        $custom_get_list = true;
                                        break;
-                               case 'custom2';
+                               case 'custom2':
+                               case 'custom3':
                                        $custom_get_list = true;
                                        $custom_get_single = true;
+                                       break;
                                default:
                        }
 

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2012-10-20 22:28:22 UTC (rev 
10279)
+++ trunk/property/inc/class.uientity.inc.php   2012-10-20 22:29:16 UTC (rev 
10280)
@@ -2049,8 +2049,10 @@
                        phpgwapi_yui::load_widget('paginator');
                        phpgwapi_yui::load_widget('animation');
 
+                       phpgwapi_yui::load_widget('calendar');
                        phpgwapi_yui::load_widget('autocomplete');
 
+
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'common', 'phpgwapi' );
 
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/examples/treeview/assets/css/folders/tree.css');

Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl   2012-10-20 22:28:22 UTC 
(rev 10279)
+++ trunk/property/templates/base/attributes_form.xsl   2012-10-20 22:29:16 UTC 
(rev 10280)
@@ -329,20 +329,20 @@
                                                                        
<xsl:text>_container</xsl:text>
                                                                </xsl:variable>
 
-                                           <input id="{$custom_id}" 
name="{$custom_id}" type="hidden" value="{value}">
-                                           </input>
-                                           <input id="{$custom_name}" 
name="{$custom_name}" type="text" value="{custom_name}">
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="disabled!=''">
-                                                                               
        <xsl:attribute name="disabled">
-                                                                               
                <xsl:text> disabled</xsl:text>
-                                                                               
        </xsl:attribute>
-                                                                               
</xsl:when>
-                                                                       
</xsl:choose>
-
-                                           </input>
-                                           <div id="{$custom_container}"/>
-
+                                                               <div 
class="autocomplete">
+                                               <input id="{$custom_id}" 
name="values_attribute[{counter}][value]" type="hidden" value="{value}">
+                                               </input>
+                                               <input id="{$custom_name}" 
name="{$custom_name}" type="text" value="{custom_name}">
+                                                                               
<xsl:choose>
+                                                                               
        <xsl:when test="disabled!=''">
+                                                                               
                <xsl:attribute name="disabled">
+                                                                               
                        <xsl:text> disabled</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </xsl:when>
+                                                                               
</xsl:choose>
+                                                                       </input>
+                                                                       <div 
id="{$custom_container}"/>
+                                                               </div>
                                                        </xsl:when>
                                                        <xsl:when 
test="datatype='user'">
                                                                <xsl:variable 
name="user_name">




reply via email to

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