[jboss-svn-commits] JBL Code SVN: r19856 - in labs/jbossforums/branches/forums120P26/forums/src: main/org/jboss/portlet/forums/impl and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 5 07:43:25 EDT 2008
Author: dejp
Date: 2008-05-05 07:43:25 -0400 (Mon, 05 May 2008)
New Revision: 19856
Modified:
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java
labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java
labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml
labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml
Log:
JBFORUMS-2
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -1,5 +1,4 @@
/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzer.java */
-
/******************************************************************************
* JBoss, a division of Red Hat *
* Copyright 2006, Red Hat Middleware, LLC, and individual *
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -1,5 +1,4 @@
/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerConstants.java */
-
/******************************************************************************
* JBoss, a division of Red Hat *
* Copyright 2006, Red Hat Middleware, LLC, and individual *
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -1,5 +1,4 @@
/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerTokenManager.java */
-
/******************************************************************************
* JBoss, a division of Red Hat *
* Copyright 2006, Red Hat Middleware, LLC, and individual *
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -25,6 +25,8 @@
import java.io.Serializable;
import java.util.*;
+import javax.persistence.OneToMany;
+
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portal.jems.hibernate.HibernateProvider;
import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.model.Topic;
public interface ForumsSearchModule {
@@ -32,4 +33,6 @@
public ResultPage<Post> findPosts(SearchCriteria criteria) throws ModuleException;
+ public ResultPage<Topic> findTopics(SearchCriteria criteria) throws ModuleException;
+
}
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -24,6 +24,9 @@
import java.util.Calendar;
import java.util.Date;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -38,6 +41,7 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.search.BooleanClause.Occur;
+import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.search.FullTextQuery;
@@ -48,6 +52,7 @@
import org.jboss.portal.jems.hibernate.HibernateProvider;
import org.jboss.portlet.forums.impl.PostImpl;
import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.model.Topic;
public class ForumsSearchModuleImpl extends AbstractModule implements ForumsSearchModule {
@@ -119,9 +124,6 @@
String userName = criteria.getAuthor();
if (userName != null && userName.length() != 0) {
- //query.add(new TermQuery(new Term("userName", userName)), Occur.MUST);
- //QueryParser parser = new QueryParser(userName, new StandardAnalyzer());
- //query.add(new WildcardQuery(new Term("poster.userName", userName)), Occur.MUST);
query.add(new WildcardQuery(new Term("userName", userName)), Occur.MUST);
}
@@ -155,6 +157,114 @@
throw new IllegalArgumentException("criteria cannot be null");
}
}
+
+ @SuppressWarnings("unchecked")
+ public ResultPage<Topic> findTopics(SearchCriteria criteria) throws ModuleException {
+ if (criteria != null) {
+ try {
+ Session session = getSession();
+ FullTextSession fullTextSession = Search.createFullTextSession(session);
+
+ BooleanQuery query = new BooleanQuery();
+
+ String keywords = criteria.getKeywords();
+ if (keywords != null && keywords.length() != 0) {
+ String[] fields = null;
+
+ Searching searching = Searching.valueOf(criteria.getSearching());
+ switch(searching) {
+ case TITLE_MSG:
+ fields = new String[] { "message.text", "topic.subject" };
+
+ break;
+ case MSG:
+ fields = new String[] { "message.text" };
+
+ break;
+ }
+
+ MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
+ query.add(parser.parse(keywords), Occur.MUST);
+ }
+
+ String forumId = criteria.getForum();
+ if (forumId != null && forumId.length() != 0) {
+ query.add(new TermQuery(new Term("topic.forum.id", forumId)), Occur.MUST);
+ }
+
+ String categoryId = criteria.getCategory();
+ if (categoryId != null && categoryId.length() != 0) {
+ query.add(new TermQuery(new Term("topic.forum.category.id", categoryId)), Occur.MUST);
+ }
+
+ String userName = criteria.getAuthor();
+ if (userName != null && userName.length() != 0) {
+ query.add(new WildcardQuery(new Term("userName", userName)), Occur.MUST);
+ }
+
+ String timePeriod = criteria.getTimePeriod();
+ if (timePeriod != null && timePeriod.length() != 0) {
+ addPostTimeQuery(query, TimePeriod.valueOf(timePeriod));
+ }
+
+ FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(query, PostImpl.class);
+
+ SortOrder sortOrder = SortOrder.valueOf(criteria.getSortOrder());
+ SortBy sortBy = SortBy.valueOf(criteria.getSortBy());
+ fullTextQuery.setSort(getSort(sortBy, sortOrder));
+
+ fullTextQuery.setProjection("topic.id");
+
+ LinkedHashSet<Integer> topicIds = new LinkedHashSet<Integer>();
+ LinkedHashSet<Integer> topicToDispIds = new LinkedHashSet<Integer>();
+
+ int start = criteria.getPageSize() * criteria.getPageNumber();
+ int end = start + criteria.getPageSize();
+ int index = 0;
+ for (Object o : fullTextQuery.list()) {
+ Integer id = (Integer) ((Object[]) o)[0];
+
+ if (topicIds.add(id)) {
+
+ if (index >= start && index < end) {
+ topicToDispIds.add(id);
+ }
+
+ index++;
+ }
+ }
+
+ Query q = session.createQuery("from TopicImpl as t join fetch t.poster where t.id IN ( :topicIds )");
+ q.setParameterList("topicIds", topicToDispIds);
+
+ List<Topic> results = q.list();
+
+ List<Topic> topics = new LinkedList<Topic>();
+ for (Integer id : topicToDispIds) {
+ for (Topic topic : results) {
+ if (id.equals(topic.getId())) {
+ topics.add(topic);
+ break;
+ }
+ }
+ }
+
+ ResultPage<Topic> resultPage = new ResultPage<Topic>();
+ resultPage.setPage(topics);
+ resultPage.setResultSize(topicIds.size());
+
+ return resultPage;
+ } catch (ParseException e) {
+
+ return null;
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ throw new ModuleException(e.getMessage(), e);
+ }
+ } else {
+ throw new IllegalArgumentException("criteria cannot be null");
+ }
+ }
protected org.apache.lucene.search.Sort getSort(SortBy sortBy, SortOrder sortOrder) {
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -48,6 +48,8 @@
private int pageNumber;
+ private String displayAs;
+
public String getKeywords() {
return keywords;
}
@@ -133,6 +135,17 @@
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
-
+
+ public String getDisplayAs() {
+ if (displayAs == null || displayAs.length() == 0)
+ displayAs = DisplayAs.POSTS.name();
+
+ return displayAs;
+ }
+
+ public void setDisplayAs(String displayAs) {
+ this.displayAs = displayAs;
+ }
+
}
\ No newline at end of file
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -66,7 +66,7 @@
return initialized;
}
-
+
@SuppressWarnings("unchecked")
public Collection<SelectItem> getCategoriesItems()
{
Modified: labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java 2008-05-05 11:43:25 UTC (rev 19856)
@@ -23,9 +23,13 @@
package org.jboss.portlet.forums.ui.view;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.model.Topic;
+import org.jboss.portlet.forums.search.DisplayAs;
import org.jboss.portlet.forums.search.ResultPage;
import org.jboss.portlet.forums.search.SearchCriteria;
import org.jboss.portlet.forums.ui.BaseController;
@@ -46,6 +50,10 @@
private List<Post> posts;
+ private List<Topic> topics;
+
+ private Map topicLastPosts = null;
+
private Search search;
private PageNavigator pageNavigator = null;
@@ -54,7 +62,21 @@
{
return posts;
}
+
+ public List<Topic> getTopics()
+ {
+ return topics;
+ }
+ public Map getTopicLastPosts()
+ {
+ if(this.topicLastPosts==null)
+ {
+ this.topicLastPosts = new HashMap();
+ }
+ return this.topicLastPosts;
+ }
+
public Search getSearch()
{
return search;
@@ -102,6 +124,17 @@
return initialized;
}
+ public boolean isDisplayAsTopics()
+ {
+ String displayAs = search.getSearchCriteria().getDisplayAs();
+
+ if (displayAs.equals(DisplayAs.TOPICS.name())) {
+ return true;
+ }
+
+ return false;
+ }
+
@SuppressWarnings("unchecked")
private void execute() throws Exception
{
@@ -117,37 +150,72 @@
SearchCriteria criteria = search.getSearchCriteria();
if (criteria != null) {
+
criteria.setPageSize(Integer.valueOf(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)));
criteria.setPageNumber(currentPage);
+
+ if (criteria.getDisplayAs().equals(DisplayAs.POSTS.name())) {
+
+ ResultPage<Post> resultPage = BaseController.getSearchModule().findPosts(criteria);
- ResultPage<Post> resultPage = BaseController.getSearchModule().findPosts(criteria);
-
- //if (resultPage != null) {
- posts = resultPage.getPage();
+ posts = resultPage.getPage();
- if (posts.isEmpty())
+ if (posts != null && posts.isEmpty())
posts = null;
- this.pageNavigator =
- new PageNavigator(resultPage.getResultSize(),
- criteria.getPageSize(),
- currentPage) {
-
- protected Collection<Post> initializePage() {
-
- int beginIndex = this.getBeginIndex();
- int totalEntries = this.getNumberOfEntries();
+ this.pageNavigator =
+ new PageNavigator(resultPage.getResultSize(),
+ criteria.getPageSize(),
+ currentPage) {
+
+ protected Collection<Post> initializePage() {
- //reset the page navigation if the start cursor is outside the range (both forward and backward)
- if (beginIndex >= totalEntries || beginIndex < 0)
- {
- this.setCurrentPage(0); //go to the first page
- beginIndex = this.getBeginIndex();
+ int beginIndex = this.getBeginIndex();
+ int totalEntries = this.getNumberOfEntries();
+
+ //reset the page navigation if the start cursor is outside the range (both forward and backward)
+ if (beginIndex >= totalEntries || beginIndex < 0)
+ {
+ this.setCurrentPage(0); //go to the first page
+ beginIndex = this.getBeginIndex();
+ }
+
+ return getPosts();
}
+ };
+ } else {
+
+ ResultPage<Topic> resultPage = BaseController.getSearchModule().findTopics(criteria);
+
+ topics = resultPage.getPage();
+
+ if (topics != null && topics.isEmpty()) {
+ topics = null;
+ } else {
+ topicLastPosts = BaseController.getForumsModule().findLastPostsOfTopics(topics);
+ }
+
+ this.pageNavigator =
+ new PageNavigator(resultPage.getResultSize(),
+ criteria.getPageSize(),
+ currentPage) {
+
+ protected Collection<Topic> initializePage() {
- return getPosts();
- }
- };
+ int beginIndex = this.getBeginIndex();
+ int totalEntries = this.getNumberOfEntries();
+
+ //reset the page navigation if the start cursor is outside the range (both forward and backward)
+ if (beginIndex >= totalEntries || beginIndex < 0)
+ {
+ this.setCurrentPage(0); //go to the first page
+ beginIndex = this.getBeginIndex();
+ }
+
+ return getTopics();
+ }
+ };
+ }
}
}
Modified: labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2008-05-05 11:43:25 UTC (rev 19856)
@@ -505,4 +505,8 @@
Search_search=Search
Search_reset=Reset
Search_found=Search found {0} matches
-Search_not_found=No posts found
+Search_topics_not_found=No topics found
+Search_posts_not_found=No posts found
+Search_display_as=Display results as:
+Search_display_as_topics=Topics
+Search_display_as_posts=Posts
Modified: labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml 2008-05-05 11:43:25 UTC (rev 19856)
@@ -153,6 +153,16 @@
</h:selectOneRadio>
</td>
</tr>
+
+ <tr class="evenRow">
+ <td class="rowlinefirst">${resource.Search_display_as}</td>
+ <td class="rowline">
+ <h:selectOneRadio value="#{search.searchCriteria.displayAs}" required="true" layout="pageDirection">
+ <f:selectItem itemValue="POSTS" itemLabel="#{resource.Search_display_as_posts}" />
+ <f:selectItem itemValue="TOPICS" itemLabel="#{resource.Search_display_as_topics}" />
+ </h:selectOneRadio>
+ </td>
+ </tr>
<tr>
<td class="forumformbuttonrow" colspan="2" style="border:0px;">
Modified: labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml
===================================================================
--- labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml 2008-05-05 10:11:21 UTC (rev 19855)
+++ labs/jbossforums/branches/forums120P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml 2008-05-05 11:43:25 UTC (rev 19856)
@@ -33,408 +33,23 @@
<ui:composition template="/views/common/common.xhtml">
<ui:define name="mainContent">
-
- <c:choose>
-
- <c:when test="#{viewSearch.initialized && viewSearch.posts != null}">
- <a name="top" />
+ <c:choose>
+
+ <c:when test="#{viewSearch.displayAsTopics}">
+
+ <ui:include src="/views/search/view_astopics.xhtml"></ui:include>
+
+ </c:when>
+
+ <c:otherwise>
+
+ <ui:include src="/views/search/view_asposts.xhtml"></ui:include>
+
+ </c:otherwise>
+
+ </c:choose>
- <div class="forumtitletext">
- <h4>
- <h:outputFormat value="#{resource.Search_found}">
- <f:param value="#{viewSearch.pageNavigator.numberOfEntries}" />
- </h:outputFormat>
- </h4>
- </div>
-
- <!-- PAGINATION -->
- <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
- <div class="forumpagination">
- <ul>
- <li class="disablepage">
- <h:outputFormat value="#{resource.PageNumber}">
- <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
- <f:param value="${viewSearch.pageNavigator.totalPages}"/>
- </h:outputFormat>
- </li>
-
- <c:choose>
- <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
- <li class="disablepage">
- ${resource.First}
- </li>
- <li class="disablepage">
- < ${resource.Previous}
- </li>
- </c:when>
- <c:otherwise>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="0"/>
- <h:outputText value="${resource.First}"/>
- </h:outputLink>
- </li>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
- <h:outputText value="< ${resource.Previous}"/>
- </h:outputLink>
- </li>
- </c:otherwise>
- </c:choose>
-
- <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${pageNumber-1}"/>
- <h:outputText value="${pageNumber}"/>
- </h:outputLink>
- </li>
- </c:forEach>
-
- <li class="currentpage">
- ${viewSearch.pageNavigator.currentPage+1}
- </li>
-
- <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${pageNumber-1}"/>
- <h:outputText value="${pageNumber}"/>
- </h:outputLink>
- </li>
- </c:forEach>
-
- <c:choose>
- <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
- <li class="disablepage">
- ${resource.Next} >
- </li>
- <li class="disablepage">
- ${resource.Last}
- </li>
- </c:when>
- <c:otherwise>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
- <h:outputText value="${resource.Next} >"/>
- </h:outputLink>
- </li>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
- <h:outputText value="${resource.Last}"/>
- </h:outputLink>
- </li>
- </c:otherwise>
- </c:choose>
- </ul>
- </div>
- </c:if>
-
- <h:form>
- <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-
- <tr class="header">
- <td class="forumheaderfirst">${resource.Author}</td>
- <td class="forumheaderopen">${resource.Message}</td>
- </tr>
-
- <c:forEach items="#{viewSearch.posts}" var="postrow" varStatus="status">
- <tr class="oddRow">
- <td class="forumpostleftcolumn">
- <c:choose>
-
- <c:when test="#{category.anonymous}">
- ${postrow.poster.user.userName}
- </c:when>
-
- <c:otherwise>
- <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
- <f:param name="uid" value="${postrow.poster.user.id}"/>
- <h:outputText value="${postrow.poster.user.userName}"/>
- </h:outputLink>
- </c:otherwise>
-
- </c:choose>
- </td>
- <td class="forumpostspacer">
-
- <a name="${postrow.id}" />
-
- <div class="forumpostinfo">
- <ul>
- <li>
- <a name="${postrow.id}" />
- <h:outputLink value="#{forums:postPermlink(postrow.id)}" style="text-decoration: none;">
- <f:verbatim>
- <h:outputText value="${resource.Permalink}"/>
- </f:verbatim>
- </h:outputLink>
- </li>
- <li>${resource.Posted}: #{forums:dateStr(postrow.createDate)}</li>
- <li>${resource.Post_subject}: ${postrow.message.subject}</li>
- </ul>
- </div>
- </td>
- </tr>
- <tr>
- <td class="forumpostleftcolumn"> </td>
- <td class="forumpostcontent">
-
- <p>
- <h:outputText value="#{forums:formatMessage(postrow.message.text,false)}" escape="false" />
- <br /><br />
- ${forums:userProperty(postrow.poster.user,'INFO_USER_SIGNATURE')}
- </p>
-
- <!-- show the attachments of this post here -->
- <p>
- <c:if test="#{postrow.attachments!=null}">
- <ui:include src="/views/topics/attachmentsview.xhtml">
- <ui:param name="attachments" value="#{postrow.attachments}"/>
- </ui:include>
- </c:if>
- </p>
-
- <c:if test="${postrow.editCount gt 0}">
- <p>
- <em>
- <c:choose>
- <c:when test="${postrow.editCount eq 1}">
- <h:outputFormat value="#{resource.Edited_time_total}">
- <f:param value="${postrow.poster.user.userName}"/>
- <f:param value="${postrow.editDate}"/>
- <f:param value="${postrow.editCount}"/>
- </h:outputFormat>
- </c:when>
- <c:otherwise>
- <h:outputFormat value="#{resource.Edited_times_total}">
- <f:param value="${postrow.poster.user.userName}"/>
- <f:param value="${postrow.editDate}"/>
- <f:param value="${postrow.editCount}"/>
- </h:outputFormat>
- </c:otherwise>
- </c:choose>
- </em>
- </p>
- </c:if>
-
- </td>
- </tr>
- <tr>
- <td class="forumpostleftcolumn">
- <a href="#top">${resource.Back_to_top}</a>
- </td>
- <td class="forumthreaduserinfo">
- <ul>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
- <f:param name="uid"
- value="#{postrow.poster.user.id}"/>
- <f:verbatim>
- <img border="0"
- src="#{forums:themeURL('resourceIconProfileURL')}"
- alt="${resource.Read_profile}"/>
- </f:verbatim>
- </h:outputLink>
- </li>
-
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE') ne null}">
- <li>
- <a href="mailto:${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE')}">
- <img border="0"
- src="#{forums:themeURL('resourceIconEmailURL')}"
- alt="${resource.Send_email}"/>
- </a>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE') ne null}">
- <li>
- <a href="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE')}">
- <img border="0"
- src="#{forums:themeURL('resourceIconWWWURL')}"
- alt="${resource.Visit_website}"/>
- </a>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM') ne null}">
- <li>
- <a href="aim:goim?screenname=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM')}&message=Hello+Are+you+there?">
- <img border="0"
- src="#{forums:themeURL('resourceIconAIMURL')}"
- alt="${resource.AIM}"/>
- </a>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM') ne null}">
- <li>
- <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM')}&.src=pg">
- <img border="0"
- src="#{forums:themeURL('resourceIconYIMURL')}"
- alt="${resource.YIM}"/>
- </a>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE') ne null}">
- <li>
- <!-- TODO: some more functionality may be added. Like automatic skype instalation and status checker.-->
- <a href="skype:#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE')}?add">
- <img border="0"
- src="#{forums:themeURL('resourceIconSkypeURL')}"
- alt="${resource.L_SKYPE}"/>
- </a>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_MSNM') ne null}">
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
- <f:param name="uid"
- value="#{postrow.poster.user.id}"/>
- <f:verbatim>
- <img border="0"
- src="#{forums:themeURL('resourceIconMSNMURL')}"
- alt="${resource.Read_profile}"/>
- </f:verbatim>
- </h:outputLink>
- </li>
- </c:if>
- <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ') ne null}">
- <li>
- <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ')}">
- <img border="0"
- src="#{forums:themeURL('resourceIconICQURL')}"
- alt="${resource.ICQ}"/>
- </a>
- </li>
- </c:if>
-
- </ul>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="forumthreadfooter">
- <img src="#{forums:themeURL('resourceSpacerURL')}" />
- </td>
- </tr>
- </c:forEach>
-
- </table>
- </h:form>
-
- <!-- PAGINATION -->
- <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
- <div class="forumpagination">
- <ul>
- <li class="disablepage">
- <h:outputFormat value="#{resource.PageNumber}">
- <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
- <f:param value="${viewSearch.pageNavigator.totalPages}"/>
- </h:outputFormat>
- </li>
-
- <c:choose>
- <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
- <li class="disablepage">
- ${resource.First}
- </li>
- <li class="disablepage">
- < ${resource.Previous}
- </li>
- </c:when>
- <c:otherwise>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="0"/>
- <h:outputText value="${resource.First}"/>
- </h:outputLink>
- </li>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
- <h:outputText value="< ${resource.Previous}"/>
- </h:outputLink>
- </li>
- </c:otherwise>
- </c:choose>
-
- <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${pageNumber-1}"/>
- <h:outputText value="${pageNumber}"/>
- </h:outputLink>
- </li>
- </c:forEach>
-
- <li class="currentpage">
- ${viewSearch.pageNavigator.currentPage+1}
- </li>
-
- <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${pageNumber-1}"/>
- <h:outputText value="${pageNumber}"/>
- </h:outputLink>
- </li>
- </c:forEach>
-
- <c:choose>
- <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
- <li class="disablepage">
- ${resource.Next} >
- </li>
- <li class="disablepage">
- ${resource.Last}
- </li>
- </c:when>
- <c:otherwise>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
- <h:outputText value="${resource.Next} >"/>
- </h:outputLink>
- </li>
- <li>
- <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
- <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
- <h:outputText value="${resource.Last}"/>
- </h:outputLink>
- </li>
- </c:otherwise>
- </c:choose>
- </ul>
- </div>
- </c:if>
-
- </c:when>
-
- <c:otherwise>
- <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
- <tr>
- <td>
- <table width="100%" cellspacing="0" cellpadding="1" border="0">
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td align="center">
- ${resource.Search_not_found}
- </td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </c:otherwise>
- </c:choose>
-
</ui:define>
</ui:composition>
More information about the jboss-svn-commits
mailing list