Commit 2b23d19a authored by Frank Bergmann's avatar Frank Bergmann

- Updated to OpenACS 5.9.1

parent fd3afc23
......@@ -7,19 +7,20 @@
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<version name="5.9.0" url="http://openacs.org/apms/acs-datetime-5.9.0.apm">
<version name="5.9.1" url="http://openacs.org/apms/acs-datetime-5.9.1.apm">
<owner url="http://openacs.org">OpenACS</owner>
<summary>An API for date and time functions</summary>
<release-date>2015-10-04</release-date>
<release-date>2017-08-06</release-date>
<vendor url="http://openacs.org">OpenACS</vendor>
<description format="text/html">Note: this version of the package requires acs-event(s) for a helper function. This requirement may go away in the future. </description>
<maturity>2</maturity>
<provides url="acs-datetime" version="5.9.0"/>
<requires url="acs-kernel" version="5.9.0"/>
<requires url="acs-events" version="0.6d2"/>
<provides url="acs-datetime" version="5.9.1"/>
<requires url="acs-kernel" version="5.9.1"/>
<requires url="acs-events" version="0.6"/>
<requires url="acs-tcl" version="5.9.1"/>
<requires url="acs-templating" version="5.9.0"/>
<requires url="acs-templating" version="5.9.1"/>
<callbacks>
</callbacks>
......
......@@ -4,7 +4,7 @@
<msg key="All_day">Ganztgig</msg>
<msg key="back_one_day">Einen Tag zurck</msg>
<msg key="Date">Datum</msg>
<msg key="Date_as">Datum in der Form:</msg>
<msg key="Date_as">Datum in der Form</msg>
<msg key="Date_as_YYYYMMDD">Datum (JJJJMMTT)</msg>
<msg key="Day">Tag</msg>
<msg key="Day_of_Week">Wochentag</msg>
......
......@@ -18,7 +18,7 @@
<msg key="Items_from">Items from</msg>
<msg key="Items_until">Items until @pretty_end_date@</msg>
<msg key="List">List</msg>
<description key="List">Description wanted from programmers. For nl_NL I need to know if I need to translate &#34;List&#34; as &#34;a list of something&#34; or as &#34;show me something&#34;.
<description key="List">Description wanted from programmers. For nl_NL I need to know if I need to translate &quot;List&quot; as &quot;a list of something&quot; or as &quot;show me something&quot;.
-- Danil Mantione</description>
......
......@@ -2,22 +2,22 @@
<message_catalog package_key="acs-datetime" locale="fr_FR" charset="ISO-8859-1">
<msg key="All_day">Journe entire</msg>
<msg key="back_one_day">retour d&#39;une journe</msg>
<msg key="back_one_day">retour d'une journe</msg>
<msg key="Date">Date</msg>
<msg key="Date_as">Date comme</msg>
<msg key="Date_as_YYYYMMDD">Format YYYYMMDD</msg>
<msg key="Day">Jour</msg>
<msg key="Day_of_Week">Jour de la semaine</msg>
<msg key="days_of_week">dimanche lundi mardi mercredi jeudi vendredi samedi</msg>
<msg key="forward_one_day">avancer d&#39;une journe</msg>
<msg key="forward_one_day">avancer d'une journe</msg>
<msg key="is">nous sommes le</msg>
<msg key="Items_from">Elments de</msg>
<msg key="Items_until">Elments jusqu&#39; @pretty_end_date@</msg>
<msg key="Items_until">Elments jusqu' @pretty_end_date@</msg>
<msg key="List">Liste</msg>
<msg key="lt_Width_must_be_">la largeur doit tre entre 1 et 12</msg>
<msg key="Month">Mois</msg>
<msg key="short_days_of_week">S L M M J V S</msg>
<msg key="to"></msg>
<msg key="Today">Aujourd&#39;hui</msg>
<msg key="Today">Aujourd'hui</msg>
<msg key="Week">Semaine</msg>
</message_catalog>
......@@ -5,8 +5,7 @@
<msg key="back_one_day">Un giorno indietro</msg>
<msg key="Date">Data</msg>
<msg key="Date_as">Formato Data</msg>
<msg key="Date_as_YYYYMMDD">&lt;b&gt;Formato Data&lt;/b&gt;: AAAA-MM-GG&lt;br&gt;
(es. 2002-05-05)</msg>
<msg key="Date_as_YYYYMMDD">Data in formato AAAAMMGG</msg>
<msg key="Day">Giorno</msg>
<msg key="Day_of_Week">Giorno della Settimana</msg>
<msg key="days_of_week">Domenica Luned Marted Mercoled Gioved Venerd Sabato</msg>
......@@ -20,5 +19,10 @@
<msg key="short_days_of_week">D L M M G V S</msg>
<msg key="to">a</msg>
<msg key="Today">Oggi</msg>
<msg key="view_calendar_day">Vista Calendario Giorno</msg>
<msg key="view_calendar_list">Vista Calendario Lista</msg>
<msg key="view_calendar_month">Vista Calendario Mese</msg>
<msg key="view_calendar_week">Vista Calendario Settimana</msg>
<msg key="Week">Settimana</msg>
<msg key="Year">Anno</msg>
</message_catalog>
......@@ -153,7 +153,7 @@ ad_proc dt_widget_month {
if { $fill_all_days == 0 } {
set skip_day 1
} else {
append output "[subst $day_number_template]&nbsp;"
append output [subst $day_number_template] "&nbsp;"
}
} else {
if {$julian_date == $today_julian_date} {
......@@ -164,7 +164,7 @@ ad_proc dt_widget_month {
set the_class "cal-month-day"
}
append output "<td class=\"$the_class\" style=\"background:$the_bgcolor; color:inherit;\" align=left valign=top>[subst $day_number_template]&nbsp;"
append output [subst {<td class="$the_class" style="background:$the_bgcolor; color:inherit;" align="left" valign="top">$day_number_template}] "&nbsp;"
}
if { (!$skip_day) && $large_calendar_p == 1 } {
......@@ -174,11 +174,8 @@ ad_proc dt_widget_month {
while { $calendar_day_index >= 0 } {
set calendar_day [ns_set value $calendar_details $calendar_day_index]
ns_set delete $calendar_details $calendar_day_index
append output "$calendar_day"
set calendar_day_index [ns_set find $calendar_details $julian_date]
}
append output "</div>"
......@@ -231,7 +228,7 @@ ad_proc dt_widget_month_small {
Returns a small calendar for a specific month. Defaults to this month.
} {
if {$days_of_week eq ""} {
set days_of_week "[_ acs-datetime.short_days_of_week]"
set days_of_week [_ acs-datetime.short_days_of_week]
}
return [dt_widget_month \
-calendar_details $calendar_details \
......@@ -277,7 +274,7 @@ ad_proc dt_widget_month_centered {
} {
if {$days_of_week eq ""} {
set days_of_week "[_ acs-datetime.short_days_of_week]"
set days_of_week [_ acs-datetime.short_days_of_week]
}
set output ""
......@@ -285,7 +282,7 @@ ad_proc dt_widget_month_centered {
append output "
<table>
<tr valign=top>
<tr valign='top'>
<td>
[dt_widget_month_small -calendar_details $calendar_details -date $prev_month -days_of_week $days_of_week -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ]</td>
......@@ -517,7 +514,7 @@ ad_proc -private dt_navbar_year {
# Serve arrow link to prev year if it leads to legal date
if {$prev_year_legal_p != 0} {
append result [subst {
<a href="[ns_urlencode ${base_url}view=$view&date=[ns_urlencode $prev_year]]">
<a href="[ns_quotehtml ${base_url}view=$view&date=[ns_urlencode $prev_year]]">
<img alt="left arrow" src="[dt_left_arrow]"></a>
}]
}
......@@ -666,16 +663,16 @@ ad_proc dt_widget_calendar_navigation {
if {$view eq "month"} {
# month view
append output "
append output [subst {
<tr>
<td class=\"no-borders\" colspan=5>
<table bgcolor=ffffff cellspacing=3 cellpadding=1 border=0>
<td class="no-borders" colspan="5">
<table bgcolor="ffffff" cellspacing="3" cellpadding="1" border="0">
<tr>
"
}]
set months_list [dt_month_names]
set now [clock scan $date]
set curr_month [expr {[dt_trim_leading_zeros [clock format $now -format "%m"]] - 1}]
set curr_month [expr {[util::trim_leading_zeros [clock format $now -format "%m"]] - 1}]
for {set i 0} {$i < 12} {incr i} {
......@@ -714,7 +711,7 @@ ad_proc dt_widget_calendar_navigation {
append output "
<tr>
<td colspan=5>
<td colspan='5'>
<table bgcolor='ffffff' cellspacing='3' cellpadding='1' border='0'>
<tr>\n"
......@@ -731,7 +728,7 @@ ad_proc dt_widget_calendar_navigation {
append output [subst {
<td>
<a href="[ns_quotehtml ${base_url}view=year&date=[ns_urlencode $year-$monthday]]">
<span style=\"font-size: smaller; color: blue;\">$year</span></a>
<span style="font-size: smaller; color: blue;">$year</span></a>
</td>
}]
}
......@@ -835,7 +832,6 @@ ad_proc dt_widget_calendar_navigation {
</td>
</tr>
</table>
</center>
</td>
</tr>
<tr class=\"table-header\"><td align='center' colspan='5'>
......@@ -854,15 +850,15 @@ ad_proc dt_widget_calendar_navigation {
<tr><td align="center"><br>
<form method='get' action="[ns_quotehtml $base_url]">
<div>
<INPUT TYPE='text' name='date' size='10'>
<INPUT type='image' src="/resources/acs-subsite/go.gif" alt="Go" border="0"><br>
<input type="text" name="date" size="10">
<input type="image" src="/resources/acs-subsite/go.gif" alt="Go" border="0"><br>
<span style="font-size:smaller">Date as YYYYMMDD</span>
<INPUT TYPE='hidden' name='view' value='day'>
<input type="hidden" name="view" value="day">
</div>
}]
foreach var $list_of_vars {
append output "<INPUT TYPE='hidden' name='[lindex $var 0]' value='[lindex $var 1]'>"
append output "<input type='hidden' name='[lindex $var 0]' value='[lindex $var 1]'>"
}
append output "
......@@ -918,9 +914,9 @@ ad_proc -private dt_get_info {
# get year, month, day
set date_list [dt_ansi_to_list $the_date]
set year [dt_trim_leading_zeros [lindex $date_list 0]]
set month [dt_trim_leading_zeros [lindex $date_list 1]]
set day [dt_trim_leading_zeros [lindex $date_list 2]]
set year [util::trim_leading_zeros [lindex $date_list 0]]
set month [util::trim_leading_zeros [lindex $date_list 1]]
set day [util::trim_leading_zeros [lindex $date_list 2]]
# We put all the data into dt_info_set and return it later
set dt_info_set [ns_set create]
......
......@@ -74,9 +74,9 @@ ad_proc -public dt_ansi_to_julian_single_arg {
} {
set date_list [dt_ansi_to_list $ansi]
set year [dt_trim_leading_zeros [lindex $date_list 0]]
set month [dt_trim_leading_zeros [lindex $date_list 1]]
set day [dt_trim_leading_zeros [lindex $date_list 2]]
set year [util::trim_leading_zeros [lindex $date_list 0]]
set month [util::trim_leading_zeros [lindex $date_list 1]]
set day [util::trim_leading_zeros [lindex $date_list 2]]
return [dt_ansi_to_julian $year $month $day $era]
}
......@@ -103,6 +103,8 @@ ad_proc -public dt_ansi_to_julian {
# 1582-10-04; 1582-10-15)
set julian_date [dt_ansi_to_julian 1582 10 15 CE]
} else {
set year [util::trim_leading_zeros $year]
if {$era eq "BCE"} {
set year [expr {-$year + 1}]
}
......@@ -159,19 +161,11 @@ ad_proc -public dt_julian_to_ansi {
}
set day [expr {floor($calc - $calc3 - floor($calc4 * 30.6001))}]
set year [expr {int($year)}]
set year [expr {int($year)}]
set month [expr {int($month)}]
set day [expr {int($day)}]
if {$month < 10} {
set month 0$month
}
if {$day < 10} {
set day 0$day
}
set day [expr {int($day)}]
return $year-$month-$day
return [format %.4d $year]-[format %.2d $month]-[format %.2d $day]
}
ad_proc -public dt_ansi_to_pretty {
......@@ -200,7 +194,7 @@ ad_proc -public dt_ansi_to_list {
}
foreach item [split [clock format [clock scan $ansi_date] -format "%Y %m %d %H %M %S"] " "] {
lappend date_info [dt_trim_leading_zeros $item]
lappend date_info [util::trim_leading_zeros $item]
}
return $date_info
......@@ -488,7 +482,7 @@ ad_proc -public dt_widget_numeric_range {
}
if {$default ne ""} {
set default [dt_trim_leading_zeros $default]
set default [util::trim_leading_zeros $default]
}
set input "<option value=_undef>--\n"
......@@ -521,7 +515,7 @@ ad_proc -public dt_widget_maybe_range {
if {$with_leading_zeros} {
return [dt_export_value $name $hidden_value]
} else {
return [dt_export_value $name [dt_trim_leading_zeros $hidden_value]]
return [dt_export_value $name [util::trim_leading_zeros $hidden_value]]
}
}
......@@ -544,7 +538,7 @@ ad_proc -public dt_interval_check { start end } {
return [expr {[clock scan $end] - [clock scan $start]}]
}
ad_proc -private dt_trim_leading_zeros {
ad_proc -private -deprecated dt_trim_leading_zeros {
string
} {
Returns a string w/ leading zeros trimmed.
......@@ -552,13 +546,7 @@ ad_proc -private dt_trim_leading_zeros {
zeros are octal. We could just use validate_integer, but it runs
one extra regexp that we don't need to run.
} {
set string [string trimleft $string 0]
if {$string eq ""} {
return "0"
}
return $string
return [util::trim_leading_zeros $string]
}
ad_proc -private dt_export_value {
......
<property name="context">{/doc/acs-datetime {Date and Time Utilities}} {ACS DateTime}</property>
<property name="context">{/doc/acs-datetime {ACS Date and Time Utilities}} {ACS DateTime}</property>
<property name="doc(title)">ACS DateTime</property>
<master>
<h2>ACS DateTime</h2>
......
......@@ -9,7 +9,7 @@
<h2>ACS DateTime</h2>
by <a href=mailto:ron@arsdigita.com>ron@arsdigita.com</a>
by <a href="mailto:ron@arsdigita.com">ron@arsdigita.com</a>
<hr>
......
<property name="context">{/doc/acs-datetime {Date and Time Utilities}} {ACS DateTime}</property>
<property name="context">{/doc/acs-datetime {ACS Date and Time Utilities}} {ACS DateTime}</property>
<property name="doc(title)">ACS DateTime</property>
<master>
<h2>ACS DateTime</h2>
......@@ -21,11 +21,12 @@ caller. Rather than standardize on a low-level representation of
time (like seconds since 00:00:00 UTC, January 1 1970) all of these
procedures accept general date specfications. For example, the
default date for <code>dt_widget_datetime</code> can be specified
as "2001-01-05", "2000-01-05 09:57 pm", "2000-01-05 21:57", etc.
Internally these are parsed by the standard Tcl procedure
<code>clock scan</code> for processing and then converted back to a
formatted string for output. This makes it easy to pass dates
between the Tcl layer and the database.</p>
as "2001-01-05", "2000-01-05 09:57 pm",
"2000-01-05 21:57", etc. Internally these are parsed by
the standard Tcl procedure <code>clock scan</code> for processing
and then converted back to a formatted string for output. This
makes it easy to pass dates between the Tcl layer and the
database.</p>
<h3>III. Historical Considerations</h3>
<p>This package was written largely to consolidate and improve the
date, time, and calendar functionality existing in ACS 3.</p>
......@@ -51,8 +52,8 @@ names</li><li>
abbreviations</li><li>
<code>dt_julian_to_ansi</code> converts Julian time to ANSI
time (yyyy-mm-dd)</li><li>
<code>dt_ansi_to_pretty</code> converts ANSI time to "pretty
ANSI time" (yyyy-mm-dd to Month day, year)</li><li>
<code>dt_ansi_to_pretty</code> converts ANSI time to
"pretty ANSI time" (yyyy-mm-dd to Month day, year)</li><li>
<code>dt_ansi_to_list</code> generates a Tcl list of date-time
elements (year, month, day, hour, minute, second)</li><li>
<code>dt_valid_time_p</code> checks the validity of a time
......
......@@ -59,7 +59,7 @@ date, time, and calendar functionality existing in ACS 3.</p>
<h4>Date and Time functions</h4>
<p>See <a href=examples/datetime-procs>examples</a>.
<p>See <a href="examples/datetime-procs">examples</a>.
<ol>
<li><code>dt_systime</code> generates current system time (local or GMT)
......@@ -82,7 +82,7 @@ time range
<h4>Date and Time widgets</h4>
<p>See <a href=examples/datetime-widgets>examples</a>.
<p>See <a href="examples/datetime-widgets">examples</a>.
<ol>
<li><code>dt_widget_datetime</code> generate HTML select widgets of varying granularity for
......@@ -96,7 +96,7 @@ widget for general numeric ranges
<h4>Calendar widgets</h4>
<p>See <a href=examples/calendar-widgets>examples</a>.</p>
<p>See <a href="examples/calendar-widgets">examples</a>.</p>
<p>Each of the following allow the programmer to supply calendar
details in an <code>ns_set</code> keyed on Julian date and returns an
......@@ -125,14 +125,14 @@ system so that the display properties are more easily customized.</p>
<h3>XIII. Authors</h3>
<p>Implemented by Ron Henderson (<a
href=mailto:ron@arsdigita.com>ron@arsdigita.com</a>), based on the
href="mailto:ron@arsdigita.com">ron@arsdigita.com</a>), based on the
previous work of <a
href=mailto:gregh@arsdigita.com>gregh@arsdigita.com</a> and <a
href=mailto:smeeks@arsdigita.com>smeeks@arsdigita.com</a>.</p>
href="mailto:gregh@arsdigita.com">gregh@arsdigita.com</a> and <a
href="mailto:smeeks@arsdigita.com">smeeks@arsdigita.com</a>.</p>
<hr>
<a href=mailto:ron@arsdigita.com>ron@arsdigita.com</a>
<a href="mailto:ron@arsdigita.com">ron@arsdigita.com</a>
</body>
</html>
......@@ -5,15 +5,15 @@
<property name="doc(title)">@title;literal@</property>
<property name="context">@context;literal@</property>
<pre>dt_widget_calendar_navigation <i>base_url</i> <i>view</i> <i>date</i> <i>pass_in_vars</i> </pre>
<pre>dt_widget_calendar_navigation <em>base_url</em> <em>view</em> <em>date</em> <em>pass_in_vars</em> </pre>
<p>
<dl>
<p><dt><b>Parameters:</b></dt><dd>
<b>base_url</b> (optional)<br>
<b>view</b> (defaults to <code>week</code>)<br>
<b>date</b> (optional)<br>
<b>pass_in_vars</b> (optional)<br>
<dt><strong>Parameters:</strong></dt><dd>
<strong>base_url</strong> (optional)<br>
<strong>view</strong> (defaults to <code>week</code>)<br>
<strong>date</strong> (optional)<br>
<strong>pass_in_vars</strong> (optional)<br>
</dd>
</dl>
......@@ -33,13 +33,9 @@ in that url's environment: <code>view</code> and <code>date</code>.
simply reads <code>view</code> and <code>date</code> as URL variables
and uses them to initialize the display.
<center>
<form>
@calendar_widget;noquote@
</form>
</center>
<p>Click on any view, date, or other navigational element to change
the display of this page.</p>
......
......@@ -13,6 +13,15 @@ ad_page_contract {
} -properties {
title:onevalue
calendar_widget:onevalue
} -validate {
date_valid -requires date {
#
# Check for the date formats accepted by lc_time_fmt
#
if {[catch {lc_time_fmt $date %B} errorMsg]} {
ad_complain "Invalid date"
}
}
}
set title "Calendar Navigation"
......@@ -23,7 +32,6 @@ set calendar_widget [dt_widget_calendar_navigation "" $view $date]
ad_return_template
# Local variables:
# mode: tcl
# tcl-indent-level: 4
......
<!-- $Id$ -->
<master>
<property name="doc(title)">ACS DateTime Examples</property>
<h2>ACS DateTime Examples</h2>
......
<property name="context">{/doc/acs-datetime {Date and Time Utilities}} {ACS DateTime Documentation}</property>
<property name="context">{/doc/acs-datetime {ACS Date and Time Utilities}} {ACS DateTime Documentation}</property>
<property name="doc(title)">ACS DateTime Documentation</property>
<master>
<h1>ACS DateTime Documentation</h1>
......
......@@ -5,11 +5,11 @@
<title>ACS DateTime Documentation</title>
</head>
<body bgcolor=#ffffff>
<body bgcolor="#ffffff">
<h1>ACS DateTime Documentation</h1>
<a href=mailto:ron@arsdigita.com>ron@arsdigita.com</a>
<a href="mailto:ron@arsdigita.com">ron@arsdigita.com</a>
<p>
<hr>
......
<property name="context">{/doc/acs-datetime {Date and Time Utilities}} {ACS DateTime}</property>
<property name="context">{/doc/acs-datetime {ACS Date and Time Utilities}} {ACS DateTime}</property>
<property name="doc(title)">ACS DateTime</property>
<master>
<h2>ACS DateTime Requirements</h2>
......@@ -44,8 +44,8 @@ applications.</p>
<ol>
<li>Generate current system time (local or GMT)</li><li>Generate current system date</li><li>Format a calendar time (system-dependent representation of
time) using the formatting codes supported by the standard Unix
time functions</li><li>Generate a list of standard month names</li><li>Generate a list of standard month abbreviations</li><li>Convert Julian time to ANSI time (yyyy-mm-dd)</li><li>Convert ANSI time to "pretty ANSI time" (yyyy-mm-dd to Month
day, year)</li><li>Generate a Tcl list of date-time elements (year, month, day,
time functions</li><li>Generate a list of standard month names</li><li>Generate a list of standard month abbreviations</li><li>Convert Julian time to ANSI time (yyyy-mm-dd)</li><li>Convert ANSI time to "pretty ANSI time" (yyyy-mm-dd
to Month day, year)</li><li>Generate a Tcl list of date-time elements (year, month, day,
hour, minute, second)</li><li>Check the validity of a time interval by comparing start and
end times and determining if they represent a positive, empty, or
negative time range</li>
......
......@@ -4,7 +4,7 @@
<title>ACS DateTime</title>
</head>
<body bgcolor=#ffffff>
<body bgcolor="#ffffff">
<h2>ACS DateTime Requirements</h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment