Changeset 279


Ignore:
Timestamp:
Mar 17, 2010, 3:18:54 PM (13 years ago)
Author:
duh
Message:
  • improved try catch block in wizard data saving
  • if saving fails, the generated exception is shown in the client's error feedback dialog and a stacktrace is shown in the console
  • navigating away from last wizard page does not result in a warning anymore
  • last page does not contain a 'previous' button anymore as this makes no sense at all
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r278 r279  
    502502                                        println "saved study "+flow.study+" (id: "+flow.study.id+")"
    503503
     504                                        // commit transaction
     505                                        println "commit"
     506                                        transaction.commit()
     507                                        success()
    504508                                } catch (Exception e) {
    505509                                        // rollback
     510                                        this.appendErrorMap(['exception': e.toString() + ', see log for stacktrace' ], flash.errors)
     511
     512                                        // debug line
     513                                        println e.printStackTrace()
     514
    506515                                        println "rollback"
    507516                                        transaction.rollback()
    508517                                        error()
    509518                                }
    510 
    511                                 // commit transaction
    512                                 println "commit"
    513                                 transaction.commit()
    514                                 success()
    515519                        }
    516520                        on("error").to "error"
  • trunk/grails-app/views/wizard/common/_error.gsp

    r250 r279  
    3636
    3737                // show error dialog
    38                 $(function() {
    39                         $("div#wizardError").dialog({
    40                                 modal: true,
    41                                 width: 600,
    42                                 buttons: {
    43                                         Ok: function() {
    44                                                 $(this).dialog('close');
    45                                         }
     38                $("div#wizardError").dialog({
     39                        modal: true,
     40                        width: 600,
     41                        buttons: {
     42                                Ok: function() {
     43                                        $(this).dialog('close');
    4644                                }
    47                         });
     45                        }
    4846                });
    4947        </script>
  • trunk/grails-app/views/wizard/common/_navigation.gsp

    r247 r279  
    1515%>
    1616    <div class="navigation">
    17       <g:if test="${page>1}"><wizard:ajaxButton name="previous" value="&laquo; prev" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" class="prevnext" /></g:if>
     17      <g:if test="${page>1 && page<pages.size}"><wizard:ajaxButton name="previous" value="&laquo; prev" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" class="prevnext" /></g:if>
    1818      <g:if test="${page>1 && page<pages.size}"> | </g:if>
    1919      <g:if test="${page<pages.size}"><wizard:ajaxButton name="next" value="next &raquo;" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" class="prevnext" /></g:if>
  • trunk/grails-app/views/wizard/pages/_done.gsp

    r275 r279  
    2222        </span>
    2323
     24        <script type="text/javascript">
     25                // disable redirect warning
     26                var warnOnRedirect = false;
     27        </script>
     28
    2429</wizard:pageContent>
  • trunk/web-app/js/wizard.js

    r275 r279  
    1313 * $Date$
    1414 */
     15var warnOnRedirect = true;
    1516$(document).ready(function() {
    1617    // check if user is using Firefox 3.6 and warm the user
     
    6162        if (!element.attr('href').match(/^#/gi) && !element.attr('href').match(/\/([^\/]+)\/wizard\/pages/gi)) {
    6263            // bind a warning to the onclick event
    63             element.bind('click',function() { return onDirectWarning(); });
     64            element.bind('click',function() {
     65                if (warnOnRedirect) {
     66                    return onDirectWarning();
     67                }
     68            });
    6469        }
    6570    })
Note: See TracChangeset for help on using the changeset viewer.