[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui ...
Christian Bauer
christian at hibernate.org
Fri Aug 17 09:00:29 EDT 2007
User: cbauer
Date: 07/08/17 09:00:29
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/ui
FeedServlet.java WikiFormattedTextHandler.java
WikiUrlRewriteFilter.java Converters.java
UIWikiFormattedText.java
Log:
Major refactoring of core data schema and some new features
Revision Changes Path
1.7 +7 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FeedServlet.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FeedServlet.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FeedServlet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- FeedServlet.java 4 Jun 2007 08:07:29 -0000 1.6
+++ FeedServlet.java 17 Aug 2007 13:00:29 -0000 1.7
@@ -1,3 +1,9 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.core.ui;
import com.sun.syndication.feed.synd.*;
@@ -55,7 +61,7 @@
syndFeed.setFeedType(feedType);
syndFeed.setTitle(feed.getTitle());
syndFeed.setLink(request.getRequestURL().toString() + "?feedId=" + feedId);
- syndFeed.setDescription(feed.getDescription());
+ syndFeed.setAuthor(feed.getAuthor());
syndFeed.setPublishedDate(feed.getPublishedDate());
// Create feed entries
1.10 +15 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiFormattedTextHandler.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- WikiFormattedTextHandler.java 6 Jul 2007 14:38:38 -0000 1.9
+++ WikiFormattedTextHandler.java 17 Aug 2007 13:00:29 -0000 1.10
@@ -1,3 +1,9 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.core.ui;
import java.io.IOException;
@@ -33,6 +39,7 @@
* text with real plugin includes/JSF components in the tree.
*
* @author Peter Muir
+ * @author Christian Bauer
*/
public class WikiFormattedTextHandler extends MetaTagHandler {
@@ -86,6 +93,7 @@
setAttribute(ctx, cmp, UIWikiFormattedText.ATTR_UPDATE_RESOLVED_LINKS);
setAttribute(ctx, cmp, UIWikiFormattedText.ATTR_RENDER_BASE_DOCUMENT);
setAttribute(ctx, cmp, UIWikiFormattedText.ATTR_RENDER_BASE_DIRECTORY);
+ setAttribute(ctx, cmp, UIWikiFormattedText.ATTR_ENABLE_PLUGINS);
}
private void setAttribute(FaceletContext ctx, UIComponent cmp, String name) {
@@ -122,6 +130,13 @@
UIWikiFormattedText wikiFormattedText = (UIWikiFormattedText) parent;
String unparsed = valueAttribute.getValue(ctx);
+
+ if (getAttribute(UIWikiFormattedText.ATTR_ENABLE_PLUGINS) == null ||
+ !getAttribute(UIWikiFormattedText.ATTR_ENABLE_PLUGINS).getValue().equals("true")) {
+ wikiFormattedText.setValue(unparsed);
+ return;
+ }
+
Matcher matcher = Pattern.compile(REGEX_MACRO).matcher(unparsed);
StringBuffer parsed = new StringBuffer();
while (matcher.find()) {
1.2 +12 -2 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUrlRewriteFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiUrlRewriteFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUrlRewriteFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- WikiUrlRewriteFilter.java 11 Jul 2007 22:44:13 -0000 1.1
+++ WikiUrlRewriteFilter.java 17 Aug 2007 13:00:29 -0000 1.2
@@ -1,3 +1,9 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.core.ui;
import org.jboss.seam.ScopeType;
@@ -14,13 +20,17 @@
import java.util.Collections;
import java.util.Map;
+/**
+ * Adapts the Tuckey URLRewrite filter to the Seam filter chain.
+ *
+ * @author Christian Bauer
+ */
@Startup
@Scope(ScopeType.APPLICATION)
@Name("wikiUrlRewriteFilter")
@BypassInterceptors
@Filter(within = "org.jboss.seam.web.ajax4jsfFilter")
- at Install(classDependencies = "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter",
- precedence = Install.APPLICATION)
+ at Install(classDependencies = "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter", precedence = Install.APPLICATION)
public class WikiUrlRewriteFilter extends AbstractFilter {
private UrlRewriteFilter urlRewriteFilter;
1.8 +8 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Converters.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Converters.java 25 Jun 2007 23:19:01 -0000 1.7
+++ Converters.java 17 Aug 2007 13:00:29 -0000 1.8
@@ -1,3 +1,9 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.core.ui;
import org.jboss.seam.annotations.Name;
@@ -78,6 +84,7 @@
@Name("treeNodeAdapter")
public static class TreeNodeAdapter {
+ /* TODO: Fixme
@Factory(value = "writableDirectoryTree", scope = ScopeType.CONVERSATION, autoCreate = true)
public TreeNode loadWritableDirectoryTree() {
Directory wikiroot = (Directory) Component.getInstance("restrictedWikiRoot");
@@ -131,6 +138,7 @@
// Immutable
}
}
+ */
}
1.26 +11 -7 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIWikiFormattedText.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- UIWikiFormattedText.java 6 Jul 2007 14:38:38 -0000 1.25
+++ UIWikiFormattedText.java 17 Aug 2007 13:00:29 -0000 1.26
@@ -1,3 +1,9 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.seam.wiki.core.ui;
import java.io.IOException;
@@ -9,21 +15,18 @@
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.el.ExpressionFactory;
import org.jboss.seam.Component;
-import org.jboss.seam.el.SeamExpressionFactory;
import org.jboss.seam.ui.util.JSF;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Conversation;
-import org.jboss.seam.core.Expressions;
import org.jboss.seam.wiki.core.engine.WikiLink;
import org.jboss.seam.wiki.core.engine.WikiTextParser;
import org.jboss.seam.wiki.core.engine.WikiTextRenderer;
import org.jboss.seam.wiki.core.engine.WikiLinkResolver;
import org.jboss.seam.wiki.core.model.File;
import org.jboss.seam.wiki.core.model.Document;
-import org.jboss.seam.wiki.core.model.Directory;
+import org.jboss.seam.wiki.core.model.Node;
import org.jboss.seam.wiki.util.WikiUtil;
public class UIWikiFormattedText extends UIOutput {
@@ -35,6 +38,7 @@
public static final String ATTR_UPDATE_RESOLVED_LINKS = "updateResolvedLinks";
public static final String ATTR_RENDER_BASE_DOCUMENT = "renderBaseDocument";
public static final String ATTR_RENDER_BASE_DIRECTORY = "renderBaseDirectory";
+ public static final String ATTR_ENABLE_PLUGINS = "enablePlugins";
private List<String> plugins;
@@ -71,7 +75,7 @@
// Resolve the base document and directory we are resolving against
final Document baseDocument = (Document)getAttributes().get(ATTR_RENDER_BASE_DOCUMENT);
- final Directory baseDirectory = (Directory)getAttributes().get(ATTR_RENDER_BASE_DIRECTORY);
+ final Node baseDirectory = (Node)getAttributes().get(ATTR_RENDER_BASE_DIRECTORY);
parser.setCurrentDocument(baseDocument);
parser.setCurrentDirectory(baseDirectory);
@@ -91,11 +95,11 @@
public String renderExternalLink(WikiLink externalLink) {
return "<a href=\""
- + externalLink.getUrl()
+ + WikiUtil.escapeEmailAddress(externalLink.getUrl())
+ "\" class=\""
+ (externalLink.isBroken() ? getAttributes().get(ATTR_BROKEN_LINK_STYLE_CLASS)
: getAttributes().get(ATTR_LINK_STYLE_CLASS)) + "\">"
- + externalLink.getDescription() + "</a>";
+ + WikiUtil.escapeEmailAddress(externalLink.getDescription()) + "</a>";
}
public String renderFileAttachmentLink(int attachmentNumber, WikiLink attachmentLink) {
More information about the jboss-cvs-commits
mailing list