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 > > > > > > > > > > > > > -- ====================================== Syed Haider. EMBL-European Bioinformatics Institute Wellcome Trust Genome Campus, Hinxton, Cambridge CB10 1SD, UK. ======================================
