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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Feb 18 02:21:57 EST 2008


Author: christian.bauer at jboss.com
Date: 2008-02-18 02:21:56 -0500 (Mon, 18 Feb 2008)
New Revision: 7432

Modified:
   trunk/examples/wiki/src/etc/WEB-INF/urlrewrite.xml
   trunk/examples/wiki/src/etc/i18n/messages_en.properties
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/feedAggregator/FeedAggregatorPreferences.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
   trunk/examples/wiki/view/search_d.xhtml
   trunk/examples/wiki/view/themes/default/css/template.css
   trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
   trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
Log:
Fixed search URL rewritting and submit-on-enter on search page, JBSEAM-2626

Modified: trunk/examples/wiki/src/etc/WEB-INF/urlrewrite.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/urlrewrite.xml	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/etc/WEB-INF/urlrewrite.xml	2008-02-18 07:21:56 UTC (rev 7432)
@@ -52,7 +52,7 @@
         <to last="true">/wiki.seam?nodeId=$1</to>
      </rule>
 
-    <!-- /search/foo -->
+    <!-- /search/Foo+Bar+No+Characters+Except+Space -->
     <rule>
         <from casesensitive="true">^/search/(.+)$</from>
         <to last="true">/search_%{session-attribute:skin}.seam?query=$1</to>
@@ -64,13 +64,13 @@
         <to last="true">/userInfo_%{session-attribute:skin}.seam?username=$1</to>
     </rule>
 
-    <!-- /tag/Foo Bar-->
+    <!-- /tag/Foo+Bar-->
     <rule>
         <from casesensitive="true">^/tag/(.+)$</from>
         <to last="true">/tagDisplay_%{session-attribute:skin}.seam?tag=$1</to>
     </rule>
 
-    <!-- /service/Feed/atom (/Area/Foo) (/Node/Bar) (/Comments/exclude/) (/Tag/foobar) (/Aggregate/My Aggregate) -->
+    <!-- /service/Feed/atom (/Area/Foo) (/Node/Bar) (/Comments/exclude/) (/Tag/Foo+Bar) (/Aggregate/My Aggregate) -->
     <rule>
         <from casesensitive="true">^/service/Feed/atom(?:/Area/([A-Z0-9]+[A-Za-z0-9]*))?(?:/Node/([A-Z0-9]+[A-Za-z0-9]*))?(?:/Comments/([a-z]+))?(?:/Tag/(.+))?(?:/Aggregate/(.+))?$</from>
         <to last="true">/servlets/feeds/atom.seam?areaName=$1&amp;nodeName=$2&amp;comments=$3&amp;tag=$4&amp;aggregate=$5</to>
@@ -82,7 +82,7 @@
         <to last="true">/servlets/files/download.seam?fileId=$1</to>
     </rule>
 
