[Mpuls-commits] r1283 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 5 16:20:58 CET 2010
Author: torsten
Date: 2010-02-05 16:20:57 +0100 (Fri, 05 Feb 2010)
New Revision: 1283
Added:
wasko/branches/2.0/mpulsweb/controllers/news.py
Log:
* mpulsweb/controllers/news.py: New. New controller for handling news.
Added: wasko/branches/2.0/mpulsweb/controllers/news.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/news.py 2010-02-05 15:19:33 UTC (rev 1282)
+++ wasko/branches/2.0/mpulsweb/controllers/news.py 2010-02-05 15:20:57 UTC (rev 1283)
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+import logging
+
+from pylons import request, response, session, tmpl_context as c
+from pylons.controllers.util import abort, redirect_to
+
+from mpulsweb.lib.base import BaseController, render
+from mpulsweb.model.user import UserObject
+
+log = logging.getLogger(__name__)
+
+MARK_NEWS_AS_READ_CONFIRM = u"""Nachricht als gelesen markieren"""
+MARK_NEWS_AS_READ_CONFIRM_TEXT = u"""\
+Wollen Sie die Nachricht wirklich als gelesen markieren?
+Sie wird dadurch dauerhaft aus der Übersicht entfernt."""
+
+class NewsController(BaseController):
+
+ def index(self):
+ # Return a rendered template
+ #return render('/news.mako')
+ # or, return a response
+ return 'Hello World'
+
+ def hide(self, id, confirmed=0):
+ '''
+ Will mark the news as read for the current user. The news will then not
+ be displayed on the blackboard
+ '''
+ id = self._checkInt(id)
+ confirmed = self._checkBool(confirmed)
+ session_user = session['USER_AUTHORIZED']
+ if confirmed == 1:
+ user = UserObject(session_user.id)
+ user.setNewsAsRead(id)
+ redirect_to(controller='/')
+ else:
+ c.confirm_for = MARK_NEWS_AS_READ_CONFIRM
+ c.question = MARK_NEWS_AS_READ_CONFIRM_TEXT
+ c.url_yes = "/news/hide/%s/1" % id
+ c.url_no = "/"
+ return render('/start/dialogs/confirm_mark_news_as_read.mako')
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
Property changes on: wasko/branches/2.0/mpulsweb/controllers/news.py
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the Mpuls-commits
mailing list