Merge branch 'master' into survey

* master: (121 commits)
  Fix a POD typo.
  correct inbox message from user preface
  Fix a typo in the Default gallery view template
  Documentation bug in buildArrayRefOfHashRefs
  changed screenshots in Matrix Listing view to popup
  matrix privileging fixes
  Fix an i18n typo in the Post user defined variables.
  Remove debugging code.
  approval workflow fix
  matrix upgrade and privileging fixes
  fixed: Template parser cannot be set
  forward porting gallery bug fixes
  preparing for 7.7.0 dev
  parser should be a selectbox, not a selectlist.
  labeling survey as beta
  fixeding my borkes to the changelog
  fixed #9852: Users can accept private messages from Visitor, but Visitor cannot send messages
  preparing for 7.6.14 release
  fix AdSpace, Ad tests
  Restore the original properties for the profile category that was modified for test.
  ...

Conflicts:
	docs/gotcha.txt
	docs/upgrades/upgrade_7.6.10-7.6.11.pl
	lib/WebGUI/Asset/Wobject/Survey.pm
	lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
This commit is contained in:
Patrick Donelan 2009-03-11 15:26:07 +11:00
commit 7ec5cab126
713 changed files with 4994 additions and 3058 deletions

View file

@ -1,6 +1,57 @@
7.7.0
- fixed: Template parser cannot be set
- fixed #9836: Matrix: Group to Add Listings is missing
- fixed #9873: third-> first in post template help
- fixed #9892: Typo in "Default Gallery View Album" Template [TEMPLATE]
7.6.14
- fixed: IE6 shows Admin Bar over Asset Manager
- fixed #9808: Search i18n
- fixed #9818: deleteAttachedFiles bug (THE REVENGE)
- fixed #9809: Pagination list up to 10/20: not working correctly on last pages.
- fixed #9820: Survey: political party spelled wrong
- fixed #9819: Survey: hoverhelp showing instead of field name
- fixed #9822: Matrix: Wrong field label
- fixed #9823: Matrix: no cancel button in add/edit listing
7.6.13
- fixed AdSpace bug: impressions and clicks for most non-human web clients will not be counted.
- fixed #9760: DataForm not working in demo.plainblack.com
- fixed #9759: Delete Entry Button missing in Data Form
- fixed #9767: FileAsset breaks 'null' rule for FileAsset table
- fixed defaultValues of undef cause mysql5.1 to complain about columns that are set to be NOT NULL. 5.0 doesn't care.
- International text retrieval has been optimized
- fixed #9766: Thingy Pagination Broken
- fixed #9779: Gallery: js for search (datepicker?) included in album view
- fixed #9783: payment methods are not added
- fixed #9785: Delete All button not working in Account/Inbox [TEMPLATE]
- fixed #9803: Survey 2.0- Gradebook spelled wrong
- fixed #9801: Survey 2.0- Template spelled wrong
- fixed #9802: Survey Template field names to be consistent
- fixed: HTMLForm generated forms have an extra double quote in the table tag.
7.6.12
- fixed: During postback on a recurring transaction, the routine could error out instead of catching an error.
- fixed: Do not show the Edit entry in the More menu in the asset manager if the asset is locked.
- fixed #9677: no output from form helper template variable sticky.form and stick.label
- fixed #9738: Gallery Title [TEMPLATE]
- fixed #9739: Gallery Delete Album Template [TEMPLATE]
- fixed #9737: Upgrade Missed a Config Option
- fixed #9169: E-mail to Collab System creates invalid asset
- fixed #9746: Shop: Add a new address unneeded extra click
- fixed #9747: Account Contributions: URLs are wrong.
- fixed #9749: Account Manager: AIM link
- fixed #9751: Account Manager: problem sorting in Contributions
- fixed #9750: Account Manager: Inbox Messages per Page [TEMPLATE]
- fixed: If the Get Credentials template is deleted for the ITransact PayDriver, it now gives you an error message instead of throwing an error.
- fixed: Collaboration groupToEditPost should not be blank
- fixed: WebGUI::User->isInGroup had bad default groupId
- fixed: Fix a layout problem in the Contributions, similar to the Inbox[TEMPLATE]
7.6.11
- Added a switch to allow the use of non-WebGUI objects with the Workflow
engine.
- fixed: Asset Manager can generate URLs that are too long
- fixed #9629: override stringify date format to use java default format.
- Added a switch to allow the use of non-WebGUI objects with the Workflow engine.
- fixed #9579: initialize keyword field because get fills it in now due to a recent code change
- fixed #9596: caching now takes into account the correct parameter for pagination
- fixed #9596: Articles now use a semi-unique pagination variable based on asset id

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,8 @@ save you many hours of grief.
7.6.11
--------------------------------------------------------------------
* WebGUI now requires Params::Validate version 0.81 or greater.
* If upgrading from WebGUI 7.5, you should upgrade to 7.5.40 first,
then you can upgrade to WebGUI 7.6.11 and beyond.
7.6.10
--------------------------------------------------------------------
@ -74,12 +75,10 @@ save you many hours of grief.
* WebGUI now requires XML::FeedPP version 0.36 or greater.
* The Syndicated Content asset has been heavily modified. Your templates
and settings should automatically migrate, but in less than 1% of cases
there will be problems that the migration cannot handle. Check your
Syndicated Content assets after upgrade to ensure they are still
working as expected.
* You must upgrade to 7.6.2 before you can upgrade to 7.6.3.
and settings should automatically migrate, but in less than 1% of cases
there will be problems that the migration cannot handle. Check your
Syndicated Content assets after upgrade to ensure they are still
working as expected.
7.6.1
--------------------------------------------------------------------

