Branch: Tag:

1998-03-13

1998-03-13 16:51:23 by Francesco Chemolli <li@kinkie.it>

Applied patch by Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>.
Allows for quoting of : and , in multi-selects.
Pages can now return http_result-mappings.

Rev: server/base_server/wizard.pike:1.58

1: - /* $Id: wizard.pike,v 1.57 1998/03/12 20:08:54 mirar Exp $ + /* $Id: wizard.pike,v 1.58 1998/03/13 16:51:23 grubba Exp $    * name="Wizard generator";    * doc="This file generats all the nice wizards";    */
181:    mapping m2 = copy_value(m);    m_delete(m2, "choices");    m_delete(m2, "options"); +  //escape the characters we need for internal purposes.. +  m->choices=replace(m->choices, +  ({"\\,", "\\:"}), +  ({"__CoMma__", "__CoLon__"})); +     return make_container("select", m2, Array.map(m->choices/",",    lambda(string s, string c) {    string t;    if(sscanf(s, "%s:%s", s, t) != 2)    t = s; -  +  s=replace(s,({"__CoMma__", +  "__CoLon__"}),({",",":"})); //can't be done before. +  t=replace(t,({"__CoMma__", +  "__CoLon__"}),({",",":"})); +     return "<option value='"+s+"' "+(s==c?" selected":"")+">"+html_encode_string(t)+"\n";    },current)*"");   
199:    m_delete(m2, "choices");    m_delete(m2, "options");    m2->multiple="1"; +  //escape the characters we need for internal purposes.. +  m->choices=replace(m->choices, +  ({"\\,", "\\:"}), +  ({"__CoMma__", "__CoLon__"})); +     return make_container("select", m2, Array.map(m->choices/",",    lambda(string s, array c) {    string t;    if(sscanf(s, "%s:%s", s, t) != 2)    t = s; -  +  s=replace(s,({"__CoMma__", +  "__CoLon__"}),({",",":"})); //can't be done before. +  t=replace(t,({"__CoMma__", +  "__CoLon__"}),({",",":"})); +     return "<option value='"+s+"' "+(search(c,s)!=-1?"selected":"")+">"+html_encode_string(t)+"\n";    },(current||"")/"\0")*"");    }
255:      string make_title()   { -  string s = (this_object()->wizard_name||this_object()->name) - "<p>"; +  string s = (this_object()->wizard_name||this_object()->name||"No name") - +  "<p>";    sscanf(s, "%*s//%s", s);    sscanf(s, "%*d:%s", s);    return s;
420:    if(!pg) return "Internal error in wizard code: Invalid page ("+v->_page+")!";    if(data = pg(id,@args)) break;    } +  // If it's a mapping we can presume it is an http response, and return +  // it directly. +  if (mappingp(data)) +  return data;    return parse_wizard_page(data,id,wiz_name);   }