Merge branch 'master' of git@github.com:plainblack/webgui

This commit is contained in:
daviddelikat 2009-11-18 19:31:17 -06:00
commit 31fb0886bc
7 changed files with 72 additions and 17 deletions

View file

@ -1,4 +1,7 @@
7.8.6
- fixed #11250: i18n Asset_EMSSubmissionForm::delete created items label help
- fixed #11251: perload.perl tries to load t/lib/WebGUI/Test.pm
- fixed #11249: Recaptcha https bug
7.8.5
- added the EMS submission subsystem

View file

@ -58,6 +58,7 @@ Contributing Developers..............Meg O'Keefe Andrea / Plain Black
Jukka Raimovaara / Axxion Oy
Alan Ritari / DonorWare
Hal Roberts / Harvard
Luke Robinson / Orchard Solutions
Laura Rummage / Plain Black
Tera Runde / Plain Black
Steve Simms

View file

@ -162,7 +162,7 @@ sub toHtml {
my $pubKey = $self->session->setting->get('recaptchaPublicKey');
my $server = "http://api.recaptcha.net";
if ($env->sslRequest) {
$server = "http://api-secure.recaptcha.net";
$server = "https://api-secure.recaptcha.net";
}
return
'<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubKey . '"></script>'

View file

@ -73,33 +73,31 @@ sub process {
$toTZ ||= $uTZ;
$format ||= $uFormat;
# remove all whitespace including newlines
$date =~ s/\s//msg;
# Additional date delimiters accepted for edge cases
my ( $year, $month, $day ) = split /[\/\-\.]/, $date;
my ( $year, $month, $day );
if ($date) {
( $year, $month, $day ) = split /[\/\-\.]/, $date;
$date =~ s/\s//msg; # remove all whitespace including newlines
}
my $dt = WebGUI::DateTime->now;
unless ( length($year) ) {
unless ( $year ) {
$year = $dt->year;
}
unless ( length($month) ) {
unless ( $month ) {
$month = $dt->month;
}
unless ( length($day) ) {
unless ( $day ) {
$day = $dt->day;
}
my $formatter = DateTime::Format::Strptime->new( pattern => $format );
# Macro calls also seem to include any spaces between commas
$time =~ s/^\s+//msg;
my ( $hour, $minute, $second );
if ( length($time) ) {
if ( $time ) {
$time =~ s/^\s+//msg; # remove all whitespace including newlines
( $hour, $minute, $second ) = split /\:/, $time;
}
my $dtOut = DateTime->new(
@ -114,7 +112,7 @@ sub process {
# If no time component, we use the date as provided with no conversion
# Without a time to convert between, there is no point to altering the date
if ( length($time) ) {
if ( $time ) {
$dtOut->set_time_zone($toTZ);
}
$dtOut->set_formatter($formatter);

View file

@ -35,8 +35,8 @@ our $I18N = { ##hashref of hashes
context => q|This is the label for the 'delete created items' field. The value will indicate if the EMSCleanup will delete items that have been converted to EMSTicket assets.|
},
'delete created items label help' => {
message => q|Set this to 'Yes' if you want submissions to be deleted after they have been converted into EMSTisket assets.|,
lastUpdated => 1131394072,
message => q|Set this to 'Yes' if you want submissions to be deleted after they have been converted into EMSTicket assets.|,
lastUpdated => 1258563620,
context => q|This is the help text for the delete created items field, if it is set to yes the EMSCleanup activity will delete approved items after EMSTickets have been created from them. This field depends on the 'days before cleanup' field and the EMSCleanup activity also.|
},
'form dscription label' => {

View file

@ -2,7 +2,7 @@ use strict;
my $webguiRoot = '/data/WebGUI';
unshift @INC, $webguiRoot . "/lib";
@INC = "$webguiRoot/lib", grep { $_ ne q{.} } @INC;
# add custom lib directories to library search path
unshift @INC, grep {

53
t/Macro/ConvertUTCToTZ.t Normal file
View file

@ -0,0 +1,53 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------
# 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 FindBin;
use strict;
use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More;
use DateTime;
my $session = WebGUI::Test->session;
my $numTests = 5+1;
plan tests => $numTests;
my $macro = 'WebGUI::Macro::ConvertUTCToTZ';
my $loaded = use_ok($macro);
my $formatter = '%Y-%m-%d';
SKIP: {
skip "Unable to load $macro", $numTests-1 unless $loaded;
my $today = DateTime->now();
$today->set_time_zone('UTC');
my $yesterday = $today->clone;
$yesterday->subtract( days => 1 );
$yesterday->set_formatter($formatter);
my $out1 = WebGUI::Macro::ConvertUTCToTZ::process($session);
like( $out1, qr/\d{2}\/\d{2}\/\d{2}\/\d{2}\/\d{2}/, 'No parameters passed, check pattern');
my $out2 = WebGUI::Macro::ConvertUTCToTZ::process($session, 'UTC', $formatter, $today->ymd);
is( $out2, $today->ymd, 'UTC, date only');
my $out3 = WebGUI::Macro::ConvertUTCToTZ::process($session, 'UTC', $formatter, $today->ymd, '02:30:00');
is( $out3, $today->ymd, 'UTC, date and time');
my $out4 = WebGUI::Macro::ConvertUTCToTZ::process($session, 'America/Chicago', $formatter, $today->ymd, '02:30:00');
is( $out4, $yesterday->ymd, 'Chicago, date and a.m. time');
my $out5 = WebGUI::Macro::ConvertUTCToTZ::process($session, 'America/Chicago', $formatter, $today->ymd, '14:30:00');
is( $out5, $today->ymd, 'Chicago, date and p.m. time');
}