Forum OpenACS Development: Re: parameters through link

Collapse
Posted by Dave Bauer on
Hi,

I am not sure what you mean by erasing.

Can you be more specific, what is the URL and parameters that you are passing?

I don't think acs-subsite/index takes and parameters in a default install, do you have custom code in there?

You should check the api-doc for

1) ad_page_contract for processing url vars in the destination page
2) export_vars for generating the url with vars

Collapse
Posted by Iuri Sampaio on
Yes, i am aware of those contraints.
I added the parameter in the ad_page_contact header of subsite index page.

ad_page_contract {

@author mailto:rhs@mit.edu
@author mailto:mbryzek@mit.edu

@creation-date 2000-09-18
@cvs-id $Id: index.tcl,v 1.21 2007/01/10 21:22:06 gustafn Exp $
} {
{project_item_id "" }

...
} -properties { ...

I created an ad_proc that return a url to a specific subsite by giving the subsite id. Based on what we have already on site_node APIs but sligthly diferent. See the string function to take out the /

if { [nsv_exists site_node_url_by_object_id $subsite_id] } {
set url [string trimright [nsv_get site_node_url_by_object_id $subsite_id] /]

set url "$url?project_item_id=$project_item_id"
return $url
}

That assigns to $subsite_url the link:
/project-manager/fred-dispatch-development?project_item_id=2644

in the db_multirow i have the piece of code:

set subsite_id [pm::project::get_subsite_id -project_id $project_id]
set subsite_url [lindex [pm::project::get_subsite_url -subsite_id $subsite_id -project_item_id $project_item_id] 0]
set subsite_name [acs_object_name $subsite_id]

and the listtemplate element is:

subsite {
label "[_ acs-subsite.subsite]"
display_template " a href=\"@projects.subsite_url;noquote@\" @projects.subsite_name;noquote@ /a"
}
*attention to the html tags. I had to take out the braquets to paste in the forum

So, I can see in the browser, at the status bar in botom that link contains the parameter project_item_id
but when i click and go to the acs-subsite index page the var just looses the paramter somehow.
and the url does not show the parameter

I put some ns_log to verify what value is assigned to project_item_id and i confirmed project_id is empty ""

and there is no reason for it that i can see in the code.