[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Usertag formel v0.01
****** message to minivend-users from Stefan Hornburg <racke@linuxia.de> ******
#
# UserTag formel - see POD documentation for more information
#
# Copyright 2000 by Stefan Hornburg <racke@linuxia.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA.
UserTag formel Order label name type size
# may be should place version information on user-defined tags
# UserTag formel Version 0.01
UserTag formel addAttr
UserTag formel Routine <<EOF
sub {
my ($label, $name, $type, $size, $opt) = @_;
my ($labelhtml, $elhtml, $fmt);
my $contrast = $::Variable->{CONTRAST} || 'red';
# set defaults
$type = 'text' unless $type;
for ('format', 'order', 'reset') {
next if $opt->{$_};
if ($::Values->{"mv_formel_$_"}) {
$opt->{$_} = $::Values->{"mv_formel_$_"};
}
}
if ($opt->{'format'}) {
$fmt = $opt->{'format'};
} else {
$fmt = '%s %s';
}
if ($Tag->error($name)) {
$labelhtml = "<font color=\"$contrast\">$label</font>";
} else {
$labelhtml = $label;
}
if ($opt->{reset}) {
$elhtml = "<input type=$type name=$name>";
} else {
$elhtml = "<input type=$type name=$name value=\"$::Values->{$name}\">";
}
if ($opt->{order}) {
# display form element first
sprintf ($fmt, $elhtml, $labelhtml);
} else {
# display label first
sprintf ($fmt, $labelhtml, $elhtml);
}
}
EOF
UserTag formel Documentation <<EOD
=head2 formel
This tag generates a HTML form element. It preserves the user input from
the last display of the current page and looks for
input value errors (using the C<error> tag).
The user-visible description will be displayed
in the color defined by the variable C<CONTRAST> or in red if the
variable is not set.
Parameters for this tag are:
=over 4
=item label
The user-visible description of the form element's purpose.
=item name
The name of the form element which appears in the C<NAME>
attribute of the HTML tag.
=back
Other options are:
=item order
Whether the user-visible description or the form element
comes first. Default is the first (order=0).
=item format
The container format string for the label and the form element.
The default is C<%s %s>.
=item reset
Discards the user input if set to 1.
=back
You can set defaults for format, order and reset with the corresponding
mv_formel_... form variable values, e.g.:
[value name="mv_formel_format" set="<TR><TD>%s</TD><TD>%s</TD></TR>" hide=1]
[value name="mv_formel_order" set=1 hide=1]
EOD
--
LinuXia Systems && Cobolt NetServices, eCommerce and more
Shop- und Datenbanklösungen mit MiniVend, Firewalls auf Debian-Basis
http://www.linuxia.de - http://www.cobolt.net
--> Coding from hell and back <---
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list