View file

@ -2,7 +2,7 @@
# WebGUI Legal Information #
####################################################################
WebGUI is Copyright 2001-2008 Plain Black Corporation. All rights
WebGUI is Copyright 2001-2009 Plain Black Corporation. All rights
reserved.
WebGUI Content Engine, WebGUI Runtime Environment, and Plain Black
@ -27,7 +27,7 @@ each file, or this file, or the license file. The notice at the top
of each file looks like the following:
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

Binary file not shown.

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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
@ -254,7 +254,7 @@ sub upgradeMatrix {
my $session = shift;
print "\tUpgrading matrix assets... \n" unless $quiet;
my $db = $session->db;
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
drop column visitorCacheTimeout");
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
@ -295,7 +295,8 @@ sub upgradeMatrix {
$db->write("alter table Matrix_rating rename MatrixListing_rating");
$db->write("alter table Matrix_ratingSummary rename MatrixListing_ratingSummary");
$db->write("alter table Matrix_field rename Matrix_attribute");
$db->write("alter table Matrix_attribute drop column label");
$db->write("alter table Matrix_attribute drop column name");
$db->write("alter table Matrix_attribute change label name char(255)");
$db->write("alter table Matrix_attribute add column options text");
$db->write("alter table Matrix_attribute change fieldType fieldType char(255) not null default 'MatrixCompare'");
$db->write("alter table Matrix_attribute change fieldId attributeId char(22) not null");
@ -336,6 +337,7 @@ sub upgradeMatrix {
$listing->{title} = $listing->{productName};
$listing->{version} = $listing->{versionNumber};
$listing->{screenshots} = $listing->{storageId};
$listing->{ownerUserId} = $listing->{maintainerId};
$listing->{productURL} = $listing->{productUrl};
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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
@ -35,8 +35,7 @@ removeBrokenWorkflowInstances($session);
undotBinaryExtensions($session);
removeProcessRecurringPaymentsFromConfig($session);
noSessionSwitch($session);
surveyDoAfterTimeLimit($session);
surveyRemoveResponseTemplate($session);
addReCaptchaSettings($session);
fixDottedAssetIds($session); ##This one should run last
finish($session); # this line required
@ -61,6 +60,27 @@ sub removeProcessRecurringPaymentsFromConfig {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addReCaptchaSettings {
my $session = shift;
print "\tAdding settings for reCAPTCHA..." unless $quiet;
my $currentSetting;
$currentSetting = $session->setting->get('useRecaptcha');
$session->setting->remove('useRecaptcha');
$session->setting->add('useRecaptcha', $currentSetting);
$currentSetting = $session->setting->get('recaptchaPublicKey');
$session->setting->remove('recaptchaPublicKey');
$session->setting->add('recaptchaPublicKey', $currentSetting);
$currentSetting = $session->setting->get('recaptchaPrivateKey');
$session->setting->remove('recaptchaPrivateKey');
$session->setting->add('recaptchaPrivateKey', $currentSetting);
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub hideGalleryAlbums {
my $session = shift;
@ -84,26 +104,6 @@ sub undotBinaryExtensions {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub surveyDoAfterTimeLimit {
my $session = shift;
print "\tAdding column doAfterTimeLimit to Survey table... " unless $quiet;
$session->db->write('alter table Survey add doAfterTimeLimit char(22)');
print "DONE!\n" unless $quiet;
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub surveyRemoveResponseTemplate {
my $session = shift;
print "\tRemoving responseTemplate... " unless $quiet;
$session->db->write('alter table Survey drop responseTemplateId');
if (my $template = WebGUI::Asset->new($session, 'PBtmpl0000000000000064')) {
$template->purge();
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub fixDottedAssetIds {
my $session = shift;

View file

@ -0,0 +1,185 @@
#!/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;
use WebGUI::Utility qw/isIn/;
my $toVersion = '7.6.12';
my $quiet; # this line required
my $session = start(); # this line required
addAssetDiscoveryServiceAgain( $session );
changeMatrixAttributeIndexing( $session );
fixCollaborationGroupToEditPost( $session );
convertLongVarcharsToText( $session );
# upgrade functions go here
finish($session); # this line required
#----------------------------------------------------------------------------
# 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;
#}
#----------------------------------------------------------------------------
sub convertLongVarcharsToText {
my $session = shift;
print "\tConverting Survey VARCHAR fields to TEXT... " unless $quiet;
$session->db->write("ALTER TABLE Survey MODIFY COLUMN exitURL TEXT");
$session->db->write("ALTER TABLE Survey_tempReport MODIFY COLUMN sectionName TEXT");
$session->db->write("ALTER TABLE Survey_tempReport MODIFY COLUMN questionName TEXT");
# and here's our code
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addAssetDiscoveryServiceAgain {
my $session = shift;
print "\tAdding asset discovery service..." unless $quiet;
my @handlers = @{ $session->config->get('contentHandlers') };
if (isIn( 'WebGUI::Content::AssetDiscovery', @handlers) ) {
print "Done.\n" unless $quiet;
return;
}
my @newHandlers = ();
foreach my $handler (@handlers) {
if ($handler eq 'WebGUI::Content::Operation') {
push @newHandlers, 'WebGUI::Content::AssetDiscovery';
}
push @newHandlers, $handler;
}
$session->config->set('contentHandlers', \@newHandlers);
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub changeMatrixAttributeIndexing {
my $session = shift;
print "\tChanging Matrix attribute indexing..." unless $quiet;
$session->db->write("alter table MatrixListing_attribute drop primary key, add primary key(attributeId,matrixListingId)");
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Fix the groupToEditPost in the Collaboration (should not be "")
sub fixCollaborationGroupToEditPost {
my $session = shift;
print "\tFixing group to edit post in Collaboration..." unless $quiet;
# and here's our code
$session->db->write(<<'SQL');
UPDATE Collaboration
SET groupToEditPost= (
SELECT groupIdEdit FROM assetData
WHERE assetData.assetId=Collaboration.assetId
AND assetData.revisionDate = Collaboration.revisionDate
)
WHERE groupToEditPost = "";
SQL
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;
# 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 = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
# Make the package not a package anymore
$package->update({ isPackage => 0 });
# Set the default flag for templates added
my $assetIds
= $package->getLineage( ['self','descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
$asset->update( { isDefault => 1 } );
}
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',".$session->datetime->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

View file

@ -0,0 +1,125 @@
#!/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.6.13';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
finish($session); # this line required
#----------------------------------------------------------------------------
# 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;
# 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 = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
# Make the package not a package anymore
$package->update({ isPackage => 0 });
# Set the default flag for templates added
my $assetIds
= $package->getLineage( ['self','descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
$asset->update( { isDefault => 1 } );
}
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',".$session->datetime->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

View file

@ -0,0 +1,125 @@
#!/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.6.14';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
finish($session); # this line required
#----------------------------------------------------------------------------
# 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;
# 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 = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
# Make the package not a package anymore
$package->update({ isPackage => 0 });
# Set the default flag for templates added
my $assetIds
= $package->getLineage( ['self','descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
$asset->update( { isDefault => 1 } );
}
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',".$session->datetime->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

View file

@ -0,0 +1,151 @@
#!/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.7.0';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addGroupToAddToMatrix( $session );
addScreenshotTemplatesToMatrix( $session );
finish($session); # this line required
#----------------------------------------------------------------------------
sub addGroupToAddToMatrix {
my $session = shift;
print "\tAdding groupToAdd to Matrix table, if needed... \n" unless $quiet;
my $sth = $session->db->read('describe Matrix groupToAdd');
if (! defined $sth->hashRef) {
$session->db->write("alter table Matrix add column groupToAdd char(22) default 2");
}
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addScreenshotTemplatesToMatrix {
my $session = shift;
print "\tAdding screenshot templates to Matrix table \n" unless $quiet;
$session->db->write("alter table Matrix add screenshotsConfigTemplateId char(22);");
$session->db->write("update Matrix set screenshotsConfigTemplateId = 'matrixtmpl000000000007';");
$session->db->write("alter table Matrix add screenshotsTemplateId char(22);");
$session->db->write("update Matrix set screenshotsTemplateId = 'matrixtmpl000000000006';");
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;
# 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 = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
# Make the package not a package anymore
$package->update({ isPackage => 0 });
# Set the default flag for templates added
my $assetIds
= $package->getLineage( ['self','descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
$asset->update( { isDefault => 1 } );
}
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',".$session->datetime->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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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
@ -61,7 +61,7 @@ sub upgradeMatrix {
my $session = shift;
print "\tUpgrading matrix assets... \n" unless $quiet;
my $db = $session->db;
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
drop column visitorCacheTimeout");
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
@ -102,7 +102,8 @@ sub upgradeMatrix {
$db->write("alter table Matrix_rating rename MatrixListing_rating");
$db->write("alter table Matrix_ratingSummary rename MatrixListing_ratingSummary");
$db->write("alter table Matrix_field rename Matrix_attribute");
$db->write("alter table Matrix_attribute drop column label");
$db->write("alter table Matrix_attribute drop column name");
$db->write("alter table Matrix_attribute change label name char(255)");
$db->write("alter table Matrix_attribute add column options text");
$db->write("alter table Matrix_attribute change fieldType fieldType char(255) not null default 'MatrixCompare'");
$db->write("alter table Matrix_attribute change fieldId attributeId char(22) not null");
@ -143,6 +144,7 @@ sub upgradeMatrix {
$listing->{title} = $listing->{productName};
$listing->{version} = $listing->{versionNumber};
$listing->{screenshots} = $listing->{storageId};
$listing->{ownerUserId} = $listing->{maintainerId};
$listing->{productURL} = $listing->{productUrl};
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# 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