moved from news to announces

This commit is contained in:
Frédéric Péters 2006-08-16 13:45:41 +00:00
parent 620fad328c
commit 1af7997e69
5 changed files with 81 additions and 70 deletions

View File

@ -1,7 +1,7 @@
import gettext
import modules.root
import modules.news
import modules.announces
import modules.links
import modules.admin

View File

@ -12,10 +12,10 @@ from wcs.forms.common import FormStatusPage
from wcs import errors
class NewsFormStatusPage(PublicFormStatusPage):
class AnnouncesFormStatusPage(PublicFormStatusPage):
def __init__(self, component):
html_top('news', title = 'XX')
formdef = FormDef.get_by_urlname('actualite')
html_top('announces', title = 'XX')
formdef = FormDef.get_by_urlname('annonce')
try:
filled = formdef.data_class().get(component)
except KeyError:
@ -29,7 +29,7 @@ class NewsFormStatusPage(PublicFormStatusPage):
return # FIXME: must not stay like this
def html_top(self, title = None):
return html_top('news', title)
return html_top('announces', title)
def _q_index [html] (self):
return self.status()
@ -40,7 +40,7 @@ class NewsFormStatusPage(PublicFormStatusPage):
def submit(self, form, comment_only = False):
t = PublicFormStatusPage.submit(self, form, comment_only = comment_only)
if t:
t = t.replace('/actualite/', '/admin/news/')
t = t.replace('/annonce/', '/admin/announces/')
return t
def delete [html] (self):
@ -54,7 +54,7 @@ class NewsFormStatusPage(PublicFormStatusPage):
return redirect('..')
if not form.is_submitted() or form.has_errors():
get_response().breadcrumb.append(('delete', _('Delete')))
html_top('news', title = _('Delete Link'))
html_top('announces', title = _('Delete Link'))
'<h2>%s %s</h2>' % (_('Deleting Link:'), self.filled.get_field_value('Titre'))
form.render()
else:
@ -64,29 +64,29 @@ class NewsFormStatusPage(PublicFormStatusPage):
edit = PublicFormStatusPage.wfedit
class NewsFormPage(FormPage):
class AnnouncesFormPage(FormPage):
def __init__(self):
FormPage.__init__(self, 'actualite')
FormPage.__init__(self, 'annonce')
def _q_lookup(self, component):
filled = self.formdef.data_class().get(component)
return NewsFormStatusPage(self.formdef, filled)
return AnnouncesFormStatusPage(self.formdef, filled)
class NewsDirectory(Directory):
class AnnouncesDirectory(Directory):
_q_exports = ['', 'new', 'listing']
label = N_('News')
label = N_('Announces')
def _q_index [html] (self):
html_top('news', _('News'))
get_response().breadcrumb.append(('news', _('News')))
html_top('announces', _('Announces'))
get_response().breadcrumb.append(('announces', _('Announces')))
'<p><a href="new">%s</a></p>' % _('New')
try:
news = FormDef.get_by_urlname('actualite').data_class().select()
announces = FormDef.get_by_urlname('annonce').data_class().select()
except:
news = []
announces = []
'<ul class="biglist">'
for l in news:
for l in announces:
link_id = l.id
'<li>'
'<strong class="label">%s</strong>' % l.get_field_value('Titre')
@ -98,21 +98,21 @@ class NewsDirectory(Directory):
'</ul>'
def new(self):
html_top('news', title = 'XX')
s = NewsFormPage()._q_index()
html_top('announces', title = 'XX')
s = AnnouncesFormPage()._q_index()
# fixing up breadcrumb
for i, data in enumerate(get_response().breadcrumb):
if data[0] == 'actualite/':
get_response().breadcrumb[i] = ('news', _('News'))
if data[0] == 'annonce/':
get_response().breadcrumb[i] = ('announces', _('Announces'))
break
return s
def _q_lookup(self, component):
html_top('news', title = 'XX')
get_response().breadcrumb.append(('news', _('News')))
return NewsFormStatusPage(component)
html_top('announces', title = 'XX')
get_response().breadcrumb.append(('announces', _('Announces')))
return AnnouncesFormStatusPage(component)
def listing(self):
return redirect('.')
wcs.admin.root.register_admin_page('news', NewsDirectory())
wcs.admin.root.register_admin_page('announces', AnnouncesDirectory())

