[seam-commits] Seam SVN: r8436 - in trunk/examples/wiki: src/etc/i18n and 9 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 7 03:33:27 EDT 2008


Author: christian.bauer at 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']}:&#160;"/>
 

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']}:&#160;"/>
+        </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="&#160;&#160; "/>
+        </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 -->




More information about the seam-commits mailing list