Index: openacs-4/packages/layout-manager/layout-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/layout-manager.info,v diff -u -r1.3 -r1.4 --- openacs-4/packages/layout-manager/layout-manager.info 19 Aug 2008 20:15:58 -0000 1.3 +++ openacs-4/packages/layout-manager/layout-manager.info 30 Aug 2008 00:34:10 -0000 1.4 @@ -1,4 +1,4 @@ - + @@ -7,14 +7,14 @@ f t - + Don Baccus Layout Manager 2008-07-15 OpenACS The Layout Manager is used to control the layout of sets of pages built from various individual library templates provided by packages. It is a simplified and stand-alone rewrite of the .LRN new-portal package. - + Index: openacs-4/packages/layout-manager/sql/oracle/includelets-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/includelets-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/layout-manager/sql/oracle/includelets-create.sql 19 Aug 2008 20:15:58 -0000 1.3 +++ openacs-4/packages/layout-manager/sql/oracle/includelets-create.sql 30 Aug 2008 00:34:10 -0000 1.4 @@ -32,7 +32,13 @@ constraint layout_includelets_i_m_p_nn not null constraint layout_includelets_i_m_p_ck - check (internally_managed_p in ('t', 'f')) + check (internally_managed_p in ('t', 'f')), + singleton_p char(1) + default 't' + constraint layout_includelets_s_p_nn + not null + constraint layout_includelets_s_p_ck + check (singleton_p in ('t', 'f')) ); -- indexes for referential integrity checking @@ -88,3 +94,7 @@ portlet create layout elements via a dynamically generated form in a very non-.LRN manner, it''s probably generally useful. '; + +comment on column layout_includelets.singleton_p is ' + If true, only one instance of this includelet should be instantiated. +'; Index: openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0-1.0.1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0-1.0.1.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0-1.0.1.sql 19 Aug 2008 20:15:58 -0000 1.1 +++ openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0-1.0.1.sql 30 Aug 2008 00:34:10 -0000 1.2 @@ -1 +1 @@ -alter table layout_includelets add uninitializer text; +alter table layout_includelets add uninitializer varchar(100); Index: openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0.1-1.0.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0.1-1.0.2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/layout-manager/sql/oracle/upgrade/upgrade-1.0.1-1.0.2.sql 30 Aug 2008 00:34:10 -0000 1.1 @@ -0,0 +1 @@ +alter table layout_includelets add singleton_p char(1) default 't' not null check (singleton_p in ('t', 'f')); Index: openacs-4/packages/layout-manager/sql/postgresql/includelets-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/includelets-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/layout-manager/sql/postgresql/includelets-create.sql 19 Aug 2008 20:15:58 -0000 1.5 +++ openacs-4/packages/layout-manager/sql/postgresql/includelets-create.sql 30 Aug 2008 00:34:10 -0000 1.6 @@ -28,6 +28,10 @@ not null, internally_managed_p boolean constraint l_includelets_i_m_p_nn + not null, + singleton_p boolean + default 't' + constraint l_includelets_s_p_nn not null ); @@ -83,3 +87,7 @@ portlet create layout elements via a dynamically generated form in a very non-.LRN manner, it''s probably generally useful. '; + +comment on column layout_includelets.singleton_p is ' + If true, only one instance of this includelet should be instantiated. +'; Index: openacs-4/packages/layout-manager/sql/postgresql/upgrade/upgrade-1.0.1-1.0.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/upgrade/upgrade-1.0.1-1.0.2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/layout-manager/sql/postgresql/upgrade/upgrade-1.0.1-1.0.2.sql 30 Aug 2008 00:34:10 -0000 1.1 @@ -0,0 +1 @@ +alter table layout_includelets add singleton_p boolean default 't' not null; 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.3 -r1.4 --- openacs-4/packages/layout-manager/tcl/element-procs.tcl 19 Aug 2008 22:12:43 -0000 1.3 +++ openacs-4/packages/layout-manager/tcl/element-procs.tcl 30 Aug 2008 00:34:10 -0000 1.4 @@ -46,7 +46,7 @@ set page_id [layout::page::get_id -pageset_id $pageset_id -page_name $page_name] - if {[string equal "" $page_column]} { + if { $page_column eq "" } { set page_column [layout::element::choose_page_column -page_id $page_id] } @@ -390,6 +390,35 @@ } +ad_proc layout::element::copy { + -element_id:required + {-page_name ""} + {-page_column ""} + {-state full} +} { + Make a copy of an existing element, including its parameters. + + @param element_id The existing element to copy from. + @param page_name The name of the page to place the copy on. + @param page_column The column in which to place the copy. + @return The element_id of the new copy of the element. +} { + set page_id [layout::element::get_column_value -element_id $element_id -column page_id] + + if { $page_column eq "" } { + set page_column [layout::element::choose_page_column -page_id $page_id] + } + + set new_element_id [db_nextval layout_seq] + + db_transaction { + db_dml copy_element {} + db_dml copy_element_parameters {} + } + + return $new_element_id +} + ad_proc layout::element::configure { -element_id:required -op:required Index: openacs-4/packages/layout-manager/tcl/element-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/layout-manager/tcl/element-procs.xql 22 Jul 2008 07:31:03 -0000 1.1 +++ openacs-4/packages/layout-manager/tcl/element-procs.xql 30 Aug 2008 00:34:10 -0000 1.2 @@ -26,6 +26,34 @@ + + + insert into layout_elements + (element_id, includelet_name, name, title, page_id, page_column, theme, + state, sort_key, required_privilege, package_id) + select :new_element_id, includelet_name, name, title, :page_id, :page_column, + theme, :state, + coalesce((select max(layout_elements.sort_key) + 1 + from layout_elements + where page_id = :page_id + and page_column = :page_column), 1), + required_privilege, + package_id + from layout_elements + where element_id = :element_id + + + + + + insert into layout_element_parameters + (element_id, key, value) + select :new_element_id, key, value + from layout_element_parameters + where element_id = :element_id + + + delete Index: openacs-4/packages/layout-manager/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/includelet-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/layout-manager/tcl/includelet-procs.tcl 19 Aug 2008 22:12:43 -0000 1.5 +++ openacs-4/packages/layout-manager/tcl/includelet-procs.tcl 30 Aug 2008 00:34:10 -0000 1.6 @@ -21,6 +21,7 @@ {-uninitializer ""} {-required_privilege read} {-internally_managed_p f} + {-singleton_p t} } { Create a new layout manager includelet. Index: openacs-4/packages/layout-manager/tcl/includelet-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/includelet-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/layout-manager/tcl/includelet-procs.xql 19 Aug 2008 20:15:58 -0000 1.4 +++ openacs-4/packages/layout-manager/tcl/includelet-procs.xql 30 Aug 2008 00:34:10 -0000 1.5 @@ -6,10 +6,10 @@ insert into layout_includelets (name, title, application, template, initializer, uninitializer, required_privilege, - description, dotlrn_compat_p, internally_managed_p) + description, dotlrn_compat_p, internally_managed_p, singleton_p) values (:name, :title, :application, :template, :initializer, :uninitializer, :required_privilege, - :description, :dotlrn_compat_p, :internally_managed_p) + :description, :dotlrn_compat_p, :internally_managed_p, :singleton_p)