Index: openacs.org-dev/packages/forums/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/forums/www/index.vuh,v diff -u -r1.2 -r1.3 --- openacs.org-dev/packages/forums/www/index.vuh 4 Nov 2002 22:42:09 -0000 1.2 +++ openacs.org-dev/packages/forums/www/index.vuh 5 Nov 2002 01:58:54 -0000 1.3 @@ -18,21 +18,47 @@ # Find index in the request list where the package url is set package_index [lsearch $request $package] -# The next element in the list is what we want to look at +# The next 2 elements in the list are what we want to look at set url_1st_elem [lindex $request [expr $package_index + 1]] +set url_2nd_elem [lindex $request [expr $package_index + 2]] +set url_3rd_elem [lindex $request [expr $package_index + 3]] +set url_4th_elem [lindex $request [expr $package_index + 4]] +ns_log notice "REQ: '$request', pk: '$package', pi: '$package_index', u1: '$url_1st_elem', u2: '$url_2nd_elem', u3: '$url_3rd_elem', u4: '$url_4th_elem'" + +# I don't like that many levels of nesting either, but it was the +# simplest way I could think of at the moment. # If the user types a trailing /, we need to redirect so the links # won't be all screwed. -set size_after_package_url [expr [llength $request] - ($package_index + 1)] -#ns_log notice "REQ: $request, sapu: $size_after_package_url, pk: $package, pi: $package_index, u1: $url_1st_elem" +if { ![empty_string_p $url_2nd_elem] } { + if { [string equal $url_2nd_elem "message"] == 1 } { + if { [string is digit $url_3rd_elem] == 1 } { + if { [empty_string_p $url_4th_elem] } { + # Add message_id to form, so it can be processed -if { $size_after_package_url > 1 } { - rp_internal_redirect [join [lrange $request [expr $package_index + 2] end] "/"] -} + rp_form_put message_id $url_3rd_elem + rp_internal_redirect message-view + } else { + rp_internal_redirect [join [lrange $request [expr $package_index + 4] end] "/"] + } + } else { + rp_internal_redirect [join [lrange $request [expr $package_index + 3] end] "/"] + } + } +} -if { [string is alpha $url_1st_elem] == 1 } { - switch $url_1st_elem { +ns_log notice "REQ: Past 1st IF" + +if { ![empty_string_p $url_1st_elem] } { + if { ![empty_string_p $url_2nd_elem] } { + ns_log notice "REQ: Into 2nd ELSE" + rp_internal_redirect [join [lrange $request [expr $package_index + 2] end] "/"] + } + + ns_log notice "REQ: Looking for '$url_1st_elem'" + + switch -exact -- $url_1st_elem { "openacs" { rp_form_put forum_id 14013 } @@ -54,9 +80,6 @@ } rp_internal_redirect forum-view -} +} -if { [string is digit $url_1st_elem] == 1 } { - rp_form_put message_id $url_1st_elem - rp_internal_redirect message-view -} +