Revision: 6503
http://languagetool.svn.sourceforge.net/languagetool/?rev=6503&view=rev
Author: dnaber
Date: 2012-02-11 16:19:34 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
[community] bugfix: make Wikipedia match count work when this rule has just
been tested against a text
Modified Paths:
--------------
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
trunk/ltcommunity/grails-app/views/rule/show.gsp
Modified:
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
===================================================================
---
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
2012-02-11 16:09:10 UTC (rev 6502)
+++
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleController.groovy
2012-02-11 16:19:34 UTC (rev 6503)
@@ -163,10 +163,11 @@
text = text.substring(0, maxTextLen)
flash.message = "The text is too long, only the first $maxTextLen
characters have been checked"
}
+ int corpusMatchCount = countCorpusMatches(lang, selectedRule.id)
List ruleMatches = lt.check(text)
render(view:'show', model: [ rule: selectedRule, isDisabled: disableId !=
-1, disableId: disableId,
textToCheck: params.text, matches:
ruleMatches, ruleId: params.id,
- isUserRule: isUserRule ],
+ isUserRule: isUserRule, corpusMatchCount:
corpusMatchCount],
contentType: "text/html", encoding: "utf-8")
}
@@ -255,7 +256,6 @@
if (!saved) {
throw new Exception("Could not save copy of rule
${params.id.encodeAsHTML()}: ${userRule.errors}")
}
- //log.info("###${params.id}")
redirect(action:'show', id:userRule.id, params:[lang:params.lang])
}
@@ -273,18 +273,23 @@
if (params.textToCheck) {
textToCheck = params.textToCheck
}
- def matchCriteria = CorpusMatch.createCriteria()
- def corpusMatchCount = matchCriteria.count {
- eq('ruleID', selectedRule.id)
- eq('languageCode', lang)
- eq('isVisible', true)
- }
+ int corpusMatchCount = countCorpusMatches(lang, selectedRule.id)
render(view:'show', model: [ rule: selectedRule, isDisabled: disableId !=
-1, disableId: disableId,
isUserRule: isUserRule, ruleId: params.id, textToCheck: textToCheck,
corpusMatchCount: corpusMatchCount],
contentType: "text/html", encoding: "utf-8")
}
-
+
+ private int countCorpusMatches(String langCode, String ruleId) {
+ def matchCriteria = CorpusMatch.createCriteria()
+ def corpusMatchCount = matchCriteria.count {
+ eq('ruleID', ruleId)
+ eq('languageCode', langCode)
+ eq('isVisible', true)
+ }
+ return corpusMatchCount
+ }
+
private String getLanguage() {
String lang = "en"
if (params.lang) {
Modified: trunk/ltcommunity/grails-app/views/rule/show.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/rule/show.gsp 2012-02-11 16:09:10 UTC
(rev 6502)
+++ trunk/ltcommunity/grails-app/views/rule/show.gsp 2012-02-11 16:19:34 UTC
(rev 6503)
@@ -125,6 +125,7 @@
<p><g:message code="ltc.rule.show.check.text" /></p>
<g:form method="post">
+
<input type="hidden" name="id" value="${ruleId}"/>
<input type="hidden" name="lang"
value="${params.lang.encodeAsHTML()}"/>
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