docs.roxen.comBack to normal mode
DocsRoxenWebServer 4.0System Developer ManualImportant Classes
Copyright © 2006, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com

Available Variable Types

The classes in the Variable module are the abstractions of module variables, with a common set of methods (covered in greater depth with Variable.Variable) and some datatype dependent add-ons to constrain or otherwise customize the variable.
Variable.Flag

An on/off toggle.

Variable.Int

Integer variable, with optional range checks

void set_range(int minimum, int maximum)

Set the range of the variable, if minimum and maximum are both 0 (the default), the range check is removed.

Variable.Float

Float variable, with optional range checks, and adjustable precision.

void set_range(float minimum, float maximum)

Set the range of the variable, if minimum and maximum are both 0.0 (the default), the range check is removed.

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.

Variable.String

String variable.

constant width = 40;

The width of the input field. Used by overriding classes.

Variable.Password

Password variable (uses crypt) (extends Variable.String).

Variable.File

A filename (extends Variable.String).

string read()

Read the file as a string.

Stat stat()

Stat the file.

Variable.Location

A location in the virtual filesystem (extends Variable.String).

Variable.URL

A URL (extends Variable.String).

Variable.Directory

A Directory (extends Variable.String).

Stat stat()

Stat the directory.

array get()

Return a listing of all files in the directory.

Variable.Text

Text (multi-line string) variable (extends Variable.String).

constant cols = 60;

The width of the textarea.

constant rows = 10;

The height of the textarea.

Variable.MultipleChoice

Base class for multiple-choice (one of many) type variables.

void set_choice_list(array to)

Set the list of choices.

array get_choice_list()

Get the list of choices. Used by this class as well. You can overload this function if you want a dynamic list.

void set_translation_table(mapping to)

Set the lookup table.

mapping get_translation_table()

Get the lookup table. Used by this class as well. You can overload this function if you want a dynamic table.

static string _name(mixed what)

Get the name used as value for an element gotten from the get_choice_list() method.

static string _title(mixed what)

Get the title used as description (shown to the user) for an element gotten from the get_choice_list() method.

Variable.StringChoice

Select one of many strings (extends Variable.MultipleChoice).

Variable.IntChoice

Select one of many integers (extends Variable.MultipleChoice).

Variable.FloatChoice

Select one of many floating point (real) numbers (extends Variable.MultipleChoice).

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.

Variable.FontChoice

Select a font from the list of available fonts (extends Variable.MultipleChoice).

Variable.List

The List baseclass, offering many-of-one-type types.

string transform_to_form(mixed what)

Override this function to do the value->form mapping for individual elements in the array.

Variable.DirectoryList

A list of directories (subclass of Variable.List).

Variable.StringList

A list of strings (subclass of Variable.List).

Variable.IntList

A list of integers (subclass of Variable.List).

Variable.FloatList

A list of floating point numbers (subclass of Variable.List). See also Variable.Float.

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.

Variable.URLList

A list of URLs (subclass of Variable.List).

Variable.PortList

A list of Port URLs (subclass of Variable.List).

Variable.FileList

A list of filenames (subclass of Variable.List).