Commit 4e8b255a authored by HERBERT Ryan's avatar HERBERT Ryan

controllers/notifications.py views/notification/info.html deprecated index in...

controllers/notifications.py views/notification/info.html deprecated index in favour of more flexible info page
parent 66b4b0bd
......@@ -10,6 +10,7 @@ if request.env.http_origin:
ACCESS_DENIED = "access denied"
NOTIFICATION_CACHE_PREFIX = 'notification_'
# Deprecated
def index():
if not auth.is_admin() :
res = {"message": ACCESS_DENIED}
......@@ -23,7 +24,10 @@ def index():
def info():
user_id = auth.user.id if auth.user else None
query = db.notification[request.vars['id']]
query = None
if request.vars['id']:
query = db.notification[request.vars['id']]
if auth.user:
rows = db((db.user_preference.user_id==auth.user.id)
&(db.user_preference.preference=='mail')
......@@ -38,7 +42,8 @@ def info():
cache.ram.clear(regex=NOTIFICATION_CACHE_PREFIX + str(user_id))
notifications = db(db.notification).select(orderby=~db.notification.id)
return dict(query=query,
return dict(message="Notifications",
query=query,
notifications=notifications)
# serve for to add a notification
......
{{from gluon.contrib.markdown.markdown2 import markdown}}
{{extend 'db_layout.html'}}
<h3>{{=query.title}}</h3>
<h3>{{=query.title if query is not None else message}}</h3>
<div class="db_block info_block">
{{=XML(markdown(query.message_content))}}
</div>
{{if query is not None:}}
<div class="db_block info_block">
{{=XML(markdown(query.message_content))}}
</div>
{{pass}}
<div id="db_table_container" class="info_table">
<div id="db_table_container" {{if query is not None:}}class="info_table"{{pass}}>
<table class="db_table" id="table">
<thead>
......@@ -60,3 +62,7 @@
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
{{if auth.is_admin():}}
<span class="button2" onclick="db.call('notification/add')"> + new notification </span>
{{pass}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment