[Mpuls-commits] r221 - in waska/trunk: . waskaweb/controllers waskaweb/model waskaweb/templates/start
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Nov 14 18:00:28 CET 2008
Author: torsten
Date: 2008-11-14 18:00:28 +0100 (Fri, 14 Nov 2008)
New Revision: 221
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/controllers/waska.py
waska/trunk/waskaweb/model/news.py
waska/trunk/waskaweb/model/user.py
waska/trunk/waskaweb/templates/start/newslist.mako
Log:
First part of fix for issue652
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2008-11-14 11:45:17 UTC (rev 220)
+++ waska/trunk/ChangeLog.txt 2008-11-14 17:00:28 UTC (rev 221)
@@ -1,3 +1,14 @@
+2008-11-14 Torsten Irlaender <torsten.irlaender at intevation.de>
+
+ Fixed issue652
+
+ * waskaweb/model/news.py,
+ waskaweb/model/user.py,
+ waskaweb/controllers/waska.py,
+ waskaweb/templates/start/newslist.mako: News now stay on blackboard
+ until they get deleted by the user. Actually the are marked as read
+ and therefor not shown anymore.
+
2008-11-14 Sascha L. Teichmann <sascha.teichmann at intevation.de>
* waskaweb/lib/app_globals.py: looking for a 'db_mapping_file' entry
@@ -7,8 +18,15 @@
* waskaweb/lib/security.py: added function to load mapping from file.
-2008-11-03 Sascha L. Teichmann <sascha.teichmann at intevation.de>
+2008-11-12 Torsten Irlaender <torsten.irlaender at intevation.de>
+ Fixed issue645
+
+ * waskaweb/controllers/waska.py: Do not check inkonsistency on
+ evaluation server.
+
+2008-11-03 Torsten Irlaender <torsten.irlaender at intevation.de>
+
Commented out evaluation of ESF Stammblatt.
* waskaweb/controllers/evaluate.py,
Modified: waska/trunk/waskaweb/controllers/waska.py
===================================================================
--- waska/trunk/waskaweb/controllers/waska.py 2008-11-14 11:45:17 UTC (rev 220)
+++ waska/trunk/waskaweb/controllers/waska.py 2008-11-14 17:00:28 UTC (rev 221)
@@ -48,6 +48,9 @@
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 WaskaController(BaseController):
def index(self):
@@ -103,6 +106,24 @@
c.news = NewsList(user)
return render('/start/start.mako')
+ def markNewsAsRead(self, id, confirmed=0):
+ id = self._checkInt(id)
+ confirmed = self._checkBool(confirmed)
+ session_user = session['USER_AUTHORIZED']
+ try:
+ if confirmed == 1:
+ user = UserObject(session_user.id)
+ user.setNewsAsRead(id)
+ return self.start()
+ else:
+ c.confirm_for = MARK_NEWS_AS_READ_CONFIRM
+ c.question = MARK_NEWS_AS_READ_CONFIRM_TEXT
+ c.url_yes = "/waska/markNewsAsRead/%s/1" % id
+ c.url_no = "/waska"
+ return render('/start/dialogs/confirm_mark_news_as_read.mako')
+ except:
+ return render('/tests/trace.mako')
+
def help(self):
return render('/start/help.mako')
Modified: waska/trunk/waskaweb/model/news.py
===================================================================
--- waska/trunk/waskaweb/model/news.py 2008-11-14 11:45:17 UTC (rev 220)
+++ waska/trunk/waskaweb/model/news.py 2008-11-14 17:00:28 UTC (rev 221)
@@ -33,7 +33,7 @@
import sys
from waskaweb.lib.db import db
-FETCH_ALL_NEWS = """SELECT id, datum, titel, nachricht, art_beschreibung FROM ka_nachrichten_tbl_view WHERE datum + interval '3 day' >= %(last_login)s order by datum desc"""
+FETCH_ALL_NEWS = """SELECT id, datum, titel, nachricht, art_beschreibung FROM ka_nachrichten_tbl_view WHERE id NOT IN (SELECT nachrichten_id from nm_benutzer_nachrichten_tbl_view WHERE benutzer_id = %(user_id)s) ORDER BY datum DESC"""
class NewsFactory:
def __init__(self):
@@ -50,7 +50,7 @@
try:
conn = db.getConnection()
cur = conn.cursor()
- cur.execute(FETCH_ALL_NEWS, {'last_login': user.last_login})
+ cur.execute(FETCH_ALL_NEWS, {'user_id': user.id})
for row in cur.fetchall():
self.list.append(factory.createByData(id=row[0], date=row[1], title=row[2], text=row[3], type=row[4]))
finally:
Modified: waska/trunk/waskaweb/model/user.py
===================================================================
--- waska/trunk/waskaweb/model/user.py 2008-11-14 11:45:17 UTC (rev 220)
+++ waska/trunk/waskaweb/model/user.py 2008-11-14 17:00:28 UTC (rev 221)
@@ -28,6 +28,7 @@
from pylons import config, session
import datetime
import sys
+MARK_NEWS_AS_READ_SQL = """SELECT markNewsAsRead(%(user_id)s, %(news_id)s)"""
FETCH_USER_LIST_SQL = """SELECT id, vorname, nachname, rolle, login, gid from ka_benutzer_tbl_view order by nachname"""
FETCH_USERGROUP_LIST_SQL = """SELECT id, name from ka_benutzergruppe_tbl_view order by name"""
FETCH_USERGROUP_DATA_SQL = """SELECT id, name from ka_benutzergruppe_tbl_view WHERE id = %(id)s"""
@@ -364,6 +365,18 @@
else:
self._fetchData(id)
+ def setNewsAsRead(self, id):
+ conn, cur = None, None
+ try:
+ conn = db.getConnection()
+ cur = conn.cursor()
+ fields = {'user_id': self.id, 'news_id': id}
+ cur.execute(MARK_NEWS_AS_READ_SQL, fields)
+ conn.commit()
+ finally:
+ db.recycleConnection(conn, cur)
+ return 1
+
def setAdmUser(self):
self.last_name = 'Zentrale Administration'
self.needs_passrefresh = False
Modified: waska/trunk/waskaweb/templates/start/newslist.mako
===================================================================
--- waska/trunk/waskaweb/templates/start/newslist.mako 2008-11-14 11:45:17 UTC (rev 220)
+++ waska/trunk/waskaweb/templates/start/newslist.mako 2008-11-14 17:00:28 UTC (rev 221)
@@ -5,7 +5,7 @@
<tr>
<td class="date table_header_h">${h.dd_mm_YYYY(news.date)}</td>
<td class="title table_header_h">${news.title}</td>
- <td class="action table_header_h"></td>
+ <td class="action table_header_h"><a href="${h.url_for(controller='/waska', action='markNewsAsRead', id=news.id)}">entfernen</a></td>
</tr>
<tr>
<td class="message" colspan="3">
More information about the Mpuls-commits
mailing list