Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
ResourceRegistries.tools.KSSRegistry.KSSRegistryTool Class Reference
Inheritance diagram for ResourceRegistries.tools.KSSRegistry.KSSRegistryTool:
Inheritance graph
[legend]
Collaboration diagram for ResourceRegistries.tools.KSSRegistry.KSSRegistryTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def clearKineticStylesheets
def finalizeContent
def manage_addKineticStylesheet
def manage_saveKineticStylesheets
def manage_removeKineticStylesheet
def registerKineticStylesheet
def updateKineticStylesheet
def getCompressionOptions
def getContentType

Public Attributes

 resources

Static Public Attributes

 id = config.KSSTOOLNAME
 meta_type = config.KSSTOOLTYPE
string title = 'KSS Registry'
tuple security = ClassSecurityInfo()
tuple manage_kssForm = PageTemplateFile('www/kssconfig', config.GLOBALS)
tuple manage_kssComposition = PageTemplateFile('www/ksscomposition', config.GLOBALS)
tuple manage_options
tuple attributes_to_compare = ('getExpression', 'getCookable', 'getCacheable')
string filename_base = 'ploneStyles'
string filename_appendix = '.kss'
string merged_output_prefix = u''
 cache_duration = config.KSS_CACHE_DURATION
 resource_class = KineticStylesheet

Private Member Functions

def _compressKSS

Static Private Attributes

 __implements__ = BaseRegistryTool.__implements__

Detailed Description

A Plone registry for managing the linking to kss files.

Definition at line 42 of file KSSRegistry.py.


Member Function Documentation

def ResourceRegistries.tools.KSSRegistry.KSSRegistryTool._compressKSS (   self,
  content,
  level = 'safe' 
) [private]

Definition at line 87 of file KSSRegistry.py.

00087 
00088     def _compressKSS(self, content, level='safe'):
00089         if level == 'full':
00090             return CSSPacker('full').pack(content)
00091         elif level == 'safe':
00092             return CSSPacker('safe').pack(content)
00093         else:
00094             return content

Here is the caller graph for this function:

Definition at line 84 of file KSSRegistry.py.

00084 
00085     def clearKineticStylesheets(self):
00086         self.clearResources()

Here is the call graph for this function:

Finalize the resource content.

Definition at line 96 of file KSSRegistry.py.

00096 
00097     def finalizeContent(self, resource, content):
00098         """Finalize the resource content."""
00099         compression = resource.getCompression()
00100         if compression != 'none' and not self.getDebugMode():
00101             orig_url = "%s/%s?original=1" % (self.absolute_url(), resource.getId())
00102             content = "/* %s */\n%s" % (orig_url,
00103                                      self._compressKSS(content, compression))
00104 
00105         return content

Here is the call graph for this function:

Compression methods for use in ZMI forms.

Definition at line 190 of file KSSRegistry.py.

00190 
00191     def getCompressionOptions(self):
00192         """Compression methods for use in ZMI forms."""
00193         return config.KSS_COMPRESSION_METHODS

Return the registry content type.

Definition at line 195 of file KSSRegistry.py.

00195 
00196     def getContentType(self):
00197         """Return the registry content type."""
00198         plone_utils = getToolByName(self, 'plone_utils')
00199         encoding = plone_utils.getSiteEncoding()
00200         return 'text/css;charset=%s' % encoding
00201 
00202 
00203 InitializeClass(KSSRegistryTool)

Here is the call graph for this function:

Here is the caller graph for this function:

def ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.manage_addKineticStylesheet (   self,
  id,
  expression = '',
  media = '',
  rel = 'stylesheet',
  title = '',
  rendering = 'import',
  enabled = False,
  cookable = True,
  compression = 'safe',
  cacheable = True,
  REQUEST = None 
)
Register a kineticstylesheet from a TTW request.

Definition at line 114 of file KSSRegistry.py.

00114 
00115                              cacheable=True, REQUEST=None):
00116         """Register a kineticstylesheet from a TTW request."""
00117         self.registerKineticStylesheet(id, expression, enabled,
00118                                        cookable, compression, cacheable)
00119         if REQUEST:
00120             REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])

Here is the call graph for this function:

Here is the caller graph for this function:

Remove kineticstylesheet from the ZMI.

Definition at line 149 of file KSSRegistry.py.

00149 
00150     def manage_removeKineticStylesheet(self, id, REQUEST=None):
00151         """Remove kineticstylesheet from the ZMI."""
00152         self.unregisterResource(id)
00153         if REQUEST:
00154             REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])

