[opencms-dev] Trying to reach non module page from administration view
Werner Punz
werpu at gmx.at
Mon May 27 14:33:03 CEST 2002
Guess nobody, except me, does weird things like that and I have to answer my
own e-mail, so that the whole answer is stored in the CMS mailing list
database.
Anyway here is the scenario, followed by the solution.
The scenario is, that I have an admin module, which should redirect properly
into a non admin page, and from this page there should be a link
back into the admin view.
The reason for this is, that it sometimes it is less time consuming to write
a module as non admin page.
The problem I encountered was, that the redirect back to the admin view
didn´t work. I now found out why.
Solution:
a) first you have to make a redirect admin module.
You have to follow standard module development procedures there, which are
better described in the manual. However if you want to have a nice integration
of your redirected page in the admin layout you should use something like:
function LaunchPopup() {
window.top.body.admin_head.location.href=']]><method
name="getServletPath"/><![CDATA[system/workplace/action/administration_head.html';
window.top.body.location.href(']]><method
name="getServletPath"/><PROCESS>REDIRECT_URL</PROCESS><![CDATA[');
}
as a javascrip function, then you also can set the redirect URL properly in
your backend class.
But now to the main problem and its solution:
once you´ve reached your own administration page outside of the
administration-backend scope, you have the problem that you can´t go back to the
administration overview properly. It always will redirect you back to your
redirection page.
Solution: At the time your redirection page is called there is a session
variable set, called adminposition. It seems that the admin overview simply
calls this variable and it if is set simply redirects to the adminposition. To
disable this in our case unwanted behavior you have to remove the adminposition
variable once you reach your own administration page:
public byte[] getContent(
CmsObject cms,
String templateFile,
String elementName,
Hashtable theParameters,
String templateSelector)
throws CmsException {
I_CmsSession session = (CmsSession)
cms.getRequestContext().getSession(true);
CmsXmlTemplateFile templateDocument = getOwnTemplateFile(cms,
templateFile, elementName, theParameters, templateSelector);
session.removeValue("adminposition");
return startProcessing(cms, templateDocument, elementName,
theParameters, templateFile);
}
Guess this sums it up, on how to redirect admin modules to your own
administration pages outside of the OpenCMS administration scope. If anybody has any
questions feel free to send me a mail. I might pack things up and send it to
Alex for putting it up on the webpage if enough people are interested.
Werner Punz Labor_C
http://www.labor-c.net
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
More information about the opencms-dev
mailing list