Branch: Tag:

1997-08-21

1997-08-21 11:31:24 by Per Hedbor <ph@opera.com>

Foo

Rev: server/base_server/wizard.pike:1.23
Rev: server/config_actions/upgrade.pike:1.10

1: - /* $Id: wizard.pike,v 1.22 1997/08/21 10:50:29 per Exp $ + /* $Id: wizard.pike,v 1.23 1997/08/21 11:31:22 per Exp $    * name="Wizard generator";    * doc="This plugin generats all the nice wizards";    */    -  +    inherit "roxenlib";   string wizard_tag_var(string n, mapping m, object id)   { -  +     string current = id->variables[m->name] || m["default"]; -  +     switch(m->type)    {    default: // String....
57:    (current==m->value)?" checked":""), m);       case "checkbox": +  string res;    m_delete(m,"default");    m_delete(m, m->name);    m_delete(id->variables, m->name); -  return make_tag("input "+(current?" checked":""), m); +  if(!search(lower_case(current||""),"on")) current="1"; +  if((int)current) m->checked="checked"; +  res=make_tag("input", m); +  m->type="hidden"; +  m->value="0"; +  return res+make_tag("input", m);       case "int":    m->type = "number";
126:    m_delete(state,"unique");    m_delete(state,"help");    - // perror("State=%O\n", state); + // werror(sprintf("State=%O\n", state)); +     string from = encode_value(state);    object gz = Gz;    if(sizeof(indices(gz)))
145:    return contents;   }    - string name_of() + string make_title()   { -  string n = (this_object()->wizard_name||this_object()->name)-"<p>"; -  sscanf(n, "%*s//%s", n); -  sscanf(n, "%*d//%s", n); -  return n; +  string s = (this_object()->wizard_name||this_object()->name) - "<p>"; +  sscanf(s, "%*s//%s", s); +  sscanf(s, "%*d:%s", s); +  return s;   }      string parse_wizard_page(string form, object id, string wiz_name)
178:    "<table bgcolor=black cellpadding=1 border=0 cellspacing=0 width=80%>\n"    " <tr><td><table bgcolor=#eeeeee cellpadding=0 "    " cellspacing=0 border=0 width=100%>\n" -  " <tr><td><table width=100% height=100% cellspacing=0 cellpadding=5>\n<tr><td>" -  "<font size=+2>"+name_of()+"</font>" +  " <tr><td valign=top><table width=100% height=100% cellspacing=0 cellpadding=5>\n<tr><td valign=top>\n" +  "<font size=+2>"+make_title()+"</font>"    " </td>\n<td align=right>"+ -  (max_page!=1?"Page "+(page+1)+"/"+(max_page+1):"")+"</td>\n" +  (max_page?"Page "+(page+1)+"/"+(max_page+1):"")+"</td>\n"    " \n<td align=right>"+    (foo->help && !id->variables->help?    "<font size=-1><input type=image name=help src="+
326:   mixed wizard_menu(object id, string dir, string base, mixed ... args)   {    mapping acts; -  if(id->pragma["no-cache"]) { -  foreach(indices(wizards), string w) -  { -  destruct(wizards[w]); -  m_delete(wizards,w); -  } -  wizards=([]); -  } +  if(id->pragma["no-cache"]) wizards=([]); +     if(!id->variables->sm)    id->variables->sm = focused_wizard_menu;    else
345:    return ("<table cellpadding=10><tr><td valign=top bgcolor=#eeeeee>"+    act_describe_submenues(indices(acts),base,id->variables->sm)+    "</td>\n\n<td valign=top>"+ -  (acts[id->variables->sm]?"<font size=+3>"+ +  (sizeof(acts)>1 && acts[id->variables->sm]?"<font size=+3>"+    (id->variables->sm||"Misc")+"</font><dl>":"<dl>")+    (sort(acts[id->variables->sm]||({}))*"\n")+    "</dl></td></tr></table>");
355:      /*** Additional Action Functions ***/    - string html_notice(string notice, object id) - { -  return ("<table><tr><td valign=top><img src=\""+ -  (id->conf?"/internal-roxen-":"/image/") -  +"err_1.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); - } -  - string html_warning(string notice, object id) - { -  return ("<table><tr><td valign=top><img src=\""+ -  (id->conf?"/internal-roxen-":"/image/") -  +"err_2.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); - } -  - string html_error(string notice, object id) - { -  return ("<table><tr><td valign=top><img src=\""+ -  (id->conf?"/internal-roxen-":"/image/") -  +"err_3.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); - } -  +    string html_table(array(string) subtitles, array(array(string)) table)   {    string r = "";    -  r += "<table bgcolor=black border=0 cellspacing=0 cellpadding=1>\n" -  "<tr><td>\n"; +  r += ("<table bgcolor=black border=0 cellspacing=0 cellpadding=1>\n" +  "<tr><td>\n");    r += "<table border=0 cellspacing=0 cellpadding=4>\n";    r += "<tr bgcolor=#113377>\n";    foreach(subtitles, string s)
399:    return r;   }    +  + string html_notice(string notice, object id) + { +  return ("<table><tr><td valign=top><img src=\""+ +  (id->conf?"/internal-roxen-":"/image/") +  +"err_1.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); + } +  + string html_warning(string notice, object id) + { +  return ("<table><tr><td valign=top><img src=\""+ +  (id->conf?"/internal-roxen-":"/image/") +  +"err_2.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); + } +  + string html_error(string notice, object id) + { +  return ("<table><tr><td valign=top><img src=\""+ +  (id->conf?"/internal-roxen-":"/image/") +  +"err_3.gif\"></td><td valign=top>"+notice+"</td></tr></table>"); + }