notifications: portlet, translations
This commit is contained in:
parent
4a0b31b34d
commit
ec28357ba7
6 changed files with 81 additions and 7 deletions
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: 0.13.0\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2013-07-15 12:00 CET\n"
|
||||
"PO-Revision-Date: 2015-10-30 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -483,6 +483,30 @@ msgstr "Lesezeichen für aktuelles Objekt hinzufügen"
|
|||
msgid "Remove from favorites"
|
||||
msgstr "Lesezeichen entfernen"
|
||||
|
||||
msgid "Notifications"
|
||||
msgstr "Nachrichten"
|
||||
|
||||
msgid "No new notifications"
|
||||
msgstr "Keine neuen Nachrichten"
|
||||
|
||||
msgid "${numNews} new notification"
|
||||
msgstr "${numNews} neue Nachricht"
|
||||
|
||||
msgid "${numNews} new notifications"
|
||||
msgstr "${numNews} neue Nachrichten"
|
||||
|
||||
msgid "Show all notifications"
|
||||
msgstr "Alle Nachrichten anzeigen"
|
||||
|
||||
msgid "Sender"
|
||||
msgstr "Absender"
|
||||
|
||||
msgid "Object"
|
||||
msgstr "Objekt"
|
||||
|
||||
msgid "Date/Time Read"
|
||||
msgstr "Gelesen"
|
||||
|
||||
msgid "Personal Informations"
|
||||
msgstr "Persönliche Informationen"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
"""
|
||||
A view configurator provides configuration data for a view controller.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from zope import component
|
||||
|
@ -30,6 +28,7 @@ from zope.traversing.browser.absoluteurl import absoluteURL
|
|||
|
||||
from cybertools.browser.configurator import ViewConfigurator, MacroViewProperty
|
||||
from cybertools.meta.interfaces import IOptions
|
||||
from loops.browser.node import NodeView
|
||||
from loops.organize.party import getPersonForUser
|
||||
from loops.util import _
|
||||
|
||||
|
@ -44,10 +43,11 @@ class PortletConfigurator(ViewConfigurator):
|
|||
def __init__(self, context, request):
|
||||
self.context = context
|
||||
self.request = request
|
||||
self.view = NodeView(self.context, self.request)
|
||||
|
||||
@property
|
||||
def viewProperties(self):
|
||||
return self.favorites + self.filters
|
||||
return self.favorites + self.filters + self.notifications
|
||||
|
||||
@Lazy
|
||||
def records(self):
|
||||
|
@ -97,3 +97,25 @@ class PortletConfigurator(ViewConfigurator):
|
|||
#url=absoluteURL(self.context, self.request) + '/@@filters.html',
|
||||
))
|
||||
return [filters]
|
||||
|
||||
@property
|
||||
def notifications(self):
|
||||
if self.person is None:
|
||||
return []
|
||||
notif = self.view.globalOptions.organize.showNotifications
|
||||
if not notif:
|
||||
return []
|
||||
if isinstance(notif, list):
|
||||
notifPage = notif[0]
|
||||
else:
|
||||
notifPage = 'notifications'
|
||||
portlet = MacroViewProperty(self.context, self.request)
|
||||
portlet.setParams(dict(
|
||||
slot='portlet_left',
|
||||
identifier='loops.organize.notifications',
|
||||
title=_(u'Notifications'),
|
||||
subMacro=personal_macros.macros['notifications_portlet'],
|
||||
priority=10,
|
||||
url='%s/%s' % (self.view.menu.url, notifPage),
|
||||
))
|
||||
return [portlet]
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
class="loops.organize.personal.browser.notification.NotificationsListing"
|
||||
permission="zope.View" />
|
||||
|
||||
<browser:page
|
||||
for="loops.interfaces.INode"
|
||||
name="notifications_view"
|
||||
class="loops.organize.personal.browser.notification.NotificationsView"
|
||||
permission="zope.View" />
|
||||
|
||||
<zope:adapter
|
||||
name="notification_read"
|
||||
for="loops.browser.node.NodeView
|
||||
|
|
|
@ -27,6 +27,7 @@ from zope.cachedescriptors.property import Lazy
|
|||
from cybertools.browser.form import FormController
|
||||
from cybertools.util.date import formatTimeStamp, getTimeStamp
|
||||
from loops.browser.concept import ConceptView
|
||||
from loops.browser.node import NodeView
|
||||
from loops.common import adapted, baseObject
|
||||
from loops.organize.personal.notification import Notifications
|
||||
from loops.organize.party import getPersonForUser
|
||||
|
@ -50,7 +51,7 @@ class NotificationsListing(ConceptView):
|
|||
def notifications(self):
|
||||
return Notifications(self.person)
|
||||
|
||||
def getNotifications(self, unreadOnly):
|
||||
def getNotifications(self, unreadOnly=True):
|
||||
tracks = self.notifications.listTracks(unreadOnly)
|
||||
return tracks
|
||||
|
||||
|
@ -78,6 +79,11 @@ class NotificationsListing(ConceptView):
|
|||
return result
|
||||
|
||||
|
||||
class NotificationsView(NodeView, NotificationsListing):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ReadNotification(FormController):
|
||||
|
||||
def update(self):
|
||||
|
|
|
@ -47,6 +47,22 @@
|
|||
</metal:actions>
|
||||
|
||||
|
||||
<metal:actions define-macro="notifications_portlet"
|
||||
tal:define="view nocall:context/@@notifications_view;
|
||||
numNews python:len(view.getNotifications())">
|
||||
<div tal:condition="not:numNews"
|
||||
i18n:translate="">No new notifications</div>
|
||||
<div tal:condition="python:numNews == 1">
|
||||
<a i18n:translate=""
|
||||
tal:attributes="href macro/url">
|
||||
<span i18n:name="numNews" tal:content="numNews" /> new notification</a></div>
|
||||
<div tal:condition="python:numNews > 1">
|
||||
<a i18n:translate=""
|
||||
tal:attributes="href macro/url">
|
||||
<span i18n:name="numNews" tal:content="numNews" /> new notifications</a></div>
|
||||
</metal:actions>
|
||||
|
||||
|
||||
<metal:block define-macro="notifications">
|
||||
<div tal:attributes="class string:content-$level;">
|
||||
<metal:title use-macro="item/concept_macros/concepttitle" />
|
||||
|
@ -65,7 +81,7 @@
|
|||
<th i18n:translate="">Sender</th>
|
||||
<th i18n:translate="">Object</th>
|
||||
<th i18n:translate="">Message</th>
|
||||
<th i18n:translate="">Date/Time read</th>
|
||||
<th i18n:translate="">Date/Time Read</th>
|
||||
</tr>
|
||||
<tr tal:repeat="notif item/getNotificationsFormatted">
|
||||
<td tal:content="notif/timeStamp" />
|
||||
|
|
Loading…
Add table
Reference in a new issue