package WebGUI::Form; ##################################################################### ##################################################################### # NOTICE: Use of this subsystem is depricated and is not recommended. ##################################################################### ##################################################################### #------------------------------------------------------------------- # WebGUI is Copyright 2001-2002 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict qw(vars subs); use WebGUI::International; use WebGUI::Session; use WebGUI::SQL; #------------------------------------------------------------------- sub _fixQuotes { my $value = shift; $value =~ s/\"/\"\;/g; return $value; } #------------------------------------------------------------------- sub checkbox { my ($output, $name, $value, $checked); ($name, $value, $checked) = @_; if ($checked) { $checked = ' checked'; } $output = ''; return $output; } #------------------------------------------------------------------- sub file { my ($output, $name); ($name) = @_; $output = ''; return $output; } #------------------------------------------------------------------- sub groupList { my ($output, %hash, @array); tie %hash, 'Tie::IxHash'; %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName"); $array[0] = $_[1]; $output = selectList($_[0],\%hash,\@array); return $output; } #------------------------------------------------------------------- sub hidden { my ($output, $name, $value); ($name, $value) = @_; $value = _fixQuotes($value); $output = ''; return $output; } #------------------------------------------------------------------- sub password { my ($output, $name, $size, $maxLength, $value); $name = shift; $size = shift; if ($size eq "") { $size = 15; } $maxLength = shift; if ($maxLength ne "") { $maxLength = ' maxlength="'.$maxLength.'"'; } $value = shift; $output = ''; return $output; } #------------------------------------------------------------------- sub radio { my ($output, $name, $value, $checked); ($name, $value, $checked) = @_; if ($checked) { $checked = ' checked'; } $output = ''; return $output; } #------------------------------------------------------------------- # eg: selectList(name, valueListHashref, selectedArrayref, size, multipleSelection, onChange) sub selectList { my ($output, $valueList, $key, $item, $name, $selected, $size, $multiple, $onChange); ($name, $valueList, $selected, $size, $multiple, $onChange) = @_; if ($size > 1) { $size = ' size="'.$size.'"'; } if ($multiple > 0) { $multiple = ' multiple="1"'; } if ($onChange ne "") { $onChange = ' onChange="'.$onChange.'"'; } $output = ''; } $value = _fixQuotes($value); $output = ''.$assistance; return $output; } #------------------------------------------------------------------- sub textArea { my ($output, $name, $value, $cols, $rows, $htmlEdit, $wrap); $output = ''; $name = $_[0]; $value = $_[1]; $value =~ s/\<\/textarea\>/\<\;\/textarea\>\;/ig; $cols = $_[2] || 50; $rows = $_[3] || 5; $htmlEdit = $_[4]; $wrap = $_[5] || "virtual"; if ($htmlEdit > 0) { $output .= ''; $output .= '
'; } $output .= ''; return $output; } 1;