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.117 2009/10/13 11:55:27 mast Exp $ + // $Id: module.pmod,v 1.118 2011/07/13 16:07:11 grubba Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:523:    //! If a string is thrown, it will be used as a error message from    //! set, and the variable will not be changed.    {    return ({ 0, new_value });    }       mapping(string:string) get_form_vars( RequestID id )    //! Return all form variables preficed with path().    {    string p = path(); -  array names = glob( p+"*", indices(id->variables) ); +  array names = glob( p+"*", indices(id->real_variables) );    mapping res = ([ ]);    foreach( sort(names), string n ) -  res[ n[strlen(p).. ] ] = id->variables[ n ]; +  res[ n[strlen(p).. ] ] = id->real_variables[ n ][0];    return res;    }       mixed transform_from_form( string what, mapping|void v )    //! Given a form value, return what should be set.    //! Used by the default set_from_form implementation.    {    return what;    }       int(0..1) set_from_form( RequestID id, void|int(0..1) force ) -  //! Set this variable from the form variable in id->Variables, +  //! Set this variable from the form variable in id->variables,    //! if any are available. The default implementation simply sets    //! the variable to the string in the form variables. @[force]    //! forces the variable to be set even if the variable already    //! has the new value, forcing possible warnings to be added.    //! Returns 1 if the variable was changed, otherwise 0.    //!    //! Other side effects: Might create warnings to be shown to the    //! user (see get_warnings)    //!    //! Calls verify_set_from_form and verify_set
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1648:    // first do the assign...    if( (int)vl[".count"] != _current_count )    return 0;    _current_count++;    set_warning(0);       foreach( indices( vl ), string vv )    if( sscanf( vv, ".set.%d", rn ) && (vv == ".set."+rn) )    {    if ((rn >= 0) && (rn < sizeof(l))) { -  m_delete( id->variables, path()+vv ); +  m_delete( id->real_variables, path()+vv );    l[rn] = transform_from_form( vl[vv], vl );    m_delete( vl, vv );    } else {    report_debug("set_from_form(%O): vv:%O sizeof(l):%d\n",    id, vv, sizeof(l));    }    }    // then the move...    foreach( indices(vl), string vv )    if( sscanf( vv, ".up.%d.x%*s", rn ) == 2 )    {    do_goto = 1; -  m_delete( id->variables, path()+vv ); +  m_delete( id->real_variables, path()+vv );    m_delete( vl, vv );    l = l[..rn-2] + l[rn..rn] + l[rn-1..rn-1] + l[rn+1..];    }    else if( sscanf( vv, ".down.%d.x%*s", rn )==2 )    {    do_goto = 1; -  m_delete( id->variables, path()+vv ); +  m_delete( id->real_variables, path()+vv );    l = l[..rn-1] + l[rn+1..rn+1] + l[rn..rn] + l[rn+2..];    }    // then the possible add.    if( vl[".new.x"] )    {    do_goto = 1; -  m_delete( id->variables, path()+".new.x" ); +  m_delete( id->real_variables, path()+".new.x" );    l += ({ transform_from_form( "",vl ) });    }       // .. and delete ..    foreach( indices(vl), string vv )    if( sscanf( vv, ".delete.%d.x%*s", rn )==2 )    {    do_goto = 1; -  m_delete( id->variables, path()+vv ); +  m_delete( id->real_variables, path()+vv );    l = l[..rn-1] + l[rn+1..];    }       array b;    mixed q = catch( b = verify_set_from_form( l ) );    if( q || sizeof( b ) != 2 )    {    if( q )    add_warning( q );    else