Index: openacs-4/packages/layout-manager/TODO.txt
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/TODO.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/TODO.txt 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,11 @@
+1. Pages and elements should be objects after all, so we can have direct permissions
+ checks on them (restrict an entire page to admins, restrict portal elements to admin).
+
+ Right now check is "if you are priv 'x' on the portal then you can see a priv 'x' portlet".
+ If a portal element was an object, the portlet init code could set perms on the element
+ as it wishes (say, inheriting privs from the package it works with, not the parent
+ portal object).
+
+2. Improve add portlet to portal administration by expanding the portal datasource to
+ include an optional procedure that guides the admin page (a bit like applets in
+ dotlrn).
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/layout-manager.info 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,41 @@
+
+
+
+
+ Layout Manager
+ Layout Managers
+ f
+ f
+
+
+ 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/catalog/layout-manager.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/catalog/layout-manager.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/catalog/layout-manager.en_US.ISO-8859-1.xml 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+ Portal Plain
+ Portal Tabbed
+ Portal Nested Tabbed
+
+ One columns
+ Two columns
+ Three columns
+ Left sidebar
+ Right sidebar
+ Left and right sidebars
+
+
Index: openacs-4/packages/layout-manager/lib/add-datasources.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/add-datasources.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/add-datasources.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,5 @@
+
Add includelets and their associated datasources to this page set.
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/add-datasources.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/add-datasources.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/add-datasources.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,77 @@
+ad_page_contract {
+
+ Generate a list of datasources that have supporting portlets.
+
+ The user's returned to the current page after installing the select datasource(s).
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: add-datasources.tcl,v 1.1 2008/07/22 07:31:01 donb Exp $
+
+} { }
+
+set package_id [ad_conn package_id]
+if { ![info exists pageset_id] } {
+ set pageset_id [layout::pageset::get_master_template_id -package_id $package_id]
+}
+
+if { ![info exists return_url] } {
+ set return_url [ad_conn url]?[ad_conn query]
+}
+
+db_multirow -extend {add_url includelets instances} datasources get_datasources {} {
+ set add_url [export_vars -base [ad_conn package_url]add-datasources-2 \
+ { pageset_id datasource return_url }]
+ set includelets [join [db_list get_includelets {}] ", "]
+ db_1row get_instance_count {}
+}
+
+set wizard_p [template::wizard::exists]
+
+# If we're in the wizard and have no datasources or includelets just skip to the next step.
+
+if { $wizard_p && ${datasources:rowcount} == 0 && ${includelets:rowcount} == 0 } {
+ rp_form_put wizard_submit_next wizard_submit_next
+ template::wizard::forward
+}
+
+# Build the list-builder list.
+
+# First, build a list of datasources to add
+
+template::list::create \
+ -name datasources \
+ -multirow datasources \
+ -key datasource \
+ -elements {
+ description {
+ label Datasource
+ }
+ instances {
+ label Instances
+ }
+ includelets {
+ label Includelets
+ }
+ add {
+ label Add
+ link_url_col add_url
+ link_html { title "Add datasource" }
+ display_template {Add}
+ }
+ }
+
+# Now, if we're in the template wizard, generate the wizard form and buttons.
+
+if { $wizard_p } {
+
+ ad_form -name add-datasources -form {
+ foo:text(hidden),optional
+ } -on_submit {
+ template::wizard::forward
+ }
+
+ template::wizard::submit add-datasources -buttons {back next}
+}
+
+ad_return_template
Index: openacs-4/packages/layout-manager/lib/add-datasources.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/add-datasources.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/add-datasources.xql 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ select name as datasource, description
+ from layout_datasources
+ order by description
+
+
+
+
+
+ select title as includelet, name
+ from layout_includelets
+ where datasource = :datasource
+ order by name
+
+
+
+
+
+ select count(distinct le.package_id) as instances
+ from layout_elements le, layout_includelets li
+ where li.datasource = :datasource
+ and le.includelet_name = li.name
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/column-configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/column-configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/column-configure.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,43 @@
+
+
+
Index: openacs-4/packages/layout-manager/lib/column-configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/column-configure.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/column-configure.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,83 @@
+ad_page_contract {
+
+ Configure a portal page column
+
+ @author Don Baccus (dhogaza@pacifier.com)
+
+}
+
+set return_url [ad_conn url]?[ad_conn query]
+
+# queries need these as a bindvar ...
+set page_id $page(page_id)
+set pageset_id $page(pageset_id)
+
+# See if there's a page before this one
+if { $page(sort_key) > 0 } {
+ db_1row select_prev_page_id {}
+} else {
+ set prev_page_id ""
+}
+
+# See if there's a page after this one (sort_key starts at zero)
+if { $page(sort_key) + 1 < [layout::pageset::get_page_count -pageset_id $pageset_id] } {
+ db_1row select_next_page_id {}
+} else {
+ set next_page_id ""
+}
+
+# Grab all the element information and compute the various motion options
+
+set element_num 1
+db_1row select_element_count {}
+db_multirow -extend {edit_url hide_url up_url down_url left_url right_url} \
+ elements select_elements {} {
+
+ set edit_url [export_vars -base [ad_conn package_url]edit-element \
+ {pageset_id element_id return_url}]
+
+ set hide_url [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op hide} pageset_id element_id page_id return_url}]
+
+ # Set up the "move up" option if possible
+ if { $element_num > 1} {
+ set up_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_up} pageset_id element_id page_id return_url}]
+ } elseif { ![string equal $prev_page_id ""] } {
+ set up_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_to_page} pageset_id element_id {page_id $prev_page_id} return_url}]
+ }
+
+ # Set up the "move down" option if possible
+ if { $element_num < $element_count } {
+ set down_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_down} pageset_id element_id page_id return_url}]
+ } elseif { ![string equal $next_page_id ""] } {
+ set down_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_to_page} pageset_id element_id {page_id $next_page_id} return_url}]
+ }
+
+ # If there's more than one column, let the user move the portlet to the right or left
+ if { $column_count > 1 } {
+
+ # if there's space to the right, let them move the portlet right
+ if { $page_column < $column_count } {
+ set right_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_right} pageset_id page_id element_id page_column return_url}]
+ }
+
+ # If there's space to the left, let them move the portlet left
+ if { $page_column > 1 } {
+ set left_url \
+ [export_vars -base [ad_conn package_url]pageset-configure-2 \
+ {{op move_left} pageset_id page_id element_id page_column return_url}]
+ }
+ }
+
+ incr element_num
+}
Index: openacs-4/packages/layout-manager/lib/column-configure.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/column-configure.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/column-configure.xql 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ select page_id as prev_page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ and sort_key = (select sort_key - 1
+ from layout_pages
+ where page_id = :page_id)
+
+
+
+
+
+ select page_id as next_page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ and sort_key = (select sort_key + 1
+ from layout_pages
+ where page_id = :page_id)
+
+
+
+
+
+ select count(*) as element_count
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and state <> 'hidden'
+
+
+
+
+
+ select element_id, name, title, sort_key, state
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and state <> 'hidden'
+ order by sort_key
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/configure-configurability.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-configurability.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-configurability.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,3 @@
+The following parameters offer the administrator some control over the degree to which
+a user can configure their own personal portal.
+
Index: openacs-4/packages/layout-manager/lib/configure-configurability.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-configurability.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-configurability.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,39 @@
+ad_page_contract {
+ Let the admin configure whether or not to present shade and hide buttons on portlets.
+} {
+}
+
+if { ![parameter::get -boolean -parameter CreatePrivatePortals] } {
+ rp_form_put wizard_submit_next wizard_submit_next
+ template::wizard::forward
+}
+
+ad_form -name configure-configurability -form {
+ {ShowShadeButton:boolean(radio)
+ {label "Show \"Shade\" button on portlet title bars?"}
+ {options {{Yes 1} {No 0}}}
+ {help_text "\"No\" will supress the display of \"shade\" widgets in portlet title bars"}
+ }
+ {ShowHideButton:boolean(radio)
+ {label "Show \"Hide\" button on portlet title bars?"}
+ {options {{Yes 1} {No 0}}}
+ {help_text "\"No\" will supress the display of \"hide\" widgets in portlet title bars"}
+ }
+ {ThemeChangeable:boolean(radio)
+ {label "Allow users to change the portlet decoration theme?"}
+ {options {{Yes 1} {No 0}}}
+ {help_text "\"Yes\" will allow the user to change the theme used to display their portal"}
+ }
+} -on_request {
+ set ShowShadeButton [parameter::get -boolean -parameter ShowShadeButton]
+ set ShowHideButton [parameter::get -boolean -parameter ShowHideButton]
+ set ThemeChangeable [parameter::get -boolean -parameter ThemeChangeable]
+ ad_set_form_values ShowShadeButton ShowHideButton
+} -on_submit {
+ parameter::set_value -parameter ShowShadeButton -value $ShowShadeButton
+ parameter::set_value -parameter ShowHideButton -value $ShowHideButton
+ parameter::set_value -parameter ThemeChangeable -value $ThemeChangeable
+ template::wizard::forward
+}
+
+template::wizard::submit configure-configurability -buttons {back next}
Index: openacs-4/packages/layout-manager/lib/configure-finish.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-finish.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-finish.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/layout-manager/lib/configure-finish.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-finish.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-finish.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,11 @@
+# ad_form doesn't like an empty -form block so we've got to provide a dummy
+# field ...
+
+ad_form -name configure-finish -form {
+ foo:text(hidden),optional
+} -on_submit {
+ ad_returnredirect index
+ ad_script_abort
+}
+
+template::wizard::submit configure-finish -buttons {finish}
Index: openacs-4/packages/layout-manager/lib/configure-help.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-help.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-help.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,16 @@
+
+This wizard will take you through the steps necessary to configure the portal package. Before configuring you should:
+
+- Install the applications and portal datasource packages that you want to make available. The wizard will mount the applications you choose and make their portlets available.
+
- Decide whether or not individual users should have their own private portal
+pages, or whether you want to configure one portal configuration to be shared by
+all visitors. Creating individual private portal pages is more flexible but also consumes
+more system resources.
+
- Decide whether or not visitors should be able to "hide" or "shade" (shrink) portlets (only
+possible if you decide to give each user their own custom portal).
+
- Decide the navigation style you wish this portlet and subsite to use.
+
- Decide whether or not you want the parent subsite to display a portal page rather than
+its standard index page.
+
+
+
Index: openacs-4/packages/layout-manager/lib/configure-help.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-help.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-help.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,10 @@
+# ad_form doesn't like an empty -form block so we've got to provide a dummy
+# field ...
+
+ad_form -name configure-help -form {
+ foo:text(hidden),optional
+} -on_submit {
+ template::wizard::forward
+}
+
+template::wizard::submit configure-help -buttons {back next}
Index: openacs-4/packages/layout-manager/lib/configure-private-pagesets.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-private-pagesets.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-private-pagesets.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,8 @@
+Check "Yes" if you'd like the layout manager package to create each user their own custom
+page set configuration. This will allow users to to move includelets from column to column
+or page to page, to hide includelets, etc.
+
+Check "no" if you want users to share a single page set configuration. This is more
+efficient of system resources but only administrators will be able to reconfigure
+the layout.
+
Index: openacs-4/packages/layout-manager/lib/configure-private-pagesets.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-private-pagesets.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-private-pagesets.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,19 @@
+ad_page_contract {
+ Let the admin configure whether or not we should create a portal for every visitor.
+} {
+}
+
+ad_form -name configure-private-pagesets -form {
+ {CreatePrivatePageSets:boolean(radio)
+ {label "Create a page set for every user?"}
+ {options {{Yes 1} {No 0}}}
+ }
+} -on_request {
+ set CreatePrivatePageSets [parameter::get -boolean -parameter CreatePrivatePageSets]
+ ad_set_form_values CreatePrivatePageSets
+} -on_submit {
+ parameter::set_value -parameter CreatePrivatePageSets -value $CreatePrivatePageSets
+ template::wizard::forward
+}
+
+template::wizard::submit configure-private-pagesets -buttons {back next}
Index: openacs-4/packages/layout-manager/lib/configure-subsite-integration.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-subsite-integration.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-subsite-integration.adp 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/layout-manager/lib/configure-subsite-integration.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/configure-subsite-integration.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/configure-subsite-integration.tcl 22 Jul 2008 07:31:01 -0000 1.1
@@ -0,0 +1,62 @@
+ad_page_contract {
+ Configure the portal package's interaction with the subsite package in the 'ole
+ look and feel department.
+} {
+}
+
+ad_form -name configure-subsite-integration -form {
+ {template_style:integer(radio)
+ {options {{"Tabbed navigation integrated with existing subsite theme" 0}
+ {"Use existing subsite theme (works best if there's only one portal page)" 1}}}
+ {values {0}}
+ {label "Choose navigation style?"}
+ }
+ {portal_index_page_p:boolean(radio)
+ {options {{Yes 1} {No 0}}}
+ {values {1}}
+ {label "Should the parent subsite serve the portal package as its index page?"}
+ }
+ {show_single_button_navbar_p:boolean(radio)
+ {options {{Yes 1} {No 0}}}
+ {values {0}}
+ {label "Should we show the navigation tabs when there's only one of them?"}
+ }
+} -on_submit {
+
+ switch $template_style {
+
+ 0 {parameter::set_value \
+ -parameter OldDefaultMaster \
+ -package_id [ad_conn package_id] \
+ -value [parameter::get -package_id [ad_conn subsite_id] \
+ -parameter DefaultMasterTemplate]
+ parameter::set_value \
+ -parameter DefaultMaster \
+ -package_id [ad_conn subsite_id] \
+ -value /packages/layout-manager/lib/tabbed-master
+ }
+
+ 2 {parameter::set_value \
+ -parameter OurMasterTemplate \
+ -package_id [ad_conn package_id] \
+ ""
+ }
+
+ }
+
+ if { $portal_index_page_p } {
+ parameter::set_value \
+ -parameter IndexRedirectUrl \
+ -package_id [ad_conn subsite_id] \
+ -value [ad_conn package_url]
+ }
+
+ parameter::set_value \
+ -parameter ShowSingleButtonNavbar \
+ -package_id [ad_conn package_id] \
+ -value $show_single_button_navbar_p
+
+ template::wizard::forward
+}
+
+template::wizard::submit configure-subsite-integration -buttons {back next}
Index: openacs-4/packages/layout-manager/lib/layout-manager-admin-includelet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/layout-manager-admin-includelet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/layout-manager-admin-includelet.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/layout-manager/lib/layout-manager-admin.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/layout-manager-admin.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/layout-manager-admin.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,10 @@
+
Index: openacs-4/packages/layout-manager/lib/layout-manager-admin.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/layout-manager-admin.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/layout-manager-admin.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,30 @@
+ad_page_contract {
+
+ Main administration page for the layout manager package. Return to the script which
+ has included us.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: layout-manager-admin.tcl,v 1.1 2008/07/22 07:31:02 donb Exp $
+} {
+}
+
+set package_id [ad_conn package_id]
+set base_url [ad_conn package_url]
+set return_url [ad_conn url]?[ad_conn query]
+
+set package_edit_p [expr { ![info exists pageset_id] }]
+if { $package_edit_p } {
+ set pageset_id [layout::pageset::get_master_template_id -package_id $package_id]
+}
+
+set edit_pageset_template_url \
+ [export_vars -base ${base_url}pageset-configure {return_url pageset_id}]
+set configure_url [export_vars -base ${base_url}admin/configure {return_url pageset_id}]
+set add_datasources_url [export_vars -base ${base_url}add-datasources {return_url pageset_id}]
+set user_pagesets_p [expr { [parameter::get -parameter CreatePrivatePageSets] && $package_edit_p }]
+if { $user_pagesets_p } {
+ set user_pagesets_url [export_vars -base ${base_url}admin/user-portals {pageset_id return_url}]
+}
+db_1row count_datasources {}
+
Index: openacs-4/packages/layout-manager/lib/layout-manager-admin.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/layout-manager-admin.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/layout-manager-admin.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ select count(*) as datasource_count
+ from layout_datasources
+
+
+
+
+
+ad_return_template
Index: openacs-4/packages/layout-manager/lib/nested-tabbed-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/nested-tabbed-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/nested-tabbed-master.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,122 @@
+
+
+ @title;noquote@
+
+
+ @signatory;noquote@
+
+
+ @focus;noquote@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @portal_pages.name@
+
+
+
+
+
+
+
+
+ @application@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/nested-tabbed-master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/nested-tabbed-master.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/nested-tabbed-master.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,83 @@
+# Expects properties:
+# title
+# focus
+# header_stuff
+# section
+# subnavbar_link
+
+if { ![info exists section] } {
+ set section {}
+}
+
+if { ![info exists header_stuff] } {
+ set header_stuff {}
+}
+
+if { ![info exists subnavbar_link] } {
+ set subnavbar_link {}
+}
+
+if { ![info exists title] } {
+ set title ""
+}
+
+set subsite_node_id [site_node::get_node_id_from_object_id -object_id [ad_conn subsite_id]]
+set portal_url [lindex [site_node::get_children -node_id $subsite_node_id -package_key portal] 0]
+
+set package_id [site_node::get_object_id -node_id [site_node::get_node_id -url $portal_url]]
+set package_node_id [site_node::get_node_id_from_object_id -object_id $package_id]
+set portal_page_p 0
+
+set user_portal_id [portal::get_user_portal_id -package_id $package_id]
+set which_navbar [parameter::get -package_id $package_id -parameter NavbarClass]
+set portal_url [site_node::get_url_from_object_id -object_id $package_id]
+array set theme [portal::theme::get -theme_id [portal::get_theme_id -portal_id $user_portal_id]]
+set theme_template $theme(template)
+set master_template [parameter::get -package_id $package_id -parameter SiteMasterTemplate]
+
+db_multirow -unclobber -extend {url} portal_pages select_user_portal_pages {} {
+ set url [export_vars -base $portal_url {portal_id page_num}]
+ if { [string equal $url $portal_url] } {
+ set portal_page_p 1
+ }
+}
+
+if { [permission::permission_p \
+ -object_id [portal::get_admin_portal_id -package_id $package_id] \
+ -privilege admin] } {
+ db_multirow -unclobber -append -extend {url} portal_pages select_admin_portal_pages {} {
+ set url [export_vars -base $portal_url {portal_id page_num}]
+ if { [string equal $url $portal_url] } {
+ set portal_page_p 1
+ }
+ }
+}
+
+array set site_node [site_node::get_from_url \
+ -url [ad_conn package_url] \
+ -exact]
+
+if { $site_node(parent_id) == $package_node_id } {
+ set application $site_node(instance_name)
+} elseif {$site_node(object_id) == $package_id } {
+ set portal_page_p 1
+}
+
+
+# This will set 'sections' and 'subsections' multirows
+subsite::define_pageflow -section $section
+subsite::get_section_info -array section_info
+
+# Find the subsite we belong to
+set subsite_url [site_node_closest_ancestor_package_url]
+array set subsite_sitenode [site_node::get -url $subsite_url]
+set subsite_node_id $subsite_sitenode(node_id)
+set subsite_name $subsite_sitenode(instance_name)
+
+# Where to find the stylesheet
+set css_url "/resources/acs-subsite/group-master.css"
+
+if { [string equal [ad_conn url] $subsite_url] } {
+ set subsite_url {}
+}
+
Index: openacs-4/packages/layout-manager/lib/nested-tabbed-master.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/nested-tabbed-master.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/nested-tabbed-master.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ select name, sort_key as page_num, portal_id
+ from portal_pages
+ where portal_id = :user_portal_id
+ order by sort_key
+
+
+
+
+
+
+ select name, 0 as page_num, portal_id
+ from portals
+ where owner_id = :package_id
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/page-configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-configure.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+ No Elements on this page
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/page-configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-configure.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-configure.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,31 @@
+ad_page_contract {
+
+ Configure one page within a page set.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+
+}
+
+set return_url [ad_conn url]?[ad_conn query]
+set package_url [ad_conn package_url]
+
+array set page [layout::page::get -page_id $page_id]
+array set page_template [layout::page_template::get -name $page(page_template)]
+
+# Get the layouts for the change layout widget
+db_multirow page_templates select_page_templates {}
+db_multirow page_themes select_page_themes {}
+
+# Build the column list since the template engine has no way to generate an
+# iterator
+
+set column_list [list]
+for { set i 1 } { $i <= $page_template(columns) } { incr i } {
+ lappend column_list $i
+}
+
+# Compute the column widths for the region table
+
+set column_width [expr {100/$page_template(columns)}]%
+
+set has_visible_elements_p [layout::page::has_visible_elements -page_id $page_id]
Index: openacs-4/packages/layout-manager/lib/page-configure.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-configure.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-configure.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ select name, description
+ from layout_page_templates
+ order by description
+
+
+
+
+
+ select name, description
+ from layout_themes
+ order by description
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/pageset-configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/pageset-configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/pageset-configure.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/pageset-configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/pageset-configure.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/pageset-configure.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,42 @@
+ad_page_contract {
+
+ Configure a page set
+
+ @author Don Baccus (dhogaza@pacifier.com)
+
+} {
+}
+
+set return_url [ad_conn url]?[ad_conn query]
+set package_url [ad_conn package_url]
+
+# If we're called from the configuration wizard, pageset_id is not defined but we
+# know we're configuting the master template.
+
+if { ![info exists pageset_id] } {
+ set pageset_id [layout::pageset::get_master_template_id]
+}
+
+set current_theme [layout::pageset::get_column_value -pageset_id $pageset_id -column theme]
+set first_page_id [lindex [layout::pageset::get_page_list -pageset_id $pageset_id] 0]
+db_multirow themes select_themes {}
+db_multirow hidden_elements select_hidden_elements {}
+db_multirow page_ids select_page_ids {}
+set page_count [layout::pageset::get_page_count -pageset_id $pageset_id]
+set new_page_num [expr {$page_count + 1}]
+
+# Now, if we're in the template wizard, generate the wizard form and buttons.
+
+set wizard_p [template::wizard::exists]
+if { $wizard_p } {
+
+ ad_form -name add-applications -form {
+ foo:text(hidden),optional
+ } -on_submit {
+ template::wizard::forward
+ }
+
+ template::wizard::submit add-applications -buttons {back next}
+}
+
+ad_return_template
Index: openacs-4/packages/layout-manager/lib/pageset-configure.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/pageset-configure.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/pageset-configure.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ select name, description
+ from layout_themes
+ order by name
+
+
+
+
+
+ select le.element_id, le.title
+ from layout_elements le, layout_pages lp
+ where lp.pageset_id = :pageset_id
+ and lp.page_id = le.page_id
+ and le.state = 'hidden'
+ order by le.name
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ order by sort_key
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/plain-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/plain-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/plain-master.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,52 @@
+
+
+ @signatory;noquote@
+
+
+ @focus;noquote@
+
+
+ @header_stuff;noquote@
+
+
+
+
+
+
+
+
+
+
+ @portal_pages.name@
+
+
+
+
+
+
+
+
+ @application@
+
+
+
+
+
+
+
+
+
+
+
+
+ @title@
+
+
+
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/plain-master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/plain-master.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/plain-master.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,47 @@
+if { ![info exists header_stuff] } {
+ set header_stuff {}
+}
+
+# Where to find the stylesheet
+set css_url "/resources/acs-subsite/group-master.css"
+
+# See if we're visiting a portal instance or an application mounted under a
+# portal instance. If so, build the portal navbar.
+
+set package_id [site_node::closest_ancestor_package \
+ -node_id [ad_conn node_id] \
+ -package_key portal \
+ -include_self]
+
+set show_single_button_navbar_p [parameter::get \
+ -package_id $package_id \
+ -parameter ShowSingleButtonNavbar]
+
+if { ![string equal $package_id ""] } {
+
+ set user_portal_id [portal::get_user_portal_id -package_id $package_id]
+ set which_navbar [parameter::get -package_id $package_id -parameter NavbarClass]
+ set portal_url [site_node::get_url_from_object_id -object_id $package_id]
+
+ db_multirow -unclobber -extend {url} portal_pages select_user_portal_pages {} {
+ set url [export_vars -base $portal_url {portal_id page_num}]
+ }
+
+ if { [permission::permission_p \
+ -object_id [portal::get_admin_portal_id -package_id $package_id] \
+ -privilege admin] } {
+ db_multirow -unclobber -append -extend {url} portal_pages select_admin_portal_pages {} {
+ set url [export_vars -base $portal_url {portal_id page_num}]
+ }
+ }
+
+ array set site_node [site_node::get_from_url \
+ -url [ad_conn package_url] \
+ -exact]
+
+ if { $site_node(object_id) != $package_id } {
+ set application $site_node(instance_name)
+ }
+
+}
+
Index: openacs-4/packages/layout-manager/lib/plain-master.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/plain-master.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/plain-master.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ select name, sort_key as page_num, portal_id
+ from portal_pages
+ where portal_id = :user_portal_id
+ order by sort_key
+
+
+
+
+
+
+ select name, 0 as page_num, portal_id
+ from portals
+ where owner_id = :package_id
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/tabbed-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/tabbed-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/tabbed-master.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,10 @@
+
+navigation
+@main_content_p@
+
+
+
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/tabbed-master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/tabbed-master.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/tabbed-master.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,68 @@
+ad_page_contract {
+
+ Build two-level tabbed navigation multirows for a pageset.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+
+ $Id: tabbed-master.tcl,v 1.1 2008/07/22 07:31:02 donb Exp $
+}
+
+set user_id [ad_conn user_id]
+
+set subsite_node_id [site_node::get_node_id_from_object_id -object_id [ad_conn subsite_id]]
+set layout_manager_url \
+ [lindex [site_node::get_children -node_id $subsite_node_id -package_key layout-manager] 0]
+
+set package_id [site_node::get_object_id -node_id [site_node::get_node_id -url $layout_manager_url]]
+set package_node_id [site_node::get_node_id_from_object_id -object_id $package_id]
+
+set pageset_id [layout::pageset::get_user_pageset_id -package_id $package_id]
+
+# set a default title in case an included application page doesn't set it. Should move
+# to the doc() array approach in the future.
+set title ""
+
+# Create the multirow so other code that add to this can do so with multirow append
+template::multirow create navigation group label href target \
+ title lang accesskey class id tabindex
+
+# Grab the pages for the user portal
+db_multirow -cache_key pageset_${pageset_id}_multirow_${user_id} -append \
+ -unclobber -extend {group href target title lang accesskey class id} \
+ navigation select_pageset_pages {} {
+ set group main
+ set href [export_vars -base $layout_manager_url {{pageset_id $pageset_id} \
+ {page_num $tabindex}}]
+}
+
+subsite_navigation::define_pageflow -group main -subgroup sub -initial_pageflow "" \
+ -navigation_multirow navigation -show_applications_p 0
+
+if { [site_node::get_element -url [ad_conn package_url] -element parent_id] == \
+ $package_node_id } {
+ set instance_name [site_node::get_element -url [ad_conn package_url] \
+ -element instance_name]
+ template::multirow append navigation main $instance_name [ad_conn package_url] \
+ "" $instance_name "" [template::multirow size navigation] "" \
+ main-navigation-active [template::multirow size navigation]
+}
+
+set pageset_page_p 0
+if { [info exists page_num] } {
+ for { set i 1 } { $i <= [template::multirow size navigation] } { incr i } {
+ if { [template::multirow get navigation $i tabindex] == $page_num } {
+ template::multirow set navigation $i id "main-navigation-active"
+ set pageset_page_p 1
+ break
+ }
+ }
+}
+
+if { !$pageset_page_p } {
+ array set theme \
+ [layout::theme::get \
+ -name [layout::pageset::get_column_value -pageset_id $pageset_id -column theme]]
+}
+
+# No expr tag in the templating system ...
+set main_content_p [expr { !$pageset_page_p }]
Index: openacs-4/packages/layout-manager/lib/tabbed-master.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/tabbed-master.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/tabbed-master.xql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ select lp.name as label, lp.sort_key as tabindex
+ from layout_pages lp
+ where lp.pageset_id = :pageset_id
+ and exists (select 1
+ from layout_elements le
+ where le.page_id = lp.page_id
+ and exists (select 1
+ from acs_object_party_privilege_map
+ where object_id = le.package_id
+ and party_id = :user_id
+ and privilege = le.required_privilege))
+ order by lp.sort_key
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/undecorated-element.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/Attic/undecorated-element.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/undecorated-element.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,7 @@
+
Index: openacs-4/packages/layout-manager/lib/page-templates/simple.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-templates/simple.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-templates/simple.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,31 @@
+ad_page_contract {
+
+ This template handles predefined page templates via name magic. Probably too
+ clever to be a useful model for how to write your own custom page template, particularly
+ if you want it to be aware of different media types, etc.
+
+ @version $Id: simple.tcl,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+} -properties {
+ element_list:onevalue
+}
+
+set column_count [layout::page_template::get_column_value -name $page(page_template) -column columns]
+
+# The page(element_list) array only contains data for elements actually placed on
+# the page. We initialize the array elements of the regions array to the empty list
+# to simplify the various templates.
+
+for { set i 1 } { $i <= $column_count } { incr i } {
+ set columns($i) [list]
+}
+
+foreach {column element_id_list} $page(element_list) {
+ set columns($column) $element_id_list
+}
+
+set name [layout::page_template::get_column_value -name $page(page_template) -column name]
+
+template::head::add_css -href /resources/layout-manager/page-templates/${name}.css -media all
+
+ad_return_template /packages/layout-manager/lib/page-templates/simple${column_count}
Index: openacs-4/packages/layout-manager/lib/page-templates/simple1.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-templates/simple1.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-templates/simple1.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,14 @@
+
Index: openacs-4/packages/layout-manager/lib/page-templates/simple2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-templates/simple2.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-templates/simple2.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,25 @@
+
Index: openacs-4/packages/layout-manager/lib/page-templates/simple3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/page-templates/simple3.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/page-templates/simple3.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,34 @@
+
+
+
Index: openacs-4/packages/layout-manager/lib/render/render-element.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-element.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-element.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,10 @@
+
+ @element.title;noquote@
+ @element.element_id;noquote@
+
+
+
+
+
+
+
Index: openacs-4/packages/layout-manager/lib/render/render-element.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-element.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-element.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,15 @@
+ad_page_contract {
+
+ Render a layout element.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs_id $Id: render-element.tcl,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+}
+
+array set element [layout::element::get_render_data \
+ -element_id $element_id \
+ -edit_p $edit_p]
+
+set config $element(config)
Index: openacs-4/packages/layout-manager/lib/render/render-page.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-page.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-page.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,3 @@
+
+
+
Index: openacs-4/packages/layout-manager/lib/render/render-page.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-page.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-page.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,17 @@
+ad_page_contract {
+
+ Render a layout page.
+
+ This is intended to be included, not called directly, with the following parameters
+ defined:
+
+ @param pageset The array describing the current portal (passed by reference)
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2004/01/24
+ @cvs_id $Id: render-page.tcl,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+}
+
+array set page [layout::page::get_render_data -page_id $pageset(page_id)]
+set elements_exist_p [expr {[llength $page(element_list)] > 0}]
Index: openacs-4/packages/layout-manager/lib/render/render-pageset.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-pageset.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-pageset.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/layout-manager/lib/render/render-pageset.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/render/render-pageset.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/render/render-pageset.tcl 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,5 @@
+array set pageset [layout::pageset::get_render_data \
+ -pageset_id $pageset_id \
+ -page_num $page_num]
+
+ad_return_template
Index: openacs-4/packages/layout-manager/lib/themes/blank.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/themes/blank.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/themes/blank.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,2 @@
+@title;noquote@
+
Index: openacs-4/packages/layout-manager/lib/themes/raw-theme.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/themes/raw-theme.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/themes/raw-theme.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1 @@
\ No newline at end of file
Index: openacs-4/packages/layout-manager/lib/themes/standard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/lib/themes/standard.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/lib/themes/standard.adp 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,15 @@
+
+
Index: openacs-4/packages/layout-manager/sql/oracle/copy-pagesets-temp.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/copy-pagesets-temp.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/copy-pagesets-temp.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,53 @@
+ if p_template_id is not null then
+ -- now insert the pages from the layout template
+ for v_page in select *
+ from layout_pages
+ where pageset_id = p_template_id
+ loop
+
+ v_page_id := layout_page__new(
+ v_page.name,
+ v_pageset_id,
+ v_page.layout_template,
+ v_pageset_id);
+
+ -- now get the elements on the templates page and put them on the new page
+ for v_element in select *
+ from layout_elements
+ where page_id = v_page.page_id
+ loop
+
+ select nextval(''layout_seq'')
+ into v_new_element_id
+ from dual;
+
+ insert into layout_elements
+ (element_id, name, title, page_id, includelet_id, page_column, sort_key, state)
+ select v_new_element_id, name, title, v_page_id, includelet_id, page_column, sort_key,
+ state
+ from layout_elements
+ where element_id = v_element.element_id;
+
+ -- now for the elements params
+ for v_param in select *
+ from layout_element_parameters
+ where element_id = v_element.element_id
+ loop
+
+ select nextval(''layout_seq'')
+ into v_new_parameter_id
+ from dual;
+
+ insert into layout_element_parameters
+ (parameter_id, element_id, key, value)
+ select v_new_parameter_id, v_new_element_id, key, value
+ from layout_element_parameters
+ where parameter_id = v_param.parameter_id;
+
+ end loop;
+
+ end loop;
+
+ end loop;
+
+ end if;
Index: openacs-4/packages/layout-manager/sql/oracle/elements-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/elements-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/elements-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,87 @@
+-- create layout manager elements datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2001-10-01
+-- @version $Id: elements-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_elements (
+ element_id integer
+ constraint layout_elements_pk
+ primary key,
+ includelet_name varchar(100)
+ constraint l_elements_includelet_name_fk
+ references layout_includelets (name)
+ on delete cascade
+ constraint l_elements_includelet_name_nn
+ not null,
+ name varchar(100)
+ constraint l_elements_name_nn
+ not null,
+ title varchar(100) default null,
+ page_id integer
+ constraint l_elements_page_id_fk
+ references layout_pages
+ on delete cascade
+ constraint l_elements_page_id_nn
+ not null,
+ page_column integer
+ constraint l_elements_column_nn
+ not null,
+ theme varchar(100)
+ constraint l_elements_theme_fk
+ references layout_themes (name),
+ sort_key integer
+ constraint l_elements_sort_key_nn
+ not null,
+ state varchar(20)
+ default 'full'
+ constraint l_elements_state_ck
+ check (state in ('full', 'shaded', 'hidden', 'pinned')),
+ required_privilege varchar(20) default 'read'
+);
+
+comment on table layout_elements is '
+ The user-visible "box" on a layout page that displays the content of a includelet
+';
+
+comment on column layout_elements.includelet_name is '
+ The name of the includelet to which this element is bound.
+';
+
+comment on column layout_elements.page_column is '
+ The column to which this element has been assigned ("column" is a keyword in SQL)
+';
+
+comment on column layout_elements.sort_key is '
+ An ordering of elements contained in the same column on a page starting from
+ 0 for the first element and increasing in a gapless integer sequence
+';
+
+comment on column layout_elements.theme is '
+ Optional theme for this element.
+';
+
+comment on column layout_elements.state is '
+ one of the set "full" (normal), "shaded" (title bar only), or "hidden" (not shown).
+';
+
+create table layout_element_parameters (
+ element_id integer
+ constraint l_element_params_element_id_fk
+ references layout_elements (element_id)
+ on delete cascade
+ constraint l_element_params_element_id_nn
+ not null,
+ key varchar(100)
+ constraint l_element_params_key_nn
+ not null,
+ value varchar(1000)
+);
+
+create index l_element_params_key_idx on layout_element_parameters (element_id, key);
+
+comment on table layout_element_parameters is '
+ Parameters for a given element. The data structure is that of a multiset (aka bag)
+ where multiple entries with the same key are allowed.
+';
Index: openacs-4/packages/layout-manager/sql/oracle/elements-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/elements-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/elements-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,9 @@
+-- drop layout elements model
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: elements-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_element_parameters;
+drop table layout_elements;
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/includelets-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,86 @@
+-- create layout includelet
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-06
+-- @version $Id: includelets-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_includelets (
+ name varchar(100)
+ constraint l_includelets_name_pk
+ primary key,
+ title varchar(100) default null,
+ application varchar(100)
+ constraint l_includelets_application_fk
+ references apm_package_types (package_key)
+ on delete cascade
+ constraint l_includelets_app_nn
+ not null,
+ owner varchar(100)
+ constraint l_includelets_owner_fk
+ references apm_package_types (package_key)
+ on delete cascade
+ constraint l_includelets_owner_nn
+ not null,
+ template varchar(100)
+ constraint l_includelets_template_nn
+ not null,
+ dotlrn_compat_p char(1) not null
+ constraint layout_includelets_d_c_p_ck
+ check (dotlrn_compat_p in ('t', 'f')),
+ constructor varchar(100),
+ destructor varchar(100),
+ description varchar(1000),
+ required_privilege varchar(20) default 'read'
+);
+
+-- indexes for referential integrity checking
+
+create index l_includelets_application_idx on layout_includelets(application);
+create index l_includelets_owner_idx on layout_includelets(owner);
+
+comment on table layout_includelets is '
+ A layout includelet is the package of code that generates the content of a layout
+ element. By convention, a package named foo-layout-includelets creates includelets
+ for the package foo.
+';
+
+comment on column layout_includelets.name is '
+ The name of this layout includelet. We can''t arbitrarily use layout_includelet_key
+ because many lincludelet packages will support at least two includelets, one user
+ includelet and one admin includelet. Includelet names, like package keys, must be
+ unique throughout a single OpenACS instance.
+';
+
+comment on column layout_includelets.title is '
+ The external name or message resource of this layout includelet. We can''t arbitrarily
+ use portlet_key because many portlet packages will support at least two portlets, one
+ user portlet and one admin portlet.
+';
+
+comment on column layout_includelets.application is '
+ The package key of the application that this includelet works with. For instance the
+ forums layout includelet works with the forums package.
+';
+
+comment on column layout_includelets.owner is '
+ The package key of the package that implements this includelet.
+';
+
+comment on column layout_includelets.template is '
+ The name of template that displays the layout includelet content. Note this is not a full
+ path, layout templates go in the standard package template library directory.
+';
+
+comment on column layout_includelets.dotlrn_compat_p is '
+ If true, pass the includelet params in an array named "cf", rather than pass them
+ directly.
+';
+
+comment on column layout_includelets.constructor is '
+ The name of an optional constructor to run after the default constructor.
+';
+
+comment on column layout_includelets.destructor is '
+ The name of an optional constructor to run after the default destructor.
+';
Index: openacs-4/packages/layout-manager/sql/oracle/includelets-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/includelets-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/includelets-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,8 @@
+-- drop layout includelet package
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: includelets-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_includelets;
Index: openacs-4/packages/layout-manager/sql/oracle/layout-manager-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/layout-manager-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/layout-manager-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,16 @@
+-- create the layout manager datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-11
+-- @version $Id: layout-manager-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create sequence layout_seq;
+
+@@includelets-create
+@@page-templates-create
+@@themes-create
+@@pagesets-create
+@@pages-create
+@@pageset-package-create
+@@elements-create
Index: openacs-4/packages/layout-manager/sql/oracle/layout-manager-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/layout-manager-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/layout-manager-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,13 @@
+-- drop the layout manager datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+
+drop package layout_pageset;
+@@elements-drop
+@@pages-drop
+@@pagesets-drop
+@@themes-drop
+@@page-templates-drop
+@@includelets-drop
+
+drop sequence layout_seq;
Index: openacs-4/packages/layout-manager/sql/oracle/page-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/page-package-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/page-package-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,151 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+
+--
+-- create portal pages package
+--
+-- @author arjun@openforce.net
+-- @author yon@openforce.net
+-- @creation-date 2001-10-01
+-- @version $Id: page-package-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create or replace package portal_page
+as
+
+ function new (
+ p_page_id in portal_pages.page_id%TYPE default null,
+ p_name in portal_pages.name%TYPE default 'Untitled Page',
+ p_portal_id in portal_pages.portal_id%TYPE,
+ p_layout_id in portal_pages.layout_id%TYPE default null,
+ p_object_type in acs_objects.object_type%TYPE default 'portal_page',
+ p_creation_date in acs_objects.creation_date%TYPE default sysdate,
+ p_creation_user in acs_objects.creation_user%TYPE default null,
+ p_creation_ip in acs_objects.creation_ip%TYPE default null,
+ p_context_id in acs_objects.context_id%TYPE default null
+ ) return portal_pages.page_id%TYPE;
+
+ procedure del (
+ p_page_id in portal_pages.page_id%TYPE
+ );
+
+end portal_page;
+/
+show errors
+
+create or replace package body portal_page
+as
+
+ function new (
+ p_page_id in portal_pages.page_id%TYPE default null,
+ p_name in portal_pages.name%TYPE default 'Untitled Page',
+ p_portal_id in portal_pages.portal_id%TYPE,
+ p_layout_id in portal_pages.layout_id%TYPE default null,
+ p_object_type in acs_objects.object_type%TYPE default 'portal_page',
+ p_creation_date in acs_objects.creation_date%TYPE default sysdate,
+ p_creation_user in acs_objects.creation_user%TYPE default null,
+ p_creation_ip in acs_objects.creation_ip%TYPE default null,
+ p_context_id in acs_objects.context_id%TYPE default null
+ ) return portal_pages.page_id%TYPE
+ is
+ v_page_id portal_pages.page_id%TYPE;
+ v_layout_id portal_pages.layout_id%TYPE;
+ v_sort_key portal_pages.sort_key%TYPE;
+ begin
+
+ v_page_id := acs_object.new(
+ object_id => p_page_id,
+ object_type => p_object_type,
+ creation_date => p_creation_date,
+ creation_user => p_creation_user,
+ creation_ip => p_creation_ip,
+ context_id => nvl(p_context_id, p_portal_id)
+ );
+
+ if p_layout_id is null then
+ select min(layout_id)
+ into v_layout_id
+ from portal_layouts;
+ else
+ v_layout_id := p_layout_id;
+ end if;
+
+ select nvl(max(sort_key) + 1, 0)
+ into v_sort_key
+ from portal_pages
+ where portal_id = p_portal_id;
+
+ insert into portal_pages
+ (page_id, name, portal_id, layout_id, sort_key)
+ values
+ (v_page_id, p_name, p_portal_id, v_layout_id, v_sort_key);
+
+ return v_page_id;
+
+ end new;
+
+ procedure del (
+ p_page_id in portal_pages.page_id%TYPE
+ )
+ is
+ v_portal_id portal_pages.portal_id%TYPE;
+ v_sort_key portal_pages.sort_key%TYPE;
+ v_curr_sort_key portal_pages.sort_key%TYPE;
+ v_page_count_from_0 integer;
+ begin
+
+ -- IMPORTANT: sort keys MUST be an unbroken sequence from 0 to max(sort_key)
+
+ select portal_id, sort_key
+ into v_portal_id, v_sort_key
+ from portal_pages
+ where page_id = p_page_id;
+
+ select (count(*) - 1)
+ into v_page_count_from_0
+ from portal_pages
+ where portal_id = v_portal_id;
+
+ for i in 0 .. v_page_count_from_0 loop
+
+ if i = v_sort_key then
+
+ delete
+ from portal_pages
+ where page_id = p_page_id;
+
+ elsif i > v_sort_key then
+
+ update portal_pages
+ set sort_key = -1
+ where sort_key = i;
+
+ update portal_pages
+ set sort_key = i - 1
+ where sort_key = -1;
+
+ end if;
+
+ end loop;
+
+ acs_object.del(p_page_id);
+
+ end del;
+
+end portal_page;
+/
+show errors
+
Index: openacs-4/packages/layout-manager/sql/oracle/page-package-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/page-package-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/page-package-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,26 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+
+--
+-- drop portal pages package
+--
+-- @author arjun@openforce.net
+-- @author yon@openforce.net
+-- @creation-date 2001-10-01
+-- @version $Id: page-package-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop package portal_page;
Index: openacs-4/packages/layout-manager/sql/oracle/page-templates-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/page-templates-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/page-templates-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,32 @@
+-- create layout page templates datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: page-templates-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_page_templates (
+ name varchar(100)
+ constraint l_page_templates_name_un
+ unique
+ constraint l_page_templates_name_nn
+ not null,
+ columns integer
+ constraint l_page_templates_column_nn
+ not null
+ constraint l_page_templates_column_ck
+ check (columns > 0),
+ description varchar(250),
+ template varchar(100)
+);
+
+
+comment on table layout_page_templates is '
+ a layout page template is a template used to render a page built of zero or more
+ elements. Examples of page page templates are the three column simple, or two column
+ "Thin Thick" templates.
+';
+
+comment on column layout_page_templates.template is '
+ The path relative to layout/lib to the page template.
+';
Index: openacs-4/packages/layout-manager/sql/oracle/page-templates-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/page-templates-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/page-templates-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,9 @@
+-- drop layout manager page templates datamodel
+--
+-- @author arjun@openforce.net
+-- @author yon@openforce.net
+-- @creation-date 2001-10-01
+-- @version $Id: page-templates-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_page_templates;
Index: openacs-4/packages/layout-manager/sql/oracle/pages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/pages-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/pages-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,55 @@
+-- create layout pages datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: pages-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_pages (
+ page_id integer
+ constraint layout_pages_pk
+ primary key,
+ name varchar(100)
+ default 'Untitled Page'
+ constraint l_pages_name_nn
+ not null,
+ pageset_id integer
+ constraint l_pages_pageset_id_fk
+ references layout_pagesets (pageset_id)
+ on delete cascade
+ constraint l_pages_pageset_id_nn
+ not null,
+ page_template varchar(100)
+ constraint l_page_template_fk
+ references layout_page_templates (name)
+ constraint l_page_template_nn
+ not null,
+ theme varchar(100)
+ constraint l_page_theme_fk
+ references layout_themes (name),
+ sort_key integer
+ constraint l_pages_sort_key_nn
+ not null,
+ constraint l_pages_pageset_id_sort_key_un
+ unique (pageset_id, sort_key)
+);
+
+create index layout_pages_page_idx on layout_pages (pageset_id, page_id);
+
+comment on table layout_pages is '
+ layout pages are containers for portal elements. They can be thought of
+ as the "tabs" of a page set.
+';
+
+comment on column layout_pages.page_template is '
+ The name of the template to be used when rendering this page.
+';
+
+comment on column layout_pages.theme is '
+ The default theme to use for elements on this page, if not null.
+';
+
+comment on column layout_pages.sort_key is '
+ An ordering of the pages contained in the same page set starting from
+ 0 for the first page and increasing in an gapless integer sequence
+';
Index: openacs-4/packages/layout-manager/sql/oracle/pages-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/pages-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/pages-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1 @@
+drop table layout_pages;
Index: openacs-4/packages/layout-manager/sql/oracle/pageset-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/pageset-package-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/pageset-package-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,63 @@
+
+create or replace package layout_pageset
+as
+ function new (
+ p_owner_id in acs_objects.object_id%TYPE,
+ p_package_id in apm_packages.package_id%TYPE,
+ p_name in layout_pagesets.name%TYPE default 'Untitled',
+ p_theme in layout_pagesets.theme%TYPE default null,
+ p_template_id in layout_pagesets.template_id%TYPE default null
+ ) return layout_pagesets.pageset_id%TYPE;
+
+ procedure del (
+ p_pageset_id in layout_pagesets.pageset_id%TYPE
+ );
+
+end layout_pageset;
+/
+show errors
+
+create or replace package body layout_pageset
+as
+
+ function new (
+ p_owner_id in acs_objects.object_id%TYPE,
+ p_package_id in apm_packages.package_id%TYPE,
+ p_name in layout_pagesets.name%TYPE default 'Untitled',
+ p_theme in layout_pagesets.theme%TYPE default null,
+ p_template_id in layout_pagesets.template_id%TYPE default null,
+ p_context_id in acs_objects.context_id%TYPE
+ ) return layout_pagesets.pageset_id%TYPE
+ is
+ v_pageset_id layout_pagesets.pageset_id%TYPE;
+ begin
+
+ v_pageset_id := acs_object.new(
+ object_type => 'layout_pageset',
+ context_type => p_context_id
+ );
+
+ insert into layout_pagesets
+ (pageset_id, owner_id, package_id, name, theme)
+ values
+ (v_pageset_id, p_owner_id, p_package_id, p_name, p_theme);
+
+ return v_pageset_id;
+
+ end new;
+
+ procedure del (
+ p_pageset_id in layout_pagesets.pageset_id%TYPE
+ )
+ is
+ v_page_id layout_pages.page_id%TYPE;
+ begin
+ delete from layout_pagesets
+ where pageset_id = p_pageset_id;
+ acs_object.del(p_pageset_id);
+ end del;
+
+end layout_pageset;
+/
+show errors
+
Index: openacs-4/packages/layout-manager/sql/oracle/pagesets-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/pagesets-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/pagesets-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,68 @@
+-- create layout manager page sets datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: pagesets-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+create table layout_pagesets (
+ pageset_id integer
+ constraint l_pageset_id_fk
+ references acs_objects (object_id)
+ on delete cascade
+ constraint layout_pagesets_pk
+ primary key,
+ owner_id integer
+ constraint l_owner_id_fk
+ references acs_objects (object_id)
+ constraint l_owner_id_nn
+ not null,
+ package_id integer
+ constraint l_package_id_fk
+ references apm_packages (package_id)
+ on delete cascade
+ constraint l_package_id_nn
+ not null,
+ name varchar(100)
+ default 'Untitled'
+ constraint l_name_nn
+ not null,
+ theme varchar(100)
+ constraint l_theme_fk
+ references layout_themes (name),
+ template_id integer
+ constraint l_template_id_fk
+ references layout_pagesets (pageset_id)
+);
+
+create index layout_pagesets_owner_id_idx on layout_pagesets(owner_id);
+create index layout_pagesets_package_id_idx on layout_pagesets(package_id);
+
+comment on table layout_pagesets is '
+ layout_pagesets are containers of one or more portal pages mapped to a party.
+';
+
+comment on column layout_pagesets.package_id is '
+ The portal instance that ownns this portal
+';
+
+comment on column layout_pagesets.template_id is '
+ A portal may have a template (another portal)
+';
+
+comment on column layout_pagesets.theme is '
+ The default theme to use for pages in this page set, if not null.
+';
+
+begin
+ acs_object_type.create_type (
+ object_type => 'layout_pageset',
+ pretty_name => 'Layout Page Set',
+ pretty_plural => 'Layout Page Sets',
+ table_name => 'layout_pagesets',
+ id_column => 'pageset_id',
+ package_name => 'layout_pageset'
+ );
+
+end;
+/
+show errors
Index: openacs-4/packages/layout-manager/sql/oracle/pagesets-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/pagesets-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/pagesets-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,14 @@
+-- drop layout pagesets datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier)
+-- @creation-date 2008-07-05
+-- @version $Id: pagesets-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+begin
+acs_rel_type.drop_type('layout_pageset');
+end;
+/
+show errors
+
+drop table layout_pagesets;
Index: openacs-4/packages/layout-manager/sql/oracle/themes-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/themes-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/themes-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,21 @@
+-- create layout manager themes datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: themes-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+create table layout_themes (
+ name varchar(100)
+ constraint layout_themes_pk
+ primary key,
+ description varchar(250),
+ template varchar(100)
+);
+
+comment on table layout_themes is '
+ decoration templates for layout elements
+';
+
+comment on column layout_themes.template is '
+ The path relative to the lib directory to the theme template
+';
Index: openacs-4/packages/layout-manager/sql/oracle/themes-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/oracle/themes-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/oracle/themes-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,8 @@
+-- drop layout manager themes datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: themes-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_themes;
Index: openacs-4/packages/layout-manager/sql/postgresql/copy-pagesets-temp.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/copy-pagesets-temp.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/copy-pagesets-temp.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,53 @@
+ if p_template_id is not null then
+ -- now insert the pages from the layout template
+ for v_page in select *
+ from layout_pages
+ where pageset_id = p_template_id
+ loop
+
+ v_page_id := layout_page__new(
+ v_page.name,
+ v_pageset_id,
+ v_page.layout_template,
+ v_pageset_id);
+
+ -- now get the elements on the templates page and put them on the new page
+ for v_element in select *
+ from layout_elements
+ where page_id = v_page.page_id
+ loop
+
+ select nextval(''layout_seq'')
+ into v_new_element_id
+ from dual;
+
+ insert into layout_elements
+ (element_id, name, title, page_id, includelet_id, page_column, sort_key, state)
+ select v_new_element_id, name, title, v_page_id, includelet_id, page_column, sort_key,
+ state
+ from layout_elements
+ where element_id = v_element.element_id;
+
+ -- now for the elements params
+ for v_param in select *
+ from layout_element_parameters
+ where element_id = v_element.element_id
+ loop
+
+ select nextval(''layout_seq'')
+ into v_new_parameter_id
+ from dual;
+
+ insert into layout_element_parameters
+ (parameter_id, element_id, key, value)
+ select v_new_parameter_id, v_new_element_id, key, value
+ from layout_element_parameters
+ where parameter_id = v_param.parameter_id;
+
+ end loop;
+
+ end loop;
+
+ end loop;
+
+ end if;
Index: openacs-4/packages/layout-manager/sql/postgresql/datasources-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/Attic/datasources-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/datasources-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,22 @@
+-- create layout includelet
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-06
+-- @version $Id: datasources-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+-- ADD COMMENTS AND INDEXES!!!
+
+create table layout_datasources (
+ name text
+ constraint l_ds_name_pk
+ primary key,
+ description text
+ constraint l_ds_description_nn
+ not null,
+ package_key text
+ constraint l_ds_package_key_fk
+ references apm_package_types(package_key),
+ constructor text,
+ destructor text
+);
Index: openacs-4/packages/layout-manager/sql/postgresql/datasources-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/Attic/datasources-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/datasources-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,8 @@
+-- drop layout datasources
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-06
+-- @version $Id: datasources-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_datasources;
Index: openacs-4/packages/layout-manager/sql/postgresql/elements-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/elements-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/elements-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,93 @@
+-- create layout manager elements datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2001-10-01
+-- @version $Id: elements-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_elements (
+ element_id integer
+ constraint layout_elements_pk
+ primary key,
+ includelet_name text
+ constraint l_elements_includelet_name_fk
+ references layout_includelets (name)
+ on delete cascade
+ constraint l_elements_includelet_name_nn
+ not null,
+ name text
+ constraint l_elements_name_nn
+ not null,
+ title text default null,
+ page_id integer
+ constraint l_elements_page_id_fk
+ references layout_pages
+ on delete cascade
+ constraint l_elements_page_id_nn
+ not null,
+ page_column integer
+ constraint l_elements_column_nn
+ not null,
+ package_id integer
+ constraint l_elements_package_Id_fk
+ references apm_packages (package_id)
+ on delete cascade
+ constraint l_elements_package_Id_nn
+ not null,
+ theme text
+ constraint l_elements_theme_fk
+ references layout_themes (name),
+ sort_key integer
+ constraint l_elements_sort_key_nn
+ not null,
+ state text
+ default 'full'
+ constraint l_elements_state_ck
+ check (state in ('full', 'shaded', 'hidden', 'pinned')),
+ required_privilege varchar(20) default 'read'
+);
+
+comment on table layout_elements is '
+ The user-visible "box" on a layout page that displays the content of a includelet
+';
+
+comment on column layout_elements.includelet_name is '
+ The name of the includelet to which this element is bound.
+';
+
+comment on column layout_elements.page_column is '
+ The column to which this element has been assigned ("column" is a keyword in SQL)
+';
+
+comment on column layout_elements.sort_key is '
+ An ordering of elements contained in the same column on a page starting from
+ 0 for the first element and increasing in a gapless integer sequence
+';
+
+comment on column layout_elements.theme is '
+ Optional theme for this element.
+';
+
+comment on column layout_elements.state is '
+ one of the set "full" (normal), "shaded" (title bar only), or "hidden" (not shown).
+';
+
+create table layout_element_parameters (
+ element_id integer
+ constraint l_element_params_element_id_fk
+ references layout_elements (element_id)
+ on delete cascade
+ constraint l_element_params_element_id_nn
+ not null,
+ key text
+ constraint l_element_params_key_nn
+ not null,
+ value text
+);
+
+create index l_element_params_element_key_idx on layout_element_parameters (element_id, key);
+
+comment on table layout_element_parameters is '
+ Parameters for a given element. The data structure is that of a multiset (aka bag)
+ where multiple entries with the same key are allowed.
+';
Index: openacs-4/packages/layout-manager/sql/postgresql/elements-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/elements-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/elements-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,9 @@
+-- drop layout elements model
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: elements-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_element_parameters;
+drop table layout_elements;
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/includelets-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,75 @@
+-- create layout includelet
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-06
+-- @version $Id: includelets-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_includelets (
+ name text
+ constraint l_includelets_name_pk
+ primary key,
+ title text default null,
+ template text
+ constraint l_includelets_template_nn
+ not null,
+ dotlrn_compat_p boolean
+ constraint l_includelets_d_c_p_nn
+ not null,
+ constructor text,
+ destructor text,
+ description text,
+ required_privilege text default 'read',
+ datasource text
+ constraint l_includelets_ds_fk
+ references layout_datasources(name)
+ on delete cascade
+ constraint l_includelets_ds_nn
+ not null
+);
+
+-- indexes for referential integrity checking
+
+create index l_includelets_datasource_idx on layout_includelets(datasource);
+
+comment on table layout_includelets is '
+ A layout includelet is the package of code that generates the content of a layout
+ element. By convention, a package named foo-layout-includelets creates includelets
+ for the package foo.
+';
+
+comment on column layout_includelets.name is '
+ The name of this layout includelet. We can''t arbitrarily use layout_includelet_key
+ because many lincludelet packages will support at least two includelets, one user
+ includelet and one admin includelet. Includelet names, like package keys, must be
+ unique throughout a single OpenACS instance.
+';
+
+comment on column layout_includelets.title is '
+ The external name or message resource of this layout includelet. We can''t arbitrarily
+ use portlet_key because many portlet packages will support at least two portlets, one
+ user portlet and one admin portlet.
+';
+
+comment on column layout_includelets.datasource is '
+ The package key of the datasource that this includelet works with. For instance the
+ forums layout includelet works with the forums package.
+';
+
+comment on column layout_includelets.template is '
+ The name of template that displays the layout includelet content. Note this is not a full
+ path, layout templates go in the standard package template library directory.
+';
+
+comment on column layout_includelets.dotlrn_compat_p is '
+ If true, pass the includelet params in an array named "cf", rather than pass them
+ directly.
+';
+
+comment on column layout_includelets.constructor is '
+ The name of an optional constructor to run after the default constructor.
+';
+
+comment on column layout_includelets.destructor is '
+ The name of an optional constructor to run after the default destructor.
+';
Index: openacs-4/packages/layout-manager/sql/postgresql/includelets-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/includelets-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/includelets-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,8 @@
+-- drop layout includelet package
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: includelets-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_includelets;
Index: openacs-4/packages/layout-manager/sql/postgresql/layout-manager-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/layout-manager-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/layout-manager-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,16 @@
+-- create the layout manager datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2001-10-01
+-- @version $Id: layout-manager-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create sequence layout_seq;
+
+\i datasources-create.sql
+\i includelets-create.sql
+\i page-templates-create.sql
+\i themes-create.sql
+\i pagesets-create.sql
+\i pages-create.sql
+\i elements-create.sql
Index: openacs-4/packages/layout-manager/sql/postgresql/layout-manager-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/layout-manager-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/layout-manager-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,13 @@
+-- drop the layout manager datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+
+\i elements-drop.sql
+\i pages-drop.sql
+\i pagesets-drop.sql
+\i themes-drop.sql
+\i page-templates-drop.sql
+\i includelets-drop.sql
+\i datasources-drop.sql
+
+drop sequence layout_seq;
Index: openacs-4/packages/layout-manager/sql/postgresql/page-templates-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/page-templates-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/page-templates-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,34 @@
+-- create layout page templates datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: page-templates-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_page_templates (
+ name text
+ constraint l_page_templates_name_un
+ unique
+ constraint l_page_templates_name_nn
+ not null,
+ columns integer
+ constraint l_page_templates_column_nn
+ not null
+ constraint l_page_templates_column_ck
+ check (columns > 0),
+ description text,
+ template text
+);
+
+
+comment on table layout_page_templates is '
+ a layout page template is a template used to render a page built of zero or more
+ elements. Examples of page page templates are the three column simple, or two column
+ "Thin Thick" templates.
+';
+
+comment on column layout_page_templates.template is '
+ The path relative to layout/lib to the page template.
+
+ Example: "layouts/simple"
+';
Index: openacs-4/packages/layout-manager/sql/postgresql/page-templates-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/page-templates-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/page-templates-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,9 @@
+-- drop layout manager page templates datamodel
+--
+-- @author arjun@openforce.net
+-- @author yon@openforce.net
+-- @creation-date 2001-10-01
+-- @version $Id: page-templates-drop.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+drop table layout_page_templates;
Index: openacs-4/packages/layout-manager/sql/postgresql/pages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/pages-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/pages-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,55 @@
+-- create layout pages datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: pages-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+--
+
+create table layout_pages (
+ page_id integer
+ constraint layout_pages_pk
+ primary key,
+ name text
+ default 'Untitled Page'
+ constraint l_pages_name_nn
+ not null,
+ pageset_id integer
+ constraint l_pages_pageset_id_fk
+ references layout_pagesets (pageset_id)
+ on delete cascade
+ constraint l_pages_pageset_id_nn
+ not null,
+ page_template text
+ constraint l_page_template_fk
+ references layout_page_templates (name)
+ constraint l_page_template_nn
+ not null,
+ theme text
+ constraint l_page_theme_fk
+ references layout_themes (name),
+ sort_key integer
+ constraint l_pages_sort_key_nn
+ not null,
+ constraint l_pages_pageset_id_sort_key_un
+ unique (pageset_id, sort_key)
+);
+
+create index layout_pages_page_idx on layout_pages (pageset_id, page_id);
+
+comment on table layout_pages is '
+ layout pages are containers for portal elements. They can be thought of
+ as the "tabs" of a page set.
+';
+
+comment on column layout_pages.page_template is '
+ The name of the template to be used when rendering this page.
+';
+
+comment on column layout_pages.theme is '
+ The default theme to use for elements on this page, if not null.
+';
+
+comment on column layout_pages.sort_key is '
+ An ordering of the pages contained in the same page set starting from
+ 0 for the first page and increasing in an gapless integer sequence
+';
Index: openacs-4/packages/layout-manager/sql/postgresql/pages-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/pages-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/pages-drop.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1 @@
+drop table layout_pages;
Index: openacs-4/packages/layout-manager/sql/postgresql/pagesets-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/pagesets-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/pagesets-create.sql 22 Jul 2008 07:31:02 -0000 1.1
@@ -0,0 +1,114 @@
+-- create layout manager page sets datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: pagesets-create.sql,v 1.1 2008/07/22 07:31:02 donb Exp $
+
+create table layout_pagesets (
+ pageset_id integer
+ constraint l_pageset_id_fk
+ references acs_objects (object_id)
+ on delete cascade
+ constraint layout_pagesets_pk
+ primary key,
+ owner_id integer
+ constraint l_owner_id_fk
+ references acs_objects (object_id)
+ constraint l_owner_id_nn
+ not null,
+ package_id integer
+ constraint l_package_id_fk
+ references apm_packages (package_id)
+ on delete cascade
+ constraint l_package_id_nn
+ not null,
+ name text
+ default 'Untitled'
+ constraint l_name_nn
+ not null,
+ theme name
+ constraint l_theme_fk
+ references layout_themes (name),
+ template_id integer
+ constraint l_template_id_fk
+ references layout_pagesets (pageset_id)
+);
+
+create index layout_pagesets_owner_id_idx on layout_pagesets(owner_id);
+create index layout_pagesets_package_id_idx on layout_pagesets(package_id);
+
+comment on table layout_pagesets is '
+ layout_pagesets are containers of one or more portal pages mapped to a party.
+';
+
+comment on column layout_pagesets.package_id is '
+ The portal instance that ownns this portal
+';
+
+comment on column layout_pagesets.template_id is '
+ A portal may have a template (another portal)
+';
+
+comment on column layout_pagesets.theme is '
+ The default theme to use for pages in this page set, if not null.
+';
+
+select acs_object_type__create_type(
+ 'layout_pageset',
+ 'Layout Page Set',
+ 'Layout Page Sets',
+ 'acs_object',
+ 'LAYOUT_PAGESETS',
+ 'PAGESET_ID',
+ 'layout_pageset',
+ 'f',
+ null,
+ null
+);
+
+
+-- DRB template id needs to be implemented by copy pageset, which copies pages, which
+-- copies elements, which copies element parameters ...
+
+select define_function_args('layout_pageset__new', 'p_owner_id,p_package_id,p_name,p_theme,p_context_id');
+
+create or replace function layout_pageset__new (integer, integer, varchar, varchar, integer)
+returns integer as '
+declare
+ p_owner_id alias for $1;
+ p_package_id alias for $2;
+ p_name alias for $3;
+ p_theme alias for $4;
+ p_context_id alias for $5;
+ v_pageset_id layout_pagesets.pageset_id%TYPE;
+begin
+
+ v_pageset_id := acs_object__new(
+ null,
+ ''layout_pageset'',
+ null,
+ p_owner_id,
+ null,
+ p_context_id
+ );
+
+ insert into layout_pagesets
+ (pageset_id, owner_id, package_id, name, theme)
+ values
+ (v_pageset_id, p_owner_id, p_package_id, p_name, p_theme);
+
+ return v_pageset_id;
+
+end;' language 'plpgsql';
+
+select define_function_args('layout_pageset__del', 'p_pageset_id');
+
+create or replace function layout_pageset__del(integer)
+returns void as '
+declare
+ p_pageset_id alias for $1;
+begin
+ delete from layout_pagesets
+ where pageset_id = p_pageset_id;
+ perform acs_object__delete(p_pageset_id);
+end;' language 'plpgsql';
Index: openacs-4/packages/layout-manager/sql/postgresql/pagesets-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/pagesets-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/pagesets-drop.sql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,10 @@
+-- drop layout pagesets datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier)
+-- @creation-date 2008-07-05
+-- @version $Id: pagesets-drop.sql,v 1.1 2008/07/22 07:31:03 donb Exp $
+--
+
+select drop_package('layout_pageset');
+drop table layout_pagesets;
+select acs_object_type__drop_type('layout_pageset', 't');
Index: openacs-4/packages/layout-manager/sql/postgresql/t.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/Attic/t.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/t.sql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1 @@
+select acs_object_type__drop_type('layout_pageset', 't');
Index: openacs-4/packages/layout-manager/sql/postgresql/themes-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/themes-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/themes-create.sql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,23 @@
+-- create layout manager themes datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: themes-create.sql,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+create table layout_themes (
+ name text
+ constraint layout_themes_pk
+ primary key,
+ description text,
+ template text
+);
+
+comment on table layout_themes is '
+ decoration templates for layout elements
+';
+
+comment on column layout_themes.template is '
+ The path relative to the lib directory to the theme template
+
+ Example: "themes/deco-theme"
+';
Index: openacs-4/packages/layout-manager/sql/postgresql/themes-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/sql/postgresql/themes-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/sql/postgresql/themes-drop.sql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,8 @@
+-- drop layout manager themes datamodel
+--
+-- @author Don Baccus (dhogaza@pacifier.com)
+-- @creation-date 2008-07-05
+-- @version $Id: themes-drop.sql,v 1.1 2008/07/22 07:31:03 donb Exp $
+--
+
+drop table layout_themes;
Index: openacs-4/packages/layout-manager/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/apm-callback-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,88 @@
+namespace eval layout_manager {}
+namespace eval layout_manager::install {}
+
+ad_proc layout_manager::install::after_install {} {
+ Package after installation callback proc
+} {
+
+ apm_source [acs_root_dir]/packages/layout-manager/tcl/includelet-procs.tcl
+ apm_source [acs_root_dir]/packages/layout-manager/tcl/page-template-procs.tcl
+ apm_source [acs_root_dir]/packages/layout-manager/tcl/theme-procs.tcl
+
+ db_transaction {
+
+ # Now define some default layouts.
+
+ layout::page_template::new \
+ -name 1_column \
+ -description #layout-manager.simple_1column_layout_description# \
+ -columns 1 \
+ -template /packages/layout-manager/lib/page-templates/simple
+
+ layout::page_template::new \
+ -name 2_column \
+ -columns 2 \
+ -description #layout-manager.simple_2column_layout_description# \
+ -template /packages/layout-manager/lib/page-templates/simple
+
+ layout::page_template::new \
+ -name 3_column\
+ -columns 3 \
+ -description "Three columns" \
+ -description #layout-manager.simple_3column_layout_description# \
+ -template /packages/layout-manager/lib/page-templates/simple
+
+ layout::page_template::new \
+ -name thin_thick \
+ -columns 2 \
+ -description #layout-manager.left_sidebar_layout_description# \
+ -template /packages/layout-manager/lib/page-templates/simple
+
+ layout::page_template::new \
+ -name thin_thick_thin \
+ -columns 3 \
+ -description #layout-manager.left_and_right_sidebar_layout_description# \
+ -template /packages/layout-manager/lib/page-templates/simple
+
+ # And some themes
+
+ layout::theme::new \
+ -name default \
+ -description "Default OpenACS Theme" \
+ -template /packages/layout-manager/lib/themes/standard
+
+ layout::theme::new \
+ -name blank \
+ -description "No Graphics" \
+ -template /packages/layout-manager/lib/themes/blank
+
+ # Now define a couple of datasource apps and includelets
+
+ layout::datasource::new \
+ -name layout_manager_includelets \
+ -description "Layout Manager Includelets" \
+ -package_key layout-manager \
+ -constructor layout::datasource::constructor::closest_ancestor
+
+ layout::includelet::new \
+ -name layout_manager_admin_includelet \
+ -description "Layout Manager Administration" \
+ -title "Layout Manager Administration" \
+ -datasource layout_manager_includelets \
+ -template /packages/layout-manager/lib/layout-manager-admin-includelet \
+ -required_privilege admin
+
+ layout::datasource::new \
+ -name subsite_includelets \
+ -description "Subsite Includelets" \
+ -package_key acs-subsite \
+ -constructor layout::datasource::constructor::closest_ancestor
+
+ layout::includelet::new \
+ -name subsites_includelet \
+ -description "Display Subsites" \
+ -title "Subsites" \
+ -datasource subsite_includelets \
+ -template /packages/acs-subsite/lib/subsites
+ }
+}
Index: openacs-4/packages/layout-manager/tcl/constructor-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/constructor-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/constructor-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,24 @@
+ad_library {
+
+ Constructors for standard datasources.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-12
+ @version $Id: constructor-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::datasource::constructor {}
+
+ad_proc layout::datasource::constructor::closest_ancestor {
+ package_key
+ node_id
+} {
+ Returns the package_id of the closest ancestor instance of package_key, including
+ the current package as an ancestor.
+} {
+ return [site_node::closest_ancestor_package \
+ -node_id $node_id \
+ -package_key $package_key \
+ -include_self]
+}
Index: openacs-4/packages/layout-manager/tcl/datasource-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/Attic/datasource-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/datasource-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,75 @@
+ad_library {
+
+ Layout Manager Application Datasources
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-5
+ @version $Id: datasource-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::datasource {}
+namespace eval layout::datasource::binding {}
+
+ad_proc layout::datasource::new {
+ -name:required
+ {-description ""}
+ {-package_key ""}
+ {-constructor ""}
+ {-destructor ""}
+} {
+ Create a new layout manager application binding..
+
+ @param name The unique internal name of the new application binding.
+ @param description A human-readable description (defaults to name)
+ @param package_key The package to associate with client includelets
+ @param constructor Custom constructor to run after the default constructor
+ @param destructor Custom destructor to run before the default destructor
+
+ @author Don Baccus (dhogaza@pacifier.com)
+} {
+ # Default datasource description to its name
+ if { ![info exists description] } {
+ set description $name
+ }
+
+ db_dml insert_datasource {}
+}
+
+ad_proc layout::datasource::get {
+ -name:required
+} {
+ Return the datasource in "array get" format.
+} {
+ db_1row select_datasource {} -column_array datasource
+ return [array get datasource]
+}
+
+ad_proc layout::datasource::get_column_value {
+ -name:required
+ -column:required
+} {
+ Return the value of one column for one row in the datasources table.
+} {
+ array set datasource [layout::datasource::get -name $name]
+ return $datasource($column)
+}
+
+ad_proc layout::datasource::delete {
+ -name:required
+} {
+ db_dml delete_datasource {}
+}
+
+ad_proc layout::datasource::construct {
+ -name:required
+ -node_id:required
+ -package_key:required
+} {
+ set constructor [layout::datasource::get_column_value -name $name -column constructor]
+ if { $constructor ne "" } {
+ return [$constructor $package_key $node_id]
+ } else {
+ return ""
+ }
+}
Index: openacs-4/packages/layout-manager/tcl/datasource-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/Attic/datasource-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/datasource-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ insert into layout_datasources
+ (name, description, package_key, constructor, destructor)
+ values
+ (:name, :description, :package_key, :constructor, :destructor)
+
+
+
+
+
+ select *
+ from layout_datasources
+ where name = :name
+
+
+
+
+
+ delete from layout_datasources
+ where name = :name
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/element-parameter-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-parameter-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-parameter-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,85 @@
+ad_library {
+
+ Page Set Element Parameter Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-05
+ @version $Id: element-parameter-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::element::parameter {}
+
+ad_proc layout::element::parameter::add_values {
+ -element_id:required
+ -parameters:required
+} {
+ Create new parameter values
+
+ @param element_id The element to add the parameters to.
+ @param parameters The parameter keys and values in array get format
+} {
+ foreach {key value} $parameters {
+ db_dml insert_parameter {}
+ }
+ layout::element::flush -element_id $element_id
+}
+
+ad_proc -private layout::element::parameter::delete {
+ -element_id:required
+ -key:required
+ -value
+} {
+ Removes a value for a parameter or all values for that parameter.
+
+ @param element_id The element the parameter(s) belong to
+ @param key The key of the parameter
+ @param value If set, only delete keys with this value, if not, all parameters
+ for the element with the given key.
+} {
+ if {[info exists value]} {
+ db_dml delete_one_parameter_value {}
+ } else {
+ db_dml delete_parameter {}
+ }
+ layout::element::flush -element_id $element_id
+}
+
+ad_proc layout::element::parameter::get {
+ -element_id:required
+ -key:required
+} {
+ returns a list of values for this element/key combination
+} {
+ return [db_list select_parameters {}]
+}
+
+ad_proc layout::element::parameter::set_values {
+ -element_id:required
+ -parameters:required
+} {
+ Overwrite existing values of parameters with the given keys and element_id.
+ Use with great care.
+
+ @param element_id The element the parameter(s) belong to
+ @param parameters The parameter keys and values in array get format
+
+} {
+ foreach {key value} $parameters {
+ db_dml delete_parameter {}
+ db_dml insert_parameter {}
+ }
+ layout::element::flush -element_id $element_id
+}
+
+ad_proc layout::element::parameter::get_all {
+ -element_id:required
+} {
+ Return all parameters for element_id in "array get" format
+} {
+ db_foreach select_parameters {} {
+ lappend parameters($key) $value
+ }
+
+ return [array get parameters]
+}
Index: openacs-4/packages/layout-manager/tcl/element-parameter-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-parameter-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-parameter-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+ insert into layout_element_parameters
+ (element_id, key, value)
+ values
+ (:element_id, :key, :value)
+
+
+
+
+
+ delete from layout_element_parameters
+ where element_id = :element_id
+ and key = :key
+ and value = :value
+
+
+
+
+
+ delete from layout_element_parameters
+ where element_id = :element_id
+ and key = :key
+
+
+
+
+
+ select value
+ from layout_element_parameters
+ where element_id = :element_id
+ and key = :key
+
+
+
+
+
+ delete from layout_element_parameters
+ where element_id = :element_id
+ and key = :key
+
+
+
+
+
+ insert into layout_element_parameters
+ (element_id, key, value)
+ values
+ (:element_id, :key, :value)
+
+
+
+
+
+ select key, value
+ from layout_element_parameters
+ where element_id = :element_id
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/element-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-procs-oracle.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,63 @@
+
+
+
+ oracle8.1.6
+
+
+
+ select sort_key as other_sort_key,
+ element_id as other_element_id
+ from (select *
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and sort_key < :sort_key
+ order by sort_key desc)
+ where rownum = 1
+
+
+
+
+
+ select sort_key as other_sort_key,
+ element_id as other_element_id
+ from (select *
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and sort_key > :sort_key
+ order by sort_key asc)
+ where rownum = 1
+
+
+
+
+
+ update layout_elements
+ set page_column = :page_column,
+ sort_key = (select nvl((select max(sort_key) + 1
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column),
+ 1)
+ from dual)
+ where element_id = :element_id
+
+
+
+
+
+ update layout_elements
+ set page_id = :page_id,
+ page_column = :page_column,
+ sort_key = (select nvl((select max(sort_key) + 1
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column),
+ 1)
+ from dual)
+ where element_id = :element_id
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/element-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/element-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-procs-postgresql.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,63 @@
+
+
+
+ postgresql7.2
+
+
+
+ select sort_key as other_sort_key,
+ element_id as other_element_id
+ from (select *
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and sort_key < :sort_key
+ order by sort_key desc) as other_element
+ limit 1
+
+
+
+
+
+ select sort_key as other_sort_key,
+ element_id as other_element_id
+ from (select *
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column
+ and sort_key > :sort_key
+ order by sort_key asc) as other_element
+ limit 1
+
+
+
+
+
+ update layout_elements
+ set page_column = :page_column,
+ sort_key = (select coalesce((select max(sort_key) + 1
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column),
+ 1)
+ from dual)
+ where element_id = :element_id
+
+
+
+
+
+ update layout_elements
+ set page_id = :page_id,
+ page_column = :page_column,
+ sort_key = (select coalesce((select max(sort_key) + 1
+ from layout_elements
+ where page_id = :page_id
+ and page_column = :page_column),
+ 1)
+ from dual)
+ where element_id = :element_id
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,424 @@
+ad_library {
+
+ Layout Manager Element Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-05
+ @version $Id: element-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::element {}
+
+ad_proc layout::element::new {
+ -pageset_id:required
+ -package_id:required
+ {-page_name ""}
+ {-page_column ""}
+ {-state full}
+ -includelet_name:required
+ {-name ""}
+ {-title ""}
+ {-parameters ""}
+ -initialize:boolean
+ {-theme ""}
+} {
+ 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 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.
+ @param includelet_name The layout manager includelet name
+ @param name The name of the element
+ @param parameters Optional args to set in array get format
+ @param initialize If set, call the layout manager's default constructor
+ @param theme Override page and pageset theme if set
+
+ @return The element_id of the new portlet
+
+ Note of the day: use of a parameter named "args" breaks ad_proc in very hard
+ to debug ways ...
+
+} {
+
+ set page_id [layout::page::get_id -pageset_id $pageset_id -page_name $page_name]
+
+ if {[string equal "" $page_column]} {
+ set page_column [layout::element::choose_page_column -page_id $page_id]
+ }
+
+ array set includelet [layout::includelet::get -name $includelet_name]
+
+ # Default name to be the same as the includelet name
+ if { $name eq "" } {
+ set name $includelet_name
+ }
+
+ # Default the display title to the value given in the includelet definition
+ if { $title eq "" } {
+ set title $includelet(title)
+ }
+
+ set element_id [db_nextval layout_seq]
+
+ db_dml insert_element {}
+
+ layout::element::parameter::add_values \
+ -element_id $element_id \
+ -parameters $parameters
+
+ if { $initialize_p && $includelet(constructor) ne "" } {
+ $includelet(constructor) $element_id
+ }
+
+ layout::page::flush -page_id $page_id
+
+ return $element_id
+}
+
+ad_proc layout::element::delete {
+ -element_id:required
+} {
+ Delete the given element.
+
+ @param element_id The id of the parameter to be deleted.
+} {
+ set page_id [layout::element::get_column_value -element_id $element_id -column page_id]
+ db_dml delete_element {}
+ layout::element::flush -element_id $element_id
+ layout::page::flush -page_id $page_id
+}
+
+ad_proc layout::element::get {
+ -element_id:required
+} {
+ Return element info in "array get" format.
+
+ @param element_id The id of the element.
+} {
+ ns_cache eval db_cache_pool element_${element_id}_get {
+ db_1row select_element {} -column_array element
+ return [array get element]
+ }
+}
+
+ad_proc layout::element::get_column_value {
+ -element_id:required
+ -column:required
+} {
+ Return one row column from a layout element.
+
+ @param element_id The id of the element.
+ @param column The name of the column in the layout_elements table.
+} {
+ array set element [layout::element::get -element_id $element_id]
+ return $element($column)
+}
+
+ad_proc layout::element::set_values {
+ -element:required
+} {
+ Set the fields of a layout manager element.
+
+ @param element The new value of the element in array get format (including the element_id).
+} {
+ array set element_array $element
+ template::util::array_to_vars element_array
+
+ db_dml update_element {}
+ layout::element::flush -element_id $element_id
+}
+
+ad_proc layout::element::set_column_value {
+ -element_id:required
+ -column:required
+ -value:required
+} {
+ Set a column to a given value in a particular row.
+
+ @param element_id The id of the element to modify.
+ @param column The name of the column being set.
+ @param value The new value for the column.
+} {
+ array set element [layout::element::get -element_id $element_id]
+ set element($column) $value
+
+ layout::element::set_values -element [array get element]
+}
+
+ad_proc layout::element::get_id_list {
+ -pageset_id:required
+ -includelet_name:required
+ {-name "%"}
+ {-title "%"}
+} {
+ get a list of element_ids of type includelet_name on a particular pageset, restricted
+ by the SQL LIKE patterns applied to the name and title columns.
+
+ @param pageset_id The pageset to search
+ @param includelet_name The portlet type
+ @param name If present, SQL LIKE pattern that restricts the search by the element's name
+ @param title If present, like name but on the title column
+} {
+ return [db_list select_element_ids {}]
+}
+
+ad_proc layout::element::get_id {
+ -pageset_id:required
+ -includelet_name:required
+ {-name "%"}
+ {-title "%"}
+} {
+ get an element_id of type includelet_name on a particular pageset, restricted
+ by the SQL LIKE patterns applied to the name and title columns. Give an error if
+ more than one such element is found.
+
+ @param pageset_id The pageset to search
+ @param includelet_name The portlet type
+ @param name If present, SQL LIKE pattern that restricts the search by the element's name
+ @param title If present, like name but on the title column
+} {
+ set id_list [layout::element::get_id_list \
+ -pageset_id $id \
+ -includelet_name $includelet_name \
+ -name $name \
+ -title $title]
+ if { [llength $id_list] != 1 } {
+ ad_return -code error "Check for exactly one layout manager element failed"
+ }
+ return [lindex $id_list 0]
+}
+
+ad_proc -private layout::element::move {
+ -page_id:required
+ -element_id:required
+ -direction:required
+} {
+ moves an element within a page
+} {
+ if {[string equal $direction up] || [string equal $direction down]} {
+ move_vertically -element_id $element_id -direction $direction
+ } elseif {[string equal $direction left] || [string equal $direction right]} {
+ move_horizontally -element_id $element_id -direction $direction
+ }
+ layout::page::flush -page_id $page_id
+}
+
+ad_proc -private layout::element::move_vertically {
+ -element_id:required
+ -direction:required
+} {
+ swaps the element with either the previous or next one in the page_column,
+ depending on the value of direction.
+} {
+
+ array set element [layout::element::get -element_id $element_id]
+ template::util::array_to_vars element
+
+ if {[string equal $direction up]} {
+ if {![db_0or1row select_previous_element {}]} {
+ return
+ }
+ } elseif {[string equal $direction down]} {
+ if {![db_0or1row select_next_element {}]} {
+ return
+ }
+ } else {
+ ad_return_complaint 1 "layout::element::swap: bad direction: $direction"
+ }
+
+ db_transaction {
+ # because of the uniqueness constraint on sort_keys we need to set
+ # a dummy key, then do the swap.
+ set dummy_sort_key -1
+
+ # set the source element to the dummy key
+ db_dml swap_sort_keys_1 {}
+
+ # set the target's sort_key to the source's sort_key
+ db_dml swap_sort_keys_2 {}
+
+ # set the source's sort_key to the target's sort_key
+ db_dml swap_sort_keys_3 {}
+ }
+ flush -element_id $element_id
+ flush -element_id $other_element_id
+
+}
+
+ad_proc -private layout::element::move_horizontally {
+ -element_id:required
+ -direction:required
+} {
+ move a pageset element between page_columns
+} {
+
+ array set element [layout::element::get -element_id $element_id]
+ template::util::array_to_vars element
+
+ if {[string equal $direction left]} {
+ incr page_column -1
+ } elseif {[string equal $direction right]} {
+ incr page_column 1
+ }
+
+ db_dml update_page_column {}
+ flush -element_id $element_id
+
+}
+
+ad_proc -private layout::element::move_to_page {
+ -element_id:required
+ -page_id:required
+ {-page_column ""}
+} {
+ move this element to another page
+} {
+
+ set from_page_id [layout::element::get_column_value -element_id $element_id -column page_id]
+ set current_page_column $page_column
+ if { $page_column eq "" } {
+ set current_page_column \
+ [layout::element::get_column_value -element_id $element_id -column page_column]
+ }
+
+ set target_n_page_columns [layout::page_template::get_column_value -column columns \
+ -name [layout::page::get_column_value -page_id $page_id -column page_template]
+ ]
+
+ if {$current_page_column > $target_n_page_columns} {
+ set page_column $target_n_page_columns
+ } else {
+ set page_column $current_page_column
+ }
+
+ db_dml update_element {}
+ flush -element_id $element_id
+ layout::page::flush -page_id $from_page_id
+ layout::page::flush -page_id $page_id
+
+}
+
+ad_proc layout::element::choose_page_column {
+ -page_id:required
+} {
+ select the page_column on the page with the fewest elements on it
+} {
+ set min_count 99999
+ set min_page_column 0
+
+ set page_template [layout::page::get_column_value -page_id $page_id -column page_template]
+ set page_columns [layout::page_template::get_column_value -name $page_template -column columns]
+
+ for { set page_column 1 } { $page_column <= $page_columns } { incr page_column } {
+ set count [db_string select_page_column_count {}]
+ if {$count < $min_count} {
+ set min_count $count
+ set min_page_column $page_column
+ }
+ }
+
+ return $min_page_column
+}
+
+ad_proc -private layout::element::get_render_data {
+ -element_id:required
+ {-edit_p 0}
+} {
+ Return all the good stuff a render template needs to render an element.
+
+ @element_id The element in question
+ @decorate_p If true decorate the element with the layout manager theme.
+ @edit_p If true the render template should show the shade and hide widgets
+
+} {
+
+ # Everything we call here caches their database queries, so we won't do any
+ # caching of our own. This (trust me) simplified the cache coherency problem.
+
+ array set element [layout::element::get -element_id $element_id]
+ array set page [layout::page::get -page_id $element(page_id)]
+ array set pageset [layout::pageset::get -pageset_id $page(pageset_id)]
+
+ # If the element has no custom theme assigned to it, inherit the
+ # default theme from the page or page set that owns this element.
+
+ if { $element(theme) eq "" } {
+ set element(theme) $page(theme)
+ if { $element(theme) eq "" } {
+ set element(theme) $pageset(theme)
+ }
+ }
+
+ array set theme [layout::theme::get -name $element(theme)]
+ set element(theme_template) $theme(template)
+
+ set config [list \
+ element_id $element_id \
+ package_id $element(package_id)
+ ]
+
+ set config [concat $config [layout::element::parameter::get_all -element_id $element_id]]
+
+ array set includelet [layout::includelet::get -name $element(includelet_name)]
+
+ # Kludge to allow portlet templates to live in the package's lib directory
+ # while remaining compatible with the existing .LRN portlet structure which has
+ # them in www. If you're porting an old portlet and are too lazy to move
+ # it to lib, specify the full path when you declare your portlet.
+
+ if { [string match /* $includelet(template)] } {
+ set element(template_path) "$includelet(template)"
+ } else {
+ set element(template_path) "/packages/$includelet(owner)/lib/$includelet(template)"
+ }
+ set element(dotlrn_compat_p) $includelet(dotlrn_compat_p)
+
+ set element(config) $config
+
+ return [array get element]
+
+}
+
+ad_proc layout::element::configure {
+ -element_id:required
+ -op:required
+ -return_url:required
+} {
+ dispatch on the element_id and op requested
+} {
+
+ set state [layout::element::get_column_value -element_id $element_id -column state]
+
+ switch $op {
+ shade {
+ if {[string equal $state shaded]} {
+ set new_state full
+ } else {
+ set new_state shaded
+ }
+ }
+ hide {
+ if {[string equal $state hidden]} {
+ set new_state full
+ } else {
+ set new_state hidden
+ }
+ }
+ }
+
+ layout::element::set_column_value -element_id $element_id -column state -value $new_state
+ ad_returnredirect $return_url
+
+}
+
+ad_proc layout::element::flush {
+ -element_id:required
+} {
+ Flush all cache entries built for element_id
+} {
+ db_flush_cache -cache_key_pattern element_${element_id}_*
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/element-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+ insert into layout_elements
+ (element_id, includelet_name, name, title, page_id, page_column, theme,
+ state, sort_key, required_privilege, package_id)
+ select :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),
+ layout_includelets.required_privilege,
+ :package_id
+ from layout_includelets
+ where layout_includelets.name = :includelet_name
+
+
+
+
+
+ delete
+ from layout_elements
+ where element_id = :element_id
+
+
+
+
+
+ select *
+ from layout_elements
+ where element_id = :element_id
+
+
+
+
+
+ update layout_elements
+ set includelet_name = :includelet_name,
+ name = :name,
+ title = :title,
+ page_id = :page_id,
+ page_column = :page_column,
+ sort_key = :sort_key,
+ theme = :theme,
+ state = :state
+ where element_id = :element_id
+
+
+
+
+
+ select count(*) as count
+ from layout_elements pe,
+ layout_pages pp
+ where pp.page_id = :page_id
+ and pe.page_column = :page_column
+ and pp.page_id = pe.page_id
+
+
+
+
+
+ select layout_elements.element_id
+ from layout_elements,
+ layout_pages
+ where layout_pages.pageset_id = :pageset_id
+ and layout_elements.includelet_name = :includelet_name
+ and layout_elements.page_id = layout_pages.page_id
+ and layout_elements.name like :name
+ and layout_elements.title like :title
+
+
+
+
+
+ select layout_elements.element_id
+ from layout_elements, layout_element_parameters
+ where layout_elements.page_id in (select page_id
+ from layout_pages
+ where layout_id = :layout_id)
+ and layout_element_parameters.element_id = layout_elements.element_id
+ and layout_element_parameters.key = :key
+ and layout_element_parameters.value = :value
+
+
+
+
+
+ update layout_elements
+ set sort_key = :dummy_sort_key
+ where element_id = :element_id
+
+
+
+
+
+ update layout_elements
+ set sort_key = :sort_key
+ where element_id = :other_element_id
+
+
+
+
+
+ update layout_elements
+ set sort_key = :other_sort_key
+ where element_id = :element_id
+
+
+
+
+
+ select pe.element_id
+ from layout_elements pe, layout_includelets pd
+ where pe.page_id = :page_id
+ and pe.includelet_name= pd.includelet_name
+ and pd.name = :includelet_name
+
+
+
+
+
+ select pe.element_id
+ from layout_elements pe, layout_pages pp
+ where pe.page_id = pp.page_id
+ and pe.name = :name
+ and pp.layout_id = :layout_id
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/includelet-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,67 @@
+ad_library {
+
+ Layout Manager Includelet Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-5
+ @version $Id: includelet-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::includelet {}
+
+ad_proc layout::includelet::new {
+ -name:required
+ -title:required
+ -datasource:required
+ -template:required
+ -description
+ {-dotlrn_compat_p f}
+ {-constructor ""}
+ {-destructor ""}
+ {-required_privilege read}
+} {
+ Create a new layout manager includelet.
+
+ @param name The internal name of the new includelet. Like package keys, this must
+ be unique in a single OpenACS instance, so it is best to incorporate the includelet's
+ package key in the name (forums_includelet, forums_admin_includelet, etc)
+ @param title The external name (or message key) of the includelet
+ @param owner The package that owns this portlet
+ @param application The package the portlet works with, if any
+ @param template The template the displays the portlet content
+ @param description A human-readable description (defaults to name)
+ @param constructor Custom constructor to run after the default constructor
+ @param destructor Custom destructor to run before the default destructor
+ @param required_privilege The default privilege the user needs to be able to see this
+ includelet (defaults to 'read')
+
+ @author Don Baccus (dhogaza@pacifier.com)
+} {
+ # Default includelet description to its name
+ if { ![info exists description] } {
+ set description $name
+ }
+
+ db_dml insert_includelet {}
+}
+
+ad_proc -private layout::includelet::delete {
+ -name:required
+} {
+ Delete an includelet and any layout element referencing it.
+
+ @param name The name of the includelet to delete
+} {
+ db_dml delete_includelet {}
+}
+
+
+ad_proc layout::includelet::get {
+ -name:required
+} {
+ Return the includelet in "array get" format.
+} {
+ db_1row select_includelet {} -column_array includelet
+ return [array get 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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/includelet-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ insert into layout_includelets
+ (name, title, datasource, template, constructor, destructor, required_privilege,
+ description, dotlrn_compat_p)
+ values
+ (:name, :title, :datasource, :template, :constructor, :destructor,
+ :required_privilege, :description, :dotlrn_compat_p)
+
+
+
+
+
+ delete from layout_includelets
+ where name = :name
+
+
+
+
+
+ select *
+ from layout_includelets
+ where name = :name
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/layout-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/layout-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/layout-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,31 @@
+ad_library {
+
+ Layout Manager Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-05
+ @version $Id: layout-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout {}
+
+ad_proc layout::package_id {} {
+ Returns our package_id. Works with acs-subsite's internal redirect parameter.
+} {
+ if { [ad_conn package_key] eq "layout-manager" } {
+ return [ad_conn package_id]
+ } elseif { [ad_conn package_key] eq "acs-subsite" } {
+ return [site_node::get_children \
+ -package_key layout-manager \
+ -node_id [ad_conn node_id] \
+ -element object_id]
+ }
+ return -code error "pageset::package_id called with package_key not acs-subsite or layout-manager"
+}
+
+ad_proc layout::mount_point {} {
+ Caches the mount point
+} {
+ return [lindex [site_node::get_url_from_object_id -object_id [ad_conn package_id]] 0]
+}
Index: openacs-4/packages/layout-manager/tcl/layout-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/Attic/layout-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/layout-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ select columns
+ from layout_page_templates
+ where name = :name
+
+
+
+
+
+ select name, description
+ from layout_page_templates
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/page-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,190 @@
+ad_library {
+
+ layout page procs
+
+ @creation-date 2008-07-05
+ @version $Id: page-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::page {}
+
+ad_proc layout::page::new {
+ -pageset_id:required
+ -name:required
+ {-page_template 2_column}
+} {
+ Create a new page and associate it with the given page set.
+
+ @param pageset_id The id of the page set the new page will be bound to.
+ @param name The page name (used for navigation).
+ @param page_template The page template to use to render this page.
+} {
+ set page_id [db_nextval layout_seq]
+ db_dml insert_page {}
+ layout::pageset::flush -pageset_id $pageset_id
+ return $page_id
+}
+
+ad_proc layout::page::delete {
+ -page_id:required
+} {
+ Delete a page.
+
+ @param page_id The id of the page to delete.
+} {
+ set pageset_id [layout::page::get_column_value -page_id $page_id -column pageset_id]
+
+ # Renumber pages that have a sort key greater than ours, then delete the page.
+ db_transaction {
+ set page_list [db_list_of_lists get_pages {}]
+ db_dml delete_page {}
+ foreach page $page_list {
+ foreach {update_page_id sort_key} $page {}
+ db_dml update_page {}
+ }
+ }
+
+ layout::pageset::flush -pageset_id $pageset_id
+ layout::page::flush -page_id $page_id
+}
+
+ad_proc -private layout::page::get {
+ -page_id:required
+} {
+ Get the columns of a page in array get format.
+
+ @param page_id The id of the page.
+} {
+ ns_cache eval db_cache_pool page_${page_id}_get {
+ db_1row select_page {} -column_array page
+ return [array get page]
+ }
+}
+
+ad_proc layout::page::get_column_value {
+ -page_id:required
+ -column:required
+} {
+ Return the value of a particular column value for a page.
+
+ @param page_id The id of the page.
+} {
+ array set page [layout::page::get -page_id $page_id]
+ return $page($column)
+}
+
+ad_proc layout::page::set_values {
+ -page:required
+} {
+ Set the fields of a layout page.
+
+ @param page The new value of the page in array get format (including page_id).
+} {
+ array set page_array $page
+ template::util::array_to_vars page_array
+
+ db_dml update_page {}
+ layout::page::flush -page_id $page_id
+}
+
+ad_proc layout::page::set_column_value {
+ -page_id:required
+ -column:required
+ -value:required
+} {
+ Set the value of a single column within a page.
+
+ @param page_id The id of the page.
+} {
+ array set page [layout::page::get -page_id $page_id]
+ set page($column) $value
+
+ layout::page::set_values -page [array get page]
+}
+
+ad_proc layout::page::get_id {
+ -pageset_id:required
+ {-page_name ""}
+ {-sort_key 0}
+} {
+ Get the page_id given a pageset_id and a page name or sort_key. if no name is given
+ the page with the given sort_key is returned.
+
+ @param pageset_id The pageset we're interested in.
+ @param page_name The name of the page we want.
+ @param sort_key If page_name is blank, grab the page with the given sort_key.
+} {
+ if {![empty_string_p $page_name]} {
+ set page_id [db_string get_page_id_from_name {} -default ""]
+ if {[empty_string_p $page_id]} {
+ # there is no page by that name in the pageset, return page 0
+ return [layout::page::get_id -pageset_id $pageset_id]
+ } else {
+ return $page_id
+ }
+ } else {
+ return [db_string get_page_id_select {}]
+ }
+}
+
+ad_proc layout::page::first_page_p {
+ -pageset_id:required
+ -page_id:required
+} {
+ Check if the given page_id is the first page in the given pageset.
+
+ @param pageset_id The id of the page set.
+ @param page_id The id of the page within the page set.
+ @return 1 If the page is the first page in the page set.
+} {
+ return [expr {$page_id == [layout::page::get_id -pageset_id $pageset_id -sort_key 0]}]
+}
+
+ad_proc -private layout::page::has_visible_elements {
+ -page_id:required
+} {
+ Check if a page has any visible elements.
+
+ @param page_id The id of the page to check.
+ @return 1 If the page has at least one element that's visible.
+} {
+ return [db_string select_visible_elements_p {} -default 0]
+}
+
+ad_proc -private layout::page::get_render_data {
+ -page_id:required
+} {
+ Get the data needed to render a page in array get format.
+
+ @param page_id The id of the page to render.
+ @return The value of the page entry augmented with template and a list of element_ids,
+ all in array get format.
+} {
+ set user_id [ad_conn user_id]
+ ns_cache eval db_cache_pool page_${page_id}_get_render_data_$user_id {
+ array set page [layout::page::get -page_id $page_id]
+ set page_template [layout::page::get_column_value -page_id $page_id -column page_template]
+ db_1row page_template_select {}
+ set page(template) $template
+
+ db_foreach element_select {} -column_array entry {
+ lappend element_ids($entry(page_column)) $entry(element_id)
+ } if_no_rows {
+ set element_ids {}
+ }
+
+ set page(element_list) [array get element_ids]
+ return [array get page]
+ }
+}
+
+ad_proc -private layout::page::flush {
+ -page_id:required
+} {
+ Flushes all cached data for this page.
+
+ @param page_id The id of the page to flush from the cache.
+} {
+ db_flush_cache -cache_key_pattern page_${page_id}_*
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/page-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+ insert into layout_pages
+ (page_id, name, pageset_id, page_template, sort_key)
+ select :page_id, :name, :pageset_id, :page_template,
+ coalesce(max(sort_key) + 1, 0)
+ from layout_pages
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select page_id, sort_key
+ from layout_pages
+ where pageset_id = :pageset_id
+ and sort_key > (select sort_key
+ from layout_pages
+ where page_id = :page_id)
+ order by sort_key
+
+
+
+
+
+ update layout_pages
+ set sort_key = :sort_key - 1
+ where page_id = :update_page_id
+
+
+
+
+
+ delete from layout_pages
+ where page_id = :page_id
+
+
+
+
+
+ select *
+ from layout_pages
+ where page_id = :page_id
+
+
+
+
+
+ update layout_pages
+ set name = :name,
+ pageset_id = :pageset_id,
+ page_template = :page_template,
+ sort_key = :sort_key,
+ theme = :theme
+ where page_id = :page_id
+
+
+
+
+
+ select case when count(*) = 0 then 0 else 1 end
+ from layout_elements
+ where page_id = :page_id
+ and state != 'hidden'
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ and sort_key = :sort_key
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ and name = :page_name
+
+
+
+
+
+ select 1
+ from dual
+ where exists (select 1
+ from layout_elements
+ where page_id = :page_id
+ and state != 'hidden')
+
+
+
+
+
+ select layout_page_templates.template
+ from layout_page_templates
+ where layout_page_templates.name = :page_template
+
+
+
+
+
+ select le.element_id,
+ le.page_column,
+ le.sort_key
+ from layout_elements le, layout_pages lp
+ where lp.page_id = :page_id
+ and le.page_id = lp.page_id
+ and le.state != 'hidden'
+ and exists (select 1
+ from acs_object_party_privilege_map
+ where object_id = le.package_id
+ and party_id = :user_id
+ and privilege = le.required_privilege)
+ order by le.page_column, le.sort_key
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/page-template-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/page-template-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/page-template-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,65 @@
+ad_library {
+
+ layout page templateprocs
+
+ @creation-date 2008-07-07
+ @version $Id: page-template-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::page_template {}
+
+ad_proc layout::page_template::new {
+ -name:required
+ {-description ""}
+ -columns:required
+ -template:required
+} {
+ Create a new page template.
+
+ A page template defines the number of columns on a page, and a template
+ to render the page and its component elements.
+
+ @param name The name of this page template, which must be unique.
+ @param description An optional description of this page template.
+ @param columns The number of columns this page template expects.
+ @param template The path (/packages/...) to the template source.
+} {
+ db_dml insert_page_template {}
+}
+
+ad_proc layout::page_template::delete {
+ -name:required
+} {
+ Delete the given page template.
+
+ @param name The name of the template to delete.
+} {
+ db_dml delete_page_template {}
+}
+
+ad_proc layout::page_template::get {
+ -name:required
+} {
+ Returns information about the given page_template in array get format
+
+ @param name The name of the page template.
+} {
+ # DRB: need to do CACHE
+ db_1row select_page_template {} -column_array page_template
+ return [array get page_template]
+}
+
+ad_proc layout::page_template::get_column_value {
+ -name:required
+ -column:required
+} {
+ Returns the requested column for the given page template.
+
+ @param name The name of the page template.
+ @param column The column of the page template to return
+ @return The requested column
+} {
+ array set page_template [layout::page_template::get -name $name]
+ return $page_template($column)
+}
Index: openacs-4/packages/layout-manager/tcl/page-template-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/page-template-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/page-template-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ insert into layout_page_templates
+ (name, description, columns, template)
+ values
+ (:name, :description, :columns, :template)
+
+
+
+
+
+ delete from layout_page_templates
+ where name = :name
+
+
+
+
+
+ select *
+ from layout_page_templates
+ where name = :name
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/pageset-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/pageset-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/pageset-procs-oracle.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+ oracle8.1.6
+
+
+
+ begin
+ layout_pageset.del(p_pageset_id => :pageset_id);
+ end;
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/pageset-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/pageset-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/pageset-procs-postgresql.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+ postgresql7.2
+
+
+
+ select layout_pageset__del(: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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/pageset-procs.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,410 @@
+ad_library {
+
+ Layout Manager Page Set Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-05
+ @version $Id: pageset-procs.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+namespace eval layout::pageset {}
+
+ad_proc layout::pageset::new {
+ -owner_id:required
+ {-name Untitled}
+ {-context_id ""}
+ {-page_list ""}
+ {-owner_privileges {read write admin}}
+ {-theme default}
+ {-package_id ""}
+} {
+ Create a new page set for the passed in owner_id. create pages passed in
+ the page_list.
+
+ @owner_id The object (usually a party) which owns the new page set
+ @name The name of the page set
+ @context_id The new page set object's context_id (defaults to package_id)
+ @page_list The list of pages to create within the page set
+ @owner_privileges A list of privileges to grant the party on the new page set.
+ Normally the default list (read, write, admin) will be correct if the party
+ is a user but if the party is a group (say, members of a subsite) then it
+ would make sense to only grant read to the party directly.
+ @theme The theme to assign to this page set (unless copying from a template)
+ @package_id The package id of the owning package (defaults to ad_conn package_id)
+
+} {
+
+ if { [string equal $package_id ""] } {
+ set package_id [ad_conn package_id]
+ }
+
+ if { [string equal $context_id ""] } {
+ set context_id $package_id
+ }
+
+ db_transaction {
+
+ set var_list [subst {
+ {p_name "$name"}
+ {p_context_id $context_id}
+ {p_owner_id $owner_id}
+ {p_theme $theme}
+ {p_package_id $package_id}}]
+
+ set pageset_id [package_instantiate_object -var_list $var_list layout_pageset]
+
+ foreach privilege $owner_privileges {
+ permission::grant -party_id $owner_id -object_id $pageset_id -privilege $privilege
+ }
+
+ foreach page $page_list {
+ layout::page::new \
+ -pageset_id $pageset_id \
+ -name [lindex $page 0] \
+ -page_template [lindex $page 1]
+ }
+ }
+ db_flush_cache -cache_key_pattern pageset_id_${package_id}_${owner_id}*
+ return $pageset_id
+}
+
+ad_proc layout::pageset::delete {
+ -pageset_id:required
+} {
+ delete a page set
+} {
+ db_dml delete_permissions {}
+ db_exec_plsql delete_pageset {}
+ layout::pageset::flush -pageset_id $pageset_id
+}
+
+ad_proc -private layout::pageset::get {
+ -pageset_id:required
+} {
+ get page set info in "array get" format (not cached)
+} {
+ ns_cache eval db_cache_pool pageset_${pageset_id}_get {
+ db_1row select_pageset_info {} -column_array pageset
+ return [array get pageset]
+ }
+}
+
+ad_proc layout::pageset::get_column_value {
+ -pageset_id:required
+ -column:required
+} {
+ array set pageset [layout::pageset::get -pageset_id $pageset_id]
+ return $pageset($column)
+}
+
+ad_proc layout::pageset::get_pageset_id {
+ -package_id:required
+ -owner_id:required
+} {
+ Get a pageset_id.
+
+ @param package_id The package_id of the page set instance
+ @param owner_id The owner of the page set
+} {
+ return [db_string -cache_key pageset_id_${package_id}_$owner_id \
+ select_pageset_id {} -default 0]
+}
+
+ad_proc layout::pageset::get_user_pageset_id {
+ -package_id
+} {
+ Get the pageset_id for a user.
+
+ @param package_id The package_id of the page set instance (defaults to package_id)_
+ @return The pageset_id for the user or the master template pageset_id if personal
+ page sets are not enabled.
+} {
+
+ if { ![info exists package_id] } {
+ set package_id [ad_conn package_id]
+ }
+
+ if { [parameter::get -package_id $package_id -parameter CreatePrivatePageSets] } {
+ set owner_id [ad_conn user_id]
+ } else {
+ set owner_id 0
+ }
+
+ set pageset_id [layout::pageset::get_pageset_id -package_id $package_id -owner_id $owner_id]
+
+ if { $pageset_id == 0 } {
+ if { ![layout::pageset::initialized -package_id $package_id] } {
+ if { [permission::permission_p -object_id $package_id -privilege admin] } {
+ ad_returnredirect admin
+ ad_script_abort
+ } else {
+ ad_return_exception_template -params {{custom_message "The page set package hasn't been configured yet."}} /packages/acs-subsite/www/shared/report-error
+ }
+ }
+
+ # At this point we know we're supposed to create a personal page set
+
+ db_1row select_user_name {}
+
+ set master_template_id [layout::pageset::get_master_template_id -package_id $package_id]
+
+# DRB: this needs to be rewritten
+ set pageset_id [layout::pageset::new \
+ -owner_id $owner_id \
+ -name "Portal for $user_name" \
+ -template_id $master_template_id \
+ -context_id [ad_conn package_id] \
+ -initialize_elements]
+
+ }
+ return $pageset_id
+}
+
+ad_proc layout::pageset::set_values {
+ -pageset:required
+} {
+ set the fields of a page set
+} {
+ array set pageset_array $pageset
+ template::util::array_to_vars pageset_array
+ db_dml update_pageset {}
+ layout::pageset::flush -pageset_id $pageset_id
+}
+
+ad_proc layout::pageset::set_column_value {
+ -pageset_id:required
+ -column:required
+ -value:required
+} {
+ array set pageset [layout::pageset::get -pageset_id $pageset_id]
+ set pageset($column) $value
+
+ layout::pageset::set_values -pageset [array get pageset]
+}
+
+ad_proc layout::pageset::get_master_template_id {
+ -package_id
+} {
+ Get the master template id, i.e. the page set used to create all other page sets.
+
+ @param package_id The package_id of the page set instance (defaults to ad_conn package_id)
+ @return The pageset_id of the master page set template.
+
+} {
+
+ if { ![info exists package_id] } {
+ set package_id [ad_conn package_id]
+ }
+
+ if { [db_0or1row get_master_template_id {}] } {
+ return $master_template_id
+ } else {
+ return ""
+ }
+}
+
+
+ad_proc -public layout::pageset::get_page_count {
+ -pageset_id:required
+} {
+ Get the number of pages in this page set.
+
+ @param pageset_id The id of the page set.
+ @return The number of pages in the page set.
+} {
+ return [db_string select_page_count {}]
+}
+
+ad_proc layout::pageset::get_page_list {
+ -pageset_id:required
+} {
+ @return list of page_ids associated with the given page set (in sort_key order).
+} {
+ return [db_list select_page_ids {}]
+}
+
+ad_proc layout::pageset::get_render_data {
+ -pageset_id:required
+ {-page_num ""}
+} {
+ returns metadata needed to render a page set
+
+ @pageset_id The id of the page set you're interested in.
+ @page_num The page within the page set (defaults to page 0).
+
+ @return The page set metadata in array get format.
+} {
+ if { [string equal $page_num ""] } {
+ set page_num 0
+ }
+ ns_cache eval db_cache_pool pageset_${pageset_id}_get_render_data_$page_num {
+ # get the page set and layout
+ db_1row pageset_select {} -column_array pageset
+
+ array set theme [layout::theme::get -name $pageset(theme)]
+ set pageset(theme_template) $theme(template)
+
+ return [array get pageset]
+ }
+}
+
+ad_proc layout::pageset::configure_dispatch {
+ {-template_p f}
+ -pageset_id:required
+ -form:required
+} {
+ Dispatches the configuration operation.
+ We get the target page_column number from the op.
+
+ DRB: This is only kept for the revert code at the moment, i.e. until I
+ get time to move it to the configure template where it belongs. Also
+ the template (copy) stuff doesn't work.
+
+ @param pageset_id the page set to edit
+ @param formdata an ns_set with all the formdata
+} {
+
+ permission::require_permission -object_id $pageset_id -privilege write
+
+ set op [ns_set get $form op]
+
+ switch $op {
+ "Revert" {
+ db_transaction {
+ set template_id [layout::pageset::get_template_id -pageset_id $pageset_id]
+
+ # revert theme
+ set_theme -pageset_id $pageset_id -theme [layout::pageset::get_theme -pageset_id $template_id]
+
+ # revert pages
+ # first equalize number of pages in the target
+ set template_page_count [layout::pageset::get_page_count -pageset_id $template_id]
+ set target_page_count [layout::pageset::get_page_count -pageset_id $pageset_id]
+ set difference [expr $template_page_count - $target_page_count]
+
+ if {$difference > 0} {
+ # less pages in target
+ for {set x 0} {$x < $difference} {incr x} {
+
+ set name "page set revert dummy page $x"
+ layout::page::new \
+ -pageset_id $pageset_id \
+ -name $name \
+ }
+ } elseif {$difference < 0} {
+ # more pages in target, delete them from the end,
+ # putting any elements on them on the first page,
+ # we put them in the right place later
+ for {set x 0} {$x < [expr abs($difference)]} {incr x} {
+
+ set max_page_id [db_string revert_max_page_id_select {}]
+ set page_id [db_string revert_min_page_id_select {}]
+ set page_column 1
+
+ db_foreach revert_move_elements_for_del {} {
+ pageset::element::move_to_page \
+ -page_id $page_id \
+ -element_id $element_id \
+ -page_columncolumn 1
+ }
+
+ layout::page::delete -page_id $max_page_id
+ }
+ }
+
+ # now that they have the same number of pages, get to it
+ foreach source_page_id [layout::pageset::get_page_list -pageset_id $template_id] {
+
+ db_1row revert_get_source_page_info {}
+
+ set target_page_id [db_string revert_get_target_page_id {}]
+
+ db_dml revert_page_update {}
+
+ # revert elements in two steps like "swap"
+ db_foreach revert_get_source_elements {} {
+ # the element might not be on the target page...
+ set target_element_id \
+ [db_string revert_get_target_element {}]
+
+ db_dml revert_element_update {}
+ }
+ }
+ }
+ }
+ }
+}
+
+
+ad_proc -private layout::pageset::generate_action_string {
+} {
+ Portal configuration pages need this to set up
+ the target for the generated links. It's just the
+ current location with "-2" appended to the name of the
+ page.
+} {
+ return "[lindex [ns_conn urlv] [expr [ns_conn urlc] - 1]]-2"
+}
+
+ad_proc includelet_list {
+} {
+ Returns a list of page set includelets which have been mapped to the given page set
+ package instance.
+} {
+ set package_id [ad_conn package_id]
+ return [db_list_of_lists select_includelets {}]
+}
+
+ad_proc layout::pageset::initialized {
+ -package_id
+} {
+ @param package_id The package_id of this page set instance (default ad_conn package_id)
+ @return True if we've already initialized this instance of the page set package.
+} {
+ if { ![info exists package_id] } {
+ set package_id [ad_conn package_id]
+ }
+
+ return [expr {[layout::pageset::get_master_template_id -package_id $package_id] ne ""}]
+}
+
+ad_proc layout::pageset::initialize {
+ -package_id
+ {-page_list {{{Page 1} 2_column}}}
+} {
+ Initialize this instance of the page set package if we've not already done so. This
+ consists of creating the master template, which is assigned to party 0 and will be
+ the page set returned to users who aren't logged in, or all users if the page set package
+ is configured to disallow personal page sets.
+
+ @param package_id The page set instance we're initializing, default's to current package_id
+ @param page_list A list of lists of page titles and layouts to for the new user page set
+} {
+ if { ![info exists package_id] } {
+ set package_id [layout::package_id]
+ }
+
+ if { ![initialized -package_id $package_id] } {
+
+ # create the master template
+
+ set master_pageset_id [layout::pageset::new \
+ -name "Shared Page Set" \
+ -owner_id 0 \
+ -package_id $package_id \
+ -page_list $page_list \
+ -theme [parameter::get \
+ -package_id $package_id \
+ -parameter DefaultThemeName] \
+ -owner_privileges {}]
+ }
+}
+
+ad_proc layout::pageset::flush {
+ -pageset_id:required
+} {
+ Flush all cached data for this page set
+} {
+ db_flush_cache -cache_key_pattern pageset_${pageset_id}_*
+}
Index: openacs-4/packages/layout-manager/tcl/pageset-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/pageset-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/pageset-procs.xql 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,219 @@
+?xml version="1.0"?>
+
+
+
+
+
+ select ld.name, le.element_id
+ from layout_includelets ld, layout_elements le, layout_pages lp
+ where lp.pageset_id = :pageset_id
+ and le.page_id = lp.page_id
+ and ld.includelet_id = le.includelet_id
+
+
+
+
+
+ delete from acs_permissions
+ where object_id = :pageset_id
+
+
+
+
+
+ select *
+ from layout_pagesets
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select pageset_id
+ from layout_pagesets
+ where owner_id = :owner_id
+ and package_id = :package_id
+
+
+
+
+
+ select first_names || ' ' || last_name as user_name
+ from persons
+ where person_id = :owner_id
+
+
+
+
+
+ update layout_pagesets
+ set name = :name,
+ theme = :theme,
+ template_id = :template_id
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select layout_pagesets.name,
+ layout_pagesets.pageset_id,
+ layout_pagesets.theme,
+ layout_pages.page_id
+ from layout_pagesets, layout_pages
+ where layout_pagesets.pageset_id = :pageset_id
+ and layout_pages.sort_key = :page_num
+ and layout_pages.pageset_id = :pageset_id
+
+
+
+
+
+ select layout_pagesets.name,
+ layout_pagesets.pageset_id,
+ layout_pageset_layouts.template,
+ layout_pages.name as page_name,
+ layout_pages.layout_id as layout_id
+ from layout_pagesets, layout_page_templates, layout_pages
+ where layout_pages.pageset_id = :pageset_id
+ and layout_pages.page_id = :page_id
+ and layout_pages.pageset_id = layout_pagesets.pageset_id
+ and layout_pages.layout_id = pageset_layouts.layout_id
+
+
+
+
+
+ update layout_elements
+ set state = 'hidden'
+ where element_id = :element_id
+
+
+
+
+
+ select max(page_id)
+ from layout_pages
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select min(page_id)
+ from layout_pages
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select element_id
+ from layout_elements
+ where page_id = :max_page_id
+
+
+
+
+
+ select name, layout_id, sort_key
+ from layout_pages
+ where page_id = :source_page_id
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ and sort_key = :sort_key
+
+
+
+
+
+ update layout_pages
+ set name = :name,
+ layout_id = :layout_id
+ where page_id = :target_page_id
+
+
+
+
+
+ select layout_elements.page_column, layout_elements.sort_key, layout_elements.state,
+ layout_includelets.includelet_id, layout_includelets.name,
+ layout_elements.name as pretty_name
+ from layout_elements, layout_includelets
+ where layout_elements.page_id = :source_page_id
+ and layout_elements.includelet_id = layout_includelets.includelet_id
+
+
+
+
+
+ select layout_pages.element_id
+ from layout_elements, layout_pages
+ where layout_pages.pageset_id = :pageset_id
+ and layout_elements.page_id = layout_pages.page_id
+ and layout_elements.includelet_id = :includelet_id
+ and layout_elements.name = :name
+
+
+
+
+
+ update layout_elements
+ set page_column = :page_column,
+ sort_key = :sort_key,
+ state = :state,
+ page_id = :target_page_id
+ where element_id = :target_element_id
+
+
+
+
+
+ select pageset_id as master_template_id
+ from layout_pagesets
+ where package_id = :package_id
+ and owner_id = 0
+
+
+
+
+
+ select count(*)
+ from layout_pages
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ order by sort_key
+
+
+
+
+
+ select name, sort_key as page_num
+ from layout_pages
+ where pageset_id = :pageset_id
+ order by sort_key
+
+
+
+
+
+ select theme
+ from layout_pagesets
+ where pageset_id = :pageset_id
+
+
+
+
Index: openacs-4/packages/layout-manager/tcl/template-tag-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/template-tag-init.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/template-tag-init.tcl 22 Jul 2008 07:31:03 -0000 1.1
@@ -0,0 +1,81 @@
+ad_library {
+
+ Implement custom layout manager template tags
+
+ @creation-date 2008-07-11
+ @version $Id: template-tag-init.tcl,v 1.1 2008/07/22 07:31:03 donb Exp $
+
+}
+
+# Include an includelet, passing a reference parameter to an array get list as a
+# list of parameters to the includelet. This allows a general-purpose template which
+# takes a set of parameters to be called directly as a layout manager includelet as
+# well as by the normal mechanism
+
+# Usage:
+
+# Note: if you're not implementing the layout-manager's render-element template, you
+# probably don't want to use this tag.
+
+template_tag layout_includelet { params } {
+
+ if { [ns_set size $params] > 2 } {
+ error "LAYOUT_INCLUDELET tag has too many parameters"
+ }
+
+ set src [ns_set iget $params src]
+
+ #Start developer support frame around subordinate template.
+ if { [llength [info procs ::ds_enabled_p]] && [llength [info procs ::ds_adp_start_box]] } {
+ ::ds_adp_start_box -stub "\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]"
+ }
+
+ set command "template::adp_parse"
+ append command " \[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]"
+
+ # We accept one reference parameter along with the src parameter. We'll pass the
+ # runtime (NOT compile time) value of that parameter as the list of parameters to
+ # the template. This has the effect of transforming the layout manager's configuration
+ # array (kept for backwards compatibility with .LRN portlets) into a set of parameters
+ # (for compatibility with "normal" library templates).
+
+ for { set i 0 } { $i < [ns_set size $params] } { incr i } {
+ set key [ns_set key $params $i]
+ if {$key eq "src"} {
+ continue
+ } elseif { $key ne "&" } {
+ error "LAYOUT_INCLUDELET tag requires a src parameter and one reference parameter"
+ }
+ set __config [ns_set value $params $i]
+ append command " \$$__config"
+ }
+
+ # Everything from here on down is poached from the include tag code.
+ # We explicitly test for ad_script_abort, so we don't dump that as an error, and don't catch it, either
+ # (We do catch it, but then we re-throw it)
+ template::adp_append_code "if { \[catch { append __adp_output \[$command\] } errmsg\] } {"
+ template::adp_append_code " global errorInfo errorCode"
+ template::adp_append_code " if { \[string equal \[lindex \$errorCode 0\] \"AD\"\] && \[string equal \[lindex \$errorCode 1\] \"EXCEPTION\"\] && \[string equal \[lindex \$errorCode 2\] \"ad_script_abort\"\] } {"
+ template::adp_append_code " ad_script_abort"
+ template::adp_append_code " } else {"
+ template::adp_append_code " append __adp_output \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\""
+ # JCD: If we have the ds_page_bits cache maybe save the error for later
+ if { [llength [info procs ::ds_enabled_p]] && [llength [info procs ::ds_page_fragment_cache_enabled_p]] } {
+ template::adp_append_code " if {\[::ds_enabled_p\]"
+ template::adp_append_code " && \[::ds_collection_enabled_p\] } {"
+ template::adp_append_code " set __include_errors {}"
+ template::adp_append_code " ns_cache get ds_page_bits \[ad_conn request\]:error __include_errors"
+ template::adp_append_code " ns_cache set ds_page_bits \[ad_conn request\]:error \[lappend __include_errors \[list \"$src\" \$errorInfo\]\]"
+ template::adp_append_code " }"
+ }
+ template::adp_append_code " ns_log Error \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\n\$errorInfo\""
+ template::adp_append_code " }"
+ template::adp_append_code "}"
+
+ #End developer support frame around subordinate template.
+ if { [llength [info procs ::ds_enabled_p]] && [llength [info procs ::ds_adp_end_box]] } {
+ ::ds_adp_end_box -stub "\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]"
+ }
+
+ }
+
Index: openacs-4/packages/layout-manager/tcl/theme-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/theme-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/theme-procs.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,61 @@
+ad_library {
+
+ Layout Manager Theme Procs
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2008-07-05
+ @version $Id: theme-procs.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+
+}
+
+namespace eval layout::theme {}
+
+# We make no provision for flushing cached theme queries at the
+# present time because once defined, they never change.
+
+ad_proc layout::theme::new {
+ -name:required
+ {-description ""}
+ -template:required
+} {
+ Create a new layout theme, which is just a master template which surrounds its
+ slave with a bit of decoration.
+
+ @param name The name of the theme, which must be unique.
+ @param description An optional description of the theme.
+ @param template The path (/packages/...) of the template.
+} {
+ db_dml insert_theme {}
+}
+
+ad_proc layout::theme::delete {
+ {-name:required}
+} {
+ db_dml delete_theme {}
+ layout::theme::flush -name $name
+}
+
+ad_proc layout::theme::get {
+ -name:required
+} {
+ ns_cache eval db_cache_pool theme_${name}_get {
+ db_1row select_theme {} -column_array theme
+ return [array get theme]
+ }
+}
+
+ad_proc layout::theme::get_column_value {
+ -name:required
+ -column:required
+} {
+ array set theme [layout::theme::get -name $name]
+ return $theme($column)
+}
+
+ad_proc layout::theme::flush {
+ -name:required
+} {
+ Flush all cached data for this page set
+} {
+ db_flush_cache -cache_key_pattern theme_${name}_*
+}
Index: openacs-4/packages/layout-manager/tcl/theme-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/tcl/theme-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/theme-procs.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ insert into layout_themes
+ (name, description, template)
+ values
+ (:name, :description, :template)
+
+
+
+
+
+ delete from layout_themes
+ where name = :name
+
+
+
+
+
+ select *
+ from layout_themes
+ where name = :name
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/tcl/test/layout-manager-test-procs.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,273 @@
+ad_library {
+ Tests for the layout manager
+}
+
+# More element-procs tests
+# Add theme-procs tests
+# Add element-parameters-procs tests
+# Add layout-procs tests
+
+# We iterate through tests in an attempt to catch caching problems
+
+aa_register_case -cats {api smoke} themes {
+ Test the themes API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+
+ for { set i 1 } { $i <= 3 } { incr i } {
+ layout::theme::new \
+ -name fake_theme \
+ -description "Fake Theme" \
+ -template fake_theme
+ aa_log "Pass $i: new"
+
+ layout::theme::delete -name fake_theme
+ aa_log "Pass $i: delete"
+
+ aa_log_result pass "pass $i: theme tests ran without failure"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} datasources {
+ Test the includelets API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+ for { set i 1 } { $i <= 3 } { incr i } {
+ layout::datasource::new \
+ -name fake_datasource \
+ -description "Fake datasource" \
+ -package_key layout-manager
+ aa_log "Pass $i: new"
+ layout::datasource::delete \
+ -name fake_datasource
+ aa_log "Pass $i: delete"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} includelets {
+ Test the includelets API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+
+ for { set i 1 } { $i <= 3 } { incr i } {
+ layout::datasource::new \
+ -name fake_datasource \
+ -description "Fake datasource" \
+ -package_key layout-manager
+ layout::includelet::new \
+ -name fake_includelet \
+ -description "Fake Includelet" \
+ -title "Fake Includelet" \
+ -datasource fake_datasource \
+ -template fake
+ aa_log "Pass $i: new"
+
+ layout::includelet::delete -name fake_includelet
+ aa_log "Pass $i: delete"
+ layout::datasource::delete \
+ -name fake_datasource
+
+ aa_log_result pass "pass $i: includelet tests ran without failure"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} pagesets {
+ Test the page sets API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+
+ for { set i 1 } { $i <= 3 } { incr i } {
+ set pageset_id \
+ [layout::pageset::new -package_id [ad_conn package_id] -name Untitled -owner_id 0]
+ aa_true "Pass $i: new" [exists_and_not_null pageset_id]
+
+ array set t [layout::pageset::get -pageset_id $pageset_id]
+ aa_true "Pass $i: get" { $t(pageset_id) ne "" }
+
+ set get_pageset_id [layout::pageset::get_pageset_id \
+ -package_id [ad_conn package_id] -owner_id 0]
+ aa_equals "Pass $i: get_pageset_id" $pageset_id $get_pageset_id
+
+ set name [layout::pageset::get_column_value -pageset_id $pageset_id -column name]
+ aa_equals "Pass $i: get name" $name Untitled
+
+ layout::pageset::set_column_value \
+ -pageset_id $pageset_id \
+ -column name \
+ -value Titled
+ aa_equals "Pass $i: set name (and therefore set_values)" \
+ [layout::pageset::get_column_value -pageset_id $pageset_id -column name] Titled
+
+ layout::pageset::delete -pageset_id $pageset_id
+ aa_log "Pass $i: delete"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} pages {
+ Test the pages API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+
+ for { set i 1 } { $i <= 3 } { incr i } {
+ 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]
+ aa_true "Pass $i: new" [exists_and_not_null page_id]
+
+ array set t [layout::page::get -page_id $page_id]
+ aa_true "Pass $i: get" { $t(page_id) ne "" }
+
+ aa_equals "Pass $i: get name" \
+ [layout::page::get_column_value -page_id $page_id -column name] test
+
+ layout::page::set_column_value \
+ -page_id $page_id \
+ -column name \
+ -value tested
+ aa_equals "Pass $i: set name (and therefore set_values)" \
+ [layout::page::get_column_value -page_id $page_id -column name] tested
+
+ aa_equals "Pass $i: get page template name" \
+ [layout::page::get_column_value -page_id $page_id -column page_template] \
+ 2_column
+
+ aa_equals "Pass $i: get_pageset_id" \
+ [layout::page::get_column_value -page_id $page_id -column pageset_id] $pageset_id
+
+ array set page [layout::page::get_render_data -page_id $page_id]
+ aa_true "Pass $i: get_render_data" \
+ {$page(element_list) eq "" &&
+ $page(template) ne ""}
+
+ layout::page::delete -page_id $page_id
+ layout::pageset::delete -pageset_id $pageset_id
+ aa_log "Pass $i: delete"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} elements {
+ Test the elements API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+ for { set i 1 } { $i <= 3 } { incr i } {
+ 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 \
+ -package_id [ad_conn package_id] \
+ -page_name test -includelet_name subsites_includelet \
+ -name test -title Test]
+ aa_true "Pass $i: new" [exists_and_not_null element_id]
+
+ aa_equals "Pass $i: get name" \
+ [layout::element::get_column_value -element_id $element_id -column name] test
+
+ aa_equals "Pass $i: get title" \
+ [layout::element::get_column_value -element_id $element_id -column title] Test
+
+ aa_true "Pass $i: get page column" \
+ { [layout::element::get_column_value -element_id $element_id -column page_column] > 0 }
+
+ layout::element::set_column_value \
+ -element_id $element_id \
+ -column name \
+ -value tested
+ aa_equals "Pass $i: set name (and therefore set_values)" \
+ [layout::element::get_column_value -element_id $element_id -column name] tested
+
+ array set element [layout::element::get_render_data -element_id $element_id]
+ aa_true "Pass $i: get_render_data" \
+ { $element(template_path) ne "" &&
+ $element(state) eq "full" && $element(page_id) ne "" &&
+ $element(includelet_name) eq "subsites_includelet" &&
+ [llength $element(config)] == 4 && $element(element_id) ne "" &&
+ $element(theme_template) ne "" && $element(sort_key) == 1 &&
+ $element(name) eq "tested" && $element(page_column) == 1 &&
+ $element(title) eq "Test" && $element(theme) eq "default" &&
+ $element(required_privilege) eq "read" }
+
+ layout::element::delete -element_id $element_id
+ layout::page::delete -page_id $page_id
+ layout::pageset::delete -pageset_id $pageset_id
+ aa_log "Pass $i: delete"
+ }
+ }
+}
+
+aa_register_case -cats {api smoke} element_parameters {
+ Test the element parameterss API
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+ for { set i 1 } { $i <= 3 } { incr i } {
+ 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 \
+ -package_id [ad_conn package_id] \
+ -page_name test -includelet_name subsites_includelet \
+ -name test -title Test]
+ layout::element::parameter::add_values \
+ -element_id $element_id \
+ -parameters {p1 v1 p2 v2}
+
+ aa_equals "Pass $i: get p1" \
+ [layout::element::parameter::get -element_id $element_id -key p1] v1
+
+ aa_equals "Pass $i: get p2" \
+ [layout::element::parameter::get -element_id $element_id -key p2] v2
+
+ layout::element::parameter::add_values \
+ -element_id $element_id \
+ -parameters {p2 vv2}
+ aa_true "Pass $i: get p2 p2" \
+ { [llength [layout::element::parameter::get -element_id $element_id -key p2]] == 2 }
+
+ layout::element::parameter::delete \
+ -element_id $element_id \
+ -key p2 \
+ -value v2
+ aa_equals "Pass $i: delete p2 v2" \
+ [layout::element::parameter::get -element_id $element_id -key p2] vv2
+
+ layout::element::parameter::add_values \
+ -element_id $element_id \
+ -parameters {p2 vv2}
+ layout::element::parameter::set_values \
+ -element_id $element_id \
+ -parameters {p2 v2}
+ aa_equals "Pass $i: /new/setvalues/get p2" \
+ [layout::element::parameter::get -element_id $element_id -key p2] v2
+
+
+ layout::element::parameter::delete \
+ -element_id $element_id \
+ -key p1
+ layout::element::parameter::delete \
+ -element_id $element_id \
+ -key p2
+ layout::element::delete -element_id $element_id
+ layout::page::delete -page_id $page_id
+ layout::pageset::delete -pageset_id $pageset_id
+ aa_log "Pass $i: delete"
+ }
+ }
+}
Index: openacs-4/packages/layout-manager/www/add-applications.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/add-applications.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/add-applications.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ select count(*) as portal_count
+ from portals
+ where portal_id = :portal_id
+
+
+
+
+
Index: openacs-4/packages/layout-manager/www/add-datasources-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/add-datasources-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/add-datasources-2.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+
+ Add one or more datasources to this instance of the portals package
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: add-datasources-2.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+
+} {
+ datasource:multiple
+ return_url:notnull,optional
+ pageset_id:integer,notnull
+}
+
+permission::require_permission -object_id $pageset_id -privilege admin
+set package_id [db_1row get_package_id {}]
+set node_id [site_node::get_node_id_from_object_id -object_id $package_id]
+
+set added_datasources [list]
+
+db_transaction {
+ foreach one_datasource $datasource {
+
+ # For some reason I'm getting dupes in my datasource list from the checkboxes
+ # set up by the list widget on the previous page.
+
+ if { [lsearch -exact $added_datasources $one_datasource] == -1 } {
+
+ lappend added_datasources $one_datasource
+
+ set package_id [layout::datasource::construct \
+ -name $one_datasource \
+ -node_id [ad_conn node_id] \
+ -package_key [layout::datasource::get_column_value \
+ -name $one_datasource \
+ -column package_key]]
+
+ set user_includelets [db_list get_user_includelets {}]
+
+ foreach user_includelet $user_includelets {
+ layout::element::new \
+ -pageset_id $pageset_id \
+ -state hidden \
+ -includelet_name $user_includelet \
+ -package_id $package_id \
+ -initialize
+ }
+ }
+ }
+}
+
+if { [info exists return_url] } {
+ ad_returnredirect $return_url
+}
Index: openacs-4/packages/layout-manager/www/add-datasources-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/add-datasources-2.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/add-datasources-2.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ select package_id
+ from layout_pagesets
+ where pageset_id = :pageset_id
+
+
+
+
+
+ select name
+ from layout_includelets
+ where datasource = :one_datasource
+
+
+
+
Index: openacs-4/packages/layout-manager/www/add-datasources.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/add-datasources.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/add-datasources.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,6 @@
+
+ Add datasources and their includelets
+ @context;noquote@
+
+
+
Index: openacs-4/packages/layout-manager/www/add-datasources.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/add-datasources.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/add-datasources.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,18 @@
+ad_page_contract {
+
+ Generate a list of applications that have supporting includelets that have not
+ yet been added to this portal package instance.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: add-datasources.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ pageset_id:notnull,integer
+ return_url:notnull
+}
+
+permission::require_permission -object_id $pageset_id -privilege admin
+
+set context [list "Add Applications"]
+
+ad_return_template
Index: openacs-4/packages/layout-manager/www/configure-element.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/configure-element.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/configure-element.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,20 @@
+ad_page_contract {
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 1/12/2004
+ @cvs_id $Id: configure-element.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ element_id:integer
+ op:notnull
+}
+
+permission::require_permission \
+ -party_id [ad_conn user_id] \
+ -object_id [layout::page::get_pageset_id \
+ -page_id [portal::element::get_page_id -element_id $element_id]] \
+ -privilege write
+
+portal::element::configure \
+ -element_id $element_id \
+ -op $op \
+ -return_url [get_referrer]
Index: openacs-4/packages/layout-manager/www/edit-element.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/edit-element.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/edit-element.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,4 @@
+
+ Edit Element
+ @context@
+
Index: openacs-4/packages/layout-manager/www/edit-element.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/edit-element.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/edit-element.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,38 @@
+ad_page_contract {
+
+ Edit the theme and title of an includelet.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: edit-element.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ pageset_id:integer,notnull
+ element_id:integer,notnull
+ return_url:notnull
+}
+
+permission::require_permission -object_id $pageset_id -privilege write
+
+set context [list "Edit Element"]
+
+set themes [concat [list [list "" ""]] [db_list_of_lists select_themes {}]]
+
+ad_form -export {pageset_id element_id return_url} -form {
+ {title:text,optional {label "Title"}}
+ {theme:text(select),optional
+ {label "Theme"}
+ {options $themes}}
+} -on_request {
+ set title [layout::element::get_column_value -element_id $element_id -column title]
+ set theme [layout::element::get_column_value -element_id $element_id -column theme]
+} -on_submit {
+
+ layout::element::set_column_value -element_id $element_id -column title -value $title
+ layout::element::set_column_value -element_id $element_id -column theme -value $theme
+ layout::element::flush -element_id $element_id
+
+ ad_returnredirect $return_url
+ ad_script_abort
+
+}
+ad_return_template
Index: openacs-4/packages/layout-manager/www/edit-element.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/edit-element.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/edit-element.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ select description, name
+ from layout_themes
+ order by description
+
+
+
+
Index: openacs-4/packages/layout-manager/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/index.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+@page_num@
+@pageset_id@
+
+
Index: openacs-4/packages/layout-manager/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/index.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,41 @@
+ad_page_contract {
+
+ Displays the given page set if specified. Otherwise, figure out the proper page set
+ to display based on the CreatePrivatePagesets parameter, creating the user's
+ personal paget set if necessary.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2004-01-02
+ @version $Id: index.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+
+} {
+ {page_num:integer,optional 0}
+ {pageset_id:integer,optional ""}
+}
+
+# This is a kludge for the rp_internal_indirect case, and will fail if more than one
+# layout-manager instance is mounted under the current subsite. There's gotta be a
+# better way, but gotta think this through, first!
+
+if { [ad_conn package_id] == [ad_conn subsite_id] } {
+ set package_id [site_node::get_children -node_id [ad_conn subsite_node_id] \
+ -package_key layout-manager -element object_id]
+} else {
+ set package_id [ad_conn package_id]
+}
+
+set master_template [parameter::get -package_id $package_id -parameter OurMasterTemplate]
+if { $master_template eq "" } {
+ set master_template [parameter::get -package_id [ad_conn subsite_id] \
+ -parameter DefaultMaster]
+}
+
+if { [string equal $pageset_id ""] } {
+ set pageset_id [layout::pageset::get_user_pageset_id -package_id $package_id]
+}
+
+permission::require_permission -privilege read -object_id $pageset_id
+set edit_p [permission::permission_p -object_id $pageset_id -privilege write]
+
+ad_return_template
+
Index: openacs-4/packages/layout-manager/www/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/index.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/index.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ select name, sort_key as page_num, portal_id
+ from portal_pages
+ where portal_id = :user_portal_id
+ order by sort_key
+
+
+
+
+
+
+ select name, 0 as page_num, portal_id
+ from portals
+ where owner_id = :package_id
+
+
+
+
Index: openacs-4/packages/layout-manager/www/pageset-configure-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/Attic/pageset-configure-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/pageset-configure-2.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,127 @@
+ad_page_contract {
+ Do the actual moving/removing of the elements, or redirect to add.
+
+ @author Don Baccus
+ @creation-date 2/26/2004
+ @cvs_id $Id: pageset-configure-2.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ pageset_id:integer,notnull
+ page_id:integer,optional
+ element_id:integer,optional
+ theme:optional
+ page_theme:optional
+ page_template:optional
+ name:notnull,optional
+ op:notnull
+ return_url:notnull
+ {anchor ""}
+}
+
+permission::require_permission -object_id $pageset_id -privilege write
+
+switch $op {
+
+ move_up {
+ layout::element::move \
+ -page_id $page_id \
+ -element_id $element_id \
+ -direction up
+ }
+
+ move_down {
+ layout::element::move \
+ -page_id $page_id \
+ -element_id $element_id \
+ -direction down
+ }
+
+ move_left {
+ layout::element::move \
+ -page_id $page_id \
+ -element_id $element_id \
+ -direction left
+ }
+
+ move_right {
+ layout::element::move \
+ -page_id $page_id \
+ -element_id $element_id \
+ -direction right
+ }
+
+ show_here {
+ db_transaction {
+ layout::element::move_to_page \
+ -page_id $page_id \
+ -element_id $element_id \
+ -page_column 1
+ layout::element::set_column_value \
+ -element_id $element_id \
+ -column state \
+ -value full
+ }
+ }
+
+ move_to_page {
+ layout::element::move_to_page \
+ -page_id $page_id \
+ -element_id $element_id \
+ -page_column 1
+ }
+
+ hide {
+ layout::element::set_column_value \
+ -element_id $element_id \
+ -column state \
+ -value hidden
+ }
+
+ change_theme {
+ layout::pageset::set_column_value \
+ -pageset_id $pageset_id \
+ -column theme \
+ -value $theme
+ }
+
+ change_page_theme {
+ layout::page::set_column_value \
+ -page_id $page_id \
+ -column theme \
+ -value $page_theme
+ }
+
+ add_page {
+ layout::page::new -pageset_id $pageset_id -name $name
+ }
+
+ remove_page {
+ layout::page::delete -page_id $page_id
+ }
+
+ change_page_template {
+ layout::page::set_column_value \
+ -page_id $page_id \
+ -column page_template \
+ -value $page_template
+ }
+
+ rename_page {
+ layout::page::set_column_value -page_id $page_id -column name -value $name
+ }
+
+ default {
+ ad_return_complaint 1 "\"$op\" is not a valid operator for portal configuration"
+ }
+}
+
+# Flush the world.
+
+layout::pageset::flush -pageset_id $pageset_id
+if { [exists_and_not_null page_id] } {
+ layout::page::flush -page_id $page_id
+}
+if { [exists_and_not_null element_id] } {
+ layout::element::flush -element_id $element_id
+}
+
+ad_returnredirect $return_url
Index: openacs-4/packages/layout-manager/www/pageset-configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/pageset-configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/pageset-configure.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,4 @@
+
+ @title;noquote@
+ @context;noquote@
+
Index: openacs-4/packages/layout-manager/www/pageset-configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/pageset-configure.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/pageset-configure.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,17 @@
+ad_page_contract {
+
+ Configure a portal
+
+ @author Don Baccus (dhogaza@pacifier.com)
+
+} {
+ pageset_id:integer,notnull
+}
+
+permission::require_permission -object_id $pageset_id -privilege write
+
+set title "Configure"
+set context [list $title]
+set return_url [ad_conn url]?[ad_conn query]
+
+ad_return_template
Index: openacs-4/packages/layout-manager/www/pageset-configure.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/pageset-configure.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/pageset-configure.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ select theme_id, name || ' - ' || description as name
+ from layout_themes
+ order by name
+
+
+
+
+
+ select element_id, pe.name
+ from layout_elements pe, layout_pages pp
+ where pp.pageset_id = :pageset_id
+ and pp.page_id = pe.page_id
+ and pe.state = 'hidden'
+ order by pe.name
+
+
+
+
+
+ select page_id
+ from layout_pages
+ where pageset_id = :pageset_id
+ order by sort_key
+
+
+
+
Index: openacs-4/packages/layout-manager/www/admin/configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/configure.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,4 @@
+
+@title;noquote@
+@context;noquote@
+
Index: openacs-4/packages/layout-manager/www/admin/configure.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/configure.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/configure.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,34 @@
+ad_page_contract {
+
+ Main configuration page for the layout manager package. Defines the configuration
+ wizard and tracks state.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: configure.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+}
+
+layout::pageset::initialize
+
+# Now set up the wizard and off we go into configuration ecstasy!
+
+template::wizard::create -action configure -name configure -params {} -steps {
+ 1 -label "Welcome to the Layout Manager Configuration Wizard" -url /packages/layout-manager/lib/configure-help
+ 2 -label "Configure Private Page Sets" -url /packages/layout-manager/lib/configure-private-pagesets
+ 3 -label "Configure User Control Over Appearance" -url /packages/layout-manager/lib/configure-configurability
+ 4 -label "Add Datasources" -url /packages/layout-manager/lib/add-datasources
+ 5 -label "Configure Master Page Set Layout" -url /packages/layout-manager/lib/pageset-configure
+ 6 -label "Configure Subsite Integration" -url /packages/layout-manager/lib/configure-subsite-integration
+ 100 -label "Congratulations! Configuration Is Complete" -url /packages/layout-manager/lib/configure-finish
+}
+
+template::wizard::get_current_step
+
+# Beautify the context bar and title with the current wizard step's label.
+
+array set current_info [array get wizard:${wizard:current_id}]]
+set title $current_info(label)
+set context [list $title]
+
+ad_return_template
Index: openacs-4/packages/layout-manager/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/index.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,6 @@
+
+Configuration
+@context;noquote@
+
+
+
Index: openacs-4/packages/layout-manager/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/index.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2001, 2002 MIT
+#
+# This file is part of dotLRN.
+#
+# dotLRN is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+
+ad_page_contract {
+
+ Main administration page for the layout manager package
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: index.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} { }
+
+if { ![layout::pageset::initialized] } {
+ ad_returnredirect configure
+ ad_script_abort
+}
+
+set context [list Admin]
+
+ad_return_template
Index: openacs-4/packages/layout-manager/www/admin/pageset-admin-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/pageset-admin-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/pageset-admin-master.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,9 @@
+
+
+
+Portal: @name@
+
+Go back
+
+
+
Index: openacs-4/packages/layout-manager/www/admin/pageset-show.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/pageset-show.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/pageset-show.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,6 @@
+
+ @referer;noquote@
+ @name;noquote@
+ @navbar;noquote@
+
Index: openacs-4/packages/layout-manager/www/admin/pageset-show.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/pageset-show.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/pageset-show.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,17 @@
+ad_page_contract {
+ Just a test script to display the pageset.
+
+ @author AKS
+ @creation-date
+ @cvs-id $Id: pageset-show.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ {referer:notnull}
+ {pageset_id:naturalnum,notnull}
+ {page_num 0}
+}
+
+set name [layout::pageset::get_column_value -pageset_id $pageset_id -column name]
+array set pageset [layout::pageset::get_render_data -pageset_id $pageset_id -page_num $page_num]
+
+ad_return_template
+
Index: openacs-4/packages/layout-manager/www/admin/portal-admin-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/portal-admin-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/portal-admin-master.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,27 @@
+<%
+ #
+ # Copyright (C) 2001, 2002 MIT
+ #
+ # This file is part of dotLRN.
+ #
+ # dotLRN is free software; you can redistribute it and/or modify it under the
+ # terms of the GNU General Public License as published by the Free Software
+ # Foundation; either version 2 of the License, or (at your option) any later
+ # version.
+ #
+ # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ # details.
+ #
+%>
+
+
+
+
+Portal: @name@
+
+Go back
+
+
+
Index: openacs-4/packages/layout-manager/www/admin/portal-show.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/portal-show.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/portal-show.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,6 @@
+
+ @referer;noquote@
+ @name;noquote@
+ @navbar;noquote@
+
Index: openacs-4/packages/layout-manager/www/admin/portal-show.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/portal-show.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/portal-show.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2001, 2002 MIT
+#
+# This file is part of dotLRN.
+#
+# dotLRN is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+
+# www/show-portal.tcl
+
+ad_page_contract {
+ Just a test script to display the portal.
+
+ @author AKS
+ @creation-date
+ @cvs-id $Id: portal-show.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} {
+ {referer:notnull}
+ {portal_id:naturalnum,notnull}
+ {page_num 0}
+}
+
+set name [portal::get_name -portal_id $portal_id]
+array set portal [portal::get_render_data -portal_id $portal_id -page_num $page_num]
+set navbar [portal::navbar -portal_id $portal_id]
+
+ad_return_template
+
Index: openacs-4/packages/layout-manager/www/admin/user-portals.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/user-portals.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/user-portals.adp 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,16 @@
+
+Welcome to the Layout Manager
+
+
+ There are no personal pagesets in the system.
+
+
+ Pagesets in the system:
+
+
+
Index: openacs-4/packages/layout-manager/www/admin/user-portals.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/user-portals.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/user-portals.tcl 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2001, 2002 MIT
+#
+# This file is part of dotLRN.
+#
+# dotLRN is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+
+ad_page_contract {
+ Page that displays a system-wide list of portals and gives
+ the option to view or edit them
+
+ @author Arjun Sanyal (arjun@openforce.net)
+ @creation-date
+ @cvs-id $Id: user-portals.tcl,v 1.1 2008/07/22 07:31:04 donb Exp $
+} { }
+
+set package_id [ad_conn package_id]
+db_multirow portals get_portals {}
+
+ad_return_template
Index: openacs-4/packages/layout-manager/www/admin/user-portals.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/admin/Attic/user-portals.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/admin/user-portals.xql 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ select pageset_id, name
+ from layout_pagesets
+ where package_id = :package_id
+ and template_id is not null
+
+
+
+
Index: openacs-4/packages/layout-manager/www/resources/images/arrow-down.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/arrow-down.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/images/arrow-left.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/arrow-left.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/images/arrow-right.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/arrow-right.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/images/arrow-up.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/arrow-up.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/images/delete.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/delete.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/images/goback.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/images/goback.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/page-templates/1_column.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/page-templates/1_column.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/resources/page-templates/1_column.css 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,26 @@
+#sidebar-1 {
+ float: left;
+ width: 100%;
+}
+
+#main-content {
+ float: left;
+ width: 100%;
+}
+
+#sidebar-2 {
+ float: left;
+ width: 100%;
+}
+
+.main-content-padding {
+ padding: 0px 5px;
+}
+
+.sidebar-1-padding {
+ padding: 0px 5px;
+}
+
+.sidebar-2-padding {
+ padding: 0px 5px;
+}
\ No newline at end of file
Index: openacs-4/packages/layout-manager/www/resources/page-templates/2_column.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/page-templates/2_column.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/resources/page-templates/2_column.css 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,26 @@
+ #sidebar-1 {
+ float: left;
+ width: 49%;
+}
+
+#main-content {
+ float: right;
+ width: 50%;
+}
+
+#sidebar-2 {
+ float: left;
+ width: 49%;
+}
+
+.main-content-padding {
+ padding-right: 5px
+}
+
+.sidebar-1-padding {
+ padding-left: 5px;
+}
+
+.sidebar-2-padding {
+ padding-left: 5px;
+}
\ No newline at end of file
Index: openacs-4/packages/layout-manager/www/resources/page-templates/3_column.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/page-templates/3_column.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/resources/page-templates/3_column.css 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,32 @@
+#main {
+ float: left;
+ width: 66%;
+}
+
+#sidebar-1 {
+ float: left;
+ width: 49%;
+}
+
+#main-content {
+ float: right;
+ width: 50%;
+}
+
+#sidebar-2 {
+ float: right;
+ width: 33%;
+}
+
+.main-content-padding {
+ padding-right: 0px
+}
+
+.sidebar-1-padding {
+ padding-left: 5px;
+}
+
+.sidebar-2-padding {
+ padding-left: 0px;
+ padding-right: 5px;
+}
\ No newline at end of file
Index: openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick.css 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,26 @@
+#sidebar-1 {
+ float: left;
+ width: 33%;
+}
+
+#main-content {
+ float: right;
+ width: 66%;
+}
+
+#sidebar-2 {
+ float: left;
+ width: 33%;
+}
+
+.main-content-padding {
+ padding-right: 5px
+}
+
+.sidebar-1-padding {
+ padding-left: 5px;
+}
+
+.sidebar-2-padding {
+ padding-left: 5px;
+}
\ No newline at end of file
Index: openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick_thin.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick_thin.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/layout-manager/www/resources/page-templates/thin_thick_thin.css 22 Jul 2008 07:31:04 -0000 1.1
@@ -0,0 +1,32 @@
+#main {
+ float: left;
+ width: 75%;
+}
+
+#sidebar-1 {
+ float: left;
+ width: 33%;
+}
+
+#main-content {
+ float: right;
+ width: 66%;
+}
+
+#sidebar-2 {
+ float: right;
+ width: 24%;
+}
+
+.main-content-padding {
+ padding-right: 0px
+}
+
+.sidebar-1-padding {
+ padding-left: 5px;
+}
+
+.sidebar-2-padding {
+ padding-left: 0px;
+ padding-right: 5px;
+}
\ No newline at end of file
Index: openacs-4/packages/layout-manager/www/resources/themes/standard-theme/shade.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/themes/standard-theme/shade.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/themes/standard-theme/unshade.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/themes/standard-theme/unshade.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/layout-manager/www/resources/themes/standard-theme/x.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/layout-manager/www/resources/themes/standard-theme/x.gif,v
diff -u
Binary files differ