Skip to content

Commit

Permalink
TRUNK-3882 Custom tag to render errors
Browse files Browse the repository at this point in the history
(cherry picked from commit be50e0d)
  • Loading branch information
jkondrat authored and rkorytkowski committed Mar 17, 2014
1 parent 6ad9d86 commit 4227c8b
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 114 deletions.
11 changes: 11 additions & 0 deletions webapp/src/main/webapp/WEB-INF/tags/errorNotify.tag
@@ -0,0 +1,11 @@
<%@ include file="/WEB-INF/template/include.jsp" %>

<%@ attribute name="errors" required="true" type="org.springframework.validation.Errors" %>

<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
Expand Up @@ -111,13 +111,7 @@ $j(document).ready( function() {
</c:if>

<spring:hasBindErrors name="conceptReferenceTermModel">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form:form method="post" action="conceptReferenceTerm.form" modelAttribute="conceptReferenceTermModel">
Expand Down
Expand Up @@ -10,7 +10,7 @@
<h2><openmrs:message code="ConceptStopWord.title"/></h2>

<spring:hasBindErrors name="command">
<openmrs:message code="fix.error"/><br/>
<openmrs:message code="fix.error"/><br/>
</spring:hasBindErrors>

<form method="post">
Expand Down
Expand Up @@ -219,13 +219,7 @@
<h2><openmrs:message code="Encounter.manage.title"/></h2>

<spring:hasBindErrors name="encounter">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<b class="boxHeader"><openmrs:message code="Encounter.summary"/></b>
Expand Down Expand Up @@ -504,4 +498,4 @@

</c:if>

<%@ include file="/WEB-INF/template/footer.jsp" %>
<%@ include file="/WEB-INF/template/footer.jsp" %>
Expand Up @@ -8,12 +8,7 @@
<h2><openmrs:message code="Form.edit.title"/></h2>

<spring:hasBindErrors name="form">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${form.retired}">
Expand Down
Expand Up @@ -25,13 +25,7 @@
</c:if>

<spring:hasBindErrors name="location">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.globalErrors}" var="error">
<openmrs:message code="${error.defaultMessage}" text="${error.defaultMessage}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>
<form method="post">
<fieldset>
Expand Down
Expand Up @@ -217,13 +217,7 @@
<h2><openmrs:message code="Obs.title"/></h2>

<spring:hasBindErrors name="obs">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.globalErrors}" var="error">
<openmrs:message code="${error.defaultMessage}" text="${error.defaultMessage}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br/>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${obs.voided}">
Expand Down
Expand Up @@ -409,12 +409,7 @@ function generateMergeList(){
</style>

<spring:hasBindErrors name="patient">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<h2><openmrs:message code="Patient.merge.title"/></h2>
Expand Down
Expand Up @@ -286,12 +286,7 @@
</openmrs:hasPrivilege>

<spring:hasBindErrors name="patient">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post" onSubmit="removeBlankData()">
Expand Down
Expand Up @@ -221,12 +221,7 @@
<openmrs:globalProperty key="use_patient_attribute.mothersName" defaultValue="false" var="showMothersName"/>

<spring:hasBindErrors name="patientModel">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form:form method="post" action="shortPatientForm.form" onsubmit="removeHiddenRows()" modelAttribute="patientModel">
Expand Down
Expand Up @@ -263,12 +263,7 @@
</openmrs:hasPrivilege>

<spring:hasBindErrors name="person">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post" onSubmit="removeBlankData()">
Expand Down
Expand Up @@ -142,13 +142,7 @@ window.onload = init;


<spring:hasBindErrors name="concept">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<spring:hasBindErrors name="task">
Expand Down
Expand Up @@ -140,12 +140,7 @@
<h2><openmrs:message code="Alert.manage.title"/></h2>

<spring:hasBindErrors name="alert">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down
Expand Up @@ -16,13 +16,7 @@
</c:if>

<spring:hasBindErrors name="user">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form id="thisChangePasswordForm" method="post" action="changePassword.form" autocomplete="off">
Expand Down
7 changes: 1 addition & 6 deletions webapp/src/main/webapp/WEB-INF/view/admin/users/roleForm.jsp
Expand Up @@ -34,12 +34,7 @@
<h2><openmrs:message code="Role.manage.title"/></h2>

<spring:hasBindErrors name="role">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/admin/users/userForm.jsp
Expand Up @@ -64,13 +64,7 @@
</c:if>

<spring:hasBindErrors name="user">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form id="thisUserForm" method="post" action="user.form" autocomplete="off">
Expand Down
Expand Up @@ -104,13 +104,7 @@ $j(document).ready( function() {
</style>

<spring:hasBindErrors name="visit">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<h2>
Expand Down
Expand Up @@ -134,13 +134,7 @@
</c:if>

<spring:hasBindErrors name="command">
<openmrs:message code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${command.concept.conceptId != null}">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/optionsForm.jsp
Expand Up @@ -121,13 +121,7 @@ function containsError(element) {
<h2><openmrs:message code="options.title" /></h2>

<spring:hasBindErrors name="opts">
<openmrs:message code="fix.error" />
<div class="error"><c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" />
<br />
<!-- ${error} -->
</c:forEach></div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down

0 comments on commit 4227c8b

Please sign in to comment.