Forum OpenACS Q&A: Re: Graphing for OACS?

Collapse
5: Re: Graphing for OACS? (response to 2)
Posted by Jerome M on
dynamic in the sense that the page that produces the grpah doesnt query the same tables over and over again...

before in my page i usually place.. <img src=graph.tcl> to produce the graph together with the other forms and text..

but since ill be querying different tables depending on the parent page.. i think <img src=graph.tcl> wouldnt do the trick... unless ill be able to pass an argument to graph.tcl in the adp page.. such as <img src=graph.tcl $tables_to_query > but i dont think its possible (or i might be wrong)..

i found somewhat a sol'n but caused another problem..
i tried to place the code of graph.tcl in page1.tcl and from it @foo@ can be accessed from page2.adp.. and outputs the binary using <img src=<%[ns_writebinary @foo@]%>> but another problem arises it only output the image it didn't include my html text and forms..

Collapse
6: Re: Graphing for OACS? (response to 5)
Posted by Jamie Rasmussen on
There are many procs in OpenACS to help you pass variables between pages - look in https://openacs.org/api-doc/ for export_url_vars and ad_page_contract for instance, and grep through some of the packages you've installed for how they are used in practice.  In your case the link generated might look something like <IMG src="graph.tcl?table=foo">.
Collapse
7: Re: Graphing for OACS? (response to 6)
Posted by Jerome M on
no what i mean is pass an argument to a tcl script in a web page.. such as..

page1.adp
contains...
  <img src=graph.tcl @argv1@ @argv2@>

page1.tcl
contains...
  set argv "dyanmicvalue1"
  set argv "dynamicvalue2"

Collapse
9: Re: Graphing for OACS? (response to 7)
Posted by Jamie Rasmussen on
I think what you want is:

page1.adp contains...
  <img src=@graph_link@>

page1.tcl contains...
  set argv1 "dynamicvalue1"
  set argv2 "dynamicvalue2"
  set graph_link "graph.tcl?[export_url_vars argv1 argv2]"

You can see very similar code in various OpenACS packages.  For example, check out workflow-gif.tcl, case-state-graph.tcl, and case-state-graph.adp in packages/acs-workflow/www/