#!/usr/bin/python # # This file is part of the Lampadas Documentation System. # # Copyright (c) 2000, 2001, 2002 David Merrill . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # """ Lampadas HTML Primitives Module This module generates HTML primitives. """ from Globals import * from Log import log from DataLayer import lampadas import re import string class Widgets: """ Generates low level widgets for use in constructing web pages. The use of the term "widget" is very loose since we also use this class to generate standard formats for some text items. """ def title(self, value): return WOStringIO('' % value).get_value() def title_compressed(self, value): """ Compress the title so it will display well in 80 characters. Just add spaces around all + signs, which lets the title wrap. """ parts = value.split('+') text = string.join(parts, ' + ') return text def short_title(self, value): return WOStringIO('' % value).get_value() def abstract(self, value): return '' def short_desc(self, value): return '' def pub_date(self, value): return '' def last_update(self, value): return '' def tickle_date(self, value): return '' def isbn(self, value): return '' def rating(self, value): return '' def copyright_holder(self, value): return '' def tf(self, name, value, lang): if value==1: v1, v2 = ' selected', '' elif value==0: v1, v2 = '', ' selected' else: v1, v2 = '', '' return WOStringIO('\n' % (name, v1, v2)).get_value() def doctable_layout(self, value='compact'): if value=='compact': compact, expanded = ' selected', '' elif value=='expanded': compact, expanded = '', ' selected' else: compact, expanded = 'compact', '' return WOStringIO('\n' % ('layout', compact, expanded)).get_value() def username(self, value): return '' def stylesheet(self, value): return '\n' def role_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def collection_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def type_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def doc_id(self, value, lang): combo = WOStringIO("") return combo.get_value() def sk_seriesid(self, value): combo = WOStringIO('\n") return combo.get_value() def replaced_by_id(self, value): combo = WOStringIO('\n") return combo.get_value() def doc_lang(self, value, lang): combo = WOStringIO("") return combo.get_value() def lang(self, value, lang): combo = WOStringIO("") return combo.get_value() def license_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def page_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def pub_status_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def format_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def dtd_code(self, value): combo = WOStringIO("") return combo.get_value() def review_status_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def tech_review_status_code(self, value, lang): combo = WOStringIO("") return combo.get_value() def topic_code(self, value, lang): combo = WOStringIO('") return combo.get_value() def filemode(self, value): if value > 0: return WOStringIO(octal2permission(value)).get_value() else: return '|strunknown|' widgets = Widgets()