wcs/wcs/qommon/backoffice/menu.py

42 lines
1.5 KiB
Python

# w.c.s. - web application for online forms
# Copyright (C) 2005-2010 Entr'ouvert
#
# 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, see <http://www.gnu.org/licenses/>.
from quixote import get_response, get_request, get_publisher, get_session
from quixote.html import htmltext, TemplateIO
from .. import get_cfg
from .. import _
def generate_header_menu(selected = None):
return get_publisher().get_backoffice_root().generate_header_menu(selected=selected)
def html_top(section, title = None, scripts = None):
header_menu = generate_header_menu(section)
if not scripts:
script = ''
else:
script = '\n'.join(['<script src="%s" type="text/javascript"></script>' % x for x in scripts])
org_name = get_cfg('sp', {}).get('organization_name', get_publisher().APP_NAME)
site_name = get_cfg('misc', {}).get('sitename', org_name)
sitetitle = _('Back Office of %s') % site_name
if title:
sitetitle += ' - '
get_response().filter.update(locals())