-    <!-- /Foo (/Bar) (/Year/2007 (/Month/08) (/Day/23) (/Page/3) (/Tag/foobar) (/Category/foobar) -->
+    <!-- /Foo (/Bar) (/Year/2007 (/Month/08) (/Day/23) (/Page/3) (/Tag/Foo+Bar) (/Category/FooBar) -->
     <rule>
         <from casesensitive="true">^/([A-Z0-9]+[A-Za-z0-9]*)(?:/([A-Z0-9]+[A-Za-z0-9]*))?(?:/Year/([0-9]{4}))?(?:/Month/([0-9]{2}))?(?:/Day/([0-9]{2}))?(?:/Page/([0-9]+))?(?:/Tag/(.+))?(?:/Category/(.+))?$</from>
         <to>/wiki.seam?areaName=$1&amp;nodeName=$2&amp;year=$3&amp;month=$4&amp;day=$5&amp;page=$6&amp;tag=$7&amp;category=$8</to>
@@ -107,11 +107,11 @@
     </rule>
     <rule>
         <from casesensitive="true">^/cgi-bin/blosxom.cgi/([0-9]{4})/([0-9]{2})/?$</from>
-        <to last="true" type="permanent-redirect">%{scheme}://%{server-name}%{context-path}/Bloggers/Everyone/$1/$2</to>
+        <to last="true" type="permanent-redirect">%{scheme}://%{server-name}%{context-path}/Bloggers/Everyone/Year/$1/Month/$2</to>
     </rule>
     <rule>
         <from casesensitive="true">^/cgi-bin/blosxom.cgi/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$</from>
-        <to last="true" type="permanent-redirect">%{scheme}://%{server-name}%{context-path}/Bloggers/Everyone/$1/$2/$3</to>
+        <to last="true" type="permanent-redirect">%{scheme}://%{server-name}%{context-path}/Bloggers/Everyone/Year/$1/Month/$2/Day/$3</to>
     </rule>
     <rule>
         <from casesensitive="true">^/cgi-bin/blosxom.cgi/index.rss$</from>

Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties	2008-02-18 07:21:56 UTC (rev 7432)
@@ -199,8 +199,7 @@
 lacewiki.label.search.Terms=Terms
 lacewiki.label.search.ExactPhrase=Exact Phrase
 lacewiki.label.search.Results=Results
-lacewiki.button.search.Find=<u>F</u>ind
-lacewiki.button.search.Find.accesskey=F
+lacewiki.button.search.Find=Find
 lacewiki.label.search.Exclude=Exclude
 lacewiki.label.search.AtAnyTime=at any time
 lacewiki.label.search.Last7Days=last 7 days
@@ -578,7 +577,7 @@
 lacewiki.label.tagEdit.NoTags=No tags defined.
 lacewiki.label.tagEdit.NoPopularTags=No popular tags available.
 lacewiki.button.tagEdit.Add=Add
-lacewiki.msg.tagEdit.TagCantContainAmpersand=Tag can not contain an ampersand.
+lacewiki.msg.tagEdit.TagCantContainSpecialCharacters=Tag can only contain alphanumeric characters.
 
 # Owner Selector
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/TagEditor.java	2008-02-18 07:21:56 UTC (rev 7432)
@@ -73,12 +73,12 @@
     }
 
     public void addNewTag() {
-        if (newTag.contains("&")) {
+        if (!newTag.matches("[\\w\\s]+")) {
             facesMessages.addToControlFromResourceBundleOrDefault(
                 "newTag",
                 FacesMessage.SEVERITY_WARN,
-                "lacewiki.msg.tagEdit.TagCantContainAmpersand",
-                "Tag can not contain an ampersand."
+                "lacewiki.msg.tagEdit.TagCantContainSpecialCharacters",
+                "Tag can only contain alphanumeric characters."
             );
         } else if (newTag.length() > 0) {
             tags.add(newTag);

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java	2008-02-18 07:21:56 UTC (rev 7432)
@@ -156,11 +156,12 @@
     }
 
     public String getDescriptionValueStrippedNoNewlines() {
+        if (getDescriptionValue() == null) return null;
         return stripHTMLTags(getDescriptionValue()).replaceAll("(\n|\r)", " ");
     }
 
     public boolean isTeaserMarkerPresent() {
-        return getDescriptionValueStripped().contains(END_TEASER_MARKER);
+        return getDescriptionValueStripped() != null && getDescriptionValueStripped().contains(END_TEASER_MARKER);
     }
 
     public String getTeaserStripped() {
@@ -202,6 +203,7 @@
     }
 
     private String stripHTMLTags(String original) {
+        if (original == null) return null;
         // Hm, that should be enough to make stuff XSS-safe?
         return original.replaceAll("\\<([a-zA-Z]|/){1}?.*?\\>","");
     }

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java	2008-02-18 07:21:56 UTC (rev 7432)
@@ -6,6 +6,7 @@
  */
 package org.jboss.seam.wiki.core.renderer;
 
+import org.jboss.seam.Component;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.In;
@@ -43,7 +44,8 @@
     public String renderSearchURL(String search) {
         if (search == null || search.length() == 0) return "";
         StringBuilder url = new StringBuilder();
-        url.append(basePath).append("/search/").append(encodeURL(search));
+        String skin = Component.getInstance("skin") != null ? (String)Component.getInstance("skin") : "d";
+        url.append(basePath).append("/search_").append(skin).append(".seam?query=").append(encodeURL(search));
         return url.toString();
     }
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/feedAggregator/FeedAggregatorPreferences.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/feedAggregator/FeedAggregatorPreferences.java	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/feedAggregator/FeedAggregatorPreferences.java	2008-02-18 07:21:56 UTC (rev 7432)
@@ -12,6 +12,7 @@
 import org.hibernate.validator.Length;
 import org.hibernate.validator.NotNull;
 import org.hibernate.validator.Range;
+import org.hibernate.validator.Pattern;
 
 /**
  * @author Christian Bauer
@@ -59,6 +60,7 @@
         visibility = {PreferenceVisibility.INSTANCE},
         editorIncludeName = "NumberRange"
     )
+    @Pattern(regex="^[a-zA-Z0-9]+[a-zA-Z0-9\\s]*")
     @Length(min = 0, max = 255)
     private String aggregateId;
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml	2008-02-18 07:21:56 UTC (rev 7432)
@@ -238,6 +238,7 @@
             by STICKY desc, LAST_POST desc
     ]]></sql-query>
 
+    <!-- TODO: Optimize this with native SQL -->
     <query name="forumTopicsReplies"><![CDATA[
         select
             t.id,

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-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java	2008-02-18 07:21:56 UTC (rev 7432)
@@ -194,6 +194,7 @@
 
     // TODO: Ouch...
     public static String removeMacros(String string) {
+        if (string == null) return null;
         String REGEX_MACRO = Pattern.quote("[") + "<=[a-z]{1}?[a-zA-Z0-9]+?" + Pattern.quote("]");
         return string.replaceAll(REGEX_MACRO, "");
 

Modified: trunk/examples/wiki/view/search_d.xhtml
===================================================================
--- trunk/examples/wiki/view/search_d.xhtml	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/view/search_d.xhtml	2008-02-18 07:21:56 UTC (rev 7432)
@@ -78,16 +78,16 @@
                     </h:selectOneMenu>
                 </h:panelGrid>
 
-                <a:commandLink id="find" styleClass="buttonNonpersistent sessionEventTrigger"
+                <a:commandButton id="find" styleClass="commandButtonNonpersistent sessionEventTrigger"
                                reRender="workspaceSwitcher, searchControl, searchPager, searchResult"
                                status="globalStatus"
                                action="#{wikiSearch.search()}"
                                oncomplete="onAjaxRequestComplete()"
-                               tabindex="1" accesskey="#{messages['lacewiki.button.search.Find.accesskey']}">
-                    <h:outputText escape="false" styleClass="buttonLabel" value="#{messages['lacewiki.button.search.Find']}"/>
+                               tabindex="1"
+                               value="#{messages['lacewiki.button.search.Find']}">
+                    <s:defaultAction/>
+                </a:commandButton>
 
-                </a:commandLink>
-
             </h:panelGrid>
 
             <s:div id="searchOptions">

Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/view/themes/default/css/template.css	2008-02-18 07:21:56 UTC (rev 7432)
@@ -449,6 +449,20 @@
     padding-bottom: 2px;
 }
 
+.commandButtonNonpersistent {
+    font-family: Verdana, Arial, Helvetica, sans-serif;
+    background: #fff url(../img/btn.nonpersistent.bg.gif) 0 0 repeat-x;
+    padding-left: 5px;
+    padding-right: 5px;
+    padding-top: 1px;
+    padding-bottom: 1px;
+    margin: 0 5px 0 5px;
+    color: #fff;
+    font-weight: bold;
+    font-size: 11px;
+    border: none;
+}
+
 .linkNavigation {
     text-decoration:none;
     font-size: 85%;

Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css	2008-02-18 07:21:56 UTC (rev 7432)
@@ -468,6 +468,20 @@
     font-size: 85%;
 }
 
+.commandButtonNonpersistent {
+    font-family: "Lucida Sans", Arial, Helvetica, sans-serif;
+    background: #fff url(../img/btn.nonpersistent.bg.gif) 0 0 repeat-x;
+    padding-left: 5px;
+    padding-right: 5px;
+    padding-top: 1px;
+    padding-bottom: 1px;
+    margin: 0 5px 0 5px;
+    color: #fff;
+    font-weight: bold;
+    font-size: 11px;
+    border: none;
+}
+
 .linkNavigation {
     text-decoration:none;
     font-size: 85%;

Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2008-02-16 15:37:41 UTC (rev 7431)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2008-02-18 07:21:56 UTC (rev 7432)
@@ -538,6 +538,20 @@
     font-size: 11px;
 }
 
+.commandButtonNonpersistent {
+    font-family:  'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+    background: #fff url(../img/btn.nonpersistent.bg.gif) 0 0 repeat-x;
+    padding-left: 5px;
+    padding-right: 5px;
+    padding-top: 1px;
+    padding-bottom: 1px;
+    margin: 0 5px 0 5px;
+    color: #fff;
+    font-weight: bold;
+    font-size: 11px;
+    border: none;
+}
+
 /* Generic Lists
 ----------------------------------------------- */
 




More information about the seam-commits mailing list