Revision: 7887
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7887&view=rev
Author:   dnaber
Date:     2012-08-19 19:44:46 +0000 (Sun, 19 Aug 2012)
Log Message:
-----------
stop if there are more than 100 errors, assuming that something is wrong anyway 
and to not flood the user with useless errors

Modified Paths:
--------------
    trunk/ltcommunity/grails-app/views/_ruleMatches.gsp

Modified: trunk/ltcommunity/grails-app/views/_ruleMatches.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/_ruleMatches.gsp 2012-08-19 15:38:15 UTC 
(rev 7886)
+++ trunk/ltcommunity/grails-app/views/_ruleMatches.gsp 2012-08-19 19:44:46 UTC 
(rev 7887)
@@ -1,27 +1,37 @@
 <%@page import="org.languagetool.rules.patterns.PatternRule; 
org.languagetool.Language" %>
 
 <ul>
+    <g:set var="maxMatches" value="${100}"/>
     <g:each in="${matches}" var="matchInfo" status="i">
-        <li class="errorList">${matchInfo.getMessage().
-            replaceAll("<suggestion>", "<span class='correction'>").
-            replaceAll("</suggestion>", "</span>")}
+        <g:if test="${i < maxMatches}">
 
-            <g:if test="${matchInfo.getRule() instanceof PatternRule}">
-                <g:link controller="rule" action="show" 
id="${matchInfo.getRule().getId()}"
-                       params="${[lang: lang, subId: 
matchInfo.getRule().getSubId()]}"><span class="additional"><g:message 
code="ltc.check.visit.rule"/></span></g:link>
-            </g:if>
-            <g:else>
-                <g:link controller="rule" action="show" 
id="${matchInfo.getRule().getId()}"
-                       params="${[lang: lang]}"><span 
class="additional"><g:message code="ltc.check.visit.rule"/></span></g:link>
-            </g:else>
+            <li class="errorList">
+                ${matchInfo.getMessage().replaceAll("<suggestion>", "<span 
class='correction'>").replaceAll("</suggestion>", "</span>")}
 
-           <br/>
-           <span class="exampleSentence">${
-           org.languagetool.gui.Tools.getContext(matchInfo.getFromPos(),
-           matchInfo.getToPos(), textToCheck,
-           100, "<span class='error'>", "</span>", true)}</span>
-            <br />
-        </li>
+                <g:if test="${matchInfo.getRule() instanceof PatternRule}">
+                    <g:link controller="rule" action="show" 
id="${matchInfo.getRule().getId()}"
+                    params="${[lang: lang, subId: 
matchInfo.getRule().getSubId()]}"><span class="additional"><g:message 
code="ltc.check.visit.rule"/></span></g:link>
+                </g:if>
+                <g:else>
+                    <g:link controller="rule" action="show" 
id="${matchInfo.getRule().getId()}"
+                    params="${[lang: lang]}"><span 
class="additional"><g:message code="ltc.check.visit.rule"/></span></g:link>
+                </g:else>
+
+               <br/>
+               <span class="exampleSentence">${
+               org.languagetool.gui.Tools.getContext(matchInfo.getFromPos(),
+               matchInfo.getToPos(), textToCheck,
+               100, "<span class='error'>", "</span>", true)}</span>
+                <br />
+            </li>
+
+        </g:if>
+        <g:elseif test="${i == maxMatches}">
+            <div class="warn">More than ${maxMatches} errors found, 
stopping</div>
+        </g:elseif>
+        <g:else>
+            <%-- nothing --%>
+        </g:else>
     </g:each>
     <g:if test="${matches != null && matches.size() == 0 && params.lang != 
'auto'}">
        <li><g:message code="ltc.no.rule.matches" 
args="${[Language.getLanguageForShortName(params.lang)]}"/></li>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
Languagetool-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to