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

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1434:       protected string _title( mixed what )    //! Get the title used as description (shown to the user) for an    //! element gotten from the get_choice_list() function.    {    if( mapping tt = get_translation_table() )    return tt[ what ] || (string)what;    return (string)what;    }    +  protected string render_element(mixed elem) +  //! Render the title used as description (shown to the user) for an +  //! element gotten from the get_choice_list() function. +  //! +  //! The default implementation just calls @[_title()], +  //! and quotes the result. +  //! +  //! Overload this for more advanced rendering. +  { +  return Roxen.html_encode_string(_title(elem)); +  } +     string render_form( RequestID id, void|mapping additional_args )    {    string autosubmit = "";    if(additional_args && additional_args->autosubmit)    autosubmit = " autosubmit='autosubmit' onChange='javascript:submit();'";    if (multiselect) {    array(string) current = map(query(), _name);    string res = "<table>\n";    foreach( get_choice_list(), mixed elem )    {
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1455:    "type": "checkbox",    "name": path(),    "value": _name(elem),    ]);    if(has_value(current, m->value)) {    m->checked="checked";    current -= ({ m->value });    }    res += sprintf("<tr><td>%s</td><td>%s</td></tr>\n",    Roxen.make_tag( "input", m), -  Roxen.html_encode_string(_title(elem))); +  render_element(elem));    }    // Make an entry for the current values if they're not in the list,    // to ensure that the value doesn't change as a side-effect by    // another change.    foreach(current, string value)    {    mapping m = ([    "type": "checkbox",    "name": path(),    "value": value,