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

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1: + // $Id: module.pmod,v 1.11 2000/09/01 01:15:21 mast Exp $ +    #include <module.h>   #include <roxen.h>      // Locale macros   static inline string getloclang() {    return roxenp()->locale->get();   }      //<locale-token project="roxen_config"> LOCALE </locale-token>   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:692:    //! element gotten from the get_choice_list() function.    {    if( mapping tt = get_translation_table() )    return tt[ what ] || (string)what;    return (string)what;    }       string render_form( RequestID id, void|mapping additional_args )    {    string res = "<select name='"+path()+"'>\n"; +  string current = _name (query()); +  int selected = 0;    foreach( get_choice_list(), mixed elem )    {    mapping m = ([]);    m->value = _name( elem ); -  if( equal( m->value, _name( query() ) ) ) +  if( equal( m->value, current ) ) {    m->selected="selected"; -  +  selected = 1; +  }    res += " "+Roxen.make_container( "option", m, _title( elem ) )+"\n";    } -  +  if (!selected) +  // Make an entry for the current value if it's not in the list, +  // so no other value appears to be selected, and to ensure that +  // the value doesn't change as a side-effect by another change. +  res = " " + Roxen.make_container ( +  "option", (["value": current, "selected": "selected"]), +  "(keep stale value " + current + ")");    return res + "</select>";    }    static void create( mixed default_value, array|mapping choices,    int _flags, string std_name, string std_doc )    //! Constructor.    //!    //! Choices is the list of possible choices, can be set with    //! set_choice_list at any time.    //!    //! Flags is a bitwise or of one or more of