Beispiel #1
0
    def writeWidget(self, widget):
        assert isinstance(widget, Widget)
        title = htmltext(widget.getLabel())

        wr = self.write

        wr("""\
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
		"http://www.w3.org/TR/html4/loose.dtd">
		<html>
		<head>
		""")
        wr("<title>%s</title>" % title)
        if self.resource.stylesheet is not None:
            wr("""\
			<link rel=stylesheet type="text/css" href="%s">
			""" % (self.baseuri + self.resource.stylesheet))
        wr("""
		</head>
		<body>
		""")
        wr(self.BEFORE_LEFT_MARGIN)
        wr('''<a href="%s.">Home</a>''' % self.baseuri)
        if self.resource.db is not None:
            if len(self.resource.db._db.getBabelLangs()) > 1:
                wr('<p>')
                for lang in self.resource.db._db.getBabelLangs():
                    if lang.id == self.langs[0]:
                        wr(lang.id)
                    else:
                        self.renderLink(url=self.uriToSelf(lng=lang.id),
                                        label=lang.id)
                    wr(' ')
                wr('</p>')

        widget.asLeftMargin(self)
        wr(self.AFTER_LEFT_MARGIN)
        wr("""
		<table class="head">
		<tr>
		<td>
		""")
        widget.asPreTitle(self)
        wr('<p class="title">%s</p>' % title)
        wr("""
		</td>
		</tr>
		</table>
		""")

        widget.asBody(self)

        wr(self.BEFORE_FOOT)
        wr("""<td align="left" valign="center">""")
        self.writeLeftFooter()
        wr("</td>")

        wr(self.BETWEEN_FOOT)
        self.renderLink(url=self.uriToSelf())
        wr(self.AFTER_FOOT)
	def writeWidget(self,widget):
		assert isinstance(widget,Widget)
		title = htmltext(widget.getLabel())

		wr = self.write

		wr("""\
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
		"http://www.w3.org/TR/html4/loose.dtd">
		<html>
		<head>
		""")
		wr("<title>%s</title>" % title)
		if self.resource.stylesheet is not None:
			wr("""\
			<link rel=stylesheet type="text/css" href="%s">
			""" % (self.baseuri+self.resource.stylesheet))
		wr("""
		</head>
		<body>
		""")
		wr(self.BEFORE_LEFT_MARGIN)
		wr('''<a href="%s.">Home</a>''' % self.baseuri)
		if self.resource.db is not None:
			if len(self.resource.db._db.getBabelLangs()) > 1:
				wr('<p>')
				for lang in self.resource.db._db.getBabelLangs():
					if lang.id == self.langs[0]:
						wr(lang.id)
					else:
						self.renderLink(url=self.uriToSelf(lng=lang.id),
											 label=lang.id)
					wr(' ')
				wr('</p>')
					
		widget.asLeftMargin(self)
		wr(self.AFTER_LEFT_MARGIN)
		wr("""
		<table class="head">
		<tr>
		<td>
		""")
		widget.asPreTitle(self)
		wr('<p class="title">%s</p>' % title)
		wr("""
		</td>
		</tr>
		</table>
		""")

		widget.asBody(self)

		wr(self.BEFORE_FOOT)
		wr("""<td align="left" valign="center">""")
		self.writeLeftFooter()
		wr("</td>")
		
		wr(self.BETWEEN_FOOT)
		self.renderLink(url=self.uriToSelf())
		wr(self.AFTER_FOOT)
Beispiel #3
0
 def refToImage(self, src, tags=None, label=None):
     if label is None:
         label = src
     #print vars()
     src = self.baseuri + "images/" + src
     s = '<img src="%s" alt="%s"' % (src, htmltext(label))
     if tags is not None:
         s += tags
     s += ">"
     return s
	def refToImage(self,src,tags=None,label=None):
		if label is None:
			label = src
		#print vars()
		src = self.baseuri+"images/"+src
		s = '<img src="%s" alt="%s"' % (src,htmltext(label))
		if tags is not None:
			s += tags
		s += ">"
		return s
Beispiel #5
0
 def formatLabel(self, label):
     p = label.find(self.resource.db.schema.HK_CHAR)
     if p != -1:
         label = label[:p] + '<u>' + label[p + 1] + '</u>' + label[p + 2:]
     return str(htmltext(label))
	def formatLabel(self,label):
		p = label.find(self.resource.db.schema.HK_CHAR)
		if p != -1:
			label = label[:p] + '<u>' + label[p+1] + '</u>' + label[p+2:]
		return str(htmltext(label))