Seam SVN: r8439 - in branches/Seam_2_0_FP: src/main/org/jboss/seam/mail and 1 other directory.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-07-08 04:09:08 -0400 (Tue, 08 Jul 2008)
New Revision: 8439
Removed:
branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/Meldware.java
branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/MeldwareUser.java
Modified:
branches/Seam_2_0_FP/build/core.pom.xml
branches/Seam_2_0_FP/build/root.pom.xml
Log:
SEAMFP-10
Modified: branches/Seam_2_0_FP/build/core.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/core.pom.xml 2008-07-08 04:55:59 UTC (rev 8438)
+++ branches/Seam_2_0_FP/build/core.pom.xml 2008-07-08 08:09:08 UTC (rev 8439)
@@ -203,18 +203,6 @@
</dependency>
<dependency>
- <groupId>org.buni.meldware</groupId>
- <artifactId>meldware-mailjmx</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.buni.meldware</groupId>
- <artifactId>meldware-mailapi</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<optional>true</optional>
Modified: branches/Seam_2_0_FP/build/root.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/root.pom.xml 2008-07-08 04:55:59 UTC (rev 8438)
+++ branches/Seam_2_0_FP/build/root.pom.xml 2008-07-08 08:09:08 UTC (rev 8439)
@@ -563,18 +563,6 @@
</dependency>
<dependency>
- <groupId>org.buni.meldware</groupId>
- <artifactId>meldware-mailjmx</artifactId>
- <version>1.0M8</version>
- </dependency>
-
- <dependency>
- <groupId>org.buni.meldware</groupId>
- <artifactId>meldware-mailapi</artifactId>
- <version>1.0M8</version>
- </dependency>
-
- <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${version.drools}</version>
Deleted: branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/Meldware.java
===================================================================
--- branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/Meldware.java 2008-07-08 04:55:59 UTC (rev 8438)
+++ branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/Meldware.java 2008-07-08 08:09:08 UTC (rev 8439)
@@ -1,79 +0,0 @@
-package org.jboss.seam.mail;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.util.List;
-
-import org.buni.meldware.mail.management.AdminTool;
-import org.buni.meldware.mail.util.MMJMXUtil;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.log.Log;
-import org.jboss.seam.log.Logging;
-
-/**
- * Creates meldware users, mailboxes and aliases
- *
- */
-@Name("org.jboss.seam.mail.meldware")
-@Startup
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(precedence=BUILT_IN, classDependencies="org.buni.meldware.mail.mailbox.Mailbox", value=false)
-public class Meldware
-{
-
- private List<MeldwareUser> users;
-
- private List<String> domains;
-
- private Log log = Logging.getLog(Meldware.class);
-
- @Create
- public void create()
- {
- // TODO Support domain creation as well. Currently they are written out to file.
-
- log.info("Creating users and mailboxes");
- //MailboxService ms = MMJMXUtil.getMBean("meldware.mail:type=MailboxManager,name=MailboxManager", MailboxService.class);
- AdminTool at = MMJMXUtil.getMBean("meldware.mail:type=MailServices,name=AdminTool", AdminTool.class);
-
- for (MeldwareUser meldwareUser : getUsers())
- {
- at.createUser(meldwareUser.getUsername(), meldwareUser.getPassword(), meldwareUser.getRoles());
- // TODO This won't work on AS 4.2
- /*Mailbox mbox = ms.createMailbox(meldwareUser.getUsername());
- for (String alias : meldwareUser.getAliases())
- {
- ms.createAlias(mbox.getId(), alias);
- }*/
- log.info("Created #0 #1 #2", meldwareUser.isAdministrator() ? "administrator" : "user", meldwareUser.getUsername(), meldwareUser.getAliases() == null || meldwareUser.getAliases().size() == 0 ? "" : "with aliases " + meldwareUser.getAliases());
- }
- }
-
- public List<MeldwareUser> getUsers()
- {
- return users;
- }
-
- public void setUsers(List<MeldwareUser> users)
- {
- this.users = users;
- }
-
- public List<String> getDomains()
- {
- return domains;
- }
-
- public void setDomains(List<String> domains)
- {
- this.domains = domains;
- }
-
-}
Deleted: branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/MeldwareUser.java
===================================================================
--- branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/MeldwareUser.java 2008-07-08 04:55:59 UTC (rev 8438)
+++ branches/Seam_2_0_FP/src/main/org/jboss/seam/mail/MeldwareUser.java 2008-07-08 08:09:08 UTC (rev 8439)
@@ -1,84 +0,0 @@
-package org.jboss.seam.mail;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-
-@Name("org.jboss.seam.mail.meldwareUser")
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(precedence=BUILT_IN, dependencies="org.jboss.seam.mail.meldware", value=false)
-public class MeldwareUser
-{
-
- private String username;
- private String password;
-
- private boolean administrator;
-
- private List<String> aliases = new ArrayList<String>();
-
- public boolean isAdministrator()
- {
- return administrator;
- }
-
- public void setAdministrator(boolean admin)
- {
- this.administrator = admin;
- }
-
- public List<String> getAliases()
- {
- return aliases;
- }
-
- public void setAliases(List<String> aliases)
- {
- this.aliases = aliases;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- public List<String> getRoles()
- {
- return getRoles(this);
- }
-
- private static List<String> getRoles(MeldwareUser user)
- {
- List<String> roles = new ArrayList<String>();
- roles.add("calendaruser");
- if (user.isAdministrator())
- {
- roles.add("adminuser");
- }
- return roles;
- }
-
-}
16 years, 6 months
Seam SVN: r8438 - in trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum: templates and 3 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-08 00:55:59 -0400 (Tue, 08 Jul 2008)
New Revision: 8438
Added:
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumLegend.xhtml
Modified:
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/css/forumList.css
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/css/forumList.css
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/css/forumList.css
Log:
Icon legend for forum plugin
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties 2008-07-07 12:27:33 UTC (rev 8437)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties 2008-07-08 04:55:59 UTC (rev 8438)
@@ -124,3 +124,7 @@
forum.msg.Reply.Update=Reply '{0}' has been updated.
forum.msg.Reply.Delete=Reply '{0}' has been deleted.
+forum.label.NewPosts=New posts
+forum.label.NoNewPosts=No new posts
+forum.label.StickyThread=Sticky thread
+forum.label.LockedThread=Locked thread
Added: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumLegend.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumLegend.xhtml (rev 0)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumLegend.xhtml 2008-07-08 04:55:59 UTC (rev 8438)
@@ -0,0 +1,35 @@
+<s:div id="forumLegendContainer"
+ styleClass="forumLegendContainer"
+ rendered="#{not forumListHome.managed}"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:wiki="http://jboss.com/products/seam/wiki">
+
+ <h:panelGrid columns="4" columnClasses="forumLegendColumn" styleClass="forumLegendTable"
+ cellpadding="0" cellspacing="0" border="0">
+
+ <h:panelGroup>
+ <h:graphicImage styleClass="forumLegendIcon" value="#{currentMacro.requestImagePath}/icon.posting_unread.gif" width="22" height="26"/>
+ <h:outputText styleClass="forumLegendText" value="#{messages['forum.label.NewPosts']}"/>
+ </h:panelGroup>
+ <h:panelGroup>
+ <h:graphicImage styleClass="forumLegendIcon" value="#{currentMacro.requestImagePath}/icon.posting.gif" width="22" height="26"/>
+ <h:outputText styleClass="forumLegendText" value="#{messages['forum.label.NoNewPosts']}"/>
+ </h:panelGroup>
+ <h:panelGroup>
+ <h:graphicImage styleClass="forumLegendIcon" value="#{currentMacro.requestImagePath}/icon.posting_sticky.gif" width="22" height="26"/>
+ <h:outputText styleClass="forumLegendText" value="#{messages['forum.label.StickyThread']}"/>
+ </h:panelGroup>
+ <h:panelGroup>
+ <h:graphicImage styleClass="forumLegendIcon" value="#{currentMacro.requestImagePath}/icon.posting_locked.gif" width="22" height="26"/>
+ <h:outputText styleClass="forumLegendText" value="#{messages['forum.label.LockedThread']}"/>
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+
+</s:div>
\ No newline at end of file
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumList.xhtml 2008-07-07 12:27:33 UTC (rev 8437)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumList.xhtml 2008-07-08 04:55:59 UTC (rev 8438)
@@ -16,6 +16,8 @@
<ui:include src="forumListTable.xhtml"/>
+ <ui:include src="forumLegend.xhtml"/>
+
</s:span>
</wiki:plugin>
\ No newline at end of file
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/css/forumList.css
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/css/forumList.css 2008-07-07 12:27:33 UTC (rev 8437)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/css/forumList.css 2008-07-08 04:55:59 UTC (rev 8438)
@@ -45,3 +45,26 @@
margin-right: 8px;
margin-bottom: 2px;
}
+
+.forumLegendContainer {
+}
+
+.forumLegendTable {
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.forumLegendColumn {
+ padding-right:30px;
+ padding-top:10px;
+ white-space:nowrap;
+}
+
+.forumLegendIcon {
+ margin-right: 5px;
+ vertical-align: middle;
+}
+
+.forumLegendText {
+}
+
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/css/forumList.css
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/css/forumList.css 2008-07-07 12:27:33 UTC (rev 8437)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/css/forumList.css 2008-07-08 04:55:59 UTC (rev 8438)
@@ -50,6 +50,24 @@
margin-bottom: 2px;
}
-.userInfoPopupContainer {
- text-align: left;
+.forumLegendContainer {
}
+
+.forumLegendTable {
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.forumLegendColumn {
+ padding-right:30px;
+ padding-top:10px;
+ white-space:nowrap;
+}
+
+.forumLegendIcon {
+ margin-right: 5px;
+ vertical-align: middle;
+}
+
+.forumLegendText {
+}
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/css/forumList.css
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/css/forumList.css 2008-07-07 12:27:33 UTC (rev 8437)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/css/forumList.css 2008-07-08 04:55:59 UTC (rev 8438)
@@ -46,3 +46,24 @@
margin-bottom: 3px;
}
+.forumLegendContainer {
+}
+
+.forumLegendTable {
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.forumLegendColumn {
+ padding-right:30px;
+ padding-top:10px;
+ white-space:nowrap;
+}
+
+.forumLegendIcon {
+ margin-right: 5px;
+ vertical-align: middle;
+}
+
+.forumLegendText {
+}
16 years, 6 months
Seam SVN: r8437 - branches/Seam_2_0_FP/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-07-07 08:27:33 -0400 (Mon, 07 Jul 2008)
New Revision: 8437
Modified:
branches/Seam_2_0_FP/build/root.pom.xml
Log:
SEAMFP-8
Modified: branches/Seam_2_0_FP/build/root.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/root.pom.xml 2008-07-07 07:33:27 UTC (rev 8436)
+++ branches/Seam_2_0_FP/build/root.pom.xml 2008-07-07 12:27:33 UTC (rev 8437)
@@ -34,11 +34,6 @@
<name>JBoss Snapshot Repository</name>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
- <repository>
- <id>java.net</id>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
</repositories>
<!-- Externalize some version numbers here -->
16 years, 7 months
Seam SVN: r8436 - in trunk/examples/wiki: src/etc/i18n and 9 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-07 03:33:27 -0400 (Mon, 07 Jul 2008)
New Revision: 8436
Added:
trunk/examples/wiki/view/includes/tagList.xhtml
Modified:
trunk/examples/wiki/src/etc/WEB-INF/components.xml
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagQuery.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/TagsAggregator.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/lastModifiedDocuments.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
trunk/examples/wiki/view/docDisplay_d.xhtml
trunk/examples/wiki/view/includes/onlineUsers.xhtml
trunk/examples/wiki/view/includes/userControl.xhtml
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
Log:
Optional global taglist
Modified: trunk/examples/wiki/src/etc/WEB-INF/components.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/components.xml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/etc/WEB-INF/components.xml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -81,6 +81,7 @@
<value>wiki.Breadcrumb</value>
<value>wiki.Comment</value>
<value>wiki.Signature</value>
+ <value>wiki.TagList</value>
</property>
</component>
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-07 07:33:27 UTC (rev 8436)
@@ -275,6 +275,7 @@
lacewiki.label.tagDisplay.CreatedOn=Created On
lacewiki.label.tagDisplay.LastModifiedOn=Last Modified On
lacewiki.label.tagDisplay.NotAvailableForSkin=Tag display is not available with this skin.
+lacewiki.label.tagDisplay.RelatedTags=Related Tags
# Attachment Display
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagQuery.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagQuery.java 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagQuery.java 2008-07-07 07:33:27 UTC (rev 8436)
@@ -7,16 +7,13 @@
package org.jboss.seam.wiki.core.action;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.Component;
import org.jboss.seam.log.Log;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.*;
import org.jboss.seam.wiki.core.dao.TagDAO;
-import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.model.WikiFile;
-import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.*;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
+import org.jboss.seam.wiki.core.cache.PageFragmentCache;
import java.io.Serializable;
import java.util.List;
@@ -28,6 +25,9 @@
@Scope(ScopeType.CONVERSATION)
public class TagQuery implements Serializable {
+ public static final String CACHE_REGION = "wiki.TagList";
+ public static final String CACHE_KEY = "TagsForDirectory";
+
@Logger
Log log;
@@ -57,4 +57,42 @@
log.debug("loading wiki files tagged with: " + tag);
taggedFiles = tagDAO.findWikFiles(wikiRoot, null, tag, WikiNode.SortableProperty.createdOn, false);
}
+
+ List<DisplayTagCount> tagsSortedByCount;
+ Long highestTagCount;
+
+ public List<DisplayTagCount> getTagsSortedByCount(int maxNumberOfTags, int minimumCount) {
+ if (tagsSortedByCount == null) {
+ WikiDirectory currentDirectory = (WikiDirectory) Component.getInstance("currentDirectory");
+ tagsSortedByCount = tagDAO.findTagCounts(currentDirectory, null, maxNumberOfTags, minimumCount);
+ }
+ return tagsSortedByCount;
+ }
+
+ public Long getHighestTagCount(int maxNumberOfTags, int minimumCount) {
+ if (highestTagCount == null) {
+ highestTagCount = 0l;
+ List<DisplayTagCount> tagsSortedByCount = getTagsSortedByCount(maxNumberOfTags, minimumCount);
+ for (DisplayTagCount tagCount : tagsSortedByCount) {
+ if (tagCount.getCount() > highestTagCount) highestTagCount= tagCount.getCount();
+ }
+ }
+ return highestTagCount;
+ }
+
+ public String getCacheRegion() {
+ return CACHE_REGION;
+ }
+
+ public String getCacheKey(int maxNumberOfTags, int minimumCount) {
+ Integer currentAccessLevel = (Integer)Component.getInstance("currentAccessLevel");
+ WikiDirectory currentDirectory = (WikiDirectory) Component.getInstance("currentDirectory");
+ return CACHE_KEY + currentDirectory.getId() + "_" + maxNumberOfTags + "_" + minimumCount + "_" + currentAccessLevel;
+ }
+
+ @Observer(value = { "Node.updated", "Node.removed", "Node.persisted"}, create = true)
+ public void invalidateCache() {
+ PageFragmentCache.instance().removeAll(CACHE_REGION);
+ }
+
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-07-07 07:33:27 UTC (rev 8436)
@@ -328,7 +328,7 @@
String secondsStr = (seconds<10 ? "0" : "")+seconds;
String minutesStr = (minutes<10 ? "0" : "")+minutes;
String hoursStr = (hours<10 ? "0" : "")+hours;
- return hoursStr + ":" + minutesStr + ":" + secondsStr;
+ return hoursStr + "h:" + minutesStr + "m:" + secondsStr + "s";
}
public static String formatDate(Date date) {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/TagsAggregator.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/TagsAggregator.java 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/TagsAggregator.java 2008-07-07 07:33:27 UTC (rev 8436)
@@ -1,8 +1,12 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.plugin.basic;
import org.jboss.seam.annotations.*;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.ScopeType;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
@@ -14,6 +18,9 @@
import java.util.*;
import java.io.Serializable;
+/**
+ * @author Christian Bauer
+ */
@Name("tagsAggregator")
@Scope(ScopeType.PAGE)
public class TagsAggregator implements Serializable {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/lastModifiedDocuments.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/lastModifiedDocuments.xhtml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/lastModifiedDocuments.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -32,7 +32,7 @@
(<s:span styleClass="undecoratedLink" rendered="#{wiki:isRegularUser(doc.lastModifiedBy)}">
<h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(doc.lastModifiedBy)}">
- <h:outputText value="#{doc.lastModifiedBy.username}"/>
+ <h:outputText value="#{doc.lastModifiedBy.fullname}"/>
</h:outputLink>
</s:span>
<s:span rendered="#{not wiki:isRegularUser(doc.lastModifiedBy)}">
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-07-07 07:33:27 UTC (rev 8436)
@@ -101,7 +101,7 @@
);
}
*/
- String mailingList =
+ mailingList =
Preferences.instance().get(ForumPreferences.class).getNotificationMailingList();
if (mailingList != null) {
getLog().debug("sending topic notification e-mail to forum list: " + mailingList);
Modified: trunk/examples/wiki/view/docDisplay_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docDisplay_d.xhtml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/view/docDisplay_d.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -10,6 +10,8 @@
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
template="themes/#{preferences.get('Wiki').themeName}/template.xhtml">
+<ui:param name="showDirectoryTags" value="true"/>
+
<ui:define name="includeHeaders">
<s:fragment rendered="#{not empty documentHome.instance.parent.feed}">
Modified: trunk/examples/wiki/view/includes/onlineUsers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -7,7 +7,7 @@
<h:panelGrid styleClass="onlineUsersPanel" columns="4"
cellpadding="0" cellspacing="0" border="0"
- rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
+ rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0}"> <!-- TODO -->
<h:outputText styleClass="onlineLabel" value="#{messages['lacewiki.label.userList.Online']}: "/>
Added: trunk/examples/wiki/view/includes/tagList.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/tagList.xhtml (rev 0)
+++ trunk/examples/wiki/view/includes/tagList.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -0,0 +1,31 @@
+<s:fragment
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <s:cache region="#{tagQuery.cacheRegion}"
+ key="#{tagQuery.getCacheKey(maxNumberOfTags, minimumCount)}">
+
+ <s:fragment rendered="#{not empty tagQuery.getTagsSortedByCount(maxNumberOfTags, minimumCount)}">
+ <h:outputText styleClass="tagListLabel" value="#{messages['lacewiki.label.tagDisplay.RelatedTags']}: "/>
+ </s:fragment>
+
+ <ui:repeat var="tagCount" value="#{tagQuery.getTagsSortedByCount(maxNumberOfTags, minimumCount)}">
+ <s:span styleClass="tagListItem noWrapWhitespace"
+ style="font-size: #{maxFontIncrease+(100/tagQuery.getHighestTagCount(maxNumberOfTags, minimumCount)*tagCount.count)}%;">
+ <s:span styleClass="undecoratedLink">
+ <h:outputLink value="#{wikiURLRenderer.renderTagURL(tagCount.tag)}">
+ <h:outputText value="#{tagCount.tag}"/>
+ </h:outputLink>
+ </s:span>
+ </s:span>
+ <h:outputText value="   "/>
+ </ui:repeat>
+
+ </s:cache>
+
+</s:fragment>
\ No newline at end of file
Modified: trunk/examples/wiki/view/includes/userControl.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userControl.xhtml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/view/includes/userControl.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -18,7 +18,7 @@
var offset = jQuery("#loginForm\\:openPasswordResetPopup").offset();
jsf('passwordResetPopup')
.css({ width: "420px", height: "115px",
- top: offset.top+10+"px", left: offset.left-200+"px"
+ top: offset.top+10+"px", left: offset.left-300+"px"
})
.jqm({
trigger: jQuery("#loginForm\\:openPasswordResetPopup"),
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-07 07:33:27 UTC (rev 8436)
@@ -376,13 +376,17 @@
}
#breadcrumb .itemSeparatorGreaterThan {
- display: none;
+ display: inline;
}
#breadcrumb .itemSeparatorDot {
display: none;
}
+#breadcrumb .itemSeparatorSlash {
+ display: none;
+}
+
#breadcrumb .itemText {
color: #576c74;
padding-left: 2px;
Modified: trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-07-07 00:44:37 UTC (rev 8435)
+++ trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-07-07 07:33:27 UTC (rev 8436)
@@ -335,7 +335,7 @@
</div>
<s:div styleClass="membersAreaContainer" style="margin-top:15px;"
- rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
+ rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0}"> <!-- TODO -->
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<ui:include src="../../includes/onlineUsers.xhtml"/>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
@@ -346,7 +346,7 @@
<!-- Main Content area -->
<div id="rightColumn">
- <h:graphicImage value="#{imagePath}/blank.gif" width="1" height="1"/>
+ <h:graphicImage value="#{imagePath}/blank.gif" width="1" height="8"/>
<ui:include src="../../includes/breadcrumb.xhtml"/>
<!-- Status messages -->
16 years, 7 months
Seam SVN: r8435 - trunk/ui/src/main/java/org/jboss/seam/ui.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-07-06 20:44:37 -0400 (Sun, 06 Jul 2008)
New Revision: 8435
Modified:
trunk/ui/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java
Log:
JBSEAM-3037 - left one behind
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java 2008-07-05 11:42:13 UTC (rev 8434)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java 2008-07-07 00:44:37 UTC (rev 8435)
@@ -31,7 +31,7 @@
@Override
protected String getPersistenceContextName()
{
- return "session";
+ return "hibernateSession";
}
@Override
@@ -39,7 +39,7 @@
{
if (getPersistenceContext() == null)
{
- throw new IllegalStateException("Unable to access a Seam Managed Hibernate Session. You must either have a Seam Managed Hibernate Session called session or configure one in components.xml");
+ throw new IllegalStateException("Unable to access a Seam Managed Hibernate Session. You must either have a Seam Managed Hibernate Session called hibernateSession or configure one in components.xml");
}
}
16 years, 7 months
Seam SVN: r8434 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/admin and 14 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-05 07:42:13 -0400 (Sat, 05 Jul 2008)
New Revision: 8434
Added:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java
trunk/examples/wiki/testbinaries/testimage_w40.jpg
trunk/examples/wiki/testbinaries/testimage_w80.jpg
Modified:
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
trunk/examples/wiki/view/includes/breadcrumb.xhtml
trunk/examples/wiki/view/includes/commentsDisplay.xhtml
trunk/examples/wiki/view/includes/mainMenuItem.xhtml
trunk/examples/wiki/view/includes/onlineMembers.xhtml
trunk/examples/wiki/view/includes/onlineUsers.xhtml
trunk/examples/wiki/view/includes/userControl.xhtml
trunk/examples/wiki/view/includes/userInfo.xhtml
trunk/examples/wiki/view/themes/default/css/mainMenu.css
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/themes/default/css/userControl.css
trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
trunk/examples/wiki/view/userProfile_d.xhtml
Log:
JBSEAM-2887, generate thumbnails of user portraits on upload, not on the fly
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-05 11:42:13 UTC (rev 8434)
@@ -306,14 +306,13 @@
lacewiki.label.userControl.Username=Username
lacewiki.label.userControl.Password=Password
-lacewiki.button.userControl.Login=<u>L</u>ogin
-lacewiki.button.userControl.Login.accesskey=L
+lacewiki.button.userControl.Login=Login
lacewiki.button.userControl.ResetPassword=Reset
lacewiki.button.userControl.Register=<u>R</u>egister
lacewiki.button.userControl.Register.accesskey=R
lacewiki.button.userControl.Members=<u>M</u>embers
lacewiki.button.userControl.Members.accesskey=M
-lacewiki.button.userControl.Logout=<u>L</u>ogout
+lacewiki.button.userControl.Logout=Logout
lacewiki.button.userControl.Logout.accesskey=L
lacewiki.button.userControl.Home=<u>H</u>ome
lacewiki.button.userControl.Home.accesskey=H
@@ -468,6 +467,7 @@
lacewiki.label.userList.OnlineMembers=Online Members
lacewiki.label.userList.InTheLast=in the last
lacewiki.label.userList.Minutes=minutes
+lacewiki.label.userList.Idle=Idle
lacewiki.msg.userList.NoOnlineMembers=No members are currently online.
lacewiki.label.userList.Online=Online
lacewiki.label.userList.Of=of
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,6 +10,7 @@
import org.jboss.seam.wiki.core.model.User;
import org.jboss.seam.wiki.core.model.Role;
import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.wiki.util.WikiUtil;
import org.jboss.seam.annotations.*;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.log.Log;
@@ -42,7 +43,7 @@
transient private Map<String, Boolean> selectedSessions = new HashMap<String,Boolean>();
transient private Map<String, Long> sessionsSize = new HashMap<String,Long>();
- transient private List<User> onlineMembers;
+ transient private List<OnlineUser> onlineMembers;
@Restrict("#{s:hasPermission('User', 'isAdmin', currentUser)}")
public Map<String, Boolean> getSelectedSessions() { return selectedSessions; }
@@ -149,44 +150,88 @@
}
*/
- public List<User> getOnlineMembers() {
- if (onlineMembers == null) {
- Set<String> onlineUsernames = new HashSet<String>();
- Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
- for (HttpSession session : sessions) {
- Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
- if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
- onlineUsernames.add( ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername() );
- }
- }
+ public long getTotalMembers() {
+ return userDAO.findTotalNoOfUsers();
+ }
- // Need to load these guys, the are not in this persistence context
- onlineMembers = userDAO.findUsersWithUsername(onlineUsernames);
- }
+ public List<OnlineUser> getOnlineMembers() {
+ if (onlineMembers == null) loadOnlineMembers();
return onlineMembers;
}
- public long getTotalMembers() {
- return userDAO.findTotalNoOfUsers();
+ public long getNumberOfOnlineMembers() {
+ if (onlineMembers == null) loadOnlineMembers();
+ return onlineMembers.size();
}
- public long getNumberOfOnlineMembers() {
+ public long getNumberOfOnlineGuests() {
+ return WikiServletListener.getSessions().values().size() - getNumberOfOnlineMembers();
+ }
+
+ private void loadOnlineMembers() {
+ onlineMembers = new ArrayList<OnlineUser>();
+
+ // First get the usernames of members out of all sessions
+ Map<String,HttpSession> onlineUsernames = new HashMap<String, HttpSession>();
Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
-
- long loggedInUsers = 0l;
for (HttpSession session : sessions) {
Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
- loggedInUsers++;
+ String username = ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername();
+
+ // Try to get the session with the smallest idle time
+ if (onlineUsernames.containsKey(username)) {
+ if (session.getLastAccessedTime() > onlineUsernames.get(username).getLastAccessedTime()) {
+ onlineUsernames.put(username, session);
+ }
+ } else {
+ onlineUsernames.put(username, session);
+ }
}
}
- return loggedInUsers;
+ // Then load these guys into a current persistence context
+ List<User> userInstances = userDAO.findUsersWithUsername(onlineUsernames.keySet());
+
+ for (User userInstance : userInstances) {
+ // Now fill the OnlineUser DTO which is needed by the UI
+ onlineMembers.add(
+ new OnlineUser(
+ userInstance,
+ onlineUsernames.get(userInstance.getUsername()).getLastAccessedTime()
+ )
+ );
+ }
}
-
- public long getNumberOfOnlineGuests() {
- return WikiServletListener.getSessions().values().size() - getNumberOfOnlineMembers();
+
+ public static class OnlineUser {
+ private User user;
+ private long lastAccessedTime;
+
+ public OnlineUser(User user, long lastAccessedTime) {
+ this.user = user;
+ this.lastAccessedTime = lastAccessedTime;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public long getLastAccessedTime() {
+ return lastAccessedTime;
+ }
+
+ public void setLastAccessedTime(long lastAccessedTime) {
+ this.lastAccessedTime = lastAccessedTime;
+ }
+
+ public String getIdleTime() {
+ return WikiUtil.getTimeDifferenceToCurrent(WikiUtil.toDate(lastAccessedTime));
+ }
}
-
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -241,6 +241,9 @@
getInstance().getProfile().setImage(
WikiUtil.resizeImage(portrait.getData(), portrait.getContentType(), 80) // TODO: Make size configurable?
);
+ getInstance().getProfile().setSmallImage(
+ WikiUtil.resizeImage(portrait.getData(), portrait.getContentType(), 40) // TODO: Make size configurable?
+ );
} else {
statusMessages.addFromResourceBundleOrDefault(
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -58,6 +58,12 @@
@Column(name = "IMAGE_CONTENT_TYPE", nullable = true, length = 255)
private String imageContentType;
+ // SchemaExport needs length.. MySQL has "tinyblob", "mediumblob" and other such nonsense types
+ @Lob
+ @Column(name = "SMALL_IMAGE_DATA", nullable = true, length = 200000)
+ @Basic(fetch = FetchType.LAZY) // Lazy loaded through bytecode instrumentation
+ private byte[] smallImage;
+
public UserProfile() {}
// Immutable properties
@@ -123,4 +129,12 @@
public void setImageContentType(String imageContentType) {
this.imageContentType = imageContentType;
}
+
+ public byte[] getSmallImage() {
+ return smallImage;
+ }
+
+ public void setSmallImage(byte[] smallImage) {
+ this.smallImage = smallImage;
+ }
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiURLRenderer.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -78,6 +78,18 @@
return url.toString();
}
+ public String renderUserPortraitURL(User user, boolean small) {
+ return renderUserPortraitURL(user, small, false);
+ }
+
+ public String renderUserPortraitURL(User user, boolean small, boolean usePrefsPath) {
+ if (user == null || user.getId() == null) return "";
+ StringBuilder url = new StringBuilder();
+ if (usePrefsPath) url.append(prefs.getBaseUrl());
+ url.append("/seam/resource/wikiUserPortrait/").append(user.getId()).append("/").append(small ? "s" : "l");
+ return url.toString();
+ }
+
public String renderAggregateFeedURL(String aggregateId) {
return renderAggregateFeedURL(aggregateId, false);
}
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUserPortraitResource.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.ui;
+
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import org.jboss.seam.web.AbstractResource;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.servlet.ContextualHttpServletRequest;
+import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.wiki.core.model.User;
+import org.jboss.seam.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+/**
+ * Serves user portraits from the database, so we don't have to use s:graphicImage anymore.
+ *
+ * This helps caching on the browser, as image URIs will be stable and not random keys into a current HttpSession.
+ *
+ * @author Christian Bauer
+ */
+@Scope(APPLICATION)
+@Name("wikiUserPortraitThemeResource")
+@BypassInterceptors
+public class WikiUserPortraitResource extends AbstractResource {
+
+ // Resources URIs end with /<userId>/<l|s>
+ public static Pattern RESOURCE_PATTERN = Pattern.compile("^/([0-9]+)/([ls]{1})$");
+
+ public static final String REGISTER_SEAM_RESOURCE = "/wikiUserPortrait";
+
+ private Log log = Logging.getLog(WikiUserPortraitResource.class);
+
+ @Override
+ public String getResourcePath() {
+ return REGISTER_SEAM_RESOURCE;
+ }
+
+ @Override
+ public void getResource(final HttpServletRequest request, final HttpServletResponse response)
+ throws ServletException, IOException {
+
+ // Wrap this, we need an ApplicationContext
+ new ContextualHttpServletRequest(request) {
+ @Override
+ public void process() throws IOException {
+ doWork(request, response);
+ }
+ }.run();
+
+ }
+
+ public void doWork(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+
+ String pathInfo = request.getPathInfo().substring(getResourcePath().length());
+
+ String userId = null;
+ String imageSize = null;
+ Matcher matcher = RESOURCE_PATTERN.matcher(pathInfo);
+ if (matcher.find()) {
+ userId = matcher.group(1);
+ imageSize = matcher.group(2);
+ log.debug("request for user id: " + userId + ", image size: " + imageSize);
+ }
+
+ if (userId == null || imageSize == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid request path, use: /wikiUserPortrait/[0-9]+/(l|s)");
+ return;
+ }
+
+ UserDAO userDAO = (UserDAO) Component.getInstance(UserDAO.class);
+ User user = userDAO.findUser(Long.valueOf(userId));
+ if (user == null || user.getProfile().getImageContentType() == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, "User id not found or no portrait for user");
+ return;
+ }
+
+ response.addHeader("Cache-Control", "max-age=600"); // 10 minutes freshness in browser cache
+
+ byte[] image = imageSize.equals("l") ? user.getProfile().getImage() : user.getProfile().getSmallImage();
+ response.setContentType(user.getProfile().getImageContentType());
+ response.setContentLength(image.length);
+ response.getOutputStream().write(image);
+ response.getOutputStream().flush();
+ }
+
+}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-07-05 11:42:13 UTC (rev 8434)
@@ -254,7 +254,7 @@
String formatName = "";
if ("image/png".equals(contentType)) formatName = "png";
- else if ("image/jpeg".equals(contentType)) formatName = "jpeg";
+ else if ("image/jpeg".equals(contentType) || "image/jpg".equals(contentType)) formatName = "jpeg";
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,10 +10,12 @@
<s:div styleClass="box">
<s:div styleClass="boxHeader">
- <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}"/>
+ <!-- TODO: make configurable
#{messages['lacewiki.label.userList.InTheLast']}
#{wikiInit.authenticatedSessionTimeoutMinutes}
#{messages['lacewiki.label.userList.Minutes']}"/>
+ -->
</s:div>
<div class="boxContent">
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/profile_userSummary.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -45,10 +45,9 @@
<h:outputText value="#{messages['basic.userSummary.label.Portrait']}:"
rendered="#{!empty userHome.instance.profile.imageContentType}"/>
- <s:graphicImage rendered="#{!empty userHome.instance.profile.imageContentType}"
- styleClass="userInfoPortraitImage" value="#{userHome.instance.profile.image}">
- <s:transformImageSize width="80" maintainRatio="true"/>
- </s:graphicImage>
+ <h:graphicImage rendered="#{!empty userHome.instance.profile.imageContentType}"
+ styleClass="userInfoPortraitImage"
+ value="#{wikiURLRenderer.renderUserPortraitURL(userHome.instance, false)}"/>
<h:outputText value="#{messages['basic.userSummary.label.Bio']}:"
rendered="#{not empty userHome.instance.profile.bio}"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/forumPostingHeader.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -118,9 +118,8 @@
<s:fragment rendered="#{currentDocument.ownedByRegularUser and !empty currentDocument.createdBy.profile.imageContentType}">
<s:span styleClass="undecoratedLink">
<h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(currentDocument.createdBy)}">
- <s:graphicImage styleClass="commentAuthorPortraitImage" value="#{currentDocument.createdBy.profile.image}">
- <s:transformImageSize width="30" maintainRatio="true"/>
- </s:graphicImage>
+ <h:graphicImage styleClass="commentAuthorPortraitImage"
+ value="#{wikiURLRenderer.renderUserPortraitURL(currentDocument.createdBy, true)}"/>
</h:outputLink>
</s:span>
</s:fragment>
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -153,7 +153,8 @@
LOCATION="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis."
OCCUPATION="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum."
SIGNATURE="My member signature

