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.56.2.16 -r1.56.2.17
--- openacs-4/packages/acs-templating/acs-templating.info 1 Oct 2016 11:00:31 -0000 1.56.2.16
+++ openacs-4/packages/acs-templating/acs-templating.info 2 Oct 2016 16:40:25 -0000 1.56.2.17
@@ -9,7 +9,7 @@
f
t
-
+
OpenACS
Templating library.
2015-10-04
@@ -27,7 +27,7 @@
GPL version 2
3
-
+
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.49.2.3 -r1.49.2.4
--- openacs-4/packages/acs-templating/tcl/date-procs.tcl 28 May 2016 09:40:24 -0000 1.49.2.3
+++ openacs-4/packages/acs-templating/tcl/date-procs.tcl 2 Oct 2016 16:40:25 -0000 1.49.2.4
@@ -1290,11 +1290,19 @@
}
if {$element(mode) eq "edit"} {
- append output ""
- append output ""
+ set id $element(id)_input_field
+ append output [subst {
+
+
+ }]
+
+ template::add_event_listener \
+ -id $id-control \
+ -script [subst {
+ showCalendarWithDefault('$element(id)_input_field', '$javascriptdate', '[template::util::textdate_localized_format]');
+ }]
} else {
- append output $textdate
- append output ""
+ append output $textdate [subst {}]
}
return $output
Index: openacs-4/packages/acs-templating/tcl/head-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/head-procs.tcl,v
diff -u -r1.20.2.12 -r1.20.2.13
--- openacs-4/packages/acs-templating/tcl/head-procs.tcl 1 Oct 2016 11:10:45 -0000 1.20.2.12
+++ openacs-4/packages/acs-templating/tcl/head-procs.tcl 2 Oct 2016 16:40:25 -0000 1.20.2.13
@@ -759,17 +759,19 @@
}
ad_proc template::add_confirm_handler {
+ {-event click}
{-message "Are you sure?"}
{-CSSclass "acs-confirm"}
- {-event click}
{-id}
} {
Register an event handler for confirmation dialogs
for elements either with an specified ID or for elements
of a CSS class (default "acs_confirm").
- @id optional ID for HTML element
- @message Message to be displayed in the confirmation dialog
+ @event register confirm handler for this type of event
+ @id register confirm handler for this HTML ID
+ @CSSclass register confirm handler for this CSS class
+ @message Message to be displayed in the confirmation dialog
@author Gustaf Neumann
} {
if {[info exists id]} {
@@ -792,11 +794,48 @@
}
}]
}
- #template::add_body_script -script $script
}
+ad_proc template::add_event_listener {
+ {-event click}
+ {-CSSclass "acs-listen"}
+ {-id}
+ {-usecapture:boolean false}
+ {-preventdefault:boolean true}
+ {-script:required}
+} {
+
+ Register an event handler for elements either with an specified ID
+ or for elements of a CSS class.
+ @event register confirm handler for this type of event
+ @id register confirm handler for this HTML ID
+ @CSSclass register confirm handler for this CSS class
+ @message Message to be displayed in the confirmation dialog
+ @author Gustaf Neumann
+} {
+ set prevent [expr {$preventdefault_p ? "event.preventDefault();" : ""}]
+
+ if {[info exists id]} {
+ template::add_body_script -script [subst {
+ document.getElementById('$id').addEventListener('$event', function (event) {
+ $prevent$script
+ }, $usecapture_p);
+ }]
+ } else {
+ template::add_body_script -script [subst {
+ var elems = document.getElementsByClassName('$CSSclass');
+ for (var i = 0, l = elems.length; i < l; i++) {
+ elems\[i\].addEventListener('$event', function (event) {
+ $prevent;$script
+ }, $usecapture_p);
+ }
+ }]
+ }
+}
+
+
# Local variables:
# mode: tcl
# tcl-indent-level: 4
Index: openacs-4/packages/acs-templating/tcl/list-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/list-procs.tcl,v
diff -u -r1.60.2.13 -r1.60.2.14
--- openacs-4/packages/acs-templating/tcl/list-procs.tcl 29 Aug 2016 09:23:03 -0000 1.60.2.13
+++ openacs-4/packages/acs-templating/tcl/list-procs.tcl 2 Oct 2016 16:40:25 -0000 1.60.2.14
@@ -348,10 +348,21 @@
error "You cannot have bulk_actions without providing a key for list '$name'"
}
# Create the checkbox element
- set label [subst {}]
+ set label [subst {
+
+ }]
+ template::add_event_listener \
+ -id $name-bulkaction-control \
+ -preventdefault=false \
+ -script [subst {acs_ListCheckAll('[ns_quotehtml $name]', this.checked);}]
+ template::add_event_listener \
+ -id $name-bulkaction-control \
+ -event keypress \
+ -preventdefault=false \
+ -script [subst {acs_ListCheckAll('[ns_quotehtml $name]', this.checked);}]
+
if {[info exists ::__csrf_token]} {
- append label \n [subst {}]
+ append label [subst {}]
}
# We only ulevel 1 here, because we want the subst to be done in this namespace