[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7045] property: history
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7045] property: history |
Date: |
Wed, 23 Feb 2011 15:16:38 +0000 |
Revision: 7045
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7045
Author: sigurdne
Date: 2011-02-23 15:16:38 +0000 (Wed, 23 Feb 2011)
Log Message:
-----------
property: history
Modified Paths:
--------------
trunk/property/inc/class.bocommon.inc.php
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/templates/base/attributes_form.xsl
Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php 2011-02-23 15:16:18 UTC (rev
7044)
+++ trunk/property/inc/class.bocommon.inc.php 2011-02-23 15:16:38 UTC (rev
7045)
@@ -1081,48 +1081,6 @@
return $datatype;
}
-
- function save_attributes($values_attribute,$type)
- {
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
-// $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- $values_attribute[$i]['value'] = ',' .
implode(',', $values_attribute[$i]['value']) . ',';
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
- $dateformat=
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $dateformat =
str_replace(".","",$dateformat);
- $dateformat =
str_replace("-","",$dateformat);
- $dateformat =
str_replace("/","",$dateformat);
- $y=strpos($dateformat,'Y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/',
$values_attribute[$i]['value']);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- $values_attribute[$i]['value'] =
date($this->dateformat,mktime(2,0,0,$month,$day,$year));
- }
- }
-
-
$this->socommon->save_attributes($values_attribute,$type);
- }
-
function add_leading_zero($num,$id_type='')
{
if ($id_type == "hex")
@@ -2083,7 +2041,7 @@
$split_values = array ();
foreach ($array as $value)
{
- array_push($split_values,array (text =>
"$value[id]", value => $value[id], onclick => array(fn => onDateClick, obj =>
array (id_button=>$id_buttons, opt=>$value[id], hidden_name=>$name_hidden))));
+ array_push($split_values,array ('text' =>
$value['id'], 'value' => $value['id'], 'onclick' => array('fn' =>
'onDateClick', 'obj' => array ('id_button'=>$id_buttons, 'opt'=>$value['id'],
'hidden_name'=>$name_hidden))));
}
return $split_values;
}
@@ -2093,7 +2051,7 @@
$split_values = array ();
foreach ($array as $value)
{
- array_push($split_values,array (text =>
"$value[name]", value => $value[id], onclick => array(fn => onUserClick, obj =>
array (id_button=>$id_buttons, id=>$value[id], name =>$value[name],
hidden_name=>$name_hidden))));
+ array_push($split_values,array ('text' =>
$value['name'], 'value' => $value['id'], 'onclick' => array('fn' =>
'onUserClick', 'obj' => array ('id_button'=>$id_buttons, 'id'=>$value['id'],
'name' =>$value['name'], 'hidden_name'=>$name_hidden))));
}
return $split_values;
}
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2011-02-23 15:16:18 UTC (rev
7044)
+++ trunk/property/inc/class.boentity.inc.php 2011-02-23 15:16:38 UTC (rev
7045)
@@ -529,12 +529,36 @@
function read_attrib_history($data)
{
- // _debug_array($data);
+ $attrib_data =
$this->custom->get($this->type_app[$this->type], $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','ASC',$data['id'],$data['attrib_id'],
$data['detail_id']);
+
+ if($attrib_data['column_info']['type'] == 'LB')
+ {
+ foreach($history_values as &$value_set)
+ {
+ foreach ($attrib_data['choice'] as
$choice)
+ {
+ if ($choice['id'] ==
$value_set['new_value'])
+ {
+
$value_set['new_value'] = $choice['value'];
+ }
+ }
+ }
+ }
+
+
+ if($attrib_data['column_info']['type'] == 'D')
+ {
+ foreach($history_values as &$value_set)
+ {
+ $value_set['new_value'] =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
strtotime( $value_set['new_value']));
+ }
+ }
+
+ reset($history_values);
$this->total_records = count($history_values);
- // _debug_array($history_values);
return $history_values;
}
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2011-02-23 15:16:18 UTC (rev
7044)
+++ trunk/property/inc/class.soentity.inc.php 2011-02-23 15:16:38 UTC (rev
7045)
@@ -891,19 +891,27 @@
if($entry['history'] == 1)
{
- $this->db->query("select " .
$entry['name'] . " from $table WHERE id=" . $values['id'],__LINE__,__FILE__);
+ $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']);
+ $old_value =
$this->db->f($entry['name'],true);
+
+ if($entry['datatype'] == 'D')
+ {
+ $old_value =
date(phpgwapi_db::date_format(), strtotime($old_value));
+ }
+
if($entry['value'] !=
$old_value)
{
-
$history_set[$entry['attrib_id']] = array('value' => $entry['value'],
- 'date' =>
$this->bocommon->date_to_timestamp($entry['date']));
+
$history_set[$entry['attrib_id']] = array
+ (
+ 'value' =>
$entry['value'],
+ 'date' =>
$this->bocommon->date_to_timestamp($entry['date'])
+ );
}
}
}
}
- //_debug_array($history_set);
$value_set =
$this->db->validate_update($value_set);
$this->db->transaction_begin();
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2011-02-23 15:16:18 UTC (rev
7044)
+++ trunk/property/inc/class.uientity.inc.php 2011-02-23 15:16:38 UTC (rev
7045)
@@ -1800,8 +1800,44 @@
}
}
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+ $dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+ $dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+
+
$data = array
(
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'dateformat_validate'
=> $dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+
'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
'datatable'
=> $datavalues,
'myColumnDefs'
=> $myColumnDefs,
@@ -2012,19 +2048,15 @@
$GLOBALS['phpgw']->xslttpl->add_file(array('attrib_history','nextmatchs'));
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $acl_location = phpgw::get_var('acl_location',
'string');
- $id = phpgw::get_var('id', 'int');
- // $entity_id =
phpgw::get_var('entity_id', 'int');
- // $cat_id =
phpgw::get_var('cat_id', 'int');
- $attrib_id = phpgw::get_var('attrib_id', 'int');
- $detail_id = phpgw::get_var('detail_id', 'int');
+ $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
(
'acl_location' => $acl_location,
- 'id' => $id,
- // 'entity_id' => $entity_id,
- // 'cat_id' => $cat_id,
+ 'id' => $id,
'attrib_id' => $attrib_id,
'detail_id' => $detail_id,
);
@@ -2047,8 +2079,6 @@
(
'menuaction' =>
'property.uientity.attrib_history',
'acl_location' =>
$acl_location,
- // 'entity_id' =>
$data_lookup['entity_id'],
- // 'cat_id' =>
$data_lookup['cat_id'],
'id' =>
$data_lookup['id'],
'attrib_id' =>
$data_lookup['attrib_id'],
'detail_id' =>
$data_lookup['detail_id'],
Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl 2011-02-23 15:16:18 UTC
(rev 7044)
+++ trunk/property/templates/base/attributes_form.xsl 2011-02-23 15:16:38 UTC
(rev 7045)
@@ -363,8 +363,7 @@
<xsl:variable name="lang_history_help"><xsl:value-of
select="//lang_history_help"/></xsl:variable>
<xsl:variable name="lang_history"><xsl:value-of
select="//lang_history"/></xsl:variable>
<a
href="javascript:var
w=window.open('{$link_history}','','left=50,top=100,width=550,height=400,scrollbars')"
-
onMouseOver="overlib('{$lang_history_help}', CAPTION, '{$lang_history}')"
-
onMouseOut="nd()">
+
title="{$lang_history_help}">
<xsl:value-of select="//lang_history"/></a>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7045] property: history,
Sigurd Nes <=