Skip to content

Commit

Permalink
Merge commit 'v7.10.24' into WebGUI8
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jan 17, 2012
2 parents c94af49 + 9ba3022 commit 3b418ed
Show file tree
Hide file tree
Showing 139 changed files with 696 additions and 32,130 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/7.x.x.txt
@@ -1,4 +1,6 @@
7.10.24 7.10.24
- fixed #12318: asset error causes asset manager to fail
- fixed #12308: error message used scalar as reference
- fixed #12256: Calendar Search doesn't show admin controls - fixed #12256: Calendar Search doesn't show admin controls
- fixed #12268: Point of sale form missing from cart screen. - fixed #12268: Point of sale form missing from cart screen.
- fixed #12201: AssetReport - no selects. - fixed #12201: AssetReport - no selects.
Expand All @@ -7,6 +9,10 @@
- fixed Passive Analytics, UI, Progress Bar, server load. - fixed Passive Analytics, UI, Progress Bar, server load.
- fixed #12303: Survey custom multiple choice question types - fixed #12303: Survey custom multiple choice question types
- fixed #12304: Surven packages do not include custom question types - fixed #12304: Surven packages do not include custom question types
- fixed #12309: Some child assets ignore visitor cache timeouts
- fixed possible values and default values on EMS submission.
- fixed #12312: Shop account plugin has unrendered macro
- fixed #12315: Remove yui tests from git repo.


7.10.23 7.10.23
- fixed #12225: Stock asset, multiple instances on a page - fixed #12225: Stock asset, multiple instances on a page
Expand Down
6 changes: 6 additions & 0 deletions docs/gotcha.txt
Expand Up @@ -38,6 +38,12 @@ save you many hours of grief.


* Support for server-side spell checking in the Rich Editor TinyMCE has been removed. * Support for server-side spell checking in the Rich Editor TinyMCE has been removed.


7.10.24
--------------------------------------------------------------------
* WebGUI now depends on Business::OnlinePayment::AuthorizeNet. This version
should install automatically via the testEnvironment.pl script, or the
perl-standard CPAN module.

7.10.23 7.10.23
-------------------------------------------------------------------- --------------------------------------------------------------------
* The default_search2 template had a bad template attachment pointing to * The default_search2 template had a bad template attachment pointing to
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
183 changes: 183 additions & 0 deletions docs/upgrades/upgrade_7.10.23-7.10.24.pl
@@ -0,0 +1,183 @@
#!/usr/bin/env perl

#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 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
#-------------------------------------------------------------------

our ($webguiRoot);

BEGIN {
$webguiRoot = "../..";
unshift (@INC, $webguiRoot."/lib");
}

use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;


my $toVersion = '7.10.24';
my $quiet; # this line required


my $session = start(); # this line required

# upgrade functions go here
addPALastLogTable($session);
addForkRedirect($session);
extendBucketName($session);
fixSurveyQuestionTypes($session);

finish($session); # this line required


