| """Support module for page layout inside `Home' web application. |
| |
| """ |
| from Apps import page |
| |
| app = page.Layout() |
| |
| |
| def page_navibar(): |
| """Returns application main pages. |
| |
| The application main pages are organized as tabs in the |
| application navigation bar. There is one tab for each main page |
| inside the application. |
| |
| """ |
| names = ['Page1', 'Page2', 'Page3'] |
| attrs = [] |
| |
| for i in names: |
| attrs.append({'href': '/webenv/?p=' + i.lower()}) |
| |
| if 'p' in page.qs.keys(): |
| focus = page.qs['p'][0].lower() |
| else: |
| focus = '' |
| |
| return app.page_navibar(names, attrs, focus) |
| |
| |
| def page_content(): |
| """Returns page content. |
| |
| The page content is determined from the query string, specifically |
| from the value of `p' variable. |
| |
| """ |
| if 'p' in page.qs.keys(): |
| p = page.qs['p'][0].lower() |
| else: |
| p = '' |
| |
| if p == 'page1': |
| output = app.tag_p('', [12, 1], 'Page Empty.') |
| elif p == 'page2': |
| output = app.tag_p('', [12, 1], 'Page Empty.') |
| elif p == 'page3': |
| output = app.tag_p({}, [12, 1], 'Page Empty' ) |
| elif p == 'entry': |
| output = app.content_details() |
| else: |
| output = app.content_list() |
| |
| return output |
| |
| |
| def main(): |
| """Returns final output.""" |
| |
| |
| |
| |
| app.name = 'Home' |
| |
| |
| |
| |
| app.title += ' :: Home' |
| |
| |
| |
| app.header = app.logo() |
| app.header += app.google_ad_example() |
| app.header += app.navibar() |
| app.header += app.releases() |
| app.header += app.page_links() |
| app.header += page_navibar() |
| |
| |
| |
| app.body = page_content() |
| |
| |
| |
| |
| app.footer = app.credits() |
| |
| |
| html = app.page() |
| |
| return html |