Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v
diff -u -r1.69 -r1.70
--- openacs-4/packages/new-portal/tcl/portal-procs.tcl 19 Nov 2001 16:46:31 -0000 1.69
+++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 21 Nov 2001 18:33:17 -0000 1.70
@@ -81,7 +81,11 @@
# Main portal procs
#
- ad_proc -public create {user_id {layout_name "'Simple 2-Column'"}} {
+ ad_proc -public create {
+ {-portal_template_p "f"}
+ {-layout_name "'Simple 2-Column'"}
+ user_id
+ } {
Create a new portal for the passed in user id.
@return The newly created portal's id
@@ -552,7 +556,314 @@
}
+ #
+ # portal template procs - util and configuration
+ #
+ ad_proc -private template_p { portal_id } {
+ Check if a portal is a portal template and not a user poral
+ } {
+ if { [db_0or1row template_p_select "select 1 from portals where portal_template_p = 't' and portal_id = :portal_id"] } {
+ return 1
+ } else {
+ return 0
+ }
+ }
+
+ ad_proc -public template_configure { portal_id } {
+ Return a portal configuration page.
+ All form targets point to file_stub-2.
+ @param portal_id
+ @return A portal configuration page
+ } {
+
+ # If this is not a portal_template
+ if { ! [template_p $portal_id] } {
+ ad_return_complaint 1 "This is not a portal template, sorry!"
+ }
+
+ ad_require_permission $portal_id portal_admin_portal
+
+ # Set up some template vars, including the form target
+ set master_template [ad_parameter master_template]
+ set target_stub [lindex [ns_conn urlv] [expr [ns_conn urlc] - 1]]
+ set action_string [append target_stub "-2"]
+ set name [get_name $portal_id]
+
+ # XXX todo layout change
+ # get the layouts
+ # set layout_count 0
+ # template::multirow create layouts layout_id name \
+ # description filename resource_dir checked
+ #
+ # db_foreach configure_layout_select "
+ # select
+ # layout_id,
+ # name,
+ # description,
+ # filename,
+ # resource_dir,
+ # ' ' as checked
+ # from portal_layouts
+ # order by name " {
+ # set resource_dir "$resource_dir"
+ # template::multirow append layouts $layout_id $name \
+ # $description $filename $resource_dir $checked
+ # incr layout_count
+ # }
+ #
+ # get the portal.
+
+
+ # get the themes, template::multirow is not working here
+ set theme_count 0
+ set theme_data "
"
+
+ # get the current theme
+ db_1row configure_portal_curr_theme_select "
+ select theme_id as cur_theme_id
+ from portals
+ where portal_id = :portal_id
+ "
+ db_foreach configure_theme_select "
+ select
+ pet.theme_id,
+ pet.name,
+ pet.description
+ from portal_element_themes pet
+ order by name " {
+ if { $cur_theme_id == $theme_id } {
+ append theme_data "
"
+ } else {
+ append theme_data "
"
+ }
+ }
+
+ append theme_data "
"
+
+ # get the portal.
+ db_1row configure_portal_select "
+ select
+ p.portal_id,
+ p.name,
+ t.filename as template,
+ t.layout_id
+ from portals p, portal_layouts t
+ where p.layout_id = t.layout_id and p.portal_id = :portal_id
+ " -column_array portal
+
+ # fake some elements so that the
+
+
+ Configure The Portal's Elements:
+ in the template has
+ # something to do.
+ set layout_id [get_layout_id $portal_id]
+
+ db_foreach configure_get_regions "
+ select region
+ from portal_supported_regions
+ where layout_id = :layout_id" {
+ lappend fake_element_ids($region) $portal_id
+ }
+
+ set element_list [array get fake_element_ids]
+ set element_src "[portal::www_path]/template-place-element"
+
+ # the