[opencms-dev] Direct edit and multi-site... is it possible?

Claus Priisholm cpr at codedroids.com
Tue Apr 4 12:54:01 CEST 2006


I have following setup:

<sites>                             	
   <workplace-server>http://siteA</workplace-server>
   <default-uri>/sites/default/</default-uri>
   <site server="http://siteA" uri="/sites/default/" />
   <site server="http://siteB" uri="/sites/siteb/" />
</sites>

The login code looks like this:

CmsJspLoginBean cms = new CmsJspLoginBean(pageContext, request, response);
cms.login(username, password);
CmsProject proj = cms.getCmsObject().readProject("Offline");
cms.getRequestContext().setCurrentProject(proj);
if(someCriteria) {
   cms.getRequestContext().setSiteRoot("/sites/default/");
   response.sendRedirect(cms.link("/index.html"));
} else {
   cms.getRequestContext().setSiteRoot("/sites/siteb/");
   response.sendRedirect(cms.link("/index.html"));
}

Now if a user (with permission to edit) access the login page via 
http://siteA and the someCriteria is true the result is as expected - 
the /sites/default/index.html is shown.

But if someCriteria is false the user should end up with the 
/sites/siteb/index.html. This does not happen (in my case the contents 
it shows the contents of /sites/default/index.html but it is using the 
template assigned to /sites/siteb/index.html).

When you start editing various other funny stuff happens. I've been able 
to open the editor via direct edit, but could not save the file because 
the backup file ~index.html was actually create in the other site.

It seems that parts of the stuff gets handled correct, while other parts 
seems to default to the default-site despite the setSiteRoot()...

This is 6.0.3 using the mod_jk rewrite setup.


-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms



More information about the opencms-dev mailing list