From 7af22613dec2096a66f0b0382b38fcb5c87e3ecb Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 28 Aug 2004 17:55:29 +0000 Subject: [PATCH] added option to suppress time in the readonly display if it's 0h0 --- etemplate/doc/referenz.html | 14 ++++++++------ etemplate/inc/class.date_widget.inc.php | 12 +++++++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/etemplate/doc/referenz.html b/etemplate/doc/referenz.html index 0b1f9a1674..575fae91e6 100644 --- a/etemplate/doc/referenz.html +++ b/etemplate/doc/referenz.html @@ -360,9 +360,9 @@ implement only a subset of XUL. Here are the main differences:

standard widgets and extensions of the eTemplates

- +
- + @@ -441,7 +441,7 @@ implement only a subset of XUL. Here are the main differences:

- + @@ -607,7 +607,7 @@ implement only a subset of XUL. Here are the main differences:

- + - +
Widget Name in EditorWidget Name
in Editor
xml tag xul internal name
Formatted Text (HTML)Formatted Text
(HTML)
<htmlarea /> no htmlarea Date-/Time-input via selectboxes or a field for the year
The order of the input-fields is determined by the prefs of the user.
- Options: [datetime-storage-format][,&1=year-no-selectbox|&2=today-button]
+ Options: [datetime-storage-format] [,&1=year-no-selectbox|&2=today-button|&4=one-min-steps|&8=ro-suppress-0h0]
datetime-storage-format is the format, in which the date is stored in the variable: empty means an unix-timestamp (in GMT), or a string containing the letters Y, m, d, H, i plus separators, eg. 'Y-m-d': 2002-12-31. The storage format @@ -617,6 +617,8 @@ implement only a subset of XUL. Here are the main differences:

select-year widget.
today-button: if set (&2) a [Today] button is displayed which sets the fields to the up-to-date date (via javascript)
+ one-min-steps: if set (&4) the minute-selectbox uses one minutes steps, default 5min steps
+ ro-suppress-0h0: if set (&8) the time is suppressed for readonly and a time of 0h0
Sub-widgets: date-time: a date and a time and date-timeonly: only a time
These widgets allow the input of times too or only, they use 12h am/pm or 24h format as specified in the user prefs.
@@ -783,13 +785,13 @@ function index($content = 0)
Nextmatch-SortHeader

Nextmatch-FilterHeader

Nextmatch-
SortHeader

Nextmatch-
FilterHeader

<nextmatch type="nextmatch-sortheader" id="col-name" label="ColLabel"/>

<nextmatch type="nextmatch-filterheader" id="col-name"/>

nonextmatch-sortheader

nextmatch-filterheader

nextmatch-
sortheader

nextmatch-
filterheader

These widget are an optional part of the nextmatch widget.

nextmatch-sortheader
diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index 55c812ea6b..91fcc23437 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -19,7 +19,8 @@ @param Options/$cell['size'] = $format[,$options], @param $format: ''=timestamp or eg. 'Y-m-d H:i' for 2002-12-31 23:59 @param $options: &1 = year is int-input not selectbox, &2 = show a [Today] button, \ - &4 = 1min steps for time (default is 5min, with fallback to 1min if value is not in 5min-steps) + &4 = 1min steps for time (default is 5min, with fallback to 1min if value is not in 5min-steps), + &8 = dont show time for readonly and type date-time if time is 0:00 @discussion This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function */ class date_widget @@ -88,6 +89,8 @@ 'i' => date('i',$value) ); } + $time_0h0 = !(int)$value['H'] && !(int)$value['i']; + $timeformat = array(3 => 'H', 4 => 'i'); if ($this->timeformat == '12') { @@ -101,11 +104,14 @@ } $format = split('[/.-]',$sep=$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); - if ($type != 'date') + $readonly = $cell['readonly'] || $readonlys; + + // no time also if $options&8 and readonly and time=0h0 + if ($type != 'date' && !($readonly && ($options & 8) && $time_0h0)) { $format += $timeformat; } - if ($cell['readonly'] || $readonlys) // is readonly + if ($readonly) // is readonly { $sep = array( 1 => $sep[1],