Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#350 closed bug (fixed)

changing language in search results gives an XML page

Reported by: lemon-head Owned by:
Priority: major Milestone: 0.1.2.1
Component: BW Search Keywords:
Cc: matrixpoint, midsch

Description

Steps to reproduce:

  1. login and go to searchmembers page, javascript enabled
  2. search for anything, until you get a list of results (displayed under the map by magic AJAX power)
  3. switch the language
  4. you get the xml page

Another similar problem:

  1. login and use the quicksearch on upper right in the menu.
  2. change language
  3. you get an empty page..

Reason:

  • With every request of a html, xml, or whatever page, bw-rox remembers this as the 'latest request' in a session variable.
  • When switching the language or the tr_mode, bw-rox uses PRequest::back() to get back to that adress.
  • XML pages are only meant for AJAX to be handled in the background, not to send the user there.
  • the 'latest request' does not remember $_POST arguments.

Possible solutions.

  • use another mechanism to specify the page to return to after a switch of language or tr_mode, or after logging in. This could be to keep the original page in a $_GET or $_POST argument.
  • don't let XML page requests overwrite the 'latest request' session variable.
  • try to protect $_POST data as well.

Change History (12)

comment:1 Changed 11 years ago by lemon-head

anyway, who invented this rox/in/lang ? is this PlatformPT, or MyTB?

comment:2 Changed 11 years ago by lemon-head

ehm stupid question.

At least the PRequest::back() is PT functionality.

Problem scenario I:

  1. open bewelcome pages x and y in two browser tabs A and B.
  2. In tab A, you click on a link to page z
  3. In tab B, you change the language.
  4. Tab B gets redirected to page z, not to page y, as z is remembered in the session variable for 'latest request'.

Problem scenario II:

  1. as above: a page not meant for the user overwrites the session var.

comment:3 Changed 11 years ago by lemon-head

  • follow_up changed from none to test
  • version changed from production to all

should be fixed with [3823] - new language switcher

see also (#363)

comment:4 Changed 11 years ago by matrixpoint

After doing a search in English on test, I switched to Finnish. I did get the searchmembers page in Finnish (not the XML ajax page), so this is good, BUT, the searchmembers page is in the Edit or Translate mode (not sure what the difference is), NOT the Browse mode. Hopefully, this is easy to fix.

comment:5 Changed 11 years ago by lemon-head

translation modes:

  • browse: no translation links shown
  • translate: translation links on words with missing or obsolete translation
  • edit: translation/edit links on ALL words, even those which are already translated. The purpose of this mode is making it easier to improve the quality text in our site.

For a translator, the 'translate' mode should be the default to start with, because we actually want that translators become aware of missing translations while browsing.

However, if you had a different mode enabled before, then this mode is remembered, even when you switch to a language where you don't have translation rights. This design decision might have problems, but I think it is not so bad.

Now.. if you are surfing as henri, then the reason is quite clear:

  • henri has not translation rights for english -> no modes to choose from, no translation links.
  • henri does have translation rights for finnish -> so here the 3 modes are available, and the system will either use the default ('translate'), or use the mode that is still stored in a session variable.

comment:6 Changed 11 years ago by matrixpoint

Thanks, Andreas. Your system is well-designed.

comment:7 Changed 11 years ago by matrixpoint

  • follow_up changed from test to test on alpha

Moved to alpha in r3855.

comment:8 Changed 11 years ago by matrixpoint

This works on alpha.

comment:9 Changed 11 years ago by midsch

  • Cc midsch added

Can't reproduce the errors with redirects anymore on alpha, also with two open tabs it works well, but have no translation-rights.

But in quicksearch and searchmembers the searchresult is gone after switching the language, would be more nice to keep the results as well.

comment:10 Changed 11 years ago by lemon-head

@midsch: I agree, but this will be more tricky to achieve. Maybe in a later version.

comment:11 Changed 11 years ago by micha

  • follow_up changed from test on alpha to release
  • Resolution set to fixed
  • Status changed from new to closed

I can confirm that this works (within the limits described above). Marking ready for release.

comment:12 Changed 11 years ago by matrixpoint

  • follow_up changed from release to none
Note: See TracTickets for help on using tickets.