Index: openacs-4/packages/content-includelet/content-includelet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/content-includelet/content-includelet.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/content-includelet/content-includelet.info 30 Aug 2008 21:20:05 -0000 1.4 +++ openacs-4/packages/content-includelet/content-includelet.info 5 Dec 2008 13:46:38 -0000 1.5 @@ -1,7 +1,7 @@ - + Content Includelet Content Includelets f Index: openacs-4/packages/layout-managed-subsite/www/admin/layouts/add-elements.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-managed-subsite/www/admin/layouts/add-elements.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/layout-managed-subsite/www/admin/layouts/add-elements.tcl 26 Nov 2008 11:10:23 -0000 1.1 +++ openacs-4/packages/layout-managed-subsite/www/admin/layouts/add-elements.tcl 5 Dec 2008 13:46:40 -0000 1.2 @@ -28,7 +28,6 @@ lappend added_names $one_name layout::element::new \ - -pageset_id $pageset_id \ -package_id $package_id \ -includelet_name $one_name \ -state hidden \ Index: openacs-4/packages/layout-manager/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/layout-manager/tcl/element-procs.tcl 3 Dec 2008 09:22:00 -0000 1.5 +++ openacs-4/packages/layout-manager/tcl/element-procs.tcl 5 Dec 2008 13:46:38 -0000 1.6 @@ -11,9 +11,8 @@ namespace eval layout::element {} ad_proc layout::element::new { - -pageset_id:required -package_id:required - {-page_name ""} + {-page_id ""} {-page_column ""} {-state full} -includelet_name:required @@ -25,9 +24,8 @@ } { Create a new layout manager element of type includelet_name on the given layout manager. - @param pageset_id The page set to add this element to. @param package_id The object this element is bound to. - @param page_name The name of the page to place it on (defaults to the first page.) + @param page_id The id of the page to place it on (defaults to first page). @param name The internal name for this element @param title The external name or message resource for this element @param page_column The page page_column to placer the element on. @@ -44,10 +42,8 @@ } { - set page_id [layout::page::get_id -pageset_id $pageset_id -page_name $page_name] - if { $page_column eq "" } { - set page_column [layout::element::choose_page_column -page_id $page_id] + set page_column [layout::element::choose_page_column -page_id $page_id] } array set includelet [layout::includelet::get -name $includelet_name] Index: openacs-4/packages/layout-manager/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/install-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/layout-manager/tcl/install-procs.tcl 5 Dec 2008 13:46:39 -0000 1.1 @@ -0,0 +1,113 @@ +ad_library { + + Implement the layout-pageset, layout-page, layout-element install.xml tags. + + @creation-date 2008-12-04 + @author Don Baccus (dhogaza@pacifier.com) + @cvs-id $Id: install-procs.tcl,v 1.1 2008/12/05 13:46:39 donb Exp $ +} + +namespace eval install {} +namespace eval install::xml {} +namespace eval install::xml::util {} +namespace eval install::xml::action {} +namespace eval install::xml::object_id {} + +ad_proc -public install::xml::action::layout-element { + {-page_id ""} + node +} { + Create a new element. Either the caller or the XML node may specify the + page_id. +} { + set id [apm_attribute_value -default "" $node id] + set package_id [::install::xml::object_id::package $node] + set page_id [apm_attribute_value -default $page_id $node page-id] + set page_column [apm_attribute_value -default "" $node page_column] + set state [apm_attribute_value -default full $node state] + set includelet_name [apm_attribute_value -default "" $node includelet-name] + set name [apm_attribute_value -default "" $node name] + set title [apm_attribute_value -default "" $node title] + set parameters [apm_attribute_value -default "" $node parameters] + set initialize [apm_attribute_value -default "" $node initialize] + set theme [apm_attribute_value -default "" $node theme] + + set cmd layout::element::new + + if { $initialize ne "" } { + if { ![string is boolean $initialize] } { + error "layout-element: non-boolean value given for the \"initialize\" attribute" + } + lappend cmd -initialize=[string is true $initialize] + } + + foreach param {package_id page_id theme page_column state + includelet_name name title parameters theme} { + lappend cmd -$param [set $param] + } + set element_id [eval $cmd] + + if {$id ne ""} { + set ::install::xml::ids($id) $element_id + } + + return {} +} + +ad_proc -public install::xml::action::layout-page { + {-pageset_id ""} + node +} { + Create a new page. Either the caller or the XML node may specify the + pageset_id. +} { + + set id [apm_attribute_value -default "" $node id] + set pageset_id [apm_attribute_value -default $pageset_id $node pageset-id] + set name [apm_required_attribute_value $node name] + set theme [apm_attribute_value -default "" $node theme] + set page_template [apm_attribute_value -default 2_column $node page-template] + + set cmd layout::page::new + foreach param {pageset_id name page_template} { + lappend cmd -$param [set $param] + } + set page_id [eval $cmd] + + if {$id ne ""} { + set ::install::xml::ids($id) $page_id + } + + foreach element [xml_node_get_children_by_name $node layout-element] { + install::xml::action::layout-element -page_id $page_id $element + } + return +} + +ad_proc -public install::xml::action::layout-pageset { node } { + Create a new pageset, bound to a given +} { + set id [apm_attribute_value -default "" $node id] + set package_id [::install::xml::object_id::package $node] + set owner_id [apm_required_attribute_value $node owner-id] + set theme [apm_attribute_value -default default $node theme] + set context_id [apm_attribute_value -default "" $node context-id] + set owner_privileges [apm_attribute_value -default "" $node owner-privileges] + set page_list [apm_attribute_value -default "" $node page-list] + + set cmd layout::pageset::new + foreach param {package_id owner_id theme context_id owner_privileges page_list} { + lappend cmd -$param [set $param] + } + set pageset_id [eval $cmd] + + if {$id ne ""} { + set ::install::xml::ids($id) $pageset_id + } + + foreach page [xml_node_get_children_by_name $node layout-page] { + install::xml::action::layout-page -pageset_id $pageset_id $page + } + + return {} +} Index: openacs-4/packages/layout-manager/tcl/page-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/page-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/layout-manager/tcl/page-procs.tcl 3 Dec 2008 09:22:00 -0000 1.2 +++ openacs-4/packages/layout-manager/tcl/page-procs.tcl 5 Dec 2008 13:46:39 -0000 1.3 @@ -13,6 +13,7 @@ -pageset_id:required -name:required {-page_template 2_column} + {-theme ""} } { Create a new page and associate it with the given page set. Index: openacs-4/packages/layout-manager/tcl/page-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/page-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/layout-manager/tcl/page-procs.xql 3 Dec 2008 09:22:00 -0000 1.2 +++ openacs-4/packages/layout-manager/tcl/page-procs.xql 5 Dec 2008 13:46:39 -0000 1.3 @@ -5,8 +5,8 @@ insert into layout_pages - (page_id, name, pageset_id, page_template, sort_key) - select :page_id, :name, :pageset_id, :page_template, + (page_id, name, pageset_id, page_template, theme, sort_key) + select :page_id, :name, :pageset_id, :page_template, :theme, coalesce(max(sort_key) + 1, 0) from layout_pages where pageset_id = :pageset_id Index: openacs-4/packages/layout-manager/tcl/pageset-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/pageset-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/layout-manager/tcl/pageset-procs.tcl 3 Dec 2008 09:22:00 -0000 1.3 +++ openacs-4/packages/layout-manager/tcl/pageset-procs.tcl 5 Dec 2008 13:46:39 -0000 1.4 @@ -18,7 +18,6 @@ {-owner_privileges {read write admin}} {-theme default} {-package_id ""} - {-template_id ""} } { Create a new page set for the passed in owner_id. create pages passed in the page_list. @@ -51,8 +50,7 @@ {p_context_id $context_id} {p_owner_id $owner_id} {p_theme $theme} - {p_package_id $package_id} - {p_template_id $template_id}}] + {p_package_id $package_id}}] set pageset_id [package_instantiate_object -var_list $var_list layout_pageset] @@ -240,7 +238,6 @@ @return The pageset_id of the master page set template. } { - if { ![info exists package_id] } { set package_id [ad_conn package_id] } @@ -252,7 +249,20 @@ } } +ad_proc layout::pageset::is_master_template_p { + -pageset_id:required + -package_id +} { + @return True if the given pageset_id is the master template for the given package_id. +} { + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + return [expr { $pageset_id == + [layout::pageset::get_master_template_id -package_id $package_id] }] +} + ad_proc -public layout::pageset::get_page_count { -pageset_id:required } { Index: openacs-4/packages/layout-manager/tcl/test/layout-manager-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/test/layout-manager-test-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/layout-manager/tcl/test/layout-manager-test-procs.tcl 22 Jul 2008 07:31:04 -0000 1.1 +++ openacs-4/packages/layout-manager/tcl/test/layout-manager-test-procs.tcl 5 Dec 2008 13:46:40 -0000 1.2 @@ -170,9 +170,9 @@ set pageset_id [layout::pageset::new -package_id [ad_conn package_id] -owner_id 0] set page_id [layout::page::new -pageset_id $pageset_id \ -name test -page_template 2_column] - set element_id [layout::element::new -pageset_id $pageset_id \ + set element_id [layout::element::new \ -package_id [ad_conn package_id] \ - -page_name test -includelet_name subsites_includelet \ + -page_id $page_id -includelet_name subsites_includelet \ -name test -title Test] aa_true "Pass $i: new" [exists_and_not_null element_id] @@ -221,9 +221,9 @@ set pageset_id [layout::pageset::new -package_id [ad_conn package_id] -owner_id 0] set page_id [layout::page::new -pageset_id $pageset_id \ -name test -page_template 2_column] - set element_id [layout::element::new -pageset_id $pageset_id \ + set element_id [layout::element::new \ -package_id [ad_conn package_id] \ - -page_name test -includelet_name subsites_includelet \ + -page_id $page_id -includelet_name subsites_includelet \ -name test -title Test] layout::element::parameter::add_values \ -element_id $element_id \