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.35 2000/11/20 07:30:15 per Exp $ + // $Id: module.pmod,v 1.36 2000/11/20 13:36:36 per 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:165:    {    return __doc || "";    }       string name( )    //! Return the name of this variable (locale dependant).    //!    //! The default implementation queries the locale object in roxen    //! to get the documentation.    { -  return __name || LOCALE(0,"unnamed")+" "+_id; +  return __name || LOCALE(326,"unnamed")+" "+_id;    }       string type_hint( )    //! Return the type hint for this variable.    //! Type hints are generic documentation for this variable type,    //! and is the same for all instances of the type.    {    }       mixed default_value()
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:323:    if( sizeof( val = get_form_vars(id)) && val[""] &&    (val = transform_from_form( val[""] )) != query() )    {    array b;    mixed q = catch( b = verify_set_from_form( val ) );    if( q || sizeof( b ) != 2 )    {    if( q )    add_warning( q );    else -  add_warning( LOCALE(0,"Internal error: Illegal sized array " +  add_warning( LOCALE(327,"Internal error: Illegal sized array "    "from verify_set_from_form\n") );    return;    }    if( b )    {    set_warning( b[0] );    set( b[1] );    }    }    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:441:    //! Default is 2.    {    _prec = prec;    }       array(string|float) verify_set( float new_value )    {    string warn;    if( new_value > _max && _max > _min)    { -  warn = sprintf(LOCALE(0,"Value is bigger than %s, adjusted"), +  warn = sprintf(LOCALE(328,"Value is bigger than %s, adjusted"),    _format(_max) );    new_value = _max;    }    else if( new_value < _min && _min < _max)    { -  warn = sprintf(LOCALE(0,"Value is less than %s, adjusted"), +  warn = sprintf(LOCALE(329,"Value is less than %s, adjusted"),    _format(_min) );    new_value = _min;    }    return ({ warn, new_value });    }       float transform_from_form( string what )    {    return (float)what;    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:500:    {    _max = maximum;    _min = minimum;    }       array(string|int) verify_set( int new_value )    {    string warn;    if( new_value > _max && _max > _min )    { -  warn = sprintf(LOCALE(0,"Value is bigger than %s, adjusted"), +  warn = sprintf(LOCALE(328,"Value is bigger than %s, adjusted"),    (string)_max );    new_value = _max;    }    else if( new_value < _min && _min < _max)    { -  warn = sprintf(LOCALE(0,"Value is less than %s, adjusted"), +  warn = sprintf(LOCALE(329,"Value is less than %s, adjusted"),    (string)_min );    new_value = _min;    }    return ({ warn, new_value });    }       int transform_from_form( string what )    {    return (int)what;    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:642:   //! A location in the virtual filesystem   {    inherit String;    constant type = "Location";    constant width = 50;       array verify_set( string value )    {    if( !strlen( value ) || !((<'~','/'>)[value[-1]]) )    return ({ -  LOCALE(0,"You most likely want an ending '/' on this variable"), +  LOCALE(330,"You most likely want an ending '/' on this variable"),    value    });    return ::verify_set( value );    }   }      class URL   //! A URL.   {    inherit String;
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:679:    array verify_set( string value )    {   #ifdef __NT__    value = replace( value, "\\", "/" );   #endif    if( strlen(value) && value[-1] != '/' )    value += "/";    if( !strlen( value ) )    return ::verify_set( value );    if( !(r_file_stat( value ) && (r_file_stat( value )[ ST_SIZE ] == -2 ))) -  return ({sprintf(LOCALE(0,"%s is not a directory"),value)+"\n",value}); +  return ({sprintf(LOCALE(331,"%s is not a directory"),value)+"\n",value});    return ::verify_set( value );    }       Stat stat()    //! Stat the directory    {    return file_stat( query() );    }       array get( )
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:772:    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":_name(current), "selected": "selected"]), -  sprintf(LOCALE(0,"(keep stale value %s)"),_name(current))); +  sprintf(LOCALE(332,"(keep stale value %s)"),_name(current)));    return res + "</select>";    }    static void create( mixed default_value, array|mapping choices, -  int _flags, string std_name, string std_doc ) +  int _flags, string|object std_name, +  string|object 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    //!    //! VAR_EXPERT Only for experts    //! VAR_MORE Only visible when more-mode is on (default on)    //! VAR_DEVELOPER Only visible when devel-mode is on (default on)
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:868:    inherit StringChoice;    constant type = "FontChoice";    void set_choice_list()    {    }    array get_choice_list()    {    return roxenp()->fonts->available_fonts();    }    static void create(mixed default_value,int flags, -  string std_name,string std_doc) +  string|object std_name,string|object std_doc)    //! Constructor.    //! Flags is a bitwise or of one or more of    //!    //! VAR_EXPERT Only for experts    //! VAR_MORE Only visible when more-mode is on (default on)    //! VAR_DEVELOPER Only visible when devel-mode is on (default on)    //! VAR_INITIAL Should be configured initially.    //!    //! The std_name and std_doc is the name and documentation string    //! for the default locale (always english)
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:979:    }    }       array b;    mixed q = catch( b = verify_set_from_form( l ) );    if( q || sizeof( b ) != 2 )    {    if( q )    set_warning( q );    else -  set_warning( LOCALE(0,"Internal error: Illegal sized array " +  set_warning( LOCALE(327,"Internal error: Illegal sized array "    "from verify_set_from_form\n" ));    return;    }    if( b )    {    set_warning( b[0] );    set( b[1] );    }    }   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1048:    constant type="DirectoryList";       array verify_set( array(string) value )    {    string warn = "";    foreach( value, string vi )    {    if(!strlen(vi)) // empty    continue;    if( !(r_file_stat( vi ) && (r_file_stat( vi )[ ST_SIZE ] == -2 ))) -  warn += sprintf(LOCALE(0,"%s is not a directory"),vi)+"\n"; +  warn += sprintf(LOCALE(331,"%s is not a directory"),vi)+"\n";    if( strlen(vi) && vi[-1] != '/' )    value = replace( value, vi, vi+"/" );    }   #ifdef __NT__    value = map( value, replace, "\\", "/" );   #endif    if( strlen( warn ) )    return ({ warn, value });       return ::verify_set( value );
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1211:   // Utility functions used in multiple variable classes above   // =================================================================   static array(string) verify_port( string port, int nofhttp )   {    if(!strlen(port))    return ({ 0, port });       string warning="";    if( (int)port )    { -  warning += sprintf(LOCALE(0,"Assuming http://*:%[0]d/ for %[0]d")+"\n", +  warning += sprintf(LOCALE(333,"Assuming http://*:%[0]d/ for %[0]d")+"\n",    (int)port);    port = "http://*:"+port+"/";    }    string protocol, host, path;       if(!strlen( port ) ) -  return ({ LOCALE(0,"Empty URL field")+"\n", port }); +  return ({ LOCALE(334,"Empty URL field")+"\n", port });       if(sscanf( port, "%[^:]://%[^/]%s", protocol, host, path ) != 3) -  return ({ sprintf(LOCALE(0,"%s does not conform to URL syntax")+"\n",port), +  return ({ sprintf(LOCALE(335,"%s does not conform to URL syntax")+"\n",port),    port });       if( path == "" || path[-1] != '/' )    { -  warning += sprintf(LOCALE(0,"Added / to the end of %s")+"\n",port); +  warning += sprintf(LOCALE(336,"Added / to the end of %s")+"\n",port);    path += "/";    }    if( nofhttp && protocol == "fhttp" )    { -  warning += sprintf(LOCALE(0,"Changed %s to http")+"\n",protocol); +  warning += sprintf(LOCALE(337,"Changed %s to http")+"\n",protocol);    protocol = "http";    }    if( protocol != lower_case( protocol ) )    { -  warning += sprintf(LOCALE(0,"Changed %s to %s"), +  warning += sprintf(LOCALE(338,"Changed %s to %s"),    protocol, lower_case( protocol ))+"\n";    protocol = lower_case( protocol );    }    if(!nofhttp) // it's a port, not a URL    {   #if constant(SSL.sslfile)    /* All is A-OK */   #else    if( (protocol == "https" || protocol == "ftps") )    warning += -  LOCALE(0,"SSL support not available in this Pike version.")+"\n"+ -  sprintf(LOCALE(0,"Please use %s instead."), +  LOCALE(339,"SSL support not available in this Pike version.")+"\n"+ +  sprintf(LOCALE(340,"Please use %s instead."),    protocol[..strlen(protocol)-2])+"\n";   #endif    }    int pno;    if( sscanf( host, "%s:%d", host, pno ) == 2)    if( roxenp()->protocols[ lower_case( protocol ) ]    && (pno == roxenp()->protocols[ lower_case( protocol ) ]->default_port )) -  warning += sprintf(LOCALE(0,"Removed the default port number " +  warning += sprintf(LOCALE(341,"Removed the default port number "    "(%d) from %s"),pno,port)+"\n";    else    host = host+":"+pno;          port = protocol+"://"+host+path;       if( !roxenp()->protocols[ protocol ] ) -  warning += sprintf(LOCALE(0,"Warning: The protocol %s is not known " +  warning += sprintf(LOCALE(342,"Warning: The protocol %s is not known "    "by roxen"),protocol)+"\n";    return ({ (strlen(warning)?warning:0), port });   }      static string input(string name, string value, int size,    void|mapping(string:string) args, void|int noxml)   {    if(!args)    args=([]);    else