in the template
+ set layout_id [get_layout_id -page_id $page_id $portal_id]
+
+ db_foreach get_regions {} {
+ lappend fake_element_ids($region) $portal_id
+ }
+
+ set element_list [array get fake_element_ids]
+
+ if {$element_count == 0} {
+ append template "
+ Page $portal(page_name) has no Elements "
+ } else {
+ append template "
+ Configure Page $portal(page_name)'s Elements
+
+ Debug: element_list $element_list, layout_id $layout_id
+
+ :
+
+ "
+ }
+ }
+
+
# This hack is to work around the acs-templating system
set __adp_stub "[get_server_root][www_path]/."
set {master_template} \"master\"
@@ -617,6 +653,7 @@
}
ad_proc -public page_create {
+ {-layout_name ""}
{-pretty_name:required}
{-portal_id:required}
} {
@@ -625,7 +662,13 @@
@return the id of the page
@param portal_id
} {
- set layout_id [get_layout_id]
+ # get the layout_id
+ if {![empty_string_p $layout_name]} {
+ set layout_id [get_layout_id -layout_name $layout_name]
+ } else {
+ set layout_id [get_layout_id]
+ }
+
return [db_exec_plsql page_create_insert {}]
}
@@ -750,15 +793,12 @@
set min_region 0
foreach region $region_list {
- ns_log notice "aks40 $region / $force_region"
if {$force_region == $region} {
set min_region $region
break
}
}
- ns_log notice "aks40 min region $min_region"
-
if {$min_region == 0} {
# the region asked for was not in the list
ns_log error "portal::add_element region $force_region not in layout $layout_id"
@@ -1467,4 +1507,19 @@
}
}
+ ad_proc -public get_theme_id_from_name {
+ {-theme_name:required}
+ } {
+ self explanatory
+ } {
+ if { [db_0or1row get_theme_id_from_name_select {} ]} {
+ return $theme_id
+ } else {
+ ns_log error "portal::get_theme_id_from_name_select bad theme_id!"
+ ad_return_complaint 1 "portal::get_theme_id_from_name_select bad theme_id!"
+ }
+
+ }
+
+
}
Index: openacs-4/packages/new-portal/tcl/portal-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/new-portal/tcl/portal-procs.xql 22 Jan 2002 01:31:52 -0000 1.9
+++ openacs-4/packages/new-portal/tcl/portal-procs.xql 22 Jan 2002 20:02:40 -0000 1.10
@@ -81,12 +81,11 @@
- select p.name, pcp.portal_id, pp.layout_id, pl.filename as template
- from portals p, portal_current_page pcp, portal_layouts pl, portal_pages pp
- where pcp.page_id = :page_id
- and pcp.portal_id = :portal_id
- and p.portal_id = pcp.portal_id
- and pp.page_id = pcp.page_id
+ select p.name, p.portal_id, pl.filename as template, pp.pretty_name as page_name
+ from portals p, portal_layouts pl, portal_pages pp
+ where pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pp.portal_id = p.portal_id
and pl.layout_id = pp.layout_id
@@ -533,5 +532,12 @@
+
+
+ select theme_id from portal_element_themes where name = :theme_name
+
+
+
+
Index: openacs-4/packages/new-portal/www/place-element.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/place-element.adp,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/new-portal/www/place-element.adp 18 Dec 2001 21:28:09 -0000 1.20
+++ openacs-4/packages/new-portal/www/place-element.adp 22 Jan 2002 20:02:40 -0000 1.21
@@ -52,6 +52,12 @@
+
+
+@other_page_html@
+
+
+
Index: openacs-4/packages/new-portal/www/place-element.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/place-element.tcl,v
diff -u -r1.24 -r1.25
--- openacs-4/packages/new-portal/www/place-element.tcl 21 Jan 2002 22:08:19 -0000 1.24
+++ openacs-4/packages/new-portal/www/place-element.tcl 22 Jan 2002 20:02:40 -0000 1.25
@@ -1,6 +1,6 @@
# www/place-element.tcl
ad_page_contract {
- Place elements.
+ Place elements. IMPROVE ME
@author Arjun Sanyal (arjun@openforce.net)
@creation-date 9/28/2001
@@ -25,11 +25,11 @@
db_foreach select_elements_by_region {
select element_id, pem.pretty_name as name, pem.sort_key, state
- from portal_element_map pem, portal_current_page pcp
+ from portal_element_map pem, portal_pages pp
where
- pcp.portal_id = :portal_id
- and pcp.page_id = :page_id
- and pem.page_id = pcp.page_id
+ pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pem.page_id = pp.page_id
and region = :region
and state != 'hidden'
order by sort_key } {
@@ -62,11 +62,11 @@
db_foreach hidden_elements {
select element_id, name
- from portal_element_map pem, portal_current_page pcp
+ from portal_element_map pem, portal_pages pp
where
- pcp.portal_id = :portal_id
- and pcp.page_id = :page_id
- and pcp.page_id = pem.page_id
+ pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pp.page_id = pem.page_id
and pem.state = 'hidden'
order by name
} {
@@ -75,7 +75,20 @@
}
-set dir "[portal::mount_point]/place-element-components"
+# moving to other pages
+set other_page_avail_p 0
+set other_page_html ""
-append show_html ""
-
+db_foreach other_pages_select {
+ select page_id, pretty_name
+ from portal_pages pem
+ where
+ pp.portal_id = :portal_id
+ and pp.page_id != :page_id
+ order by sort_key
+} {
+ set other_page_avail_p 1
+ append other_page_html "$name \n"
+}
+
+set dir "[portal::mount_point]/place-element-components"
Index: openacs-4/packages/new-portal/www/template-place-element.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/template-place-element.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/new-portal/www/template-place-element.tcl 21 Jan 2002 22:08:19 -0000 1.5
+++ openacs-4/packages/new-portal/www/template-place-element.tcl 22 Jan 2002 20:02:40 -0000 1.6
@@ -24,11 +24,11 @@
template::multirow create element_multi element_id name sort_key state hideable_p shadeable_p description
db_foreach select_elements_by_region {
select pem.element_id, pem.name, pem.sort_key, state, pd.description
- from portal_element_map pem, portal_datasources pd, portal_current_page pcp
+ from portal_element_map pem, portal_datasources pd, portal_pages pp
where
- pcp.portal_id = :portal_id
- and pcp.page_id = :page_id
- and pem.page_id = pcp.page_id
+ pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pem.page_id = pp.page_id
and pem.datasource_id = pd.datasource_id
and region = :region
and state != 'hidden'
@@ -48,11 +48,11 @@
db_1row select_all_noimm_count \
"select count(*) as all_count
- from portal_element_map pem, portal_current_page pcp
+ from portal_element_map pem, portal_pages pp
where
- pcp.portal_id = :portal_id
- and pcp.page_id = :page_id
- and pcp.page_id = pem.page_id
+ pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pp.page_id = pem.page_id
and state != 'hidden'
and region not like 'i%'"
@@ -65,11 +65,11 @@
db_foreach hidden_elements {
select element_id, name
- from portal_element_map pem, portal_current_page pcp
+ from portal_element_map pem, portal_pages pp
where
- pcp.portal_id = :portal_id
- and pcp.page_id = :page_id
- and pcp.page_id = pem.page_id
+ pp.portal_id = :portal_id
+ and pp.page_id = :page_id
+ and pp.page_id = pem.page_id
and pem.state = 'hidden'
order by name
} {