View File

@ -83,17 +83,17 @@ class AlternateRootDirectory(OldRootDirectory):
'</ul>'
'</div>'
## News
## Announces
try:
news = FormDef.get_by_urlname('actualite').data_class().select()
announces = FormDef.get_by_urlname('annonce').data_class().select()
except KeyError:
news = None
announces = None
if news:
'<div id="news">'
'<h3>%s</h3>' % _('News')
for item in news:
'<div class="newsitem">'
if announces:
'<div id="announces">'
'<h3>%s</h3>' % _('Announces to citizens')
for item in announces:
'<div class="announce-item">'
'<h4>'
item.get_field_value('Titre')
'</h4>'

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-08-16 14:03+0200\n"
"POT-Creation-Date: 2006-08-16 15:44+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -43,22 +43,22 @@ msgstr ""
msgid "(new)"
msgstr ""
#: ../extra/modules/admin.ptl:76 ../extra/modules/admin.ptl:127
#: ../extra/modules/admin.ptl:76 ../extra/modules/admin.ptl:129
#: ../extra/modules/root.ptl:109
msgid "Editor Informations"
msgstr ""
#: ../extra/modules/admin.ptl:79 ../extra/modules/admin.ptl:128
#: ../extra/modules/admin.ptl:79 ../extra/modules/admin.ptl:130
msgid "Accessibility Statement"
msgstr ""
#: ../extra/modules/admin.ptl:92 ../extra/modules/links.ptl:51
#: ../extra/modules/news.ptl:51
#: ../extra/modules/announces.ptl:51
msgid "Submit"
msgstr ""
#: ../extra/modules/admin.ptl:93 ../extra/modules/links.ptl:52
#: ../extra/modules/news.ptl:52
#: ../extra/modules/announces.ptl:52
msgid "Cancel"
msgstr ""
@ -66,45 +66,45 @@ msgstr ""
msgid "Editing Public Page"
msgstr ""
#: ../extra/modules/admin.ptl:114 ../extra/modules/admin.ptl:120
#: ../extra/modules/admin.ptl:121 ../extra/modules/admin.ptl:122
#: ../extra/modules/admin.ptl:116 ../extra/modules/admin.ptl:122
#: ../extra/modules/admin.ptl:123 ../extra/modules/admin.ptl:124
msgid "Control Panel"
msgstr ""
#: ../extra/modules/admin.ptl:124
#: ../extra/modules/admin.ptl:126
msgid "Public Pages"
msgstr ""
#: ../extra/modules/admin.ptl:131
#: ../extra/modules/admin.ptl:133
msgid "Available Forms"
msgstr ""
#: ../extra/modules/admin.ptl:170
#: ../extra/modules/admin.ptl:172
msgid "Up to date"
msgstr ""
#: ../extra/modules/admin.ptl:172
#: ../extra/modules/admin.ptl:174
msgid "Download new form"
msgstr ""
#: ../extra/modules/admin.ptl:173 ../extra/modules/links.ptl:82
#: ../extra/modules/news.ptl:82
#: ../extra/modules/admin.ptl:175 ../extra/modules/links.ptl:82
#: ../extra/modules/announces.ptl:82
msgid "New"
msgstr ""
#: ../extra/modules/links.ptl:50 ../extra/modules/news.ptl:50
#: ../extra/modules/links.ptl:50 ../extra/modules/announces.ptl:50
msgid "You are about to irrevocably delete this link."
msgstr ""
#: ../extra/modules/links.ptl:56 ../extra/modules/news.ptl:56
#: ../extra/modules/links.ptl:56 ../extra/modules/announces.ptl:56
msgid "Delete"
msgstr ""
#: ../extra/modules/links.ptl:57 ../extra/modules/news.ptl:57
#: ../extra/modules/links.ptl:57 ../extra/modules/announces.ptl:57
msgid "Delete Link"
msgstr ""
#: ../extra/modules/links.ptl:58 ../extra/modules/news.ptl:58
#: ../extra/modules/links.ptl:58 ../extra/modules/announces.ptl:58
msgid "Deleting Link:"
msgstr ""
@ -114,12 +114,6 @@ msgstr ""
msgid "Links"
msgstr ""
#: ../extra/modules/news.ptl:77 ../extra/modules/news.ptl:80
#: ../extra/modules/news.ptl:81 ../extra/modules/news.ptl:106
#: ../extra/modules/news.ptl:112 ../extra/modules/root.ptl:94
msgid "News"
msgstr ""
#: ../extra/modules/root.ptl:21
msgid "Ma ville au quotidien"
msgstr ""
@ -135,3 +129,13 @@ msgstr ""
#: ../extra/modules/root.ptl:77
msgid "Useful links"
msgstr ""
#: ../extra/modules/root.ptl:94
msgid "Announces to citizens"
msgstr ""
#: ../extra/modules/announces.ptl:77 ../extra/modules/announces.ptl:80
#: ../extra/modules/announces.ptl:81 ../extra/modules/announces.ptl:106
#: ../extra/modules/announces.ptl:112
msgid "Announces"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: auquotidien 0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-08-16 14:13+0200\n"
"POT-Creation-Date: 2006-08-16 15:44+0200\n"
"PO-Revision-Date: 2006-08-16 13:12+0200\n"
"Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
"Language-Team: none\n"
@ -53,12 +53,12 @@ msgid "Accessibility Statement"
msgstr "Déclaration d'accessibilité"
#: ../extra/modules/admin.ptl:92 ../extra/modules/links.ptl:51
#: ../extra/modules/news.ptl:51
#: ../extra/modules/announces.ptl:51
msgid "Submit"
msgstr "Valider"
#: ../extra/modules/admin.ptl:93 ../extra/modules/links.ptl:52
#: ../extra/modules/news.ptl:52
#: ../extra/modules/announces.ptl:52
msgid "Cancel"
msgstr "Annuler"
@ -88,23 +88,23 @@ msgid "Download new form"
msgstr "Télécharger nouveau formulaire"
#: ../extra/modules/admin.ptl:175 ../extra/modules/links.ptl:82
#: ../extra/modules/news.ptl:82
#: ../extra/modules/announces.ptl:82
msgid "New"
msgstr "Nouveau"
#: ../extra/modules/links.ptl:50 ../extra/modules/news.ptl:50
#: ../extra/modules/links.ptl:50 ../extra/modules/announces.ptl:50
msgid "You are about to irrevocably delete this link."
msgstr "Vous allez définitivement supprimer ce lien."
#: ../extra/modules/links.ptl:56 ../extra/modules/news.ptl:56
#: ../extra/modules/links.ptl:56 ../extra/modules/announces.ptl:56
msgid "Delete"
msgstr "Supprimer"
#: ../extra/modules/links.ptl:57 ../extra/modules/news.ptl:57
#: ../extra/modules/links.ptl:57 ../extra/modules/announces.ptl:57
msgid "Delete Link"
msgstr "Supprimer le lien"
#: ../extra/modules/links.ptl:58 ../extra/modules/news.ptl:58
#: ../extra/modules/links.ptl:58 ../extra/modules/announces.ptl:58
msgid "Deleting Link:"
msgstr "Suppression du lien :"
@ -114,12 +114,6 @@ msgstr "Suppression du lien :"
msgid "Links"
msgstr "Liens"
#: ../extra/modules/news.ptl:77 ../extra/modules/news.ptl:80
#: ../extra/modules/news.ptl:81 ../extra/modules/news.ptl:106
#: ../extra/modules/news.ptl:112 ../extra/modules/root.ptl:94
msgid "News"
msgstr "Actualités"
#: ../extra/modules/root.ptl:21
msgid "Ma ville au quotidien"
msgstr "Ma ville au quotidien"
@ -135,3 +129,16 @@ msgstr "Consultations"
#: ../extra/modules/root.ptl:77
msgid "Useful links"
msgstr "Liens utiles"
#: ../extra/modules/root.ptl:94
msgid "Announces to citizens"
msgstr "Annonces aux citoyens"
#: ../extra/modules/announces.ptl:77 ../extra/modules/announces.ptl:80
#: ../extra/modules/announces.ptl:81 ../extra/modules/announces.ptl:106
#: ../extra/modules/announces.ptl:112
msgid "Announces"
msgstr "Annonces"
#~ msgid "News"
#~ msgstr "Actualités"