diff --git a/Scripts/CentOS-Web/Apps/Home/page.py b/Scripts/CentOS-Web/Apps/Home/page.py index f703e1c..9376f3e 100755 --- a/Scripts/CentOS-Web/Apps/Home/page.py +++ b/Scripts/CentOS-Web/Apps/Home/page.py @@ -1,42 +1,15 @@ -#!/usr/bin/python -# -# Apps.Home.page -- This module intantiates Apps.xhtml module to -# create the xhtml output of home web applications. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- +"""Support module for page layout inside `Home' web application. +""" from Apps import page app = page.Layout() -def page_ads_release(): - """Returns last-release advertisements.""" - image = 'last-release.png' - return app.ads_release(image) - def page_navibar_tabs(): - """Returns application's main pages. + """Returns application main pages. - The application's main pages are organized as tabs in the + The application main pages are organized as tabs in the application navigation bar. There is one tab for each main page inside the application. @@ -48,9 +21,9 @@ def page_navibar_tabs(): attrs.append({'href': '/centos-web/?p=' + i.lower()}) if 'p' in app.qs.keys(): - focus = app.qs['p'][0] + focus = app.qs['p'][0].lower() else: - focus = names[0] + focus = names[0].lower() return app.navibar_app(names, attrs, focus) @@ -58,8 +31,8 @@ def page_navibar_tabs(): def page_content(): """Returns page content. - The page content to show is determined from the query string, - specifically from the value of `p' variable. + The page content is determined from the query string, specifically + from the value of `p' variable. """ if 'p' in app.qs.keys(): @@ -88,37 +61,35 @@ def page_content(): def main(): """Returns final output.""" - # Define application name. This value is used as reference to - # determine which application to load and what tab in the - # navigation bar to focus. + # Define page name. This value is used as reference to determine + # which application to load and what tab in the navigation bar to + # focus on. app.name = 'Home' - # Define application title. This value is dislayed on the - # browser's title bar. Notice that we concatenated the page class - # default value here. + # Define page title. This value is dislayed on the browser's title + # bar. Notice that we concatenated the page class default value + # here. app.title += ' :: Home' - page_header = app.logo() - page_header += app.ads_google() - page_header += app.navibar_top() - page_header += app.lastreleases() - page_header += app.appslinks() - page_header += page_navibar_tabs() - page_header = app.tag_div({'id': 'page-header'}, [4, 1], page_header, 1) - - page_body = page_content() + app.separator(indent=[12,1]) - page_body = app.tag_div({'id':'content'}, [8,1], page_body, 1) - page_body = app.tag_div({'id':'page-body'}, [4,1], page_body, 1) - - page_footer = app.tag_div({'id': 'page-footer'}, [4,1], app.credits(), 1) - - top = app.tag_a({'name':'top'}, [0,1]) - wrap = app.tag_div({'id': 'wrap'}, [0,1], page_header + page_body + page_footer) - body = app.tag_body('', [0,1], top + wrap) - - html = app.preamble() - html += app.tag_html({'xmlns': 'http://www.w3.org/1999/xhtml', 'dir': 'ltr', - 'lang': str(app.language), 'xml:lang': - str(app.language)}, [0,1], app.metadata() + body) + # Define page header. This is the information displayed + # between the page top and the page content. + app.header = app.logo() + app.header += app.ads_google() + app.header += app.navibar_top() + app.header += app.lastreleases() + app.header += app.appslinks() + app.header += page_navibar_tabs() + + # Define page body. This is the information displayed between the + # page header and page footer. + app.body = page_content() + + # Define page footer. This is the information displayed between + # the page bottom and the page content, the last information + # displayed in the page. + app.footer = app.credits() + + # Define page final layout. + html = app.page() return html