- Timestamp:
- Nov 16, 2010, 6:30:11 PM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r1099 r1149 205 205 206 206 // reset errors 207 flash. errors = [:]207 flash.wizardErrors = [:] 208 208 success() 209 209 }.to "study" … … 213 213 214 214 // reset errors 215 flash. errors = [:]215 flash.wizardErrors = [:] 216 216 success() 217 217 }.to "study" … … 221 221 222 222 // reset errors 223 flash. errors = [:]223 flash.wizardErrors = [:] 224 224 success() 225 225 }.to "start" … … 264 264 265 265 // reset errors 266 flash. errors = [:]266 flash.wizardErrors = [:] 267 267 268 268 // remove subject … … 277 277 278 278 // reset errors 279 flash. errors = [:]279 flash.wizardErrors = [:] 280 280 success() 281 281 }.to "study" … … 334 334 335 335 // reset errors 336 flash. errors = [:]336 flash.wizardErrors = [:] 337 337 success() 338 338 … … 351 351 352 352 // reset errors 353 flash. errors = [:]353 flash.wizardErrors = [:] 354 354 success() 355 355 }.to "events" … … 359 359 360 360 // reset errors 361 flash. errors = [:]361 flash.wizardErrors = [:] 362 362 363 363 // add event to study … … 384 384 385 385 // append errors 386 this.appendErrors(flow.event, flash. errors)386 this.appendErrors(flow.event, flash.wizardErrors) 387 387 error() 388 388 } … … 393 393 394 394 // reset errors 395 flash. errors = [:]395 flash.wizardErrors = [:] 396 396 397 397 // find matching (sampling) event … … 429 429 430 430 // reset errors 431 flash. errors = [:]431 flash.wizardErrors = [:] 432 432 success() 433 433 }.to "events" … … 437 437 438 438 // reset errors 439 flash. errors = [:]439 flash.wizardErrors = [:] 440 440 441 441 // remove eventGroup … … 450 450 451 451 // reset errors 452 flash. errors = [:]452 flash.wizardErrors = [:] 453 453 success() 454 454 }.to "subjects" … … 555 555 556 556 // ignore errors 557 flash. errors = [:]557 flash.wizardErrors = [:] 558 558 559 559 succes() … … 569 569 570 570 // ignore errors 571 flash. errors = [:]571 flash.wizardErrors = [:] 572 572 573 573 success() … … 583 583 584 584 // ignore errors 585 flash. errors = [:]585 flash.wizardErrors = [:] 586 586 587 587 success() … … 592 592 593 593 // ignore errors 594 flash. errors = [:]594 flash.wizardErrors = [:] 595 595 596 596 success() … … 622 622 623 623 // reset errors 624 flash. errors = [:]624 flash.wizardErrors = [:] 625 625 success() 626 626 }.to "assays" … … 641 641 642 642 // reset errors 643 flash. errors = [:]643 flash.wizardErrors = [:] 644 644 success() 645 645 }.to "assays" … … 649 649 650 650 // reset errors 651 flash. errors = [:]651 flash.wizardErrors = [:] 652 652 653 653 // add assay to study … … 665 665 666 666 // append errors 667 this.appendErrors(flow.assay, flash. errors)667 this.appendErrors(flow.assay, flash.wizardErrors) 668 668 error() 669 669 } … … 676 676 677 677 // reset errors 678 flash. errors = [:]678 flash.wizardErrors = [:] 679 679 680 680 // find this assay … … 689 689 690 690 // ignore errors 691 flash. errors = [:]691 flash.wizardErrors = [:] 692 692 693 693 success() … … 731 731 732 732 // ignore errors 733 flash. errors = [:]733 flash.wizardErrors = [:] 734 734 735 735 success() … … 792 792 action { 793 793 println "saving..." 794 flash. errors = [:]794 flash.wizardErrors = [:] 795 795 796 796 // persist data to the database … … 803 803 804 804 if (!flow.study.save(flush:true)) { 805 this.appendErrors(flow.study, flash. errors)805 this.appendErrors(flow.study, flash.wizardErrors) 806 806 throw new Exception('error saving study') 807 807 } … … 811 811 } catch (Exception e) { 812 812 // rollback 813 this.appendErrorMap(['exception': e.toString() + ', see log for stacktrace' ], flash. errors)813 this.appendErrorMap(['exception': e.toString() + ', see log for stacktrace' ], flash.wizardErrors) 814 814 815 815 // stacktrace in flash scope … … 857 857 // def authenticationService 858 858 859 flash. errors = new LinkedHashMap()859 flash.wizardErrors = new LinkedHashMap() 860 860 861 861 // load study … … 880 880 } catch (Exception e) { 881 881 // rollback 882 this.appendErrorMap(['exception': e.getMessage() + ', see log for stacktrace'], flash. errors)882 this.appendErrorMap(['exception': e.getMessage() + ', see log for stacktrace'], flash.wizardErrors) 883 883 884 884 return false … … 945 945 } else { 946 946 // validation failed 947 flash. errors = [:]948 this.appendErrors(flow.study, flash. errors)947 flash.wizardErrors = [:] 948 this.appendErrors(flow.study, flash.wizardErrors) 949 949 return false 950 950 } … … 1122 1122 def subjectPage(flow, flash, params) { 1123 1123 def errors = false 1124 flash. errors = [:]1124 flash.wizardErrors = [:] 1125 1125 1126 1126 // remember the params in the flash scope … … 1141 1141 if (!subject.validate()) { 1142 1142 errors = true 1143 this.appendErrors(subject, flash. errors, 'subject_' + subject.getIdentifier() + '_')1143 this.appendErrors(subject, flash.wizardErrors, 'subject_' + subject.getIdentifier() + '_') 1144 1144 } 1145 1145 } … … 1169 1169 1170 1170 // (re)set error message 1171 flash. errors = [:]1171 flash.wizardErrors = [:] 1172 1172 1173 1173 // set work variables … … 1213 1213 1214 1214 // append errors 1215 this.appendErrors(subject, flash. errors)1215 this.appendErrors(subject, flash.wizardErrors) 1216 1216 errors = true 1217 1217 } … … 1220 1220 // add feedback 1221 1221 errors = true 1222 if (number < 1) this.appendErrorMap(['addNumber': 'Enter a positive number of subjects to add'], flash. errors)1223 if (!species) this.appendErrorMap(['species': 'You need to select a species, or add one if it is not yet present'], flash. errors)1224 if (!template) this.appendErrorMap(['template': 'You need to select a template, or add one if it is not yet present'], flash. errors)1222 if (number < 1) this.appendErrorMap(['addNumber': 'Enter a positive number of subjects to add'], flash.wizardErrors) 1223 if (!species) this.appendErrorMap(['species': 'You need to select a species, or add one if it is not yet present'], flash.wizardErrors) 1224 if (!template) this.appendErrorMap(['template': 'You need to select a template, or add one if it is not yet present'], flash.wizardErrors) 1225 1225 } 1226 1226 … … 1238 1238 def eventPage(flow, flash, params) { 1239 1239 def errors = false 1240 flash. errors = [:]1240 flash.wizardErrors = [:] 1241 1241 1242 1242 // remember the params in the flash scope … … 1350 1350 if (!event.validate()) { 1351 1351 errors = true 1352 this.appendErrors(event, flash. errors)1352 this.appendErrors(event, flash.wizardErrors) 1353 1353 } 1354 1354 } … … 1367 1367 def groupPage(flow, flash, params) { 1368 1368 def errors = false 1369 flash. errors = [:]1369 flash.wizardErrors = [:] 1370 1370 1371 1371 // remember the params in the flash scope … … 1437 1437 def samplePage(flow, flash, params) { 1438 1438 def errors = false 1439 flash. errors = [:]1439 flash.wizardErrors = [:] 1440 1440 1441 1441 // remember the params in the flash scope … … 1464 1464 if (!sample.validate()) { 1465 1465 errors = true 1466 this.appendErrors(sample, flash. errors, 'sample_' + sample.getIdentifier() + '_' )1466 this.appendErrors(sample, flash.wizardErrors, 'sample_' + sample.getIdentifier() + '_' ) 1467 1467 println 'error-> sample_'+sample.getIdentifier() 1468 1468 } … … 1482 1482 def assayPage(flow, flash, params) { 1483 1483 def errors = false 1484 flash. errors = [:]1484 flash.wizardErrors = [:] 1485 1485 1486 1486 // remember the params in the flash scope … … 1511 1511 if (!assay.validate()) { 1512 1512 errors = true 1513 this.appendErrors(assay, flash. errors, 'assay_' + assay.getIdentifier() + '_')1513 this.appendErrors(assay, flash.wizardErrors, 'assay_' + assay.getIdentifier() + '_') 1514 1514 } 1515 1515 } … … 1528 1528 def assayGroupPage(flow, flash, params) { 1529 1529 def errors = false 1530 flash. errors = [:]1530 flash.wizardErrors = [:] 1531 1531 1532 1532 // remember the params in the flash scope -
trunk/grails-app/views/wizard/common/_error.gsp
r959 r1149 15 15 */ 16 16 %> 17 <g:if test="${ errors}">17 <g:if test="${wizardErrors}"> 18 18 <div id="wizardError" class="error" title="errors"> 19 <g:each in="${ errors}" var="error" status="e">19 <g:each in="${wizardErrors}" var="error" status="e"> 20 20 <p> 21 21 <g:if test="${!e}"><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span></g:if> … … 26 26 <script type="text/javascript"> 27 27 // mark error fields 28 <g:each in="${ errors}" var="error">28 <g:each in="${wizardErrors}" var="error"> 29 29 var element = $("input:[name='${error.key}'], input:[name='${error.key.toLowerCase().replaceAll("([^a-z0-9])","_")}'], select:[name='${error.key}'], select:[name='${error.key.toLowerCase().replaceAll("([^a-z0-9])","_")}']"); 30 30 <g:if test="${error.value['dynamic']}">
Note: See TracChangeset
for help on using the changeset viewer.