diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index 2f2a68752..d5aefd663 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -39,6 +39,7 @@ Base forms package. Eliminates some of the normal code work that goes along with $html = WebGUI::Form::checkList({name=>"dayOfWeek", options=>\%days}); $html = WebGUI::Form::combo({name=>"fruit",options=>\%fruit}); $html = WebGUI::Form::date({name=>"endDate", value=>$endDate}); + $html = WebGUI::Form::dateTime({name=>"begin", value=>$begin}); $html = WebGUI::Form::email({name=>"emailAddress"}); $html = WebGUI::Form::fieldType({name=>"fieldType",types=>\%supportedTypes}); $html = WebGUI::Form::file({name=>"image"}); @@ -60,6 +61,7 @@ Base forms package. Eliminates some of the normal code work that goes along with $html = WebGUI::Form::template({name=>"templateId"}); $html = WebGUI::Form::text({name=>"firstName"}); $html = WebGUI::Form::textarea({name=>"emailMessage"}); + $html = WebGUI::Form::timeField({name=>"begin", value=>$begin}); $html = WebGUI::Form::url({name=>"homepage"}); $html = WebGUI::Form::yesNo({name=>"happy"}); $html = WebGUI::Form::zipcode({name=>"workZip"}); @@ -289,7 +291,7 @@ By default a date is placed in the "value" field. Set this to "1" to turn off th =cut sub date { - my ($subtext, $noDate, $class, $output, $name, $label, $extras, $size, $value); + my ($subtext, $noDate, $class, $name, $label, $extras, $size, $value); $value = epochToSet($_[0]->{value}); $size = $_[0]->{size} || 10; $value = "" if ($_[0]->{noDate}); @@ -344,7 +346,7 @@ sub dateTime { value=>$_[0]->{value}, extras=>$_[0]->{dateExtras} }); - $output .= time({ + $output .= timeField({ name=>$_[0]->{name}."_time", value=>WebGUI::DateTime::getSecondsFromEpoch($_[0]->{value}), extras=>$_[0]->{timeExtras} @@ -446,8 +448,8 @@ sub fieldType { foreach $type (@{$_[0]->{types}}) { if ($type eq "text") { $hash{text} = WebGUI::International::get(475); - } elsif ($type eq "time") { - $hash{time} = WebGUI::International::get(971); + } elsif ($type eq "timeField") { + $hash{timeField} = WebGUI::International::get(971); } elsif ($type eq "dateTime") { $hash{dateTime} = WebGUI::International::get(972); } elsif ($type eq "textarea") { @@ -1413,7 +1415,7 @@ sub textarea { #------------------------------------------------------------------- -=head2 time ( hashRef ) +=head2 timeField ( hashRef ) Returns a time field, 24 hour format. @@ -1445,7 +1447,7 @@ The number of characters wide this form element should be. There should be no re =cut -sub time { +sub timeField { my $value = WebGUI::DateTime::secondsToTime($_[0]->{value}); my $output = _javascriptFile('inputCheck.js'); $output .= text({ diff --git a/lib/WebGUI/FormProcessor.pm b/lib/WebGUI/FormProcessor.pm index d711910aa..7ee06af4e 100644 --- a/lib/WebGUI/FormProcessor.pm +++ b/lib/WebGUI/FormProcessor.pm @@ -55,7 +55,7 @@ This package helps in the processing of the form variables that are returned fro $value = WebGUI::FormProcessor::template("templateId"); $value = WebGUI::FormProcessor::text("firstName"); $value = WebGUI::FormProcessor::textarea("emailMessage"); - $value = WebGUI::FormProcessor::time("wakeupCall"); + $value = WebGUI::FormProcessor::timeField("wakeupCall"); $value = WebGUI::FormProcessor::url("homepage"); $value = WebGUI::FormProcessor::yesNo("happy"); $value = WebGUI::FormProcessor::zipcode("workZip"); @@ -170,8 +170,8 @@ The name of the form variable to retrieve. =cut sub dateTime { - my $date = WebGUI::FormProcessor::date($_[0]."_date"); - my $time = WebGUI::FormProcessor::time($_[0]."_time"); + my $date = date($_[0]."_date"); + my $time = timeField($_[0]."_time"); my $epoch = $date+$time; return $epoch; } @@ -193,7 +193,7 @@ The name of the form variable to retrieve. =cut sub email { - if ($session{form}{$_[0]} =~ /^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/i) { + if ($session{form}{$_[0]} =~ /^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) { return $session{form}{$_[0]}; } return undef; @@ -614,7 +614,7 @@ sub textarea { #------------------------------------------------------------------- -=head2 time ( name ) +=head2 timeField ( name ) Returns the number of seconds since 00:00:00 on a 24 hour clock. @@ -628,7 +628,7 @@ The name of the form variable to retrieve. =cut -sub time { +sub timeField { return WebGUI::DateTime::timeToSeconds($session{form}{$_[0]}); } @@ -650,12 +650,11 @@ The name of the form variable to retrieve. =cut sub url { - if ($session{form}{$_[0]} =~ /^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/i) { - if ($session{form}{$_[0]} =~ /mailto:/) { - return $session{form}{$_[0]}; - } + if ($session{form}{$_[0]} =~ /mailto:/) { + return $session{form}{$_[0]}; + } elsif ($session{form}{$_[0]} =~ /^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) { return "mailto:".$session{form}{$_[0]}; - } elsif ($session{form}{$_[0]} =~ /:/) { + } elsif ($session{form}{$_[0]} =~ /:\/\//) { return $session{form}{$_[0]}; } return "http://".$session{form}{$_[0]}; diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index f2d7cf503..ddc0d085f 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -56,6 +56,11 @@ Package that makes HTML forms typed data and significantly reduces the code need -label=>"End Date", -value=>$endDate ); + $f->dateTime( + -name=>"endDate", + -label=>"End Date", + -value=>$endDate + ); $f->email( -name=>"emailAddress", -label=>"Email Address" @@ -142,6 +147,11 @@ Package that makes HTML forms typed data and significantly reduces the code need -name=>"emailMessage", -label=>"Email Message" ); + $f->timeField( + -name=>"endDate", + -label=>"End Date", + -value=>$endDate + ); $f->url( -name=>"homepage", -label=>"Home Page" @@ -1985,7 +1995,7 @@ sub textarea { #------------------------------------------------------------------- -=head2 time ( name [ label, value, extras, subtext, size, noDate, uiLevel ] ) +=head2 timeField ( name [ label, value, extras, subtext, size, noDate, uiLevel ] ) Adds a date row to this form. @@ -2025,7 +2035,7 @@ The UI level for this field. See the WebGUI developer's site for details. Defaul =cut -sub time { +sub timeField { my ($output); my ($self, @p) = @_; my ($name, $label, $value, $extras, $subtext, $size, $uiLevel) = diff --git a/lib/WebGUI/Operation/Collateral.pm b/lib/WebGUI/Operation/Collateral.pm index 86f2a13f9..187483a29 100644 --- a/lib/WebGUI/Operation/Collateral.pm +++ b/lib/WebGUI/Operation/Collateral.pm @@ -486,12 +486,12 @@ sub _htmlAreaCreateTree { #------------------------------------------------------------------- sub www_htmlArealistCollateral { - my (@parents, $output, $sth, $data, $folderId, $parent, $indent); + my (@parents, $sth, $data, $indent); $session{form}{makePrintable}=1; $session{form}{style}=-10; # Special style for this output return "Only Content Managers are allowed to use WebGUI Collateral" unless (WebGUI::Privilege::isInGroup(4)); - $output .= '