Page MenuHomec4science

webpage.py.wml
No OneTemporary

File Metadata

Created
Sun, Oct 20, 10:32

webpage.py.wml

## $Id$
## CDSware Web Page Template.
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware 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.
##
## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
from config import *
from webuser import create_user_infobox
import re
## start Python:
<protect>## $Id$</protect>
<protect>## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
"""CDSware Web Page Template"""
page_template_header = """
<!-- DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware SOURCES. LOOK THERE FOR THE COPYRIGHT INFO. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><CDSNAME>: %s</title>
<link rev="made" href="mailto:<SUPPORTEMAIL>">
<link rel="stylesheet" href="<WEBURL>/img/cds.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="%s">
<meta name="keywords" content="%s">
</head>
<body>
<div class="pageheader">
%s
%s
%s
</div>
"""
page_template_footer = """
<div class="pagefooter">
%s
%s
</div>
</body>
</html>
"""
page_template_portal = """
<table border="0" cellspacing="0" cellpadding="0" width="100%%">
<tr valign="top">
<td class="pagestripemiddle" align="left">
%s
<br>
<strong class="headline"><span class="h1">%s</span></strong>
<p>
%s
</td>
<td class="pagestriperight" width="<CDSPAGESTRIPEWIDTH>" align="right" valign="top">
<CDSPAGEBOXRIGHTTOP>
%s
</td>
</tr>
</table>
"""
def create_navtrail(title,
previous_links,
prolog="""<table class="navtrailbox"><tr><td width="15">&nbsp;</td><td class="navtrailboxbody">""",
separator=""" &gt; """,
epilog="""</td></tr></table>"""):
"""create_navtrail(): create navigation trail table box
input: title = page title;
previous_links = the trail content from site title until current page (both ends exlusive).
"""
out = ""
if title != cdsname:
out += """<a class="navtrail" href="%s">%s</a>""" % (weburl, "Home")
if previous_links:
if out:
out += separator
out += previous_links
if title:
if out:
out += separator
if title==cdsname:
out += "Home"
else:
out += title
return prolog + out + epilog
def page(title, body, navtrail="", url="", description="", keywords="", uid=0, cdspagerightstripeadd="", cdspageheaderadd="", cdspagebodyadd="", cdspagefooteradd=""):
"""page(): display the cds page
input: title of the page;
body of the page in html format;
url to be displayed at the bottom right corner;
description goes to the metadata in the header of the HTML page
keywords goes to the metadata in the header of the html page
cdspageheaderadd is a message to be displayed just under the page header
cdspagefooteradd is a message to be dusplayed on the top of the page footer
output: the final cds page with header, footer, etc.
"""
out = page_template_header % (title, description, keywords, cdspageheader, cdspageheaderadd, create_navtrail(title, navtrail))
out = re.sub("<!--USERINFOBOX-->", create_user_infobox(uid), out)
out += page_template_portal % (cdspagebodyadd, title, body, cdspagerightstripeadd)
out += page_template_footer % (cdspagefooteradd, re.sub("<!--URL-->", url, cdspagefooter))
return out

Event Timeline