579: #line 687 "web_weaver.ipk"
580: def mk_contents(self,toc_filename,target):
581: if 'weavers' in self.process.trace:
582: print 'Generating Table of Contents'
583: self.toc_sink = named_file_sink(
584: self.pass_frame,
585: self.basedir+toc_filename,
586: self.master.weaver_prefix,
587: eol=self.eol)
588: if 'weavers' in self.process.trace:
589: print 'File name',self.toc_sink.name
590: self.mk_head(self.toc_sink)
591: w = self.toc_sink.writeline
592: w( '<BODY lang="'+self.language+'" onload="loadHandler()" onclick="clickHandler()">')
593: if not target:
594: nav = '<DIV CLASS="NAVIGATION">'+self.home_anchor+' '+self.frames_anchor+'<BR><HR></DIV>'
595: self.toc_sink.writeline(nav)
596: w('<H1>'+self.tr_phrase('Table of Contents')+'</H1>')
597: w(stacking_weaver.MSIE_treehandler)
598: last_level = -1
599: if self.toc:
600: i = 0
601: level, hnum, href, text = self.toc[i][:4]
602: next_level = 0
603: if len(self.toc) > i+1: next_level = self.toc[i+1][0]
604: self.emit_contents_line(level, hnum, href, text, level<next_level, target)
605: divid = 'h'+hnum+'d'
606:
607: w('<DIV></DIV><DIV ID='+divid+' style="display:">')
608: last_level = level
609: for i in range(1, len(self.toc)):
610: level, hnum, href, text = self.toc[i][:4]
611: next_level = 0
612: if len(self.toc) > i+1: next_level = self.toc[i+1][0]
613: while level <= last_level:
614: self.toc_sink.writeline('</DIV>')
615: last_level = last_level - 1
616: self.emit_contents_line(level, hnum, href, text, level<next_level, target)
617: divid = 'h'+hnum+'d'
618: w('<DIV></DIV><DIV ID='+divid+' style="display:">')
619: last_level = level
620: while 1 <= last_level:
621: w('</DIV>')
622: last_level = last_level - 1
623: w( '</BODY>')
624: w( '</HTML>')
625: del self.toc_sink
626: return 1
627:
628: def emit_contents_line(self, level, hnum, href, text, enabled, target):
629: self.toc_sink.writeline(' '*(3*level))
630: headid ='h'+hnum
631: flag = 'disabled'
632: if enabled: flag = ''
633: self.toc_sink.writeline('<INPUT ID='+headid+' CLASS="Button" TYPE="Radio" '+flag+'>')
634: if target:
635: self.toc_sink.writeline('<A HREF="'+href+'" TARGET="'+target+'">'+text+'</A>')
636: else:
637: self.toc_sink.writeline('<A HREF="'+href+'">'+text+'</A>')
638: