Author: dabbous
Date: 2006-07-03 16:33:30-0700
New Revision: 10198
Modified:
branches/release/b21/project.properties
branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java
branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java
branches/release/b21/src/java/org/tigris/scarab/om/Module.java
branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java
branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java
branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java
branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java
branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm
branches/release/b21/xdocs/scarab_properties.xml
Log:
comment rendering can now be configured by module. (fixes SCB1614 and SCB1734)
details:
* added new property "scarab.issue.comment.renderer" which can take the values
this property defines the default behaviour of Scarab concerning rendering of comments.
currently we have implemented following rendering engines:
- plaintext (uses plain ascii as entered in the editor surrounds text with a <pre>...</pre>
- html (renders text as HTML text. In addition renders each CR as <br/> )
- radeox (uses the radeox wiki engine for rendering. wiki markup is supported)
* Added a new GlobalParameter COMMENT_RENDER_ENGINE plus access methods
* Added new interface method to Module getCommentRenderingEngine()
Added implementation method to ScarabModule
* Added new configuration line to module editor, where the admin can configure the render engine type
No change in the database schema needed.
Modified: branches/release/b21/project.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/project.properties?view=diff&rev=10198&p1=branches/release/b21/project.properties&p2=branches/release/b21/project.properties&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/project.properties (original)
+++ branches/release/b21/project.properties 2006-07-03 16:33:30-0700
@@ -436,6 +436,37 @@
#######################################################################
+# =============
+# Group: module
+# =============
+#
+# scarab.issue.comment.renderer
+#
+
+
+# -----------------------------
+# scarab.issue.comment.renderer
+# -----------------------------
+#
+#
+# Scarab can display issue comments in three ways. Either
+# all comments are simply rendered as plaintext ("plaintext", the default),
+# or they are rendered using a very restricted subset of html ("html")
+# or they are rendered using the wiki syntax of the radeox
+# wiki rendering engine ("radeox"). The used rendering engine
+# can be configured individually for each module from within
+# the module editor. The value given in this property only
+# defines the default engine to be used when it has not yet
+# been defined in the module.
+#
+
+scarab.issue.comment.renderer=plaintext
+
+# ===================
+# End of Group module
+# ===================
+
+
# ============
# Group: email
# ============
@@ -691,6 +722,16 @@
#
# These properties will allow Scarab to try to authenticate users against a
# NTLM domain (windows network), using credentials provided by the browser.
+#
+# b ships with an empty implementation jar for the JCIFS library. To activate this
+# re you'll need to download the real implementation and replace the shipped jcifs.jar
+# it.
+#
+# an download it from:
+#
+# p://jcifs.samba.org (official site)
+# p://www.ibiblio.org/maven/org.samba.jcifs/jars/jcifs-1.2.6.jar (tested version)
+#
#
@@ -710,7 +751,7 @@
# ------------------------
#
#
-# The name of the NTLM domain to authenticate users.
+# The name of the NTLM domain to authenticate users, if scarab.login.ntlm.active is TRUE.
#
scarab.login.ntlm.domain=
@@ -1408,7 +1449,7 @@
# scarab.test.database.url.postgresql
# scarab.test.database.username.postgresql
# scarab.test.database.password.postgresql
-# scarab.database.jdbc.driver.jar.postgresql
+# scarab.database.jdbc.driver.jar.postgres
#
# Default settings for Postgres
#
@@ -1428,7 +1469,7 @@
scarab.test.database.url.postgresql=${jdbc}:postgresql://${scarab.database.host}:${scarab.database.port}/${scarab.database.name}
scarab.test.database.username.postgresql=${scarab.database.username}
scarab.test.database.password.postgresql=${scarab.database.password}
-scarab.database.jdbc.driver.jar.postgresql=postgresql-*.jar
+scarab.database.jdbc.driver.jar.postgres=postgresql-*.jar
# =====================
# End of Group postgres
@@ -1876,4 +1917,4 @@
# =======================
# End of Group maven-site
-# =======================
+# =======================
\ No newline at end of file
Modified: branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java&p2=branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/actions/ModifyModule.java 2006-07-03 16:33:30-0700
@@ -217,18 +217,25 @@
}
}
- ParameterParser pp = data.getParameters();
- String name = GlobalParameter.ISSUE_REASON_REQUIRED;
- String allowEmptyReason = pp.getString(name);
- if (allowEmptyReason == null)
- allowEmptyReason = "";
- GlobalParameterManager.setString(name, me,allowEmptyReason);
-
- // Is there a needed role for even requesting access?
- name = GlobalParameter.REQUIRED_ROLE_FOR_REQUESTING_ACCESS;
+ ParameterParser pp = data.getParameters();
+ storeGlobalParameter(GlobalParameter.ISSUE_REASON_REQUIRED, me, pp);
+ storeGlobalParameter(GlobalParameter.REQUIRED_ROLE_FOR_REQUESTING_ACCESS, me, pp);
+ storeGlobalParameter(GlobalParameter.COMMENT_RENDER_ENGINE, me, pp);
+
+ }
+
+ /**
+ * @param me
+ * @param pp
+ * @throws TorqueException
+ */
+ private void storeGlobalParameter(String name, Module me, ParameterParser pp) throws TorqueException
+ {
String requiredRole = pp.getString(name);
if (null == requiredRole)
+ {
requiredRole = "";
+ }
GlobalParameterManager.setString(name, me, requiredRole);
}
Modified: branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java&p2=branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/om/GlobalParameter.java 2006-07-03 16:33:30-0700
@@ -68,5 +68,7 @@
"scarab.issue.edit.reason.required";
public static final String REQUIRED_ROLE_FOR_REQUESTING_ACCESS =
"required-role-for-requesting-access";
+ public static final String COMMENT_RENDER_ENGINE =
+ "comment-render-engine";
}
Modified: branches/release/b21/src/java/org/tigris/scarab/om/Module.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/om/Module.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/om/Module.java&p2=branches/release/b21/src/java/org/tigris/scarab/om/Module.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/om/Module.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/om/Module.java 2006-07-03 16:33:30-0700
@@ -501,6 +501,11 @@
boolean allowsNewIssues();
/**
+ * Retruns the currently used rendering engine for comments
+ */
+ String getCommentRenderingEngine();
+
+ /**
* Determines whether this module accepts issues.
*/
boolean allowsIssues();
Modified: branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java&p2=branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/om/ScarabModule.java 2006-07-03 16:33:30-0700
@@ -1054,6 +1054,35 @@
}
/**
+ * Returns the comment rendering engine currently in use.
+ * @return
+ */
+ public String getCommentRenderingEngine()
+ {
+ // TODO: We should return a RenderEngine here and hide
+ // all rendering details in the returned instance.
+ // currently we provide radeoz and plaintext only.
+ // this may change soon ;-) [HD]
+ //
+ String key = GlobalParameter.COMMENT_RENDER_ENGINE;
+ String result = null;
+ try
+ {
+ result = GlobalParameterManager.getString(key, this);
+ }
+ catch (Exception e)
+ {
+ getLog().error("getCommentRenderingEngine(): " + e);
+ }
+
+ if(result == null || result.equals(""))
+ {
+ result = ScarabConstants.COMMENT_RENDER_ENGINE;
+ }
+ return result;
+ }
+
+ /**
* Gets all module roles.
*/
public List getRoles()
Modified: branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java&p2=branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java 2006-07-03 16:33:30-0700
@@ -151,6 +151,8 @@
private static final String BUILD_VERSION =
Turbine.getConfiguration().getString("scarab.build.version", "");
+ private static RenderContext context = new BaseRenderContext();
+ private static RenderEngine engine = new ScarabRenderEngine();
public void init(Object data)
@@ -694,18 +696,26 @@
{
try
{
- // TODO if these are synchronised, or ScarabGlobalTool instances are per request based,
- // these two lines should be moved to member fields and reused each textToHTML call.
- final RenderContext context = new BaseRenderContext();
- final RenderEngine engine = new ScarabRenderEngine();
- // XXX make this configuration option module based, not a turbine system variable.
- final String txt = Turbine.getConfiguration().getBoolean("scarab.wikitext.disabled", false)
- ? perlUtil.substitute(REGEX_URL,
+ String renderEngine = currentModule.getCommentRenderingEngine();
+ String txt;
+ if(renderEngine.equals("radeox"))
+ {
+ txt = engine.render(text, context);
+ }
+ else if(renderEngine.equals("html"))
+ {
+ txt = perlUtil.substitute(REGEX_URL,
+ perlUtil.substitute(REGEX_MAILTO,
+ perlUtil.substitute(REGEX_NEWLINETOBR,
+ ReferenceInsertionFilter.filter(text))));
+ }
+ else // if(renderEngine.equals("plaintext"))
+ {
+ txt = perlUtil.substitute(REGEX_URL,
perlUtil.substitute(REGEX_MAILTO,
- perlUtil.substitute(REGEX_NEWLINETOBR,
- ReferenceInsertionFilter.filter(text))))
- : engine.render(text, context);
+ ReferenceInsertionFilter.filter(text)));
+ }
return new SimpleSkipFiltering(ScarabUtil.linkifyText(txt, link, currentModule));
}
Modified: branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/ScarabConstants.java 2006-07-03 16:33:30-0700
@@ -307,6 +307,11 @@
final int REPORT_MAX_CRITERIA =
Turbine.getConfiguration().getInt("scarab.report.max.criteria", 5);
+ /**
+ * The default comment rendering engine
+ */
+ final String COMMENT_RENDER_ENGINE =
+ Turbine.getConfiguration().getString("scarab.issue.comment.renderer", "plaintext");
// Http parameters
public static final String HTTP_DOMAIN = "scarab.http.domain";
Modified: branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java?view=diff&rev=10198&p1=branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/ScarabUtil.java 2006-07-03 16:33:30-0700
@@ -118,7 +118,11 @@
//output = perlUtil.substitute(REGEX_URL,output);
List result = IssueIdParser.tokenizeText(module, output);
- //sb.append("<pre>");
+ String engine = module.getCommentRenderingEngine();
+ if(engine.equals("plaintext"))
+ {
+ sb.append("<pre>");
+ }
for (Iterator itr = result.iterator(); itr.hasNext();)
{
Object tmp = itr.next();
@@ -135,7 +139,10 @@
sb.append(bar);
}
}
- //sb.append("</pre>");
+ if(engine.equals("plaintext"))
+ {
+ sb.append("</pre>");
+ }
return sb.toString();
}
Modified: branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm?view=diff&rev=10198&p1=branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm&p2=branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm (original)
+++ branches/release/b21/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm 2006-07-03 16:33:30-0700
@@ -166,6 +166,20 @@
#end
+ <tr>
+ <th nowrap="nowrap">render engine</th>
+ <td>
+ #set ($name = $scarabG.ParameterName.COMMENT_RENDER_ENGINE)
+ #set ($selected = $editModule.commentRenderingEngine)
+ <select name="$name">
+ <option value="" #if ($selected.equals("")) selected #end>choose...</option>
+ <option value="plaintext" #if ($selected.equals("plaintext")) selected #end>plaintext</option>
+ <option value="html" #if ($selected.equals("html")) selected #end>html</option>
+ <option value="radeox" #if ($selected.equals("radeox")) selected #end>wiki(radeox)</option>
+ </select>
+ render engine to be used for comments.
+ </td>
+ </tr>
<tr>
<th nowrap="nowrap">$l10n.ReasonFieldRequired</th>
Modified: branches/release/b21/xdocs/scarab_properties.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/xdocs/scarab_properties.xml?view=diff&rev=10198&p1=branches/release/b21/xdocs/scarab_properties.xml&p2=branches/release/b21/xdocs/scarab_properties.xml&r1=10197&r2=10198
==============================================================================
--- branches/release/b21/xdocs/scarab_properties.xml (original)
+++ branches/release/b21/xdocs/scarab_properties.xml 2006-07-03 16:33:30-0700
@@ -522,6 +522,30 @@
deploy
</details>
+ <group name="module">
+ <property>
+ <name>scarab.issue.comment.renderer</name>
+ <default>plaintext</default>
+ <comment>
+ determines the default rendering engine ("plaintext"|"html"|"radeox").
+ </comment>
+ <type>Runtime</type>
+ <customization modification="optional">advanced</customization>
+ <file/>
+ <details>
+ Scarab can display issue comments in three ways. Either
+ all comments are simply rendered as plaintext ("plaintext", the default),
+ or they are rendered using a very restricted subset of html ("html")
+ or they are rendered using the wiki syntax of the radeox
+ wiki rendering engine ("radeox"). The used rendering engine
+ can be configured individually for each module from within
+ the module editor. The value given in this property only
+ defines the default engine to be used when it has not yet
+ been defined in the module.
+ </details>
+ </property>
+ </group>
+
<group name="email">
<details>
Following Email related properties are derived properties.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.