| """Support module for page layout inside `Sponsors' web application. |
| |
| """ |
| from Apps import page |
| |
| app = page.Layout() |
| |
| |
| def page_navibar(): |
| """Returns application's main pages. |
| |
| The application's main pages are organized as tabs in the |
| application navigation bar. There is one tab for each main page |
| inside the application. |
| |
| """ |
| names = ['Hardware', 'Hosting', 'Others'] |
| attrs = [] |
| |
| for i in names: |
| if 'app' in page.qs.keys(): |
| attrs.append({'href': '/webenv/?app=' + page.qs['app'][0].lower() + '&p=' + i.lower()}) |
| else: |
| attrs.append({'href': '/webenv/?p=' + i.lower()}) |
| |
| if 'p' in page.qs.keys(): |
| focus = page.qs['p'][0].lower() |
| else: |
| focus = names[0].lower() |
| |
| return app.page_navibar(names, attrs, focus) |
| |
| |
| def page_content(): |
| """Returns page content. |
| |
| The page content to show 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 = 'hardware' |
| |
| if p == 'hardware': |
| output = app.tag_h1({'class': 'title'}, [12, 1], 'Hardware Sponsors' ) |
| elif p == 'hosting': |
| output = app.tag_h1({'class': 'title'}, [12, 1], 'Hosting Sponsors' ) |
| elif p == 'others': |
| output = app.tag_h1({'class': 'title'}, [12, 1], 'Other Sponsors' ) |
| else: |
| output = app.tag_p('', [12, 1], 'Page empty.') |
| |
| return output |
| |
| |
| def main(): |
| """Returns final output.""" |
| |
| |
| |
| |
| app.name = 'Sponsors' |
| |
| |
| |
| |
| app.title += ' :: Sponsors' |
| |
| |
| |
| app.header = app.logo() |
| app.header += app.google_ad_example() |
| app.header += app.navibar() |
| app.header += app.page_links() |
| app.header += page_navibar() |
| |
| |
| |
| app.body = page_content() |
| |
| |
| |
| |
| app.footer = app.credits() |
| |
| |
| html = app.page() |
| |
| return html |