#----------------------------------------------------------------------------
# Describe what our function does
sub addPALastLogTable {
my $session = shift;
print "\tAdd a table to keep track of additional Passive Analytics data... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
CREATE TABLE IF NOT EXISTS `PA_lastLog` (
`userId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`assetId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`sessionId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`timeStamp` bigint(20) DEFAULT NULL,
`url` char(255) NOT NULL,
PRIMARY KEY (userId, sessionId)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
EOSQL
print "DONE!\n" unless $quiet;
}

#----------------------------------------------------------------------------
# Describe what our function does
sub addForkRedirect {
my $session = shift;
print "\tAdd a column to Fork to keep track of late generated redirect URLs... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
ALTER TABLE Fork add column redirect CHAR(255);
EOSQL
print "DONE!\n" unless $quiet;
}

#----------------------------------------------------------------------------
# Describe what our function does
sub extendBucketName {
my $session = shift;
print "\tExtend the size of the bucket name in the bucketLog table for Passive Analytics... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
ALTER TABLE bucketLog CHANGE COLUMN Bucket Bucket CHAR(255)
EOSQL
print "DONE!\n" unless $quiet;
}


#----------------------------------------------------------------------------
# Describe what our function does
sub fixSurveyQuestionTypes {
my $session = shift;
print "\tFix bad custom Question Types in the Survey... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
update Survey_questionTypes set answers="{}" where answers like 'HASH%';
EOSQL
print "DONE!\n" unless $quiet;
}

#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
# # and here's our code
# print "DONE!\n" unless $quiet;
#}


# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------

#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;

print "\tUpgrading package $file\n" unless $quiet;
# Make a storage location for the package
my $storage = WebGUI::Storage->createTemp( $session );
$storage->addFileFromFilesystem( $file );

# Import the package into the import node
my $package = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};

if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}

return;
}

#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
my $session = WebGUI::Session->open($webguiRoot,$configFile);
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
return $session;
}

#-------------------------------------------------
sub finish {
my $session = shift;
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

#-------------------------------------------------
sub updateTemplates {
my $session = shift;
return undef unless (-d "packages-".$toVersion);
print "\tUpdating packages.\n" unless ($quiet);
opendir(DIR,"packages-".$toVersion);
my @files = readdir(DIR);
closedir(DIR);
my $newFolder = undef;
foreach my $file (@files) {
next unless ($file =~ /\.wgpkg$/);
# Fix the filename to include a path
$file = "packages-" . $toVersion . "/" . $file;
addPackage( $session, $file );
}
}

#vim:ft=perl
2 changes: 2 additions & 0 deletions lib/WebGUI/Asset/EMSSubmission.pm
Expand Up @@ -391,6 +391,8 @@ sub www_editSubmission {
$fields->{$fieldId}{fieldType} = $metaField->{dataType}; $fields->{$fieldId}{fieldType} = $metaField->{dataType};
$fields->{$fieldId}{name} = $fieldId; $fields->{$fieldId}{name} = $fieldId;
$fields->{$fieldId}{value} = $self->get($fieldId) if $self; $fields->{$fieldId}{value} = $self->get($fieldId) if $self;
$fields->{$fieldId}{options} = $metaField->{possibleValues};
$fields->{$fieldId}{defaultValue} = $metaField->{defaultValues};
} }
} }


Expand Down
5 changes: 3 additions & 2 deletions lib/WebGUI/Asset/Template.pm
Expand Up @@ -731,9 +731,10 @@ sub process {
my $output; my $output;
eval { $output = $parser->process($template, $self->param); }; eval { $output = $parser->process($template, $self->param); };
if (my $e = Exception::Class->caught) { if (my $e = Exception::Class->caught) {
$session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $e->error); my $message = ref $e ? $e->error : $e;
$session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $message);
my $i18n = WebGUI::International->new($session, 'Asset_Template'); my $i18n = WebGUI::International->new($session, 'Asset_Template');
$output = sprintf $i18n->get('template error').$e->error, $self->getUrl, $self->getId; $output = sprintf $i18n->get('template error').$message, $self->getUrl, $self->getId;
} }


# Process the style template # Process the style template
Expand Down
11 changes: 7 additions & 4 deletions lib/WebGUI/Asset/Wobject/Calendar.pm
Expand Up @@ -1126,7 +1126,7 @@ sub viewList {
); );


### Build the event vars ### Build the event vars
my $dtLast = $dtStart; # The DateTime of the last event my $dtLast = WebGUI::DateTime->new(0); # The DateTime of the last event
EVENT: for my $event (@events) { EVENT: for my $event (@events) {
next EVENT unless $event && $event->canView(); next EVENT unless $event && $event->canView();
my ( %eventVar, %eventDate ) my ( %eventVar, %eventDate )
Expand All @@ -1135,12 +1135,15 @@ sub viewList {
# Add the change flags # Add the change flags
my $dt = $event->getDateTimeStart; my $dt = $event->getDateTimeStart;
if ( $dt->year > $dtLast->year ) { if ( $dt->year > $dtLast->year ) {
$eventVar{ new_year } = 1; $eventVar{ new_year } = 1;
$eventVar{ new_month } = 1;
$eventVar{ new_day } = 1;
} }
if ( $dt->month > $dtLast->month ) { elsif ( $dt->month > $dtLast->month ) {
$eventVar{ new_month } = 1; $eventVar{ new_month } = 1;
$eventVar{ new_day } = 1;
} }
if ( $dt->day > $dtLast->day ) { elsif ( $dt->day > $dtLast->day ) {
$eventVar{ new_day } = 1; $eventVar{ new_day } = 1;
} }


Expand Down
47 changes: 47 additions & 0 deletions lib/WebGUI/Asset/Wobject/Survey.pm
Expand Up @@ -2430,6 +2430,53 @@ sub export {


#------------------------------------------------------------------- #-------------------------------------------------------------------


=head2 exportAssetData ()
Extend the base method to include custom question types added to this Survey.
=cut

sub exportAssetData {
my $self = shift;
my $asset_data = $self->SUPER::exportAssetData();
my $questions = $self->surveyJSON->questions();
my $multiple_choice = $self->surveyJSON->multipleChoiceTypes();
my %question_types = ();
my $get_question = $self->session->db->prepare('select answers from Survey_questionTypes where questionType=?');
foreach my $question (@{ $questions }) {
my $type = $question->{questionType};
next unless $multiple_choice->{$type};
next if $question_types{$type};
$get_question->execute([$type]);
my ($answers) = $get_question->array();
$question_types{$type} = $answers;
}
#my $question_types = $self->db->buildArrayRefOfHashRefs('select * from Survey_questionTypes');
$get_question->finish;
$asset_data->{question_types} = \%question_types;
return $asset_data;
}

#-------------------------------------------------------------------

=head2 importAssetCollateralData ($data)
Extend the base method to include custom question types added to this Survey.
=cut

sub importAssetCollateralData {
my $self = shift;
my $data = shift;
$self->SUPER::importAssetCollateralData($data);
my $custom_types = $data->{question_types};
while (my ($question, $answer) = each %{ $custom_types }) {
$self->session->db->write("INSERT INTO Survey_questionTypes VALUES(?,?) ON DUPLICATE KEY UPDATE answers = ?",[$question,$answer,$answer]);
}
}

#-------------------------------------------------------------------

=head2 www_exportSimpleResults () =head2 www_exportSimpleResults ()
Exports transposed results as CSV (or tabbed depending on the C<format> form param) Exports transposed results as CSV (or tabbed depending on the C<format> form param)
Expand Down
2 changes: 1 addition & 1 deletion lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
Expand Up @@ -169,7 +169,7 @@ sub addType {
my $questionType = shift; my $questionType = shift;
my $address = shift; my $address = shift;
my $question = $self->question($address); my $question = $self->question($address);
my $ansString = $question->{answers} ? to_json $question->{answers} : {}; my $ansString = $question->{answers} ? to_json $question->{answers} : '{}';
$self->session->db->write("INSERT INTO Survey_questionTypes VALUES(?,?) ON DUPLICATE KEY UPDATE answers = ?",[$questionType,$ansString,$ansString]); $self->session->db->write("INSERT INTO Survey_questionTypes VALUES(?,?) ON DUPLICATE KEY UPDATE answers = ?",[$questionType,$ansString,$ansString]);
$question->{questionType} = $questionType; $question->{questionType} = $questionType;
} }
Expand Down
4 changes: 4 additions & 0 deletions lib/WebGUI/AssetExportHtml.pm
Expand Up @@ -157,6 +157,10 @@ This scratch variable is used by the Widget Macro.
Takes a hashref of arguments, containing the following keys: Takes a hashref of arguments, containing the following keys:
=head3 depth
How many levels deep to export.
=head3 quiet =head3 quiet
Boolean. To be or not to be quiet with our output. Defaults to false. Boolean. To be or not to be quiet with our output. Defaults to false.
Expand Down
13 changes: 8 additions & 5 deletions lib/WebGUI/Auth.pm
Expand Up @@ -1169,8 +1169,10 @@ sub www_displayLogin {
$vars->{title} = $i18n->get(66); $vars->{title} = $i18n->get(66);
my $action; my $action;
if ($self->session->setting->get("encryptLogin")) { if ($self->session->setting->get("encryptLogin")) {
$action = $self->session->url->page(undef,1); my $uri = URI->new($self->session->url->page(undef,1));
$action =~ s/http:/https:/; $uri->scheme('https');
$uri->host_port($uri->host);
$action = $uri->as_string;
} }
use WebGUI::Form::Password; use WebGUI::Form::Password;
use WebGUI::Form::Hidden; use WebGUI::Form::Hidden;
Expand Down Expand Up @@ -1241,9 +1243,10 @@ sub www_login {
$self->session->scratch->delete("redirectAfterLogin"); $self->session->scratch->delete("redirectAfterLogin");
} }
elsif ($self->session->setting->get('encryptLogin')) { elsif ($self->session->setting->get('encryptLogin')) {
my $currentUrl = $self->session->url->page(undef,1); my $currentUrl = URI->new($self->session->url->page(undef,1));
$currentUrl =~ s/^https:/http:/; $currentUrl->scheme('http');
$self->session->response->setRedirect($currentUrl); $currentUrl->port($self->session->config->get('webServerPort') || 80);
$self->session->response->setRedirect($currentUrl->canonical->as_string);
} }


# Get open version tag. This is needed if we want # Get open version tag. This is needed if we want
Expand Down
15 changes: 15 additions & 0 deletions lib/WebGUI/Fork.pm
Expand Up @@ -293,6 +293,7 @@ sub finish {
$props{latch} = 0; $props{latch} = 0;
} }
$props{endTime} = time(); $props{endTime} = time();
$props{redirect} = $self->{redirect};
$self->set( \%props ); $self->set( \%props );
} }


Expand Down Expand Up @@ -529,6 +530,20 @@ sub setGroup {


#----------------------------------------------------------------- #-----------------------------------------------------------------


=head2 setRedirect($url)
Allows a redirect to be set for the process after the initial fork. This happens
in the case when a file is to be downloaded after the fork finishes.
=cut

sub setRedirect {
my ( $self, $url ) = @_;
$self->{redirect} = $url;
}

#-----------------------------------------------------------------

=head2 request ($module, $subname, $data) =head2 request ($module, $subname, $data)
Internal method. Generates a hashref suitable for passing to runRequest. Internal method. Generates a hashref suitable for passing to runRequest.
Expand Down

0 comments on commit 3b418ed

Please sign in to comment.