Ejemplo n.º 1
0
 def toXhtml(self, REQUEST, deep=True):
     standard.writeLog(self, '[toXhtml]')
     level = 0
     html = ''
     if 'ZMS_PAGE_HTML_HEADER' in REQUEST:
         html += getattr(self, REQUEST.get('ZMS_PAGE_HTML_HEADER'))(self,
                                                                    REQUEST)
     else:
         html += '<html>\n'
         html += '<head>\n'
         html += self.f_headMeta_Locale(self, REQUEST)
         html += '<title>%s</title>\n' % self.getTitle(REQUEST)
         html += '</head>\n'
         html += '<body>\n'
     print_html = self.printHtml(level, _globals.MySectionizer(), REQUEST,
                                 deep)
     try:
         html += print_html
     except:
         html += standard.writeError(self,
                                     "[toXhtml]: can't append printHtml")
     if 'ZMS_PAGE_HTML_FOOTER' in REQUEST:
         html += getattr(self, REQUEST.get('ZMS_PAGE_HTML_FOOTER'))(self,
                                                                    REQUEST)
     else:
         html += '</body>\n'
         html += '</html>\n'
     html = localHtml(self, html)
     html = localIndexHtml(self, self, level, html, xhtml=True)
     return html
Ejemplo n.º 2
0
 def getSecNo(self):
     sec_no = ''
     #-- [ReqBuff]: Fetch buffered value from Http-Request.
     parentNode = self.getParentNode()
     if parentNode is None or \
        getattr(parentNode, 'meta_type', None) not in self.dGlobalAttrs:
         return sec_no
     reqBuffId = 'getSecNo'
     try:
         levelnfc = parentNode.fetchReqBuff('%s_levelnfc' % reqBuffId)
         if levelnfc > 0:
             sec_no = parentNode.fetchReqBuff('%s_%s' %
                                              (reqBuffId, self.id))
     except:
         levelnfc = parentNode.attr('levelnfc')
         parentNode.storeReqBuff('%s_levelnfc' % reqBuffId, levelnfc,
                                 self.REQUEST)
         if levelnfc is not None and len(levelnfc) > 0:
             parent_no = parentNode.getSecNo()
             sectionizer = _globals.MySectionizer(levelnfc)
             siblings = parentNode.filteredChildNodes(self.REQUEST)
             for sibling in siblings:
                 curr_no = ''
                 level = 0
                 if sibling.isPageElement():
                     format = sibling.attr('format')
                     if format is not None and format.find('headline') == 0:
                         level = int(
                             format[len(standard.id_prefix(format)):]) - 1
                 elif sibling.isPage():
                     level = 1
                 if level > 0:
                     sectionizer.processLevel(level)
                     curr_no = parent_no + str(sectionizer)
                     if self == sibling:
                         sec_no = curr_no
                 #-- [ReqBuff]: Store value in buffer of Http-Request.
                 parentNode.storeReqBuff('%s_%s' % (reqBuffId, sibling.id),
                                         curr_no, self.REQUEST)
     #-- [ReqBuff]: Return value.
     return sec_no