Home
The Toolkit for Online Communities
15902 Community Members, 0 members online, 2407 visitors today
Log In Register

date-procs.tcl

OpenACS Home : ACS API Browser : ACS Templating 5.5.1 : date-procs.tcl
Publicity:
[Public Only | All]

date-procs.tcl


Procedures in this file

Detailed information

template::data::transform::date (public)

template::data::transform::date element_ref
Collect a Date object from the form

Parameters:
element_ref
 

template::data::transform::textdate (public)

template::data::transform::textdate element_ref
Collect a textdate from the form, it automatically reformats it from the users locale to the iso standard YYYY-MM-DD this is useful because it doesn't need reformatting in tcl code

Parameters:
element_ref
 

template::data::validate::textdate (public)

template::data::validate::textdate value_ref message_ref
Validate that a submitted textdate if properly formatted.

Parameters:
value_ref - Reference variable to the submitted value.
message_ref - Reference variable for returning an error message.
Returns:
True (1) if valid, false (0) if not.
 

template::util::date (public)

template::util::date command [ args... ]
Dispatch procedure for the date object

Parameters:
command
 

template::util::date::acquire (public)

template::util::date::acquire type [ value ]
Create a new date with some predefined value Basically, create and set the date

Parameters:
type
value (optional)
 

template::util::date::add_time (public)

template::util::date::add_time -time_array_name time_array_name \
    -date_array_name date_array_name
set the time and date and new format properties into one date object (list) which is returned not sure this proc should live here...

Switches:
-time_array_name (required)
-date_array_name (required)
Author:
Walter McGinnis <wtem@olywa.net>
Created:
2002-01-04
 

template::util::date::compare (public)

template::util::date::compare date1 date2
Perform date comparison; same syntax as string compare

Parameters:
date1
date2
 

template::util::date::create (public)

template::util::date::create [ year ] [ month ] [ day ] [ hours ] \
    [ minutes ] [ seconds ] [ format ]
Create a new Date object I chose to implement the date objects as lists instead of arrays, because arrays are not first-class in TCL

Parameters:
year (optional)
month (optional)
day (optional)
hours (optional)
minutes (optional)
seconds (optional)
format (defaults to "DD MONTH YYYY")
 

template::util::date::daysInMonth (public)

template::util::date::daysInMonth month [ year ]

Parameters:
month
year (defaults to "0")
Returns:
the number of days in a month, accounting for leap years LOOKATME: IS THE LEAP YEAR CODE CORRECT ?
 

template::util::date::defaultInterval (public)

template::util::date::defaultInterval what
Get the default ranges for all the numeric fields of a Date object

Parameters:
what
 

template::util::date::from_ansi (public)

template::util::date::from_ansi ansi_date [ format ]
Create a new templating system date structure from a full ANSI date, i.e. in the format YYYY-MM-DD HH24:MI:SS.

Parameters:
ansi_date - Date in full ANSI format YYYY-MM-DD HH24:MI:SS (time portion is optional).
format (defaults to "YYYY MM DD") - Format for the date object. Optional, defaults to YYYY MM DD.
Returns:
Date object for use with e.g. form builder.
Author:
Lars Pind <lars@pinds.com>
Created:
November 18, 2002
 

template::util::date::get_property (public)

template::util::date::get_property what date
Returns a property of a date list, usually created by ad_form.

Parameters:
what - the name of the property. one of:
  • year
  • month
  • day
  • hours
  • minutes
  • seconds
  • format
  • long_month_name
  • short_month_name
  • days_in_month
  • short_year
  • short_hours
  • ampm
  • not_null
  • sql_date
  • linear_date
  • linear_date_no_time
  • display_date
  • clock

date - the date widget list
 

template::util::date::init (public)

template::util::date::init
Sets up some initial variables and other conditions to facilitate the data structure template::util::date working properly and completely.

 

template::util::date::monthName (public)

template::util::date::monthName month length
Return the specified month name (short or long)

Parameters:
month
length
 

template::util::date::now (public)

template::util::date::now
Create a new Date object for the current date and time

 

template::util::date::now_min_interval (public)

template::util::date::now_min_interval
Create a new Date object for the current date and time with the default interval for minutes

Author:
Walter McGinnis <wtem@olywa.net>
Created:
2002-01-06
 

