[jboss-svn-commits] JBL Code SVN: r22522 - in labs/jbosslabs/labs-3.0-build/integration: mgnl-paragraphs and 17 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 8 12:46:56 EDT 2008


Author: dejp
Date: 2008-09-08 12:46:56 -0400 (Mon, 08 Sep 2008)
New Revision: 22522

Added:
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.classpath
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.project
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.settings/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.settings/org.eclipse.jdt.core.prefs
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/pom.xml
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/Constants.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/dialogs/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/dialogs/OrgTemplateDialog.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/CSSearchResultSnippetTag.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/Dev.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/DevSpotlightHelper.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/JBossOrgSearchTag.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/PaginationTag.java
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/META-INF/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/META-INF/jbossorg-util-taglib.tld
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/labs/
   labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/labs/AppTest.java
Log:
magnolia paragraphs

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.classpath
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.classpath	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.classpath	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,24 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/com/jivesoftware/clearspace/2.5.0.rc/clearspace-2.5.0.rc.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/geronimo/geronimo-ws-metadata/1.0/geronimo-ws-metadata-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/google/code/guice/guice/1.0/guice-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/jaxb-api/1.0/jaxb-api-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/jcr/jcr/1.0.1/jcr-1.0.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
+  <classpathentry kind="var" path="M2_REPO/info/magnolia/magnolia-core/3.5.8/magnolia-core-3.5.8.jar"/>
+  <classpathentry kind="var" path="M2_REPO/info/magnolia/magnolia-gui/3.5.8/magnolia-gui-3.5.8.jar"/>
+  <classpathentry kind="var" path="M2_REPO/info/magnolia/magnolia-module-admininterface/3.5.8/magnolia-module-admininterface-3.5.8.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/sun-jaxws-api/1.0/sun-jaxws-api-1.0.jar"/>
+</classpath>
\ No newline at end of file

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.project
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.project	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.project	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,14 @@
+<projectDescription>
+  <name>mgnl-paragraphs</name>
+  <comment>Parent POM for all JBoss Projects. Provides default project build
+    configuration.</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/.settings/org.eclipse.jdt.core.prefs	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,5 @@
+#Mon Sep 08 13:26:29 CEST 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/pom.xml	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/pom.xml	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,121 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>integration</artifactId>
+    <groupId>org.jboss.labs</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.labs</groupId>
+  <artifactId>mgnl-paragraphs</artifactId>
+  <name>mgnl-paragraphs</name>
+  <version>1.0</version>
+  <url>http://maven.apache.org</url>
+  <!--build>
+    <plugins>
+      <plugin>
+        <groupId>org.jboss.labs</groupId>
+        <artifactId>maven-labs-plugin</artifactId>
+        <configuration>
+          <fileFinalName>${project.build.finalName}.jar</fileFinalName>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build-->
+  <dependencies>
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.1</version>
+        <scope>test</scope>
+    </dependency>
+	<dependency>
+	    <groupId>javax.servlet</groupId>
+	    <artifactId>jsp-api</artifactId>
+	    <version>2.0</version>
+	</dependency>
+	<dependency>
+	    <groupId>commons-lang</groupId>
+	    <artifactId>commons-lang</artifactId>
+	    <version>2.4</version>
+    </dependency>
+    <dependency>
+	    <groupId>commons-httpclient</groupId>
+	    <artifactId>commons-httpclient</artifactId>
+	    <version>3.1</version>
+    </dependency>
+	<dependency>
+	    <groupId>javax.jcr</groupId>
+	    <artifactId>jcr</artifactId>
+	    <version>1.0.1</version>
+	</dependency> 
+
+    <dependency>
+        <groupId>info.magnolia</groupId>
+        <artifactId>magnolia-core</artifactId>
+        <version>3.5.8</version>
+        <scope>provided</scope>
+    </dependency>
+    <dependency>
+        <groupId>info.magnolia</groupId>
+        <artifactId>magnolia-module-admininterface</artifactId>
+        <version>3.5.8</version>
+        <scope>provided</scope>
+    </dependency>
+    <dependency>
+        <groupId>info.magnolia</groupId>
+        <artifactId>magnolia-gui</artifactId>
+        <version>3.5.8</version>
+        <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>com.jivesoftware</groupId>
+        <artifactId>clearspace</artifactId>
+        <version>2.5.0.rc</version>
+        <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>com.sun</groupId>
+        <artifactId>sun-jaxws-api</artifactId>
+        <version>1.0</version>
+        <scope>provided</scope>
+    </dependency>
+    <dependency>
+        <groupId>com.sun</groupId>
+        <artifactId>jaxb-api</artifactId>
+        <version>1.0</version>
+        <scope>provided</scope>
+    </dependency>
+    <dependency>
+        <groupId>com.geronimo</groupId>
+        <artifactId>geronimo-ws-metadata</artifactId>
+        <version>1.0</version>
+        <scope>provided</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+	<groupId>org.jboss.labs</groupId>
+	<artifactId>maven-labs-plugin</artifactId>
+	<executions>
+	  <execution>
+	    <id>install</id>
+	    <phase>install</phase>
+	    <goals>
+	      <goal>cs-setup</goal>
+	    </goals>
+	    <configuration>
+	      <resourcesFolder>target</resourcesFolder>
+	      <labsDeploy>false</labsDeploy>
+	      <!--includes>.+SNAPSHOT.jar</includes-->
+	    </configuration>
+	  </execution>
+	</executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/Constants.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/Constants.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/Constants.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,31 @@
+package org.jboss.labs.magnolia;
+
+public class Constants {
+
+    public static final String JBOSSORG_CONTENT_NODE_PATH = "jbossorg";
+    
+    public static final String TEMPLATE_CONTENT_NODE = "template";
+    
+    public static final String TEMPLATE_CONTENT_NODE_PATH = JBOSSORG_CONTENT_NODE_PATH + "/" + TEMPLATE_CONTENT_NODE;
+    
+    public static final String SEARCH_THE_ENTIRE = "Search the JBoss.org site";
+    
+    public static final String SEARCH_PROJECTS = "Search Project Pages";
+    
+    public static final String SEARCH_THE_COMMUNITY = "Search the Community";
+    
+    public static final String PROJECTS_PATH = "projects";
+    
+    public static final String RESULT_PAGE = "resultPage";
+    
+    public static final int PAGE_SIZE = 15;
+    
+    public static final String SEARCH_AREA = "searchArea";
+    
+    public static final String QUERY = "q";
+
+    public static final String PAGE = "p";
+    
+    public static final String SEARCH_PAGE= "/search.html";
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/dialogs/OrgTemplateDialog.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/dialogs/OrgTemplateDialog.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/dialogs/OrgTemplateDialog.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,74 @@
+package org.jboss.labs.magnolia.dialogs;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
+import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.gui.misc.Sources;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.module.admininterface.SaveHandler;
+import info.magnolia.module.admininterface.dialogs.ConfiguredDialog;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.labs.magnolia.Constants;
+
+public class OrgTemplateDialog extends ConfiguredDialog {
+
+    protected static Logger logger = Logger.getLogger(OrgTemplateDialog.class);
+    
+    public OrgTemplateDialog(String name, HttpServletRequest request, HttpServletResponse response, Content configNode) {
+        super(name, request, response, configNode);
+    }
+    
+    @Override
+    public Content getStorageNode() {
+        Content content = null;
+        
+        HierarchyManager mgr = MgnlContext.getHierarchyManager(ContentRepository.WEBSITE);
+        
+        try {
+            Content c = mgr.getContent(Constants.JBOSSORG_CONTENT_NODE_PATH, true, ItemType.CONTENTNODE);
+            content = c.getChildByName(Constants.TEMPLATE_CONTENT_NODE);
+        } catch(Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+        
+        return content;
+    }
+
+    @Override
+    protected boolean onPreSave(SaveHandler handler) {
+        handler.setPath(Constants.TEMPLATE_CONTENT_NODE_PATH);
+        handler.setCreate(true);
+        handler.setCreationItemType(ItemType.CONTENTNODE);
+        
+        return true;
+    }
+
+    @Override
+    public void renderHtml(String view) throws IOException {
+        PrintWriter out = response.getWriter();
+        
+        if (view == VIEW_CLOSE_WINDOW) {
+            out.println("<html>");
+            out.println(new Sources(this.getRequest().getContextPath()).getHtmlJs());
+            out.println("<script type=\"text/javascript\">");
+            out.println("mgnlDialogReloadOpener();");
+            out.println("window.close();");
+            out.println("</script></html>");
+        } else {
+            try {
+                super.renderHtml(view);
+            } catch (IOException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+    }
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/CSSearchResultSnippetTag.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/CSSearchResultSnippetTag.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/CSSearchResultSnippetTag.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,127 @@
+package org.jboss.labs.magnolia.utils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+import com.jivesoftware.community.webservices.WSDocument;
+
+public class CSSearchResultSnippetTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    private WSDocument document;
+
+    private String query;
+
+    private int chars = 100;
+
+    public void setQuery(String query) {
+        this.query = query;
+    }
+
+    public void setChars(int chars) {
+        this.chars = chars;
+    }
+
+    public void setDocument(WSDocument document) {
+        this.document = document;
+    }
+
+    public int doStartTag() throws JspException {
+
+        JspWriter out = this.pageContext.getOut();
+        try {
+            Iterator<StringBuilder> iterator = getSnippets().iterator();
+            while (iterator.hasNext()) {
+                out.println(iterator.next());
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        
+        return EVAL_PAGE;
+    }
+
+    public Collection<StringBuilder> getSnippets() {
+        Collection<StringBuilder> snippets = new ArrayList<StringBuilder>();
+        String[] searchTerms = StringUtils.split(this.query);
+        
+        if (document == null || !document.isTextBody()) {
+            return snippets;
+        } 
+
+        String resultString = document.getBody();
+
+        if (resultString.length() < 20) {
+            
+        }
+
+        for (int j = 0; j < searchTerms.length; j++) {
+            String searchTerm = StringUtils.lowerCase(searchTerms[j]);
+
+            if (!ArrayUtils.contains(JBossOrgSearchTag.KEYWORDS, searchTerm) && searchTerm.length() > 2) {
+
+                if (!StringUtils.contains(resultString.toLowerCase(), searchTerm)) {
+                    continue;
+                }
+
+                resultString = com.jivesoftware.util.StringUtils.stripTags(resultString);
+
+                // only get first matching keyword
+                int pos = resultString.toLowerCase().indexOf(searchTerm);
+                if (pos > -1) {
+
+                    int posEnd = pos + searchTerm.length();
+                    int from = (pos - chars / 2);
+                    if (from < 0) {
+                        from = 0;
+                    }
+
+                    int to = from + chars;
+                    if (to > resultString.length()) {
+                        to = resultString.length();
+                    }
+
+                    StringBuilder snippet = new StringBuilder();
+
+                    snippet.append(StringUtils.substring(resultString, from, pos));
+                    snippet.append("<strong>");
+                    snippet.append(StringUtils.substring(resultString, pos, posEnd));
+                    snippet.append("</strong>");
+                    snippet.append(StringUtils.substring(resultString, posEnd, to));
+
+                    if (from > 0) {
+                        snippet.insert(0, "... ");
+                    }
+                    if (to < resultString.length()) {
+                        snippet.append("... ");
+                    }
+
+                    snippets.add(snippet);
+                }
+            }
+        }
+
+        return snippets;
+    }
+
+    /**
+     * @see javax.servlet.jsp.tagext.TagSupport#release()
+     */
+    public void release() {
+        this.query = null;
+        this.document = null;
+        this.chars = 100;
+        super.release();
+    }
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/Dev.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/Dev.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/Dev.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,157 @@
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+package org.jboss.labs.magnolia.utils;
+
+
+public class Dev implements Comparable<Dev> {
+
+        /*public final static String USER_LOGIN_ELEMENT   = "login";
+        public final static String USER_LOGINS_ELEMENT  = "logins";
+	public final static String NAME_ELEMENT		= "name";
+	public final static String TITLE_ELEMENT	= "title";
+	public final static String PROJECT_ELEMENT	= "project";
+	public final static String PROJECTS_ELEMENT	= "projects";
+	public final static String MUGSHOT_ELEMENT	= "mugshot";
+	public final static String STATUS_ELEMENT	= "status";
+	public final static String BIO_ELEMENT		= "bio";
+	public final static String COUNTRY_ELEMENT	= "country";*/
+	
+    private String username;
+    
+	private String name;
+
+	private String title;
+
+	private String mugshot;
+
+	private String status;
+
+	private String country;
+
+	private String bio;
+	
+	private String url;
+	
+	public Dev() {
+
+	}
+	
+	public String getNameForUrl() {
+	    String tmp = null;
+	    
+	    if (name != null) {
+	        tmp = name.replaceAll("\\W","");
+	        tmp = "#" + tmp;
+	    }
+	    
+	    return tmp;
+	}
+	
+	public String getNameForUrlWithoutHash() {
+	    String tmp = null;
+	        
+	    if (name != null) {
+	        tmp = name.replaceAll("\\W","");
+	    }
+	        
+	    return tmp;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getMugshot() {
+        return mugshot;
+    }
+
+    public void setMugshot(String mugshot) {
+        this.mugshot = mugshot;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public String getBio() {
+        return bio;
+    }
+
+    public void setBio(String bio) {
+        this.bio = bio;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public int compareTo(Dev dev) {
+        
+        if (this == dev) return 0;
+        
+        if (name == null) {
+            return 1;
+        }
+        
+        return name.compareTo(dev.getName());
+    }
+    
+    
+    
+}


Property changes on: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/Dev.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/DevSpotlightHelper.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/DevSpotlightHelper.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/DevSpotlightHelper.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,154 @@
+package org.jboss.labs.magnolia.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+import com.jivesoftware.community.webservices.GroupService;
+import com.jivesoftware.community.webservices.ProfileService;
+import com.jivesoftware.community.webservices.ServiceLocator;
+import com.jivesoftware.community.webservices.WSUser;
+import com.jivesoftware.community.webservices.WSUserProfile;
+
+public class DevSpotlightHelper {
+
+    public static final long TITLE_FIELD_ID = 1L;
+    
+    public static final long ADDRESS_FIELD_ID = 3L;
+    
+    public static final long BIOGRAPHY_FIELD_ID = 11L;
+    
+    //public static final long STATUS_FIELD = ;
+    
+    public static final long URL_FIELD_ID = 9L;
+    
+    /*public static final long 
+    
+    public static final long 
+    
+    public static final long 
+    public static final long*/ 
+    
+    private String url;
+    
+    private Long csGroupId;
+    
+    public Dev getRandomDev() throws Exception {
+        Dev dev = null;
+        
+        ServiceLocator locator = new ServiceLocator(url, "admin", "admin");
+        
+        GroupService groupService = locator.getGroupService();
+        WSUser[] users = groupService.getGroupMembers(csGroupId);
+
+        if (users != null) {
+            dev = new Dev();
+            
+            Random random = new Random();
+            int randNum = random.nextInt(users.length);
+            
+            WSUser user = users[randNum];
+
+            dev.setUsername(user.getUsername());
+            dev.setName(user.getName());
+            
+            ProfileService profileService = locator.getProfileService();
+            List<WSUserProfile> userProfiles = profileService.getProfile(user.getID());
+
+            if (userProfiles != null) {
+
+                for (WSUserProfile p : userProfiles) {  
+                    long fieldId = p.getFieldID();
+
+                    if (fieldId == TITLE_FIELD_ID) {
+                        dev.setTitle(p.getValue());
+                    } else if (fieldId == ADDRESS_FIELD_ID) {
+                        String address = p.getValue();
+                        for (String s : address.split(",")) {
+                            if (s.startsWith("country:")) {
+                                dev.setCountry(s.replaceFirst("country:", ""));
+                            }
+                        }
+                    } else if (fieldId == BIOGRAPHY_FIELD_ID) {
+                        dev.setBio(p.getValue());
+                    } else if (fieldId == URL_FIELD_ID) {
+                        dev.setUrl(p.getValue());
+                    }
+                }
+            }
+        }
+        
+        return dev;
+    }
+    
+    public List<Dev> getAllDevs() throws Exception {
+        List<Dev> devs = new ArrayList<Dev>();
+        
+        ServiceLocator locator = new ServiceLocator(url, "admin", "admin");
+        
+        GroupService groupService = locator.getGroupService();
+        WSUser[] users = groupService.getGroupMembers(csGroupId);
+        
+        if (users != null) {
+            
+            for (WSUser user : users) {
+                Dev dev = new Dev();
+
+                dev.setUsername(user.getUsername());
+                dev.setName(user.getName());
+                
+                ProfileService profileService = locator.getProfileService();
+                List<WSUserProfile> userProfiles = profileService.getProfile(user.getID());
+                
+                if (userProfiles != null) {
+
+                    for (WSUserProfile p : userProfiles) {  
+                        long fieldId = p.getFieldID();
+
+                        if (fieldId == TITLE_FIELD_ID) {
+                            dev.setTitle(p.getValue());
+                        } else if (fieldId == ADDRESS_FIELD_ID) {
+                            String address = p.getValue();
+                            for (String s : address.split(",")) {
+                                if (s.startsWith("country:")) {
+                                    dev.setCountry(s.replaceFirst("country:", ""));
+                                }
+                            }
+                        } else if (fieldId == BIOGRAPHY_FIELD_ID) {
+                            dev.setBio(p.getValue());
+                        } else if (fieldId == URL_FIELD_ID) {
+                            dev.setUrl(p.getValue());
+                        }
+                    }
+                }
+                
+                devs.add(dev);
+            }
+            
+            Collections.sort(devs);
+        }
+        
+        return devs;
+    }
+
+
+    public String getUrl() {
+        return url;
+    }
+    
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+    
+    public Long getCsGroupId() {
+        return csGroupId;
+    }
+    
+
+    public void setCsGroupId(Long csGroupId) {
+        this.csGroupId = csGroupId;
+    }    
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/JBossOrgSearchTag.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/JBossOrgSearchTag.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/JBossOrgSearchTag.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,427 @@
+package org.jboss.labs.magnolia.utils;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.core.search.Query;
+import info.magnolia.cms.core.search.QueryResult;
+import info.magnolia.context.MgnlContext;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jboss.labs.magnolia.Constants;
+
+import com.jivesoftware.community.JiveConstants;
+import com.jivesoftware.community.webservices.DocumentService;
+import com.jivesoftware.community.webservices.SearchService;
+import com.jivesoftware.community.webservices.ServiceLocator;
+import com.jivesoftware.community.webservices.WSDocument;
+import com.jivesoftware.community.webservices.WSJiveObject;
+import com.jivesoftware.community.webservices.WSQuery;
+
+public class JBossOrgSearchTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String RESERVED_CHARS = "()[]{}<>:/\\@*?=\"'&";
+
+    static final String[] KEYWORDS = new String[]{"and", "or"};
+
+    static final String REPOSITORY = ContentRepository.WEBSITE;
+    
+    static final String ITEM_TYPE = ItemType.CONTENT.getSystemName();
+    
+    private static final Logger logger = Logger.getLogger(JBossOrgSearchTag.class);
+    
+    private String query;
+    
+    private String searchArea;
+    
+    private String mgnlResults;
+    
+    private String csResults;
+    
+    private String pages;
+    
+    //private boolean useSimpleJcrQuery = true;
+    
+    private String startPath;
+    
+    private int scope = PageContext.PAGE_SCOPE;
+    
+    private int currentPage = 1;
+    
+    private int pageSize = Constants.PAGE_SIZE;
+    
+    private String csInstanceURL = null;
+    
+    private String csUsername = null;
+    
+    private String csPassword = null;
+
+    private ServiceLocator locator = null;
+    
+    public void setQuery(String query) {
+        this.query = query;
+    }
+    
+    public void setSearchArea(String searchArea) {
+        this.searchArea = searchArea;
+    }
+
+    public void setScope(String scope) {
+        if ("request".equalsIgnoreCase(scope)) {
+            this.scope = PageContext.REQUEST_SCOPE;
+        } else if ("session".equalsIgnoreCase(scope)) {
+            this.scope = PageContext.SESSION_SCOPE;
+        } else if ("application".equalsIgnoreCase(scope)) {
+            this.scope = PageContext.APPLICATION_SCOPE;
+        } else {
+            // default
+            this.scope = PageContext.PAGE_SCOPE;
+        }
+    }
+
+    public int doStartTag() throws JspException {
+        
+        if (logger.isDebugEnabled()) {
+            logger.debug("query: " + query);
+            logger.debug("searchArea: " + searchArea);
+            logger.debug("currentPage: " + currentPage);
+        }
+        
+        if (searchArea == null) {
+            searchArea = Constants.SEARCH_THE_ENTIRE;
+        }
+
+        int pages = 0;
+        
+        if (searchArea.equals(Constants.SEARCH_THE_ENTIRE)) {
+            this.startPath = null;
+            
+            final String queryString = generateComplexXPathQuery();
+
+            if (queryString == null) {
+                return EVAL_PAGE;
+            }
+            
+            try {
+                Query q = MgnlContext.getQueryManager(REPOSITORY).createQuery(queryString, "xpath");
+                
+                QueryResult result = q.execute();
+                Collection<Content> mgnlContent = result.getContent(ITEM_TYPE);
+                
+                List<Content> mgnlResults = getMgnlResults(mgnlContent);
+                
+                pageContext.setAttribute(this.mgnlResults, mgnlResults, scope);
+                
+                try {
+                    ServiceLocator locator = getServiceLocator();
+                    
+                    SearchService searchService = locator.getSearchService();
+                    
+                    int[] contentTypes = new int[1];
+                    
+                    contentTypes[0] = JiveConstants.DOCUMENT;
+                    WSQuery wsQuery = new WSQuery();
+                    
+                    wsQuery.setQueryString(query);
+                    wsQuery.setSortField(WSQuery.RELEVANCE);
+                    wsQuery.setSortOrder(WSQuery.DESCENDING);
+                    
+                    int searchResults = searchService.countSearchResults(wsQuery, contentTypes);
+                    
+                    if (mgnlResults.size() < pageSize && searchResults > 0) {
+                        
+                        int firstResult = 0;
+                        int ps = pageSize;
+                        
+                        int numOfMgnlPages = mgnlContent.size() / pageSize;
+                        firstResult = pageSize * ((currentPage - 1) - numOfMgnlPages);
+                        if (mgnlResults.size() > 0) {
+                            ps = ps - mgnlResults.size();
+                        }
+                        
+                        WSJiveObject[] results = searchService.search(wsQuery, contentTypes, firstResult, ps);
+                        
+                        DocumentService documentService = null;
+                        List<WSDocument> csResults = null; 
+                        if (results != null && results.length > 0) {
+                            documentService = locator.getDocumentService();
+                            csResults = new ArrayList<WSDocument>(ps);
+                        
+                            for (WSJiveObject o : results) {
+                                try {
+                                    WSDocument d = documentService.getDocumentByInternalDocID(o.getID());
+                                    
+                                    csResults.add(d);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        }    
+                        
+                        pageContext.setAttribute(this.csResults, csResults, scope);
+                    }
+                    
+                    pages = (mgnlContent.size() + searchResults) / pageSize;
+                    if ((mgnlContent.size() + searchResults) % pageSize != 0) {
+                        pages++;
+                    }
+                    
+                    pageContext.setAttribute(this.pages, String.valueOf(pages), scope);
+                } catch (Exception e) {
+                    logger.error(e.getMessage(), e);
+                }
+
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        } else if (searchArea.equals(Constants.SEARCH_THE_COMMUNITY)) {
+            try {
+                ServiceLocator locator = getServiceLocator();
+                
+                SearchService searchService = locator.getSearchService();
+                
+                int[] contentTypes = new int[1];
+                
+                contentTypes[0] = JiveConstants.DOCUMENT;
+                WSQuery wsQuery = new WSQuery();
+                
+                wsQuery.setQueryString(query);
+                wsQuery.setSortField(WSQuery.RELEVANCE);
+                wsQuery.setSortOrder(WSQuery.DESCENDING);
+                
+                int searchResults = searchService.countSearchResults(wsQuery, contentTypes);
+                
+                int firstResult = pageSize * (currentPage - 1);
+                
+                WSJiveObject[] results = searchService.search(wsQuery, contentTypes, firstResult, pageSize);
+                
+                DocumentService documentService = null;
+                List<WSDocument> csResults = null; 
+                if (results != null && results.length > 0) {
+                    documentService = locator.getDocumentService();
+                    csResults = new ArrayList<WSDocument>(pageSize);
+                
+                    for (WSJiveObject o : results) {
+                        try {
+                            WSDocument d = documentService.getDocumentByInternalDocID(o.getID());
+                            csResults.add(d);
+                        } catch (Exception e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    }
+                }
+                
+                pages = searchResults / pageSize;
+                if (searchResults % pageSize != 0) {
+                    pages++;
+                }
+                pageContext.setAttribute(this.pages, String.valueOf(pages), scope);
+                
+                pageContext.setAttribute(this.csResults, csResults, scope);
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        } else if (searchArea.equals(Constants.SEARCH_PROJECTS)) {
+            this.startPath = Constants.PROJECTS_PATH;
+            final String queryString = generateComplexXPathQuery();
+
+            System.out.println("query: " + queryString);
+            
+            if (queryString == null) {
+                return EVAL_PAGE;
+            }            
+
+            try {
+                Query q = MgnlContext.getQueryManager(REPOSITORY).createQuery(queryString, "xpath");
+                
+                QueryResult result = q.execute();
+                Collection<Content> mgnlContent = result.getContent(ITEM_TYPE);
+                
+                List<Content> mgnlResults = getMgnlResults(mgnlContent);
+                
+                pages = mgnlContent.size() / pageSize;
+                if (mgnlContent.size() % pageSize != 0) {
+                    pages++;
+                }
+                pageContext.setAttribute(this.pages, String.valueOf(pages), scope);
+                
+                pageContext.setAttribute(this.mgnlResults, mgnlResults, scope);
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+        
+        System.out.println("pages: " + pages);
+        
+        return EVAL_PAGE;
+    }
+    
+    protected List<Content> getMgnlResults(Collection<Content> content) {
+        List<Content> results = new ArrayList<Content>(pageSize);
+        
+        if (content == null) {
+            return results;
+        }
+        
+        List<Content> mgnlContent = new ArrayList<Content>(content);
+
+        int resultSize = mgnlContent.size();
+        
+        if (resultSize == 0) {
+            return results;
+        }
+        
+        int firstResult = pageSize * (currentPage - 1);
+        if (resultSize - firstResult >= pageSize) {
+            for (int i = firstResult; i < firstResult + pageSize; i++) {
+                results.add(mgnlContent.get(i));
+            }
+        } else {
+            for (int i = firstResult; i < firstResult + pageSize && i < resultSize; i++) {
+                results.add(mgnlContent.get(i));
+            }
+        }
+        
+        return results;
+    }
+    
+    protected ServiceLocator getServiceLocator() {
+        if (locator == null) {
+            locator = new ServiceLocator(csInstanceURL, csUsername, csPassword);
+        }
+        
+        return locator;
+    }
+
+    protected String generateComplexXPathQuery() {
+        return generateXPathQuery();
+    }
+
+    protected String generateXPathQuery() {
+        // strip reserved chars and split
+        String[] tokens = StringUtils.split(StringUtils.lowerCase(StringUtils.replaceChars(
+            this.query,
+            RESERVED_CHARS,
+            null)));
+
+        // null input string?
+        if (tokens == null) {
+            return null;
+        }
+
+        StringBuilder xpath = new StringBuilder(tokens.length * 20);
+        if (StringUtils.isNotEmpty(startPath)) {
+            xpath.append(startPath);
+        }
+        xpath.append("//*[@jcr:primaryType=\'mgnl:content\']//*[");
+
+        String joinOperator = "and";
+        boolean emptyQuery = true;
+
+        for (int j = 0; j < tokens.length; j++) {
+            String tkn = tokens[j];
+            if (ArrayUtils.contains(KEYWORDS, tkn)) {
+                joinOperator = tkn;
+            } else {
+                if (!emptyQuery) {
+                    xpath.append(" ");
+                    xpath.append(joinOperator);
+                    xpath.append(" ");
+                }
+                xpath.append("jcr:contains(., '");
+                
+                xpath.append(tkn);
+                
+                xpath.append("')");
+                emptyQuery = false;
+            }
+        }
+
+        xpath.append("]");
+
+        // if no valid search terms are added don't return a catch-all query
+        if (emptyQuery) {
+            return null;
+        }
+        
+        return xpath.toString();
+    }
+
+    public void release() {
+        this.query = null;
+        this.searchArea = null;
+        this.mgnlResults = null;
+        this.csResults = null;
+        this.scope = PageContext.PAGE_SCOPE;
+        super.release();
+    }
+
+    public void setMgnlResults(String mgnlResults) {
+        this.mgnlResults = mgnlResults;
+    }
+
+    public void setCsResults(String csResults) {
+        this.csResults = csResults;
+    }
+
+    public int getCurrentPage() {
+        return currentPage;
+    }
+
+    public void setCurrentPage(int currentPage) {
+        this.currentPage = currentPage;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String getPages() {
+        return pages;
+    }
+
+    public void setPages(String pages) {
+        this.pages = pages;
+    }
+
+    public String getCsInstanceURL() {
+        return csInstanceURL;
+    }
+
+    public void setCsInstanceURL(String csInstanceURL) {
+        this.csInstanceURL = csInstanceURL;
+    }
+
+    public String getCsUsername() {
+        return csUsername;
+    }
+
+    public void setCsUsername(String csUsername) {
+        this.csUsername = csUsername;
+    }
+
+    public String getCsPassword() {
+        return csPassword;
+    }
+
+    public void setCsPassword(String csPassword) {
+        this.csPassword = csPassword;
+    }
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/PaginationTag.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/PaginationTag.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/java/org/jboss/labs/magnolia/utils/PaginationTag.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,162 @@
+package org.jboss.labs.magnolia.utils;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.util.EncodingUtil;
+import org.jboss.labs.magnolia.Constants;
+
+public class PaginationTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+    
+    private int currentPage;
+    
+    private int pages;
+    
+    static final int MAX_DISPLAYED_PAGES = 20;
+
+    private String query;
+    
+    private String searchArea;
+
+    @Override
+    public int doStartTag() throws JspException {
+        /*if (!searchArea.equals(Constants.SEARCH_THE_ENTIRE) 
+                && !searchArea.equals(Constants.SEARCH_THE_COMMUNITY)
+                && !searchArea.equals(Constants.SEARCH_PROJECTS)) {
+            return EVAL_PAGE;
+        }*/
+        
+        if (currentPage > pages || currentPage <= 0) {
+            return EVAL_PAGE;
+        }
+        
+        JspWriter out = this.pageContext.getOut();
+       
+        try {
+            out.print("<ul>");
+            
+            if (currentPage != 1) {
+                createLink(1, "First", false, out);
+            }
+            
+            int beginPageIndex = 1;
+            int endPageIndex = 1;
+            if (pages <= MAX_DISPLAYED_PAGES) {
+                endPageIndex = pages; 
+            } else {
+                /*if (currentPage <= MAX_DISPLAYED_PAGES / 2) {
+                    endPageIndex = MAX_DISPLAYED_PAGES;
+                } else if (currentPage == pages) {
+                    beginPageIndex = currentPage - MAX_DISPLAYED_PAGES;
+                    endPageIndex = currentPage;
+                } else {
+                    beginPageIndex = currentPage - (MAX_DISPLAYED_PAGES / 2);
+                    endPageIndex = currentPage + (MAX_DISPLAYED_PAGES / 2 - 1);
+                }*/
+                
+                if (currentPage <= MAX_DISPLAYED_PAGES / 2 + 1) {
+                    endPageIndex = MAX_DISPLAYED_PAGES;
+                } else if ((pages - currentPage) < MAX_DISPLAYED_PAGES / 2) {
+                    beginPageIndex = pages - MAX_DISPLAYED_PAGES;
+                    endPageIndex = pages;
+                } else {
+                    beginPageIndex = currentPage - (MAX_DISPLAYED_PAGES / 2);
+                    endPageIndex = currentPage + MAX_DISPLAYED_PAGES / 2 - 1;
+                }
+            }
+            
+            for (int i = beginPageIndex; i <= endPageIndex; i++) {
+                if (i == currentPage) {
+                    createLink(i, true, out);
+                        
+                    continue;
+                }
+                    
+                createLink(i, false, out);
+            }
+            
+            if (currentPage != pages) {
+                createLink(pages, "Last", false, out);
+            }
+            
+            out.print("</ul>");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        
+        return EVAL_PAGE;
+    }
+    
+    protected void createLink(int page, boolean current, JspWriter out) throws IOException {
+        createLink(page, String.valueOf(page), current, out);
+    }
+    
+    protected void createLink(int page, String label, boolean current, JspWriter out) throws IOException {
+        
+        if (current) {
+            out.print("<li class=\"current\">" + page + "</li>");
+        } else {
+            out.print("<li><a href=\"");
+            
+            if (query != null && searchArea != null) {
+                StringBuilder url = new StringBuilder("");
+                url.append(Constants.SEARCH_PAGE).append("?");
+                    
+                NameValuePair[] pairs = new NameValuePair[3];
+                
+                NameValuePair searchArea = new NameValuePair(Constants.SEARCH_AREA, this.searchArea);
+                pairs[0] = searchArea;
+                NameValuePair q = new NameValuePair(Constants.QUERY, query);
+                pairs[1] = q;
+                NameValuePair p = new NameValuePair(Constants.PAGE, String.valueOf(page));
+                pairs[2] = p;
+                
+                url.append(EncodingUtil.formUrlEncode(pairs, "UTF-8"));
+                
+                out.print(url.toString());
+            }
+            
+            out.print("\">" + label + "</a></li>");            
+        }
+        
+    }
+
+    public int getCurrentPage() {
+        return currentPage;
+    }
+
+    public void setCurrentPage(int currentPage) {
+        this.currentPage = currentPage;
+    }
+
+    public int getPages() {
+        return pages;
+    }
+
+    public void setPages(int pages) {
+        this.pages = pages;
+    }
+
+    public String getQuery() {
+        return query;
+    }
+
+    public void setQuery(String query) {
+        this.query = query;
+    }
+
+    public String getSearchArea() {
+        return searchArea;
+    }
+
+    public void setSearchArea(String searchArea) {
+        this.searchArea = searchArea;
+    }
+    
+}

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/META-INF/jbossorg-util-taglib.tld
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/META-INF/jbossorg-util-taglib.tld	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/main/resources/META-INF/jbossorg-util-taglib.tld	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
+  <description>JBoss.org Utility Tag Library</description>
+  <display-name>JBoss.org Utility Tag Library</display-name>
+  <tlib-version>1.0</tlib-version>
+  <short-name>jbossorg</short-name>
+  <uri>jbossorg-util-taglib</uri>
+
+  <tag>
+    <name>jbossorgSearch</name>
+    <tag-class>org.jboss.labs.magnolia.utils.JBossOrgSearchTag</tag-class>
+    <body-content>empty</body-content>
+    <attribute>
+      <name>query</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>searchArea</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <description>The search results (a collection of Content nodes (pages)) will be added to the pagecontext using this name.</description>
+      <name>mgnlResults</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <description>The search results (a collection of jive objects) will be added to the pagecontext using this name.</description>
+      <name>csResults</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>pages</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <description>Scope for the variable. Can be "page" (default), "request", "session", "application".</description>
+      <name>scope</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <description>Current page number</description>
+      <name>currentPage</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>int</type>
+    </attribute>
+    <attribute>
+      <name>csInstanceURL</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>csUsername</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>csPassword</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+  </tag>
+  <tag> 
+    <name>csSearchResultSnippet</name>
+    <tag-class>org.jboss.labs.magnolia.utils.CSSearchResultSnippetTag</tag-class>
+    <body-content>empty</body-content>
+    <attribute>
+      <description>Search query.</description>
+      <name>query</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>document</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>com.jivesoftware.community.webservices.WSDocument</type>
+    </attribute>
+    <attribute>
+      <description>Number of characters to include in search snippets.</description>
+      <name>chars</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>int</type>
+    </attribute>
+  </tag>
+  <tag>
+    <name>pagination</name>
+    <tag-class>org.jboss.labs.magnolia.utils.PaginationTag</tag-class>
+    <body-content>empty</body-content>
+    <attribute>
+      <name>currentPage</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>int</type>
+    </attribute>
+    <attribute>
+      <name>pages</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>int</type>
+    </attribute>
+    <attribute>
+      <name>query</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+    <attribute>
+      <name>searchArea</name>
+      <required>true</required>
+      <rtexprvalue>true</rtexprvalue>
+    </attribute>
+  </tag>
+</taglib>

Added: labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/labs/AppTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/labs/AppTest.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/mgnl-paragraphs/src/test/java/org/jboss/labs/AppTest.java	2008-09-08 16:46:56 UTC (rev 22522)
@@ -0,0 +1,38 @@
+package org.jboss.labs;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}




More information about the jboss-svn-commits mailing list