Hi Richard,
Thanks for the suggestion. I was thinking along those lines, although
without using the query ID. What I was particularly interested to find
out, was whether I had missed some more obvious way to do this, without
the complication of using AJAX. At least for some of us this seems
complicated, although I suppose you BioMart guys probably think that
AJAX is easy enough, and maybe you are right
:-) .
Regards,
Roger.
Richard Holland wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If you inspect the URL for the martview page you will see it includes a
unique query ID reference - usually a long string of 40 or so random
characters.
This unique ID remains assigned to the current query until the user
starts a new query using 'New'.
You could extract the unique ID and use AJAX to dispatch it to a
separate CGI script elsewhere along with your canned query details.
Then, on the next time the page is displayed, you could use AJAX to call
that same CGI with the query ID to see if it has any stored values for
you to populate your form with.
This way you get to preserve the details and any other info you need
server-side without needing to modify BioMart's server code.
cheers,
Richard
Roger Hull wrote:
Hi Syed,
Sorry, I didn't explain clearly enough where I see the problem.
I have a form for selecting and parameterising canned queries in
header.tt which appears at the top of the martview page. When the user
presses submit in my form, it goes to a new perl script I provide.
The perl script stores what the user has entered in the form (maybe into
a session parameter), and converts the user input into a corresponding
martview URL request.
The martview page is refreshed, filling in the appropriate filter and
attribute selections - this works well. However, in refreshing the page,
my form has also been refreshed, so the user selections in my form have
been cleared. This is very user-unfriendly, the user may wish to see
what has been entered in the form - which canned query and what
parameters for that query, and maybe modify the parameters a bit and
re-submit my form. My problem is how to find out what the user had
entered in the form before the page was refreshed, since I don't have
any server-side code in the martview page.
I hope I've made that clear - and maybe I've missed some obvious way to
get the user entries back in the form?
Regards,
Roger.
Syed Haider wrote:
Hi Roger,
On Thu, 2008-02-21 at 23:33 +0000, Roger Hull wrote:
Hi Syed,
Thanks for your comments.
Well, just getting the xml of the biomart query is a possibility - it
might be possible to get back to what the user had selected/typed from
the xml. But really I want to store my own data which makes it easy to
reinitialise my form (in header.tt) to what the user had
selected/typed. (Also in some cases the same biomart query might have
arisen from more than one canned query.)
I guess AJAX is still an option for this job (with a simple perl
script to handle the request). Originally I thought of adding some
extra GET or POST parameters to the martview page to pass it this
information, but then I would need to be able to run a CGI script as
the page loads, which would involve hacking into your martview code.
As far as I can see you don't provide anywhere official for me to put
a CGI script which gets run when martview loads.
So I wondered if you have any other suggestions?
Looks to me the best option if you declare your own <form>...</form> and
have a PERL CGI script talking to it. would be easy to maintain and
eliminates the need to hack martview.
cheers
syed
If I write such a conversion function (xml -> URL parameters) I'll
certainly share it.
Regards,
Roger.
Syed Haider wrote:
Hi Roger,
On Thu, 2008-02-21 at 17:36 +0000, Roger Hull wrote:
Hi,
I am in the process of adding some preformed queries to MartView. The
user will select from a list of queries, possibly enter some
parameters (depending upon the query), and I have code (either perl or
_javascript_) which will send the query to MartView using a Mart URL
Request. This works fine for my first test query. This is implemented
in _javascript_ added to header.tt and footer.tt.
My main problem is how best to find out using _javascript_ what query
was requested when I come back into the martview page (so I can
reselect the user's canned query and re-enter the parameters). Can you
suggest how I could do this, minimising the changes to the biomart
code as far as possible?
One idea I had is to handle the generation of the query URL from perl,
and store the canned query somewhere (in a session parameter maybe).
Then when I come back to the martview page, use an ajax request to
find out the details of the canned query.
by storing a 'canned query' in session param, what exactly do you intend
to store ? is it just like an XML query which our XML button
generates ? then of course write a simple AJAX _javascript_ request and
ask from XML query. Currently, if you see the code behind OnClick() of
XML button, it asks for XML by setting the target to a new window, you
can call it exactly the same way and just avoid the target window bit.
AJAX code is already available in _javascript_ 'martview.js' which can be
reused.
This seems rather complicated, but could all be done without changing
any biomart code, just adding _javascript_ to header.tt, and some extra
scripts on my server to handle the requests. But if you can suggest
something better (simpler :-) ) I would be grateful.
Also, do you have handy perl and/or _javascript_ functions to convert
between a query in xml format (for MartService) and URL format? It
would be convenient to store the canned queries as xml templates
(ready to fill in parameters), then convert the completed xml into a
URL query. I guess I can write such a function if necessary, but don't
want to re-invent the wheel.
I am afraid, we never felt a need to do this conversion, please feel
free to write such a conversion function. This may help other users in
the future.
good luck!
cheers
syed
Regards,
Roger
- --
Richard Holland (BioMart)
EMBL EBI, Wellcome Trust Genome Campus,
Hinxton, Cambridgeshire CB10 1SD, UK
Tel. +44 (0)1223 494416
http://www.biomart.org/
http://www.biojava.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHvrbH4C5LeMEKA/QRAmAFAKCUjb4NGP+qW1deVBJXV9Rt3F09tgCfReI2
0brLysWn7e905q9OGoBFnOE=
=s4M+
-----END PGP SIGNATURE-----
|