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.52 2001/06/13 22:03:26 nilsson Exp $ + // $Id: module.pmod,v 1.53 2001/06/14 20:07:11 js 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:547:         // =====================================================================   // String   // =====================================================================   class String   //! String variable   {    inherit Variable;    constant type = "String"; -  constant width = 40; +  int width = 40;    //! The width of the input field. Used by overriding classes.       array(string) verify_set_from_form( mixed new )    {    return ({ 0, [string]new-"\r" });    }       string render_form( RequestID id, void|mapping additional_args )    {    return input(path(), (string)query(), width, additional_args);
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:569:   }      // =====================================================================   // Text   // =====================================================================   class Text   //! Text (multi-line string) variable   {    inherit String;    constant type = "Text"; -  constant cols = 60; +  int cols = 60;    //! The width of the textarea -  constant rows = 10; +  int rows = 10;    //! The height of the textarea    string render_form( RequestID id, void|mapping additional_args )    {    return "<textarea cols='"+cols+"' rows='"+rows+"' name='"+path()+"'>"    + Roxen.html_encode_string( query() || "" ) +    "</textarea>";    }   }            // =====================================================================   // Password   // =====================================================================   class Password   //! Password variable (uses crypt)   {    inherit String; -  constant width = 20; +  int width = 20;    constant type = "Password";       int(0..1) set_from_form( RequestID id )    {    mapping val;    if( sizeof( val = get_form_vars(id)) &&    val[""] && strlen(val[""]) ) {    set( crypt( val[""] ) );    return 1;    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:622:    additional_args->type="password";    return input(path(), "", 30, additional_args);    }   }      class File   //! A filename   {    inherit String;    constant type = "File"; -  constant width = 50; +  int width = 50;       string read( )    //! Read the file as a string.    {    return Stdio.read_bytes( query() );    }       Stat stat()    //! Stat the file    {
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:650:    }   #endif      }      class Location   //! A location in the virtual filesystem   {    inherit String;    constant type = "Location"; -  constant width = 50; +  int width = 50;       array verify_set( string value )    {    if( !strlen( value ) || !((<'~','/'>)[value[-1]]) )    return ({    LOCALE(330,"You most likely want an ending '/' on this variable"),    value    });    return ::verify_set( value );    }   }      class URL   //! A URL.   {    inherit String;    constant type = "URL"; -  constant width = 50; +  int width = 50;       array verify_set_from_form( string new_value )    {    return verify_port( new_value, 1 );    }   }      class Directory   //! A Directory.   {    inherit String;    constant type = "Directory"; -  constant width = 50; +  int width = 50;       array verify_set( string value )    {   #ifdef __NT__    value = replace( value, "\\", "/" );   #endif    if( strlen(value) && value[-1] != '/' )    value += "/";    if( !strlen( value ) )    return ::verify_set( value );
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:908:         // =====================================================================   // List baseclass   // =====================================================================   class List   //! Many of one type types   {    inherit Variable;    constant type="List"; -  constant width = 40; +  int width = 40;       string transform_to_form( mixed what )    //! Override this function to do the value->form mapping for    //! individual elements in the array.    {    return (string)what;    }       mixed transform_from_form( string what,mapping v )    {
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1111:   {    inherit List;    constant type="StringList";   }      class IntList   //! A list of integers   {    inherit List;    constant type="IntList"; -  constant width=20; +  int width=20;       string transform_to_form(int what) { return (string)what; }    int transform_from_form(string what,mapping v) { return (int)what; }   }      class FloatList   //! A list of floating point numbers   {    inherit List;    constant type="DirectoryList"; -  constant width=20; +  int width=20;       static int _prec = 3;       void set_precision( int prec )    //! Set the number of _decimals_ shown to the user.    //! If prec is 3, and the float is 1, 1.000 will be shown.    //! Default is 2.    {    _prec = prec;    }