Index: openacs-4/packages/dotlrn/www/configure-element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/configure-element.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/configure-element.tcl 9 Nov 2001 18:13:26 -0000 1.1 @@ -0,0 +1,58 @@ + +ad_page_contract { + Displays an element configuration page + + @author Ben Adida (ben@openforce.net) + @author Arjun Sanyal (arjun@openforce.net) + @creation-date 2001-10-24 +} { + element_id:naturalnum,notnull + op:notnull +} + +# Check if this is a community type level thing +if {[ad_parameter community_type_level_p] == 1} { + ad_returnredirect "one-community-type" + return +} + +# Make sure user is logged in +set user_id [ad_maybe_redirect_for_registration] + + +if {[ad_parameter community_level_p] == 1} { + # This is a community + # What community type are we at? + set community_id [dotlrn_community::get_community_id] + + # Check that this user is a member + if {![dotlrn_community::member_p $community_id $user_id]} { + set context_bar [list "Not a member"] + + ad_return_template one-community-not-member + return + } else { + + # they are a member, do the request + set rendered_page \ + [portal::configure_element $element_id $op "one-community"] + } +} else { + # this not a community, it is the "workspace" deal + + # Get the page + set page_id [db_string select_page_id {} -default ""] + + # If there is no page_id, this user is either a guest or something else + if {[empty_string_p $page_id]} { + # do something + ad_returnredirect "/." + } else { + set rendered_page [portal::configure_element $element_id $op "index"] + } +} + +ad_return_template + + + 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.55 -r1.56 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 9 Nov 2001 02:46:29 -0000 1.55 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 9 Nov 2001 18:13:14 -0000 1.56 @@ -733,6 +733,10 @@ # apply the path hack to the filename and the resourcedir set element(filename) "[www_path]/$element(filename)" set element(resource_dir) "[mount_point]/$element(resource_dir)" + + # set up the title, configuration and other links + + # get the element's params db_foreach evaluate_element_params_select " @@ -751,10 +755,8 @@ # get the datasource db_1row evaluate_element_datasource_select " select - datasource_id, mime_type, name, - description, content from portal_datasources where datasource_id = $element(datasource_id) @@ -780,7 +782,49 @@ } + + ad_proc -public configure_element { element_id op return_url } { + Return a portal configuration page. + All form targets point to file_stub-2. + @param portal_id + @return_url + @return A portal configuration page + } { + + if { [db_0or1row configure_element_select "select portal_id + from portal_element_map + where element_id = :element_id"] } { + # passed in element_id is good, do they have perms? + ad_require_permission $portal_id portal_read_portal + ad_require_permission $portal_id portal_edit_portal + } else { + return + } + + switch $op { + "edit" { + ad_return_complaint 1 "portal::configure_element + edit called with $element_id $return_url + Not implimented yet" + } + "shade" { + set shaded_p [get_element_param $element_id "shaded_p"] + + if { $shaded_p == "f" } { + set_element_param $element_id "shaded_p" "t" + } else { + set_element_param $element_id "shaded_p" "f" + } + + return "Done. Go back" + } + "hide" { + ad_return_complaint 1 "hide called $element_id $return_url" + } + } + } + # # Datasource helper procs #