Seam SVN: r8389 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-06-19 13:13:15 -0400 (Thu, 19 Jun 2008)
New Revision: 8389
Modified:
trunk/src/main/org/jboss/seam/persistence-2.1.xsd
Log:
JBSEAM-3082
Modified: trunk/src/main/org/jboss/seam/persistence-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/persistence-2.1.xsd 2008-06-19 17:12:48 UTC (rev 8388)
+++ trunk/src/main/org/jboss/seam/persistence-2.1.xsd 2008-06-19 17:13:15 UTC (rev 8389)
@@ -47,6 +47,7 @@
<xs:element name="mapping-jars" type="components:multiValuedProperty"/>
<xs:element name="mapping-packages" type="components:multiValuedProperty"/>
<xs:element name="mapping-resources" type="components:multiValuedProperty"/>
+ <xs:element name="naming-strategy" type="components:expressionType"/>
<xs:element name="cfg-properties" type="components:mapProperty"/>
</xs:choice>
<xs:attributeGroup ref="persistence:attlist.HibernateSessionFactory"/>
16 years, 3 months
Seam SVN: r8388 - branches/Seam_2_0/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-06-19 13:12:48 -0400 (Thu, 19 Jun 2008)
New Revision: 8388
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/persistence-2.0.xsd
Log:
JBSEAM-3082
Modified: branches/Seam_2_0/src/main/org/jboss/seam/persistence-2.0.xsd
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/persistence-2.0.xsd 2008-06-19 16:58:51 UTC (rev 8387)
+++ branches/Seam_2_0/src/main/org/jboss/seam/persistence-2.0.xsd 2008-06-19 17:12:48 UTC (rev 8388)
@@ -48,6 +48,7 @@
<xs:element name="mapping-jars" type="components:multiValuedProperty"/>
<xs:element name="mapping-packages" type="components:multiValuedProperty"/>
<xs:element name="mapping-resources" type="components:multiValuedProperty"/>
+ <xs:element name="naming-strategy" type="xs:string"/>
<xs:element name="cfg-properties" type="components:mapProperty"/>
</xs:choice>
<xs:attributeGroup ref="persistence:attlist.HibernateSessionFactory"/>
16 years, 3 months
Seam SVN: r8387 - trunk.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-19 12:58:51 -0400 (Thu, 19 Jun 2008)
New Revision: 8387
Modified:
trunk/seam-text.g
Log:
Another NPE
Modified: trunk/seam-text.g
===================================================================
--- trunk/seam-text.g 2008-06-19 14:57:46 UTC (rev 8386)
+++ trunk/seam-text.g 2008-06-19 16:58:51 UTC (rev 8387)
@@ -293,7 +293,7 @@
}
// CSS property value
- if (!stylePropertiesValues.contains(propertyValue)) {
+ if (propertyValue != null && !stylePropertiesValues.contains(propertyValue)) {
// Not in list, now check the regex
if (!REGEX_VALID_CSS_VALUE.matcher(propertyValue).matches()) {
throw new SemanticException(getInvalidAttributeValueMessage(elementName, attributeName, attributeValue));
16 years, 3 months
Seam SVN: r8386 - in trunk/examples/wiki: src/etc/i18n and 30 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-19 10:57:46 -0400 (Thu, 19 Jun 2008)
New Revision: 8386
Added:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Validatable.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextEditor.java
trunk/examples/wiki/view/includes/wikitext/
trunk/examples/wiki/view/includes/wikitext/editor/
trunk/examples/wiki/view/includes/wikitext/editor/editor.xhtml
trunk/examples/wiki/view/includes/wikitext/editor/preview.xhtml
Removed:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextPreview.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextValidator.java
trunk/examples/wiki/view/includes/wikiTextEditor.xhtml
trunk/examples/wiki/view/includes/wikiTextPreview.xhtml
Modified:
trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHistory.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/DocumentEditorPreferences.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiDocumentFeedEntryManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchSupport.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/i18n/messages_faqBrowser_en.properties
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqQuestionForm.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/replyForm.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReply.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReply.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReply.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/DocumentHistoryTests.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/EditMacros.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Linking.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/feeds/DocumentFeedTests.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java
trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/preferences/InstancePreferencesTests.java
trunk/examples/wiki/view/docDisplay_d.xhtml
trunk/examples/wiki/view/docDisplay_m.xhtml
trunk/examples/wiki/view/docEdit_d.xhtml
trunk/examples/wiki/view/docHistory_d.xhtml
trunk/examples/wiki/view/includes/commentForm.xhtml
trunk/examples/wiki/view/includes/commentsDisplay.xhtml
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/themes/default/js/lacewiki.js
trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
trunk/examples/wiki/view/userHome_d.xhtml
Log:
Another complete rewrite of the wiki text editor, now supports plaintext
Modified: trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -133,10 +133,11 @@
<function-signature>java.lang.String escapeAtSymbol(java.lang.String)</function-signature>
</function>
+ <!-- There is a reason why this HTML is uppercase, I forgot... -->
<function>
<function-name>escapeHTML</function-name>
<function-class>org.jboss.seam.wiki.util.WikiUtil</function-class>
- <function-signature>java.lang.String escapeHtml(java.lang.String,boolean)</function-signature>
+ <function-signature>java.lang.String escapeHtml(java.lang.String,boolean,boolean)</function-signature>
</function>
<function>
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-06-19 14:57:46 UTC (rev 8386)
@@ -213,7 +213,10 @@
# Wiki Text Editor
lacewiki.label.wikiTextEditor.CharactersLeft=chars left
+lacewiki.label.wikiTextEditor.DisableContentMarkup=Let me type some plain text, not markup
+lacewiki.label.wikiTextEditor.EnableLivePreview=Enable live preview
lacewiki.msg.wikiTextEditor.EditThisText=Click HELP for text formatting instructions. Then edit this text and check the preview.
+lacewiki.msg.wikiTextEditor.MarkupDisabled=Formatting disabled!
lacewiki.msg.wikiTextEditor.FormatSelection=Format selected text...
lacewiki.msg.wikiTextEditor.FormatInline=-------- Inline --------
lacewiki.msg.wikiTextEditor.FormatMonospace=Monospace/Code
@@ -232,14 +235,9 @@
lacewiki.msg.wikiTextEditor.FormatHeadline2=Headline 2
lacewiki.msg.wikiTextEditor.FormatHeadline3=Headline 3
lacewiki.msg.wikiTextEditor.FormatHeadline4=Headline 4
-lacewiki.button.wikiTextEditor.EnablePreview=Pre<u>v</u>iew On
-lacewiki.button.wikiTextEditor.EnablePreview.accesskey=V
-lacewiki.button.wikiTextEditor.DisablePreview=Pre<u>v</u>iew Off
-lacewiki.button.wikiTextEditor.DisablePreview.accesskey=V
-lacewiki.button.wikiTextEditor.Validate=<u>C</u>heck
-lacewiki.button.wikiTextEditor.Validate.accesskey=C
lacewiki.msg.wikiTextValidator.InvalidWikiText=Invalid wiki text, please click HELP for formatting instructions.
lacewiki.msg.wikiTextValidator.EmptyWikiText=Please enter wiki text, field can not be empty.
+lacewiki.msg.wikiTextValidator.MaxLengthExceeded=Too much content, please shorten the text.
# Document Display
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -22,7 +22,7 @@
import org.jboss.seam.wiki.core.action.prefs.CommentsPreferences;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
+import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.util.WikiUtil;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
@@ -49,8 +49,9 @@
/* -------------------------- Internal State ------------------------------ */
@RequestParameter
- private Long parentCommentId;
- private boolean showForm = false;
+ protected Long parentCommentId;
+ protected boolean showForm = false;
+ protected WikiTextEditor textEditor = new WikiTextEditor("comment", 32767, true, true);
/* -------------------------- Basic Overrides ------------------------------ */
@@ -60,6 +61,11 @@
}
@Override
+ protected String getEditorWorkspaceDescription(boolean create) {
+ return null;
+ }
+
+ @Override
public Class<WikiComment> getEntityClass() {
return WikiComment.class;
}
@@ -112,6 +118,20 @@
/* -------------------------- Custom CUD ------------------------------ */
@Override
+ public boolean beforePersist() {
+
+ getInstance().setContent(
+ textEditor.getValueAndConvertLinks(getParentNode().getAreaNumber())
+ );
+
+ if (textEditor.isValuePlaintext()) {
+ getInstance().setUseWikiText(false);
+ }
+
+ return true;
+ }
+
+ @Override
public String persist() {
String outcome = super.persist();
if (outcome != null) {
@@ -166,9 +186,19 @@
return (CommentNodeRemover)Component.getInstance(CommentNodeRemover.class);
}
-/* -------------------------- Messages ------------------------------ */
+ @Override
+ protected Validatable[] getUpdateValidations() {
+ return new Validatable[] { textEditor };
+ }
@Override
+ protected Validatable[] getPersistValidations() {
+ return new Validatable[] { textEditor };
+ }
+
+ /* -------------------------- Messages ------------------------------ */
+
+ @Override
protected void createdMessage() {
StatusMessages.instance().addFromResourceBundleOrDefault(
INFO,
@@ -198,10 +228,6 @@
);
}
- protected String getEditorWorkspaceDescription(boolean create) {
- return null;
- }
-
/* -------------------------- Internal Methods ------------------------------ */
protected void endConversation() {
@@ -245,33 +271,6 @@
return quoted.toString();
}
- @Override
- protected WikiTextValidator.ValidationCommand[] getPersistValidationCommands() {
- return new WikiTextValidator.ValidationCommand[] {
- new WikiTextValidator.ValidationCommand() {
- public String getKey() {
- return "comment";
- }
-
- public String getWikiTextValue() {
- return getInstance().getContent();
- }
-
- public boolean getWikiTextRequired() {
- return true;
- }
- }
- };
- }
-
- protected String getValidationRequiredWikiTextEditorId() {
- return "comment";
- }
-
- protected String getValidationRequiredWikiText() {
- return getInstance().getContent();
- }
-
/* -------------------------- Public Features ------------------------------ */
public boolean isShowForm() {
@@ -286,11 +285,13 @@
public void newComment() {
initEditor(false);
showForm = true;
+ textEditor.setValue(getInstance().getContent());
}
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void replyTo() {
prepareReply();
+ textEditor.setValue(getInstance().getContent());
WikiRedirect.instance()
.setWikiDocument(documentHome.getInstance())
.setPropagateConversation(true)
@@ -301,6 +302,7 @@
public void quote() {
prepareReply();
setQuotedContent((WikiComment)getParentNode());
+ textEditor.setValue(getInstance().getContent());
WikiRedirect.instance()
.setWikiDocument(documentHome.getInstance())
.setPropagateConversation(true)
@@ -312,10 +314,11 @@
throw new InvalidWikiRequestException("Missing parentCommentId request parameter");
getLog().debug("reply to comment id: " + parentCommentId);
- newComment();
+ initEditor(false);
+ showForm = true;
setParentNodeId(parentCommentId);
- getInstance(); // Init the parent
+ getInstance(); // Init the parent, has to happen here
setReplySubject((WikiComment)getParentNode());
}
@@ -366,4 +369,8 @@
}
}
+ public WikiTextEditor getTextEditor() {
+ return textEditor;
+ }
+
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHistory.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHistory.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHistory.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -165,7 +165,7 @@
if (delEnd != Diff.NONE) {
result.append("<div class=\"diffDeleted\">");
for (int lnum = delStart; lnum <= delEnd; ++lnum) {
- result.append( WikiUtil.escapeHtml(a[lnum], false) ).append("<br/>");
+ result.append( WikiUtil.escapeHtml(a[lnum], false, false) ).append("<br/>");
}
result.append("</div>");
if (addEnd != Diff.NONE) {
@@ -175,7 +175,7 @@
if (addEnd != Diff.NONE) {
result.append("<div class=\"diffAdded\">");
for (int lnum = addStart; lnum <= addEnd; ++lnum) {
- result.append( WikiUtil.escapeHtml(b[lnum], false) ).append("<br/>");
+ result.append( WikiUtil.escapeHtml(b[lnum], false, false) ).append("<br/>");
}
result.append("</div>");
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -19,16 +19,14 @@
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
import org.jboss.seam.wiki.core.feeds.FeedDAO;
import org.jboss.seam.wiki.core.feeds.FeedEntryManager;
-import org.jboss.seam.wiki.core.wikitext.engine.WikiLinkResolver;
import org.jboss.seam.wiki.core.wikitext.renderer.MacroWikiTextRenderer;
import org.jboss.seam.wiki.core.model.*;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
import org.jboss.seam.wiki.core.template.TemplateRegistry;
import org.jboss.seam.wiki.core.template.WikiDocumentTemplate;
import org.jboss.seam.wiki.core.template.WikiDocumentEditorDefaults;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
+import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.preferences.Preferences;
-import org.hibernate.validator.Length;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
@@ -46,19 +44,20 @@
private FeedDAO feedDAO;
@In
private TagEditor tagEditor;
+ @In("#{preferences.get('DocEditor')}")
+ private DocumentEditorPreferences docEditorPreferences;
/* -------------------------- Internal State ------------------------------ */
- private WikiDocument historicalCopy;
- private Boolean minorRevision;
- private String formContent;
- private Set<WikiFile> linkTargets;
- private boolean pushOnFeeds = false;
- private boolean pushOnSiteFeed = false;
- private boolean isOnSiteFeed = false;
- private List<WikiFile> historicalFiles;
- private Long numOfHistoricalFiles = 0l;
- private String templateType;
+ protected WikiTextEditor textEditor = new WikiTextEditor("content");
+ protected WikiDocument historicalCopy;
+ protected Boolean minorRevision;
+ protected boolean pushOnFeeds = false;
+ protected boolean pushOnSiteFeed = false;
+ protected boolean isOnSiteFeed = false;
+ protected List<WikiFile> historicalFiles;
+ protected Long numOfHistoricalFiles = 0l;
+ protected String templateType;
/* -------------------------- Basic Overrides ------------------------------ */
@@ -125,6 +124,8 @@
doc.setEnableComments( Preferences.instance().get(CommentsPreferences.class).getEnableByDefault() );
+ syncInstanceToEditor(getParentNode().getAreaNumber(), doc);
+
return doc;
}
@@ -156,23 +157,36 @@
isOnSiteFeed = feedDAO.isOnSiteFeed(doc);
+ syncInstanceToEditor(getParentNode().getAreaNumber(), doc);
+ copyHistoricalRevision(doc);
+
return doc;
}
+ @Override
+ protected String getEditorWorkspaceDescription(boolean create) {
+ if (create) {
+ return Messages.instance().get("lacewiki.label.docEdit.CreateDocument");
+ } else {
+ return Messages.instance().get("lacewiki.label.docEdit.EditDocument") + ":" + getInstance().getName();
+ }
+ }
+
/* -------------------------- Custom CUD ------------------------------ */
@Override
protected boolean beforePersist() {
- // Sync document content
- syncFormContentToInstance(getParentNode());
- syncLinks();
- // Make a copy
- historicalCopy = new WikiDocument();
- historicalCopy.flatCopy(getInstance(), true);
+ syncEditorToInstance(getParentNode().getAreaNumber(), getInstance());
+ syncMacros(getInstance());
+ copyHistoricalRevision(getInstance());
purgeFeedEntries();
+ // Plain text can only be set on persist(), never changed later with update()
+ if (textEditor.isValuePlaintext())
+ getInstance().addHeaderMacro(new WikiTextMacro(WikiDocument.MACRO_DISABLE_CONTENT_MARKUP));
+
return true;
}
@@ -200,9 +214,8 @@
@Override
protected boolean beforeUpdate() {
- // Sync document content
- syncFormContentToInstance(getParentNode());
- syncLinks();
+ syncEditorToInstance(getParentNode().getAreaNumber(), getInstance());
+ syncMacros(getInstance());
// Update feed entries
if (isPushOnFeeds()) {
@@ -234,12 +247,11 @@
historicalCopy.setLastModifiedBy(getCurrentUser());
getWikiNodeDAO().persistHistoricalFile(historicalCopy);
getInstance().incrementRevision();
- // New historical copy in conversation
- historicalCopy = new WikiDocument();
- historicalCopy.flatCopy(getInstance(), true);
+ copyHistoricalRevision(getInstance());
+
// Reset form
- setMinorRevision( Preferences.instance().get(DocumentEditorPreferences.class).getMinorRevisionEnabled() );
+ setMinorRevision( docEditorPreferences.getMinorRevisionEnabled() );
}
return true;
@@ -254,32 +266,15 @@
protected NodeRemover getNodeRemover() {
return (DocumentNodeRemover)Component.getInstance(DocumentNodeRemover.class);
}
-
@Override
- protected WikiTextValidator.ValidationCommand[] getPersistValidationCommands() {
- return getValidationCommands();
- }
- protected WikiTextValidator.ValidationCommand[] getUpdateValidationCommands() {
- return getValidationCommands();
+ protected Validatable[] getUpdateValidations() {
+ return new Validatable[] { textEditor };
}
- private WikiTextValidator.ValidationCommand[] getValidationCommands() {
- return new WikiTextValidator.ValidationCommand[] {
- new WikiTextValidator.ValidationCommand() {
- public String getKey() {
- return "content";
- }
-
- public String getWikiTextValue() {
- return getFormContent();
- }
-
- public boolean getWikiTextRequired() {
- return true;
- }
- }
- };
+ @Override
+ protected Validatable[] getPersistValidations() {
+ return new Validatable[] { textEditor };
}
@@ -315,14 +310,6 @@
);
}
- protected String getEditorWorkspaceDescription(boolean create) {
- if (create) {
- return Messages.instance().get("lacewiki.label.docEdit.CreateDocument");
- } else {
- return Messages.instance().get("lacewiki.label.docEdit.EditDocument") + ":" + getInstance().getName();
- }
- }
-
/* -------------------------- Internal Methods ------------------------------ */
protected void findHistoricalFiles(WikiDocument doc) {
@@ -347,47 +334,22 @@
}
}
- private void syncLinks() {
- if (linkTargets != null) getInstance().setOutgoingLinks(linkTargets);
+ public void syncEditorToInstance(Long areaNumber, WikiDocument doc) {
+ doc.setContent(textEditor.getValueAndConvertLinks(areaNumber));
+ if (textEditor.getLinkTargets() != null)
+ doc.setOutgoingLinks(textEditor.getLinkTargets());
}
- public void syncMacros(WikiDocument doc) {
- if (doc.getHeader() != null) {
- MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getHeader());
- doc.setHeaderMacros(renderer.getMacros());
- }
- if (doc.getContent() != null) {
- MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getContent());
- doc.setContentMacros(renderer.getMacros());
- }
- if (doc.getFooter() != null) {
- MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getFooter());
- doc.setFooterMacros(renderer.getMacros());
- }
+ public void syncInstanceToEditor(Long areaNumber, WikiDocument doc) {
+ textEditor.setValueAndConvertLinks(areaNumber, doc.getContent());
+ textEditor.setRows(docEditorPreferences.getRegularEditAreaRows().intValue());
}
- private void syncFormContentToInstance(WikiDirectory dir) {
- if (formContent != null) {
- getLog().debug("sync form content to instance");
- WikiLinkResolver wikiLinkResolver = (WikiLinkResolver)Component.getInstance("wikiLinkResolver");
- linkTargets = new HashSet<WikiFile>();
- getInstance().setContent(
- wikiLinkResolver.convertToWikiProtocol(linkTargets, dir.getAreaNumber(), formContent)
- );
- syncMacros(getInstance());
- }
+ protected void copyHistoricalRevision(WikiDocument doc) {
+ historicalCopy = new WikiDocument();
+ historicalCopy.flatCopy(doc, true);
}
- private void syncInstanceToFormContent(WikiDirectory dir) {
- getLog().debug("sync instance to form in area: " + dir.getAreaNumber());
- WikiLinkResolver wikiLinkResolver = (WikiLinkResolver)Component.getInstance("wikiLinkResolver");
- formContent = wikiLinkResolver.convertFromWikiProtocol(dir.getAreaNumber(), getInstance().getContent());
- if (historicalCopy == null) {
- getLog().debug("making a history copy of the document");
- historicalCopy = new WikiDocument();
- historicalCopy.flatCopy(getInstance(), true);
- }
- }
protected String getFeedEntryManagerName() {
return "wikiDocumentFeedEntryManager";
@@ -401,27 +363,27 @@
feedDAO.purgeOldFeedEntries(oldestDate.getTime());
}
- /* -------------------------- Public Features ------------------------------ */
+/* -------------------------- Public Features ------------------------------ */
- // TODO: We need to duplicate this here, otherwise it will only validated on persist(): http://jira.jboss.com/jira/browse/JBSEAM-2671
- @Length(min = 0, max = 32767)
- public String getFormContent() {
- // Load the document content and resolve links
- if (formContent == null) syncInstanceToFormContent(getParentNode());
- return formContent;
- }
-
- public void setFormContent(String formContent) {
- this.formContent = formContent;
- if (formContent != null) {
- syncFormContentToInstance(getParentNode());
+ public void syncMacros(WikiDocument doc) {
+ if (doc.getHeader() != null) {
+ MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getHeader());
+ doc.setHeaderMacros(renderer.getMacros());
}
+ if (doc.getContent() != null) {
+ MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getContent());
+ doc.setContentMacros(renderer.getMacros());
+ }
+ if (doc.getFooter() != null) {
+ MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(doc.getFooter());
+ doc.setFooterMacros(renderer.getMacros());
+ }
}
public boolean isMinorRevision() {
// Lazily initalize preferences
if (minorRevision == null)
- minorRevision = Preferences.instance().get(DocumentEditorPreferences.class).getMinorRevisionEnabled();
+ minorRevision = docEditorPreferences.getMinorRevisionEnabled();
return minorRevision;
}
public void setMinorRevision(boolean minorRevision) { this.minorRevision = minorRevision; }
@@ -446,16 +408,6 @@
this.pushOnSiteFeed = pushOnSiteFeed;
}
- public void setShowPluginPrefs(boolean showPluginPrefs) {
- Contexts.getPageContext().set("showPluginPreferences", showPluginPrefs);
- }
-
- // TODO: Move this into WikiTextEditor.java
- public boolean isShowPluginPrefs() {
- Boolean showPluginPrefs = (Boolean)Contexts.getPageContext().get("showPluginPreferences");
- return showPluginPrefs != null && showPluginPrefs;
- }
-
public boolean isHistoricalFilesPresent() {
return numOfHistoricalFiles != null && numOfHistoricalFiles> 0;
}
@@ -475,4 +427,8 @@
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
+
+ public WikiTextEditor getTextEditor() {
+ return textEditor;
+ }
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -19,7 +19,6 @@
import org.jboss.seam.wiki.core.model.*;
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
import org.jboss.seam.wiki.util.WikiUtil;
import org.jboss.seam.wiki.preferences.Preferences;
import org.jboss.seam.international.StatusMessages;
@@ -52,15 +51,12 @@
protected User currentUser;
@In
protected List<Role.AccessLevel> accessLevelsList;
- @In
- protected WikiTextValidator wikiTextValidator;
public WikiNodeDAO getWikiNodeDAO() { return wikiNodeDAO; }
public UserDAO getUserDAO() { return userDAO; }
public WikiDirectory getWikiRoot() { return wikiRoot; }
public User getCurrentUser() { return currentUser; }
public List<Role.AccessLevel> getAccessLevelsList() { return accessLevelsList; }
- public WikiTextValidator getWikiTextValidator() { return wikiTextValidator; }
/* -------------------------- Request Wiring ------------------------------ */
@@ -221,7 +217,7 @@
public String persist() {
checkPersistPermissions();
- if (!validateWikiTexts(getPersistValidationCommands())) return null;
+ if (!validateComponents(getPersistValidations())) return null;
if (!preparePersist()) return null;
@@ -256,7 +252,7 @@
public String update() {
checkUpdatePermissions();
- if (!validateWikiTexts(getUpdateValidationCommands())) return null;
+ if (!validateComponents(getUpdateValidations())) return null;
if (!prepareUpdate()) return null;
@@ -418,22 +414,21 @@
return Identity.instance().hasPermission("Node", "edit", node);
}
- protected boolean validateWikiTexts(WikiTextValidator.ValidationCommand[] validationCommands) {
- if (validationCommands == null) return true;
-
+ protected boolean validateComponents(Validatable validatableComponents[]) {
+ if (validatableComponents == null) return true;
boolean allValid = true;
- for (WikiTextValidator.ValidationCommand validationCommand : validationCommands) {
- getWikiTextValidator().validate(validationCommand);
- allValid = getWikiTextValidator().isValid(validationCommand.getKey());
+ for (Validatable validatableComponent : validatableComponents) {
+ validatableComponent.validate();
+ allValid = validatableComponent.isValid();
}
return allValid;
}
- protected WikiTextValidator.ValidationCommand[] getUpdateValidationCommands() {
+ protected Validatable[] getUpdateValidations() {
return null;
}
- protected WikiTextValidator.ValidationCommand[] getPersistValidationCommands() {
+ protected Validatable[] getPersistValidations() {
return null;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -28,7 +28,7 @@
import org.jboss.seam.wiki.core.model.WikiUploadImage;
import org.jboss.seam.wiki.core.upload.Uploader;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
+import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.preferences.PreferenceVisibility;
import org.jboss.seam.wiki.preferences.Preferences;
import org.jboss.seam.wiki.preferences.PreferenceProvider;
@@ -73,6 +73,8 @@
private org.jboss.seam.wiki.core.model.Role defaultRole;
private Uploader uploader;
private String requestedUsername;
+ private WikiTextEditor bioTextEditor;
+ private WikiTextEditor signatureTextEditor;
public Uploader getUploader() {
return uploader;
@@ -117,6 +119,13 @@
if (defaultRole == null) defaultRole = (Role)Component.getInstance("newUserDefaultRole");
}
+
+ if (bioTextEditor == null || signatureTextEditor == null) {
+ bioTextEditor = new WikiTextEditor("bio", 1023, false, false, 5);
+ signatureTextEditor = new WikiTextEditor("signature", 1023, false, false, 5);
+ syncInstanceToWikiTextEditors();
+ }
+
}
public void initEdit() {
@@ -170,6 +179,8 @@
return null;
}
+ syncWikiTextEditorsToInstance();
+
// Assign default role
getInstance().getRoles().add(defaultRole);
@@ -222,6 +233,8 @@
return null;
}
+ syncWikiTextEditorsToInstance();
+
if (uploader.hasData()) {
uploader.uploadNewInstance();
if (WikiUploadImage.class.isAssignableFrom(uploader.getUpload().getClass())) {
@@ -348,14 +361,20 @@
);
}
- protected boolean validateWikiTextEditors() {
- WikiTextValidator wikiTextValidator =
- (WikiTextValidator) Component.getInstance(WikiTextValidator.class);
+ protected void syncInstanceToWikiTextEditors() {
+ bioTextEditor.setValue(getInstance().getProfile().getBio());
+ signatureTextEditor.setValue(getInstance().getProfile().getSignature());
+ }
- wikiTextValidator.validate("bio", getInstance().getProfile().getBio(), false);
- wikiTextValidator.validate("signature", getInstance().getProfile().getSignature(), false);
+ protected void syncWikiTextEditorsToInstance() {
+ getInstance().getProfile().setBio(bioTextEditor.getValue());
+ getInstance().getProfile().setSignature(signatureTextEditor.getValue());
+ }
- return wikiTextValidator.isValid("bio") && wikiTextValidator.isValid("signature");
+ protected boolean validateWikiTextEditors() {
+ bioTextEditor.validate();
+ signatureTextEditor.validate();
+ return bioTextEditor.isValid() && signatureTextEditor.isValid();
}
@@ -489,6 +508,14 @@
return userDAO.findRatingPoints(getInstance().getId());
}
+ public WikiTextEditor getBioTextEditor() {
+ return bioTextEditor;
+ }
+
+ public WikiTextEditor getSignatureTextEditor() {
+ return signatureTextEditor;
+ }
+
// ####################### PREFERENCES ##################################
PreferenceEditor preferenceEditor;
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Validatable.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Validatable.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Validatable.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.action;
+
+/**
+ * Marks a component that has to be valid before a CUD operation can continue.
+ * <p>
+ * These components are validated during save or update operations, and they typically queue
+ * a status message for display on the UI. The validation method is decoupled from the validation
+ * result, this simplifies user interface design.
+ * </p>
+ *
+ * @author Christian Bauer
+ */
+public interface Validatable {
+
+ public void validate();
+ public boolean isValid();
+}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/DocumentEditorPreferences.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/DocumentEditorPreferences.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/DocumentEditorPreferences.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -27,6 +27,7 @@
@NotNull
private Long regularEditAreaRows;
+ // TODO: This property is not used anymore - or it shouldn't be used...
@PreferenceProperty(
description = "#{messages['lacewiki.preferences.documentEditor.RegularEditAreaColumns']}",
visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.USER},
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -22,6 +22,7 @@
import org.jboss.seam.wiki.core.model.FeedEntry;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.wiki.core.ui.WikiURLRenderer;
+import org.jboss.seam.wiki.util.WikiUtil;
/**
* @author Christian Bauer
@@ -78,5 +79,9 @@
return parser.toString();
}
+ protected String renderPlainText(String plainText) {
+ return WikiUtil.escapeHtml(plainText, true, true);
+ }
+
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -11,6 +11,7 @@
import org.jboss.seam.international.Messages;
import org.jboss.seam.wiki.core.model.WikiComment;
import org.jboss.seam.wiki.core.model.WikiCommentFeedEntry;
+import org.jboss.seam.wiki.core.model.User;
@Name("wikiCommentFeedEntryManager")
public class WikiCommentFeedEntryManager extends FeedEntryManager<WikiComment, WikiCommentFeedEntry> {
@@ -22,7 +23,12 @@
fe.setLink(wikiURLRenderer.renderURL(comment, true));
fe.setTitle(getFeedEntryTitle(comment));
- fe.setAuthor(comment.getCreatedBy().getFullname() != null ? comment.getCreatedBy().getFullname() : comment.getFromUserName());
+ fe.setAuthor(
+ comment.getCreatedBy().getFullname() != null
+ && !comment.getCreatedBy().getUsername().equals(User.GUEST_USERNAME)
+ && !comment.getCreatedBy().getUsername().equals(User.ADMIN_USERNAME)
+ ? comment.getCreatedBy().getFullname()
+ : comment.getFromUserName());
fe.setUpdatedDate(fe.getPublishedDate());
// Do NOT use text/html, the fabulous Sun "Rome" software will
@@ -56,7 +62,11 @@
desc.append("'").append(comment.getParentDocument().getName()).append("'");
desc.append("</a>.");
desc.append("<hr/>");
- desc.append(renderWikiText(comment.getAreaNumber(), comment.getContent()));
+ desc.append(
+ comment.isUseWikiText()
+ ? renderWikiText(comment.getAreaNumber(), comment.getContent())
+ : renderPlainText(comment.getContent())
+ );
return desc.toString();
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiDocumentFeedEntryManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiDocumentFeedEntryManager.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiDocumentFeedEntryManager.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -27,7 +27,13 @@
// Do NOT use text/html, the fabulous Sun "Rome" software will
// render type="HTML" (uppercase!) which kills the Firefox feed renderer!
fe.setDescriptionType("html");
- fe.setDescriptionValue(renderWikiText(document.getAreaNumber(), document.getFeedDescription()));
+ String descriptionValue = "";
+ if (document.macroPresent(WikiDocument.MACRO_DISABLE_CONTENT_MARKUP)) {
+ descriptionValue = renderPlainText(document.getFeedDescription());
+ } else {
+ descriptionValue = renderWikiText(document.getAreaNumber(), document.getFeedDescription());
+ }
+ fe.setDescriptionValue(descriptionValue);
fe.setDocument(document);
return fe;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -17,6 +17,8 @@
public class WikiDocument extends WikiFile<WikiDocument> implements Serializable {
+ public static final String MACRO_DISABLE_CONTENT_MARKUP = "disableContentMarkup";
+
@Column(name = "NAME_AS_TITLE", nullable = false)
private boolean nameAsTitle = true;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchSupport.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchSupport.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchSupport.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -85,7 +85,7 @@
String unescapedFragements =
highlighter.getBestFragments(tokenStream, indexedText, numOfFragments, getFragmentSeparator());
- String escapedFragments = WikiUtil.escapeHtml(WikiUtil.removeMacros(unescapedFragements), false);
+ String escapedFragments = WikiUtil.escapeHtml(WikiUtil.removeMacros(unescapedFragements), false, false);
// .. and then replace the internal placeholders with real tags after HTML has been escaped
escapedFragments = escapedFragments.replaceAll(INTERNAL_BEGIN_HIT, getBeginHitTag());
@@ -101,10 +101,10 @@
0,
indexedText.length()>alternativeLength ? alternativeLength : indexedText.length()
)
- ), false
+ ), false, false
);
} else if (escapedFragments.length() == 0 && alternativeLength == 0){
- return WikiUtil.escapeHtml(WikiUtil.removeMacros(indexedText), false);
+ return WikiUtil.escapeHtml(WikiUtil.removeMacros(indexedText), false, false);
}
return escapedFragments;
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextEditor.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextEditor.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.wikitext.editor;
+
+import org.jboss.seam.log.Log;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.wiki.core.wikitext.engine.WikiLinkResolver;
+import org.jboss.seam.wiki.core.model.WikiFile;
+import org.jboss.seam.wiki.core.action.Validatable;
+import org.jboss.seam.Component;
+
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+import java.util.HashSet;
+import java.util.Set;
+import java.io.Serializable;
+
+/**
+ * A wiki (or plain) text editor.
+ *
+ * @author Christian Bauer
+ */
+public class WikiTextEditor implements Validatable, Serializable {
+
+ Log log = Logging.getLog(WikiTextEditor.class);
+
+ // Construction time
+ private String key;
+ private int valueMaxLength = 32767;
+ private boolean valueRequired = true;
+ private boolean allowPlaintext = false;
+ private int rows = 20;
+
+ // Editing
+ private String value;
+ private boolean valid = true;
+ private boolean valuePlaintext;
+ private boolean previewEnabled;
+ private String lastValidationError;
+ private Set<WikiFile> linkTargets;
+
+ public WikiTextEditor(String key) {
+ this.key = key;
+ }
+
+ public WikiTextEditor(String key, int valueMaxLength) {
+ this.key = key;
+ this.valueMaxLength = valueMaxLength;
+ }
+
+ public WikiTextEditor(String key, int valueMaxLength, boolean valueRequired) {
+ this.key = key;
+ this.valueMaxLength = valueMaxLength;
+ this.valueRequired = valueRequired;
+ }
+
+ public WikiTextEditor(String key, int valueMaxLength, boolean valueRequired, boolean allowPlaintext) {
+ this.key = key;
+ this.valueMaxLength = valueMaxLength;
+ this.valueRequired = valueRequired;
+ this.allowPlaintext = allowPlaintext;
+ }
+
+ public WikiTextEditor(String key, int valueMaxLength, boolean valueRequired, boolean allowPlaintext, int rows) {
+ this.key = key;
+ this.valueMaxLength = valueMaxLength;
+ this.valueRequired = valueRequired;
+ this.allowPlaintext = allowPlaintext;
+ this.rows = rows;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ // Stupid Internet Explorer textarea puts carriage returns inside the text, we don't want any of that
+ this.value = value != null ? value.replaceAll("\r", "") : value;
+ }
+
+ public int getValueMaxLength() {
+ return valueMaxLength;
+ }
+
+ public void setValueMaxLength(int valueMaxLength) {
+ this.valueMaxLength = valueMaxLength;
+ }
+
+ public boolean isValueRequired() {
+ return valueRequired;
+ }
+
+ public void setValueRequired(boolean valueRequired) {
+ this.valueRequired = valueRequired;
+ }
+
+ public boolean isAllowPlaintext() {
+ return allowPlaintext;
+ }
+
+ public void setAllowPlaintext(boolean allowPlaintext) {
+ this.allowPlaintext = allowPlaintext;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public void setValid(boolean valid) {
+ this.valid = valid;
+ }
+
+ public boolean isValuePlaintext() {
+ return valuePlaintext;
+ }
+
+ public void setValuePlaintext(boolean valuePlaintext) {
+ this.valuePlaintext = valuePlaintext;
+ }
+
+ public boolean isPreviewEnabled() {
+ return previewEnabled;
+ }
+
+ public void setPreviewEnabled(boolean previewEnabled) {
+ this.previewEnabled = previewEnabled;
+ }
+
+ public String getLastValidationError() {
+ return lastValidationError;
+ }
+
+ public void setLastValidationError(String lastValidationError) {
+ this.lastValidationError = lastValidationError;
+ }
+
+ public Set<WikiFile> getLinkTargets() {
+ return linkTargets;
+ }
+
+ public void setValueAndConvertLinks(Long areaNumber, String value) {
+ log.debug("setting value and resolving wiki://links to clear text");
+ WikiLinkResolver wikiLinkResolver = (WikiLinkResolver) Component.getInstance("wikiLinkResolver");
+ setValue(wikiLinkResolver.convertFromWikiProtocol(areaNumber, value));
+ }
+
+ public String getValueAndConvertLinks(Long areaNumber) {
+ log.debug("setting value and resolving clear text to wiki://links");
+ WikiLinkResolver wikiLinkResolver = (WikiLinkResolver)Component.getInstance("wikiLinkResolver");
+ linkTargets = new HashSet<WikiFile>();
+ return wikiLinkResolver.convertToWikiProtocol(linkTargets, areaNumber, getValue());
+ }
+
+ public int getRemainingCharacters() {
+ return getValue() != null ? getValueMaxLength() - getValue().length() : getValueMaxLength();
+ }
+
+ public void switchPlaintext() {
+ // If the user wants to switch from plain text back to wiki text, do validation
+ if (!isValuePlaintext()) {
+ validate();
+ // Allow only if valid wiki text markup
+ setValuePlaintext(!isValid());
+ } else {
+ // If the user wants plain text, then we can discard any validation errors
+ setValid(true);
+ lastValidationError = null;
+ }
+ }
+
+ public void validate() {
+ log.debug("validating value of text editor: " + key);
+ setValid(false);
+ if (valueRequired && (value == null || value.length() == 0)) {
+ log.debug("validation failed for required but null or empty wiki text with key: " + key);
+ lastValidationError = "lacewiki.msg.wikiTextValidator.EmptyWikiText"; // TODO: make static
+ return;
+ }
+ if (value != null && value.length() > getValueMaxLength()) {
+ log.debug("validation failed for too long wiki text with key: " + key);
+ lastValidationError = "lacewiki.msg.wikiTextValidator.MaxLengthExceeded"; // TODO: make static
+ return;
+ }
+ try {
+ lastValidationError = null;
+ if (!isValuePlaintext()) {
+ WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
+ validator.validate(null, null, value);
+ }
+ setValid(true);
+ } catch (ValidatorException e) {
+ log.debug("exception during validation: " + e.getFacesMessage().getSummary());
+ lastValidationError = convertFacesMessage(e.getFacesMessage());
+ }
+ log.debug("completed validation of text editor value for key: " + key);
+ }
+
+ // TODO: These are supposed to be message bundle keys, not the literal ANTLR parser messages, see WikiFormattedTextValidator
+ protected String convertFacesMessage(FacesMessage fm) {
+ // Convert the FacesMessage to a StatusMessage (which of course is then converted back to JSF...)
+ StringBuilder msg = new StringBuilder();
+ msg.append(fm.getSummary());
+
+ // Append the detail only if the summary doesn't end with it already
+ if (!fm.getSummary().endsWith(fm.getDetail())) {
+ msg.append(" (").append(fm.getDetail()).append(")");
+ }
+ return msg.toString();
+ }
+
+ /* TODO: Old stuff
+ public void setShowPluginPrefs(boolean showPluginPrefs) {
+ Contexts.getPageContext().set("showPluginPreferences", showPluginPrefs);
+ }
+
+ public boolean isShowPluginPrefs() {
+ Boolean showPluginPrefs = (Boolean)Contexts.getPageContext().get("showPluginPreferences");
+ return showPluginPrefs != null && showPluginPrefs;
+ }
+ */
+}
Deleted: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextPreview.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextPreview.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextPreview.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.seam.wiki.core.wikitext.editor;
-
-import org.jboss.seam.annotations.*;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.log.Log;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.io.Serializable;
-
-/**
- * Holds conversation-scoped state of wiki text preview feature.
- *
- * @author Christian Bauer
- */
-@Name("wikiTextPreview")
-(a)Scope(ScopeType.CONVERSATION)
-@AutoCreate
-public class WikiTextPreview implements Serializable {
-
- @Logger
- Log log;
-
- @In
- WikiTextValidator wikiTextValidator;
-
- private Map<String, Boolean> previewEnabled = new HashMap<String, Boolean>();
-
- public void enablePreview(String key) {
- previewEnabled.put(key, true);
- }
-
- public void enablePreview(String key, String value, boolean valueRequired) {
- // Only enable preview if text passes validation
- wikiTextValidator.validate(key, value, valueRequired);
- if (wikiTextValidator.isValid(key)) previewEnabled.put(key, true);
- }
-
- public void disablePreview(String key) {
- previewEnabled.remove(key);
- }
-
- public Boolean isPreviewEnabled(String key) {
- return previewEnabled.get(key);
- }
-
-}
Deleted: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextValidator.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextValidator.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/editor/WikiTextValidator.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -1,123 +0,0 @@
-package org.jboss.seam.wiki.core.wikitext.editor;
-
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.log.Log;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.HashMap;
-
-import javax.faces.validator.ValidatorException;
-import javax.faces.application.FacesMessage;
-
-/**
- * Wraps the <tt>WikiFormattedTextValidator</tt> into a conversation-scoped action
- * that queues the right messages and holds the status of various text editors
- * for easy error checking by the user interface.
- *
- * @see WikiFormattedTextValidator
- *
- * @author Christian Bauer
- */
-@Name("wikiTextValidator")
-(a)Scope(ScopeType.CONVERSATION)
-@AutoCreate
-public class WikiTextValidator implements Serializable {
-
- @Logger
- Log log;
-
- private Map<String, String> validationFailures = new HashMap<String, String>();
-
- /**
- * Validates the wiki text value and stores the validation state in this component.
- *
- * @param key
- * The key under which the validation status is stored and can be later retrieved with <tt>isValid()</tt>
- * @param value
- * The wiki text
- * @param valueRequired
- * Checks before validation if a value is present and required.
- */
- public void validate(String key, String value, boolean valueRequired) {
- log.debug("validating value of text editor: " + key);
- if (valueRequired && (value == null || value.length() == 0)) {
- log.debug("validation failed for required but null or empty wiki text with key: " + key);
- validationFailures.put(key, "lacewiki.msg.wikiTextValidator.EmptyWikiText");
- return;
- }
- WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
- try {
- validationFailures.remove(key);
- validator.validate(null, null, value);
- } catch (ValidatorException e) {
- log.debug("exception during validation: " + e.getFacesMessage().getSummary());
- validationFailures.put(key, convertFacesMessage(e.getFacesMessage()));
- }
- log.debug("completed validation of text editor value for key: " + key);
- }
-
- /**
- * Makes it easier to call the validation routine programmatically.
- *
- * @param validationCommand
- * A command that bundles the validation values and options.
- */
- public void validate(ValidationCommand validationCommand) {
- validate(
- validationCommand.getKey(),
- validationCommand.getWikiTextValue(),
- validationCommand.getWikiTextRequired()
- );
- }
-
- /**
- * Validation status of wiki text with the given key.
- * <p>
- * <b>Attention: Returns <tt>true</tt> if the given key can not be found!</b>
- * </p>
- *
- * @param key
- * The key under which the validation status has been stored, i.e. from an earlier <tt>validate()</tt> call
- * @return
- * True if no status for <tt>key</tt> can be found or if previous validation failed for <tt>key</tt>
- */
- public boolean isValid(String key) {
- return !validationFailures.containsKey(key);
- }
-
- /**
- * Return the last validation failure message key for the given wiki text key.
- *
- * @param key
- * The key under which the validation status has been stored, i.e. from an earlier <tt>validate()</tt> call
- * @return
- * The validation failure message bundle key or null if no error is known.
- */
- public String getValidationFailureMessageBundleKey(String key) {
- return validationFailures.get(key);
- }
-
- // TODO: These are supposed to be message bundle keys, not the literal ANTLR parser messages, see WikiFormattedTextValidator
- protected String convertFacesMessage(FacesMessage fm) {
- // Convert the FacesMessage to a StatusMessage (which of course is then converted back to JSF...)
- StringBuilder msg = new StringBuilder();
- msg.append(fm.getSummary());
-
- // Append the detail only if the summary doesn't end with it already
- if (!fm.getSummary().endsWith(fm.getDetail())) {
- msg.append(" (").append(fm.getDetail()).append(")");
- }
- return msg.toString();
- }
-
- public interface ValidationCommand {
- public String getKey();
- public String getWikiTextValue();
- public boolean getWikiTextRequired();
- }
-}
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-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -30,6 +30,7 @@
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
+import java.util.regex.Matcher;
/**
* Adds stuff to and for JSF that should be there but isn't. Also stuff that is exposed
@@ -174,7 +175,7 @@
return string.replaceAll("@", Preferences.instance().get(WikiPreferences.class).getAtSymbolReplacement());
}
- public static String escapeHtml(String string, boolean convertNewlines) {
+ public static String escapeHtml(String string, boolean convertNewlines, boolean convertSpaces) {
if (string == null) return null;
StringBuilder sb = new StringBuilder();
String htmlEntity;
@@ -194,10 +195,26 @@
sb.append(c);
}
}
+ String result = sb.toString();
+ if (convertSpaces) {
+ // Converts the _beginning_ of line whitespaces into non-breaking spaces
+ Matcher matcher = Pattern.compile("(\\n+)(\\s*)(.*)").matcher(result);
+ StringBuffer temp = new StringBuffer();
+ while(matcher.find()) {
+ String group = matcher.group(2);
+ StringBuilder spaces = new StringBuilder();
+ for (int i = 0; i < group.length(); i++) {
+ spaces.append(" ");
+ }
+ matcher.appendReplacement(temp, "$1"+spaces.toString()+"$3");
+ }
+ matcher.appendTail(temp);
+ result = temp.toString();
+ }
if (convertNewlines) {
- return sb.toString().replaceAll("\n", "<br/>");
+ result = result.replaceAll("\n", "<br/>");
}
- return sb.toString();
+ return result;
}
public static String removeHtml(String original) {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/Basic.plugin.xml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -65,6 +65,14 @@
<applicable-to header="true"/>
</macro>
+ <macro key="disableContentMarkup" name="disableContentMarkup">
+ <skins>
+ <skin name="d"/>
+ <skin name="m"/>
+ </skins>
+ <applicable-to header="true"/>
+ </macro>
+
<macro key="dirMenu" name="dirMenu">
<skins>
<skin name="d"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/i18n/messages_basic_en.properties 2008-06-19 14:57:46 UTC (rev 8386)
@@ -22,6 +22,9 @@
basic.disableContentMacros.label=Disable Content Macros
basic.disableContentMacros.description=Disable execution of macros in document content area
+basic.disableContentMarkup.label=Disable Content Markup
+basic.disableContentMarkup.description=Disable wiki markup in content text
+
basic.dirMenu.label=Directory Menu
basic.dirMenu.description=Shows a list of subdirectories of the current directory
basic.dirMenu.preferences.description=Plugin: Directory Menu
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/i18n/messages_faqBrowser_en.properties
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/i18n/messages_faqBrowser_en.properties 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/i18n/messages_faqBrowser_en.properties 2008-06-19 14:57:46 UTC (rev 8386)
@@ -11,7 +11,7 @@
fb.faqBrowser.button.NewQuestion=New <u>Q</u>uestion
fb.faqBrowser.button.NewQuestion.accesskey=Q
-fb.faqBrowser.label.NewFaqQuestion=New question in category
+fb.faqBrowser.label.NewFaqQuestion=New question and answer in category
fb.faqBrowser.label.NewQuestionTitle=Your question?
fb.faqBrowser.label.QuestionTitle=Question
fb.faqBrowser.label.QuestionText=Text
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqQuestionForm.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqQuestionForm.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqQuestionForm.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -27,26 +27,16 @@
<h:inputText id="faqQuestionName" tabindex="1" size="60" maxlength="255" required="true" value="#{faqQuestionHome.instance.name}"/>
</s:decorate>
- <ui:include src="/includes/wikiTextEditor.xhtml">
- <ui:param name="textEditorId" value="faqQuestion"/>
+ <ui:include src="/includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{faqQuestionHome.textEditor}"/>
<ui:param name="namingContainer" value="faqBrowserPlugin\\\\:faqQuestionForm"/>
- <ui:param name="label" value="#{messages['fb.faqBrowser.label.QuestionText']}"/>
- <ui:param name="valueBinding" value="#{faqQuestionHome.formContent}"/>
- <ui:param name="valueMaxLength" value="32767"/>
- <ui:param name="valueRequired" value="true"/>
- <ui:param name="textEditorColumns" value="60"/>
- <ui:param name="textEditorRows" value="20"/>
</ui:include>
+ <ui:include src="/includes/wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{faqQuestionHome.textEditor}"/>
+ <ui:param name="baseDocument" value="#{faqQuestionHome.instance}"/>
+ <ui:param name="baseDirectory" value="#{currentDirectory}"/>
+ </ui:include>
- <s:div styleClass="marginLeft">
- <ui:include src="/includes/wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="faqQuestion"/>
- <ui:param name="valueBinding" value="#{faqQuestionHome.instance.content}"/>
- <ui:param name="baseDocument" value="#{faqQuestionHome.instance}"/>
- <ui:param name="baseDirectory" value="#{currentDirectory}"/>
- </ui:include>
- </s:div>
-
</s:div>
<div class="formControls">
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -7,7 +7,6 @@
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.security.Identity;
import org.jboss.seam.wiki.core.action.CommentHome;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
import org.jboss.seam.wiki.core.model.WikiComment;
import org.jboss.seam.wiki.core.model.WikiNode;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
@@ -27,6 +26,8 @@
public void create() {
super.create();
markTopicRead();
+
+ textEditor.setKey("reply");
}
@In(create = true)
@@ -62,6 +63,8 @@
getInstance().setSubject(REPLY_PREFIX + getParentNode().getName());
+ textEditor.setValue(getInstance().getContent());
+
WikiRedirect.instance()
.setWikiDocument(documentHome.getInstance())
.setPropagateConversation(true)
@@ -83,6 +86,8 @@
documentHome.getInstance().getCreatedBy().getFullname()
));
+ textEditor.setValue(getInstance().getContent());
+
WikiRedirect.instance()
.setWikiDocument(documentHome.getInstance())
.setPropagateConversation(true)
@@ -101,25 +106,6 @@
return "forumReplyFeedEntryManager";
}
- @Override
- protected WikiTextValidator.ValidationCommand[] getPersistValidationCommands() {
- return new WikiTextValidator.ValidationCommand[] {
- new WikiTextValidator.ValidationCommand() {
- public String getKey() {
- return "reply";
- }
-
- public String getWikiTextValue() {
- return getInstance().getContent();
- }
-
- public boolean getWikiTextRequired() {
- return true;
- }
- }
- };
- }
-
/* -------------------------- Messages ------------------------------ */
protected void createdMessage() {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -8,15 +8,18 @@
import org.jboss.seam.faces.Renderer;
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.wiki.core.action.DocumentHome;
-import org.jboss.seam.wiki.core.wikitext.editor.WikiTextValidator;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
+import org.jboss.seam.wiki.core.model.WikiFile;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
+import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.preferences.Preferences;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
+import org.hibernate.validator.InvalidStateException;
+import org.hibernate.validator.InvalidValue;
@Name("topicHome")
@Scope(ScopeType.CONVERSATION)
@@ -54,6 +57,9 @@
Boolean preferencesNotifyReplies = Preferences.instance().get(ForumPreferences.class).getNotifyMeOfReplies();
notifyReplies = preferencesNotifyReplies != null && preferencesNotifyReplies;
+
+ textEditor.setKey("topic");
+ textEditor.setAllowPlaintext(true);// Topics can be plain text, regular documents can't
}
@Override
@@ -97,7 +103,8 @@
endConversation();
- // TODO: We should redirect here to the posted topic with WikiRedirect, see cancel()
+ // Redirect to topic (so the created message is actually never displayed, but that's ok)
+ WikiRedirect.instance().setWikiDocument(getInstance()).execute();
}
return null; // Prevent navigation
}
@@ -116,33 +123,6 @@
return null; // Prevent navigation
}
- @Override
- protected WikiTextValidator.ValidationCommand[] getPersistValidationCommands() {
- return getValidationCommands();
- }
-
- protected WikiTextValidator.ValidationCommand[] getUpdateValidationCommands() {
- return getValidationCommands();
- }
-
- private WikiTextValidator.ValidationCommand[] getValidationCommands() {
- return new WikiTextValidator.ValidationCommand[] {
- new WikiTextValidator.ValidationCommand() {
- public String getKey() {
- return "topic";
- }
-
- public String getWikiTextValue() {
- return getInstance().getContent();
- }
-
- public boolean getWikiTextRequired() {
- return true;
- }
- }
- };
- }
-
/* -------------------------- Messages ------------------------------ */
protected void createdMessage() {
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/replyForm.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/replyForm.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/replyForm.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -73,26 +73,16 @@
</h:inputText>
</s:decorate>
- <a:region>
- <ui:include src="/includes/wikiTextEditor.xhtml">
- <ui:param name="textEditorId" value="reply"/>
- <ui:param name="namingContainer" value="forumRepliesPlugin\\\\:replyForm"/>
- <ui:param name="label" value="#{messages['forum.label.replyForm.Message']}"/>
- <ui:param name="valueBinding" value="#{replyHome.instance.content}"/>
- <ui:param name="valueMaxLength" value="32767"/>
- <ui:param name="valueRequired" value="true"/>
- <ui:param name="textEditorColumns" value="#{replyHome.instance.ownedByRegularUser ? '65' : '55'}"/>
- <ui:param name="textEditorRows" value="20"/>
- </ui:include>
+ <ui:include src="/includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{replyHome.textEditor}"/>
+ <ui:param name="namingContainer" value="forumRepliesPlugin\\\\:replyForm"/>
+ </ui:include>
+ <ui:include src="/includes/wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{replyHome.textEditor}"/>
+ <ui:param name="baseDocument" value="#{currentDocument}"/>
+ <ui:param name="baseDirectory" value="#{currentDocument.parent}"/>
+ </ui:include>
- <ui:include src="/includes/wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="reply"/>
- <ui:param name="valueBinding" value="#{replyHome.instance.content}"/>
- <ui:param name="baseDocument" value="#{currentDocument}"/>
- <ui:param name="baseDirectory" value="#{currentDocument.parent}"/>
- </ui:include>
- </a:region>
-
<s:decorate id="verifyCaptchaEntry" template="/includes/captchaEntry.xhtml">
<ui:param name="rendered" value="#{!identity.loggedIn}"/>
</s:decorate>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/templates/topicForm.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -20,35 +20,17 @@
</div>
<a:region>
- <s:div styleClass="formFields formBorder">
+ <s:div styleClass="formFields wideLabels formBorder">
<s:decorate id="nameDecorate" template="/includes/formFieldDecorate.xhtml">
<ui:define name="label">#{messages['forum.label.Subject']}</ui:define>
<h:inputText id="topicName" tabindex="1" size="60" maxlength="255" required="true" value="#{topicHome.instance.name}"/>
</s:decorate>
- <a:region>
- <ui:include src="/includes/wikiTextEditor.xhtml">
- <ui:param name="textEditorId" value="topic"/>
- <ui:param name="namingContainer" value="forumTopicsPlugin\\\\:topicForm"/>
- <ui:param name="label" value="#{messages['forum.label.Message']}"/>
- <ui:param name="valueBinding" value="#{topicHome.formContent}"/>
- <ui:param name="valueMaxLength" value="32767"/>
- <ui:param name="valueRequired" value="true"/>
- <ui:param name="textEditorColumns" value="60"/>
- <ui:param name="textEditorRows" value="20"/>
- </ui:include>
+ <ui:include src="/includes/tagEditor.xhtml">
+ <ui:param name="editor" value="#{topicHome.tagEditor}"/>
+ </ui:include>
- <s:div styleClass="marginLeft">
- <ui:include src="/includes/wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="topic"/>
- <ui:param name="valueBinding" value="#{topicHome.instance.content}"/>
- <ui:param name="baseDocument" value="#{topicHome.instance}"/>
- <ui:param name="baseDirectory" value="#{currentDirectory}"/>
- </ui:include>
- </s:div>
- </a:region>
-
<s:fragment rendered="#{s:hasPermission('User', 'isAdmin', currentUser)}">
<s:div styleClass="entry">
<div class="label">
@@ -77,9 +59,15 @@
</div>
</s:div>
- <ui:include src="/includes/tagEditor.xhtml">
- <ui:param name="editor" value="#{topicHome.tagEditor}"/>
+ <ui:include src="/includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{topicHome.textEditor}"/>
+ <ui:param name="namingContainer" value="forumTopicsPlugin\\\\:topicForm"/>
</ui:include>
+ <ui:include src="/includes/wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{topicHome.textEditor}"/>
+ <ui:param name="baseDocument" value="#{topicHome.instance}"/>
+ <ui:param name="baseDirectory" value="#{currentDirectory}"/>
+ </ui:include>
<s:decorate id="verifyCaptchaEntry" template="/includes/captchaEntry.xhtml">
<ui:param name="rendered" value="#{!identity.loggedIn}"/>
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReply.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReply.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReply.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -2,10 +2,11 @@
xmlns:m="http://jboss.com/products/seam/mail"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:wiki="http://jboss.com/products/seam/wiki">
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
- <m:from name="Seam Wiki" address="do-not-reply(a)jboss.com" />
+ <m:from name="LaceWiki" address="do-not-reply(a)jboss.com" />
<m:to name="#{currentDocument.createdBy.fullname}">#{currentDocument.createdBy.email}</m:to>
<m:subject>[LaceWiki Forums] #{replyHome.instance.subject}</m:subject>
<m:body>
@@ -21,14 +22,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
<m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
@@ -28,14 +29,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/default/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
<m:header name="X-Sent-From" value="JBoss Seam" />
@@ -11,7 +12,7 @@
<m:header name="From" value="#{topicHome.instance.createdBy.fullname} <do-not-reply(a)jboss.com>"/>
<m:to name="LaceWiki Forums List">#{preferences.get('Forum').notificationMailingList}</m:to>
- <m:subject>[SeamFramework.org Forums] #{topicHome.instance.name}</m:subject>
+ <m:subject>[LaceWiki Forums] #{topicHome.instance.name}</m:subject>
<m:body>
<html>
@@ -23,14 +24,21 @@
<hr/>
- <wiki:formattedText value="#{topicHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{not topicHome.instance.macroPresent('disableContentMarkup')}">
+ <wiki:formattedText value="#{topicHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{topicHome.instance.macroPresent('disableContentMarkup')}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(topicHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(topicHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReply.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReply.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReply.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -2,6 +2,7 @@
xmlns:m="http://jboss.com/products/seam/mail"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:wiki="http://jboss.com/products/seam/wiki">
<m:header name="X-Sent-From" value="JBoss Seam" />
<m:header name="Precedence" value="list"/>
@@ -21,14 +22,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
<m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
@@ -28,14 +29,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/inrelationto/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
<m:header name="X-Sent-From" value="JBoss Seam" />
@@ -23,14 +24,21 @@
<hr/>
- <wiki:formattedText value="#{topicHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{not topicHome.instance.macroPresent('disableContentMarkup')}">
+ <wiki:formattedText value="#{topicHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{topicHome.instance.macroPresent('disableContentMarkup')}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(topicHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(topicHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReply.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReply.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReply.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -2,6 +2,7 @@
xmlns:m="http://jboss.com/products/seam/mail"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:wiki="http://jboss.com/products/seam/wiki">
<m:header name="X-Sent-From" value="SeamFramework.org" />
<m:header name="Precedence" value="list"/>
@@ -21,14 +22,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyReplyToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(replyHome.instance.id, replyHome.instance.name)}">
<m:header name="In-Reply-To" value="#{wiki:calculateMessageId(currentDocument.id, currentDocument.name)}"/>
@@ -27,14 +28,21 @@
<hr/>
- <wiki:formattedText value="#{replyHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{replyHome.instance.useWikiText}">
+ <wiki:formattedText value="#{replyHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{not replyHome.instance.useWikiText}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(replyHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(replyHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/themes/sfwkorg/mailtemplates/forumNotifyTopicToList.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -3,6 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
+ xmlns:c="http://java.sun.com/jstl/core"
messageId="#{wiki:calculateMessageId(topicHome.instance.id, topicHome.instance.name)}">
<m:header name="X-Sent-From" value="SeamFramework.org" />
@@ -23,14 +24,21 @@
<hr/>
- <wiki:formattedText value="#{topicHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{currentDocument}"
- currentAreaNumber="#{currentDocument.areaNumber}"
- enableMacroRendering="false"/>
+ <c:if test="#{not topicHome.instance.macroPresent('disableContentMarkup')}">
+ <wiki:formattedText value="#{topicHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{currentDocument}"
+ currentAreaNumber="#{currentDocument.areaNumber}"
+ enableMacroRendering="false"/>
+ </c:if>
+ <c:if test="#{topicHome.instance.macroPresent('disableContentMarkup')}">
+ <div style="font-family: Andale Mono, Courier New, monospace;">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(topicHome.instance.content, true, true)}"/>
+ </div>
+ </c:if>
<hr/>
<a href="#{wikiURLRenderer.renderURL(topicHome.instance, true)}">Click here</a> to reply...
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -110,7 +110,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
assert invokeMethod("#{documentHome.persist}").equals("persisted");
@@ -150,11 +150,17 @@
setParameter("cid", conversationId);
}
- protected void processValidations() throws Exception {
+ protected void invokeApplication() throws Exception {
+
+ DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
+ docHome.getInstance().setName("Test Name");
+
StringBuilder builder = new StringBuilder();
for (int i = 0; i <= 40000; i++) builder.append("a");
- validateValue("#{documentHome.formContent}", builder.toString());
- assert isValidationFailure();
+
+ docHome.getTextEditor().setValue(builder.toString());
+ docHome.getTextEditor().validate();
+ assert !docHome.getTextEditor().isValid();
}
}.run();
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/DocumentHistoryTests.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/DocumentHistoryTests.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/DocumentHistoryTests.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -85,7 +85,7 @@
protected void invokeApplication() throws Exception {
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
assert invokeMethod("#{documentHome.persist}").equals("persisted");
@@ -129,8 +129,9 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
- docHome.getFormContent(); // Initialize historical revision
- docHome.setFormContent("New text");
+ docHome.syncInstanceToEditor(docHome.getParentNode().getId(), docHome.getInstance());
+ docHome.getTextEditor().setValue("New text");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
docHome.setMinorRevision(false);
assert invokeMethod("#{documentHome.update}").equals("updated");
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/EditMacros.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/EditMacros.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/EditMacros.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -84,8 +84,11 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
- docHome.setFormContent("[<=contentMacro[param=value]]");
+ docHome.getTextEditor().setValue("[<=contentMacro[param=value]]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
+ docHome.syncMacros(docHome.getInstance());
+
assert docHome.getInstance().getHeaderMacros().size() == 2;
assert docHome.getInstance().getContentMacros().size() == 1;
assert docHome.getInstance().getFooterMacros().size() == 2;
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Linking.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Linking.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Linking.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -55,37 +55,37 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
- docHome.setFormContent("[=>http://foo.bar]");
+ docHome.getTextEditor().setValue("[=>http://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[=>http://foo.bar]");
- assert docHome.getFormContent().equals("[=>http://foo.bar]");
- docHome.setFormContent("[=>https://foo.bar]");
+ docHome.getTextEditor().setValue("[=>https://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[=>https://foo.bar]");
- assert docHome.getFormContent().equals("[=>https://foo.bar]");
- docHome.setFormContent("[=>ftp://foo.bar]");
+ docHome.getTextEditor().setValue("[=>ftp://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[=>ftp://foo.bar]");
- assert docHome.getFormContent().equals("[=>ftp://foo.bar]");
- docHome.setFormContent("[=>mailto:foo@bar.tld]");
+ docHome.getTextEditor().setValue("[=>mailto:foo@bar.tld]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[=>mailto:foo@bar.tld]");
- assert docHome.getFormContent().equals("[=>mailto:foo@bar.tld]");
- docHome.setFormContent("[Foo Bar=>http://foo.bar]");
+ docHome.getTextEditor().setValue("[Foo Bar=>http://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[Foo Bar=>http://foo.bar]");
- assert docHome.getFormContent().equals("[Foo Bar=>http://foo.bar]");
- docHome.setFormContent("[Foo Bar=>https://foo.bar]");
+ docHome.getTextEditor().setValue("[Foo Bar=>https://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[Foo Bar=>https://foo.bar]");
- assert docHome.getFormContent().equals("[Foo Bar=>https://foo.bar]");
- docHome.setFormContent("[Foo Bar=>ftp://foo.bar]");
+ docHome.getTextEditor().setValue("[Foo Bar=>ftp://foo.bar]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[Foo Bar=>ftp://foo.bar]");
- assert docHome.getFormContent().equals("[Foo Bar=>ftp://foo.bar]");
- docHome.setFormContent("[Foo Bar=>mailto:foo@bar.tld]");
+ docHome.getTextEditor().setValue("[Foo Bar=>mailto:foo@bar.tld]");
+ docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
assert docHome.getInstance().getContent().equals("[Foo Bar=>mailto:foo@bar.tld]");
- assert docHome.getFormContent().equals("[Foo Bar=>mailto:foo@bar.tld]");
}
@@ -114,7 +114,7 @@
WikiLinkResolver resolver = (WikiLinkResolver)getInstance("wikiLinkResolver");
Map<String, WikiLink> links = new HashMap<String, WikiLink>();
- docHome.setFormContent("[=>hhh://1234]");
+ docHome.getTextEditor().setValue("[=>hhh://1234]");
resolver.resolveLinkText(3l, links, "hhh://1234");
assert links.size()==1;
assert links.get("hhh://1234").getUrl().equals("http://opensource.atlassian.com/projects/hibernate/browse/HHH-1234");
@@ -235,7 +235,7 @@
assert docHome.getInstance().getId().equals(6l); // Init!
assert docHome.getInstance().getOutgoingLinks().size() == 0;
- docHome.setFormContent("[=>Two] and [=>Three] and [=>BBB|Test Image]");
+ docHome.getTextEditor().setValue("[=>Two] and [=>Three] and [=>BBB|Test Image]");
assert invokeMethod("#{documentHome.update}").equals("updated");
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/feeds/DocumentFeedTests.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/feeds/DocumentFeedTests.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/feeds/DocumentFeedTests.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -46,7 +46,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
docHome.setPushOnSiteFeed(true);
@@ -85,7 +85,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
docHome.setPushOnSiteFeed(true);
@@ -123,7 +123,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
@@ -162,7 +162,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
@@ -200,7 +200,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
docHome.setPushOnSiteFeed(true);
@@ -240,7 +240,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
docHome.getInstance().setName("Test Name");
- docHome.setFormContent("Test Content");
+ docHome.getTextEditor().setValue("Test Content");
docHome.setPushOnFeeds(true);
docHome.setPushOnSiteFeed(true);
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -64,7 +64,7 @@
TopicHome home = (TopicHome)getInstance(TopicHome.class);
home.getInstance().setName("New Topic");
- home.setFormContent("This is a new topic.");
+ home.getTextEditor().setValue("This is a new topic.");
assert invokeMethod("#{topicHome.persist}") == null;
}
@@ -131,7 +131,7 @@
TopicHome home = (TopicHome)getInstance(TopicHome.class);
home.getInstance().setName("New Topic");
- home.setFormContent("This is a new topic.");
+ home.getTextEditor().setValue("This is a new topic.");
home.setSticky(true);
assert invokeMethod("#{topicHome.persist}") == null;
@@ -197,7 +197,7 @@
TopicHome home = (TopicHome)getInstance(TopicHome.class);
home.getInstance().setName("New Topic");
- home.setFormContent("This is a new topic.");
+ home.getTextEditor().setValue("This is a new topic.");
home.getInstance().setEnableComments(false);
assert invokeMethod("#{topicHome.persist}") == null;
Modified: trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/preferences/InstancePreferencesTests.java
===================================================================
--- trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/preferences/InstancePreferencesTests.java 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/src/test/org/jboss/seam/wiki/test/preferences/InstancePreferencesTests.java 2008-06-19 14:57:46 UTC (rev 8386)
@@ -86,7 +86,7 @@
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
- docHome.setFormContent("[<=lastModifiedDocuments[documentTitleLength=66]]");
+ docHome.getTextEditor().setValue("[<=lastModifiedDocuments[documentTitleLength=66]]");
assert invokeMethod("#{documentHome.update}").equals("updated");
}
Modified: trunk/examples/wiki/view/docDisplay_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docDisplay_d.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/docDisplay_d.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -116,15 +116,23 @@
</h1>
</s:div>
- <wiki:formattedText value="#{documentHome.instance.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{documentHome.instance}"
- currentAreaNumber="#{documentHome.instance.areaNumber}"
- enableMacroRendering="#{not documentHome.instance.macroPresent('disableContentMacros')}"/>
+ <c:if test="#{not documentHome.instance.macroPresent('disableContentMarkup')}">
+ <wiki:formattedText value="#{documentHome.instance.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{documentHome.instance}"
+ currentAreaNumber="#{documentHome.instance.areaNumber}"
+ enableMacroRendering="#{not documentHome.instance.macroPresent('disableContentMacros')}"/>
+ </c:if>
+ <c:if test="#{documentHome.instance.macroPresent('disableContentMarkup')}">
+ <s:div styleClass="plaintext">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(documentHome.instance.content, true, true)}"/>
+ </s:div>
+ </c:if>
+
<wiki:formattedText value="#{documentHome.instance.footer}"
linkStyleClass="regularLink"
brokenLinkStyleClass="brokenLink"
Modified: trunk/examples/wiki/view/docDisplay_m.xhtml
===================================================================
--- trunk/examples/wiki/view/docDisplay_m.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/docDisplay_m.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -122,15 +122,23 @@
</h:outputLink>
</s:div>
- <wiki:formattedText value="#{wiki:disableFloats(documentHome.instance.content)}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{documentHome.instance}"
- currentAreaNumber="#{documentHome.instance.areaNumber}"
- enableMacroRendering="#{not documentHome.instance.macroPresent('disableContentMacros')}"/>
+ <c:if test="#{not documentHome.instance.macroPresent('disableContentMarkup')}">
+ <wiki:formattedText value="#{wiki:disableFloats(documentHome.instance.content)}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{documentHome.instance}"
+ currentAreaNumber="#{documentHome.instance.areaNumber}"
+ enableMacroRendering="#{not documentHome.instance.macroPresent('disableContentMacros')}"/>
+ </c:if>
+ <c:if test="#{documentHome.instance.macroPresent('disableContentMarkup')}">
+ <s:div styleClass="plaintext">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(documentHome.instance.content, true, true)}"/>
+ </s:div>
+ </c:if>
+
<wiki:formattedText value="#{documentHome.instance.footer}"
linkStyleClass="regularLink"
brokenLinkStyleClass="brokenLink"
@@ -263,11 +271,13 @@
currentAreaNumber="#{currentDocument.areaNumber}"
enableMacroRendering="false"/>
</s:div>
- <s:div rendered="#{not c.useWikiText and currentDocument.name != c.subject}" style="margin-top:15px;">
- <h:outputText value="#{wiki:escapeHTML(c.content, true)}" escape="false"/>
+ <s:div style="margin-top:15px;font-family: Andale Mono, Courier New, monospace;"
+ rendered="#{not c.useWikiText and currentDocument.name != c.subject}">
+ <h:outputText value="#{wiki:escapeHTML(c.content, true, true)}" escape="false"/>
</s:div>
- <s:div rendered="#{not c.useWikiText and currentDocument.name == c.subject}">
- <h:outputText value="#{wiki:escapeHTML(c.content, true)}" escape="false"/>
+ <s:div style="font-family: Andale Mono, Courier New, monospace;"
+ rendered="#{not c.useWikiText and currentDocument.name == c.subject}">
+ <h:outputText value="#{wiki:escapeHTML(c.content, true, true)}" escape="false"/>
</s:div>
<s:div styleClass="smallFont"
Modified: trunk/examples/wiki/view/docEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docEdit_d.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/docEdit_d.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -172,45 +172,12 @@
</s:fragment>
</s:fragment>
- <ui:include src="includes/wikiTextEditor.xhtml">
- <ui:param name="textEditorId" value="content"/>
- <ui:param name="valueBinding" value="#{documentHome.formContent}"/>
+ <ui:include src="includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{documentHome.textEditor}"/>
<ui:param name="tabId" value="docContentTab"/>
<ui:param name="namingContainer" value="docEditForm"/>
- <ui:param name="label" value="#{messages['lacewiki.label.docEdit.Content']}"/>
- <ui:param name="textEditorColumns" value="#{preferences.get('DocEditor').regularEditAreaColumns}"/>
- <ui:param name="textEditorRows" value="#{preferences.get('DocEditor').regularEditAreaRows}"/>
- <ui:param name="valueMaxLength" value="32767"/>
- <ui:param name="valueRequired" value="true"/>
</ui:include>
-<!--
- <s:div styleClass="entry" id="previewSwitchDiv">
- <h:message for="previewSwitch"/>
- <div class="label"> </div>
- <div class="input">
- <h:selectBooleanCheckbox styleClass="ajaxSupport" value="#{wikiTextPreview.isPreviewEnabled('content')}" tabindex="1" id="previewSwitch">
- <a:support action="#{documentHome.wikiTextValidator.validate('content', documentHome.formContent, true)}"
- status="globalStatus"
- event="onchange"
- oncomplete="onAjaxRequestComplete()"
- reRender="contentPreview, docEditForm:contentTextEditor, pluginSwitch"/>
- </h:selectBooleanCheckbox>
- <h:outputText value="#{messages['lacewiki.label.docEdit.EnablePreview']}"/>
- </div>
- </s:div>
- <s:div id="pluginSwitch">
- <s:div styleClass="entry" rendered="false">
- <div class="label"> </div>
- <div class="input">
- <h:selectBooleanCheckbox styleClass="ajaxSupport" value="#{documentHome.showPluginPrefs}" tabindex="1">
- <a:support status="globalStatus" event="onchange" reRender="contentPreview" oncomplete="onAjaxRequestComplete()"/>
- </h:selectBooleanCheckbox>
- <h:outputText value="#{messages['lacewiki.label.docEdit.ShowPluginSettings']}"/>
- </div>
- </s:div>
- </s:div>
--->
</div>
</a:region>
@@ -362,7 +329,7 @@
<br/>
<s:div id="contentPreview">
- <c:if test="#{wikiTextPreview.isPreviewEnabled('content') and wikiTextValidator.isValid('content')}">
+ <c:if test="#{documentHome.textEditor.previewEnabled and documentHome.textEditor.valid}">
<s:div id="documentDisplayContainer"
styleClass="box">
<s:fragment rendered="#{documentHome.instance.macroPresent('clearBackground')}">
@@ -380,7 +347,7 @@
</h1>
</s:div>
- <wiki:formattedText value="#{documentHome.instance.content}"
+ <wiki:formattedText value="#{documentHome.textEditor.value}"
linkStyleClass="regularLink"
brokenLinkStyleClass="brokenLink"
attachmentLinkStyleClass="regularLink"
@@ -392,11 +359,11 @@
</s:div>
</s:div>
- <s:div rendered="#{wikiTextPreview.isPreviewEnabled('content')}">
+ <s:div rendered="#{documentHome.textEditor.previewEnabled and documentHome.textEditor.valid}">
<ui:include src="includes/attachmentDisplay.xhtml"/>
</s:div>
</c:if>
- <c:if test="#{wikiTextPreview.isPreviewEnabled('content') and not wikiTextValidator.isValid('content')}">
+ <c:if test="#{documentHome.textEditor.previewEnabled and not documentHome.textEditor.valid}">
<h:outputText value="#{messages['lacewiki.msg.wikiTextValidator.InvalidWikiText']}"/>
</c:if>
</s:div>
Modified: trunk/examples/wiki/view/docHistory_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docHistory_d.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/docHistory_d.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -163,6 +163,7 @@
<hr/>
</s:div>
<s:div id="documentDisplay" styleClass="documentDisplay">
+ <!-- TODO: Ugh, we don't know if this is plaintext or not -->
<wiki:formattedText value="#{documentHistory.displayedHistoricalFile.content}"
linkStyleClass="regularLink"
brokenLinkStyleClass="brokenLink"
Modified: trunk/examples/wiki/view/includes/commentForm.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/commentForm.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/includes/commentForm.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -82,26 +82,16 @@
</s:decorate>
</a:region>
- <a:region>
- <ui:include src="wikiTextEditor.xhtml">
- <ui:param name="textEditorId" value="comment"/>
- <ui:param name="valueBinding" value="#{commentHome.instance.content}"/>
- <ui:param name="namingContainer" value="commentForm"/>
- <ui:param name="label" value="#{messages['lacewiki.label.commentForm.Comment']}"/>
- <ui:param name="textEditorColumns" value="#{commentHome.instance.ownedByRegularUser ? '60' : '48'}"/>
- <ui:param name="textEditorRows" value="10"/>
- <ui:param name="valueMaxLength" value="32767"/>
- <ui:param name="valueRequired" value="true"/>
- </ui:include>
+ <ui:include src="wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{commentHome.textEditor}"/>
+ <ui:param name="namingContainer" value="commentForm"/>
+ </ui:include>
+ <ui:include src="wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{commentHome.textEditor}"/>
+ <ui:param name="baseDocument" value="#{currentDocument}"/>
+ <ui:param name="baseDirectory" value="#{currentDocument.parent}"/>
+ </ui:include>
- <ui:include src="wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="comment"/>
- <ui:param name="valueBinding" value="#{commentHome.instance.content}"/>
- <ui:param name="baseDocument" value="#{currentDocument}"/>
- <ui:param name="baseDirectory" value="#{currentDocument.parent}"/>
- </ui:include>
- </a:region>
-
<s:decorate id="verifyCaptchaEntry" template="captchaEntry.xhtml">
<ui:param name="rendered" value="#{!identity.loggedIn}"/>
</s:decorate>
Modified: trunk/examples/wiki/view/includes/commentsDisplay.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/commentsDisplay.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/includes/commentsDisplay.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -122,11 +122,11 @@
enableMacroRendering="false"/>
</s:cache>
</s:div>
- <s:div styleClass="commentText" rendered="#{not c.useWikiText and currentDocument.name != c.subject}" style="margin-top:15px;">
- <h:outputText value="#{wiki:escapeHTML(c.content, true)}" escape="false"/>
+ <s:div styleClass="commentText plaintext" rendered="#{not c.useWikiText and currentDocument.name != c.subject}" style="margin-top:15px;">
+ <h:outputText value="#{wiki:escapeHTML(c.content, true, true)}" escape="false"/>
</s:div>
- <s:div styleClass="commentText" rendered="#{not c.useWikiText and currentDocument.name == c.subject}">
- <h:outputText value="#{wiki:escapeHTML(c.content, true)}" escape="false"/>
+ <s:div styleClass="commentText plaintext" rendered="#{not c.useWikiText and currentDocument.name == c.subject}">
+ <h:outputText value="#{wiki:escapeHTML(c.content, true, true)}" escape="false"/>
</s:div>
<s:div styleClass="commentSignature"
Deleted: trunk/examples/wiki/view/includes/wikiTextEditor.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/wikiTextEditor.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/includes/wikiTextEditor.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -1,207 +0,0 @@
-<s:fragment
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:a="https://ajax4jsf.dev.java.net/ajax"
- xmlns:wiki="http://jboss.com/products/seam/wiki">
-
-<!-- TODO: Most of this Javascript could be made generic and not rendered for each and every
- text editor on the page (luckily we usually have just one)... -->
-
-<s:div styleClass="entry" id="#{textEditorId}TextEditor">
-
- <script type="text/javascript">
- if(jQuery.browser.mozilla){
- jQuery(function() {
- jQuery("##{namingContainer}\\:#{textEditorId}TextAreaDiv").Resizable({
- minHeight: 50,
- minWidth: 250,
- handlers: {
- se: '##{namingContainer}\\:#{textEditorId}TextEditResizeHandle'
- },
- onResize: function(size) {
- jQuery("##{namingContainer}\\:#{textEditorId}TextArea").css({ height: size.height-15 + "px" });
- jQuery("##{namingContainer}\\:#{textEditorId}TextArea").css({ width: size.width-10 + "px" });
- }
- });
- jQuery("##{namingContainer}\\:#{textEditorId}TextEditResizeHandle").show();
- })
- };
- </script>
-
- <s:div id="#{textEditorId}MessageLabel"
- styleClass="#{not wikiTextValidator.isValid(textEditorId) ? 'label errorEntry' : 'label'}">
-
- <s:div>
- <h:outputText value="#{label}:"/>
- <s:fragment rendered="#{wikiTextPreview.isPreviewEnabled(textEditorId)}">
- <br/>
- <h:outputText style="white-space:nowrap;"
- value="(#{valueMaxLength - valueBinding.length()} #{messages['lacewiki.label.wikiTextEditor.CharactersLeft']})"/>
- </s:fragment>
- </s:div>
-
- <s:div styleClass="errorMessage" rendered="#{not wikiTextValidator.isValid(textEditorId)}">
- <h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="0">
- <h:graphicImage value="#{imagePath}/attention.gif"
- width="18" height="18"
- styleClass="attentionImage"/>
- <s:span styleClass="attentionMessage"><span id="#{textEditorId}MessageText"><h:outputText value="#{messages[wikiTextValidator.getValidationFailureMessageBundleKey(textEditorId)]}"/></span></s:span>
- </h:panelGrid>
- </s:div>
-
- <s:fragment rendered="#{not empty tabId}">
- <s:span rendered="#{not wikiTextValidator.isValid(textEditorId)}">
- <script type="text/javascript">jQuery(function() {
- formTabRaiseError("#{tabId}", "#{textEditorId}TextArea", '#{label}: ' + jQuery("##{textEditorId}MessageText").html());
- });</script>
- </s:span>
- <s:span rendered="#{wikiTextValidator.isValid(textEditorId)}">
- <script type="text/javascript">jQuery(function() {
- formTabClearError("#{tabId}", "#{textEditorId}TextArea");
- });</script>
- </s:span>
- </s:fragment>
-
- </s:div>
-
- <div class="input">
-
- <h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0">
-
- <h:panelGrid id="#{textEditorId}Controls" columns="4" cellpadding="0" cellspacing="0" border="0">
-
- <s:fragment>
- <select id="#{textEditorId}Formatter"
- onchange="formatText(
- jQuery('##{namingContainer}\\:#{textEditorId}TextArea')[0],
- jQuery('##{textEditorId}Formatter')[0].options[jQuery('##{textEditorId}Formatter')[0].selectedIndex].value
- );
- #{textEditorId}RefreshPreview();
- jQuery('##{textEditorId}Formatter')[0].options[0].selected = true;">
- <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatSelection']}</option>
- <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatInline']}</option>
- <option value="|{i}|">#{messages['lacewiki.msg.wikiTextEditor.FormatMonospace']}</option>
- <option value="*{i}*">#{messages['lacewiki.msg.wikiTextEditor.FormatEmphasis']}</option>
- <option value="_{i}_">#{messages['lacewiki.msg.wikiTextEditor.FormatUnderline']}</option>
- <option value="~{i}~">#{messages['lacewiki.msg.wikiTextEditor.FormatStrikeout']}</option>
- <option value="^{i}^">#{messages['lacewiki.msg.wikiTextEditor.FormatSuperscript']}</option>
- <option value=""{i}"">#{messages['lacewiki.msg.wikiTextEditor.FormatQuote']}</option>
- <option value="[My Link=>{i}]">#{messages['lacewiki.msg.wikiTextEditor.FormatLink']}</option>
- <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatBlock']}</option>
- <option value="`{b}`">#{messages['lacewiki.msg.wikiTextEditor.FormatCodeBlock']}</option>
- <option value=""{b}"">#{messages['lacewiki.msg.wikiTextEditor.FormatQuoteBlock']}</option>
- <option value="= {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatUnorderedList']}</option>
- <option value="# {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatOrderedList']}</option>
- <option value="+ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline1']}</option>
- <option value="++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline2']}</option>
- <option value="+++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline3']}</option>
- <option value="++++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline4']}</option>
- </select>
-
- <a:jsFunction name="#{textEditorId}RefreshPreview" status="globalStatus"
- action="#{wikiTextValidator.validate(textEditorId, valueBinding, valueRequired)}"
- reRender="#{textEditorId}MessageLabel, #{textEditorId}Preview"/>
- </s:fragment>
-
- <ui:decorate template="helpPopupButton.xhtml">
- <ui:param name="label" value="#{messages['lacewiki.button.help.Help']}"/>
- <ui:param name="width" value="450"/>
- <ui:param name="height" value="350"/>
- <ui:param name="offsetId" value="#{namingContainer}\\\\:#{textEditorId}TextAreaDiv"/>
- <ui:param name="helpDocument" value="Wiki Text Markup"/>
- </ui:decorate>
-
- <s:fragment>
-
- <s:fragment rendered="#{not wikiTextPreview.isPreviewEnabled(textEditorId)}">
- <h:outputLink value="javascript://no-op"
- tabindex="1" styleClass="buttonNonpersistent noWrapWhitespace"
- accesskey="#{messages['lacewiki.button.wikiTextEditor.Validate.accesskey']}"
- onclick="rememberCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea'); #{textEditorId}Validate(); return false;">
- <h:outputText styleClass="buttonLabel" escape="false" value="#{messages['lacewiki.button.wikiTextEditor.Validate']}"/>
- </h:outputLink>
-
- <a:jsFunction name="#{textEditorId}Validate"
- action="#{wikiTextValidator.validate(textEditorId, valueBinding, valueRequired)}"
- reRender="#{textEditorId}MessageLabel, #{textEditorId}Preview"
- status="globalStatus"
- ignoreDupResponses="true"
- eventsQueue="ajaxEventQueue"
- oncomplete="onAjaxRequestComplete();
- setRememberedCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea');"/>
- </s:fragment>
-
- </s:fragment>
-
- <s:fragment>
-
- <s:fragment rendered="#{not wikiTextPreview.isPreviewEnabled(textEditorId)}">
- <h:outputLink value="javascript://no-op"
- tabindex="1" styleClass="buttonNonpersistent noWrapWhitespace"
- accesskey="#{messages['lacewiki.button.wikiTextEditor.EnablePreview.accesskey']}"
- onclick="rememberCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea'); #{textEditorId}EnablePreview(); return false;">
- <h:outputText styleClass="buttonLabel" escape="false" value="#{messages['lacewiki.button.wikiTextEditor.EnablePreview']}"/>
- </h:outputLink>
-
- <a:jsFunction name="#{textEditorId}EnablePreview"
- action="#{wikiTextPreview.enablePreview(textEditorId, valueBinding, valueRequired)}"
- status="globalStatus"
- eventsQueue="ajaxEventQueue"
- reRender="#{textEditorId}TextEditor, #{textEditorId}Preview"
- oncomplete="onAjaxRequestComplete();setRememberedCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea');"/>
-
- </s:fragment>
-
- <s:fragment rendered="#{wikiTextPreview.isPreviewEnabled(textEditorId)}">
- <h:outputLink value="javascript://no-op"
- tabindex="1" styleClass="buttonNonpersistent noWrapWhitespace"
- accesskey="#{messages['lacewiki.button.wikiTextEditor.DisablePreview.accesskey']}"
- onclick="rememberCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea'); #{textEditorId}DisablePreview(); return false;">
- <h:outputText styleClass="buttonLabel" escape="false" value="#{messages['lacewiki.button.wikiTextEditor.DisablePreview']}"/>
- </h:outputLink>
-
- <a:jsFunction name="#{textEditorId}DisablePreview"
- action="#{wikiTextPreview.disablePreview(textEditorId)}"
- status="globalStatus"
- eventsQueue="ajaxEventQueue"
- reRender="#{textEditorId}TextEditor, #{textEditorId}Preview"
- oncomplete="onAjaxRequestComplete();setRememberedCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea');"/>
-
- </s:fragment>
-
- </s:fragment>
-
- </h:panelGrid>
-
- <s:div id="#{textEditorId}TextAreaDiv" styleClass="textEditResizable">
-
- <h:inputTextarea id="#{textEditorId}TextArea"
- styleClass="ajaxSupport"
- tabindex="1"
- cols="#{empty textEditorColumns ? '58' : textEditorColumns}"
- rows="#{textEditorRows}"
- value="#{valueBinding}">
- <a:support event="onkeyup"
- action="#{wikiTextValidator.validate(textEditorId, valueBinding, valueRequired)}"
- reRender="#{textEditorId}MessageLabel, #{textEditorId}Preview"
- status="globalStatus"
- ignoreDupResponses="true"
- requestDelay="3000"
- ajaxSingle="true"
- eventsQueue="ajaxEventQueue"
- oncomplete="onAjaxRequestComplete()"
- rendered="#{wikiTextPreview.isPreviewEnabled(textEditorId)}"/>
- </h:inputTextarea>
-
- <s:div id="#{textEditorId}TextEditResizeHandle" styleClass="textEditResizeHandle" style="display:none;float:right;"/>
- </s:div>
-
- </h:panelGrid>
-
- </div>
-</s:div>
-
-</s:fragment>
-
Deleted: trunk/examples/wiki/view/includes/wikiTextPreview.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/wikiTextPreview.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/includes/wikiTextPreview.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -1,29 +0,0 @@
-<s:fragment
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:a="https://ajax4jsf.dev.java.net/ajax"
- xmlns:wiki="http://jboss.com/products/seam/wiki">
-
-<s:div id="#{textEditorId}Preview">
- <s:div styleClass="textPreview"
- rendered="#{not empty valueBinding
- and wikiTextPreview.isPreviewEnabled(textEditorId)
- and wikiTextValidator.isValid(textEditorId)}">
- <wiki:formattedText value="#{valueBinding}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- linkBaseFile="#{baseDocument}"
- currentAreaNumber="#{baseDirectory.areaNumber}"
- enableMacroRendering="false"/>
- </s:div>
- <s:div styleClass="textPreview"
- rendered="#{wikiTextPreview.isPreviewEnabled(textEditorId) and not wikiTextValidator.isValid(textEditorId)}">
- <h:outputText value="#{messages['lacewiki.msg.wikiTextValidator.InvalidWikiText']}"/>
- </s:div>
-</s:div>
-
-</s:fragment>
Added: trunk/examples/wiki/view/includes/wikitext/editor/editor.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/wikitext/editor/editor.xhtml (rev 0)
+++ trunk/examples/wiki/view/includes/wikitext/editor/editor.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -0,0 +1,225 @@
+<s:fragment
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:wiki="http://jboss.com/products/seam/wiki">
+
+<a:region>
+<s:div styleClass="textEditor" id="#{textEditor.key}TextEditor">
+
+ <!-- ################################# JavaScript functions ################################# -->
+
+ <script type="text/javascript">
+
+ /* Make text area resizable */
+ jQuery(function() {
+ eval("#{textEditor.key}SizeTextArea()")
+ })
+
+ function #{textEditor.key}SizeTextArea() {
+ var width = jQuery("##{namingContainer}\\:#{textEditor.key}TextEditor").width();
+ jQuery("##{namingContainer}\\:#{textEditor.key}TextArea").width(
+ width-20 // Safety for IE scrollbar
+ );
+ makeTextAreaResizable("##{namingContainer}\\:#{textEditor.key}TextArea")
+ }
+
+ /* Some functions we need to store the cursor position and restore it after reRender */
+ function #{textEditor.key}StoreSettings() {
+ storeEditorSettings('##{namingContainer}\\:#{textEditor.key}TextArea');
+ }
+
+ function #{textEditor.key}RecallSettings() {
+ recallEditorSettings('##{namingContainer}\\:#{textEditor.key}TextArea');
+ }
+ </script>
+
+ <a:jsFunction name="#{textEditor.key}ValidateDelayed"
+ action="#{textEditor.validate}"
+ reRender="#{textEditor.key}Messages, #{textEditor.key}PreviewOption, #{textEditor.key}Preview"
+ status="globalStatus"
+ requestDelay="3000"
+ ignoreDupResponses="true"
+ eventsQueue="ajaxEventQueue"
+ oncomplete="onAjaxRequestComplete();"/>
+
+ <a:jsFunction name="#{textEditor.key}ValidateImmediately"
+ action="#{textEditor.validate}"
+ reRender="#{textEditor.key}Messages, #{textEditor.key}PreviewOption, #{textEditor.key}Preview"
+ status="globalStatus"
+ ignoreDupResponses="true"
+ eventsQueue="ajaxEventQueue"
+ oncomplete="onAjaxRequestComplete();"/>
+
+ <!-- Now the reRender-able functions -->
+ <s:div id="#{textEditor.key}Functions">
+
+ <!--
+ Bind preview update to keyup on textarea - we do this so we don't have to reRender the textarea when
+ the preview is enabled or disabled, this would disrupt the workflow of the user and it flashes on the screen.
+ -->
+ <s:fragment rendered="#{textEditor.previewEnabled}">
+ <script type="text/javascript">jQuery(function() {
+ jQuery("##{namingContainer}\\:#{textEditor.key}TextArea").bind(
+ "keyup",
+ function(e) {
+ eval("#{textEditor.key}ValidateDelayed()");
+ }
+ ).attr("wrap", "virtual");
+ });</script>
+ </s:fragment>
+ <s:fragment rendered="#{not textEditor.previewEnabled}">
+ <script type="text/javascript">jQuery(function() {
+ jQuery("##{namingContainer}\\:#{textEditor.key}TextArea").unbind("keyup").attr("wrap", "virtual");
+ });</script>
+ </s:fragment>
+
+ <!-- Toolbar formatter doesn't work on IE, so only fade it in if it is a) hidden and b) no MSFT software -->
+ <script type="text/javascript">jQuery(function() {
+ if(!jQuery.browser.msie && jQuery("##{textEditor.key}Formatter").css("display") == "none"){
+ jQuery("##{textEditor.key}Formatter").fadeIn(1000);
+ }
+ });</script>
+
+ </s:div>
+
+ <!-- ################################# Toolbar ################################# -->
+ <s:div id="#{textEditor.key}Toolbar" styleClass="textEditorToolbar">
+ <h:panelGrid columns="2" style="width:100%;" columnClasses="alignLeft, alignRight"
+ cellpadding="0" cellspacing="0" border="0">
+
+ <s:div id="#{textEditor.key}ToolbarFormatter">
+ <select id="#{textEditor.key}Formatter" style="display:none"
+ onchange="formatText(
+ jQuery('##{namingContainer}\\:#{textEditor.key}TextArea')[0],
+ jQuery('##{textEditor.key}Formatter')[0].options[jQuery('##{textEditor.key}Formatter')[0].selectedIndex].value
+ );
+ eval('#{textEditor.key}ValidateImmediately()');
+ jQuery('##{textEditor.key}Formatter')[0].options[0].selected = true;">
+ <s:fragment rendered="#{textEditor.valuePlaintext}">
+ <option value="">#{messages['lacewiki.msg.wikiTextEditor.MarkupDisabled']}</option>
+ </s:fragment>
+ <s:fragment rendered="#{not textEditor.valuePlaintext}">
+ <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatSelection']}</option>
+ <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatInline']}</option>
+ <option value="|{i}|">#{messages['lacewiki.msg.wikiTextEditor.FormatMonospace']}</option>
+ <option value="*{i}*">#{messages['lacewiki.msg.wikiTextEditor.FormatEmphasis']}</option>
+ <option value="_{i}_">#{messages['lacewiki.msg.wikiTextEditor.FormatUnderline']}</option>
+ <option value="~{i}~">#{messages['lacewiki.msg.wikiTextEditor.FormatStrikeout']}</option>
+ <option value="^{i}^">#{messages['lacewiki.msg.wikiTextEditor.FormatSuperscript']}</option>
+ <option value=""{i}"">#{messages['lacewiki.msg.wikiTextEditor.FormatQuote']}</option>
+ <option value="[My Link=>{i}]">#{messages['lacewiki.msg.wikiTextEditor.FormatLink']}</option>
+ <option value="">#{messages['lacewiki.msg.wikiTextEditor.FormatBlock']}</option>
+ <option value="`{b}`">#{messages['lacewiki.msg.wikiTextEditor.FormatCodeBlock']}</option>
+ <option value=""{b}"">#{messages['lacewiki.msg.wikiTextEditor.FormatQuoteBlock']}</option>
+ <option value="= {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatUnorderedList']}</option>
+ <option value="# {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatOrderedList']}</option>
+ <option value="+ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline1']}</option>
+ <option value="++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline2']}</option>
+ <option value="+++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline3']}</option>
+ <option value="++++ {b}">#{messages['lacewiki.msg.wikiTextEditor.FormatHeadline4']}</option>
+ </s:fragment>
+ </select>
+
+ </s:div>
+
+ <ui:decorate template="../../helpPopupButton.xhtml">
+ <ui:param name="label" value="#{messages['lacewiki.button.help.Help']}"/>
+ <ui:param name="width" value="450"/>
+ <ui:param name="height" value="350"/>
+ <ui:param name="offsetId" value="#{namingContainer}\\\\:#{textEditor.key}TextAreaDiv"/>
+ <ui:param name="helpDocument" value="Wiki Text Markup"/>
+ </ui:decorate>
+
+ </h:panelGrid>
+ </s:div>
+
+ <!-- ################################# Messages ################################# -->
+
+ <s:div id="#{textEditor.key}Messages"
+ styleClass="#{not textEditor.valid ? 'textEditorErrorMessages' : 'textEditorMessages'}">
+
+ <s:div styleClass="errorMessage" rendered="#{not textEditor.valid}">
+ <h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="0">
+ <h:graphicImage value="#{imagePath}/attention.gif"
+ width="18" height="18"
+ styleClass="attentionImage"/>
+ <s:span styleClass="attentionMessage"><span
+ id="#{textEditor.key}MessageText"><h:outputText
+ value="#{messages[textEditor.lastValidationError]}"/></span></s:span>
+ </h:panelGrid>
+ </s:div>
+
+ <s:fragment rendered="#{not empty tabId}">
+ <s:span rendered="#{not textEditor.valid}">
+ <script type="text/javascript">jQuery(function() {
+ formTabRaiseError("#{tabId}", "#{textEditor.key}TextArea", '#{messages[textEditor.lastValidationError]}');
+ });</script>
+ </s:span>
+ <s:span rendered="#{textEditor.valid}">
+ <script type="text/javascript">jQuery(function() {
+ formTabClearError("#{tabId}", "#{textEditor.key}TextArea");
+ });</script>
+ </s:span>
+ </s:fragment>
+
+ </s:div>
+
+ <!-- ################################# Text Area ################################# -->
+
+ <s:div id="#{textEditor.key}TextAreaDiv" styleClass="textEditResizable">
+
+ <h:inputTextarea id="#{textEditor.key}TextArea"
+ styleClass="ajaxSupport"
+ tabindex="1"
+ rows="#{textEditor.rows}"
+ value="#{textEditor.value}"/>
+
+ <s:div id="#{textEditor.key}TextAreaResizeHandle"
+ styleClass="textAreaResizeHandle" style="display:none;float:right;"/>
+ </s:div>
+
+ <!-- ################################# Options ################################# -->
+
+ <s:div id="#{textEditor.key}PlaintextOption">
+ <h:panelGroup rendered="#{textEditor.allowPlaintext}">
+ <h:selectBooleanCheckbox value="#{textEditor.valuePlaintext}"
+ tabindex="1"
+ onclick="eval('#{textEditor.key}StoreSettings()');">
+ <a:support status="globalStatus" event="onchange"
+ action="#{textEditor.switchPlaintext}"
+ reRender="#{textEditor.key}Functions, #{textEditor.key}Messages, #{textEditor.key}ToolbarFormatter,
+ #{textEditor.key}PlaintextOption, #{textEditor.key}PreviewOption, #{textEditor.key}Preview"
+ oncomplete="onAjaxRequestComplete(); eval('#{textEditor.key}RecallSettings()');"/>
+ </h:selectBooleanCheckbox>
+ <s:span style="white-space:nowrap;">
+ <h:outputText value="#{messages['lacewiki.label.wikiTextEditor.DisableContentMarkup']}"/>
+ </s:span>
+ </h:panelGroup>
+ </s:div>
+
+ <s:div id="#{textEditor.key}PreviewOption">
+ <h:panelGroup>
+ <h:selectBooleanCheckbox value="#{textEditor.previewEnabled}"
+ tabindex="1"
+ onclick="eval('#{textEditor.key}StoreSettings()');">
+ <a:support status="globalStatus" event="onchange"
+ reRender="#{textEditor.key}Functions, #{textEditor.key}Messages,
+ #{textEditor.key}PreviewOption, #{textEditor.key}Preview"
+ oncomplete="onAjaxRequestComplete(); eval('#{textEditor.key}RecallSettings()');"/>
+ </h:selectBooleanCheckbox>
+ <s:span style="white-space:nowrap;">
+ <h:outputText value="#{messages['lacewiki.label.wikiTextEditor.EnableLivePreview']}"/>
+ <h:outputText rendered="#{textEditor.previewEnabled}"
+ value=" (#{textEditor.remainingCharacters} #{messages['lacewiki.label.wikiTextEditor.CharactersLeft']})"/>
+ </s:span>
+ </h:panelGroup>
+ </s:div>
+
+</s:div>
+</a:region>
+
+</s:fragment>
+
Added: trunk/examples/wiki/view/includes/wikitext/editor/preview.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/wikitext/editor/preview.xhtml (rev 0)
+++ trunk/examples/wiki/view/includes/wikitext/editor/preview.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -0,0 +1,40 @@
+<s:fragment
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:wiki="http://jboss.com/products/seam/wiki">
+
+<s:div id="#{textEditor.key}Preview">
+ <s:fragment rendered="#{textEditor.previewEnabled}">
+
+ <s:div styleClass="textPreview"
+ rendered="#{not textEditor.valuePlaintext and textEditor.valid}">
+
+ <wiki:formattedText value="#{textEditor.value}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ linkBaseFile="#{baseDocument}"
+ currentAreaNumber="#{baseDirectory.areaNumber}"
+ enableMacroRendering="false"/>
+ </s:div>
+
+ <s:div styleClass="textPreview"
+ rendered="#{not textEditor.valuePlaintext and not textEditor.valid}">
+ <h:outputText value="#{messages['lacewiki.msg.wikiTextValidator.InvalidWikiText']}"/>
+ </s:div>
+
+ <s:div styleClass="textPreview"
+ rendered="#{textEditor.valuePlaintext}">
+ <s:div styleClass="plaintext">
+ <h:outputText escape="false" value="#{wiki:escapeHTML(textEditor.value, true, true)}"/>
+ </s:div>
+ </s:div>
+
+ </s:fragment>
+</s:div>
+
+</s:fragment>
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-06-19 14:57:46 UTC (rev 8386)
@@ -686,7 +686,31 @@
.wideLabels .textEditResizable {}
-.textEditResizeHandle {
+.textEditor {
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin-left: 80px;
+ margin-right: 80px;
+}
+
+.textEditorToolbar {
+ padding-right: 10px;
+}
+
+.textEditorMessages {
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textEditorErrorMessages {
+ background-color: #ffeeee;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textAreaResizeHandle {
width: 15px;
height: 15px;
background: #f5f5f5 url(../img/icon.resize_se.gif) no-repeat;
@@ -702,9 +726,20 @@
padding-bottom: 5px;
background-color: white;
margin-left: 80px;
- margin-right: 80px;
+ margin-right: 95px;
}
+.plaintext {
+ font-family: Andale Mono, Courier New, monospace;
+ overflow-x: auto;
+ border: none;
+ background: none;
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 10px;
+ padding-bottom: 10px;
+}
+
/* Directory Browser
----------------------------------------------- */
Modified: trunk/examples/wiki/view/themes/default/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-06-19 14:57:46 UTC (rev 8386)
@@ -128,9 +128,31 @@
}
}
-var cursorPosition;
-var scrollPosition;
-function rememberCursorPosition(textAreaId) {
+function makeTextAreaResizable(textAreaId) {
+ if(jQuery.browser.mozilla){
+ var textAreaDivId = textAreaId + "Div";
+ var textAreaResizeHandleId = textAreaId + "ResizeHandle";
+ jQuery(textAreaDivId).Resizable({
+ minHeight: 50,
+ minWidth: 250,
+ handlers: {
+ se: textAreaResizeHandleId
+ },
+ onResize: function(size) {
+ jQuery(textAreaId).height(size.height-10);
+ jQuery(textAreaId).width(size.width-10);
+ }
+ }).width(jQuery(textAreaId).width()+10);
+ jQuery(textAreaResizeHandleId).show();
+ };
+
+}
+
+var editorCursorPosition;
+var editorScrollPosition;
+var editorSizeX;
+var editorSizeY;
+function storeEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
cursorPosition = textArea.caretPos;
@@ -140,9 +162,11 @@
} else {
cursorPosition = textArea.value.length - 1;
}
+ editorSizeX = jQuery(textAreaId).width();
+ editorSizeY = jQuery(textAreaId).height();
}
-function setRememberedCursorPosition(textAreaId) {
+function recallEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if(textArea.createTextRange) {
var range = textArea.createTextRange();
@@ -155,4 +179,6 @@
} else {
textArea.focus(cursorPosition);
}
-}
\ No newline at end of file
+ jQuery(textAreaId).width(editorSizeX);
+ jQuery(textAreaId).height(editorSizeY);
+}
Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-06-19 14:57:46 UTC (rev 8386)
@@ -697,14 +697,38 @@
.wideLabels .textEditResizable {}
-.textEditResizeHandle {
+.textEditor {
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin-left: 80px;
+ margin-right: 80px;
+}
+
+.textEditorToolbar {
+ padding-right: 10px;
+}
+
+.textEditorMessages {
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textEditorErrorMessages {
+ background-color: #ffeeee;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textAreaResizeHandle {
width: 15px;
height: 15px;
background: #f5f5f5 url(../img/icon.resize_se.gif) no-repeat;
cursor: se-resize;
}
-.wideLabels .textEditResizeHandle {
+.wideLabels .textAreaResizeHandle {
}
.textPreview {
@@ -716,9 +740,21 @@
padding-bottom: 5px;
background-color: white;
margin-left: 80px;
- margin-right: 80px;
+ margin-right: 95px;
}
+.plaintext {
+ font-family: Andale Mono, Courier New, monospace;
+ overflow-x: auto;
+ border: none;
+ background: none;
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 10px;
+ padding-bottom: 10px;
+ font-size: 95%;
+}
+
/* Directory Browser
----------------------------------------------- */
Modified: trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-06-19 14:57:46 UTC (rev 8386)
@@ -128,9 +128,31 @@
}
}
-var cursorPosition;
-var scrollPosition;
-function rememberCursorPosition(textAreaId) {
+function makeTextAreaResizable(textAreaId) {
+ if(jQuery.browser.mozilla){
+ var textAreaDivId = textAreaId + "Div";
+ var textAreaResizeHandleId = textAreaId + "ResizeHandle";
+ jQuery(textAreaDivId).Resizable({
+ minHeight: 50,
+ minWidth: 250,
+ handlers: {
+ se: textAreaResizeHandleId
+ },
+ onResize: function(size) {
+ jQuery(textAreaId).height(size.height-10);
+ jQuery(textAreaId).width(size.width-10);
+ }
+ }).width(jQuery(textAreaId).width()+10);
+ jQuery(textAreaResizeHandleId).show();
+ };
+
+}
+
+var editorCursorPosition;
+var editorScrollPosition;
+var editorSizeX;
+var editorSizeY;
+function storeEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
cursorPosition = textArea.caretPos;
@@ -140,9 +162,11 @@
} else {
cursorPosition = textArea.value.length - 1;
}
+ editorSizeX = jQuery(textAreaId).width();
+ editorSizeY = jQuery(textAreaId).height();
}
-function setRememberedCursorPosition(textAreaId) {
+function recallEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if(textArea.createTextRange) {
var range = textArea.createTextRange();
@@ -155,4 +179,6 @@
} else {
textArea.focus(cursorPosition);
}
-}
\ No newline at end of file
+ jQuery(textAreaId).width(editorSizeX);
+ jQuery(textAreaId).height(editorSizeY);
+}
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-06-19 14:57:46 UTC (rev 8386)
@@ -981,7 +981,31 @@
.wideLabels .textEditResizable {}
-.textEditResizeHandle {
+.textEditor {
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin-left: 80px;
+ margin-right: 80px;
+}
+
+.textEditorToolbar {
+ padding-right: 10px;
+}
+
+.textEditorMessages {
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textEditorErrorMessages {
+ background-color: #ffeeee;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+}
+
+.textAreaResizeHandle {
width: 15px;
height: 15px;
background: #f5f5f5 url(../img/icon.resize_se.gif) no-repeat;
@@ -996,10 +1020,22 @@
padding-top: 5px;
padding-bottom: 5px;
background-color: white;
- margin-left: 50px;
- margin-right: 50px;
+ margin-left: 80px;
+ margin-right: 95px;
}
+.plaintext {
+ font-family: Andale Mono, Courier New, monospace;
+ overflow-x: auto;
+ border: none;
+ background: none;
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 10px;
+ padding-bottom: 10px;
+ font-size: 95%;
+}
+
/* Box on page
----------------------------------------------- */
Modified: trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-06-19 14:57:46 UTC (rev 8386)
@@ -128,9 +128,31 @@
}
}
-var cursorPosition;
-var scrollPosition;
-function rememberCursorPosition(textAreaId) {
+function makeTextAreaResizable(textAreaId) {
+ if(jQuery.browser.mozilla){
+ var textAreaDivId = textAreaId + "Div";
+ var textAreaResizeHandleId = textAreaId + "ResizeHandle";
+ jQuery(textAreaDivId).Resizable({
+ minHeight: 50,
+ minWidth: 250,
+ handlers: {
+ se: textAreaResizeHandleId
+ },
+ onResize: function(size) {
+ jQuery(textAreaId).height(size.height-10);
+ jQuery(textAreaId).width(size.width-10);
+ }
+ }).width(jQuery(textAreaId).width()+10);
+ jQuery(textAreaResizeHandleId).show();
+ };
+
+}
+
+var editorCursorPosition;
+var editorScrollPosition;
+var editorSizeX;
+var editorSizeY;
+function storeEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
cursorPosition = textArea.caretPos;
@@ -140,9 +162,11 @@
} else {
cursorPosition = textArea.value.length - 1;
}
+ editorSizeX = jQuery(textAreaId).width();
+ editorSizeY = jQuery(textAreaId).height();
}
-function setRememberedCursorPosition(textAreaId) {
+function recallEditorSettings(textAreaId) {
var textArea = jQuery(textAreaId)[0];
if(textArea.createTextRange) {
var range = textArea.createTextRange();
@@ -155,4 +179,6 @@
} else {
textArea.focus(cursorPosition);
}
-}
\ No newline at end of file
+ jQuery(textAreaId).width(editorSizeX);
+ jQuery(textAreaId).height(editorSizeY);
+}
Modified: trunk/examples/wiki/view/userHome_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userHome_d.xhtml 2008-06-18 20:49:04 UTC (rev 8385)
+++ trunk/examples/wiki/view/userHome_d.xhtml 2008-06-19 14:57:46 UTC (rev 8386)
@@ -25,7 +25,7 @@
<ui:define name="content">
<h:form id="userHomeForm" styleClass="box" enctype="multipart/form-data">
- <div class="form">
+ <div class="form">
<script type="text/javascript">startSessionTimeoutCheck()</script>
@@ -44,6 +44,7 @@
<h:outputText escape="false" value="#{messages['lacewiki.button.userHome.Account']}"/>
</a></li>
<li id="userProfileTab"><a href="#userProfile"
+ onclick="setTimeout('bioSizeTextArea(); signatureSizeTextArea();', 200);"
accesskey="#{messages['lacewiki.button.userHome.Profile.accesskey']}">
<h:outputText escape="false" value="#{messages['lacewiki.button.userHome.Profile']}"/>
</a></li>
@@ -213,20 +214,17 @@
</s:span>
</s:div>
- <ui:include src="includes/wikiTextEditor.xhtml">
- <ui:param name="tabId" value="userProfileTab"/>
- <ui:param name="textEditorId" value="bio"/>
+ <s:div styleClass="entry">
+ <div class="label"><h:outputText value="#{messages['lacewiki.label.userHome.Bio']}:"/></div>
+ <div class="output"> </div>
+ </s:div>
+ <ui:include src="includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{userHome.bioTextEditor}"/>
<ui:param name="namingContainer" value="userHomeForm"/>
- <ui:param name="label" value="#{messages['lacewiki.label.userHome.Bio']}"/>
- <ui:param name="valueBinding" value="#{userHome.instance.profile.bio}"/>
- <ui:param name="valueMaxLength" value="1000"/>
- <ui:param name="textEditorColumns" value="50"/>
- <ui:param name="textEditorRows" value="5"/>
+ <ui:param name="tabId" value="userProfileTab"/>
</ui:include>
-
- <ui:include src="includes/wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="bio"/>
- <ui:param name="valueBinding" value="#{userHome.instance.profile.bio}"/>
+ <ui:include src="includes/wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{userHome.bioTextEditor}"/>
<ui:param name="baseDocument" value="#{wikiStart}"/>
<ui:param name="baseDirectory" value="#{wikiStart.parent}"/>
</ui:include>
@@ -258,20 +256,17 @@
</h:inputText>
</s:decorate>
- <ui:include src="includes/wikiTextEditor.xhtml">
- <ui:param name="tabId" value="userProfileTab"/>
- <ui:param name="textEditorId" value="signature"/>
+ <s:div styleClass="entry">
+ <div class="label"><h:outputText value="#{messages['lacewiki.label.userHome.Signature']}:"/></div>
+ <div class="output"> </div>
+ </s:div>
+ <ui:include src="includes/wikitext/editor/editor.xhtml">
+ <ui:param name="textEditor" value="#{userHome.signatureTextEditor}"/>
<ui:param name="namingContainer" value="userHomeForm"/>
- <ui:param name="label" value="#{messages['lacewiki.label.userHome.Signature']}"/>
- <ui:param name="valueBinding" value="#{userHome.instance.profile.signature}"/>
- <ui:param name="valueMaxLength" value="1000"/>
- <ui:param name="textEditorColumns" value="50"/>
- <ui:param name="textEditorRows" value="5"/>
+ <ui:param name="tabId" value="userProfileTab"/>
</ui:include>
-
- <ui:include src="includes/wikiTextPreview.xhtml">
- <ui:param name="textEditorId" value="signature"/>
- <ui:param name="valueBinding" value="#{userHome.instance.profile.signature}"/>
+ <ui:include src="includes/wikitext/editor/preview.xhtml">
+ <ui:param name="textEditor" value="#{userHome.signatureTextEditor}"/>
<ui:param name="baseDocument" value="#{wikiStart}"/>
<ui:param name="baseDirectory" value="#{wikiStart.parent}"/>
</ui:include>
16 years, 3 months
Seam SVN: r8385 - trunk.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-18 16:49:04 -0400 (Wed, 18 Jun 2008)
New Revision: 8385
Modified:
trunk/seam-text.g
Log:
Avoid NPE
Modified: trunk/seam-text.g
===================================================================
--- trunk/seam-text.g 2008-06-18 17:37:47 UTC (rev 8384)
+++ trunk/seam-text.g 2008-06-18 20:49:04 UTC (rev 8385)
@@ -260,6 +260,8 @@
Token attribute,
String attributeValue) throws SemanticException {
+ if (attributeValue == null || attributeValue.length() == 0) return;
+
String elementName = element.getText().toLowerCase();
String attributeName = attribute.getText().toLowerCase();
16 years, 3 months
Seam SVN: r8384 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-06-18 13:37:47 -0400 (Wed, 18 Jun 2008)
New Revision: 8384
Modified:
trunk/src/main/org/jboss/seam/Component.java
Log:
woops - left in the println
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-06-18 03:08:40 UTC (rev 8383)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-06-18 17:37:47 UTC (rev 8384)
@@ -963,12 +963,10 @@
Class interceptorClass = interceptor.getUserInterceptorClass();
if (interceptorClass != null) {
if (Init.instance().getDisabledInterceptors().contains(interceptorClass.getName())) {
- System.out.println("**** DISABLED INTERCEPTOR[" + name + "] " + interceptorClass);
return false;
}
}
- System.out.println("**** INTERCEPTOR[" + name + "] " + interceptorClass);
return true;
}
16 years, 3 months
Seam SVN: r8383 - trunk/src/main/org/jboss/seam/annotations/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-17 23:08:40 -0400 (Tue, 17 Jun 2008)
New Revision: 8383
Modified:
trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java
Log:
minor
Modified: trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java 2008-06-17 22:52:14 UTC (rev 8382)
+++ trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java 2008-06-18 03:08:40 UTC (rev 8383)
@@ -1,6 +1,6 @@
package org.jboss.seam.annotations.security;
-import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
@@ -14,7 +14,7 @@
*
* @author Shane Bryzak
*/
-@Target({TYPE})
+@Target({ANNOTATION_TYPE})
@Documented
@Retention(RUNTIME)
@Inherited
16 years, 3 months
Seam SVN: r8382 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-06-17 18:52:14 -0400 (Tue, 17 Jun 2008)
New Revision: 8382
Modified:
trunk/src/main/org/jboss/seam/core-2.1.xsd
Log:
JBSEAM-3096
Modified: trunk/src/main/org/jboss/seam/core-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/core-2.1.xsd 2008-06-17 21:48:33 UTC (rev 8381)
+++ trunk/src/main/org/jboss/seam/core-2.1.xsd 2008-06-17 22:52:14 UTC (rev 8382)
@@ -14,6 +14,13 @@
<xs:documentation>A Seam component that holds Seam configuration settings</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="disabled-interceptors" type="components:multiValuedProperty">
+ <xs:annotation>
+ <xs:documentation>A list of interceptors that should be disabled for all components</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.init"/>
</xs:complexType>
@@ -24,6 +31,7 @@
<xs:attribute name="jndi-pattern" type="components:string" />
<xs:attribute name="transaction-management-enabled" type="components:boolean"/>
<xs:attribute name="user-transaction-name" type="components:string"/>
+ <xs:attribute name="disabled-interceptors" type="components:string" />
</xs:attributeGroup>
<xs:element name="manager">
16 years, 3 months
Seam SVN: r8381 - in trunk/src/main/org/jboss/seam: core and 1 other directory.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-06-17 17:48:33 -0400 (Tue, 17 Jun 2008)
New Revision: 8381
Modified:
trunk/src/main/org/jboss/seam/Component.java
trunk/src/main/org/jboss/seam/core/Init.java
Log:
JBSEAM-3096
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-06-13 17:54:41 UTC (rev 8380)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-06-17 21:48:33 UTC (rev 8381)
@@ -48,6 +48,8 @@
import javassist.util.proxy.MethodFilter;
import javassist.util.proxy.MethodHandler;
+
+import org.apache.tools.ant.types.Assertions.EnabledAssertion;
import org.jboss.seam.util.ProxyFactory;
import javassist.util.proxy.ProxyObject;
@@ -948,16 +950,28 @@
public void addInterceptor(Interceptor interceptor)
{
- if ( interceptor.getType()==InterceptorType.SERVER)
- {
- interceptors.add(interceptor);
- }
- else
- {
- clientSideInterceptors.add(interceptor);
- }
+ if (isInterceptorEnabled(interceptor)) {
+ if (interceptor.getType()==InterceptorType.SERVER) {
+ interceptors.add(interceptor);
+ } else {
+ clientSideInterceptors.add(interceptor);
+ }
+ }
}
+ private boolean isInterceptorEnabled(Interceptor interceptor) {
+ Class interceptorClass = interceptor.getUserInterceptorClass();
+ if (interceptorClass != null) {
+ if (Init.instance().getDisabledInterceptors().contains(interceptorClass.getName())) {
+ System.out.println("**** DISABLED INTERCEPTOR[" + name + "] " + interceptorClass);
+ return false;
+ }
+ }
+
+ System.out.println("**** INTERCEPTOR[" + name + "] " + interceptorClass);
+ return true;
+ }
+
private List<Interceptor> newSort(List<Interceptor> list)
{
List<SortItem<Interceptor>> siList = new ArrayList<SortItem<Interceptor>>();
Modified: trunk/src/main/org/jboss/seam/core/Init.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Init.java 2008-06-13 17:54:41 UTC (rev 8380)
+++ trunk/src/main/org/jboss/seam/core/Init.java 2008-06-17 21:48:33 UTC (rev 8381)
@@ -50,6 +50,8 @@
private boolean myFacesLifecycleBug;
private boolean transactionManagementEnabled = true;
+ private List<String> disabledInterceptors = new ArrayList<String>();
+
private Map<String, List<ObserverMethod>> observerMethods = new HashMap<String, List<ObserverMethod>>();
private Map<String, List<ObserverMethodExpression>> observerMethodBindings = new HashMap<String, List<ObserverMethodExpression>>();
private Map<String, FactoryMethod> factories = new HashMap<String, FactoryMethod>();
@@ -532,4 +534,14 @@
{
return globalImports;
}
+
+ public List<String> getDisabledInterceptors() {
+ return disabledInterceptors;
+ }
+
+ public void setDisabledInterceptors(List<String> disabledInterceptors) {
+ this.disabledInterceptors = disabledInterceptors;
+ }
+
+
}
16 years, 3 months
Seam SVN: r8380 - in branches/Seam_2_0: build and 1 other directory.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-06-13 13:54:41 -0400 (Fri, 13 Jun 2008)
New Revision: 8380
Modified:
branches/Seam_2_0/build/default.build.properties
branches/Seam_2_0/readme.txt
Log:
updated for 2.0.3-SNAPSHOT work in SEAM_2_0 branch
Modified: branches/Seam_2_0/build/default.build.properties
===================================================================
--- branches/Seam_2_0/build/default.build.properties 2008-06-13 17:53:13 UTC (rev 8379)
+++ branches/Seam_2_0/build/default.build.properties 2008-06-13 17:54:41 UTC (rev 8380)
@@ -8,7 +8,7 @@
major.version 2
minor.version .0
patchlevel .3
-qualifier .CR1
+qualifier -SNAPSHOT
#
# Other program locations
# -----------------------
Modified: branches/Seam_2_0/readme.txt
===================================================================
--- branches/Seam_2_0/readme.txt 2008-06-13 17:53:13 UTC (rev 8379)
+++ branches/Seam_2_0/readme.txt 2008-06-13 17:54:41 UTC (rev 8380)
@@ -1,6 +1,6 @@
JBoss Seam - Contextual Component framework for Java EE 5
=========================================================
-version 2.0.3.CR1, June 2008
+version 2.0.3-SNAPSHOT, June 2008
This software is distributed under the terms of the FSF Lesser Gnu
Public License (see lgpl.txt).
16 years, 3 months