template::util::date::now_min_interval_plus_hour (public)

template::util::date::now_min_interval_plus_hour
Create a new Date object for the current date and time plus one hour with the default interval for minutes

Author:
Walter McGinnis <wtem@olywa.net>
Created:
2002-01-06
 

template::util::date::set_property (public)

template::util::date::set_property what date value
Replace a property in a list created by a date widget.

Parameters:
what - name of the property (see source for allowed values)
date - the date list
value - the new value
Returns:
the modified list
 

template::util::date::today (public)

template::util::date::today
Create a new Date object for the current date

 

template::util::date::unpack (public)

template::util::date::unpack date
Set the variables for each field of the date object in the calling frame. sets: year month day hours minutes seconds format from a list formatted date string

Parameters:
date

See Also:
  • template::util::date::from_ans
 

template::util::date::validate (public)

template::util::date::validate date error_ref
Validate a date object. Return 1 if the object is valid, 0 otherwise. Set the error_ref variable to contain an error message, if any

Parameters:
date
error_ref
 

template::util::leadingPad (public)

template::util::leadingPad string size
Pad a string with leading zeroes

Parameters:
string
size
 

template::util::leadingTrim (public)

template::util::leadingTrim value
Trim the leading zeroes from the value, but preserve the value as "0" if it is "00"

Parameters:
value
 

template::util::negative (public)

template::util::negative value
Check if a value is less than zero, but return false if the value is an empty string

Parameters:
value
 

template::util::textdate (public)

template::util::textdate command [ args... ]
Dispatch procedure for the textdate object

Parameters:
command
 

template::util::textdate::create (public)

template::util::textdate::create [ textdate ]
Build a textdate datatype structure, which is just the string itself for this simple type.

Parameters:
textdate (optional)
 

template::util::textdate_localized_format (public)

template::util::textdate_localized_format
Gets the localized format for the textdate widget

 

template::widget::ampmFragment (public)

template::widget::ampmFragment element_reference fragment size type \
    value [ mode ] [ tag_attributes ]
Create a widget that shows the am/pm selection

Parameters:
element_reference
fragment
size
type
value
mode (defaults to "edit")
tag_attributes (optional)
 

template::widget::date (public)

template::widget::date element_reference tag_attributes
Create a date entry widget according to a format string The format string should contain the following fields, separated by / \ - : . or whitespace:
stringmeaning
YYYY4-digit year
YY2-digit year
MM2-digit month
MONmonth name, short (i.e. "Jan")
MONTHmonth name, long (i.e. "January")
DDday of month
HH1212-hour hour
HH2424-hour hour
MIminutes
SSseconds
AMam/pm flag
Any format field may be followed by "t", in which case a text widget will be used to represent the field. the array in range_ref determines interval ranges; the keys are the date fields and the values are in form {start stop interval}

Parameters:
element_reference
tag_attributes
 

template::widget::dateFragment (public)

template::widget::dateFragment element_reference fragment size type \
    value [ mode ] [ tag_attributes ]
Create an input widget for the given date fragment If type is "t", uses a text widget for the fragment, with the given size. Otherwise, determines the proper widget based on the element flags, which may be text or a picklist

Parameters:
element_reference
fragment
size
type
value
mode (defaults to "edit")
tag_attributes (optional)
 

template::widget::monthFragment (public)

template::widget::monthFragment element_reference fragment size type \
    value [ mode ] [ tag_attributes ]
Create a month entry widget with short or long month names

Parameters:
element_reference
fragment
size
type
value
mode (defaults to "edit")
tag_attributes (optional)
 

template::widget::numericRange (public)

template::widget::numericRange name interval_def size [ value ] \
    [ tag_attributes ]
Create an html fragment to display a numeric range widget interval_def is in form { start stop interval }

Parameters:
name
interval_def
size
value (optional)
tag_attributes (optional)
 

template::widget::numericrange (public)

template::widget::numericrange element_reference tag_attributes
Widget proc usable with ad_form, need to define interval_def as {interval_def {start end step}}

Parameters:
element_reference
tag_attributes
 

template::widget::textdate (public)

template::widget::textdate element_reference tag_attributes
Implements the textdate widget.

Parameters:
element_reference
tag_attributes