Lorem ipsum dolor sit amet, *consectetuer* adipiscing elit, _sed diam nonummy_ nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum."
- IMAGE_DATA="[BINARY_DIR]/testimage_thumbnail.jpg"
+ IMAGE_DATA="[BINARY_DIR]/testimage_w80.jpg"
+ SMALL_IMAGE_DATA="[BINARY_DIR]/testimage_w40.jpg"
IMAGE_CONTENT_TYPE="image/jpg"/>
/>
Added: trunk/examples/wiki/testbinaries/testimage_w40.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/testbinaries/testimage_w40.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/wiki/testbinaries/testimage_w80.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/testbinaries/testimage_w80.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/includes/breadcrumb.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/breadcrumb.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/breadcrumb.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -44,6 +44,9 @@
<h:outputText rendered="#{breadcrumb.indexOf(node) < breadcrumb.size()-1}"
styleClass="itemSeparatorGreaterThan itemSeparator" value=">"/>
+ <h:outputText rendered="#{breadcrumb.indexOf(node) < breadcrumb.size()-1}"
+ styleClass="itemSeparatorSlash itemSeparator" value="/"/>
+
</ui:repeat>
</h:panelGroup>
Modified: trunk/examples/wiki/view/includes/commentsDisplay.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/commentsDisplay.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/commentsDisplay.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -99,9 +99,8 @@
<s:fragment rendered="#{c.ownedByRegularUser and !empty c.createdBy.profile.imageContentType}">
<s:span styleClass="undecoratedLink">
<h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(c.createdBy)}">
- <s:graphicImage styleClass="commentAuthorPortraitImage" value="#{c.createdBy.profile.image}">
- <s:transformImageSize width="30" maintainRatio="true"/>
- </s:graphicImage>
+ <h:graphicImage styleClass="commentAuthorPortraitImage"
+ value="#{wikiURLRenderer.renderUserPortraitURL(c.createdBy, true)}"/>
</h:outputLink>
</s:span>
</s:fragment>
Modified: trunk/examples/wiki/view/includes/mainMenuItem.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/mainMenuItem.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/mainMenuItem.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -10,7 +10,10 @@
<c:forEach var="childWrapper" items="#{node.wrappedChildrenSorted}">
<s:div styleClass="level#{childWrapper.level}">
<s:div styleClass="level#{childWrapper.level}Body">
- <h:outputText styleClass="level#{childWrapper.level}Marker" value="·"/>
+ <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerDot" value="·"/>
+ <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerGreaterThan" value=">"/>
+ <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSlash" value="/"/>
+ <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSpace" value=" "/>
<h:outputLink styleClass="level#{childWrapper.level}Link"
value="#{wikiURLRenderer.renderURL(childWrapper.wrappedNode)}">#{childWrapper.wrappedNode.name}</h:outputLink>
</s:div>
Modified: trunk/examples/wiki/view/includes/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -7,32 +7,32 @@
xmlns:s="http://jboss.com/products/seam/taglib">
<h:panelGrid columns="8" rendered="#{not empty wikiHttpSessionManager.onlineMembers}"
- columnClasses="alignBottom minorPadding"
+ columnClasses="alignBottom alignCenter minorPadding"
style="margin-left:auto;margin-right:auto;">
- <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
+ <c:forEach var="ou" items="#{wikiHttpSessionManager.onlineMembers}">
<s:div>
- <s:div styleClass="alignCenter">
- <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
- <s:graphicImage styleClass="userInfoPortraitImage"
- rendered="#{!empty u.profile.imageContentType}"
- value="#{u.profile.image}">
- <s:transformImageSize width="40" maintainRatio="true"/>
- </s:graphicImage>
- <h:graphicImage rendered="#{empty u.profile.imageContentType}"
+ <s:div>
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(ou.user)}">
+ <h:graphicImage styleClass="userInfoPortraitImage"
+ rendered="#{!empty ou.user.profile.imageContentType}"
+ value="#{wikiURLRenderer.renderUserPortraitURL(ou.user, true)}"/>
+ <h:graphicImage rendered="#{empty ou.user.profile.imageContentType}"
value="#{imagePath}/default_portrait.gif" width="40" height="50"/>
</h:outputLink>
</s:div>
- <s:div styleClass="undecoratedLink">
- <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
- <h:outputText value="#{u.fullname}"/>
+ <s:div styleClass="undecoratedLink smallFont">
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(ou.user)}">
+ <h:outputText value="#{ou.user.fullname}"/>
</h:outputLink>
+ <br/>
+ <h:outputText styleClass="smallFont" value="#{messages['lacewiki.label.userList.Idle']}: #{ou.idleTime}"/>
</s:div>
</s:div>
</c:forEach>
</h:panelGrid>
- <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"
- rendered="#{empty wikiHttpSessionManager.onlineMembers}"/>
+ <s:div styleClass="minorPadding" rendered="#{empty wikiHttpSessionManager.onlineMembers}">
+ <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"/>
+ </s:div>
-
</s:fragment>
\ No newline at end of file
Modified: trunk/examples/wiki/view/includes/onlineUsers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -6,7 +6,8 @@
xmlns:s="http://jboss.com/products/seam/taglib">
<h:panelGrid styleClass="onlineUsersPanel" columns="4"
- cellpadding="0" cellspacing="0" border="0">
+ cellpadding="0" cellspacing="0" border="0"
+ rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
<h:outputText styleClass="onlineLabel" value="#{messages['lacewiki.label.userList.Online']}: "/>
@@ -24,6 +25,7 @@
</s:link>
</s:fragment>
+ <!-- TODO: Make this configurable, it's confusing because the search robots also count as guests (but explain that to a marketing guy)
<h:outputText styleClass="onlineSeparator" value=" | "
rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and
wikiHttpSessionManager.numberOfOnlineGuests > 0}"/>
@@ -36,6 +38,7 @@
: messages['lacewiki.label.userList.Guest']}"/>
</s:span>
</s:fragment>
+ -->
</h:panelGrid>
Modified: trunk/examples/wiki/view/includes/userControl.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userControl.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/userControl.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -104,10 +104,11 @@
</s:span>
<h:inputSecret styleClass="input" id="loginPassword" value="#{identity.password}" size="8" tabindex="50"/>
- <h:commandLink action="#{identity.login}" tabindex="50" styleClass="link"
- accesskey="#{messages['lacewiki.button.userControl.Login.accesskey']}">
- <h:outputText styleClass="linkText" escape="false" value="#{messages['lacewiki.button.userControl.Login']}"/>
- </h:commandLink>
+ <h:commandButton id="loginButton" action="#{identity.login}" tabindex="50" styleClass="loginButton"
+ accesskey="#{messages['lacewiki.button.userControl.Login.accesskey']}"
+ value="#{messages['lacewiki.button.userControl.Login']}">
+ <s:defaultAction/>
+ </h:commandButton>
</h:form>
@@ -128,13 +129,15 @@
<s:fragment rendered="#{identity.loggedIn}">
- <h:outputText styleClass="label" value="(#{currentUser.fullname})"/>
- <s:link styleClass="link" action="#{authenticator.logout}" tabindex="70"
- propagation="none"
- accesskey="#{messages['lacewiki.button.userControl.Logout.accesskey']}">
- <h:outputText styleClass="linkText" escape="false" value="#{messages['lacewiki.button.userControl.Logout']}"/>
- </s:link>
+ <h:form id="logoutForm" styleClass="logoutForm">
+ <h:outputText styleClass="label" value="(#{currentUser.fullname})"/>
+ <h:commandButton action="#{authenticator.logout}" tabindex="70" styleClass="logoutButton"
+ accesskey="#{messages['lacewiki.button.userControl.Logout.accesskey']}"
+ value="#{messages['lacewiki.button.userControl.Logout']}">
+ <s:conversationPropagation type="none"/>
+ </h:commandButton>
+ </h:form>
<h:outputLink styleClass="link" tabindex="70"
accesskey="#{messages['lacewiki.button.userControl.Home.accesskey']}"
Modified: trunk/examples/wiki/view/includes/userInfo.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userInfo.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/includes/userInfo.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -27,10 +27,7 @@
<s:div styleClass="#{!empty user.profile.bio ? 'userInfoPortraitWithBio' : 'userInfoPortrait'}"
rendered="#{!empty user.profile.imageContentType}">
- <s:graphicImage styleClass="userInfoPortraitImage"
- value="#{user.profile.image}">
- <s:transformImageSize width="80" maintainRatio="true"/>
- </s:graphicImage>
+ <h:graphicImage styleClass="userInfoPortraitImage" value="#{wikiURLRenderer.renderUserPortraitURL(user, false)}"/>
</s:div>
<s:span styleClass="userInfoBio" rendered="#{!empty user.profile.bio}">
Modified: trunk/examples/wiki/view/themes/default/css/mainMenu.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/mainMenu.css 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/mainMenu.css 2008-07-05 11:42:13 UTC (rev 8434)
@@ -49,6 +49,10 @@
#mainMenu .level3 {}
#mainMenu .level3Marker {
+ display: none;
+}
+
+#mainMenu .level3MarkerDot {
padding-left: 2px;
padding-right: 2px;
font-size: 80%;
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-07-05 11:42:13 UTC (rev 8434)
@@ -1489,6 +1489,14 @@
display: none;
}
+#breadcrumb .itemSeparatorSlash {
+ display: none;
+}
+
+#breadcrumb .itemSeparatorDot {
+ display: inline;
+}
+
#breadcrumb .itemText {
color: #fff;
text-decoration: none;
Modified: trunk/examples/wiki/view/themes/default/css/userControl.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/userControl.css 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/default/css/userControl.css 2008-07-05 11:42:13 UTC (rev 8434)
@@ -3,7 +3,7 @@
font-size: 75%;
}
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
display: inline;
}
@@ -34,6 +34,22 @@
border: 0;
}
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+ padding: 2px;
+ border: none;
+ margin-left: 5px;
+ margin-right: 0;
+ margin-top: 0;
+ margin-bottom: 0;
+ color: #C7B299;
+ background: none;
+ font-family: Arial, Helvetica, sans-serif;
+ line-height: 100%;
+ font-size: 115%;
+ font-weight: bold;
+ cursor: pointer;
+}
+
.resetPasswordForm {
display: inline;
}
Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-05 11:42:13 UTC (rev 8434)
@@ -1502,10 +1502,18 @@
color: #d75525;
}
+#breadcrumb .itemSeparatorSlash {
+ display: none;
+}
+
#breadcrumb .itemSeparatorGreaterThan {
display: none;
}
+#breadcrumb .itemSeparatorDot {
+ display: inline;
+}
+
#breadcrumb .itemText {
color: #d75525;
text-decoration: none;
@@ -1710,7 +1718,7 @@
padding-right: 18px;
}
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
display: inline;
}
@@ -1758,6 +1766,21 @@
}
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+ border: none;
+ background: none;
+ padding: 1px;
+ margin-left: 5px;
+ margin-right: 0;
+ margin-top: 0;
+ margin-bottom: 0;
+ color: #fff;
+ font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+ line-height: 100%;
+ font-size: 100%;
+ cursor: pointer;
+}
+
/* Search Control
----------------------------------------------- */
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-05 11:42:13 UTC (rev 8434)
@@ -375,6 +375,10 @@
color: #000;
}
+#breadcrumb .itemSeparatorGreaterThan {
+ display: none;
+}
+
#breadcrumb .itemSeparatorDot {
display: none;
}
@@ -1668,7 +1672,7 @@
margin-right: 10px;
}
-.loginForm {
+.userControlPanel .loginForm, .userControlPanel .logoutForm {
display: inline;
}
@@ -1703,6 +1707,20 @@
border: 0;
}
+.userControlPanel .loginButton, .userControlPanel .logoutButton {
+ border: none;
+ background: none;
+ padding: 1px;
+ margin-left: 5px;
+ margin-right: 0;
+ margin-top: 0;
+ margin-bottom: 0;
+ color: #fff;
+ font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+ font-size: 100%;
+ cursor: pointer;
+}
+
.resetPasswordForm {
display: inline;
}
@@ -1814,6 +1832,11 @@
}
#mainMenu .level2Marker {
+ display: none;
+}
+
+#mainMenu .level2MarkerDot {
+ display: inline;
color: #ca884e;
margin-right: 4px;
font-size: 85%;
@@ -1837,10 +1860,7 @@
}
#mainMenu .level3Marker {
- padding-left: 2px;
- padding-right: 2px;
- font-size: 80%;
- color: #ca884e;
+ display: none;
}
#mainMenu .level3Link {
Modified: trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -334,7 +334,8 @@
</div>
</div>
- <s:div styleClass="membersAreaContainer" style="margin-top:15px;">
+ <s:div styleClass="membersAreaContainer" style="margin-top:15px;"
+ rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0 and wikiHttpSessionManager.numberOfOnlineGuests > 0}"> <!-- TODO -->
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<ui:include src="../../includes/onlineUsers.xhtml"/>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
Modified: trunk/examples/wiki/view/userProfile_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userProfile_d.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
+++ trunk/examples/wiki/view/userProfile_d.xhtml 2008-07-05 11:42:13 UTC (rev 8434)
@@ -30,10 +30,6 @@
<ui:define name="content">
- <h1 class="documentTitle">
- <h:outputText value="#{messages['lacewiki.label.userProfile.UserProfile']} '#{userHome.instance.username}'"/>
- </h1>
-
<s:div>
<c:forEach var="pm" items="#{pluginRegistry.profilePluginModulesAsList}">
<ui:include src="/#{pm.plugin.getPackageDefaultTemplatePath(pm.template)}"/>
16 years, 7 months
Seam SVN: r8433 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/core/plugin/metamodel and 3 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-04 13:11:26 -0400 (Fri, 04 Jul 2008)
New Revision: 8433
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/ProfilePluginModule.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/feed/FeedAggregatorPreferences.java
trunk/examples/wiki/view/userProfile_d.xhtml
Log:
Minor bugfixes
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2008-07-04 17:11:26 UTC (rev 8433)
@@ -197,12 +197,15 @@
@Observer("org.jboss.seam.security.loggedOut")
public void resetSessionTime() {
- // Don't rely on that, do a null check
+ // Don't rely on that, do a null check - this should never be null but sometimes it is... *sigh*
Object o = Contexts.getSessionContext().get(REGULAR_SESSION_MAX_INACTIVE_SECONDS);
if (o != null) {
int regularSessionTimeout = (Integer) o;
log.debug("resetting timeout of user session after logout to minutes: " + regularSessionTimeout/60);
ServletContexts.getInstance().getRequest().getSession().setMaxInactiveInterval(regularSessionTimeout);
+ } else {
+ // Safety, reset to a low value, 10 minutes
+ ServletContexts.getInstance().getRequest().getSession().setMaxInactiveInterval(600);
}
}
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java 2008-07-04 17:11:26 UTC (rev 8433)
@@ -108,4 +108,6 @@
public String getQualifiedCacheRegionName(String name) {
return getFullyQualifiedKey() + "." + name;
}
+
+ public abstract String getModuleTypeLabel();
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/ProfilePluginModule.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/ProfilePluginModule.java 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/ProfilePluginModule.java 2008-07-04 17:11:26 UTC (rev 8433)
@@ -50,4 +50,8 @@
: result;
}
+ // TODO: This is only used in the Administration UI
+ public String getModuleTypeLabel() {
+ return "Profile";
+ }
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-07-04 17:11:26 UTC (rev 8433)
@@ -74,11 +74,11 @@
// Initialize the value holders used for UI binding
for (SearchableEntity searchableEntity : searchRegistry.getSearchableEntities()) {
- log.debug("preparing search value holder for entity: " + searchableEntity.getDescription());
+ log.trace("preparing search value holder for entity: " + searchableEntity.getDescription());
List<PropertySearch> searchesForEntity = new ArrayList<PropertySearch>();
for (SearchableProperty prop : searchableEntity.getProperties()) {
- log.debug("preparing search value holder for property: " + prop.getDescription());
+ log.trace("preparing search value holder for property: " + prop.getDescription());
searchesForEntity.add(new PropertySearch(prop));
}
searches.put(searchableEntity, searchesForEntity);
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/feed/FeedAggregatorPreferences.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/feed/FeedAggregatorPreferences.java 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/feed/FeedAggregatorPreferences.java 2008-07-04 17:11:26 UTC (rev 8433)
@@ -19,7 +19,7 @@
*/
@Preferences(
name = "FeedAggregator",
- description = "#{messages['feed.aggregator.preferences.property.description']}",
+ description = "#{messages['feed.aggregator.preferences.description']}",
mappedTo = "feed.aggregator"
)
public class FeedAggregatorPreferences {
Modified: trunk/examples/wiki/view/userProfile_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userProfile_d.xhtml 2008-07-03 11:12:59 UTC (rev 8432)
+++ trunk/examples/wiki/view/userProfile_d.xhtml 2008-07-04 17:11:26 UTC (rev 8433)
@@ -10,7 +10,7 @@
xmlns:c="http://java.sun.com/jstl/core"
template="themes/#{preferences.get('Wiki').themeName}/template.xhtml">
-<ui:param name="hideControls" value="#{not s:hasPermission('User', 'isAdmin', currentUser)}"/>
+<ui:param name="hideControls" value="#{not s:hasPermission('User', 'isAdmin', currentUser) and userHome.instance.id != currentUser.id}"/>
<ui:define name="screenname">
<h:outputText value="#{messages['lacewiki.label.userProfile.UserProfile']} '#{userHome.instance.username}'"/>
16 years, 7 months
Seam SVN: r8432 - branches/Seam_2_0_FP/build.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-07-03 07:12:59 -0400 (Thu, 03 Jul 2008)
New Revision: 8432
Modified:
branches/Seam_2_0_FP/build/docs.pom.xml
Log:
SEAMFP-7
Modified: branches/Seam_2_0_FP/build/docs.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/docs.pom.xml 2008-07-01 11:53:31 UTC (rev 8431)
+++ branches/Seam_2_0_FP/build/docs.pom.xml 2008-07-03 11:12:59 UTC (rev 8432)
@@ -33,9 +33,9 @@
<extensions>true</extensions>
<dependencies>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-docbook-xslt</artifactId>
- <version>1.1.0.BETA2</version>
+ <groupId>com.jboss</groupId>
+ <artifactId>jbossent-docbook-xslt</artifactId>
+ <version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.wst.css</groupId>
@@ -48,15 +48,15 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jdocbook-style</artifactId>
- <version>1.1.0.BETA2</version>
+ <groupId>com.jboss</groupId>
+ <artifactId>jbossent-jdocbook-style</artifactId>
+ <version>1.0.0</version>
<type>jdocbook-style</type>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0.Beta1</version>
+ <version>1.1.0</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
@@ -77,28 +77,28 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>
- classpath:/xslt/org/jboss/seam/pdf.xsl
+ classpath:/xslt/com/jboss/pdf.xsl
</stylesheetResource>
<finalName>seam_reference.pdf</finalName>
</format>
<format>
<formatName>html</formatName>
<stylesheetResource>
- classpath:/xslt/org/jboss/seam/xhtml.xsl
+ classpath:/xslt/com/jboss/xhtml.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>
- classpath:/xslt/org/jboss/seam/xhtml-single.xsl
+ classpath:/xslt/com/jboss/xhtml-single.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>eclipse</formatName>
<stylesheetResource>
- classpath:/xslt/org/jboss/seam/eclipse.xsl
+ classpath:/xslt/com/jboss/eclipse.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
16 years, 7 months
Seam SVN: r8431 - in trunk/examples/wiki: src/etc/i18n and 13 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-01 07:53:31 -0400 (Tue, 01 Jul 2008)
New Revision: 8431
Added:
trunk/examples/wiki/src/etc/gwtmodules/
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
trunk/examples/wiki/view/themes/default/img/default_portrait.gif
trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
Modified:
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
trunk/examples/wiki/view/includes/onlineMembers.xhtml
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
trunk/examples/wiki/view/userList_d.xhtml
Log:
Added onlineMembers macro
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-01 11:53:31 UTC (rev 8431)
@@ -466,6 +466,9 @@
lacewiki.label.userList.Edit=Edit
lacewiki.label.userList.NotAvailableForSkin=User search is not available with this skin.
lacewiki.label.userList.OnlineMembers=Online Members
+lacewiki.label.userList.InTheLast=in the last
+lacewiki.label.userList.Minutes=minutes
+lacewiki.msg.userList.NoOnlineMembers=No members are currently online.
lacewiki.label.userList.Online=Online
lacewiki.label.userList.Of=of
lacewiki.label.userList.Member=Member
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-01 11:53:31 UTC (rev 8431)
@@ -42,6 +42,7 @@
transient private Map<String, Boolean> selectedSessions = new HashMap<String,Boolean>();
transient private Map<String, Long> sessionsSize = new HashMap<String,Long>();
+ transient private List<User> onlineMembers;
@Restrict("#{s:hasPermission('User', 'isAdmin', currentUser)}")
public Map<String, Boolean> getSelectedSessions() { return selectedSessions; }
@@ -149,17 +150,20 @@
*/
public List<User> getOnlineMembers() {
- Set<String> onlineUsernames = new HashSet<String>();
- Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
- for (HttpSession session : sessions) {
- Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
- if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
- onlineUsernames.add( ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername() );
+ if (onlineMembers == null) {
+ Set<String> onlineUsernames = new HashSet<String>();
+ Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
+ for (HttpSession session : sessions) {
+ Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
+ if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
+ onlineUsernames.add( ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername() );
+ }
}
+
+ // Need to load these guys, the are not in this persistence context
+ onlineMembers = userDAO.findUsersWithUsername(onlineUsernames);
}
-
- // Need to load these guys, the are not in this persistence context
- return userDAO.findUsersWithUsername(onlineUsernames);
+ return onlineMembers;
}
public long getTotalMembers() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-07-01 11:53:31 UTC (rev 8431)
@@ -53,13 +53,8 @@
}
public long findTotalNoOfUsers() {
- Query q =
- entityManager.createQuery(
- "select count(u) from User u where not u.username = :guestUsername and not u.username = :adminUsername"
- );
- q.setParameter("guestUsername", User.GUEST_USERNAME);
- q.setParameter("adminUsername", User.ADMIN_USERNAME);
- q.setHint("org.hibernate.comment", "Find number of members");
+ Query q = entityManager.createQuery("select count(u) from User u");
+ q.setHint("org.hibernate.comment", "Find number of users");
q.setHint("org.hibernate.cacheable", true);
return (Long)q.getSingleResult();
}
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -169,6 +169,13 @@
-->
</macro>
+ <macro key="onlineMembers" name="onlineMembers">
+ <applicable-to content="true"/>
+ <skins>
+ <skin name="d"/>
+ </skins>
+ </macro>
+
<profile key="userSummary" template="profile_userSummary" priority="10">
<skins>
<skin name="d"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-07-01 11:53:31 UTC (rev 8431)
@@ -82,6 +82,9 @@
basic.userProfile.label=User Profile
basic.userProfile.description=Display the profile of the current document owner/creator
+basic.onlineMembers.label=Online Members
+basic.onlineMembers.description=Display all currently online members and their portrait
+
basic.userSummary.label=User Summary
basic.userSummary.description=Display a summary of a users statistics
basic.userSummary.label.Portrait=Portrait
Added: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml (rev 0)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/onlineMembers.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -0,0 +1,29 @@
+<wiki:plugin
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+
+ <s:div styleClass="box">
+
+ <s:div styleClass="boxHeader">
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+ #{messages['lacewiki.label.userList.InTheLast']}
+ #{wikiInit.authenticatedSessionTimeoutMinutes}
+ #{messages['lacewiki.label.userList.Minutes']}"/>
+ </s:div>
+
+ <div class="boxContent">
+
+ <ui:include src="/includes/onlineMembers.xhtml"/>
+
+ </div>
+
+ <div class="boxFooter"/>
+
+ </s:div>
+
+</wiki:plugin>
Modified: trunk/examples/wiki/view/includes/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -6,39 +6,33 @@
xmlns:c="http://java.sun.com/jstl/core"
xmlns:s="http://jboss.com/products/seam/taglib">
- <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0"
- styleClass="datatable topLeftBottomBorder rightBorder smallFont"
- headerClass="regularHeader"
- columnClasses="alignCenter alignBottom minorPadding">
+ <h:panelGrid columns="8" rendered="#{not empty wikiHttpSessionManager.onlineMembers}"
+ columnClasses="alignBottom minorPadding"
+ style="margin-left:auto;margin-right:auto;">
+ <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
+ <s:div>
+ <s:div styleClass="alignCenter">
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
+ <s:graphicImage styleClass="userInfoPortraitImage"
+ rendered="#{!empty u.profile.imageContentType}"
+ value="#{u.profile.image}">
+ <s:transformImageSize width="40" maintainRatio="true"/>
+ </s:graphicImage>
+ <h:graphicImage rendered="#{empty u.profile.imageContentType}"
+ value="#{imagePath}/default_portrait.gif" width="40" height="50"/>
+ </h:outputLink>
+ </s:div>
+ <s:div styleClass="undecoratedLink">
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
+ <h:outputText value="#{u.fullname}"/>
+ </h:outputLink>
+ </s:div>
+ </s:div>
+ </c:forEach>
+ </h:panelGrid>
- <f:facet name="header">
- <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}"/>
- <h:outputText value="#{init.authenticatedSessionTimeoutMinutes} minutes"/>
- </f:facet>
+ <h:outputText value="#{messages['lacewiki.msg.userList.NoOnlineMembers']}"
+ rendered="#{empty wikiHttpSessionManager.onlineMembers}"/>
- <h:panelGrid columns="10">
- <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
- <h:panelGrid columns="1">
- <s:div styleClass="alignCenter">
- <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
- <s:graphicImage styleClass="userInfoPortraitImage"
- rendered="#{!empty u.profile.imageContentType}"
- value="#{u.profile.image}">
- <s:transformImageSize width="40" maintainRatio="true"/>
- </s:graphicImage>
- <h:graphicImage rendered="#{empty u.profile.imageContentType}"
- style="background: #ccc;" value="#{imagePath}/blank.gif" width="40" height="40"/>
- </h:outputLink>
- </s:div>
- <s:div styleClass="undecoratedLink">
- <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
- <h:outputText value="#{u.fullname}"/>
- </h:outputLink>
- </s:div>
- </h:panelGrid>
- </c:forEach>
- </h:panelGrid>
- </h:panelGrid>
-
</s:fragment>
\ No newline at end of file
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -932,6 +932,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/default/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/default/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -952,6 +952,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/inrelationto/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-07-01 11:53:31 UTC (rev 8431)
@@ -607,6 +607,14 @@
text-align: left;
}
+.alignTop {
+ vertical-align: top;
+}
+
+.alignBottom {
+ vertical-align: bottom;
+}
+
.noPadding {
padding: 0;
}
Added: trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/wiki/view/themes/sfwkorg/img/default_portrait.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/examples/wiki/view/userList_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userList_d.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
+++ trunk/examples/wiki/view/userList_d.xhtml 2008-07-01 11:53:31 UTC (rev 8431)
@@ -31,7 +31,21 @@
<ui:define name="content">
<s:div styleClass="box" style="margin-top:10px;">
- <ui:include src="includes/onlineMembers.xhtml"/>
+ <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0"
+ styleClass="datatable topLeftBottomBorder rightBorder"
+ headerClass="regularHeader smallFont"
+ columnClasses="alignCenter alignBottom">
+
+ <f:facet name="header">
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}
+ #{messages['lacewiki.label.userList.InTheLast']}
+ #{wikiInit.authenticatedSessionTimeoutMinutes}
+ #{messages['lacewiki.label.userList.Minutes']}"/>
+ </f:facet>
+
+ <ui:include src="includes/onlineMembers.xhtml"/>
+
+ </h:panelGrid>
</s:div>
<script type="text/javascript">jQuery(function() {
16 years, 7 months
Seam SVN: r8430 - in trunk/examples/wiki: src/etc/i18n and 18 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-07-01 06:02:54 -0400 (Tue, 01 Jul 2008)
New Revision: 8430
Added:
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumTopicsPreferences.java
trunk/examples/wiki/view/includes/onlineMembers.xhtml
Removed:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/blosxom/
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/AbstractImporter.java
Modified:
trunk/examples/wiki/src/etc/META-INF/seam-deployment.properties
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/UploadTypes.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/ZipImporter.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/Importer.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/ImporterRegistry.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/view/docDisplay_d.xhtml
trunk/examples/wiki/view/includes/onlineUsers.xhtml
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/uploadEdit_d.xhtml
trunk/examples/wiki/view/userList_d.xhtml
Log:
New wiki features: Upload Importers, Online Members with portrait, Mailinglist per Forum
Modified: trunk/examples/wiki/src/etc/META-INF/seam-deployment.properties
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/seam-deployment.properties 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/etc/META-INF/seam-deployment.properties 2008-07-01 10:02:54 UTC (rev 8430)
@@ -1,2 +1,2 @@
-org.jboss.seam.deployment.annotationTypes=org.jboss.seam.wiki.preferences.annotations.Preferences:org.jboss.seam.wiki.core.template.WikiDocumentTemplate
+org.jboss.seam.deployment.annotationTypes=org.jboss.seam.wiki.preferences.annotations.Preferences:org.jboss.seam.wiki.core.template.WikiDocumentTemplate:org.jboss.seam.wiki.core.upload.importers.annotations.UploadImporter
org.jboss.seam.deployment.deploymentHandlers=org.jboss.seam.wiki.core.plugin.binding.lacewiki.PluginDeploymentHandler:org.jboss.seam.wiki.core.plugin.binding.lacewiki.PluginI18NDeploymentHandler
\ No newline at end of file
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
@@ -465,7 +465,15 @@
lacewiki.label.userList.View=View
lacewiki.label.userList.Edit=Edit
lacewiki.label.userList.NotAvailableForSkin=User search is not available with this skin.
+lacewiki.label.userList.OnlineMembers=Online Members
+lacewiki.label.userList.Online=Online
+lacewiki.label.userList.Of=of
+lacewiki.label.userList.Member=Member
+lacewiki.label.userList.Members=Members
+lacewiki.label.userList.Guest=Guest
+lacewiki.label.userList.Guests=Guests
+
# User Profile
lacewiki.label.userProfile.UserProfile=User Profile
@@ -506,7 +514,8 @@
lacewiki.label.uploadEdit.CreatedOn=Created on
lacewiki.label.uploadEdit.Name=Name
lacewiki.label.uploadEdit.FileDetails=File Details
-lacewiki.label.uploadEdit.Converters=Converters
+lacewiki.label.uploadEdit.Importers=Importers
+lacewiki.label.uploadEdit.ImportNoSelection=Select an importer to convert the file
lacewiki.label.uploadEdit.OriginalImageSize=Original Image Size
lacewiki.label.uploadEdit.Pixel=px
lacewiki.label.uploadEdit.ImagePreview=Image Preview
@@ -528,6 +537,7 @@
lacewiki.button.uploadEdit.Delete=<u>D</u>elete
lacewiki.button.uploadEdit.Delete.accesskey=D
lacewiki.msg.uploadEdit.UpdateUpload=File {0} has been uploaded.
+lacewiki.button.uploadEdit.Import=Import
# Document Edit
@@ -687,10 +697,6 @@
lacewiki.msg.MemberHomedirectoryNotFound=Could not find member area with name {0} - your configuration is broken, please change it.
lacewiki.msg.TrashAreaNotFound=Could not find trash area with name {0} - your configuration is broken, please change it.
lacewiki.msg.HelpAreaNotFound=Could not find help area with name {0} - your configuration is broken, please change it.
-lacewiki.msg.ImportSkippingDirectory=Skipping directory '{0}', importing not supported...
-lacewiki.msg.ImportDuplicateName=Skipping file '{0}', name is already used in this area...
-lacewiki.msg.ImportInvalidNode=Skipping entry '{0}', invalid: {1}
-lacewiki.msg.ImportOk=Created file '{0}' in current directory.
lacewiki.msg.OptimisticLockError=Someone modified the same record while you were editing it. Your workspace has been closed.
lacewiki.msg.AccessDenied=Access Denied
lacewiki.msg.FatalError=Request failed, please check the application log or contact the administrator
@@ -748,3 +754,12 @@
# Templates
lacewiki.label.template.RegularWikiDocument=Regular Document
+
+
+# Importers
+
+lacewiki.msg.ImportSkippingDirectory=Skipping directory '{0}', importing not supported...
+lacewiki.msg.ImportDuplicateName=Skipping file '{0}', name is already used in this area...
+lacewiki.msg.ImportInvalidNode=Skipping entry '{0}', invalid: {1}
+lacewiki.msg.ImportOk=Created file '{0}' in current directory.
+lacewiki.label.ZipImporter=Extract archive as individual files
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/admin/WikiHttpSessionManager.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -9,15 +9,14 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.wiki.core.model.User;
import org.jboss.seam.wiki.core.model.Role;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.annotations.*;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
import javax.servlet.http.HttpSession;
+import javax.persistence.EntityManager;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@@ -31,12 +30,16 @@
@AutoCreate
public class WikiHttpSessionManager implements Serializable {
- protected static final String SESSION_ATTR_IDENTITY = "org.jboss.seam.security.identity";
- protected static final String SESSION_ATTR_ACCESSLVL = "currentAccessLevel";
+ protected static final String SESSION_ATTR_IDENTITY = "org.jboss.seam.security.identity";
+ protected static final String SESSION_ATTR_ACCESSLVL = "currentAccessLevel";
+ protected static final String SESSION_ATTR_USER = "currentUser";
@Logger
private Log log;
+ @In
+ UserDAO userDAO;
+
transient private Map<String, Boolean> selectedSessions = new HashMap<String,Boolean>();
transient private Map<String, Long> sessionsSize = new HashMap<String,Long>();
@@ -145,6 +148,24 @@
}
*/
+ public List<User> getOnlineMembers() {
+ Set<String> onlineUsernames = new HashSet<String>();
+ Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
+ for (HttpSession session : sessions) {
+ Integer userLevel = (Integer)session.getAttribute(SESSION_ATTR_ACCESSLVL);
+ if (userLevel != null && userLevel > Role.GUESTROLE_ACCESSLEVEL) {
+ onlineUsernames.add( ((User)session.getAttribute(SESSION_ATTR_USER)).getUsername() );
+ }
+ }
+
+ // Need to load these guys, the are not in this persistence context
+ return userDAO.findUsersWithUsername(onlineUsernames);
+ }
+
+ public long getTotalMembers() {
+ return userDAO.findTotalNoOfUsers();
+ }
+
public long getNumberOfOnlineMembers() {
Collection<HttpSession> sessions = WikiServletListener.getSessions().values();
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -197,8 +197,12 @@
@Observer("org.jboss.seam.security.loggedOut")
public void resetSessionTime() {
- int regularSessionTimeout = (Integer) Contexts.getSessionContext().get(REGULAR_SESSION_MAX_INACTIVE_SECONDS);
- log.debug("resetting timeout of user session after logout to minutes: " + regularSessionTimeout/60);
- ServletContexts.getInstance().getRequest().getSession().setMaxInactiveInterval(regularSessionTimeout);
+ // Don't rely on that, do a null check
+ Object o = Contexts.getSessionContext().get(REGULAR_SESSION_MAX_INACTIVE_SECONDS);
+ if (o != null) {
+ int regularSessionTimeout = (Integer) o;
+ log.debug("resetting timeout of user session after logout to minutes: " + regularSessionTimeout/60);
+ ServletContexts.getInstance().getRequest().getSession().setMaxInactiveInterval(regularSessionTimeout);
+ }
}
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -85,6 +85,11 @@
return dir;
}
+ @Override
+ protected boolean requiresMessageId() {
+ return false;
+ }
+
/* -------------------------- Custom CUD ------------------------------ */
@Override
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -245,6 +245,19 @@
Events.instance().raiseEvent("PreferenceEditor.flushAll");
Events.instance().raiseEvent("Node.persisted", getInstance());
}
+
+ // Now set the message identifier, if nobody else did
+ if (getInstance().getMessageId() == null && requiresMessageId()) {
+ getInstance().setMessageId(
+ // Use the identifier and the creation time, both quite unique and immutable
+ WikiUtil.calculateMessageId(
+ getInstance().getId(),
+ String.valueOf(getInstance().getCreatedOn().getTime()))
+ );
+ // Need to flush again, to execute UPDATE
+ getEntityManager().flush();
+ }
+
return outcome;
}
@@ -432,6 +445,10 @@
return null;
}
+ protected boolean requiresMessageId() {
+ return true;
+ }
+
/* -------------------------- Optional Subclass Callbacks ------------------------------ */
protected boolean isPageRootController() { return true; }
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -12,12 +12,16 @@
import org.jboss.seam.wiki.core.upload.UploadType;
import org.jboss.seam.wiki.core.upload.UploadTypes;
import org.jboss.seam.wiki.core.upload.Uploader;
+import org.jboss.seam.wiki.core.upload.importers.metamodel.ImporterRegistry;
+import org.jboss.seam.wiki.core.upload.importers.metamodel.Importer;
import org.jboss.seam.wiki.core.upload.editor.UploadEditor;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
import java.util.Date;
import java.util.Map;
+import java.util.List;
+import java.util.Collections;
@Name("uploadHome")
@Scope(ScopeType.CONVERSATION)
@@ -36,9 +40,13 @@
@In
private TagEditor tagEditor;
+ @In
+ ImporterRegistry importerRegistry;
+
/* -------------------------- Internal State ------------------------------ */
protected UploadEditor uploadEditor;
+ protected String importer;
/* -------------------------- Basic Overrides ------------------------------ */
@@ -197,4 +205,27 @@
public TagEditor getTagEditor() {
return tagEditor;
}
+
+ public List<String> getAvailableImporters() {
+ if (getInstance().getContentType() == null) return Collections.EMPTY_LIST;
+ return importerRegistry.getAvailableImporters(getInstance().getContentType(), getInstance().getExtension());
+ }
+
+ public String getImporter() {
+ return importer;
+ }
+
+ public void setImporter(String importer) {
+ this.importer = importer;
+ }
+
+ public void importInstance() {
+ if (importer == null) return;
+
+ getLog().debug("importing with importer: " + importer);
+ Importer imp = (Importer)Component.getInstance(importer);
+ imp.handleImport(getEntityManager(), getInstance());
+ getEntityManager().flush();
+
+ }
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserDAO.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -3,6 +3,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.NoResultException;
+import javax.persistence.Query;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -18,6 +19,8 @@
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
@Name("userDAO")
@AutoCreate
@@ -49,6 +52,38 @@
return null;
}
+ public long findTotalNoOfUsers() {
+ Query q =
+ entityManager.createQuery(
+ "select count(u) from User u where not u.username = :guestUsername and not u.username = :adminUsername"
+ );
+ q.setParameter("guestUsername", User.GUEST_USERNAME);
+ q.setParameter("adminUsername", User.ADMIN_USERNAME);
+ q.setHint("org.hibernate.comment", "Find number of members");
+ q.setHint("org.hibernate.cacheable", true);
+ return (Long)q.getSingleResult();
+ }
+
+ public List<User> findUsersWithUsername(Collection<String> usernames) {
+ // We need to batch this because we use an in() expression
+ int batchsize = 50;
+ int i = 0;
+ List<String> usernamesToQuery = new ArrayList<String>(batchsize);
+ List<User> users = new ArrayList<User>();
+ for (String username : usernames) {
+ usernamesToQuery.add(username);
+ i++;
+ if (i % batchsize == 0 || usernames.size() < batchsize) {
+ // Query and clear
+ Query q = entityManager.createQuery("select u from User u left join fetch u.profile where u.username in(:usernames)");
+ q.setParameter("usernames", usernamesToQuery);
+ users.addAll(q.getResultList());
+ usernamesToQuery.clear();
+ }
+ }
+ return users;
+ }
+
public User findUserWithActivationCode(String activationCode) {
StringBuilder query = new StringBuilder("select u from User u where u.activationCode = :activationCode");
try {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -116,7 +116,7 @@
public String[] getPropertiesForGroupingInQueries() {
return new String[]{
"version", "parent", "rating",
- "areaNumber", "name", "wikiname", "createdBy", "createdOn",
+ "areaNumber", "name", "wikiname", "createdBy", "createdOn", "messageId",
"lastModifiedBy", "lastModifiedOn", "readAccessLevel", "writeAccessLevel", "writeProtected",
"subject", "fromUserName", "fromUserEmail", "fromUserHomepage", "useWikiText",
};
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -86,7 +86,7 @@
public String[] getPropertiesForGroupingInQueries() {
return new String[]{
"version", "parent", "rating",
- "areaNumber", "name", "wikiname", "createdBy", "createdOn",
+ "areaNumber", "name", "wikiname", "createdBy", "createdOn", "messageId",
"lastModifiedBy", "lastModifiedOn", "readAccessLevel", "writeAccessLevel", "writeProtected",
"defaultFile", "description"
};
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -322,7 +322,7 @@
public static String[] getPropertiesForGroupingInQueries() {
return new String[]{
"id", "version", "parent", "rating",
- "areaNumber", "name", "wikiname", "createdBy", "createdOn",
+ "areaNumber", "name", "wikiname", "createdBy", "createdOn", "messageId",
"lastModifiedBy", "lastModifiedOn", "readAccessLevel", "writeAccessLevel", "writeProtected",
"nameAsTitle", "enableComments", "enableCommentForm", "enableCommentsOnFeeds",
"header", "headerMacrosString", "contentMacrosString", "footer", "footerMacrosString"
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -58,6 +58,9 @@
)
protected String wikiname;
+ @Column(name = "MESSAGE_ID", length = 1023, nullable = true)
+ protected String messageId;
+
@Column(name = "CREATED_ON", nullable = false, updatable = false)
@org.hibernate.search.annotations.Field(
index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
@@ -133,6 +136,9 @@
public String getWikiname() { return wikiname; }
public void setWikiname(String wikiname) { this.wikiname = wikiname; }
+ public String getMessageId() { return messageId; }
+ public void setMessageId(String messageId) { this.messageId = messageId; }
+
public Date getCreatedOn() { return createdOn; }
public void setCreatedOn(Date createdOn) { this.createdOn = createdOn; }
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -15,9 +15,10 @@
private int sizeY;
@Column(name = "THUMBNAIL")
- private char thumbnail = 'A'; // Disable embedding by default, attach
+ private char thumbnail = 'M'; // Medium size thumbnail by default, not attached
- // SchemaExport needs length.. MySQL has "tinyblob", "mediumblob" and other such nonsense types
+ // TODO: SchemaExport needs length.. MySQL has "tinyblob", "mediumblob" and other such nonsense types, this
+ // is a best-guess value
@Lob
@Column(name = "THUMBNAIL_DATA", length = 1000000, nullable = true)
@Basic(fetch = FetchType.LAZY) // Lazy loaded through bytecode instrumentation
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -13,8 +13,6 @@
import org.jboss.seam.wiki.core.model.Role;
import org.jboss.seam.wiki.core.search.metamodel.SearchRegistry;
import org.jboss.seam.wiki.core.search.metamodel.SearchableEntity;
-import org.jboss.seam.wiki.core.upload.importers.metamodel.Importer;
-import org.jboss.seam.wiki.core.upload.importers.metamodel.ImporterRegistry;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -32,27 +30,6 @@
return new String[]{"NULL","January","February","March","April","May","June","July","August","September","October","November","December"};
}
- @Name("importerConverter")
- @org.jboss.seam.annotations.faces.Converter(forClass = Importer.class)
- public static class ImporterConverter implements Converter, Serializable {
-
- public Object getAsObject(FacesContext arg0,
- UIComponent arg1,
- String arg2) throws ConverterException {
- if (arg2 == null) return null;
- ImporterRegistry importerRegistry = (ImporterRegistry)Component.getInstance("importerRegistry");
- return importerRegistry.getImportersByName().get(arg2);
- }
-
- public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException {
- if (arg2 instanceof Importer) {
- return ((Importer)arg2).getComponentName();
- } else {
- return null;
- }
- }
- }
-
@Name("searchableEntityConverter")
@org.jboss.seam.annotations.faces.Converter(forClass = SearchableEntity.class)
public static class SearchableEntityConverter implements Converter, Serializable {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/UploadTypes.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/UploadTypes.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/UploadTypes.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -24,6 +24,7 @@
public class UploadTypes {
public static final String GENERIC_UPLOAD_TYPE = "generic";
+ public static final String DEFAULT_UPLOAD_TYPE = "application/octet-stream";
private Map<String, UploadType> uploadTypes = new HashMap<String, UploadType>() {
{
@@ -33,7 +34,7 @@
put("image/gif", new UploadType("icon.fileimg.gif", new WikiUploadHandler() ));
put("text/plain", new UploadType("icon.filetxt.gif", new WikiUploadHandler() ));
put("application/pdf", new UploadType("icon.filepdf.gif", new WikiUploadHandler() ));
- put("application/octet-stream", new UploadType("icon.filegeneric.gif", new WikiUploadHandler() ));
+ put(DEFAULT_UPLOAD_TYPE, new UploadType("icon.filegeneric.gif", new WikiUploadHandler() ));
put(GENERIC_UPLOAD_TYPE, new UploadType("icon.filegeneric.gif", new WikiUploadHandler() ));
}
};
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/ZipImporter.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/ZipImporter.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/ZipImporter.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -1,40 +1,43 @@
package org.jboss.seam.wiki.core.upload.importers;
+import net.sf.jmimemagic.Magic;
+import org.hibernate.validator.ClassValidator;
+import org.hibernate.validator.InvalidValue;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.core.Validators;
+import static org.jboss.seam.international.StatusMessage.Severity.ERROR;
+import static org.jboss.seam.international.StatusMessage.Severity.INFO;
+import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.log.Log;
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
-import org.jboss.seam.wiki.core.upload.importers.annotations.UploadImporter;
-import org.jboss.seam.wiki.core.upload.importers.metamodel.AbstractImporter;
-import org.jboss.seam.wiki.core.upload.UploadType;
-import org.jboss.seam.wiki.core.model.WikiUpload;
import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.WikiUpload;
+import org.jboss.seam.wiki.core.upload.UploadType;
+import org.jboss.seam.wiki.core.upload.UploadTypes;
+import org.jboss.seam.wiki.core.upload.Uploader;
+import org.jboss.seam.wiki.core.upload.importers.annotations.UploadImporter;
+import org.jboss.seam.wiki.core.upload.importers.metamodel.Importer;
import org.jboss.seam.wiki.util.WikiUtil;
-import org.jboss.seam.core.Validators;
-import org.hibernate.validator.InvalidValue;
-import org.hibernate.validator.ClassValidator;
-import static org.jboss.seam.international.StatusMessage.Severity.ERROR;
-import static org.jboss.seam.international.StatusMessage.Severity.INFO;
-
import javax.persistence.EntityManager;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.BufferedInputStream;
-import net.sf.jmimemagic.Magic;
-
@Name("zipImporter")
@UploadImporter(
handledMimeTypes = {"application/zip", "application/java-archive"},
handledExtensions = {"zip", "jar"},
- description = "Extract archive as individual files"
+ description = "lacewiki.label.ZipImporter"
)
-public class ZipImporter extends AbstractImporter {
+@AutoCreate
+public class ZipImporter implements Importer {
@Logger
Log log;
@@ -45,6 +48,9 @@
@In
protected Map<String, UploadType> uploadTypes;
+ @In
+ protected StatusMessages statusMessages;
+
public boolean handleImport(EntityManager em, WikiUpload zipFile) {
if (zipFile.getData().length == 0) return true;
@@ -67,10 +73,8 @@
while ((ze = zipInputStream.getNextEntry()) != null) {
log.debug("extracting zip entry: " + ze.getName());
- if (ze.getName().contains("/") && !handleDirectory(em, zipFile, ze)) continue;
+ if (!beforeUncompress(em, zipFile, ze)) continue;
- if (!continueUncompressing(em, zipFile, ze)) continue;
-
baos = new ByteArrayOutputStream();
while ((bytesRead = zipInputStream.read(buffer, 0, bufferSize)) > 0) {
baos.write(buffer, 0, bytesRead);
@@ -97,35 +101,29 @@
}
}
- // By default append them to the
- persistNewNodesSorted(
- em,
- zipFile,
- newObjects,
- new Comparator() {
- public int compare(Object o, Object o1) {
- if ( !(o instanceof WikiNode) && !(o1 instanceof WikiNode) ) return 0;
- return ((WikiNode)o).getWikiname().compareTo( ((WikiNode)o1).getWikiname() );
- }
- }
- );
+ handleNewObjects(em, zipFile, newObjects);
return true;
}
- protected boolean handleDirectory(EntityManager em, WikiUpload zipFile, ZipEntry zipEntry) {
- log.debug("skipping directory: " + zipEntry.getName());
- getStatusMessages().addFromResourceBundleOrDefault(
- ERROR,
- "lacewiki.msg.ImportSkippingDirectory",
- "Skipping directory '{0}', importing not supported...",
- zipEntry.getName()
- );
- return false; // Not supported
- }
+ protected boolean beforeUncompress(EntityManager em, WikiUpload zipFile, ZipEntry zipEntry) {
- protected boolean continueUncompressing(EntityManager em, WikiUpload zipFile, ZipEntry zipEntry) {
- return validateNewWikiname(zipFile, WikiUtil.convertToWikiName(zipEntry.getName()));
+ if (zipEntry.getName().contains("/")) {
+ log.debug("skipping directory: " + zipEntry.getName());
+ statusMessages.addFromResourceBundleOrDefault(
+ ERROR,
+ "lacewiki.msg.ImportSkippingDirectory",
+ "Skipping directory '{0}', importing not supported...",
+ zipEntry.getName()
+ );
+ return false; // Not supported
+ }
+
+ // This assumes that the wiki name is the zip entry filename without extension - maybe we should
+ // support with extension as option, that's unique inside a zip archive so we fail too often
+ WikiUpload tmp = new WikiUpload();
+ tmp.setFilename(zipEntry.getName());
+ return validateNewWikiname(zipFile, WikiUtil.convertToWikiName(tmp.getFilenameWithoutExtension()));
}
protected boolean validateNewWikiname(WikiUpload zipFile, String newWikiname) {
@@ -136,7 +134,7 @@
return true;
} else {
log.debug("new name is not unique and invalid");
- getStatusMessages().addFromResourceBundleOrDefault(
+ statusMessages.addFromResourceBundleOrDefault(
ERROR,
"lacewiki.msg.ImportDuplicateName",
"Skipping file '{0}', name is already used in this area...",
@@ -149,51 +147,56 @@
protected Object createNewObject(EntityManager em, WikiUpload zipFile, ZipEntry zipEntry, byte[] uncompressedBytes) {
log.debug("creating new file from zip entry: " + zipEntry.getName());
- WikiUpload wikiUpload = new WikiUpload();
- wikiUpload.setFilename(zipEntry.getName());
- wikiUpload.setName(zipEntry.getName());
- wikiUpload.setWikiname(WikiUtil.convertToWikiName(wikiUpload.getName()));
+ // First figure out what it is
+ String mimeType = null;
+ try {
+ mimeType = Magic.getMagicMatch(uncompressedBytes).getMimeType();
+ } catch (Exception ex) {}
+ String contentType = mimeType != null ? mimeType : UploadTypes.DEFAULT_UPLOAD_TYPE;
+ // Just a temporary value holder this time
+ Uploader uploader = new Uploader();
+ uploader.setData(uncompressedBytes);
+ uploader.setFilename(zipEntry.getName());
+ uploader.setContentType(contentType);
+
+ // Get the right handler for that type and produce a WikiUpload instance
+ UploadType uploadType = uploadTypes.get(contentType);
+ if (uploadType == null) uploadType = uploadTypes.get(UploadTypes.GENERIC_UPLOAD_TYPE);
+ WikiUpload wikiUpload = uploadType.getUploadHandler().handleUpload(uploader);
+
+ // Now set the other properties so we can persist it directly
+ wikiUpload.setName(wikiUpload.getFilenameWithoutExtension());
+ wikiUpload.setWikiname(WikiUtil.convertToWikiName(wikiUpload.getName()));
wikiUpload.setAreaNumber(zipFile.getAreaNumber());
wikiUpload.setCreatedBy(zipFile.getCreatedBy());
wikiUpload.setLastModifiedBy(wikiUpload.getCreatedBy());
wikiUpload.setCreatedOn(new Date(zipEntry.getTime()));
- wikiUpload.setLastModifiedOn(new Date());
+ wikiUpload.setLastModifiedOn(wikiUpload.getCreatedOn());
wikiUpload.setReadAccessLevel(zipFile.getReadAccessLevel());
wikiUpload.setWriteAccessLevel(zipFile.getWriteAccessLevel());
- log.debug("detecting mime type of zip entry: " + zipEntry.getName());
- String mimeType;
- try {
- mimeType = Magic.getMagicMatch(uncompressedBytes).getMimeType();
- log.debug("mime type of zip entry is: " + mimeType);
- } catch (Exception ex) {
- log.debug("could not detect mime type, defaulting to binary");
- mimeType = "application/octet-stream";
- }
- wikiUpload.setContentType(mimeType);
- wikiUpload.setData(uncompressedBytes);
- wikiUpload.setFilesize(uncompressedBytes.length);
+ log.debug("created new file from zip entry: " + wikiUpload);
- // TODO: Make this generic, duplicated here and in uploadHome
- /* TODO: fixme
- if (fileMetaMap.get(wikiUpload.getContentType()) != null &&
- fileMetaMap.get(wikiUpload.getContentType()).image) {
- throw new RuntimeException("TODO: Images not supported");
- wikiUpload.setImageMetaInfo(new ImageMetaInfo());
- ImageIcon icon = new ImageIcon(wikiUpload.getData());
- int imageSizeX = icon.getImage().getWidth(null);
- int imageSizeY = icon.getImage().getHeight(null);
- wikiUpload.getImageMetaInfo().setSizeX(imageSizeX);
- wikiUpload.getImageMetaInfo().setSizeY(imageSizeY);
- }
- */
-
return wikiUpload;
}
- protected void persistNewNodesSorted(EntityManager em, WikiUpload zipFile, Map<String, Object> newObjects, Comparator comparator) {
+ public void handleNewObjects(EntityManager em, WikiUpload zipFile, Map<String, Object> newObjects) {
+ persistWikiUploadsSorted(
+ em,
+ zipFile,
+ newObjects,
+ new Comparator() {
+ public int compare(Object o, Object o1) {
+ if ( !(o instanceof WikiNode) && !(o1 instanceof WikiNode) ) return 0;
+ return ((WikiNode)o).getWikiname().compareTo( ((WikiNode)o1).getWikiname() );
+ }
+ }
+ );
+ }
+ private void persistWikiUploadsSorted(EntityManager em, WikiUpload zipFile, Map<String, Object> newObjects, Comparator comparator) {
+
List<WikiNode> newNodes = new ArrayList<WikiNode>();
for (Object newObject : newObjects.values()) {
if (newObject instanceof WikiNode) {
@@ -202,7 +205,6 @@
}
Collections.sort(newNodes, comparator);
- int i = 0;
for (WikiNode newNode : newNodes) {
log.debug("validating new node");
@@ -211,7 +213,7 @@
if (invalidValues != null && invalidValues.length > 0) {
log.debug("new node is invalid: " + newNode);
for (InvalidValue invalidValue : invalidValues) {
- getStatusMessages().addFromResourceBundleOrDefault(
+ statusMessages.addFromResourceBundleOrDefault(
ERROR,
"lacewiki.msg.ImportInvalidNode",
"Skipping entry '{0}', invalid: {1}",
@@ -226,19 +228,12 @@
log.debug("persisting newly imported node: " + newNode);
newNode.setParent(zipFile.getParent());
em.persist(newNode);
- getStatusMessages().addFromResourceBundleOrDefault(
+ statusMessages.addFromResourceBundleOrDefault(
INFO,
"lacewiki.msg.ImportOk",
"Created file '{0}' in current directory.",
newNode.getName()
);
-
- // Batch the work (we can't clear because of nested set updates, unfortunately)
- i++;
- if (i==100) {
- em.flush();
- i = 0;
- }
}
}
Deleted: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/AbstractImporter.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/AbstractImporter.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/AbstractImporter.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -1,26 +0,0 @@
-package org.jboss.seam.wiki.core.upload.importers.metamodel;
-
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.wiki.core.model.WikiUpload;
-
-import javax.persistence.EntityManager;
-import java.util.Set;
-
-(a)Scope(ScopeType.APPLICATION)
-public abstract class AbstractImporter {
-
- @Observer("Importers.addImporter")
- public void add(Set<AbstractImporter> importerComponents) {
- importerComponents.add(this);
- }
-
- protected StatusMessages getStatusMessages() {
- return StatusMessages.instance();
- }
-
- public abstract boolean handleImport(EntityManager em, WikiUpload file);
-
-}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/Importer.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/Importer.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/Importer.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -1,51 +1,11 @@
package org.jboss.seam.wiki.core.upload.importers.metamodel;
-import org.jboss.seam.wiki.core.upload.importers.annotations.UploadImporter;
-import org.jboss.seam.annotations.Name;
+import org.jboss.seam.wiki.core.model.WikiUpload;
-public class Importer implements Comparable {
+import javax.persistence.EntityManager;
- private Class clazz;
- private String componentName;
- private String[] handledMimeTypes;
- private String[] handledExtensions;
- private String description;
+public interface Importer {
- public Importer(Class<?> clazz) {
- this.clazz = clazz;
+ public boolean handleImport(EntityManager entityManager, WikiUpload file);
- this.componentName = clazz.getAnnotation(Name.class).value();
- this.handledMimeTypes = clazz.getAnnotation(UploadImporter.class).handledMimeTypes();
- this.handledExtensions = clazz.getAnnotation(UploadImporter.class).handledExtensions();
- this.description = clazz.getAnnotation(UploadImporter.class).description();
- }
-
- public Class getClazz() {
- return clazz;
- }
-
- public String getComponentName() {
- return componentName;
- }
-
- public String[] getHandledMimeTypes() {
- return handledMimeTypes;
- }
-
- public String[] getHandledExtensions() {
- return handledExtensions;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String toString() {
- return "importer class: " + getClazz().getName();
- }
-
- public int compareTo(Object o) {
- Importer other = (Importer)o;
- return this.getDescription().compareTo(other.getDescription());
- }
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/ImporterRegistry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/ImporterRegistry.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/importers/metamodel/ImporterRegistry.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -1,74 +1,62 @@
package org.jboss.seam.wiki.core.upload.importers.metamodel;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
import org.jboss.seam.wiki.core.upload.importers.annotations.UploadImporter;
-import org.jboss.seam.core.Events;
-import org.jboss.seam.log.Log;
+import org.jboss.seam.wiki.util.AnnotationDeploymentHelper;
import java.util.*;
@Name("importerRegistry")
@Scope(ScopeType.APPLICATION)
+@Startup
+@BypassInterceptors
+
public class ImporterRegistry {
- @Logger
- static Log log;
+ private static final LogProvider log = Logging.getLogProvider(ImporterRegistry.class);
- Map<String, Importer> importersByName = new HashMap<String, Importer>();
- List<Importer> importers = new ArrayList<Importer>();
+ SortedMap<String, UploadImporter> importerComponents = new TreeMap<String, UploadImporter>();
- // TODO: Fix importers
- //@Observer("Wiki.startup")
- public void scanForFileImporters() {
+ @Create
+ public void startup() {
- log.debug("initializing file importer registry");
- importers.clear();
- importersByName.clear();
+ log.debug("initializing upload importer registry");
- // Fire an event and let all listeners add themself into the given collection
- Set<AbstractImporter> importerComponents = new HashSet<AbstractImporter>();
- Events.instance().raiseEvent("Importers.addImporter", importerComponents);
+ Set<Class<Object>> importerClasses = AnnotationDeploymentHelper.getAnnotatedClasses(UploadImporter.class);
+ if (importerClasses == null) return;
- log.debug("found file importer components: " + importerComponents.size());
+ for (Class<?> importerClass : importerClasses) {
- for (AbstractImporter importerComponent : importerComponents) {
- if (importerComponent.getClass().isAnnotationPresent(UploadImporter.class)) {
- Importer importer = new Importer(importerComponent.getClass());
- importers.add(importer);
- importersByName.put(importer.getComponentName(), importer);
- }
+ importerComponents.put(
+ importerClass.getAnnotation(Name.class).value(),
+ importerClass.getAnnotation(UploadImporter.class)
+ );
+ log.debug("added upload importer to registry: " + importerClass.getAnnotation(Name.class).value());
}
- log.debug("added file importers to registry: " + importers.size());
-
- // Sort entities
- Collections.sort(importers);
-
- if (log.isTraceEnabled()) {
- for (Importer importer : importers) {
- log.trace(importer);
- }
- }
}
- public Map<String, Importer> getImportersByName() {
- return importersByName;
+ public SortedMap<String, UploadImporter> getImporterComponents() {
+ return importerComponents;
}
- public List<Importer> getImporters() {
- return importers;
+ public List<String> getImporterComponentNames() {
+ return new ArrayList(importerComponents.keySet());
}
- public List<Importer> getAvailableImporters(String mimeType, String extension) {
- List<Importer> availableImporters = new ArrayList<Importer>();
- for (Importer importer : importers) {
- List<String> supportedMimeTypes = Arrays.asList(importer.getHandledMimeTypes());
- List<String> supportedExtensions = Arrays.asList(importer.getHandledExtensions());
+ public List<String> getAvailableImporters(String mimeType, String extension) {
+ List<String> availableImporters = new ArrayList<String>();
+ for (Map.Entry<String, UploadImporter> importerEntry : importerComponents.entrySet()) {
+ List<String> supportedMimeTypes = Arrays.asList(importerEntry.getValue().handledMimeTypes());
+ List<String> supportedExtensions = Arrays.asList(importerEntry.getValue().handledExtensions());
if (supportedMimeTypes.contains(mimeType) && supportedExtensions.contains(extension) ) {
- availableImporters.add(importer);
+ availableImporters.add(importerEntry.getKey());
}
}
return availableImporters;
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -50,7 +50,7 @@
private String[] getWikiDocumentSQLColumnNames() {
return new String[]{
"doc2.NODE_ID",
- "doc2.OBJ_VERSION", "doc2.PARENT_NODE_ID", "doc2.RATING",
+ "doc2.OBJ_VERSION", "doc2.PARENT_NODE_ID", "doc2.RATING", "doc2.MESSAGE_ID",
"doc2.AREA_NR", "doc2.NAME", "doc2.WIKINAME", "doc2.CREATED_BY_USER_ID", "doc2.CREATED_ON", "doc2.WRITE_PROTECTED",
"doc2.LAST_MODIFIED_BY_USER_ID", "doc2.LAST_MODIFIED_ON", "doc2.READ_ACCESS_LEVEL", "doc2.WRITE_ACCESS_LEVEL",
"doc1.FILE_REVISION",
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -93,6 +93,7 @@
c1.AREA_NR as AREA_NR,
c1.NAME as NAME,
c1.WIKINAME as WIKINAME,
+ c1.MESSAGE_ID as MESSAGE_ID,
c1.CREATED_ON as CREATED_ON,
c1.CREATED_BY_USER_ID as CREATED_BY_USER_ID,
c1.LAST_MODIFIED_ON as LAST_MODIFIED_ON,
@@ -231,6 +232,7 @@
doc2.AREA_NR as AREA_NR,
doc2.NAME as NAME,
doc2.WIKINAME as WIKINAME,
+ doc2.MESSAGE_ID as MESSAGE_ID,
doc2.CREATED_ON as CREATED_ON,
doc2.CREATED_BY_USER_ID as CREATED_BY_USER_ID,
doc2.LAST_MODIFIED_ON as LAST_MODIFIED_ON,
@@ -288,6 +290,7 @@
cl1.AREA_NR as AREA_NR,
cl1.NAME as NAME,
cl1.WIKINAME as WIKINAME,
+ cl1.MESSAGE_ID as MESSAGE_ID,
cl1.CREATED_ON as CREATED_ON,
cl1.CREATED_BY_USER_ID as CREATED_BY_USER_ID,
cl1.LAST_MODIFIED_ON as LAST_MODIFIED_ON,
@@ -337,7 +340,7 @@
limit 1
)
group by
- cl1.OBJ_VERSION, cl1.RATING, cl1.AREA_NR, cl1.NAME, cl1.WIKINAME, cl1.CREATED_ON, cl1.CREATED_BY_USER_ID, cl1.LAST_MODIFIED_ON,
+ cl1.OBJ_VERSION, cl1.RATING, cl1.AREA_NR, cl1.NAME, cl1.WIKINAME, cl1.MESSAGE_ID, cl1.CREATED_ON, cl1.CREATED_BY_USER_ID, cl1.LAST_MODIFIED_ON,
cl1.LAST_MODIFIED_BY_USER_ID, cl1.WRITE_ACCESS_LEVEL, cl1.READ_ACCESS_LEVEL, cl1.WRITE_PROTECTED, cl1.PARENT_NODE_ID,
cl0.SUBJECT, cl0.FROM_USER_NAME, cl0.FROM_USER_EMAIL, cl0.FROM_USER_HOMEPAGE, cl0.USE_WIKI_TEXT, cl0.NS_LEFT, cl0.NS_RIGHT, cl0.NS_THREAD,
Added: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumTopicsPreferences.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumTopicsPreferences.java (rev 0)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumTopicsPreferences.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.plugin.forum;
+
+import org.jboss.seam.wiki.preferences.annotations.Preferences;
+import org.jboss.seam.wiki.preferences.annotations.PreferenceProperty;
+import org.jboss.seam.wiki.preferences.PreferenceVisibility;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Email;
+
+/**
+ * @author Christian Bauer
+ */
+@Preferences(
+ name = "ForumTopics",
+ description = "#{messages['forum.topics.preferences.description']}",
+ mappedTo = "forum.topics"
+)
+public class ForumTopicsPreferences {
+
+ @PreferenceProperty(
+ description = "#{messages['forum.topics.preferences.property.mailingList']}",
+ visibility = {PreferenceVisibility.INSTANCE},
+ editorIncludeName = "AdaptiveTextInput"
+ )
+ @Length(min = 4, max = 255)
+ @Email
+ private String mailingList;
+
+ public String getMailingList() {
+ return mailingList;
+ }
+}
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-07-01 10:02:54 UTC (rev 8430)
@@ -11,20 +11,18 @@
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
-import org.jboss.seam.wiki.core.model.WikiFile;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.preferences.Preferences;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
-import org.hibernate.validator.InvalidStateException;
-import org.hibernate.validator.InvalidValue;
@Name("topicHome")
@Scope(ScopeType.CONVERSATION)
public class TopicHome extends DocumentHome {
+ public static final String TOPIC_LIST_MACRO = "forumTopics";
+ public static final String TOPIC_LIST_MACRO_ML_PARAM = "mailingList";
public static final String TOPIC_NOTIFY_ME_MACRO = "forumNotifyReplies";
public static final String TOPIC_NOTIFY_LIST_TEMPLATE = "/mailtemplates/forumNotifyTopicToList.xhtml";
@@ -37,6 +35,7 @@
private boolean showForm = false;
private boolean sticky = false;
private boolean notifyReplies = false;
+ private String mailingList;
/* -------------------------- Basic Overrides ------------------------------ */
@@ -58,6 +57,8 @@
Boolean preferencesNotifyReplies = Preferences.instance().get(ForumPreferences.class).getNotifyMeOfReplies();
notifyReplies = preferencesNotifyReplies != null && preferencesNotifyReplies;
+ // TODO: mailingList = getMailingListFromTopicMacro();
+
textEditor.setKey("topic");
textEditor.setAllowPlaintext(true);// Topics can be plain text, regular documents can't
}
@@ -92,10 +93,18 @@
if (outcome != null) {
// Notify forum mailing list
- String notificationMailingList =
+ /* TODO
+ if (mailingList != null) {
+ getLog().debug("sending topic e-mail to list: " + mailingList);
+ Renderer.instance().render(
+ PluginRegistry.instance().getPlugin("forum").getPackageThemePath()+TOPIC_NOTIFY_LIST_TEMPLATE
+ );
+ }
+ */
+ String mailingList =
Preferences.instance().get(ForumPreferences.class).getNotificationMailingList();
- if (notificationMailingList != null) {
- getLog().debug("sending topic notification e-mail to forum list: " + notificationMailingList);
+ if (mailingList != null) {
+ getLog().debug("sending topic notification e-mail to forum list: " + mailingList);
Renderer.instance().render(
PluginRegistry.instance().getPlugin("forum").getPackageThemePath()+TOPIC_NOTIFY_LIST_TEMPLATE
);
@@ -170,6 +179,14 @@
return "forumTopicFeedEntryManager";
}
+ public String getMailingListFromTopicMacro() {
+ for (WikiTextMacro macro : currentDocument.getContentMacros()) {
+ if (macro.getName().equals(TOPIC_LIST_MACRO))
+ return macro.getParamValue(TOPIC_LIST_MACRO_ML_PARAM);
+ }
+ return null;
+ }
+
/* -------------------------- Public Features ------------------------------ */
public boolean isShowForm() {
@@ -196,6 +213,14 @@
this.notifyReplies = notifyReplies;
}
+ public String getMailingList() {
+ return mailingList;
+ }
+
+ public String getMailingListName() {
+ return currentDocument.getName();
+ }
+
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void newTopic() {
initEditor(false);
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/i18n/messages_forum_en.properties 2008-07-01 10:02:54 UTC (rev 8430)
@@ -11,6 +11,8 @@
forum.topics.label=Forum Topics
forum.topics.description=List of all topics in a forum directory
+forum.topics.preferences.description=Plugin: Forum Topics
+forum.topics.preferences.property.mailingList=Send and receive topics to and from this mailinglist
forum.posting.label=Forum Posting
forum.posting.description=Turns a WikiDocument into a regular forum posting
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -68,11 +68,11 @@
<ui:param name="baseDocument" value="#{topicHome.instance}"/>
<ui:param name="baseDirectory" value="#{currentDirectory}"/>
</ui:include>
-
+<!--
<s:decorate id="verifyCaptchaEntry" template="/includes/captchaEntry.xhtml">
<ui:param name="rendered" value="#{!identity.loggedIn}"/>
</s:decorate>
-
+-->
</s:div>
<div class="formControls">
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,16 +4,15 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
+ messageId="#{replyHome.instance.messageId}">
- <m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
- <m:header name="References" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
+ <m:header name="In-Reply-To" value="#{currentDocument.messageId}"/>
+ <m:header name="References" value="#{currentDocument.messageId}"/>
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
<m:header name="From" value="#{replyHome.instance.createdBy.fullname} <do-not-reply(a)jboss.com>"/>
-
<m:to name="LaceWiki Forums List">#{preferences.get('Forum').notificationMailingList}</m:to>
<m:subject>[LaceWiki Forums] #{replyHome.instance.subject}</m:subject>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,13 +4,13 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
+ messageId="#{topicHome.instance.messageId}">
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
<m:header name="From" value="#{topicHome.instance.createdBy.fullname} <do-not-reply(a)jboss.com>"/>
- <m:to name="LaceWiki Forums List">#{preferences.get('Forum').notificationMailingList}</m:to>
+ <m:to name="LaceWiki Forums List">#{topicHome.mailingList}</m:to>
<m:subject>[LaceWiki Forums] #{topicHome.instance.name}</m:subject>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,10 +4,10 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
+ messageId="#{replyHome.instance.messageId}">
- <m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
- <m:header name="References" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
+ <m:header name="In-Reply-To" value="#{currentDocument.messageId}"/>
+ <m:header name="References" value="#{currentDocument.messageId}"/>
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,15 +4,15 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
+ messageId="#{topicHome.instance.messageId}">
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
<m:header name="From" value="#{topicHome.instance.createdBy.fullname} <do-not-reply(a)jboss.com>"/>
- <m:to name="LaceWiki Forums List">#{preferences.get('Forum').notificationMailingList}</m:to>
+ <m:to name="LaceWiki Forums List">#{topicHome.mailingList}</m:to>
- <m:subject>[SeamFramework.org Forums] #{topicHome.instance.name}</m:subject>
+ <m:subject>[LaceWiki Forums] #{topicHome.instance.name}</m:subject>
<m:body>
<html>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,7 +4,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
+ messageId="#{replyHome.instance.messageId}">
<m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
<m:header name="References" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -4,13 +4,13 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:c="http://java.sun.com/jstl/core"
- messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
+ messageId="#{topicHome.instance.messageId}">
<m:header name="X-Sent-From" value="SeamFramework.org" />
<m:header name="Precedence" value="list"/>
<m:header name="From" value="#{topicHome.instance.createdBy.fullname} <do-not-reply(a)jboss.com>"/>
- <m:to name="SeamFramework.org Forums List">#{preferences.get('Forum').notificationMailingList}</m:to>
+ <m:to name="SeamFramework.org Forums List">#{topicHome.mailingList}</m:to>
<m:subject>#{topicHome.instance.name}</m:subject>
Modified: trunk/examples/wiki/view/docDisplay_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docDisplay_d.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/view/docDisplay_d.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -147,6 +147,7 @@
<s:div rendered="#{preferences.get('Wiki').showTags and not documentHome.instance.macroPresent('hideTags') and not empty documentHome.instance.tags}"
styleClass="documentTags undecoratedLink smallFont">
+ <!-- TODO: This should use wikiUrlRenderer for user link -->
<s:div>
#{messages['lacewiki.label.docDisplay.Tags']}: 
<ui:repeat var="tag" value="#{documentHome.tagEditor.tagsAsList}">
Added: trunk/examples/wiki/view/includes/onlineMembers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineMembers.xhtml (rev 0)
+++ trunk/examples/wiki/view/includes/onlineMembers.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -0,0 +1,44 @@
+<s:fragment
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0"
+ styleClass="datatable topLeftBottomBorder rightBorder smallFont"
+ headerClass="regularHeader"
+ columnClasses="alignCenter alignBottom minorPadding">
+
+ <f:facet name="header">
+ <h:outputText value="#{messages['lacewiki.label.userList.OnlineMembers']}"/>
+ <h:outputText value="#{init.authenticatedSessionTimeoutMinutes} minutes"/>
+ </f:facet>
+
+ <h:panelGrid columns="10">
+ <c:forEach var="u" items="#{wikiHttpSessionManager.onlineMembers}">
+ <h:panelGrid columns="1">
+ <s:div styleClass="alignCenter">
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
+ <s:graphicImage styleClass="userInfoPortraitImage"
+ rendered="#{!empty u.profile.imageContentType}"
+ value="#{u.profile.image}">
+ <s:transformImageSize width="40" maintainRatio="true"/>
+ </s:graphicImage>
+ <h:graphicImage rendered="#{empty u.profile.imageContentType}"
+ style="background: #ccc;" value="#{imagePath}/blank.gif" width="40" height="40"/>
+ </h:outputLink>
+ </s:div>
+ <s:div styleClass="undecoratedLink">
+ <h:outputLink value="#{wikiURLRenderer.renderUserProfileURL(u)}">
+ <h:outputText value="#{u.fullname}"/>
+ </h:outputLink>
+ </s:div>
+ </h:panelGrid>
+ </c:forEach>
+ </h:panelGrid>
+
+ </h:panelGrid>
+
+</s:fragment>
\ No newline at end of file
Modified: trunk/examples/wiki/view/includes/onlineUsers.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/view/includes/onlineUsers.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -8,13 +8,20 @@
<h:panelGrid styleClass="onlineUsersPanel" columns="4"
cellpadding="0" cellspacing="0" border="0">
- <h:outputText styleClass="onlineLabel" value="Online: "/>
+ <h:outputText styleClass="onlineLabel" value="#{messages['lacewiki.label.userList.Online']}: "/>
<s:fragment rendered="#{wikiHttpSessionManager.numberOfOnlineMembers > 0}">
- <s:span styleClass="onlineValue">
- <h:outputText value="#{wikiHttpSessionManager.numberOfOnlineMembers}"/>
- <h:outputText value=" #{wikiHttpSessionManager.numberOfOnlineMembers > 1 ? 'Members' : 'Member'}"/>
- </s:span>
+ <s:link styleClass="link"
+ view="/userList_#{skin}.xhtml" propagation="none">
+ <s:span styleClass="onlineValue">
+ <h:outputText value="#{wikiHttpSessionManager.numberOfOnlineMembers}"/>
+ <h:outputText value=" #{wikiHttpSessionManager.numberOfOnlineMembers > 1
+ ? messages['lacewiki.label.userList.Members']
+ : messages['lacewiki.label.userList.Member']}"/>
+ <h:outputText value=" #{messages['lacewiki.label.userList.Of']} "/>
+ <h:outputText value="#{wikiHttpSessionManager.totalMembers}"/>
+ </s:span>
+ </s:link>
</s:fragment>
<h:outputText styleClass="onlineSeparator" value=" | "
@@ -24,7 +31,9 @@
<s:fragment rendered="#{wikiHttpSessionManager.numberOfOnlineGuests > 0}">
<s:span styleClass="onlineValue">
<h:outputText value="#{wikiHttpSessionManager.numberOfOnlineGuests}"/>
- <h:outputText value=" #{wikiHttpSessionManager.numberOfOnlineGuests> 1 ? 'Guests' : 'Guest'}"/>
+ <h:outputText value=" #{wikiHttpSessionManager.numberOfOnlineGuests> 1
+ ? messages['lacewiki.label.userList.Guests']
+ : messages['lacewiki.label.userList.Guest']}"/>
</s:span>
</s:fragment>
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-07-01 10:02:54 UTC (rev 8430)
@@ -289,6 +289,7 @@
font-weight: normal;
vertical-align: top;
background-color: #362f2d;
+ background-image: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
Modified: trunk/examples/wiki/view/uploadEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/uploadEdit_d.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/view/uploadEdit_d.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -92,6 +92,19 @@
</div>
</div>
+ <s:div styleClass="entry">
+ <div class="label">#{messages['lacewiki.label.uploadEdit.Importers']}:</div>
+ <div class="input">
+ <h:selectOneMenu id="importerSelect" value="#{uploadHome.importer}" tabindex="1"
+ onchange="if (jQuery('#uploadEditForm\\:importerSelect')[0].selectedIndex > 0 ) { jQuery('#uploadEditForm\\:import').show(); } else { jQuery('#uploadEditForm\\:import').hide(); }">
+ <s:selectItems value="#{uploadHome.availableImporters}"
+ var="importerName"
+ label="#{messages[importerRegistry.importerComponents[importerName].description()]}"
+ noSelectionLabel="#{messages['lacewiki.label.uploadEdit.ImportNoSelection']}"/>
+ </h:selectOneMenu>
+ </div>
+ </s:div>
+
<s:div id="uploadControl" styleClass="sessionEventTrigger">
<s:decorate id="uploadDecorate" template="includes/formFieldDecorate.xhtml">
<ui:define name="label">
@@ -126,6 +139,13 @@
<div class="label"> </div>
<div class="input">
+ <h:commandLink id="import" action="#{uploadHome.importInstance}"
+ rendered="#{uploadHome.managed}"
+ tabindex="1"
+ style="display:none;" styleClass="button sessionEventTrigger">
+ <h:outputText escape="false" styleClass="buttonLabel" value="#{messages['lacewiki.button.uploadEdit.Import']}"/>
+ </h:commandLink>
+
<h:commandLink id="save" action="#{uploadHome.persist}"
rendered="#{!uploadHome.managed}"
tabindex="1" accesskey="#{messages['lacewiki.button.uploadEdit.Save.accesskey']}"
Modified: trunk/examples/wiki/view/userList_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userList_d.xhtml 2008-06-30 13:15:47 UTC (rev 8429)
+++ trunk/examples/wiki/view/userList_d.xhtml 2008-07-01 10:02:54 UTC (rev 8430)
@@ -30,6 +30,10 @@
<ui:define name="content">
+ <s:div styleClass="box" style="margin-top:10px;">
+ <ui:include src="includes/onlineMembers.xhtml"/>
+ </s:div>
+
<script type="text/javascript">jQuery(function() {
jQuery(".contextMenu").show().menu({offsetLeft: 20});
})</script>
16 years, 7 months