Logo Search packages:      
Sourcecode: zope-cpsskins version File versions  Download package

def CPSSkins::PortalTheme::PortalTheme::renderJS (   self,
  REQUEST = None,
  kw 
)

Generates the javascript code for this theme 

Definition at line 317 of file PortalTheme.py.

00317                                           :
        """ Generates the javascript code for this theme """

        if REQUEST is not None:
            kw.update(REQUEST.form)

        self.setCacheHeaders(content_type='text/javascript', **kw)

        cache = self.getJSCache()
        index = tuple(kw.items())

        cleanup_date = getattr(self, 'js_cache_cleanup_date', 0)
        last_update = cache.getLastUpdate()
        if last_update < cleanup_date:
            cache.invalidate()

        js = cache.getEntry(index)

        if js is None:
            js = ''
            done_types = []
            page = self.getPageContainer(**kw)
            if page is None:
                return ''
            for templet in page.getTemplets():
                ti = templet.getTypeInfo()
                if ti is None:
                    continue
                templet_type = ti.getId()
                if templet_type in done_types:
                    continue
                if templet_type != 'Portlet Box Templet':
                    done_types.append(templet_type)
                js_code = templet.render_js(**kw)
                if js_code:
                    js += js_code
            cache.setEntry(index, js)
        return '<!--\n%s\n//-->' % js

    security.declarePublic('setCacheHeaders')
    def setCacheHeaders(self, content_type='', editing=0, **kw):


Generated by  Doxygen 1.6.0   Back to index