############################################################################ # Copyright 2009 Benjamin Kellermann # # # # This file is part of dudle. # # # # Dudle is free software: you can redistribute it and/or modify it under # # the terms of the GNU Affero General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # Dudle 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 Affero General Public # # License for more details. # # # # You should have received a copy of the GNU Affero General Public License # # along with dudle. If not, see . # ############################################################################ class HTML attr_accessor :body, :header def initialize(title) @title = title @header = {} @header["type"] = "text/html" # @header["type"] = "application/xhtml+xml" @header["charset"] = "utf-8" @body = "" @css = {} @atom = [] end def head ret = < #{@title} HEAD @css.each{|title,href| ret += "" ret += "" if title == "print" } @atom.each{|href| ret += "" } ret += "" ret end def add_css(href, title = "default") @css[title] ||= [] @css[title] << href end def add_atom(href) @atom << href end def add_cookie(key,value,path,expiretime) c = CGI::Cookie.new(key, value) c.path = path c.expires = expiretime @header["cookie"] = c end def << (bodycontent) @body += bodycontent end def out(cgi) cgi.out(@header){ < #{head} #{@body} HEAD } end end module Dudle def Dudle.tabs(active_tab) ret = "
" ret end end