Here is the call graph for this function:

Save kineticstylesheets from the ZMI.

Updates the whole sequence. For editing and reordering.

Definition at line 122 of file KSSRegistry.py.

00122 
00123     def manage_saveKineticStylesheets(self, REQUEST=None):
00124         """Save kineticstylesheets from the ZMI.
00125 
00126         Updates the whole sequence. For editing and reordering.
00127         """
00128         debugmode = REQUEST.get('debugmode',False)
00129         self.setDebugMode(debugmode)
00130         autogroupingmode = REQUEST.get('autogroupingmode', False)
00131         self.setAutoGroupingMode(autogroupingmode)
00132         records = REQUEST.get('kineticstylesheets')
00133         records.sort(lambda a, b: a.sort - b.sort)
00134         self.resources = ()
00135         kineticstylesheets = []
00136         for r in records:
00137             kss = KineticStylesheet(r.get('id'),
00138                                     expression=r.get('expression', ''),
00139                                     enabled=r.get('enabled', False),
00140                                     cookable=r.get('cookable', False),
00141                                     cacheable=r.get('cacheable', False),
00142                                     compression=r.get('compression', 'safe'))
00143             kineticstylesheets.append(kss)
00144         self.resources = tuple(kineticstylesheets)
00145         self.cookResources()
00146         if REQUEST:
00147             REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])

Here is the call graph for this function:

def ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.registerKineticStylesheet (   self,
  id,
  expression = '',
  enabled = 1,
  cookable = True,
  compression = 'safe',
  cacheable = True,
  skipCooking = False 
)
Register a kineticstylesheet.

Definition at line 162 of file KSSRegistry.py.

00162 
00163                                   cacheable=True, skipCooking=False):
00164         """Register a kineticstylesheet."""
00165         kineticstylesheet = KineticStylesheet(id,
00166                                 expression=expression,
00167                                 enabled=enabled,
00168                                 cookable=cookable,
00169                                 compression=compression,
00170                                 cacheable=cacheable)
00171         self.storeResource(kineticstylesheet, skipCooking=skipCooking)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 173 of file KSSRegistry.py.

00173 
00174     def updateKineticStylesheet(self, id, **data):
00175         kineticstylesheet = self.getResourcesDict().get(id, None)
00176         if kineticstylesheet is None:
00177             raise ValueError, 'Invalid resource id %s' % (id)
00178         
00179         if data.get('expression', None) is not None:
00180             kineticstylesheet.setExpression(data['expression'])
00181         if data.get('enabled', None) is not None:
00182             kineticstylesheet.setEnabled(data['enabled'])
00183         if data.get('cookable', None) is not None:
00184             kineticstylesheet.setCookable(data['cookable'])
00185         if data.get('compression', None) is not None:
00186             kineticstylesheet.setCompression(data['compression'])
00187         if data.get('cacheable', None) is not None:
00188             kineticstylesheet.setCacheable(data['cacheable'])

Here is the call graph for this function:


Member Data Documentation

ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.__implements__ = BaseRegistryTool.__implements__ [static, private]

Definition at line 52 of file KSSRegistry.py.

tuple ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.attributes_to_compare = ('getExpression', 'getCookable', 'getCacheable') [static]

Definition at line 72 of file KSSRegistry.py.

Definition at line 76 of file KSSRegistry.py.

Definition at line 74 of file KSSRegistry.py.

Definition at line 73 of file KSSRegistry.py.

Definition at line 45 of file KSSRegistry.py.

tuple ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.manage_kssComposition = PageTemplateFile('www/ksscomposition', config.GLOBALS) [static]

Definition at line 59 of file KSSRegistry.py.

tuple ResourceRegistries.tools.KSSRegistry.KSSRegistryTool.manage_kssForm = PageTemplateFile('www/kssconfig', config.GLOBALS) [static]

Definition at line 58 of file KSSRegistry.py.

Initial value:
(
        {
            'label': 'KSS Registry',
            'action': 'manage_kssForm',
        },
        {
            'label': 'Merged KSS Composition',
            'action': 'manage_kssComposition',
        },
    )

Definition at line 61 of file KSSRegistry.py.

Definition at line 75 of file KSSRegistry.py.

Definition at line 46 of file KSSRegistry.py.

Definition at line 77 of file KSSRegistry.py.

Definition at line 133 of file KSSRegistry.py.

Definition at line 49 of file KSSRegistry.py.

Definition at line 47 of file KSSRegistry.py.


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