[Zope] Storing REQUEST for frame request?

Joel Burton joel@joelburton.com
Fri, 16 Aug 2002 00:37:37 -0400


I'm converting a portal application that makes heavy use of frames
(ick!) and have a problem:

Sometimes a page is requested (/foo.html), and, if it's not part of the
frameset, should be 'framed'. The normal way of handling this seems to
be to check (with JavaScript) if its in the frame, and if not, set
location.href= the frameset document, passing it the name of this page
so when it assembles the framed page, this will be in the content cell.
Straightforward enough.

The problem is when there is form data being passed along. For GET data,
it's simple enough--when I pass along the URL of the requested doc for
framing, I can pass along the QUERY_STRING and the framed-doc request
will get it.

For POST data, though, this won't work.

What seems the nicest would be something like

  if-we-need-to-be-framed
    SESSION.set('request_data',REQUEST)
    do frameset document, passing URL

  if we're already framed
    REQUEST=SESSION.geT('request_data')
    do the regular page

This way, all of the REQUEST vars that the original page would have
received (including POST stuff), the new page will receive.

Unfortunately, this doesn't work, of course -- I can't replace the
REQUEST object. Nor can I replace just REQUEST.form.

I think I could do something like:

  if-we-need-to-be-framed
    for item in REQUEST.form:
      SESSION.set('req'+item, item.value)
    do frameset doc, passing URL

  if we're already framed
    for item in SESSION.'req___':
      REQUEST.set(item, value)
    do regular page

but this seems really inefficient -- having to shlep each piece of form
data individually.

Does anyone have a better idea? (No, not using frames isn't an option,
in this case! ;) )

Thanks!

- J.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant