Branch: Tag:

2002-06-10

2002-06-10 15:00:26 by Jonas Wallden <jonasw@roxen.com>

Fixed [bug 2718 (#2718)] where use of Prev button in wizards with hidden pages at
the beginning triggered wizard_done().

Rev: server/base_server/wizard.pike:1.141

2:   // Copyright © 1997 - 2001, Roxen IS.   //   // Wizard generator - // $Id: wizard.pike,v 1.140 2002/05/15 17:53:31 wellhard Exp $ + // $Id: wizard.pike,v 1.141 2002/06/10 15:00:26 jonasw Exp $      /* wizard_automaton operation (old behavior if it isn't defined):   
605:       FakedVariables v=id->variables;    +  int current_page = (int) v->_page; +     mapping(string:array) automaton = this_object()->wizard_automaton;    function dispatcher;    string oldpage, page_name;
791:    }    }    } -  else +  else {    for(; !data; v->_page=PAGE(offset))    {    function pg=this_object()[wiz_name+((int)v->_page)];
809:    if(data = pg(id,@args)) break;    DEBUGMSG ("Wizard: No data from page function; going to " +    (offset > 0 ? "next" : "previous") + " page\n"); +  +  // If going backwards and we end up on a negative page (e.g. due to +  // intermediate pages returning 0) we remain on current page. This is +  // done so that wizards which skip pages in the beginning won't result +  // in wizard_done() when trying to step into hidden pages. +  if ((offset < 0) && ((int) v->_page <= 0)) { +  v->_page = current_page; +  pg = this_object()[wiz_name + ((int) v->_page)]; +  if (pg && (data = pg(id, @args))) +  break;    } -  +  } +  }       // If it's a mapping we can presume it is an http response, and return    // it directly.