Home

# automatic style switching and css

Updated:
Created:

plone.css produces different content depending on how I access the plone site. This is ackward.

I have an folder 'ajax' with an access_rule in my plone site ('noscenda'):

from string import split,join
REQUEST = container.REQUEST

# Set the skin
changeSkin = context.changeSkin('AjaxSkin',REQUEST)

# Tell absoulute_url and friends to use the correct path
if not hasattr(REQUEST,'VIRTUAL_URL'):
REQUEST.set('SiteRootPATH', '/noscenda/ajax')

stack = REQUEST['TraversalRequestNameStack']
# make the request for the plone site
stack.append('noscenda')

Now depending on wether I access http://localhost:8080/noscenda/ajax/plone.css or http://localhost:8080/noscenda/plone.css I get different results. Actually, thinking about it, it seems to be ok - there are different styles applied after all.

Whats the real problem - tinymce in its image popup is not including the right css. This is because its thinking that the portal_url is /noscenda, not noscenda/ajax.This can be seen in the title attribute of the textarea which tinymce uses.

Some searches further on, there is a portal_tinymce utility, which sets the portal_url in utility.py (in the tinymce egg):

portal = getUtility(ISiteRoot)
results['portal_url'] =  aq_inner(portal).absolute_url()

Now changing that would mean pathing the tinymce file. There must be a way around that.

[…lost some text here…]

I need to be clear here: when I go to http://localhost:8080/noscenda/ajax/index.html, the popup includes the 'normal' plone styles - this is wrong, because the AjaxSkin should be active -, while when going through http://localhost/wp/index.html I see the ugly popup, which actually is the ugly but right behaviour.