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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/index.adp 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,23 @@ + + +
+
+
+ + +
+ @navbar.name@ +
+
+ + + +
+
+
+
+
+ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/index.tcl 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,107 @@ +ad_page_contract { + + Displays the given portal if specified. Otherwise, figure out the proper portal + to display based on the create_private_portals_p parameter, creating the user's + personal portal if necessary. + + @author Don Baccus (dhogaza@pacifier.com) + @creation-date 2004-01-02 + @version $Id: index.tcl,v 1.1 2004/03/14 01:19:10 donb Exp $ + +} { + {page_num:integer,optional 0} + portal_id:integer,optional +} + +# If specified, the portal_id might be the admin portal_id, or the user or +# default portal_id. That makes the code below slightly convoluted. The +# notion is that we always need the user portal_id available for the navbar +# even if we're serving the admin portal_id. + +set package_id [ad_conn package_id] + +# Assume that this instance of portal has been configured and that we're going to +# serve a page ... + +if { [parameter::get -parameter create_private_portals_p] } { + set owner_id [ad_conn user_id] +} else { + set owner_id 0 +} +set user_portal_id [portal::get_portal_id -owner_id $owner_id] + +if { ![info exists portal_id] } { + + if { [string equal $user_portal_id ""] } { + + # Make sure we've been initalized + if { ![portal::initialized] } { + 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 portal 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 portal + + db_1row select_user_name {} + + set master_template_id [portal::get_master_template_id] + + set portal_id [portal::new \ + -owner_id :owner_id \ + -name "Portal for $user_name" \ + -template_id $master_template_id \ + -context_id [ad_conn package_id] \ + -initialize_elements] + + } else { + set portal_id $user_portal_id + } +} + +# We should investigate improving performance by avoiding the read and write checks +# at some future point. We could sign the portal_id param, ensuring it's been set +# from within the portals package. The request processor has verified that the +# user can read this portal instance. As long as administrators don't muck +# with permissions directly and let the portals package manage them, we know +# that: + +# 1. Users can read and write (edit) their own portal +# 2. Everyone can read the master template portal +# 3. Only admins can edit the master template portal +# 4. Only admins can read the admin portal + +# Check to see if we're serving the admin portal +if { $portal_id == $user_portal_id} { + permission::require_permission -privilege read -object_id $portal_id + set admin_p [permission::permission_p -object_id $portal_id -privilege admin] + set edit_p [permission::permission_p -object_id $portal_id -privilege write] +} else { + # Gotta be an admin to use the admin portal, and it's not configurable so + # we set edit_0 + permission::require_permission -privilege admin -object_id $portal_id + set admin_p 1 + set edit_p 0 +} + +array set portal [portal::get_render_data -portal_id $portal_id -page_num $page_num] + +db_multirow -unclobber -extend {url} navbar select_user_navbar {} { + set url [export_vars -base index {portal_id page_num}] +ns_log Notice "Huh? user url: $url" +} + +if { $admin_p } { + db_multirow -unclobber -append -extend {url} navbar select_admin_navbar {} { + set url [export_vars -base index {portal_id page_num}] +ns_log Notice "Huh? admin url: $url" + } +} + +set which_navbar [parameter::get -parameter navbar_class] + +ad_return_template + Index: openacs-4/contrib/packages/portal/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/index.xql 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,31 @@ + + + + + + + select first_names || ' ' || last_name as user_name + from persons + where person_id = :owner_id + + + + + + 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/contrib/packages/portal/www/portal-configure-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/portal-configure-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/portal-configure-2.tcl 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,114 @@ +# +# 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/element-layout-2.tcl +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: portal-configure-2.tcl,v 1.1 2004/03/14 01:19:10 donb Exp $ +} { + portal_id:integer,notnull + page_id:integer,optional + element_id:integer,optional + theme_id:integer,optional + layout_id:integer,optional + name:notnull,optional + op:notnull + return_url:notnull + {anchor ""} +} + +permission::require_permission -object_id $portal_id -privilege write + +switch $op { + + move_up { + portal::element::move \ + -element_id $element_id \ + -direction up + } + + move_down { + portal::element::move \ + -element_id $element_id \ + -direction down + } + + move_left { + portal::element::move \ + -element_id $element_id \ + -direction left + } + + move_right { + portal::element::move \ + -element_id $element_id \ + -direction right + } + + show_here { + db_transaction { + portal::element::move_to_page \ + -page_id $page_id \ + -element_id $element_id \ + -region 1 + portal::element::set_state \ + -element_id $element_id \ + -state full + } + } + + move_to_page { + portal::element::move_to_page \ + -page_id $page_id \ + -element_id $element_id \ + -region 1 + } + + hide { + portal::element::set_state -element_id $element_id -state hidden + } + + change_theme { + portal::set_theme_id -portal_id $portal_id -theme_id $theme_id + } + + add_page { + portal::page::new -portal_id $portal_id -name $name + } + + remove_page { + portal::page::delete -page_id $page_id + } + + change_layout { + portal::page::set_layout_id \ + -page_id $page_id \ + -layout_id $layout_id + } + + rename_page { + portal::page::set_name -page_id $page_id -name $name + } + + default { + ad_return_complaint 1 "\"$op\" is not a valid operator for portal configuration" + } +} + +ad_returnredirect $return_url Index: openacs-4/contrib/packages/portal/www/portal-configure.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/portal-configure.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/portal-configure.adp 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,5 @@ + + @title;noquote@ + @context;noquote@ + + Index: openacs-4/contrib/packages/portal/www/portal-configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/portal-configure.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/portal-configure.tcl 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,17 @@ +ad_page_contract { + + Configure a portal + + @author Don Baccus (dhogaza@pacifier.com) + +} { + portal_id:integer,notnull +} + +permission::require_permission -object_id $portal_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/contrib/packages/portal/www/portal-configure.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/portal-configure.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/portal-configure.xql 14 Mar 2004 01:19:10 -0000 1.1 @@ -0,0 +1,34 @@ + + + + + + + select theme_id, name || ' - ' || description as name + from portal_themes + order by name + + + + + + select element_id, + pe.name + from portal_elements pe, portal_pages pp + where pp.portal_id = :portal_id + and pp.page_id = pe.page_id + and pe.state = 'hidden' + order by pe.name + + + + + + select page_id + from portal_pages + where portal_id = :portal_id + order by sort_key + + + + Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/portal/www/show-here.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/portal/www/show-here.tcl'. Fisheye: No comparison available. Pass `N' to diff?