fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9061] api: custom fields - datetime


From: Sigurd Nes
Subject: [Fmsystem-commits] [9061] api: custom fields - datetime
Date: Wed, 28 Mar 2012 17:36:15 +0000

Revision: 9061
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9061
Author:   sigurdne
Date:     2012-03-28 17:36:03 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
api: custom fields - datetime

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.custom_fields.inc.php
    trunk/property/inc/class.custom_fields.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/templates/base/attributes_form.xsl
    trunk/property/templates/base/tts.xsl

Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php      2012-03-28 16:20:05 UTC 
(rev 9060)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php      2012-03-28 17:36:03 UTC 
(rev 9061)
@@ -473,10 +473,16 @@
                                                break;
 
                                        case 'DT':
-                                               
-                                               $date_array     = 
phpgwapi_datetime::date_array($attrib['value']['date']);
-                                               $ts = mktime 
((int)$attrib['value']['hour'], (int)$attrib['value']['min'], 0, 
$date_array['month'], $date_array['day'], $date_array['year']);
-                                               $attrib['value'] = 
date($this->_datetimeformat, $ts);
+                                               if($attrib['value']['date'])
+                                               {
+                                                       $date_array     = 
phpgwapi_datetime::date_array($attrib['value']['date']);
+                                                       $ts = mktime 
((int)$attrib['value']['hour'], (int)$attrib['value']['min'], 0, 
$date_array['month'], $date_array['day'], $date_array['year']);
+                                                       $attrib['value'] = 
date($this->_datetimeformat, $ts);
+                                               }
+                                               else
+                                               {
+                                                       $attrib['value'] = '';
+                                               }
                                                break;
                                }
                        }

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2012-03-28 16:20:05 UTC 
(rev 9060)
+++ trunk/property/inc/class.custom_fields.inc.php      2012-03-28 17:36:03 UTC 
(rev 9061)
@@ -109,7 +109,21 @@
                                                        
$attributes['value']['date'] = 
$GLOBALS['phpgw']->common->show_date($timestamp,$dateformat);
                                                        
$attributes['value']['hour'] = date('H', $timestamp);
                                                        
$attributes['value']['min'] = date('i', $timestamp);
-//                                                     
_debug_array($attributes);die();
+                                                       
$clear_functions[$m]['name']    = "clear_{$attributes['name']}()";
+                                                       $confirm_msg = 
lang('delete') . '?';
+                                                       
$clear_functions[$m]['action']  = <<<JS
+                                                       
if(confirm("{$confirm_msg}"))
+                                                       {
+                                                               var 
attribute_{$i}_date = document.getElementById('values_attribute_{$i}');
+                                                               var 
attribute_{$i}_hour = document.getElementById('values_attribute_{$i}_hour');
+                                                               var 
attribute_{$i}_min = document.getElementById('values_attribute_{$i}_min');
+                                                               
attribute_{$i}_date.value = '';
+                                                               
attribute_{$i}_hour.value = '';
+                                                               
attribute_{$i}_min.value = '';                                                  
        
+                                                       }
+JS;
+                                                       $m++;
+
                                                }
                                                else
                                                {
@@ -370,7 +384,7 @@
                                        $values['lookup_functions'] .= 
'}'."\r\n";
                                }
                        }
