Return to search-results page
kroyeren
Joined: 2012-07-19
Posts: 8 |
Posted: Mon, 2012-07-23 11:00 |
Hi I'm trying to add a feature to the searchresults page. Basically I need a link to my function, and I would like to return to the search-results page when my module is done doing it's thing. So I add <a href={g->url arg1="my.controller" [... my arguments...] argN="return=1"}>{g->text text="do this"}</a> I think there's an issue with the return=1 argument. Link shows up fine, do the desired action, but for some reason the return attribute is converted to point to the page I was at when performing the search, rather than returning to the search-result page. Should I do it in another way in order to "current page" to be interpreted as the search-results page. There has been a post about this before, but it was unanswered http://gallery.menalto.com/node/63078 Kind regards Morten |
|
Posts: 8339
the return should be the url to return to.
Notice the g2_return when you click a link to gallery admin
-s
Posts: 8
But I can only specify return as a non-null value...
So what you're saying is, that it's interpreted incorrectly by the template parser?
it is translated to ...return="main.php"> if search was performed on main page and ...return="main.php?g2_itemId=[where ever i was]" if viewing a photo...
Posts: 8339
you need a string relative url to the return page
link to my admin:
<a href="index.php?g2_view=core.SiteAdmin&g2_return=%2Fmedia%2Findex.php%3Fg2_view%3Dcore.SiteAdmin%26g2_authToken%3Dbe5f9a094671">Site Admin</a>
-s
Posts: 8
Just to be sure, what you're saying is that I should write the actual link instead of using Smarty to create it for me (g->url...)
Because if I use smarty no matter what the return argument is set to, it will be changed
/morten
Posts: 8339
Guess I'm not sure where you are trying to accomplish this?
Looks like you are adding your own controller.
Did you want to add a redirect after the controller completes its task?
-s
Posts: 8
I'm adding a new link below each thumbnail on the search-results page. Link is pointing to an existing controller in another module.
The module has an option (in the administration section) to either go to a view in the module or stay on page when it has completed it's task.
My problem is, that "stay on page" is interpreted as "go back to where the search was performed" instead of "go back to the page with search-results". To me it looks like an incorrect "i was here" parameter somehow gets sent to the controller.
When the search-result is showed, there's a "g2_return=/main.php[&...]" parameter in the url pointing to the page the search-results was perfomed, and I suppose that's what is carried over to my link when I write "return=1" (as I understand is the way to do it according to: http://codex.gallery2.org/Gallery2:MVC_Structure#How_To_Return_.28or_There_and_Back_Again.29).
I've made a workaround by shooting off the request as a javascript xmlHTTP request that changes the link text when it gets a response. This solution is bypassing the modules option of where to go after controller is done, which is ok for my scenario, but not an elegant or "correct" solution imo.
The gallery I'm working on, is not currently on a public IP, but would it help if I put up a demo gallery to show examples of what I'm trying to do?