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.179 -r1.179.2.1 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 8 Aug 2006 21:26:59 -0000 1.179 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 30 Jan 2007 19:48:13 -0000 1.179.2.1 @@ -268,14 +268,11 @@ # set up the template, it includes the layout template, # which in turn includes the theme, then elements - if { [empty_string_p $element_list] } { - # The portal has no elements, show anyway (they can configure) - set template " - @portal.name@" - } else { + set template " + @portal.name@" + if { ![empty_string_p $element_list] } { set element_src "[www_path]/render_styles/${render_style}/render-element" - set template " - @portal.name@ + append template " \n$end_html\n" } + ad_proc get_layout_header_stuff { + -portal_id + -page_num + } { + Return CSS link statements for the given page's layout. Done here because + the current new-portal implementation doesn't build a master/slave stack + down to the layout script level, making impossible to pass the CSS file + information as a master template property. + + This is a kludge that should be made obsolete someday ... + + 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 we find in the layout's resource_dir. Given + that until now the layout resource_dir has been unused, this should not break + any existing code. + + The code assumes the resource_dir (which is a misnomer, they've always been + resource URLs - check the use of the theme resource_dir coiumn) is either + relative or in proper "/resources/package-key" form. (the existing code + for the theme resource_dir only supports the relative form) + } { + db_1row get_resource_dir {} + 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 " +" + } + 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.45 -r1.45.2.1 --- openacs-4/packages/new-portal/tcl/portal-procs.xql 8 Aug 2006 21:26:59 -0000 1.45 +++ openacs-4/packages/new-portal/tcl/portal-procs.xql 30 Jan 2007 19:48:13 -0000 1.45.2.1 @@ -45,6 +45,7 @@ portals.theme_id, portal_layouts.layout_id, portal_layouts.filename as layout_filename, + portal_layouts.resource_dir as layout_resource_dir, portal_pages.page_id from portals, portal_pages, @@ -812,4 +813,14 @@ + + + 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 + + +