Gossamer Forum
Home : Products : Others : Gossamer Community :

ssi_form_control

Quote Reply
ssi_form_control
How do I use this function?

Code:

sub ssi_form_control {
# -------------------------------------------------------------------
require GT::SQL::Display::HTML;
require GT::SQL::Display::HTML::Table;
require GT::Template;
my $opts = ref $_[0] eq 'HASH' ? shift : {@_};
my $user_tb = $DB->table('comm_users');
my $tags = GT::Template->tags || {};
my $disp = $DB->html($user_tb, $tags);
my $form_type = lc( $opts->{form_type} || $opts->{def}{form_type} );
exists $opts->{blank} or $opts->{blank} = $form_type eq 'select' ? 1 : 0;
my $input_html = 'radio' eq $form_type ? $disp->radio( $opts ) :
'checkbox' eq $form_type ? $disp->checkbox( $opts ) :
'select' eq $form_type ? do {
$opts->{form_size} ||= $opts->{def}{form_size};
$disp->select( $opts );
} :
'hidden' eq $form_type ? $disp->hidden( $opts ) :
'multiple' eq $form_type ? do {
$opts->{form_size} ||= $opts->{def}{form_size};
$opts->{multiple} = $opts->{form_size};
$disp->multiple( $opts )
}:
'textarea' eq $form_type ? $disp->textarea( $opts ) :
'file' eq $form_type ? "File type not supported." :
'date' eq $form_type ? do {
require GT::Date;
my ($sel_year, $sel_mon, $sel_day) = split /\-/, GT::CGI::html_escape($opts->{value});
$sel_year ||= 1970;
$sel_mon ||= 1;
$sel_day ||= 1;
my $month_sel = $disp->select({
name => "$opts->{name}-mon",
value => $sel_mon,
values => { map { sprintf("%02d", $_) => $GT::Date::LANGUAGE->{short_month_names}->[$_ - 1] } (1 .. 12) },
sort => [ map { sprintf("%02d", $_) } (1 .. 12) ],
blank => 0
});
my $day_sel = $disp->select({
name => "$opts->{name}-day",
value => $sel_day,
values => { map { sprintf("%02d", $_) => $_ } (1 .. 31) },
sort => [ map { sprintf("%02d", $_) } (1 .. 31) ],
blank => 0
});
qq~
$day_sel /
$month_sel /
<input type="text" name="$opts->{name}-year" value="$sel_year" size="4" maxlength="4">
~;
} :
$disp->text($opts);
return \$input_html;
}
Quote Reply
Re: [smsltd] ssi_form_control In reply to
What do you want to know?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [smsltd] ssi_form_control In reply to
Sorry, I was trying to find out how to get community user data from links sql and as such was looking at a variety of functions. This one seemed particularly obfuscated.
Quote Reply
Re: [smsltd] ssi_form_control In reply to
This duplicate question was answered in your another thread:
How to display community profile data in Links SQL?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...