Revision: 6502
http://languagetool.svn.sourceforge.net/languagetool/?rev=6502&view=rev
Author: dnaber
Date: 2012-02-11 16:09:10 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
[community] bugfix: support pattern rules with sub ids (i.e. rulegroups); tiny
layout fixes
Modified Paths:
--------------
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
trunk/ltcommunity/grails-app/i18n/messages.properties
trunk/ltcommunity/grails-app/views/rule/list.gsp
trunk/ltcommunity/grails-app/views/rule/show.gsp
trunk/ltcommunity/web-app/css/main.css
Modified:
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
===================================================================
---
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
2012-02-11 15:45:18 UTC (rev 6501)
+++
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
2012-02-11 16:09:10 UTC (rev 6502)
@@ -137,7 +137,7 @@
selectedRule = userRule.toPatternRule(true)
isUserRule = true
} catch (NumberFormatException e) {
- selectedRule = getSystemRuleById(params.id, lt)
+ selectedRule = getSystemRuleById(params.id, params.subId, lt)
}
if (!selectedRule) {
flash.message = "No rule with id ${params.id.encodeAsHTML()}"
@@ -236,7 +236,7 @@
String lang = getLanguage()
JLanguageTool lt = new
JLanguageTool(Language.getLanguageForShortName(lang))
lt.activateDefaultPatternRules()
- Rule origRule = getSystemRuleById(params.id, lt)
+ Rule origRule = getSystemRuleById(params.id, params.subId, lt)
if (!origRule) {
throw new Exception("No rule found for id ${params.id}, language
$lang")
}
@@ -261,11 +261,10 @@
def show = {
String lang = getLanguage()
- int disableId = 0
SelectedRule rule = getRuleById(params.id, lang)
Rule selectedRule = rule.rule
boolean isUserRule = rule.isUserRule
- disableId = getEnableDisableId(selectedRule, params.id, lang)
+ int disableId = getEnableDisableId(selectedRule, params.id, lang)
if (!selectedRule) {
flash.message = "No rule with id ${params.id.encodeAsHTML()}"
redirect(action:list)
@@ -308,18 +307,23 @@
} catch (NumberFormatException e) {
JLanguageTool lt = new
JLanguageTool(Language.getLanguageForShortName(lang))
lt.activateDefaultPatternRules()
- selectedRule = getSystemRuleById(params.id, lt)
+ selectedRule = getSystemRuleById(params.id, params.subId, lt)
isUserRule = false
}
return new SelectedRule(isUserRule: isUserRule, rule: selectedRule)
}
- private Rule getSystemRuleById(String id, JLanguageTool lt) {
+ private Rule getSystemRuleById(String id, String subId, JLanguageTool lt) {
log.debug("Getting system rule with id $id")
Rule selectedRule = null
List rules = lt.getAllRules()
for (Rule rule in rules) {
- if (rule.id == params.id) {
+ boolean subIdMatchIfNeeded = true
+ if (rule instanceof PatternRule && subId != null) {
+ PatternRule pRule = (PatternRule) rule
+ subIdMatchIfNeeded = pRule.subId == subId
+ }
+ if (rule.id == params.id && subIdMatchIfNeeded) {
selectedRule = rule
break
}
Modified: trunk/ltcommunity/grails-app/i18n/messages.properties
===================================================================
--- trunk/ltcommunity/grails-app/i18n/messages.properties 2012-02-11
15:45:18 UTC (rev 6501)
+++ trunk/ltcommunity/grails-app/i18n/messages.properties 2012-02-11
16:09:10 UTC (rev 6502)
@@ -72,9 +72,9 @@
ltc.rule.show.message=Message:
ltc.rule.show.category=Category:
ltc.rule.show.active=Active?
-ltc.rule.show.incorrect.sentences=Incorrect sentences that this rule can
detect:
+ltc.rule.show.incorrect.sentences=Incorrect sentences<br/>that this rule can
detect:
ltc.rule.show.corrections=Correction suggestion:
-ltc.rule.show.correct.sentences=Correct sentences for comparison:
+ltc.rule.show.correct.sentences=Correct sentences<br/>for comparison:
ltc.rule.show.no.examples=[no examples found]
ltc.rule.show.check.text=Check the following text against just this rule:
ltc.rule.show.corpus.link=There are {0} matches of this rule in our Wikipedia
check result.
@@ -87,7 +87,7 @@
ltc.rule.browse.description=Description
ltc.rule.browse.pattern=Pattern
ltc.rule.browse.category=Category
-ltc.rule.browse.java.rule=[Java rule]
+ltc.rule.browse.java.rule=<span class="javaRule">[Java rule]</span>
ltc.rule.browse.add.rule=Add New Rule
ltc.home.check.title=Results of your text check
Modified: trunk/ltcommunity/grails-app/views/rule/list.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/rule/list.gsp 2012-02-11 15:45:18 UTC
(rev 6501)
+++ trunk/ltcommunity/grails-app/views/rule/list.gsp 2012-02-11 16:09:10 UTC
(rev 6502)
@@ -70,14 +70,25 @@
</td>
<td>
- <g:if test="${userRuleId}">
- <g:link action="show" id="${userRuleId}"
-
params="[lang:params.lang]">${rule.description ?
rule.description.encodeAsHTML() : "[unnamed]"}</g:link></td>
- </g:if>
- <g:else>
- <g:link action="show" id="${rule.id}"
-
params="[lang:params.lang]">${rule.description ?
rule.description.encodeAsHTML() : "[unnamed]"}</g:link></td>
- </g:else>
+ <g:if test="${userRuleId}">
+ <g:link action="show" id="${userRuleId}"
+
params="[lang:params.lang]">${rule.description ?
rule.description.encodeAsHTML() : "[unnamed]"}</g:link>
+ </g:if>
+ <g:else>
+ <g:if test="${rule instanceof
PatternRule}">
+ <%
+ PatternRule pRule = (PatternRule) rule;
+ %>
+ <g:set var="subId"
value="${pRule.subId}"/>
+ <g:link action="show" id="${rule.id}"
+ params="[lang:params.lang,
subId: subId]">${rule.description ? rule.description.encodeAsHTML() :
"[unnamed]"}</g:link>
+ </g:if>
+ <g:else>
+ <g:link action="show" id="${rule.id}"
+
params="[lang:params.lang]">${rule.description ?
rule.description.encodeAsHTML() : "[unnamed]"}</g:link>
+ </g:else>
+ </g:else>
+ </td>
<g:if test="${rule instanceof PatternRule}">
<%
Modified: trunk/ltcommunity/grails-app/views/rule/show.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/rule/show.gsp 2012-02-11 15:45:18 UTC
(rev 6501)
+++ trunk/ltcommunity/grails-app/views/rule/show.gsp 2012-02-11 16:09:10 UTC
(rev 6502)
@@ -25,14 +25,14 @@
<table>
<tr>
- <td width="15%"><g:message code="ltc.rule.show.pattern"
/></td>
+ <td><g:message code="ltc.rule.show.pattern" /></td>
<td>
<g:if test="${rule instanceof PatternRule}">
<span
class="pattern">${rule.toPatternString().encodeAsHTML()}</span><br />
</g:if>
<g:else>
<!-- TODO: add link to source code -->
- <g:message
code="ltc.rule.show.java.rule" /><br/>
+ <span class="javaRule"><g:message
code="ltc.rule.show.java.rule" /></span><br/>
</g:else>
</td>
</tr>
Modified: trunk/ltcommunity/web-app/css/main.css
===================================================================
--- trunk/ltcommunity/web-app/css/main.css 2012-02-11 15:45:18 UTC (rev
6501)
+++ trunk/ltcommunity/web-app/css/main.css 2012-02-11 16:09:10 UTC (rev
6502)
@@ -385,3 +385,7 @@
line-height: 30px;
margin-bottom: 15px;
}
+
+.javaRule {
+ color: #777777;
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs