source: products/qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/csshover_save.cpy @ 1591

Last change on this file since 1591 was 372, checked in by chervol, 18 years ago

fixed interfaces

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1## Controller Python Script "csshover_save"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind state=state
7##bind subpath=traverse_subpath
8##parameters=enabled=False, csshovering=[], sheetId='csshover.css', title='CSS Hover'
9##title=
10##
11
12from Products.CMFCore.utils import getToolByName
13from Products.qPloneDropDownMenu.utils import addCSS
14folder = getToolByName(context, 'portal_skins').restrictedTraverse('custom')
15
16if csshovering.find('.cssHoverCSSExists {}') == -1: csshovering = '.cssHoverCSSExists {}\n\n' + csshovering
17if not sheetId in folder.objectIds():
18    if csshovering.find('Use this configlet in IE') != -1: csshovering = " "
19    addCSS(folder, sheetId, title, csshovering)
20    message = 'Added %s to plone_skins  custom folder. ' % sheetId
21else:
22    if csshovering.find('Use this configlet in IE') == -1:
23        getattr(folder, sheetId).manage_edit(csshovering,title)
24        message = 'Updated %s. ' % sheetId
25    else: message = 'Visit this page in IE to see and activate generated CSS. '
26cssreg = getToolByName(context, 'portal_css', None)
27if cssreg is not None:
28    stylesheet_ids = cssreg.getResourceIds()
29    if sheetId not in stylesheet_ids:
30        cssreg.registerStylesheet(id=sheetId, enabled=enabled)
31        try: cssreg.moveResource(sheetId, cssreg.getResourcePosition('textLarge.css')+1)
32        except: pass
33        cssreg.cookResources()
34    else:
35        cssreg.updateStylesheet(sheetId, **{'enabled' : enabled})
36        cssreg.cookResources()
37else:
38    message += "For activating csshover.css customize ploneCustom.css and add <dtml-var csshover.css> line before <dtml-var drop_down.css>"
39
40context.plone_utils.addPortalMessage(message)
41
42return state.set(status='success')
Note: See TracBrowser for help on using the repository browser.