Index: openacs-4/packages/acs-templating/acs-templating.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/acs-templating.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-templating/acs-templating.info 9 May 2001 22:32:25 -0000 1.4 +++ openacs-4/packages/acs-templating/acs-templating.info 19 Jan 2002 03:55:16 -0000 1.5 @@ -1,11 +1,11 @@ - + ACS Templating ACS Templating Services - t t + t @@ -17,8 +17,8 @@ Separate page layout and implementation. 2001-02-21 ArsDigita Corporation - The template system provides mechanisms that allow developers and graphic designers to work independently. Templates specify the layout of the page seperately from the contents of the page. Graphic designers work primarily on the layout part of the template (the template), while programmers work primarily a script that generates the the content part of the template (the code). In addition, the -template system provides a way to use a single layout + The template system provides mechanisms that allow developers and graphic designers to work independently. Templates specify the layout of the page seperately from the contents of the page. Graphic designers work primarily on the layout part of the template (the template), while programmers work primarily a script that generates the the content part of the template (the code). In addition, the +template system provides a way to use a single layout specification for many physical pages, so the overall layout of a site can be more easily administered. @@ -50,6 +50,7 @@ + Index: openacs-4/packages/acs-templating/tcl/0-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/Attic/0-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/tcl/0-procs.tcl 9 May 2001 05:15:58 -0000 1.2 +++ openacs-4/packages/acs-templating/tcl/0-procs.tcl 19 Jan 2002 03:55:16 -0000 1.3 @@ -32,6 +32,7 @@ namespace eval query {} namespace eval util { namespace eval date {} + namespace eval currency {} } namespace eval element { Index: openacs-4/packages/acs-templating/tcl/data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/data-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/tcl/data-procs.tcl 9 May 2001 05:15:58 -0000 1.2 +++ openacs-4/packages/acs-templating/tcl/data-procs.tcl 19 Jan 2002 03:55:16 -0000 1.3 @@ -89,35 +89,6 @@ return 1 } -ad_proc -public template::data::validate::currency { value_ref message_ref } { - - upvar 2 $message_ref message $value_ref value - - ns_log Notice "In template::data::validate::currency" - - # a currency is a 6 element list supporting, for example, the following forms: "$2.03" "Rs 50.42" "12.52L" "Y5,13c" - # equivalent of date::unpack - set leading_symbol [lindex 0 $value] - set whole_part [lindex 1 $value] - set seperator [lindex 2 $value] - set fractional_part [lindex 3 $value] - set trailing_money [lindex 4 $value] - set format [lindex 5 $value] - - set format_whole_part [lindex 1 $format] - set format_fractional_part [lindx 3 $format] - - set whole_part_valid_p [expr [data::validate integer whole_part message] && { [string length $whole_part] < $format_whole_part } ] - set fractional_part_valid_p [expr [data::validate integer fractional_part message] && { [string length $fractional_part] < $format_fractional_part }] - - if { ! $whole_part_valid_p || ! $fractional_part_valid_p } { - set message "Invalid currency {[join $value ""]}" - return 0 - } else { - return 1 - } -} - ad_proc -public template::data::transform { type value_ref } { set proc_name [info procs ::template::data::transform::$type] Index: openacs-4/packages/acs-templating/tcl/date-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/date-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-templating/tcl/date-procs.tcl 7 Jan 2002 20:09:39 -0000 1.5 +++ openacs-4/packages/acs-templating/tcl/date-procs.tcl 19 Jan 2002 03:55:16 -0000 1.6 @@ -284,7 +284,6 @@ # mutate properties of the Date object ad_proc -public template::util::date::set_property { what date value } { - # Erase leading zeroes from the value, but make sure that 00 # is not completely erased set value [template::util::leadingTrim $value] @@ -383,8 +382,10 @@ @author Walter McGinnis (wtem@olywa.net) @creation_date 2002-01-06 } { - set now [clock format [clock seconds] -format "%Y %m %d %H %M %S"] - set today [list] + set now [list] + foreach v [clock format [clock seconds] -format "%Y %m %d %H %M %S"] { + lappend now [template::util::leadingTrim $v] + } # manipulate the minute value so it rounds up to nearest minute interval set minute [lindex $now 4] @@ -401,14 +402,10 @@ } } - # replaace the minute value in the now list with new value + # replace the minute value in the now list with new value set now [lreplace $now 4 4 $minute] - set today [list] - foreach v $now { - lappend today [template::util::leadingTrim $v] - } - return [eval create $today] + return [eval create $now] } ad_proc -public template::util::date::now_min_interval_plus_hour {} { @@ -419,8 +416,10 @@ @author Walter McGinnis (wtem@olywa.net) @creation_date 2002-01-06 } { - set now [clock format [clock seconds] -format "%Y %m %d %H %M %S"] - set today [list] + set now [list] + foreach v [clock format [clock seconds] -format "%Y %m %d %H %M %S"] { + lappend now [template::util::leadingTrim $v] + } # manipulate the minute value so it rounds up to nearest minute interval set minute [lindex $now 4] @@ -440,13 +439,9 @@ # get the hour value set hour [lindex $now 3] # replace the hour and minute values in the now list with new values - set now [lreplace $now 3 4 [incr hour] $minute] - set today [list] - foreach v $now { - lappend today [template::util::leadingTrim $v] - } + set now [lreplace $now 3 4 [incr hour $minute]] - return [eval create $today] + return [eval create $now] } ad_proc -public template::util::date::add_time { {-time_array_name:required} {-date_array_name:required} } { Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 12 Dec 2001 20:54:47 -0000 1.4 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 19 Jan 2002 03:55:16 -0000 1.5 @@ -247,105 +247,6 @@ $element(name) $element(options) $element(values) attributes] } -ad_proc -public template::widget::currency { element_reference tag_attributes } { - - upvar $element_reference element - - if { [info exists element(html)] } { - array set attributes $element(html) - } - - set default { $ 5 . 2 "" } - if { ! [info exists element(format)] } { - set format { {} {} {} {} {} } - } else { - set format [split $element(format) " "] - } - - if { [info exists element(value)] } { - ns_log Notice "element value $element(value)" - ns_log Notice "sep [lindex $format 0][lindex $format 2][lindex $format 4]" - ns_log Notice "checking [string index $element(value) 0] [lindex $format 0]" - if { [string equal [string index $element(value) 0] [lindex $format 0] ] } { - ns_log Notice "in here" - set element(value) [string range $element(value) 1 end] - } - ns_log Notice "new element $element(value)" - set values [split $element(value) "[lindex $format 0][lindex $format 2][lindex $format 4]"] - ns_log Notice "values $values" - } - - set i 0 - foreach format_property $format { - if { $i == 0 || $i == 2 || $i == 4 } { - append output $format_property - } elseif { $i == 1 || $i == 3 } { - set value [lindex $values 0] - set values [lrange $values 1 end] - - if { [string equal $format_property 0] } { - append output $value - } else { - append output "" - } - ns_log Notice "Values $i: [lindex $values $i]" - } - incr i - } - - return $output -} - -ad_proc -public template::data::transform::currency { element_ref } { - - upvar $element_ref element - set element_id $element(id) - - set format [split [ns_queryget "$element_id.format"] ""] - - set have_values 0 - - foreach field { - leading_symbol whole_part seperator fractional_part trailing_symbol - } { - set key "$element_id.$field" - if { [ns_queryexists $key] } { - set value [ns_queryget $key] - - # let's put a leading zero if the whole part is empty - if { [string equal $field whole_part] } { - if { [string equal $value ""] } { - set value 0 - } - } - - # and let's fill in the zeros at the end up to the precision - if { [string equal $field fractional_part] } { - set fractional_part_format [lindex format 3] - for { set i [string length $value] } { $i < $fractional_part_format } { set i [expr $i + 1] } { - append $value 0 - } - } - - # If the value is not null, set it - if { ![string equal $value {}] } { - lappend the_amount $value - set have_values 1 - } - } - } - - lappend the_amount $format - - ns_log Notice "The amount: $the_amount" - - if { $have_values } { - return [list $the_amount] - } else { - return {} - } -} - ad_proc -public template::data::transform::search { element_ref } { upvar $element_ref element