portal_display

one of the documented procedures in this installation of the ACS
Usage:
portal_display
What it does:
Registered procedure that uses the URL to determine what page to show
Defined in: /web/philip/tcl/portals-defs.tcl

Source code:



    set full_url [ns_conn url]
    set portal_extension [ad_parameter PortalExtension portals .ptl]

    if [regexp "/portals/user(.*)-(\[0-9\]+)$portal_extension" $full_url match user_id page_number] {
	ad_maybe_redirect_for_registration
	# memoize a user page for a short time, first check to make sure we're not evaling 
	# anything naughty
	validate_integer "user_id" $user_id
	validate_integer "page_number" $page_number
	ns_return 200 text/html [util_memoize "portal_display_page $user_id $page_number user" 10]
    } elseif [regexp "/portals/(.*)-(\[0-9\]+)$portal_extension" $full_url match group_name page_number] {
	regsub -all -- {-} $group_name { } group_name
	set group_name [string toupper $group_name]
	set db [ns_db gethandle]

	set group_id  [database_to_tcl_string_or_null $db "
	    select group_id 
            from user_groups where upper(group_name)='[DoubleApos $group_name]'"] 
	if { [empty_string_p $group_id] } {
	    # If the group does not exist, we redirect to the
	    # portal list.

	    ad_returnredirect [ad_parameter MainPublicURL portals]
	} else {
	    ns_db releasehandle $db
	    validate_integer "group_id" $group_id
	    validate_integer "page_number" $page_number
	    ns_return 200 text/html [util_memoize "portal_display_page $group_id $page_number group" [ad_parameter CacheTimeout portals 600]]
	}
    } else {
	ad_returnredirect [ad_parameter MainPublicURL portals]
    }



philg@mit.edu