You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2009/01/13 16:35:28 UTC
svn commit: r734158 - in /lenya/trunk/src/modules/notification:
config/cocoon-xconf/ java/src/org/apache/lenya/inbox/usecases/
resources/css/ resources/i18n/ usecases/
Author: andreas
Date: Tue Jan 13 07:35:16 2009
New Revision: 734158
URL: http://svn.apache.org/viewvc?rev=734158&view=rev
Log:
Layout improvement for inbox, use separate usecase to delete messages.
Added:
lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-deleteMessage.xconf
lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/AbstractInboxUsecase.java
lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/DeleteMessage.java
lenya/trunk/src/modules/notification/resources/css/
lenya/trunk/src/modules/notification/resources/css/inbox.css
Modified:
lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-inbox.xconf
lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/Inbox.java
lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/SendMessage.java
lenya/trunk/src/modules/notification/resources/i18n/cmsui.xml
lenya/trunk/src/modules/notification/resources/i18n/cmsui_de.xml
lenya/trunk/src/modules/notification/usecases/currentMessage.jx
lenya/trunk/src/modules/notification/usecases/inbox.jx
lenya/trunk/src/modules/notification/usecases/messageList.jx
lenya/trunk/src/modules/notification/usecases/sendMessage.jx
Added: lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-deleteMessage.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-deleteMessage.xconf?rev=734158&view=auto
==============================================================================
--- lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-deleteMessage.xconf (added)
+++ lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-deleteMessage.xconf Tue Jan 13 07:35:16 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xconf xpath="/cocoon/usecases"
+ unless="/cocoon/usecases/component-instance[@name = 'notification.deleteMessage']">
+
+ <component-instance name="notification.deleteMessage" logger="lenya.notification"
+ class="org.apache.lenya.inbox.usecases.DeleteMessage">
+ <exit usecase="notification.inbox"/>
+ </component-instance>
+
+</xconf>
Modified: lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-inbox.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-inbox.xconf?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-inbox.xconf (original)
+++ lenya/trunk/src/modules/notification/config/cocoon-xconf/usecase-inbox.xconf Tue Jan 13 07:35:16 2009
@@ -22,7 +22,7 @@
<component-instance name="notification.inbox" logger="lenya.notification"
class="org.apache.lenya.inbox.usecases.Inbox">
- <view uri="modules/notification/usecases/inbox.jx" menu="true">
+ <view uri="modules/notification/usecases/inbox.jx" menu="true" createContinuation="false">
<tab group="admin" name="inbox"/>
</view>
<exit usecase="notification.inbox"/>
Added: lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/AbstractInboxUsecase.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/AbstractInboxUsecase.java?rev=734158&view=auto
==============================================================================
--- lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/AbstractInboxUsecase.java (added)
+++ lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/AbstractInboxUsecase.java Tue Jan 13 07:35:16 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.lenya.inbox.usecases;
+
+import org.apache.lenya.ac.User;
+import org.apache.lenya.cms.usecase.AbstractUsecase;
+import org.apache.lenya.inbox.InboxManager;
+
+/**
+ * Base class for inbox-related usecases.
+ */
+public abstract class AbstractInboxUsecase extends AbstractUsecase {
+
+ protected static final String PARAM_USER = "user";
+ protected static final String PARAM_INBOX = "inbox";
+
+ protected void prepareView() throws Exception {
+ super.prepareView();
+ }
+
+ protected User getUser() {
+ return getSession().getIdentity().getUser();
+ }
+
+ protected org.apache.lenya.inbox.Inbox getInbox() {
+ org.apache.lenya.inbox.Inbox inbox = (org.apache.lenya.inbox.Inbox) getParameter(PARAM_INBOX);
+ if (inbox == null) {
+ InboxManager inboxManager = null;
+ try {
+ inboxManager = (InboxManager) this.manager.lookup(InboxManager.ROLE);
+ inbox = inboxManager.getInbox(getUser());
+ setParameter(PARAM_INBOX, inbox);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (inboxManager != null) {
+ this.manager.release(inboxManager);
+ }
+ }
+ }
+ return inbox;
+ }
+
+}
Added: lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/DeleteMessage.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/DeleteMessage.java?rev=734158&view=auto
==============================================================================
--- lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/DeleteMessage.java (added)
+++ lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/DeleteMessage.java Tue Jan 13 07:35:16 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.lenya.inbox.usecases;
+
+import org.apache.lenya.inbox.InboxMessage;
+
+/**
+ * Delete a message from the inbox.
+ */
+public class DeleteMessage extends AbstractInboxUsecase {
+
+ protected static final String PARAM_MESSAGE_ID = "messageId";
+
+ protected void doExecute() throws Exception {
+ super.doExecute();
+ String id = getParameterAsString(PARAM_MESSAGE_ID);
+ if (id != null) {
+ org.apache.lenya.inbox.Inbox inbox = getInbox();
+ InboxMessage message = inbox.getMessage(id);
+ if (message == null) {
+ addErrorMessage("The message " + id + " does not exist.");
+ } else {
+ inbox.remove(message);
+ }
+ }
+ }
+
+}
Modified: lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/Inbox.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/Inbox.java?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/Inbox.java (original)
+++ lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/Inbox.java Tue Jan 13 07:35:16 2009
@@ -17,58 +17,42 @@
*/
package org.apache.lenya.inbox.usecases;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.inbox.InboxManager;
import org.apache.lenya.inbox.InboxMessage;
/**
* Show and manage an inbox.
*/
-public class Inbox extends AbstractUsecase {
+public class Inbox extends AbstractInboxUsecase {
- protected void initParameters() {
- super.initParameters();
-
- User user = getSession().getIdentity().getUser();
- setParameter("user", user);
-
- InboxManager inboxManager = null;
- try {
- inboxManager = (InboxManager) this.manager.lookup(InboxManager.ROLE);
- org.apache.lenya.inbox.Inbox inbox = inboxManager.getInbox(user);
- setParameter("inbox", inbox);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (inboxManager != null) {
- this.manager.release(inboxManager);
- }
- }
- }
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
+ protected static final String PARAM_MESSAGE_ID = "messageId";
+ protected static final String PARAM_NOF_MESSAGES = "nofMessages";
+ protected static final String PARAM_NOF_UNREAD_MESSAGES = "nofUnreadMessages";
+
+ protected void prepareView() throws Exception {
+ super.prepareView();
+ setParameter(PARAM_USER, getUser());
- String id = getParameterAsString("messageId");
+ org.apache.lenya.inbox.Inbox inbox = getInbox();
+
+ String id = getParameterAsString(PARAM_MESSAGE_ID);
if (id != null) {
- org.apache.lenya.inbox.Inbox inbox = (org.apache.lenya.inbox.Inbox) getParameter("inbox");
InboxMessage message = inbox.getMessage(id);
- message.markAsRead(true);
+ if (message == null) {
+ addErrorMessage("The message " + id + " does not exist.");
+ } else {
+ message.markAsRead(true);
+ }
}
- }
-
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String deleteId = getParameterAsString("deleteMessageId");
- if (deleteId != null) {
- org.apache.lenya.inbox.Inbox inbox = (org.apache.lenya.inbox.Inbox) getParameter("inbox");
- InboxMessage message = inbox.getMessage(deleteId);
- inbox.remove(message);
+ InboxMessage[] messages = inbox.getMessages();
+ int nofUnreadMessages = 0;
+ for (int i = 0; i < messages.length; i++) {
+ if (!messages[i].isMarkedAsRead()) {
+ nofUnreadMessages++;
+ }
}
+ setParameter(PARAM_NOF_MESSAGES, new Integer(messages.length));
+ setParameter(PARAM_NOF_UNREAD_MESSAGES, new Integer(nofUnreadMessages));
}
}
Modified: lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/SendMessage.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/SendMessage.java?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/SendMessage.java (original)
+++ lenya/trunk/src/modules/notification/java/src/org/apache/lenya/inbox/usecases/SendMessage.java Tue Jan 13 07:35:16 2009
@@ -20,7 +20,7 @@
import org.apache.lenya.ac.Identifiable;
import org.apache.lenya.ac.User;
import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
+import org.apache.lenya.inbox.InboxMessage;
import org.apache.lenya.notification.Message;
import org.apache.lenya.notification.NotificationUtil;
import org.apache.lenya.util.Assert;
@@ -28,13 +28,29 @@
/**
* Show and manage an inbox.
*/
-public class SendMessage extends AbstractUsecase {
+public class SendMessage extends AbstractInboxUsecase {
- protected void initParameters() {
- super.initParameters();
+ protected static final String PARAM_BODY = "body";
+ protected static final String PARAM_SUBJECT = "subject";
+ protected static final String PARAM_RECIPIENT = "recipient";
+ protected static final String PARAM_USER = "user";
+ protected static final String PARAM_REPLY_TO = "replyTo";
+
+ protected void prepareView() throws Exception {
+ super.prepareView();
+
+ String replyToMessageId = getParameterAsString(PARAM_REPLY_TO);
+ if (replyToMessageId != null) {
+ org.apache.lenya.inbox.Inbox inbox = getInbox();
+ InboxMessage message = inbox.getMessage(replyToMessageId);
+ if (message != null) {
+ User sender = (User) message.getMessage().getSender();
+ setParameter(PARAM_RECIPIENT, sender.getId());
+ }
+ }
User user = getSession().getIdentity().getUser();
- setParameter("user", user);
+ setParameter(PARAM_USER, user);
try {
UserManager userManager = user.getAccreditableManager().getUserManager();
@@ -60,15 +76,15 @@
}
protected String getSubject() {
- return getParameterAsString("subject");
+ return getParameterAsString(PARAM_SUBJECT);
}
protected String getRecipient() {
- return getParameterAsString("recipient");
+ return getParameterAsString(PARAM_RECIPIENT);
}
protected String getBody() {
- return getParameterAsString("body");
+ return getParameterAsString(PARAM_BODY);
}
protected void doExecute() throws Exception {
Added: lenya/trunk/src/modules/notification/resources/css/inbox.css
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/resources/css/inbox.css?rev=734158&view=auto
==============================================================================
--- lenya/trunk/src/modules/notification/resources/css/inbox.css (added)
+++ lenya/trunk/src/modules/notification/resources/css/inbox.css Tue Jan 13 07:35:16 2009
@@ -0,0 +1,48 @@
+.lenyaNotificationDate {
+ white-space: nowrap;
+}
+
+.lenyaNotificationSubject {
+ overflow: hidden;
+ white-space: nowrap;
+ width: 150px;
+}
+
+tr.lenyaNotificationMessageRead,
+tr.lenyaNotificationMessageRead a,
+tr.lenyaNotificationMessageHighlight a {
+ color: #666666;
+}
+
+tr.lenyaNotificationMessageHighlight {
+ background-color: #DDDDDD;
+}
+
+.lenyaNotification textarea {
+ width: 600px;
+ height: 200px;
+ border: 1px solid #CCCCCC;
+ background: #FFFFFF;
+ font-family: Arial;
+}
+
+.lenyaNotification {
+ font-family: Arial;
+}
+
+.lenyaNotification span.lenyaNotificationLabel {
+ font-weight: bold;
+ color: #666666;
+ width: 5em;
+ display: block;
+ float: left;
+}
+
+.lenyaNotificationActions {
+ float: right;
+}
+
+.lenyaNotification p {
+ margin-top: 1em;
+ margin-bottom: .5em;
+}
\ No newline at end of file
Modified: lenya/trunk/src/modules/notification/resources/i18n/cmsui.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/resources/i18n/cmsui.xml?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/resources/i18n/cmsui.xml (original)
+++ lenya/trunk/src/modules/notification/resources/i18n/cmsui.xml Tue Jan 13 07:35:16 2009
@@ -33,6 +33,9 @@
<message key="unread-messages">{0} new messages</message>
<message key="unread-message">1 new message</message>
<message key="Read">Read</message>
- <message key="Inbox">Inbox</message>
+ <message key="Inbox">Inbox</message>
+ <message key="notification.delete">Delete</message>
+ <message key="notification.reply">Reply</message>
+ <message key="notification.nofMessages">{0} messages, {1} new</message>
</catalogue>
Modified: lenya/trunk/src/modules/notification/resources/i18n/cmsui_de.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/resources/i18n/cmsui_de.xml?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/resources/i18n/cmsui_de.xml (original)
+++ lenya/trunk/src/modules/notification/resources/i18n/cmsui_de.xml Tue Jan 13 07:35:16 2009
@@ -34,5 +34,8 @@
<message key="unread-message">1 neue Nachricht</message>
<message key="Read">Gelesen</message>
<message key="Inbox">Posteingang</message>
+ <message key="notification.delete">Löschen</message>
+ <message key="notification.reply">Antworten</message>
+ <message key="notification.nofMessages">{0} Nachrichten, davon {1} ungelesen</message>
</catalogue>
Modified: lenya/trunk/src/modules/notification/usecases/currentMessage.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/usecases/currentMessage.jx?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/usecases/currentMessage.jx (original)
+++ lenya/trunk/src/modules/notification/usecases/currentMessage.jx Tue Jan 13 07:35:16 2009
@@ -15,7 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<!-- $Id: groups.jx 473861 2006-11-12 03:51:14Z gregor $ -->
<jx:template
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
@@ -26,56 +25,29 @@
<jx:if test="${usecase.getName().getClass().isInstance(messageId)}">
<jx:set var="message" value="${inbox.getMessage(messageId)}"/>
-
- <div class="lenya-box" style="width: 100%">
- <div class="lenya-box-title"><i18n:text>selected-message</i18n:text></div>
- <div class="lenya-box-body">
- <table class="lenya-table-noborder">
- <tr>
- <td class="lenya-entry-caption"><i18n:text>From</i18n:text>:</td>
- <td style="white-space: nowrap">
- <jx:out value="${message.getMessage().getSender().getName()}"/>
- (<a href="?lenya.usecase=admin.user&userId=${message.getMessage().getSender().getId()}"><jx:out value="${message.getMessage().getSender().getId()}"/></a>)
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Subject</i18n:text>:</td>
- <td>
- <i18n:translate>
- <i18n:text><jx:out value="${message.getMessage().getSubject()}"/></i18n:text>
- <jx:forEach var="param" items="${message.getMessage().getSubjectParameters()}">
- <i18n:param><jx:out value="${param}"/></i18n:param>
- </jx:forEach>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption" valign="top"><i18n:text>Message</i18n:text>:</td>
- <td>
- <pre><i18n:translate>
- <i18n:text><jx:out value="${message.getMessage().getBody()}"/></i18n:text>
- <jx:forEach var="param" items="${message.getMessage().getBodyParameters()}">
- <i18n:param><jx:out value="${param}"/></i18n:param>
- </jx:forEach>
- </i18n:translate></pre>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <br/>
- <form method="POST">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="deleteMessageId" value="${messageId}"/>
- <input type="submit" name="submit" value="Delete" i18n:attr="value"/>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </div>
-
+ <jx:set var="sender" value="${message.getMessage().getSender().getId()}"/>
+ <p class="lenyaNotificationActions">
+ <a class="lenyaButton" href="?lenya.usecase=notification.sendMessage&replyTo=${messageId}"><i18n:text>notification.reply</i18n:text></a>
+ <a class="lenyaButton" href="?lenya.usecase=notification.deleteMessage&messageId=${messageId}"><i18n:text>notification.delete</i18n:text></a>
+ </p>
+ <p>
+ <span class="lenyaNotificationLabel"><i18n:text>From</i18n:text>: </span>
+ <jx:out value="${message.getMessage().getSender().getName()}"/>
+ (<a href="?lenya.usecase=admin.user&userId=${sender}"><jx:out value="${sender}"/></a>)
+ <br/>
+ <span class="lenyaNotificationLabel"><i18n:text>Subject</i18n:text>: </span>
+ <i18n:translate>
+ <i18n:text><jx:out value="${message.getMessage().getSubject()}"/></i18n:text>
+ <jx:forEach var="param" items="${message.getMessage().getSubjectParameters()}">
+ <i18n:param><jx:out value="${param}"/></i18n:param>
+ </jx:forEach>
+ </i18n:translate>
+ </p>
+ <textarea disabled="disabled"><i18n:translate><i18n:text><jx:out value="${message.getMessage().getBody()}"/></i18n:text>
+ <jx:forEach var="param" items="${message.getMessage().getBodyParameters()}">
+ <i18n:param><jx:out value="${param}"/></i18n:param>
+ </jx:forEach>
+ </i18n:translate></textarea>
</jx:if>
</jx:template>
\ No newline at end of file
Modified: lenya/trunk/src/modules/notification/usecases/inbox.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/usecases/inbox.jx?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/usecases/inbox.jx (original)
+++ lenya/trunk/src/modules/notification/usecases/inbox.jx Tue Jan 13 07:35:16 2009
@@ -24,6 +24,11 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
>
+ <page:head>
+ <link rel="stylesheet" type="text/css" href="/modules/gui/css/lenya.css"/>
+ <link rel="stylesheet" type="text/css" href="/modules/notification/css/inbox.css"/>
+ </page:head>
+
<page:body>
<jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
<div id="contentblock1" class="lenya-tab">
@@ -34,32 +39,22 @@
</i18n:translate>
</h1>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
+ <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <div style="margin-bottom: 10px;">
- <a href="?lenya.usecase=notification.sendMessage"><i18n:text>new-message</i18n:text></a>
+ <div class="lenyaNotification">
+
+ <div style="margin-bottom: 10px;">
+ <a class="lenyaButton" href="?lenya.usecase=notification.sendMessage"><i18n:text>new-message</i18n:text></a>
+ </div>
+
+ <jx:set var="inbox" value="${usecase.getParameter('inbox')}"/>
+ <jx:set var="messageId" value="${request.getParameter('messageId')}"/>
+
+ <jx:import uri="fallback://lenya/modules/notification/usecases/messageList.jx"/>
+
+ <jx:import uri="fallback://lenya/modules/notification/usecases/currentMessage.jx"/>
</div>
- <jx:set var="inbox" value="${usecase.getParameter('inbox')}"/>
- <jx:set var="messageId" value="${request.getParameter('messageId')}"/>
-
- <table>
- <tr>
- <td valign="top" style="padding: 0px; padding-right: 20px;">
- <jx:import uri="fallback://lenya/modules/notification/usecases/messageList.jx"/>
- </td>
- <td valign="top" style="padding: 0px; padding-left: 20px;">
- <jx:import uri="fallback://lenya/modules/notification/usecases/currentMessage.jx"/>
- </td>
- </tr>
- </table>
-
</div>
</page:body>
</page:page>
\ No newline at end of file
Modified: lenya/trunk/src/modules/notification/usecases/messageList.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/usecases/messageList.jx?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/usecases/messageList.jx (original)
+++ lenya/trunk/src/modules/notification/usecases/messageList.jx Tue Jan 13 07:35:16 2009
@@ -24,51 +24,65 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
>
- <table class="lenya-table-list">
- <tr>
- <th style="text-align: left; padding-right: 20px;"><i18n:text>Subject</i18n:text></th>
- <th style="text-align: left; padding-right: 20px;"><i18n:text>Sender</i18n:text></th>
- <th style="text-align: left; padding-right: 20px;"><i18n:text>Date</i18n:text></th>
- <th style="text-align: left; padding-right: 20px;"><i18n:text>Read</i18n:text></th>
- <th> </th>
- </tr>
- <jx:forEach var="message" items="${inbox.getMessages()}">
-
- <jx:set var="class" value="normal"/>
- <jx:if test="${messageId.equals(message.getId())}">
- <jx:set var="class" value="highlight"/>
- </jx:if>
-
- <tr class="${class}">
- <td>
- <a href="?lenya.usecase=notification.inbox&messageId=${message.getId()}">
- <i18n:translate>
- <i18n:text><jx:out value="${message.getMessage().getSubject()}"/></i18n:text>
- <jx:forEach var="param" items="${message.getMessage().getSubjectParameters()}">
- <i18n:param><jx:out value="${param}"/></i18n:param>
- </jx:forEach>
- </i18n:translate>
- </a>
- </td>
- <td>
- <a href="?lenya.usecase=admin.user&userId=${message.getMessage().getSender().getId()}"><jx:out value="${message.getMessage().getSender().getId()}"/></a>
- </td>
- <td>
- <jx:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${message.getMessage().getTime()}"/>
- </td>
- <td style="text-align: center;">
- <jx:if test="${message.isMarkedAsRead()}">✔</jx:if>
- </td>
- <td style="text-align: center;">
- <form method="POST">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="deleteMessageId" value="${message.getId()}"/>
- <input type="submit" name="submit" value="Delete" i18n:attr="value"/>
- </form>
- </td>
- </tr>
- </jx:forEach>
- </table>
+ <p>
+ <i18n:translate>
+ <i18n:text>notification.nofMessages</i18n:text>
+ <i18n:param>${usecase.getParameter('nofMessages')}</i18n:param>
+ <i18n:param>${usecase.getParameter('nofUnreadMessages')}</i18n:param>
+ </i18n:translate>
+ </p>
+ <div class="lenyaListContainer" style="height: 200px;">
+ <table>
+ <thead>
+ <tr>
+ <th style="text-align: left; padding-right: 20px;"><i18n:text>Subject</i18n:text></th>
+ <th style="text-align: left; padding-right: 20px;"><i18n:text>Sender</i18n:text></th>
+ <th style="text-align: left; padding-right: 20px;"><i18n:text>Date</i18n:text></th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ <jx:forEach var="message" items="${inbox.getMessages()}">
+
+ <jx:set var="class" value="normal"/>
+ <jx:choose>
+ <jx:when test="${messageId.equals(message.getId())}">
+ <jx:set var="class" value="lenyaNotificationMessageHighlight"/>
+ </jx:when>
+ <jx:when test="${message.isMarkedAsRead()}">
+ <jx:set var="class" value="lenyaNotificationMessageRead"/>
+ </jx:when>
+ </jx:choose>
+
+ <tr class="${class}">
+ <td class="lenyaNotificationSubject">
+ <a href="?lenya.usecase=notification.inbox&messageId=${message.getId()}">
+ <i18n:translate>
+ <i18n:text><jx:out value="${message.getMessage().getSubject()}"/></i18n:text>
+ <jx:forEach var="param" items="${message.getMessage().getSubjectParameters()}">
+ <i18n:param><jx:out value="${param}"/></i18n:param>
+ </jx:forEach>
+ </i18n:translate>
+ </a>
+ </td>
+ <td>
+ <a href="?lenya.usecase=admin.user&userId=${message.getMessage().getSender().getId()}"><jx:out value="${message.getMessage().getSender().getId()}"/></a>
+ </td>
+ <td class="lenyaNotificationDate">
+ <jx:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${message.getMessage().getTime()}"/>
+ </td>
+ <td style="text-align: center;">
+ <form method="POST">
+ <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
+ <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+ <input type="hidden" name="deleteMessageId" value="${message.getId()}"/>
+ <input type="image" src="/modules/gui/icons/sweetie/base/16-square-red-delete.png" name="submit" value="Delete" i18n:attr="value"/>
+ </form>
+ </td>
+ </tr>
+ </jx:forEach>
+ </tbody>
+ </table>
+ </div>
</jx:template>
\ No newline at end of file
Modified: lenya/trunk/src/modules/notification/usecases/sendMessage.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/notification/usecases/sendMessage.jx?rev=734158&r1=734157&r2=734158&view=diff
==============================================================================
--- lenya/trunk/src/modules/notification/usecases/sendMessage.jx (original)
+++ lenya/trunk/src/modules/notification/usecases/sendMessage.jx Tue Jan 13 07:35:16 2009
@@ -53,9 +53,17 @@
<tr>
<td class="lenya-entry-caption"><i18n:text>To</i18n:text></td>
<td>
+ <jx:set var="recipient" value="${usecase.getParameter('recipient')}"/>
<select class="lenya-form-element" name="recipient">
- <jx:forEach var="recipient" items="${usecase.getParameter('users')}">
- <option value="${recipient.getId()}"><jx:out value="${recipient.getId()}"/></option>
+ <jx:forEach var="rec" items="${usecase.getParameter('users')}">
+ <jx:choose>
+ <jx:when test="${rec.getId().equals(recipient)}">
+ <option value="${rec.getId()}" selected="selected"><jx:out value="${rec.getName()}"/> (<jx:out value="${rec.getId()}"/>)</option>
+ </jx:when>
+ <jx:otherwise>
+ <option value="${rec.getId()}"><jx:out value="${rec.getName()}"/> (<jx:out value="${rec.getId()}"/>)</option>
+ </jx:otherwise>
+ </jx:choose>
</jx:forEach>
</select>
</td>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org