Roxen.git / server / etc / modules / Variable.pmod / module.pmod

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1175:    mapping get_translation_table( )    //! Get the lookup table. Used by this class as well.    //! You can overload this function if you want a dynamic table.    {    return _table;    }       int(0..1) set_from_form(RequestID id, void|int(0..1) force)    {    if (!multiselect) return ::set_from_form(id); -  if (!id->real_variables[path()]) return 0; +  if (!id->real_variables[path()] && +  !id->real_variables[path() + ".hidden"]) return 0;    set_warning(0);    mapping(string:string) m = get_form_vars(id);    array(mixed) values = ({});    foreach(id->real_variables[path()] || ({}), string form_val) {    mixed val = transform_from_form(form_val, m);    array b = ({ 0, val });    mixed err = catch { b = verify_set_from_form(val); };    if (err) {    add_warning(err);    return 0;
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1255:    "type": "checkbox",    "name": path(),    "value": _name(elem),    "checked": "checked",    ]);    string title = sprintf(LOCALE(332,"(keep stale value %s)"), current);    res += sprintf("<tr><td>%s</td><td>%s</td></tr>\n",    Roxen.make_tag( "input", m),    Roxen.html_encode_string(title));    } -  return res + "</table>"; +  res += "</table>"; +  // Hidden field allows saving of empty selection. +  res += Roxen.make_tag( "input", ([ "type" : "hidden", +  "name" : path() + ".hidden", +  "value" : "hidden" ])); +  return res;    } else {    string current = _name (query());    int selected = 0;    string res = "<select name='"+path()+"'"+autosubmit+">\n";    foreach( get_choice_list(), mixed elem )    {    mapping m = ([]);    m->value = _name( elem );    if( equal( m->value, current ) ) {    m->selected="selected";