Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v
diff -u -r1.183 -r1.184
--- openacs-4/packages/new-portal/tcl/portal-procs.tcl 7 Oct 2007 22:37:03 -0000 1.183
+++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 20 Dec 2007 13:49:54 -0000 1.184
@@ -289,7 +289,8 @@
edit_p=@edit_p@
hide_links_p=@hide_links_p@
page_id=@page_id@
- layout_id=@portal.layout_id@>"
+ layout_id=@portal.layout_id@
+ resource_dir=@portal.layout_resource_dir@>"
}
# Necessary hack to work around the acs-templating system
@@ -2438,41 +2439,22 @@
append html " \n$end_html\n"
}
-ad_proc portal::get_page_header_stuff {
- -portal_id
- -page_num
+ad_proc portal::set_page_css {
+ resource_dir
} {
- Return CSS link statements for the given page. Done here because
- the current new-portal implementation doesn't build a master/slave stack
- down to the layout or portlet script level, making impossible to pass CSS file
- information as a master template property.
+ Set the CSS in the HTML head tag for the given resource dir.
+ This proc is to be called from the layout templates.
+} {
- This is a kludge that should be made obsolete someday ...
+ if { [string first /resources/ $resource_dir] == 0 } {
+ set l [split $resource_dir /]
+ set path [acs_package_root_dir [lindex $l 2]]/www/resources/[join [lrange $l 3 end] /]
+ } else {
+ set path [acs_package_root_dir new-portal]/www/$resource_dir
+ }
- The basic idea is that since CSS must appear in the HEAD portion of a document,
- it is safe to link to any CSS file needed by a portal page. This includes
- all CSS files found in the previously unused layout resource_dir, and the
- new datasource css_dir column.
-
- The code assumes the layout's resource_dir (which is a misnomer, they've always been
- resource URLs - check the use of the theme resource_dir coiumn) and portlet
- CSS files are either relative or in proper "/resources/package-key" form.
-
-} {
- set header_stuff ""
- foreach resource_dir [db_list \
- -cache_key portal::get_page_header_stuff_${portal_id}_$page_num \
- get_resource_dirs {}] {
- if { [string first /resources/ $resource_dir] == 0 } {
- set l [split $resource_dir /]
- set path [acs_package_root_dir [lindex $l 2]]/www/resources/[join [lrange $l 3 end] /]
- } else {
- set path [acs_package_root_dir new-portal]/www/$resource_dir
- }
- foreach file [file tail [glob -nocomplain -directory $path *.css]] {
- append header_stuff "
- "
- }
+ foreach file [file tail [glob -nocomplain -directory $path *.css]] {
+ template::head::add_css -href $resource_dir/$file
}
- return $header_stuff
+
}
Index: openacs-4/packages/new-portal/tcl/portal-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v
diff -u -r1.47 -r1.48
--- openacs-4/packages/new-portal/tcl/portal-procs.xql 8 Aug 2007 11:43:57 -0000 1.47
+++ openacs-4/packages/new-portal/tcl/portal-procs.xql 20 Dec 2007 13:49:54 -0000 1.48
@@ -808,22 +808,4 @@
-
-
- select l.resource_dir
- from portal_pages p, portal_layouts l
- where p.portal_id = :portal_id
- and p.sort_key = :page_num
- and l.layout_id = p.layout_id
- union
- select distinct(pd.css_dir)
- from portal_element_map pem, portal_datasources pd, portal_pages pp
- where pp.portal_id = :portal_id
- and pp.sort_key = :page_num
- and pem.page_id = pp.page_id
- and pem.datasource_id = pd.datasource_id
- and pd.css_dir is not null
-
-
-
Index: openacs-4/packages/theme-zen/lib/layouts/zen1.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/theme-zen/lib/layouts/zen1.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/theme-zen/lib/layouts/zen1.tcl 15 May 2007 20:14:56 -0000 1.2
+++ openacs-4/packages/theme-zen/lib/layouts/zen1.tcl 20 Dec 2007 13:50:37 -0000 1.3
@@ -38,6 +38,10 @@
set return_url ""
}
+if { [exists_and_not_null resource_dir] } {
+ portal::set_page_css $resource_dir
+}
+
portal::layout_elements $element_list
ad_return_template
Index: openacs-4/packages/theme-zen/lib/layouts/zen2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/theme-zen/lib/layouts/zen2.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/theme-zen/lib/layouts/zen2.tcl 15 May 2007 20:14:56 -0000 1.2
+++ openacs-4/packages/theme-zen/lib/layouts/zen2.tcl 20 Dec 2007 13:50:37 -0000 1.3
@@ -42,6 +42,10 @@
set return_url ""
}
+if { [exists_and_not_null resource_dir] } {
+ portal::set_page_css $resource_dir
+}
+
portal::layout_elements $element_list
set element_2_first_num [llength $element_ids_1]
Index: openacs-4/packages/theme-zen/lib/layouts/zen3.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/theme-zen/lib/layouts/zen3.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/theme-zen/lib/layouts/zen3.tcl 15 May 2007 20:14:56 -0000 1.2
+++ openacs-4/packages/theme-zen/lib/layouts/zen3.tcl 20 Dec 2007 13:50:37 -0000 1.3
@@ -43,6 +43,10 @@
set return_url ""
}
+if { [exists_and_not_null resource_dir] } {
+ portal::set_page_css $resource_dir
+}
+
portal::layout_elements $element_list
set element_2_first_num [llength $element_ids_1]