Branch: Tag:

2016-01-12

2016-01-12 15:10:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Wizards: Moved RoxenWizardId code to better place.

Fixes some of [bug 7618 (#7618)] #3.

690:    int pageno = (int)page;    mapping foo = ([]);    -  string wizard_id = id->cookies["RoxenWizardId"]; -  if (!sizeof(wizard_id || "")) { -  wizard_id = (string)random(0x7fffffff); -  id->add_response_header("Set-Cookie", -  sprintf("RoxenWizardId=%s; path=/", wizard_id)); -  DEBUGMSG(sprintf("Wizard: Generated new wizard_id: %s\n", wizard_id)); -  } -  if (wizard_id != id->variables["_roxen_wizard_id"]) { -  // Invalid or unset roxen_wizard_id. -  if (page) { -  report_warning("Wizard: Invalid wizard_id: %O != %O.\n" -  "Resetting page from %O to 0.\n", -  id->variables["_roxen_wizard_id"], wizard_id, -  page); -  } -  // Correct it, and return to page #0. -  id->real_variables["_roxen_wizard_id"] = ({ wizard_id }); -  pageno = 0; -  page = "0"; -  // Also reset some typical action buttons as a preventive measure. -  reset_buttons(id->variables); -  // FIXME: Do we need to reset any other variables? -  } -  +     // FIXME: Add support for preparse on the page-level.    // form = parse_rxml(form, id);   
746:    compress_state(id->real_variables)+"\" />\n";   #endif    +  string wizard_id = id->cookies["RoxenWizardId"];    res = ("\n<!--Wizard-->\n"    "<form " + method + ">\n"    "<input type=\"hidden\" name=\"_roxen_wizard_id\" value=\"" +
927:       int current_page = (int) v->_page;    +  string wizard_id = id->cookies["RoxenWizardId"]; +  if (!sizeof(wizard_id || "")) { +  wizard_id = (string)random(0x7fffffff); +  id->add_response_header("Set-Cookie", +  sprintf("RoxenWizardId=%s; path=/", wizard_id)); +  DEBUGMSG(sprintf("Wizard: Generated new wizard_id: %s\n", wizard_id)); +  } +  if (wizard_id != id->variables["_roxen_wizard_id"]) { +  // Invalid or unset roxen_wizard_id. +  if (current_page) { +  report_warning("Wizard: Invalid wizard_id: %O != %O.\n" +  "Resetting page from %O to 0.\n", +  v["_roxen_wizard_id"], wizard_id, +  current_page); +  } +  // Correct it, and return to page #0. +  id->real_variables["_roxen_wizard_id"] = ({ wizard_id }); +  current_page = 0; +  m_delete(id->real_variables, "_page"); +  m_delete(v, "_page"); +  // Also reset some typical action buttons as a preventive measure. +  reset_buttons(v); +  // FIXME: Do we need to reset any other variables? +  } +     mapping(string:array) automaton = this_object()->wizard_automaton;    function dispatcher;    string oldpage, page_name;