Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Member Functions
CMFPlone.migrations.v3_0.alphas.installKss Class Reference
Collaboration diagram for CMFPlone.migrations.v3_0.alphas.installKss:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def install_resources
def install_mimetype
def install_skins
def installKss

Public Attributes

 portal
 out

Static Public Attributes

list js_unregister = []
list js_all
list css_all
list kss_all

Static Private Member Functions

def _old_res

Detailed Description

Definition at line 291 of file alphas.py.


Constructor & Destructor Documentation

def CMFPlone.migrations.v3_0.alphas.installKss.__init__ (   self,
  portal,
  out 
)

Definition at line 311 of file alphas.py.

00311 
00312     def __init__(self, portal, out):
00313         self.portal = portal
00314         self.out = out
00315         self.installKss()

Definition at line 388 of file alphas.py.

00388 
00389     def installKss(self):
00390         out = self.out
00391         self.install_mimetype() 
00392         self.install_resources() 
00393         self.install_skins() 
00394         out.append("Succesfully migrated portal to KSS")
00395 

Here is the call graph for this function:


Member Function Documentation

def CMFPlone.migrations.v3_0.alphas.installKss._old_res (   tool,
  id 
) [static, private]

Definition at line 317 of file alphas.py.

00317 
00318     def _old_res(tool, id):
00319         return tool.getResourcesDict().get(id, None)
     

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 356 of file alphas.py.

00356 
00357     def install_mimetype(self):
00358         portal, out = self.portal, self.out
00359         mt = getToolByName(portal, 'mimetypes_registry')
00360         mt.manage_addMimeType('KSS (Azax) StyleSheet', ('text/kss', ), ('kss', ), 'text.png',
00361                                binary=0, globs=('*.kss', ))
00362         out.append("Registered kss mimetype")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 320 of file alphas.py.

00320 
00321     def install_resources(self):
00322         portal, out = self.portal, self.out
00323         jstool = getToolByName(portal, 'portal_javascripts')
00324         for id in self.js_unregister:
00325             if self._old_res(jstool, id):
00326                 jstool.unregisterResource(id)
00327                 out.append("Unregistered old %s" % (id, ))
00328         for id, compression, enabled in self.js_all:
00329             if not self._old_res(jstool, id):
00330                 jstool.registerScript(
00331                     id = id,
00332                     enabled = enabled,
00333                     cookable = True,
00334                     compression = compression,
00335                     )
00336         csstool = getToolByName(portal, 'portal_css')
00337         for css in self.css_all:
00338             if not self._old_res(csstool, css):
00339                 csstool.manage_addStylesheet(
00340                     id = css,
00341                     rel = 'stylesheet',
00342                     rendering = 'link',
00343                     enabled = True,
00344                     cookable = True,
00345                     )
00346         # kss stylesheets
00347         for kss in self.kss_all:
00348             if not self._old_res(csstool, kss):
00349                 csstool.manage_addStylesheet(id=kss,
00350                     rel='k-stylesheet',
00351                     rendering = 'link',
00352                     enabled=True,
00353                     cookable=False,
00354                     )
00355         out.append("Registered kss resources")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 363 of file alphas.py.

00363 
00364     def install_skins(self):
00365         portal, out = self.portal, self.out
00366         st = getToolByName(portal, 'portal_skins')
00367         skins = ['Plone Default', 'Plone Tableless']
00368         if not hasattr(aq_base(st), 'plone_kss'):
00369             createDirectoryView(st, 'CMFPlone/skins/plone_kss')
00370         if not hasattr(aq_base(st), 'archetypes_kss'):
00371             createDirectoryView(st, 'Archetypes/skins/archetypes_kss')
00372         selections = st._getSelections()
00373         for s in skins:
00374             if not selections.has_key(s):
00375                continue
00376             path = st.getSkinPath(s)
00377             path = [p.strip() for p in  path.split(',')]
00378             path_changed = False
00379             if not 'plone_kss' in path:
00380                 path.append('plone_kss')
00381                 path_changed = True
00382             if not 'archetypes_kss' in path:
00383                 path.append('archetypes_kss')
00384                 path_changed = True
00385             if path_changed:
00386                 st.addSkinSelection(s, ','.join(path))
00387                 out.append('Added missing skins to %s' % s)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Initial value:
[
        'ploneKss.css',
    ]

Definition at line 302 of file alphas.py.

Initial value:
[
        ('++resource++MochiKit.js', 'none', False),
        ('++resource++prototype.js', 'safe', True),
        ('++resource++effects.js', 'safe', True),
        ('++resource++kukit.js', 'none', True),
    ]

Definition at line 295 of file alphas.py.

Definition at line 293 of file alphas.py.

Initial value:
[
        'plone.kss',
        'at.kss',
    ]

Definition at line 306 of file alphas.py.

Definition at line 313 of file alphas.py.

Definition at line 312 of file alphas.py.


The documentation for this class was generated from the following file: