|
|
4e1c91 |
"""Support module for page layout inside `Home' web application.
|
|
|
8c93bb |
|
|
|
4e1c91 |
"""
|
|
|
8c93bb |
from Apps import page
|
|
|
8c93bb |
|
|
|
8c93bb |
app = page.Layout()
|
|
|
8c93bb |
|
|
|
8c93bb |
|
|
|
8c93bb |
def page_navibar_tabs():
|
|
|
4e1c91 |
"""Returns application main pages.
|
|
|
8c93bb |
|
|
|
4e1c91 |
The application main pages are organized as tabs in the
|
|
|
8c93bb |
application navigation bar. There is one tab for each main page
|
|
|
8c93bb |
inside the application.
|
|
|
8c93bb |
|
|
|
8c93bb |
"""
|
|
|
8c93bb |
names = ['Erratas', 'Articles', 'Events']
|
|
|
8c93bb |
attrs = []
|
|
|
8c93bb |
|
|
|
8c93bb |
for i in names:
|
|
|
8c93bb |
attrs.append({'href': '/centos-web/?p=' + i.lower()})
|
|
|
8c93bb |
|
|
|
8c93bb |
if 'p' in app.qs.keys():
|
|
|
4e1c91 |
focus = app.qs['p'][0].lower()
|
|
|
8c93bb |
else:
|
|
|
4e1c91 |
focus = names[0].lower()
|
|
|
8c93bb |
|
|
|
8c93bb |
return app.navibar_app(names, attrs, focus)
|
|
|
8c93bb |
|
|
|
8c93bb |
|
|
|
8c93bb |
def page_content():
|
|
|
8c93bb |
"""Returns page content.
|
|
|
8c93bb |
|
|
|
4e1c91 |
The page content is determined from the query string, specifically
|
|
|
4e1c91 |
from the value of `p' variable.
|
|
|
8c93bb |
|
|
|
8c93bb |
"""
|
|
|
8c93bb |
if 'p' in app.qs.keys():
|
|
|
8c93bb |
p = app.qs['p'][0].lower()
|
|
|
8c93bb |
else:
|
|
|
8c93bb |
p = 'erratas'
|
|
|
8c93bb |
|
|
|
8c93bb |
if p == 'erratas':
|
|
|
8c93bb |
output = app.tag_h1({'class': 'title'}, [12, 1], 'Erratas' )
|
|
|
8c93bb |
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
|
|
|
8c93bb |
output += app.tag_p({}, [12, 1], 'This is a paragraph in the sense of improvement. '*30 )
|
|
|
8c93bb |
output += app.tag_h2({'class': 'title'}, [12, 1], 'For A Better OS' )
|
|
|
8c93bb |
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
|
|
|
8c93bb |
output += app.admonition('Caution', '', app.tag_p({}, [16, 1], 'This is a paragraph. '*5))
|
|
|
8c93bb |
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
|
|
|
8c93bb |
elif p == 'articles':
|
|
|
8c93bb |
output = app.tag_h1({'class': 'title'}, [12, 1], 'Articles' )
|
|
|
8c93bb |
elif p == 'events':
|
|
|
8c93bb |
output = app.tag_h1({'class': 'title'}, [12, 1], 'Events' )
|
|
|
8c93bb |
else:
|
|
|
8c93bb |
output = app.tag_p('', [12, 1], 'Page Empty.')
|
|
|
8c93bb |
|
|
|
8c93bb |
return app.content(output)
|
|
|
8c93bb |
|
|
|
8c93bb |
|
|
|
8c93bb |
def main():
|
|
|
8c93bb |
"""Returns final output."""
|
|
|
8c93bb |
|
|
|
4e1c91 |
# Define page name. This value is used as reference to determine
|
|
|
4e1c91 |
# which application to load and what tab in the navigation bar to
|
|
|
4e1c91 |
# focus on.
|
|
|
8c93bb |
app.name = 'Home'
|
|
|
8c93bb |
|
|
|
4e1c91 |
# Define page title. This value is dislayed on the browser's title
|
|
|
4e1c91 |
# bar. Notice that we concatenated the page class default value
|
|
|
4e1c91 |
# here.
|
|
|
8c93bb |
app.title += ' :: Home'
|
|
|
8c93bb |
|
|
|
4e1c91 |
# Define page header. This is the information displayed
|
|
|
4e1c91 |
# between the page top and the page content.
|
|
|
4e1c91 |
app.header = app.logo()
|
|
|
4e1c91 |
app.header += app.ads_google()
|
|
|
4e1c91 |
app.header += app.navibar_top()
|
|
|
4e1c91 |
app.header += app.lastreleases()
|
|
|
4e1c91 |
app.header += app.appslinks()
|
|
|
4e1c91 |
app.header += page_navibar_tabs()
|
|
|
4e1c91 |
|
|
|
4e1c91 |
# Define page body. This is the information displayed between the
|
|
|
4e1c91 |
# page header and page footer.
|
|
|
4e1c91 |
app.body = page_content()
|
|
|
4e1c91 |
|
|
|
4e1c91 |
# Define page footer. This is the information displayed between
|
|
|
4e1c91 |
# the page bottom and the page content, the last information
|
|
|
4e1c91 |
# displayed in the page.
|
|
|
4e1c91 |
app.footer = app.credits()
|
|
|
4e1c91 |
|
|
|
4e1c91 |
# Define page final layout.
|
|
|
4e1c91 |
html = app.page()
|
|
|
8c93bb |
|
|
|
8c93bb |
return html
|