Index: openacs-4/packages/acs-subsite/acs-subsite.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/acs-subsite.info,v diff -u -r1.117.2.2 -r1.117.2.3 --- openacs-4/packages/acs-subsite/acs-subsite.info 25 Aug 2015 17:16:36 -0000 1.117.2.2 +++ openacs-4/packages/acs-subsite/acs-subsite.info 27 Aug 2015 08:06:56 -0000 1.117.2.3 @@ -9,7 +9,7 @@ t t - + OpenACS Subsite 2015-06-16 @@ -18,7 +18,7 @@ GPL 3 - + @@ -88,6 +88,7 @@ + Index: openacs-4/packages/acs-subsite/sql/oracle/themes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/sql/oracle/themes-create.sql,v diff -u -r1.4.6.1 -r1.4.6.2 --- openacs-4/packages/acs-subsite/sql/oracle/themes-create.sql 25 Aug 2015 16:01:41 -0000 1.4.6.1 +++ openacs-4/packages/acs-subsite/sql/oracle/themes-create.sql 27 Aug 2015 08:06:56 -0000 1.4.6.2 @@ -22,7 +22,8 @@ form_template varchar(200), list_template varchar(200), list_filter_template varchar(200), - dimensional_template varchar(200) + dimensional_template varchar(200), + resource_dir varchar(200) ); -- Insert the old themes that were hard-wired into earlier versions of acs-subsite. Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-subsite/sql/oracle/upgrade/upgrade-5.9.0d4-5.9.0d5.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-subsite/sql/postgresql/themes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/sql/postgresql/themes-create.sql,v diff -u -r1.3.6.1 -r1.3.6.2 --- openacs-4/packages/acs-subsite/sql/postgresql/themes-create.sql 25 Aug 2015 16:01:41 -0000 1.3.6.1 +++ openacs-4/packages/acs-subsite/sql/postgresql/themes-create.sql 27 Aug 2015 08:06:57 -0000 1.3.6.2 @@ -22,7 +22,8 @@ form_template text, list_template text, list_filter_template text, - dimensional_template text + dimensional_template text, + resource_dir text ); -- Insert the old themes that were hard-wired into earlier versions of acs-subsite. Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-subsite/sql/postgresql/upgrade/upgrade-5.9.0d4-5.9.0d5.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl,v diff -u -r1.44.2.1 -r1.44.2.2 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 25 Aug 2015 16:01:42 -0000 1.44.2.1 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 27 Aug 2015 08:06:57 -0000 1.44.2.2 @@ -796,8 +796,13 @@ -subsite_id {-theme:required} } { - Set the theme for the given subsite. This will change the subsite's ThemeKey, - DefaultMaster, and ThemeCSS parameters. + Set the theme for the given or current subsite. This will change + the subsite's ThemeKey, DefaultMaster, and ThemeCSS, + DefaultFormStyle, DefaultListStyle, DefaultListFilterStyle, + DefaultDimensionalStyle, and ResourceDir parameters. + + @param subsite_id id of the subsite + @param theme Name of the theme (theme key)x } { if { ![info exists subsite_id] } { set subsite_id [ad_conn subsite_id] @@ -817,8 +822,26 @@ -value $list_template parameter::set_value -parameter DefaultListFilterStyle -package_id $subsite_id \ -value $list_filter_template + parameter::set_value -parameter DefaultDimensionalStyle -package_id $subsite_id \ + -value $dimensional_template + parameter::set_value -parameter ResourceDir -package_id $subsite_id \ + -value $resource_dir } +ad_proc -public subsite::get_theme { + -subsite_id +} { + Get the theme for the given (or current) subsite. + + @param subsite_id id of the subsite + @return Name of the theme (theme key) +} { + if { ![info exists subsite_id] } { + set subsite_id [ad_conn subsite_id] + } + parameter::get -parameter ThemeKey -package_id $subsite_id +} + ad_proc -public subsite::new_subsite_theme { -key:required -name:required @@ -828,6 +851,7 @@ {-list_template ""} {-list_filter_template ""} {-dimensional_template ""} + {-resource_dir ""} } { Add a new subsite theme, making it available to the theme configuration code. } { Index: openacs-4/packages/acs-subsite/tcl/subsite-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/subsite-procs.xql,v diff -u -r1.12.10.1 -r1.12.10.2 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 25 Aug 2015 16:01:42 -0000 1.12.10.1 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 27 Aug 2015 08:06:57 -0000 1.12.10.2 @@ -86,10 +86,10 @@ insert into subsite_themes (key, name, template, css, form_template, list_template, - list_filter_template, dimensional_template) + list_filter_template, dimensional_template resource_dir) values (:key, :name, :template, :css, :form_template, :list_template, - :list_filter_template, :dimensional_template) + :list_filter_template, :dimensional_template, :resource_dir) Index: openacs-4/packages/acs-subsite/www/admin/configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/configure.tcl,v diff -u -r1.12 -r1.12.6.1 --- openacs-4/packages/acs-subsite/www/admin/configure.tcl 15 Apr 2011 09:50:52 -0000 1.12 +++ openacs-4/packages/acs-subsite/www/admin/configure.tcl 27 Aug 2015 08:06:57 -0000 1.12.6.1 @@ -6,10 +6,9 @@ @cvs-id $Id$ } -set page_title "[_ acs-subsite.Subsite_Configuration]" +set page_title [_ acs-subsite.Subsite_Configuration] +set context [list [_ acs-subsite.Configuration]] -set context [list "[_ acs-subsite.Configuration]"] - set group_id [application_group::group_id_from_package_id] ad_form -name name -cancel_url [ad_conn url] -mode display -form { Index: openacs-4/packages/acs-templating/tcl/dimensional-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/dimensional-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/acs-templating/tcl/dimensional-procs.tcl 25 Aug 2015 22:09:07 -0000 1.1.2.2 +++ openacs-4/packages/acs-templating/tcl/dimensional-procs.tcl 27 Aug 2015 08:06:57 -0000 1.1.2.3 @@ -69,11 +69,10 @@ -default "dimensional-table"] } - if {[regexp {^/(.*)} $style path]} { - set adp_stub $path - } else { - set adp_stub /packages/acs-templating/resources/dimensional/$style - } + # + # Get the path. template::include needs a relative path. + # + set adp_stub [template::resource_path -type dimensional -style $style -relative] # # Create nested adp-arrays. Since the templating system does not Index: openacs-4/packages/acs-templating/tcl/filter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/filter-procs.tcl,v diff -u -r1.16.2.1 -r1.16.2.2 --- openacs-4/packages/acs-templating/tcl/filter-procs.tcl 17 Aug 2015 17:50:27 -0000 1.16.2.1 +++ openacs-4/packages/acs-templating/tcl/filter-procs.tcl 27 Aug 2015 08:06:57 -0000 1.16.2.2 @@ -103,7 +103,7 @@ set code_stub "$::acs::rootdir/packages/$package_key/www$rest" set beginTime [clock clicks -milliseconds] - set file_stub [template::get_resource_path]/messages/datasources + set file_stub [template::resource_path -type messages -style $datasources] set output [template::adp_parse $file_stub [list code_stub $code_stub]] Index: openacs-4/packages/acs-templating/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/form-procs.tcl,v diff -u -r1.46 -r1.46.2.1 --- openacs-4/packages/acs-templating/tcl/form-procs.tcl 27 Oct 2014 16:40:11 -0000 1.46 +++ openacs-4/packages/acs-templating/tcl/form-procs.tcl 27 Aug 2015 08:06:58 -0000 1.46.2.1 @@ -338,22 +338,20 @@ -default "standard-lars"]] } - # Added support for storing form templates outside acs-templating - if {[regexp {^/(.*)} $style path]} { - set file_stub "$::acs::rootdir$path" - } else { - set file_stub [template::get_resource_path]/forms/$style - } - - if { ![file exists "${file_stub}.adp"] } { + set file_stub [template::resource_path -type forms -style $style] + + if { ![file exists "$file_stub.adp"] } { # We always have a template named 'standard' - set file_stub "[template::get_resource_path]/forms/standard" + set file_stub [template::resource_path -type forms -style standard] } - # set the asset url for images - set assets "[template::get_resource_path]/assets" - # assume resources are under page root (not safe) - regsub "^$::acs::pageroot" $assets {} assets + # the following block seems useless, deactivated for the time being + if {0} { + # set the asset url for images + set assets "[template::get_resource_path]/assets" + # assume resources are under page root (not safe) + regsub "^$::acs::pageroot" $assets {} assets + } # ensure that the style template has been compiled and is up-to-date template::adp_init adp $file_stub 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.1 -r1.60.2.2 --- openacs-4/packages/acs-templating/tcl/list-procs.tcl 25 Aug 2015 22:29:54 -0000 1.60.2.1 +++ openacs-4/packages/acs-templating/tcl/list-procs.tcl 27 Aug 2015 08:06:58 -0000 1.60.2.2 @@ -1146,12 +1146,7 @@ -default "table"]] } - # Added support for storing form templates outside acs-templating - if {[regexp {^/(.*)} $style path]} { - set file_stub "$::acs::rootdir$path" - } else { - set file_stub [template::get_resource_path]/lists/$style - } + set file_stub [template::resource_path -type lists -style $style] # ensure that the style template has been compiled and is up-to-date template::adp_init adp $file_stub @@ -1805,12 +1800,8 @@ -parameter DefaultListFilterStyle \ -default "filters"] } - # Added support for storing form templates outside acs-templating - if {[regexp {^/(.*)} $style path]} { - set file_stub "$::acs::rootdir$path" - } else { - set file_stub [template::get_resource_path]/lists/$style - } + + set file_stub [template::resource_path -type lists -style $style] # ensure that the style template has been compiled and is up-to-date template::adp_init adp $file_stub @@ -3100,13 +3091,13 @@ ############################################################ ############################################################ - if {$style eq {}} { + if {$style eq ""} { set style [parameter::get \ -package_id [apm_package_id_from_key "acs-templating"] \ -parameter DefaultListFilterStyle \ -default "filters"] } - set file_stub "[template::get_resource_path]/lists/$style" + set file_stub [template::resource_path -type lists -style $style] # ensure that the style template has been compiled and is up-to-date template::adp_init adp $file_stub Index: openacs-4/packages/acs-templating/tcl/request-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/request-procs.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/acs-templating/tcl/request-procs.tcl 27 Oct 2014 16:40:12 -0000 1.8 +++ openacs-4/packages/acs-templating/tcl/request-procs.tcl 27 Aug 2015 08:06:58 -0000 1.8.2.1 @@ -157,29 +157,29 @@ @return 1 if no error conditions exist, 0 otherwise. } { - set level [template::adp_level] - upvar #$level request:error requesterror + set level [template::adp_level] + upvar #$level request:error requesterror - if { [info exists requesterror] } { + if { [info exists requesterror] } { - # set requesterror as a data source - uplevel #$level "upvar 0 request:error requesterror" + # set requesterror as a data source + uplevel #$level "upvar 0 request:error requesterror" - if { $url ne "self" } { + if { $url ne "self" } { - if {$url eq {}} { - set file_stub [template::get_resource_path]/messages/request-error - } else { - set file_stub [ns_url2file $url] - } - template::set_file $file_stub - } + if {$url eq {}} { + set file_stub [template::resource_path -type messages -style request-error] + } else { + set file_stub [ns_url2file $url] + } + template::set_file $file_stub + } - return 0 + return 0 - } else { + } else { - return 1 - } + return 1 + } } Index: openacs-4/packages/acs-templating/tcl/util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/util-procs.tcl,v diff -u -r1.28 -r1.28.2.1 --- openacs-4/packages/acs-templating/tcl/util-procs.tcl 12 Jan 2015 12:39:20 -0000 1.28 +++ openacs-4/packages/acs-templating/tcl/util-procs.tcl 27 Aug 2015 08:06:58 -0000 1.28.2.1 @@ -757,15 +757,63 @@ } } -ad_proc -public template::get_resource_path {} { +ad_proc -deprecated template::get_resource_path {} { Get the template directory The body is doublequoted, so it is interpreted when this file is read + @see template::resource_path } " return \"[file dirname [file dirname [info script]]]/resources\" " +ad_proc -public template::resource_path { + -type:required + -style:required + -relative:boolean + -subsite_id + -theme_dir +} { + + Process the templating "style" and return the stub (path without + extensions). When the style is not an abolute path, check if the + resource can be obtained from the theme, if not fallback to the + resources directory of acs-templating. + @param type type of resource (e.g. "forms" or "lists") + @param style name of the resource within the type (e.g. "standard") + @param relative return optionally the path relative to the OpenACS root directory + @param theme_dir theming directory (alternative to determination via subsite), higher priority + @param subsite_id subsite_id to determine theming information + @return path of the resource (without extension) +} { + + if {![regexp {^/(.*)} $style path]} { + + if { ![info exists theme_dir] } { + if { ![info exists subsite_id] } { + set subsite_id [ad_conn subsite_id] + } + set theme_dir [parameter::get -parameter ResourceDir -package_id $subsite_id] + } + + if {$theme_dir ne ""} { + set path $theme_dir/$type/$style + if {![file exists $::acs::rootdir/$path.adp]} { + unset path + } + } + if {![info exists path]} { + set path /packages/acs-templating/resources/$type/$style + } + } + + if {$relative_p} { + return $path + } else { + return $::acs::rootdir/$path + } +} + ad_proc -public stack_frame_values {level} { return the variables and arrays of one frame as HTML } { Index: openacs-4/packages/openacs-default-theme/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openacs-default-theme/tcl/apm-callback-procs.tcl,v diff -u -r1.3.10.1 -r1.3.10.2 --- openacs-4/packages/openacs-default-theme/tcl/apm-callback-procs.tcl 25 Aug 2015 16:01:41 -0000 1.3.10.1 +++ openacs-4/packages/openacs-default-theme/tcl/apm-callback-procs.tcl 27 Aug 2015 08:06:59 -0000 1.3.10.2 @@ -19,7 +19,7 @@ -form_template /packages/acs-templating/resources/forms/standard \ -list_template /packages/acs-templating/resources/lists/table \ -list_filter_template /packages/acs-templating/resources/lists/filters \ - -dimensional_template /packages/acs-templating/resources/dimensional/dimensional-table + -dimensional_template /packages/acs-templating/resources/dimensional/dimensional-table subsite::new_subsite_theme \ -key default_tabbed \