-
+//_debug_array($values);die();
                        if(isset($lookup_functions) && $lookup_functions)
                        {
                                
$GLOBALS['phpgw']->session->appsession('insert_record_values' . 
$location,$appname,$insert_record_values);

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2012-03-28 16:20:05 UTC (rev 
9060)
+++ trunk/property/inc/class.sotts.inc.php      2012-03-28 17:36:03 UTC (rev 
9061)
@@ -1292,14 +1292,12 @@
                        $value_set                                      = 
array();
 
                        $data_attribute = 
$this->custom->prepare_for_db('fm_tts_tickets', $values_attribute);
+
                        if(isset($data_attribute['value_set']))
                        {
                                foreach($data_attribute['value_set'] as 
$input_name => $value)
                                {
-                                       if(isset($value) && $value)
-                                       {
-                                               $value_set[$input_name] = 
$value;
-                                       }
+                                       $value_set[$input_name] = $value;
                                }
                        }
 
@@ -1309,6 +1307,7 @@
                        $value_set['ecodimb']           = $ticket['ecodimb'];
                        $value_set['budget']            = $ticket['budget'];
                        $value_set['branch_id']         = $ticket['branch_id'];
+
                        $value_set                                      = 
$this->db->validate_update($value_set);
                        $this->db->query("UPDATE fm_tts_tickets SET $value_set 
WHERE id={$id}",__LINE__,__FILE__);
 

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2012-03-28 16:20:05 UTC (rev 
9060)
+++ trunk/property/inc/class.uitts.inc.php      2012-03-28 17:36:03 UTC (rev 
9061)
@@ -2042,6 +2042,7 @@
                        $data = array
                                (
                                        'custom_attributes'                     
        => array('attributes' => $values['attributes']),
+                                       'lookup_functions'                      
        => isset($values['lookup_functions'])?$values['lookup_functions']:'',
                                        'contact_data'                          
        => $contact_data,
                                        'simple'                                
                => $this->_simple,
                                        'show_finnish_date'                     
        => $this->_show_finnish_date,
@@ -3167,6 +3168,7 @@
                        $data = array
                                (
                                        'custom_attributes'                     
        => array('attributes' => $ticket['attributes']),
+                                       'lookup_functions'                      
        => isset($ticket['lookup_functions'])?$ticket['lookup_functions']:'',
                                        'send_response'                         
        => isset($this->bo->config->config_data['tts_send_response']) ? 
$this->bo->config->config_data['tts_send_response'] : '',
                                        'value_sms_phone'                       
        => $ticket['contact_phone'],
                                        'access_order'                          
        => $access_order,

Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl   2012-03-28 16:20:05 UTC 
(rev 9060)
+++ trunk/property/templates/base/attributes_form.xsl   2012-03-28 17:36:03 UTC 
(rev 9061)
@@ -358,6 +358,12 @@
                                                                <img 
id="values_attribute_{counter}-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;"/>
                                                        </xsl:when>
                                                        <xsl:when 
test="datatype='DT'">
+                                                                               
        <xsl:variable name="clear_function">
+                                                                               
                <xsl:text>clear_</xsl:text>
+                                                                               
                <xsl:value-of select="name"/>
+                                                                               
                <xsl:text>();</xsl:text>
+                                                                               
        </xsl:variable>
+
                                                                <table>
                                                                        <tr>
                                                                                
<td>
@@ -400,6 +406,17 @@
                                                                                
                </xsl:choose>
                                                                                
        </input>
                                                                                
</td>
+                                                                               
<td>
+                                                                               
        <input type="checkbox" name="clear_{name}_box" 
onClick="{$clear_function}">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'delete')"/>
+                                                                               
                </xsl:attribute>
+                                                                               
                <xsl:attribute name="readonly">
+                                                                               
                        <xsl:text>readonly</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+
+                                                                               
</td>
                                                                        </tr>
                                                                </table>
                                                        </xsl:when>

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2012-03-28 16:20:05 UTC (rev 
9060)
+++ trunk/property/templates/base/tts.xsl       2012-03-28 17:36:03 UTC (rev 
9061)
@@ -508,6 +508,11 @@
 
        <!-- add -->
        <xsl:template xmlns:php="http://php.net/xsl"; match="add">
+               <script type="text/javascript">
+                       self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
+               </script>
+
                <xsl:choose>
                        <xsl:when test="msgbox_data != ''">
                                <tr>
@@ -830,6 +835,7 @@
        <xsl:template xmlns:php="http://php.net/xsl"; match="view">
                <script type="text/javascript">
                        self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
                        function generate_order()
                        {
                                Window1=window.open('<xsl:value-of 
select="order_link"/>','','left=50,top=100');




reply via email to

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