Index: openacs-4/contrib/packages/portal/catalog/portal.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/catalog/portal.en_US.ISO-8859-1.xml,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/catalog/portal.en_US.ISO-8859-1.xml 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/catalog/portal.en_US.ISO-8859-1.xml 26 Jun 2004 00:36:00 -0000 1.2 @@ -1,6 +1,6 @@ - + Change Theme: Create a new page Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/portal/lib/render-portal.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/portal/lib/render-portal.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/portal/lib/layouts/simple.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/layouts/simple.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/lib/layouts/simple.adp 24 Mar 2004 00:03:36 -0000 1.2 +++ openacs-4/contrib/packages/portal/lib/layouts/simple.adp 26 Jun 2004 00:36:00 -0000 1.3 @@ -27,6 +27,7 @@
Index: openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.adp,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.adp 24 Mar 2004 01:08:04 -0000 1.4 +++ openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.adp 26 Jun 2004 00:36:00 -0000 1.5 @@ -1,9 +1,9 @@ - + @page.name@ f f f - @theme.resource_dir@ + @portal.theme_resource_dir@ Index: openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.tcl 22 Mar 2004 01:57:37 -0000 1.3 +++ openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-page.tcl 26 Jun 2004 00:36:00 -0000 1.4 @@ -32,11 +32,4 @@ } array set page [portal::page::get_render_data -render_style all-in-one -page_id $portal(page_id)] - -# This is a kludge for the admin portal ... themes should be a subsite not portal thin -# anyway. - -array set theme [portal::theme::get \ - -theme_id [portal::get_theme_id -portal_id [portal::get_user_portal_id]]] - set elements_exist_p [expr {[llength $page(element_list)] > 0}] Index: openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.adp 26 Jun 2004 00:36:00 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-styles/all-in-one/render-portal.tcl 26 Jun 2004 00:36:00 -0000 1.1 @@ -0,0 +1,6 @@ +array set portal [portal::get_render_data \ + -portal_id $portal_id \ + -render_style all-in-one \ + -page_num $page_num] + +ad_return_template Index: openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.adp 22 Mar 2004 01:57:37 -0000 1.2 +++ openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.adp 26 Jun 2004 00:36:00 -0000 1.3 @@ -18,9 +18,9 @@ %> - + @element.name;noquote@ -@element.resource_dir;noquote@ +@portal.theme_resource_dir;noquote@ @element.element_id;noquote@ @element.shadeable_p;noquote@ @element.shaded_p;noquote@ Index: openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.tcl 24 Mar 2004 00:03:37 -0000 1.3 +++ openacs-4/contrib/packages/portal/lib/render-styles/individual/render-element.tcl 26 Jun 2004 00:36:00 -0000 1.4 @@ -27,5 +27,4 @@ array set element [portal::element::get_render_data \ -element_id $element_id \ - -decorate_p $decorate_p \ -edit_p $edit_p] Index: openacs-4/contrib/packages/portal/lib/render-styles/individual/render-page.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/individual/render-page.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/lib/render-styles/individual/render-page.adp 22 Mar 2004 01:57:37 -0000 1.2 +++ openacs-4/contrib/packages/portal/lib/render-styles/individual/render-page.adp 26 Jun 2004 00:36:00 -0000 1.3 @@ -1,3 +1,3 @@ - + Index: openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.adp 26 Jun 2004 00:36:00 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-styles/individual/render-portal.tcl 26 Jun 2004 00:36:00 -0000 1.1 @@ -0,0 +1,6 @@ +array set portal [portal::get_render_data \ + -portal_id $portal_id \ + -render_style individual \ + -page_num $page_num] + +ad_return_template Index: openacs-4/contrib/packages/portal/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/contrib/packages/portal/tcl/element-procs.tcl 20 Jun 2004 00:39:05 -0000 1.19 +++ openacs-4/contrib/packages/portal/tcl/element-procs.tcl 26 Jun 2004 00:36:00 -0000 1.20 @@ -34,7 +34,8 @@ {-state full} {-datasource_name:required} {-name ""} - {-args ""} + {-element_args ""} + {-initialize:boolean} } { Create a new portal element of type datasource_name on the given portal. @@ -44,10 +45,14 @@ @param region The page region to placer the element on. @param datasource_name The portal datasource name @param name The name of the element - @param args Optional args to set in array get format + @param element_args Optional args to set in array get format + @param initialize If set, call the portal's default initializer @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 [portal::page::get_id -portal_id $portal_id -page_name $page_name] @@ -65,6 +70,9 @@ set element_id [db_nextval portal_seq] +ns_log Notice "Huh? portal_id: $portal_id portal [db_list_of_lists foo {select * from portals where portal_id = :portal_id}]" +ns_log Notice "Huh? page_id: $page_id elements [db_list_of_lists foo {select * from portal_elements where page_id = :page_id}]" + db_transaction { if {[db_0or1row select_template_element_id {}]} { db_dml insert_element_with_template {} @@ -75,16 +83,18 @@ } } - for {key value} $args { + foreach {key value} $element_args { portal::element::parameter::new \ -element_id $element_id \ -key $key \ -value $value } - portal::element::initialize \ - -datasource_name $datasource_name \ - -element_id $element_id + if { $initialize_p } { + portal::element::initialize \ + -datasource_name $datasource_name \ + -element_id $element_id + } return $element_id @@ -410,7 +420,6 @@ ad_proc -private get_render_data { {-element_id:required} - {-decorate_p 1} {-edit_p 0} } { Return all the good stuff a render template needs to render an element. @@ -423,19 +432,6 @@ array set element [get -element_id $element_id] - if { $decorate_p } { - array set theme [portal::theme::get \ - -theme_id [portal::get_theme_id \ - -portal_id [portal::page::get_portal_id -page_id $element(page_id)] \ - ] \ - ] - set element(filename) "$theme(filename)" - set element(resource_dir) "$theme(resource_dir)" - } else { - set element(filename) /packages/portal/lib/undecorated-element - set element(resource_dir) "" - } - if {!$edit_p || ![::parameter::get -parameter ShowShadeButton]} { set element(shadeable_p) f } @@ -670,4 +666,19 @@ } { } + ad_proc -public get_element_id { + -page_id:required + -datasource_name:required + } { + + Return the element_id of the datasource on the given page if there is exactly one + such portlet on the page, an error otherwise. + + @param page_id The page_id + @param datasource_name The name of the datasource used to create the portlet + @return The element_id if there's exactly one portlet of this type on the page, error + otherwise + } { + return [db_string element_id {}] + } } Index: openacs-4/contrib/packages/portal/tcl/element-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/tcl/element-procs.xql 22 Jan 2004 02:50:12 -0000 1.4 +++ openacs-4/contrib/packages/portal/tcl/element-procs.xql 26 Jun 2004 00:36:01 -0000 1.5 @@ -113,4 +113,14 @@ + + + select pe.element_id + from portal_elements pe, portal_datasources pd + where pe.page_id = :page_id + and pe.datasource_id = pd.datasource_id + and pd.name = :datasource_name + + + Index: openacs-4/contrib/packages/portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/portal-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 20 Jun 2004 01:11:22 -0000 1.32 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 26 Jun 2004 00:36:01 -0000 1.33 @@ -325,6 +325,10 @@ set portal(theme_id) [portal::get_theme_id -portal_id [get_user_portal_id]] } + array set theme [portal::theme::get -theme_id $portal(theme_id)] + set portal(theme_filename) $theme(filename) + set portal(theme_resource_dir) $theme(resource_dir) + return [array get portal] } @@ -440,7 +444,7 @@ lappend ad_dim_struct [list $page_num $name [list]] } - set ad_dim_struct "{ page_num [list [_ new-portal.Page_1]] 0 [list $ad_dim_struct] }" + set ad_dim_struct "{ page_num [list [_ portal.Page_1]] 0 [list $ad_dim_struct] }" return [dimensional -no_header \ -no_bars \ Index: openacs-4/contrib/packages/portal/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.adp,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/www/index.adp 19 Mar 2004 00:41:23 -0000 1.3 +++ openacs-4/contrib/packages/portal/www/index.adp 26 Jun 2004 00:36:01 -0000 1.4 @@ -3,4 +3,4 @@ @portal_id@ @user_portal_id@ - + Index: openacs-4/contrib/packages/portal/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/www/index.tcl 19 Mar 2004 00:41:23 -0000 1.4 +++ openacs-4/contrib/packages/portal/www/index.tcl 26 Jun 2004 00:36:01 -0000 1.5 @@ -19,5 +19,21 @@ set portal_id $user_portal_id } +# Check to see if we're serving the admin portal +if { $portal_id == [portal::get_admin_portal_id] } { + permission::require_permission -privilege admin -object_id $portal_id + set edit_p 0 + set render_style all-in-one +} elseif { $portal_id == [portal::get_user_portal_id] } { + set edit_p [permission::permission_p -object_id $portal_id -privilege write] + set render_style individual +} else { + permission::require_permission -privilege read -object_id $portal_id + set edit_p [permission::permission_p -object_id $portal_id -privilege write] + set render_style individual +} + +set src /packages/portal/lib/render-styles/${render_style}/render-portal + ad_return_template Index: openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 20 Jun 2004 00:39:06 -0000 1.6 +++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 26 Jun 2004 00:36:01 -0000 1.7 @@ -41,7 +41,8 @@ -portal_id $non_admin_portal \ -state hidden \ -datasource_name $user_datasource \ - -args [list package_id $application_id] + -args [list package_id $application_id] \ + -initialize } } }