Index: openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl 12 Apr 2013 16:12:57 -0000 1.20
+++ openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl 27 Oct 2014 16:40:10 -0000 1.21
@@ -12,7 +12,7 @@
# http://www.fsf.org/copyleft/gpl.html
ad_proc -public ad_return_template {
- -string:boolean
+ -string:boolean
{template ""}
} {
This function is a wrapper for sundry template:: procs. Will set the
@@ -21,16 +21,16 @@
@param template Name of template file
@param string If specified, will return the resulting page to the caller
- string instead sending it to the connection.
+ string instead sending it to the connection.
} {
if {$template ne ""} {
- template::set_file \
- [template::util::url_to_file $template [ad_conn file]]
+ template::set_file \
+ [template::util::url_to_file $template [ad_conn file]]
}
if { $string_p } {
- return [template::adp_parse \
- [template::util::url_to_file $template [ad_conn file]] {}]
+ return [template::adp_parse \
+ [template::util::url_to_file $template [ad_conn file]] {}]
}
}
@@ -53,12 +53,8 @@
set template_params [list]
foreach param $params {
switch [llength $param] {
- 1 { lappend template_params "&"
- lappend template_params [lindex $param 0]
- }
- 2 { lappend template_params [lindex $param 0]
- lappend template_params [lindex $param 1]
- }
+ 1 { lappend template_params "&" [lindex $param 0] }
+ 2 { lappend template_params [lindex $param 0] [lindex $param 1] }
default { return -code error [_ acs-templating.Template_parser_error_in_parameter_list] }
}
}
@@ -88,18 +84,18 @@
ad_proc -public get_server_root {} {
Get the server root directory (supposing we run under ACS)
} {
- file dir $::acs::tcllib
+ return $::acs::rootdir
}
ad_proc adp_parse_ad_conn_file {} {
handle a request for an adp and/or tcl file in the template system.
} {
- namespace eval template variable parse_level ""
- #ns_log debug "adp_parse_ad_conn_file => file '[file root [ad_conn file]]'"
+ set ::template::parse_level ""
+ #ns_log debug "adp_parse_ad_conn_file => file '[file rootname [ad_conn file]]'"
template::reset_request_vars
- set parsed_template [template::adp_parse [file root [ad_conn file]] {}]
+ set parsed_template [template::adp_parse [file rootname [ad_conn file]] {}]
if {$parsed_template ne ""} {
@@ -108,6 +104,7 @@
#
if { [lang::util::translator_mode_p] } {
+ set apm_package_url [apm_package_url_from_key "acs-lang"]
# Attempt to move all message keys outside of tags
while { [regsub -all {(<[^>]*)(\x002\(\x001[^\x001]*\x001\)\x002)([^>]*>)} $parsed_template {\2\1\3} parsed_template] } {}
@@ -124,27 +121,25 @@
if { [string first "...
while { [regexp -indices {\x002\(\x001([^\x001]*)\x001\)\x002} $parsed_template indices key] } {
- set before [string range $parsed_template 0 [expr {[lindex $indices 0] - 1}]]
- set after [string range $parsed_template [expr {[lindex $indices 1] + 1}] end]
+ set before [string range $parsed_template 0 [lindex $indices 0]-1]
+ set after [string range $parsed_template [lindex $indices 1]+1 end]
set key [string range $parsed_template [lindex $key 0] [lindex $key 1]]
+ lassign [split $key "."] package_key message_key
- set keyv [split $key "."]
- set package_key [lindex $keyv 0]
- set message_key [lindex $keyv 1]
+ set edit_url [export_vars -base "${apm_package_url}admin/edit-localized-message" {
+ { locale {[ad_conn locale]} } package_key message_key { return_url [ad_return_url] } }]
- set edit_url [export_vars -base "[apm_package_url_from_key "acs-lang"]admin/edit-localized-message" { { locale {[ad_conn locale]} } package_key message_key { return_url [ad_return_url] } }]
-
if { [lang::message::message_exists_p [ad_conn locale] $key] } {
set edit_link "o"
} else {
@@ -153,7 +148,8 @@
set edit_link "*"
} else {
# Message key missing entirely
- set new_url [export_vars -base "[apm_package_url_from_key "acs-lang"]admin/localized-message-new" { { locale en_US } package_key message_key { return_url [ad_return_url] } }]
+ set new_url [export_vars -base "${apm_package_url}admin/localized-message-new" {
+ { locale en_US } package_key message_key { return_url [ad_return_url] } }]
set edit_link "@"
}
}
@@ -164,9 +160,16 @@
set mime_type [template::get_mime_type]
set header_preamble [template::get_mime_header_preamble $mime_type]
- doc_return 200 $mime_type "$header_preamble$parsed_template"
+ doc_return 200 $mime_type "$header_preamble$parsed_template"
} else {
db_release_unused_handles
}
}
+#
+# Local variables:
+# mode: tcl
+# tcl-indent-level: 4
+# indent-tabs-mode: nil
+# End:
+