fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13168] fix history on custom attribs for generic-cla


From: Sigurd Nes
Subject: [Fmsystem-commits] [13168] fix history on custom attribs for generic-class
Date: Fri, 08 May 2015 12:25:29 +0000

Revision: 13168
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13168
Author:   sigurdne
Date:     2015-05-08 12:25:28 +0000 (Fri, 08 May 2015)
Log Message:
-----------
fix history on custom attribs for generic-class

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.bogeneric.inc.php
    branches/dev-syncromind/property/inc/class.custom_fields.inc.php
    branches/dev-syncromind/property/inc/class.historylog.inc.php
    branches/dev-syncromind/property/inc/class.sogeneric.inc.php
    branches/dev-syncromind/property/inc/class.uigeneric.inc.php
    branches/dev-syncromind/property/setup/setup.inc.php
    branches/dev-syncromind/property/setup/tables_current.inc.php
    branches/dev-syncromind/property/setup/tables_update.inc.php
    branches/dev-syncromind/property/templates/base/attrib_history.xsl

Modified: branches/dev-syncromind/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.bogeneric.inc.php        
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/inc/class.bogeneric.inc.php        
2015-05-08 12:25:28 UTC (rev 13168)
@@ -268,10 +268,9 @@
 
                public function read_attrib_history($data)
                {
-                       $attrib_data = $this->custom->get($data['app'], 
$data['acl_location'], $data['attrib_id'], $inc_choices = true);
-                       $history_type = 
$this->get_history_type_for_location($data['acl_location']);
-                       $historylog = 
CreateObject('property.historylog',$history_type);
-                       $history_values = 
$historylog->return_array(array(),array('SO'),'history_timestamp','DESC',$data['id'],$data['attrib_id'],
 $data['detail_id']);
+                       $attrib_data = $this->custom->get($data['appname'], 
$data['acl_location'], $data['attrib_id'], $inc_choices = true);
+                       $historylog = 
CreateObject('property.historylog',$data['appname'],$data['acl_location']);
+                       $history_values = 
$historylog->return_array(array(),array('SO'),'history_timestamp','DESC',$data['id'],$data['attrib_id']);
 
                        if($attrib_data['column_info']['type'] == 'LB')
                        {
@@ -301,6 +300,12 @@
                        return $history_values;
                }
 
+               public function delete_history_item($data)
+               {
+                       $historylog = 
CreateObject('property.historylog',$data['appname'],$data['acl_location']);
+                       
$historylog->delete_single_record((int)$data['history_id']);
+               }
+
                function get_history_type_for_location($acl_location)
                {
                        switch($acl_location)

Modified: branches/dev-syncromind/property/inc/class.custom_fields.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.custom_fields.inc.php    
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/inc/class.custom_fields.inc.php    
2015-05-08 12:25:28 UTC (rev 13168)
@@ -575,9 +575,10 @@
                                                        if($entry['value'] != 
$old_value)
                                                        {
                                                                
$data['history_set'][$entry['attrib_id']] = array
-                                                               ('
-                                                                       value'  
=> $entry['value'],
-                                                                       'date'  
=> phpgwapi_datetime::date_to_timestamp($entry['date'])
+                                                               (
+                                                                       'value' 
        => $entry['value'],
+                                                                       
'old_value'     => $old_value,
+                                                                       'date'  
        => phpgwapi_datetime::date_to_timestamp($entry['date'])
                                                                );
                                                        }
                                                }

Modified: branches/dev-syncromind/property/inc/class.historylog.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.historylog.inc.php       
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/inc/class.historylog.inc.php       
2015-05-08 12:25:28 UTC (rev 13168)
@@ -34,12 +34,17 @@
 
        class property_historylog
        {
-               var $db;
-               var $appname;
-               var $table;
-               var $attrib_id_field = '';
-               var $detail_id_field = '';
-               var $types = array(
+               private $db;
+               private $appname;
+               private $table;
+               private $attrib_id_field = '';
+               private $detail_id_field = '';
+               private $location_id_field = '';
+               private $app_id_field = '';
+               private $app_id;
+               private $location_id;
+
+               private $types = array(
                        'C' => 'Created',
                        'D' => 'Deleted',
                        'E' => 'Edited'
@@ -47,7 +52,7 @@
                var $alternate_handlers = array();
                var $account;
 
-               function property_historylog($appname)
+               function __construct($appname,$acl_location = '')
                {
                        if (! $this->account)
                        {
@@ -72,6 +77,10 @@
                                $selector = $appname;
                        }
 
+                       if($acl_location)
+                       {
+                               $selector = $acl_location;
+                       }
                        switch($selector)
                        {
                                case 'request':
@@ -102,6 +111,15 @@
                                case 'tenant_claim':
                                        $this->table='fm_tenant_claim_history';
                                        break;
+                               case '.vendor':
+                                       $appname = 'property';
+                                       $this->table ="fm_generic_history";
+                                       $this->attrib_id_field = 
'history_attrib_id';
+                                       $this->location_id_field = 
'location_id';
+                                       $this->app_id_field = 'app_id';
+                                       $this->app_id = 
$GLOBALS['phpgw']->applications->name2id($appname);
+                                       $this->location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, '.vendor');
+                                       break;
                                default:
                                        throw new Exception(lang('Unknown 
history register for acl_location: %1', $selector));
                                
@@ -112,24 +130,30 @@
                        $this->db      = & $GLOBALS['phpgw']->db;
                }
 
-               function delete($record_id,$attrib_id='')
+               function delete($record_id,$attrib_id = 0)
                {
+                       $condition = '';
                        if($attrib_id)
                        {
-                               $attrib_id_condition = "and history_attrib_id = 
$attrib_id";
+                               $condition .= " AND history_attrib_id = 
$attrib_id";
                        }
 
-                       $this->db->query("delete from $this->table where 
history_record_id='$record_id' and "
-                               . "history_appname='" . $this->appname . "' 
$attrib_id_condition",__LINE__,__FILE__);
+                       if($this->location_id_field)
+                       {
+                               $condition .= " AND {$this->location_id_field} 
= {$this->location_id}";
+                       }
+
+                       $this->db->query("DELETE FROM {$this->table} WHERE 
history_record_id='{$record_id}' AND "
+                               . 
"history_appname='{$this->appname}'{$condition}",__LINE__,__FILE__);
                }
 
                function delete_single_record($history_id)
                {
-                       $this->db->query("delete from $this->table where 
history_id='$history_id'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM {$this->table} WHERE 
history_id='{$history_id}'",__LINE__,__FILE__);
                }
 
 
-               function add($status,$record_id,$new_value,$old_value 
='',$attrib_id='', $date=0,$detail_id='')
+               function add($status,$record_id,$new_value,$old_value 
='',$attrib_id = 0, $date=0,$detail_id = 0)
                {
                        if($date)
                        {
@@ -143,7 +167,6 @@
                        $value_set = array
                        (
                                'history_record_id'             => $record_id,
-                               'history_appname'               => 
"'{$this->appname}'",
                                'history_owner'                 => 
(int)$this->account,
                                'history_status'                => 
"'{$status}'",
                                'history_new_value'             => "'" . 
$this->db->db_addslashes($new_value) . "'",
@@ -160,6 +183,20 @@
                                $value_set[$this->detail_id_field]      = 
(int)$detail_id;
                        }
 
+                       if($this->app_id)
+                       {
+                               $value_set[$this->app_id_field] = 
(int)$this->app_id;
+                       }
+                       else
+                       {
+                               $value_set['history_appname']   = 
"'{$this->appname}'";
+                       }
+
+                       if($this->location_id_field)
+                       {
+                               $value_set[$this->location_id_field]    = 
(int)$this->location_id;
+                       }
+
                        $cols = implode(',', array_keys($value_set));
                        $values = implode(',', array_values($value_set));
                        $sql = "INSERT INTO {$this->table} ({$cols}) VALUES 
({$values})";
@@ -173,18 +210,34 @@
                        $attrib_id = (int) $attrib_id;
                        $detail_id = (int) $detail_id;
                        
+                       $location_filter = '';
+
+                       if($this->app_id)
+                       {
+                               $location_filter .= " WHERE 
{$this->app_id_field} = " . (int) $this->app_id;
+                       }
+                       else
+                       {
+                               $location_filter .= " WHERE history_appname     
= '{$this->appname}'";
+                       }
+
+                       if($this->location_id_field)
+                       {
+                               $location_filter .= " AND 
{$this->location_id_field} = " . (int) $this->location_id;
+                       }
+
                        if (! $sort || ! $_orderby)
                        {
-                               $orderby = 'order by 
history_timestamp,history_id';
+                               $orderby = 'ORDER BY 
history_timestamp,history_id';
                        }
                        else
                        {
-                               $orderby = "order by $_orderby $sort";
+                               $orderby = "ORDER BY $_orderby $sort";
                        }
 
                        while (is_array($filter_out) && list(,$_filter) = 
each($filter_out))
                        {
-                               $filtered[] = "history_status != '$_filter'";
+                               $filtered[] = "history_status != '{$_filter}'";
                        }
 
                        $filter = '';
@@ -205,7 +258,7 @@
 
                        while (is_array($only_show) && list(,$_filter) = 
each($only_show))
                        {
-                               $_only_show[] = "history_status='$_filter'";
+                               $_only_show[] = "history_status='{$_filter}'";
                        }
 
                        $only_show_filter = '';
@@ -214,9 +267,8 @@
                                $only_show_filter = ' AND (' . implode(' OR 
',$_only_show) . ')';
                        }
 
-                       $this->db->query("SELECT * FROM {$this->table} WHERE 
history_appname='"
-                               . $this->appname . "' AND 
history_record_id=$record_id $filter $only_show_filter "
-                               . "$orderby",__LINE__,__FILE__);
+                       $this->db->query("SELECT * FROM {$this->table} 
{$location_filter}"
+                               . " AND history_record_id={$record_id} 
{$filter} {$only_show_filter} {$orderby}",__LINE__,__FILE__);
 
                        $return_values = array();
                        while ($this->db->next_record())

Modified: branches/dev-syncromind/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.sogeneric.inc.php        
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/inc/class.sogeneric.inc.php        
2015-05-08 12:25:28 UTC (rev 13168)
@@ -3261,16 +3261,16 @@
                                $this->_db->query("UPDATE $table SET 
{$value_set} WHERE {$this->location_info['id']['name']} = 
'{$id}'",__LINE__,__FILE__);
                        }
 
-/*                     //FIXME
+                       //FIXME
                        if (isset($data_attribute['history_set']) && 
is_array($data_attribute['history_set']))
                        {
-                               $historylog     = 
CreateObject('phpgwapi.historylog','property', 
$this->location_info['acl_location']);
+                               $historylog     = 
CreateObject('property.historylog',$this->location_info['acl_app'], 
$this->location_info['acl_location']);
                                foreach ($data_attribute['history_set'] as 
$attrib_id => $history)
                                {
-                                       
$historylog->add('SO',$data['id'],$history['value'],false, 
$attrib_id,$history['date']);
+                                       
$historylog->add('SO',$data['id'],$history['value'],isset($history['old_value'])?$history['old_value']:null,
 $attrib_id,$history['date']);
                                }
                        }
- */
+ 
                        $this->_db->transaction_commit();
 
                        $receipt['id'] = $data['id'];

Modified: branches/dev-syncromind/property/inc/class.uigeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uigeneric.inc.php        
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/inc/class.uigeneric.inc.php        
2015-05-08 12:25:28 UTC (rev 13168)
@@ -387,10 +387,6 @@
                                                                        
'sortable' => ($uicols['sortable'][$k]) ? true : false,
                                                                        
'hidden' => ($uicols['input_type'][$k] == 'hidden') ? true : false
                                                                );
-                                       if ($uicols['name'][$k] == 'id')
-                                       {
-                                               $params['formatter'] = 
'JqueryPortico.formatLink';
-                                       }
                                        switch ($uicols['datatype'][$k])
                                        {
                                                case 'email':
@@ -401,6 +397,11 @@
                                                break;
                                        }
 
+                                       if ($uicols['name'][$k] == 'id')
+                                       {
+                                               $params['formatter'] = 
'JqueryPortico.formatLink';
+                                               $params['editor'] = false;
+                                       }
                                        array_push 
($data['datatable']['field'], $params);
                        }
 
@@ -608,11 +609,10 @@
                                                        (
                                                                'menuaction'    
=> 'property.uigeneric.attrib_history',
                                                                'appname'       
        => $this->appname,
-                                                               'attrib_id'     
=> $attribute['id'],
-                                                               'actor_id'      
=> $actor_id,
-                                                               'role'          
=> $this->role,
+                                                               'attrib_id'     
        => $attribute['id'],
+                                                               'id'            
        => $id,
                                                                'acl_location'  
=> $this->acl_location,
-                                                               'edit'          
=> true
+                                                               'edit'          
        => true
                                                        );
 
                                                $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
@@ -725,22 +725,20 @@
 
                function attrib_history()
                {
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('attrib_history','nextmatchs'));
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
+                       $appname                = phpgw::get_var('appname', 
'string');
                        $acl_location   = phpgw::get_var('acl_location', 
'string');
                        $id                             = phpgw::get_var('id', 
'int');
                        $attrib_id              = phpgw::get_var('attrib_id', 
'int');
-                       $detail_id              = phpgw::get_var('detail_id', 
'int');
 
-                       $data_lookup= array
-                       (
-                               'app'                   => 'property',
-                               'acl_location'  => $acl_location,
-                               'id'                    => $id,
-                               'attrib_id'     => $attrib_id,
-                               'detail_id'     => $detail_id,
-                       );
+                       $data_lookup = array
+                               (
+                                       'appname'               => $appname,
+                                       'acl_location'  => $acl_location,
+                                       'id'                    => $id,
+                                       'attrib_id'     => $attrib_id,
+                               );
 
                        $delete = phpgw::get_var('delete', 'bool');
                        $edit = phpgw::get_var('edit', 'bool');
@@ -748,215 +746,146 @@
                        if ($delete)
                        {
                                $data_lookup['history_id'] = 
phpgw::get_var('history_id', 'int');
-               //              $this->bo->delete_history_item($data_lookup);
-                       }
+                               $this->bo->delete_history_item($data_lookup);
 
-                       $values = $this->bo->read_attrib_history($data_lookup);
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
-                       while (is_array($values) && list(,$entry) = 
each($values))
-                       {
-                               $link_delete_history_data = array
-                                       (
-                                               'menuaction'    => 
'property.uientity.attrib_history',
-                                               'acl_location'  => 
$acl_location,
-                                               'id'                    => 
$data_lookup['id'],
-                                               'attrib_id'             => 
$data_lookup['attrib_id'],
-                                               'detail_id'     => 
$data_lookup['detail_id'],
-                                               'history_id'    => $entry['id'],
-                                               'delete'                => true,
-                                               'edit'                  => true,
-                                               'type'                  => 
$this->type
-                                       );
-                               if($edit)
-                               {
-                                       $text_delete    = lang('delete');
-                                       $link_delete    = 
$GLOBALS['phpgw']->link('/index.php',$link_delete_history_data);
-                               }
-
-                               $content[] = array
-                                       (
-                                               'id'                            
=> $entry['id'],
-                                               'value'                         
=> $entry['new_value'],
-                                               'user'                          
=> $entry['owner'],
-                                               'time_created'                  
=> $GLOBALS['phpgw']->common->show_date($entry['datetime'],$dateformat),
-                                               'link_delete'                   
=> $link_delete,
-                                               'lang_delete_statustext'        
=> lang('delete the item'),
-                                               'text_delete'                   
=> $text_delete,
-                                       );
+                               return 'ok';
                        }
 
-
-                       $table_header = array
-                               (
-                                       'lang_value'            => 
lang('value'),
-                                       'lang_user'                     => 
lang('user'),
-                                       'lang_time_created'     => lang('time 
created'),
-                                       'lang_delete'           => 
lang('delete')
-                               );
-
                        $link_data = array
                                (
-                                       'menuaction'    => 
'property.uientity.attrib_history',
-                                       'acl_location'  => $acl_location,
-                                       'id'                    => $id,
-                                       'detail_id'     => 
$data_lookup['detail_id'],
-                                       'edit'                  => $edit,
-                                       'type'                  => $this->type
+                                       'menuaction'            => 
'property.uigeneric.attrib_history',
+                                       'appname'                       => 
$appname,
+                                       'acl_location'          => 
$acl_location,
+                                       'id'                            => $id,
+                                       'attrib_id'                     => 
$attrib_id,
+                                       'edit'                          => 
$edit,
+                                       'phpgw_return_as'       => 'json'
                                );
 
 
-                       //--- asynchronous response 
--------------------------------------------                                
-
                        if( phpgw::get_var('phpgw_return_as') == 'json')
                        {
-                               if(count($content))
+                               $values = 
$this->bo->read_attrib_history($data_lookup);
+                               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                               $content = array();
+                               while (is_array($values) && list(,$entry) = 
each($values))
                                {
-                                       return json_encode($content);
+                                       $content[] = array
+                                               (
+                                                       'id'                    
        => $entry['id'],
+                                                       'value'                 
        => $entry['new_value'],
+                                                       'user'                  
        => $entry['owner'],
+                                                       'time_created'          
=> $GLOBALS['phpgw']->common->show_date($entry['datetime'],"{$dateformat} 
G:i:s")
+                                               );
                                }
+
+                               $draw = phpgw::get_var('draw', 'int');
+                               $allrows = phpgw::get_var('length', 'int') == 
-1;
+
+                               $start = phpgw::get_var('start', 'int', 
'REQUEST', 0);
+                               $total_records = count($content);
+
+                               $num_rows = phpgw::get_var('length', 'int', 
'REQUEST', 0);
+
+                               if($allrows)
+                               {
+                                       $out = $content;
+                               }
                                else
                                {
-                                       return "";
+                                       if ($total_records > $num_rows)
+                                       {
+                                               $page = ceil( ( $start / 
$total_records ) * ($total_records/ $num_rows) );
+                                               $values_part = 
array_chunk($content, $num_rows);
+                                               $out = $values_part[$page];
+                                       }
+                                       else
+                                       {
+                                               $out = $content;
+                                       }
                                }
-                       }               
-                       //---datatable 
settings---------------------------------------------------                     
         
-                       $parameters['delete'] = array
-                               (
-                                       'parameter' => array
-                                       (
-                                               array
-                                               (
-                                                       'name'  => 
'acl_location',
-                                                       'source' => 
$data_lookup['acl_location'],
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'id',
-                                                       'source' => 
$data_lookup['id'],
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'attrib_id',
-                                                       'source' => 
$data_lookup['attrib_id'],
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'detail_id',
-                                                       'source' => 
$data_lookup['detail_id'],
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'history_id',
-                                                       'source' => 'id',
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'delete',
-                                                       'source' => true,
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'edit',
-                                                       'source' => true,
-                                                       'ready'  => 1
-                                               ),
-                                               array
-                                               (
-                                                       'name'  => 'type',
-                                                       'source' => $this->type,
-                                                       'ready'  => 1
-                                               )                               
-                                       )
-                               );
 
+                               $result_data = array('results' => $out);
+
+                               $result_data['total_records'] = $total_records;
+                               $result_data['draw'] = $draw;
+
+                               return $this->jquery_results($result_data);
+
+                       }
+
+                       $tabletools = array();
                        if($edit && $this->acl->check($acl_location, 
PHPGW_ACL_DELETE, $this->type_app[$this->type]))
                        {
-                               $permissions['rowactions'][] = array
+                               $parameters = array
                                        (
-                                               'text'          => 
lang('delete'),
-                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uigeneric.attrib_history' )),
-                                               'confirm_msg'=> lang('do you 
really want to delete this entry'),
-                                               'parameters'=> 
$parameters['delete']
+                                               'parameter' => array
+                                               (
+                                                       array
+                                                       (
+                                                               'name'          
=> 'history_id',
+                                                               'source'        
=> 'id'
+                                                       )
+                                               )
                                        );
-                       }
 
-                       $datavalues[0] = array
+                               $tabletools[] = array
                                (
-                                       'name'                  => "0",
-                                       'values'                => 
json_encode($content),
-                                       'total_records' => count($content),
-                                       'permission'    => 
json_encode($permissions['rowactions']),
-                                       'is_paginator'  => 1,
-                                       'footer'                => 0
-                               );                         
+                                       'my_name'               => 'delete',
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                       (
+                                               'menuaction'    => 
'property.uigeneric.attrib_history',
+                                               'acl_location'  => 
$acl_location,
+                                               'id'                    => $id,
+                                               'attrib_id'             => 
$attrib_id,
+                                               'detail_id'     => $detail_id,
+                                               'delete'                => true,
+                                               'edit'                  => true,
+                                               'type'                  => 
$this->type
+                                       )),
+                                       'parameters'    => 
json_encode($parameters)
+                               );
+                       }
 
-                       $myColumnDefs[0] = array
-                               (
-                                       'name'                  => "0",
-                                       'values'                =>      
json_encode(array(      array('key' => 'id',                    'hidden'=>true),
-                                                                               
                        array('key' => 'value',                 
'label'=>lang('value'),         'sortable'=>true,'resizeable'=>true),
-                                                                               
                        array('key' => 'time_created',  'label'=>lang('time 
created'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                        array('key' => 'user',                  
'label'=>lang('user'),          'sortable'=>true,'resizeable'=>true)
-                               ))
-                       );                              
+                       $history_def = array
+                       (
+                               array('key'=>'value', 'label'=>lang('value'), 
'sortable'=>false),
+                               array('key'=>'time_created', 
'label'=>lang('time created'), 'sortable'=>false),
+                               array('key'=>'user', 'label'=>lang('user'), 
'sortable'=>false),
+                               array('key'=>'id', 'hidden'=>true)
+                       );
 
-                       
//----------------------------------------------datatable settings--------      
                
-                       $property_js = "/property/js/yahoo/property2.js";
+                       $datatable_def = array();
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_0',
+                               'requestUrl'    => 
json_encode(self::link($link_data)),
+                               'ColumnDefs'    => $history_def,
+                               'tabletools'    => $tabletools,
+                               'config'                => array(
+                                       array('disableFilter' => true)
+                               )
+                       );
 
-                       if 
(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) || 
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
-                       {
-                               $cachedir = 
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
-                               $property_js = 
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" . 
str_replace('/', '--', ltrim($property_js,'/'));
-                       }
-
                        $data = array
                        (
-                               'property_js'           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url'] . $property_js),
                                'base_java_url'         => 
json_encode(array(menuaction => "property.uigeneric.attrib_history")),
-                               'datatable'                     => $datavalues,
-                               'myColumnDefs'          => $myColumnDefs,
-                               'allow_allrows'         => false,
-                               'start_record'          => $this->start,
-                               'record_limit'          => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'           => count($values),
-                               'all_records'           => 
$this->bo->total_records,
+                               'datatable_def'         => $datatable_def,
                                'link_url'                      => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                      => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'values'                        => $content,
-                               'table_header'          => $table_header,
+                               'img_path'                      => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default')
                        );
-                       //---datatable settings--------------------
-                       phpgwapi_yui::load_widget('dragdrop');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('menu');
-                       phpgwapi_yui::load_widget('connection');
-                       phpgwapi_yui::load_widget('loader');
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('paginator');
-                       phpgwapi_yui::load_widget('animation');
 
-                       $GLOBALS['phpgw']->css->validate_file('datatable');
-                       $GLOBALS['phpgw']->css->validate_file('property');
-                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.attrib_history', 'property' );
-                       //-----------------------datatable settings---  
-
-                       //_debug_array($data);die();
                        $custom                 = 
createObject('phpgwapi.custom_fields');
-                       $attrib_data    = $custom->get('property', 
$acl_location, $attrib_id);
+                       $attrib_data    = 
$custom->get($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
                        $appname                = $attrib_data['input_text'];
                        $function_msg   = lang('history');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('attrib_history' => $data));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
+
+                       self::render_template_xsl(array('attrib_history', 
'datatable_inline'), array('attrib_history' => $data));
                }
 
                function delete()

Modified: branches/dev-syncromind/property/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/setup.inc.php        2015-05-07 
23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/setup/setup.inc.php        2015-05-08 
12:25:28 UTC (rev 13168)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.688';
+       $setup_info['property']['version']              = '0.9.17.689';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -212,7 +212,8 @@
                'fm_jasper_format_type',
                'fm_jasper_input',
                'fm_custom_menu_items',
-               'fm_regulations'
+               'fm_regulations',
+               'fm_generic_history'
        );
 
        /* The hooks this app includes, needed for hooks registration */

Modified: branches/dev-syncromind/property/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_current.inc.php       
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/setup/tables_current.inc.php       
2015-05-08 12:25:28 UTC (rev 13168)
@@ -1865,6 +1865,24 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_generic_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp'),
+                               'history_attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'location_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'app_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_owner' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),

Modified: branches/dev-syncromind/property/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_update.inc.php        
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/setup/tables_update.inc.php        
2015-05-08 12:25:28 UTC (rev 13168)
@@ -8308,7 +8308,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.685 to 0.9.17.686
+       * Update property version from 0.9.17.686 to 0.9.17.687
        * Add controller-flag to entities
        */
        $test[] = '0.9.17.687';
@@ -8329,3 +8329,39 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+       /**
+       * Update property version from 0.9.17.687 to 0.9.17.688
+       * Add generic history
+       */
+       $test[] = '0.9.17.688';
+       function property_upgrade0_9_17_688()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_generic_history', array(
+                               'fd' => array(
+                                       'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                                       'history_new_value' => array('type' => 
'text','nullable' => False),
+                                       'history_old_value' => array('type' => 
'text','nullable' => true),
+                                       'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp'),
+                                       'history_attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'location_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'app_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               ),
+                               'pk' => array('history_id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.689';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: branches/dev-syncromind/property/templates/base/attrib_history.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/attrib_history.xsl  
2015-05-07 23:13:44 UTC (rev 13167)
+++ branches/dev-syncromind/property/templates/base/attrib_history.xsl  
2015-05-08 12:25:28 UTC (rev 13168)
@@ -1,6 +1,14 @@
   <!-- $Id$ -->
 <!-- attrib_history -->
-   
+ <xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="attrib_history">
+                       <xsl:apply-templates select="attrib_history"/>
+               </xsl:when>
+       </xsl:choose>
+       <xsl:call-template name="jquery_phpgw_i18n"/>
+</xsl:template>
+
 <xsl:template match="attrib_history">
        <div id="tab-content">
                <fieldset>




reply via email to

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