each frame in its own function
This commit is contained in:
parent
176760d26c
commit
b08ecb38d6
|
@ -7,6 +7,7 @@ import os
|
|||
import wcs
|
||||
import wcs.root
|
||||
from wcs import template
|
||||
from wcs import errors
|
||||
|
||||
from wcs.categories import Category
|
||||
from wcs.formdef import FormDef
|
||||
|
@ -21,15 +22,25 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
template.html_top(default_org = _('Ma ville au quotidien'))
|
||||
|
||||
'<div id="gauche">'
|
||||
self.services()
|
||||
self.consultations()
|
||||
'</div>'
|
||||
'<div id="droite">'
|
||||
self.links()
|
||||
self.announces()
|
||||
'</div>'
|
||||
|
||||
|
||||
def services [html] (self):
|
||||
## Services
|
||||
'<div id="services">'
|
||||
'<h3>%s</h3>' % _('Services')
|
||||
|
||||
consultations_category = None
|
||||
self.consultations_category = None
|
||||
'<ul>'
|
||||
for category in Category.select(order_by = 'name'):
|
||||
if category.url_name == 'consultations':
|
||||
consultations_category = category
|
||||
self.consultations_category = category
|
||||
continue
|
||||
'<li>'
|
||||
'<strong>'
|
||||
|
@ -48,11 +59,12 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'</ul>'
|
||||
'</div>'
|
||||
|
||||
def consultations [html] (self):
|
||||
## Consultations
|
||||
'<div id="consultations">'
|
||||
'<h3>%s</h3>' % _('Consultations')
|
||||
formdefs = FormDef.select(lambda x: (
|
||||
x.category_id == consultations_category.id and not x.disabled),
|
||||
x.category_id == self.consultations_category.id and not x.disabled),
|
||||
order_by = 'name')
|
||||
'<ul>'
|
||||
for formdef in formdefs:
|
||||
|
@ -62,10 +74,7 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'</ul>'
|
||||
'</div>'
|
||||
|
||||
|
||||
'</div>'
|
||||
'<div id="droite">'
|
||||
|
||||
def links [html] (self):
|
||||
## Links
|
||||
try:
|
||||
links = FormDef.get_by_urlname('liens').data_class().select()
|
||||
|
@ -83,6 +92,8 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'</ul>'
|
||||
'</div>'
|
||||
|
||||
|
||||
def announces [html] (self):
|
||||
## Announces
|
||||
try:
|
||||
announces = FormDef.get_by_urlname('annonce').data_class().select()
|
||||
|
@ -103,13 +114,16 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'</div>'
|
||||
'</div>'
|
||||
|
||||
'</div>'
|
||||
|
||||
def informations_editeur [html] (self):
|
||||
template.html_top(_('Editor Informations'))
|
||||
article_html = str(os.path.join(get_publisher().app_dir, 'articles/editor_info.html'))
|
||||
if os.path.exists(str(article_html)):
|
||||
'<div class="article">'
|
||||
htmltext(file(article_html).read())
|
||||
'</div>'
|
||||
else:
|
||||
raise errors.TraversalError()
|
||||
|
||||
|
||||
wcs.root.RootDirectory = AlternateRootDirectory
|
||||
|
|
Reference in New Issue