Merge commit WebGUI_7.6.9-beta into yung-thingy-rfe

* commit 'tags/WebGUI_7.6.9-beta': (223 commits)
  Release 7.6.9-beta
  preparing for 7.6.9 release
  fixed: Exporting to static files can leak large amounts of memory
  fixed: HTTP Proxy doesn't serve new content to visitors
  use to_json and from_json in more places instead of encode_json and decode_json
  Document the heretofore missing date template variable in
  Qualify a chained method call when getting Workflow instances.  If the
  Attempt to fix IE6 bug
  fixed: ukplayer example is now loaded with swfobject.js released under the MIT licence, see gotcha's and /extras/ukplayer
  Added a style for printing Alumni pages
  Emails sent about low stock should have status unread, not completed.
  Moved draggable.js to extras/yui-webgui/build/layout since it is now a wrapper around YUI dragdrob
  Attributions in the changelog for a patch provided to fix a bug.
  whups, left in console.logs
  Updated draggable.js to wrap the YUI
  fixed #4137: Calendar Search page has extra head tags in body
  Fix a typo typo in the Operation/Workflow POD.
  Forward port Shelf view fix.  Was not displaying child shelves, only self.
  Forward port the PayDriver bug fixes from 7.5 branch.  Labels are always
  fixed #9264: new slideShow.swf uploaded in extras/ukplayer (United Knowledge/Arjan Widlak)
  ...

Conflicts:
	lib/WebGUI/Asset/Wobject/Thingy.pm
This commit is contained in:
Patrick Donelan 2009-01-22 05:01:02 +00:00
commit 7e4c6c70b2
696 changed files with 18003 additions and 3585 deletions

View file

@ -1,4 +1,94 @@
7.6.9
- fixed: ukplayer example is now loaded with swfobject.js released under the
MIT licence, see gotcha's and /extras/ukplayer
- fixed #9264: new slideShow.swf uploaded in extras/ukplayer (United Knowledge/Arjan Widlak)
- fixed #9428: added code to ASSET::get to include keywords when no property name is requested
- marked sbin scripts as executable
- fixed #9492: Problem in passing form variables to Macro SQL inside a snippet
- fixed #9404: Head tags for admin user with admin mode off
- fixed #9507: Navigation: relDepth is calculated with starting point, instead of the first displayed page
- fixed a bug where no Payment Gateway labels show up when checking out.
- fixed #9511: Subcategories displayed incorrectly (Henry Tang, Long Term Results B.v.)
- fixed #4137: Calendar Search page has head tags in body
- fixed: HTTP Proxy doesn't serve new content to visitors
- fixed: Exporting to static files can leak large amounts of memory
7.6.8
- added #!/usr/bin/env perl to all utility scripts
- Updated captcha images to be more legible.
- fixed #9285: modifing template prevents edit of syncontent
- fixed #8886: Search button in Asset manager
- fixed #9410: Wrong help text
- fixed #9154: WebGUI Shop - Checkout Caching Problem
- fixed a bug where clicking the apply button when func=add would return the
edit screen of the parent asset rather than that of the new asset. (Martin
Kamerbeek / Oqapi).
- fixed: Make sure that Form subclasses are found by WebGUI::Form::FieldType
- fixed #9356: Data Form Mail Fields
- fixed #9365: Account: when viewing another person's contribution, it displays my name
- fixed #9351: Cannot translate phrase
- fixed #9368: Gallery: All children included into navigation
- fixed #9349: CS archival broken after update (Bernd Kalbfuß-Zimmermann)
- fixed Display of Interval form control in Thingy and User profiling did not show units, only seconds.
- fixed #9374: Subscription Asset: Redeem subscription template not documented, or user selectable
- fixed #9366: Gallery: Missing i18n
- fixed #9367: Gallery: Errors in templates
- fixed #9352: Account activation message MIA
- fixed #9046: Wiki tabs all combined (David Delikat)
- refixed #9147: Misspellings in Account
- fixed #9348: Required Upgrade Step Not Documented - 7.6.0
- fixed #8993: Gallery Image Details Overlap Image
- fixed #9380: CoolMenus template - invalid markup affecting page layouts
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
- fixed #9001: Thingy add image broken
- fixed #9386: Gallery: "Image resolutions" issue
- fixed #9342: Thingy - Cannot edit a thing
- fixed #9033: Deleting Linked Thing Field Crashes Thingy
- fixed #9400: Form.captcha should be form_capcha in dataform help
- fixed #9402: i18n confusion
- fixed #9403: i18n survey
- fixed: Syndicated Content corrupts wide characters
7.6.7
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
- fixed: Alter WebGUI::Asset::Template's update method so that it can import packages that use the old, deprecated headBlock property. The update method change is deprecatd.
- fixed #9266: controls missing on product asset
- fixed #9150: Edit Data Table - Cannot add column (David Delikat)
- fixed #9261: Cart Payment Screen not templated
- fixed #4124: Site starter uses floats in ways that cause problems
- fixed #9274: AdminBar errors and fails when an asset class cannot be loaded
- fixed #9301: Error in Shelf Template
- fixed #9260: untitled (Delete icon "X" circumvents revision control)
- fixed: Deleting an LDAP connection does not take you back to the List LDAP connections screen.
- fixed #9284: User manager broken if no LDAP links exits
- fixed #4136: Shortcut doesn't display all properties in override
- fixed #8838: Gallery Cross Publish template is broken
- fixed #8898: versioning problem
- fixed #9315: Password Recovery
- fixed #9298: Inconsistent date formats
- fixed #9296: Thingy View template not recognising field_isVisible (SDH Consulting Group)
- fixed #4196: update button doesn't work in IE
7.6.6
- fixed #9217: Survey 2.0 - "Cancel" button not working as expected(David Delikat)
- fixed #8792: Image Preview gives ERROR in Collateral Manager
- fixed #8774: Forum Rich Edit no longer supports indent/outdent
- fixed #4173: fieldnames in profilefields can contain spaces
- fixed #8811: Bug Tracker: Formatting is bad for the resolution form.
- fixed #9235: Image Bug in rich text editor.
- fixed #9219: Thingy After Save Search This Thing not showing all rows (SDH Consulting Group)
- fixed #9231: Singleton workflows should not report an error when an attempt is made to run them again
- fixed #9244: i18n for colin
- fixed #9252: Thingy defaultValue length causes input to be truncated (SDH Consulting Group)
- fixed #8937: Feeds in Calendar strip information
- fixed #9063: Thingy - Time Field editing errors
- fixed #9237: Payment Gateways all display "cash"
- fixed #8816: PayDriver "Label" of the instance of the driver should be used instead of the generic name
- fixed #4220: testEnvironment.pl unable to find WebGUI modules...
- fixed #9279: "Read more" text in Syndicated Articles is not a label
7.6.5
- security: A problem was discovered and fixed in which users could email executable attachments to a collaboration system and then when viewed online, could execute them.
- fixed #8800: Errors in POD of Asset-related mix-in modules (Bernd Kalbfuß-Zimmermann)
- fixed: Products imported into the Shelf have bad URLs
- Deprecated WebGUI::Storage::Image. WebGUI::Storage can now do everything WebGUI::Storage::Image can do.
@ -14,6 +104,18 @@
- fixed #9112: Thingy View Thing screen doesn't preserve newlines
- fixed #9155: purpose of "headblock" duplicates "extra head tags"
- fixed: Improve Thingy navigation.
- fixed #9126: UserList is completely broken in 7.6.4 (Yung Han Khoe)
- fixed #9177: Wide-characters break product varients
- fixed #9191: Message Board reveals user email, ignores profile privacy setting (#9180)
- fixed #4209: i18n in Rich edit in Dutch breaks
- fixed #9196: Shelf lacks pagination
- fixed #4208: EMS badges with Admin security visible to all
- fixed Calendar copy behavior. In the Asset toolbar, Copy Just this Asset
was broken. This has been fixed. As a side effect, in the Asset Manager
the default behavior is to copy ONLY the Calendar, and none of the events.
- fixed: filtering of rich text areas very slow for large content
- fixed: international characters are corrupted on export
- removed: WSClient
7.6.4
- Survey now will show progress and time limit.
@ -81,24 +183,7 @@
- fixed #9140: Date format error when adding tasks to PM
- fixed #8800: Errors in POD of Asset-related mix-in modules (Bernd Kalbfuß-Zimmermann)
- fixed #9143: Yes No user profile fields problem when default == 1
7.5.34
- fixed: Regression with ProfileField->formField. Added tests to prevent future regression
- fixed #8849: More missing i18n
- fixed: Performance issue with Stow. Added a way to bypass safety for speed.
- fixed #4182: Edit links show in asset manager for locked assets
- fixed #8971: UserList shows accounts that have been self-deactivated (Bernd Kalbfuß-Zimmermann)
- fixed #4199: Default values of user profile fields are not filled in correctly when shown by the UserList asset (Bernd Kalbfuß-Zimmerman)
- fixed #9068: field.inTab
- fixed #8845: Workflows refusing to show edit screen
- fixed #4198: Namespace of Template "Newsletter (Manager)" set to "Collaboration
- fixed #9106: Calendar Feed Workflow Creating Version Tags w/o Updates
- fixed #8914: epoch for calendar/List View for Calendar
- fixed #8822: Password Recovery Tempalte not working
- fixed: DataForm times out when exporting large data sets
- fixed: DataForm entry data field is too small
>>>>>>> .merge-right.r8665
- fixed #8775: Miscount in number of replies in CS Thread (Martin Kamerbeek / Oqapi)
7.6.3
- improved performance of file uploads

File diff suppressed because one or more lines are too long

View file

@ -7,17 +7,40 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
7.6.9
--------------------------------------------------------------------
* The ukplayer example, slideshow.html in /extras/ukplayer, used
to be loaded with a javascript called AC_RunActiveContent.js.
This file is removed due to licencing issues. If you use this
script in custom HTML, you should replace it with swfobject.js
as is demonstrated in the new example slideshow.html file.
7.6.8
--------------------------------------------------------------------
* Due to an error during the 7.6.6 development cycle, an Itransact template,
for displaying the credentials screen, needs to be reimported. Any changes
that you have made to this module will be lost, so please make a back up
of this template.
7.6.5
--------------------------------------------------------------------
* The deprecated use of Graphics::Magick has been eliminated. WebGUI uses
Image::Magick exclusively for all image processing functions once again.
* The Head Block of Templates has been merged into the Extra Head
Tags field. Extra Head Tags are now added for all templates and
assets included on a page, except for Style templates, which do
not have Extra Head Tags. Existing Extra Head Tags for Style
templates have been removed.
* Web Services Client is no longer part of the official distribution of
WebGUI, but is still available to be maintained by third-parties. However,
if you don't want to use Web Services Client any longer, make sure you
delete all Web Services Clients from your site prior to the upgrade *and*
purge them from your trash. Then the upgrade will automatically uninstall
the Web Services Client from your site.
7.6.4
--------------------------------------------------------------------
* The user facing portions of WebGUI's profile, inbox, friends, and "invite

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------

View file

@ -1,3 +1,5 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------
@ -30,13 +32,63 @@ my $session = start(); # this line required
fixAccountMisspellings( $session );
removeTemplateHeadBlock( $session );
updateMatrixListingScores( $session );
removeSqlForm( $session );
# upgrade functions go here
finish($session); # this line required
#----------------------------------------------------------------------------
sub removeSqlForm {
my $session = shift;
print "\tOptionally removing Web Services Client...\n" unless $quiet;
my $db = $session->db;
unless ($db->quickScalar("select count(*) from asset where className='WebGUI::Asset::Wobject::WSClient'")) {
print "\t\tNot using it, so we're uninstalling it.\n" unless $quiet;
$session->config->delete("assets/WebGUI::Asset::Wobject::WSClient");
my @ids = $db->buildArray("select distinct assetId from template where namespace = 'WSClient'");
push @ids, qw(5YAbuwiVFUx-z8hcOAnsdQ);
foreach my $id (@ids) {
my $asset = WebGUI::Asset->newByDynamicClass($session, $id);
if (defined $asset) {
$asset->purge;
}
}
$db->write("drop table WSClient");
}
else {
print "\t\tThis site uses Web Services Client, so we won't uninstall it.\n" unless $quiet;
}
}
#----------------------------------------------------------------------------
# Describe what our function does
sub updateMatrixListingScores {
my $session = shift;
print "\tUpdating score for every MatrixListing asset... " unless $quiet;
my $matrixListings = WebGUI::Asset->getRoot($session)->getLineage(['descendants'],
{
statesToInclude => ['published','trash','clipboard','clipboard-limbo','trash-limbo'],
statusToInclude => ['pending','approved','deleted','archived'],
includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
returnObjects => 1,
});
for my $matrixListing (@{$matrixListings})
{
next unless defined $matrixListing;
my $score = $session->db->quickScalar("select sum(value) from MatrixListing_attribute
left join Matrix_attribute using(attributeId)
where matrixListingId = ? and fieldType = 'MatrixCompare'",
[$matrixListing->getId]);
$matrixListing->update({score => $score});
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub removeTemplateHeadBlock {
my $session = shift;
print "\tMerging Template head blocks into the Extra Head Tags field... " unless $quiet;

View file

@ -0,0 +1,145 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# 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
#-------------------------------------------------------------------
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.6';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addMatrixEditListingTemplate( $session );
lengthenThingyDefaultValues($session);
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;
#}
# Add editListingTemplate property to Matrix
sub addMatrixEditListingTemplate {
my $session = shift;
print "Add editListingTemplate property to Matrix\t... " unless $quiet;
$session->db->write("alter table Matrix add editListingTemplateId char(22)");
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub lengthenThingyDefaultValues {
my $session = shift;
print "\tMake sure that Thingy fields can have a default value size appropriate to their field type... " unless $quiet;
# and here's our code
$session->db->write('alter table Thingy_fields modify defaultValue longtext');
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-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
#-------------------------------------------------------------------
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.7';
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,195 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# 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
#-------------------------------------------------------------------
our ($webguiRoot);
BEGIN {
$webguiRoot = "../..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Asset::File::GalleryFile;
use WebGUI::Shop::Pay;
use WebGUI::Shop::PayDriver;
my $toVersion = '7.6.8';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
setDefaultItransactCredentialTemplate($session);
hideGalleryPhotos($session);
addSubscriptionRedeemTemplateSetting($session);
reFixAccountMisspellings($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub setDefaultItransactCredentialTemplate {
my $session = shift;
print "\tSet default ITransact Credentials template if it is not set... " unless $quiet;
# and here's our code
my $pay = WebGUI::Shop::Pay->new($session);
my $drivers = $pay->getPaymentGateways($session);
DRIVER: foreach my $driver (@{ $drivers }) {
##Only work on ITransact drivers
next DRIVER unless $driver->className eq "WebGUI::Shop::PayDriver::ITransact";
my $properties = $driver->get();
##And only ones that don't already have a template set
next DRIVER if $properties->{credentialsTemplateId};
$properties->{credentialsTemplateId} = 'itransact_credentials1';
$driver->update($properties);
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addSubscriptionRedeemTemplateSetting {
my $session = shift;
print "\tAdd a field to the Subscription Asset so the user can select which Redeem Subscription code template to use... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
alter table Subscription add column redeemSubscriptionCodeTemplateId char(22) NOT NULL default ''
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub hideGalleryPhotos {
my $session = shift;
print "\tSet the isHidden bit in all Photos so your navigations do not blow up... " unless $quiet;
# and here's our code
my $getAPhoto = WebGUI::Asset::File::GalleryFile->getIsa($session);
while (my $photo = $getAPhoto->()) {
$photo->update({isHidden => 1});
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
#Describe what our function does
sub reFixAccountMisspellings {
my $session = shift;
my $setting = $session->setting;
print "\tFix misspellings in Account settings... " unless $quiet;
# and here's our code
$setting->add("profileViewTemplateId", $setting->get('profileViewTempalteId') );
$setting->add("profileErrorTemplateId", $setting->get('profileErrorTempalteId') );
$setting->add("inboxLayoutTemplateId", $setting->get('inboxLayoutTempalteId') );
$setting->add("friendsLayoutTemplateId", $setting->get('friendsLayoutTempalteId'));
$setting->remove("profileViewTempalteId");
$setting->remove("profileErrorTempalteId");
$setting->remove("inboxLayoutTempalteId");
$setting->remove("friendsLayoutTempalteId");
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

@ -0,0 +1,149 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# 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
#-------------------------------------------------------------------
our ($webguiRoot);
BEGIN {
$webguiRoot = "../..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Shop::Pay;
use WebGUI::Shop::PayDriver;
my $toVersion = '7.6.9';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixPayDriverLabels($session);
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;
#}
#----------------------------------------------------------------------------
# Get rid of the duplicate label properties in the PayDrivers.
sub fixPayDriverLabels {
my $session = shift;
print "\tGet rid of the duplicate label properties in the PayDrivers... " unless $quiet;
my $pay = WebGUI::Shop::Pay->new($session);
my $gateways = $pay->getPaymentGateways;
foreach my $gateway (@{ $gateways }) {
my $gatewayId = $gateway->getId;
my $jsonLabel = $gateway->get('label');
next if $jsonLabel;
my $dbLabel = $session->db->quickScalar('select label from paymentGateway where paymentGatewayId=?', [$gatewayId]);
my $properties = $gateway->get();
$properties->{label} = $dbLabel;
$gateway->update($properties);
}
$session->db->write('alter table paymentGateway drop column label');
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

@ -502,9 +502,6 @@
"isContainer" : 1,
"category" : "community"
},
"WebGUI::Asset::Wobject::WSClient" : {
"category" : "utilities"
},
"WebGUI::Asset::Wobject::StockData" : {
"category" : "intranet"
},

View file

@ -1,5 +1,5 @@
# WebGUI uses the log4perl logging system. This default configuration file
# will work out of the box and will log only warnings and errors to
# will work out of the box and will log only ERROR and FATAL level messages to
# /var/log/webgui.log. This is only the beginning of what this logging
# system is capable of. To unleash the full power read the config file manual
# http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/Config.html

View file

@ -1,7 +1,7 @@
package WebGUI;
our $VERSION = '7.6.5';
our $VERSION = '7.6.9';
our $STATUS = "beta";

View file

@ -176,6 +176,7 @@ sub www_view {
'WebGUI::Asset::Post',
'WebGUI::Asset::Wobject::GalleryAlbum',
'WebGUI::Asset::Event',
'WebGUI::Asset::WikiPage',
'WebGUI::Asset::Post::Thread',
],
whereClause => "asset.createdBy = '$userId' or assetData.ownerUserId = '$userId'",
@ -195,8 +196,15 @@ sub www_view {
my @contribs = ();
foreach my $row ( @{$p->getPageData} ) {
my $assetId = $row->{assetId};
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
push(@contribs,$asset->get);
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
my $props = $asset->get;
if (ref $asset eq "WebGUI::Asset::Post") {
$asset = $asset->getThread;
$props = $asset->get;
$props->{className} = "WebGUI::Asset::Post";
}
push(@contribs,$props);
}
my $contribsCount = $p->getRowCount;
@ -216,6 +224,12 @@ sub www_view {
$self->appendCommonVars($var);
$p->appendTemplateVars($var);
#Overwrite these
my $user = WebGUI::User->new($session,$userId);
$var->{'user_full_name' } = $user->getWholeName;
$var->{'user_member_since' } = $user->dateCreated;
return $self->processTemplate($var,$self->getViewTemplateId);
}

View file

@ -173,6 +173,7 @@ sub www_managePurchases {
my $url = $session->url;
my $var = {};
$var->{transactions} = [];
# build list
foreach my $id (@{WebGUI::Shop::Transaction->getTransactionIdsForUser($session)}) {

View file

@ -184,6 +184,8 @@ sub assetExists {
Verifies that the user has the privileges necessary to add this type of asset. Return a boolean.
A class method.
=head3 session
The session variable.
@ -751,6 +753,8 @@ sub get {
return $self->{_properties}{$propertyName};
}
my %copyOfHashRef = %{$self->{_properties}};
my $keywords = WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset => $self});
if( $keywords ne '' ) { $copyOfHashRef{ keywords } = $keywords ; }
return \%copyOfHashRef;
}
@ -1329,7 +1333,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return undef unless $self->canEdit;
return undef unless $self->canEdit && $self->session->var->isAdminOn;
return $self->{_toolbar}
if (exists $self->{_toolbar});
my $userUiLevel = $self->session->user->profileField("uiLevel");
@ -1428,6 +1432,7 @@ sub getToolbar {
. $self->getUrl("op=assetManager") . '">' . $i18n->get("manage") . '</a></li>';
}
$output .= '</ul></div></div>' . $toolbar . '</div>';
$self->{_toolbar} = $output;
return $output;
}
@ -1984,9 +1989,8 @@ Executes what is necessary to make the view() method work with content chunking.
sub prepareView {
my $self = shift;
if ($self->session->var->isAdminOn) {
$self->{_toolbar} = $self->getToolbar;
}
##Make the toolbar now and stick it in the cache.
$self->getToolbar;
my $style = $self->session->style;
my @keywords = @{WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset=>$self, asArrayRef=>1})};
if (scalar @keywords) {
@ -1995,6 +1999,7 @@ sub prepareView {
content => join(',', @keywords),
});
}
$style->setRawHeadTags($self->getExtraHeadTags);
}
#-------------------------------------------------------------------
@ -2570,7 +2575,9 @@ NOTE: Don't try to override or overload this method. It won't work. What you are
sub www_editSave {
my $self = shift;
return $self->session->privilege->locked() unless $self->canEditIfLocked;
##If this is a new asset (www_add), the parent may be locked. We should still be able to add a new asset.
my $isNewAsset = $self->session->form->process("assetId") eq "new" ? 1 : 0;
return $self->session->privilege->locked() if (!$self->canEditIfLocked and !$isNewAsset);
return $self->session->privilege->insufficient() unless $self->canEdit;
if ($self->session->config("maximumAssets")) {
my ($count) = $self->session->db->quickArray("select count(*) from asset");
@ -2578,7 +2585,7 @@ sub www_editSave {
return $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
}
my $object;
if ($self->session->form->process("assetId") eq "new") {
if ($isNewAsset) {
$object = $self->addChild({className=>$self->session->form->process("class","className")});
return $self->www_view unless defined $object;
$object->{_parent} = $self;
@ -2623,7 +2630,12 @@ sub www_editSave {
# Handle "saveAndReturn" button
if ( $self->session->form->process( "saveAndReturn" ) ne "" ) {
return $self->www_edit;
if ($isNewAsset) {
return $object->www_edit;
}
else {
return $self->www_edit;
}
}
# Handle "proceed" form parameter

View file

@ -159,6 +159,36 @@ sub exportAssetData {
return $data;
}
#-------------------------------------------------------------------
sub exportWriteFile {
my $self = shift;
# we have no assurance whether the exportPath is valid or not, so check it.
WebGUI::Asset->exportCheckPath($self->session);
# if we're still here, everything is well with the export path. let's make
# sure that this user can view the asset that we want to export.
unless($self->canView) {
WebGUI::Error->throw(error => "user can't view asset at " . $self->getUrl . " to export it");
}
# if we're still here, everything is well with the export path. let's get
# our destination FS path and then make any required directories.
my $dest = $self->exportGetUrlAsPath;
my $parent = $dest->parent;
eval { File::Path::mkpath($parent->absolute->stringify) };
if($@) {
WebGUI::Error->throw(error => "could not make directory " . $parent->absolute->stringify);
}
if ( ! File::Copy::copy($self->getStorageLocation->getPath($self->get('filename')), $dest->stringify) ) {
WebGUI::Error->throw(error => "can't copy " . $self->getStorageLocation->getPath($self->get('filename'))
. ' to ' . $dest->absolute->stringify . ": $!");
}
}
#-------------------------------------------------------------------
@ -529,20 +559,6 @@ sub www_edit {
#-------------------------------------------------------------------
# setStreamedFile and setRedirect do not interact well with the
# exporter. We have a separate method for this now.
sub exportHtml_view {
my $self = shift;
my $path = $self->getStorageLocation->getPath($self->get('filename'));
open my $fh, '<:raw', $path or return "";
while ( read $fh, my $block, 16384 ) {
$self->session->output->print($block, 1);
}
close $fh;
return 'chunked';
}
#--------------------------------------------------------------------
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;

View file

@ -141,10 +141,11 @@ sub appendTemplateVarsCommentForm {
value => $comment->{ bodyText },
});
my $i18n = WebGUI::International->new($session, 'Asset_Photo');
$var->{ commentForm_submit }
= WebGUI::Form::submit( $session, {
name => "submit",
value => "Save Comment",
value => $i18n->get('form comment save comment'),
});
return $var;
@ -739,6 +740,21 @@ sub setComment {
);
}
####################################################################
=head2 update
Wrap update so that isHidden is always set to be a 1.
=cut
sub update {
my $self = shift;
my $properties = shift;
return $self->SUPER::update({%$properties, isHidden => 1});
}
#----------------------------------------------------------------------------
=head2 view ( )

View file

@ -19,9 +19,10 @@ use base 'WebGUI::Asset::File::GalleryFile';
use Carp qw( carp croak );
use Image::ExifTool qw( :Public );
use JSON qw/ encode_json decode_json /;
use JSON qw/ to_json from_json /;
use URI::Escape;
use Tie::IxHash;
use List::MoreUtils;
use WebGUI::DateTime;
use WebGUI::Friends;
@ -220,7 +221,7 @@ sub getExifData {
# Our processing and eliminating of bad / unparsable keys
# isn't perfect, so handle errors gracefully
my $exif = eval { decode_json( $self->get('exifData') ) };
my $exif = eval { from_json( $self->get('exifData') ) };
if ( $@ ) {
$self->session->errorHandler->warn(
"Could not parse JSON data for EXIF in Photo '" . $self->get('title')
@ -360,14 +361,19 @@ sub makeResolutions {
my $storage = $self->getStorageLocation;
$self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'});
for my $res ( @$resolutions ) {
my $filename = $self->get('filename');
RESOLUTION: for my $res ( @$resolutions ) {
# carp if resolution is bad
if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) {
carp "Geometry '$res' is invalid. Skipping.";
next;
next RESOLUTION;
}
##Only resize images if the image is too big!
my ($imageX, $imageY) = $storage->getSizeInPixels($filename);
my @resolutions = split /x/, $res;
next RESOLUTION if List::MoreUtils::any { $imageX < $_ && $imageY < $_ } @resolutions;
my $newFilename = $res . ".jpg";
$storage->copyFile( $self->get("filename"), $newFilename );
$storage->copyFile( $filename, $newFilename );
$storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) );
}
}
@ -455,7 +461,7 @@ sub updateExifDataFromFile {
}
$self->update({
exifData => encode_json( $info ),
exifData => to_json( $info ),
});
}

View file

@ -226,11 +226,78 @@ sub getEditForm {
my $session = $self->session;
my $db = $session->db;
my $matrixId = $self->getParent->getId;
my $tabform = $self->next::method();
my $i18n = WebGUI::International->new($session, 'Asset_MatrixListing');
my $func = $session->form->process("func");
my $form = WebGUI::HTMLForm->new($session);
if ($func eq "add" || ( $func eq "editSave" && $session->form->process("assetId") eq "new")) {
$form->hidden(
-name =>'assetId',
-value =>'new',
);
$form->hidden(
-name =>'class',
-value =>'WebGUI::Asset::MatrixListing',
);
}
$form->hidden(
-name =>'func',
-value =>'editSave',
);
$form->text(
-name =>'title',
-defaultValue =>'Untitled',
-label =>$i18n->get("product name label"),
-hoverHelp =>$i18n->get('product name description'),
-value =>$self->getValue('title'),
);
$form->image(
-name =>'screenshots',
-defaultValue =>undef,
-maxAttachments =>20,
-label =>$i18n->get("screenshots label"),
-hoverHelp =>$i18n->get("screenshots description"),,
-value =>$self->getValue('screenshots'),
);
$form->HTMLArea(
-name =>'description',
-defaultValue =>undef,
-label =>$i18n->get("description label"),
-hoverHelp =>$i18n->get("description description"),
-value =>$self->getValue('description'),
);
$form->text(
-name =>'version',
-defaultValue =>undef,
-label =>$i18n->get("version label"),
-hoverHelp =>$i18n->get("version description"),
-value =>$self->getValue('version'),
);
$form->text(
-name =>'manufacturerName',
-defaultValue =>undef,
-label =>$i18n->get("manufacturerName label"),
-hoverHelp =>$i18n->get("manufacturerName description"),
-value =>$self->getValue('manufacturerName'),
);
$form->url(
-name =>'manufacturerURL',
-defaultValue =>undef,
-label =>$i18n->get("manufacturerURL label"),
-hoverHelp =>$i18n->get("manufacturerURL description"),
-value =>$self->getValue('manufacturerURL'),
);
$form->url(
-name =>'productURL',
-defaultValue =>undef,
-label =>$i18n->get("productURL label"),
-hoverHelp =>$i18n->get("productURL description"),
-value =>$self->getValue('productURL'),
);
foreach my $category (keys %{$self->getParent->getCategories}) {
$tabform->getTab('properties')->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
$form->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
my $attributes;
if ($session->form->process('func') eq 'add'){
$attributes = $db->read("select * from Matrix_attribute where category = ? and assetId = ?",
@ -246,10 +313,13 @@ sub getEditForm {
$attribute->{label} = $attribute->{name};
$attribute->{subtext} = $attribute->{description};
$attribute->{name} = 'attribute_'.$attribute->{attributeId};
$tabform->getTab("properties")->dynamicField(%{$attribute});
$form->dynamicField(%{$attribute});
}
}
return $tabform;
$form->submit();
return $form;
}
#-------------------------------------------------------------------
@ -426,7 +496,7 @@ sub setRatings {
foreach my $category (keys %{$self->getParent->getCategories}) {
if ($ratings->{$category}) {
$db->write("insert into MatrixListing_rating
(userId, category, rating, timeStamp, listingId, ipAddress, matrixId) values (?,?,?,?,?,?,?)",
(userId, category, rating, timeStamp, listingId, ipAddress, assetId) values (?,?,?,?,?,?,?)",
[$session->user->userId,$category,$ratings->{$category},$session->datetime->time(),$self->getId,
$session->env->get("HTTP_X_FORWARDED_FOR"),$matrixId]);
}
@ -439,7 +509,7 @@ sub setRatings {
my $median = $db->quickScalar("select rating $sql limit $half,$half",[$self->getId,$category]);
$db->write("replace into MatrixListing_ratingSummary
(listingId, category, meanValue, medianValue, countValue, matrixId)
(listingId, category, meanValue, medianValue, countValue, assetId)
values (?,?,?,?,?,?)",[$self->getId,$category,$mean,$median,$count,$matrixId]);
}
return undef;
@ -449,6 +519,23 @@ sub setRatings {
=head2 view ( hasRated )
Updates the score of a MatrixListing.
=cut
sub updateScore {
my $self = shift;
my $score = $self->session->db->quickScalar("select sum(value) from MatrixListing_attribute
left join Matrix_attribute using(attributeId)
where matrixListingId = ? and fieldType = 'MatrixCompare'",[$self->getId]);
$self->update({score => $score});
return undef;
}
#-------------------------------------------------------------------
=head2 view ( hasRated )
method called by the container www_view method.
=head3 hasRated
@ -465,8 +552,9 @@ sub view {
my $self = shift;
my $hasRated = shift || $self->hasRated;
my $emailSent = shift;
my $db = $self->session->db;
my $i18n = WebGUI::International->new($self->session, "Asset_Matrix");
my $session = $self->session;
my $db = $session->db;
my $i18n = WebGUI::International->new($self->session, "Asset_MatrixListing");
my @categories = keys %{$self->getParent->getCategories};
# Increment views before getting template var hash so that the views tmpl_var has the incremented value.
@ -480,7 +568,7 @@ sub view {
$var->{comments} = $self->getFormattedComments();
$var->{productName} = $var->{title};
$var->{lastUpdated_epoch} = $self->get('lastUpdated');
$var->{lastUpdated_date} = $self->session->datetime->epochToHuman($self->get('lastUpdated'),"%z");
$var->{lastUpdated_date} = $session->datetime->epochToHuman($self->get('lastUpdated'),"%z");
$var->{manufacturerUrl_click} = $self->getUrl("func=click;manufacturer=1");
$var->{productUrl_click} = $self->getUrl("func=click");
@ -515,7 +603,7 @@ sub view {
foreach my $category (@categories) {
my $attributes;
my @attribute_loop;
my $categoryLoopName = $self->session->url->urlize($category)."_loop";
my $categoryLoopName = $session->url->urlize($category)."_loop";
$attributes = $db->read("select * from Matrix_attribute as a
left join MatrixListing_attribute as l on (a.attributeId = l.attributeId and l.matrixListingId = ?)
where category =? and a.assetId = ?",
@ -523,7 +611,7 @@ sub view {
while (my $attribute = $attributes->hashRef) {
$attribute->{label} = $attribute->{name};
if ($attribute->{fieldType} eq 'MatrixCompare'){
$attribute->{value} = WebGUI::Form::MatrixCompare->new($self->session,$attribute)->getValueAsHtml;
$attribute->{value} = WebGUI::Form::MatrixCompare->new($session,$attribute)->getValueAsHtml;
}
push(@attribute_loop,$attribute);
}
@ -537,7 +625,7 @@ sub view {
# Screenshots
if ($var->{screenshots}) {
my $file = WebGUI::Form::File->new($self->session,{ value=>$var->{screenshots} });
my $file = WebGUI::Form::File->new($session,{ value=>$var->{screenshots} });
my $storage = $file->getStorageLocation;
my @files;
@files = @{ $storage->getFiles } if (defined $storage);
@ -614,11 +702,11 @@ pluginspage="http://www.macromedia.com/go/getflashplayer" />
<th>".$i18n->get('median label')."</th>
<th>".$i18n->get('count label')."</th></tr>\n";
my $ratingForm = WebGUI::HTMLForm->new($self->session,
my $ratingForm = WebGUI::HTMLForm->new($session,
-extras =>'class="content"',
-tableExtras=>'class="content"'
);
$ratingForm = WebGUI::HTMLForm->new($self->session,
$ratingForm = WebGUI::HTMLForm->new($session,
-extras =>'class="ratingForm"',
-tableExtras=>'class="ratingForm"'
);
@ -647,9 +735,9 @@ pluginspage="http://www.macromedia.com/go/getflashplayer" />
$ratingForm->submit(
-extras =>'class="ratingForm"',
-value =>$i18n->get('rate submit label'),
-label =>'<a href="'.$self->getUrl("func=rate").'">'.$i18n->get('show ratings').'</a>'
-label =>'<a href="'.$self->getUrl("showRatings=1").'">'.$i18n->get('show ratings').'</a>'
);
if ($hasRated) {
if ($hasRated || $session->form->process('showRatings')) {
$var->{ratings} = $ratingsTable;
} else {
$var->{ratings} = $ratingForm->print;
@ -657,7 +745,7 @@ pluginspage="http://www.macromedia.com/go/getflashplayer" />
# Mail form
my $mailForm = WebGUI::HTMLForm->new($self->session,
my $mailForm = WebGUI::HTMLForm->new($session,
-extras =>'class="content"',
-tableExtras=>'class="content"'
);
@ -671,7 +759,7 @@ pluginspage="http://www.macromedia.com/go/getflashplayer" />
$mailForm->email(
-extras =>'class="content"',
-name =>"from",
-value =>$self->session->user->profileField("email"),
-value =>$session->user->profileField("email"),
-label =>$i18n->get('your email label'),
);
$mailForm->selectBox(
@ -759,7 +847,12 @@ sub www_edit {
my $i18n = WebGUI::International->new($self->session, "Asset_MatrixListing");
return $self->session->privilege->insufficient() unless $self->canEdit;
return $self->session->privilege->locked() unless $self->canEditIfLocked;
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('edit matrix listing title'));
my $var = $self->get;
my $matrix = $self->getParent;
$var->{form} = $self->getEditForm->print;
return $matrix->processStyle($self->processTemplate($var,$matrix->get("editListingTemplateId")));
}
#-------------------------------------------------------------------
@ -794,6 +887,7 @@ sub www_getAttributes {
$attribute->{label} = $attribute->{name};
$attribute->{attributeId} =~ s/-/_____/g;
if ($attribute->{fieldType} eq 'MatrixCompare'){
$attribute->{compareColor} = $self->getParent->getCompareColor($attribute->{value});
$attribute->{value} = WebGUI::Form::MatrixCompare->new($self->session,$attribute)->getValueAsHtml;
}
if($session->scratch->get('stickied_'.$attribute->{attributeId})){

View file

@ -33,7 +33,41 @@ use WebGUI::Utility;
use WebGUI::VersionTag;
our @ISA = qw(WebGUI::Asset);
#-------------------------------------------------------------------
=head2 _fixReplyCount ( asset )
Fixes the mismatch in number of replies and lastPost in a thread and/or a CS that occurs after a cut or paste
action.
Note: if invoked on a thread the CS containing it will very likely be changed as well, but likely in an incorrect
manner. Therfore, after running this method on a Thread you probably also want to run it on the container CS.
=head3 asset
The instanciated asset to fix. This may only be either a WebGUI::Asset::Post::Thread or a
WebGUI::Asset::Wobject::Collaboration.
=cut
sub _fixReplyCount {
my $self = shift;
my $asset = shift;
my $lastPost = $asset->getLineage( [ qw{ self descendants } ], {
returnObjects => 1,
isa => 'WebGUI::Asset::Post',
orderByClause => 'assetData.revisionDate desc',
limit => 1,
} )->[0];
if ($lastPost) {
$asset->incrementReplies( $lastPost->get( 'revisionDate' ), $lastPost->getId );
}
else {
$asset->incrementReplies( undef, undef );
}
}
#-------------------------------------------------------------------
@ -175,6 +209,29 @@ sub commit {
}
}
#-------------------------------------------------------------------
sub cut {
my $self = shift;
# Fetch the Thread and CS before cutting the asset.
my $thread = $self->getThread;
my $cs = $thread->getParent;
# Cut the asset
my $result = $self->SUPER::cut;
# If a post is being cut update the thread reply count first
if ($thread->getId ne $self->getId) {
$self->_fixReplyCount( $thread );
}
# Update the CS reply count. This step is also necessary when a Post is cut since the Thread's incrementReplies
# also calls the CS's incrementReplies, possibly with the wrong last post Id.
$self->_fixReplyCount( $cs );
return $result;
}
#-------------------------------------------------------------------
sub definition {
my $class = shift;
@ -764,7 +821,9 @@ sub notifySubscribers {
my $returnAddress = $setting->get("mailReturnPath");
my $companyAddress = $setting->get("companyEmail");
my $listAddress = $cs->get("mailAddress");
my $posterAddress = $user->profileField("email");
my $posterAddress = $user->getProfileFieldPrivacySetting('email') eq "all"
? $user->profileField('email')
: '';
my $from = $posterAddress || $listAddress || $companyAddress;
my $replyTo = $listAddress || $returnAddress || $companyAddress;
my $sender = $listAddress || $companyAddress || $posterAddress;
@ -818,6 +877,43 @@ sub notifySubscribers {
}
}
#-------------------------------------------------------------------
sub paste {
my $self = shift;
$self->SUPER::paste(@_);
# First, figure out what Thread we're under
my $thread = $self->getLineage( [ qw{ self ancestors } ], {
returnObjects => 1,
isa => 'WebGUI::Asset::Post::Thread',
} )->[0];
# If the pasted asset is not a thread we'll have to update the threadId of it and all posts below it.
if ( $self->get('threadId') ne $self->getId ) {
# Check if we're actually pasting under a thread.
if ($thread) {
# If so, get the threadId from the thread and fetch all posts that must be updated.
my $threadId = $thread->getId;
my $childPosts = $self->getLineage( [ qw{ self descendants } ], {
returnObjects => 1,
isa => 'WebGUI::Asset::Post',
} );
# Finally update all these Posts
foreach my $asset ( @{ $childPosts } ) {
$asset->update( { threadId => $threadId } );
}
}
else {
# We're putting Posts in a place they don't belong, so issue a warning.
$self->session->log->warn('Posts pasted under an asset that is not a Thread');
}
}
# Recount the replies under the thread.
$thread->sumReplies;
}
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
@ -859,6 +955,14 @@ sub postProcess {
my $self = shift;
my %data = ();
($data{synopsis}, $data{content}) = $self->getSynopsisAndContent($self->get("synopsis"), $self->get("content"));
my $spamStopWords = $self->session->config->get('spamStopWords');
if (ref $spamStopWords eq 'ARRAY') {
my $spamRegex = join('|',@{$spamStopWords});
if ($data{content} =~ m/$spamRegex/xmsi) {
$data{skipNotification} = 1;
$self->trash;
}
}
my $user = WebGUI::User->new($self->session, $self->get("ownerUserId"));
my $i18n = WebGUI::International->new($self->session, "Asset_Post");
if ($self->getThread->getParent->get("addEditStampToPosts")) {
@ -882,11 +986,12 @@ sub postProcess {
#-------------------------------------------------------------------
sub publish {
my $self = shift;
$self->SUPER::publish(@_);
$self->getThread->sumReplies;
}
#sub publish {
# my $self = shift;
# $self->SUPER::publish(@_);
#
# $self->getThread->sumReplies;
#}
#-------------------------------------------------------------------
@ -1331,7 +1436,7 @@ sub www_edit {
name=>"storageId",
value=>$self->get("storageId"),
maxAttachments=>$numberOfAttachments,
deleteFileUrl=>$self->getUrl("func=deleteFile;filename=")
##Removed deleteFileUrl, since it will go around the revision control system.
}) if ($numberOfAttachments);
$var{'contentType.form'} = WebGUI::Form::contentType($session, {

View file

@ -260,7 +260,7 @@ sub getAllCollateral {
my $json = $self->get($tableName);
my $table;
if ($json) {
$table = decode_json($json);
$table = from_json($json);
}
else {
$table = [];
@ -785,7 +785,7 @@ The name of the table to insert the data.
sub setAllCollateral {
my $self = shift;
my $tableName = shift;
my $json = encode_json($self->{_collateral}->{$tableName});
my $json = to_json($self->{_collateral}->{$tableName});
$self->update({ $tableName => $json });
return;
}

View file

@ -99,6 +99,14 @@ sub definition {
label => $i18n->get("template"),
hoverHelp => $i18n->get("template help"),
},
redeemSubscriptionCodeTemplateId => {
tab => "display",
fieldType => "template",
namespace => "Operation/RedeemSubscription",
defaultValue => 'PBtmpl0000000000000053',
label => $i18n->get("redeem subscription code template"),
hoverHelp => $i18n->get("redeem subscription code template help"),
},
thankYouMessage => {
tab => "properties",
defaultValue => $i18n->get("default thank you message"),
@ -980,7 +988,7 @@ sub www_redeemSubscriptionCode {
$f->submit;
$var->{ codeForm } = $f->print;
return $self->processStyle($self->processTemplate($var, 'PBtmpl0000000000000053'));
return $self->processStyle($self->processTemplate($var, $self->get('redeemSubscriptionCodeTemplateId')));
}
1;

View file

@ -194,23 +194,24 @@ sub purgeCache {
sub view {
my $self = shift;
my $calledAsWebMethod = shift;
my $versionTag = WebGUI::VersionTag->getWorking($self->session, 1);
my $session = $self->session;
my $versionTag = WebGUI::VersionTag->getWorking($session, 1);
my $noCache =
$self->session->var->isAdminOn
$session->var->isAdminOn
|| $self->get("cacheTimeout") <= 10
|| ($versionTag && $versionTag->getId eq $self->get("tagId"));
unless ($noCache) {
my $out = WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->get;
my $out = WebGUI::Cache->new($session,"view_".$calledAsWebMethod."_".$self->getId)->get;
return $out if $out;
}
my $output = $self->get("snippet");
WebGUI::Macro::process($self->session,\$output);
$output = $self->getToolbar.$output if ($self->session->var->isAdminOn && !$calledAsWebMethod);
$output = $self->getToolbar.$output if ($session->var->isAdminOn && !$calledAsWebMethod);
if ($self->getValue("processAsTemplate")) {
$output = WebGUI::Asset::Template->processRaw($self->session, $output, $self->get);
$output = WebGUI::Asset::Template->processRaw($session, $output, $self->get);
}
WebGUI::Macro::process($session,\$output);
unless ($noCache) {
WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout"));
WebGUI::Cache->new($session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout"));
}
return $output;
}

View file

@ -19,6 +19,7 @@ use base 'WebGUI::Asset';
use WebGUI::International;
use WebGUI::Asset::Template::HTMLTemplate;
use WebGUI::Utility;
use Clone qw/clone/;
=head1 NAME
@ -401,6 +402,30 @@ sub processRaw {
}
#-------------------------------------------------------------------
=head2 update
Override update from Asset.pm to handle backwards compatibility with the old
packages that contain headBlocks.
This method is deprecated and will be removed in the future. Don't plan
on this being here.
=cut
sub update {
my $self = shift;
my $requestedProperties = shift;
my $properties = clone($requestedProperties);
if (exists $properties->{headBlock}) {
$properties->{extraHeadTags} .= $properties->{headBlock};
delete $properties->{headBlock};
}
$self->SUPER::update($properties);
}
#-------------------------------------------------------------------
sub www_edit {
my $self = shift;

View file

@ -459,34 +459,6 @@ sub createSubscriptionGroup {
#----------------------------------------------------------------------------
=head2 duplicate ( )
Duplicates an Event Calendar. Duplicates all the events in this Event Calendar.
=cut
sub duplicate {
my $self = shift;
# Superclass duplicates the calendar
my $newCalendar = $self->SUPER::duplicate(@_);
# Duplicate the events in this calendar
my $events = $self->getLineage(["descendants"], {
returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::Event'],
});
for my $event (@{ $events }) {
my %eventProperties = %{ $event->get() };
$newCalendar->addChild(\%eventProperties);
}
return $newCalendar;
}
#----------------------------------------------------------------------------
=head2 getEditForm
Adds an additional tab for feeds.
@ -612,26 +584,31 @@ sub getEditForm {
</script>
ENDJS
$tab->raw(<<'ENDHTML');
<label for="addFeed">Add a feed</label>
my $addFeed = $i18n->get('Add a feed');
my $add = $i18n->get('Add');
my $feedUrl = $i18n->get('Feed URL');
my $status = $i18n->get('434', 'WebGUI');
my $lastUpdated = $i18n->get('454', 'WebGUI');
$tab->raw(<<"ENDHTML");
<label for="addFeed">$addFeed</label>
<input type="text" size="60" id="addFeed" name="addFeed" value="" />
<input type="button" value="Add" onclick="FeedsManager.addFeed('feeds','new',{ 'url' : this.form.addFeed.value }); this.form.addFeed.value=''" />
<input type="button" value="$add" onclick="FeedsManager.addFeed('feeds','new',{ 'url' : this.form.addFeed.value }); this.form.addFeed.value=''" />
<table id="feeds" style="width: 100%;">
<thead>
<th style="width: 30px;">&nbsp;</th>
<th style="width: 50%;">Feed URL</th>
<th>Status</th>
<th>Last Updated</th>
<th style="width: 50%;">$feedUrl</th>
<th>$status</th>
<th>$lastUpdated</th>
<th>&nbsp;</th>
</thead>
</table>
ENDHTML
# Add the existing feeds
my $feeds = $self->getFeeds();
$tab->raw('<script type="text/javascript">'."\n");
@ -640,8 +617,8 @@ ENDHTML
$tab->raw("FeedsManager.addFeed('feeds','".$feedId."',".JSON->new->encode( \%row ).");\n");
}
$tab->raw('</script>');
$tab->raw("</td></tr>");
return $form;
}
@ -1905,13 +1882,15 @@ sub www_ical {
# Summary (the title)
# Wrapped at 75 columns
$ical .= $self->wrapIcal("SUMMARY:".$event->get("title"))."\r\n";
# Description (the text)
# Wrapped at 75 columns
$ical .= $self->wrapIcal("DESCRIPTION:".$event->get("description"))."\r\n";
# Location (the text)
# Wrapped at 75 columns
$ical .= $self->wrapIcal("LOCATION:".$event->get("location"))."\r\n";
# X-WEBGUI lines
if ($event->get("groupIdView")) {
$ical .= "X-WEBGUI-GROUPIDVIEW:".$event->get("groupIdView")."\r\n";
@ -1921,11 +1900,11 @@ sub www_ical {
}
$ical .= "X-WEBGUI-URL:".$event->get("url")."\r\n";
$ical .= "X-WEBGUI-MENUTITLE:".$event->get("menuTitle")."\r\n";
$ical .= qq{END:VEVENT\r\n};
}
# ENDVEVENT
$ical .= qq{END:VCALENDAR\r\n};
@ -2085,14 +2064,9 @@ sub www_search {
});
# This is very bad! It should be $self->processStyle or whatnot.
$self->session->http->sendHeader;
my $template = WebGUI::Asset::Template->new($self->session,$self->get("templateIdSearch"));
my $style = $self->session->style->process($self->getSeparator,$self->get("styleTemplateId"));
my ($head, $foot) = split($self->getSeparator,$style);
$self->session->output->print($head, 1);
$self->session->output->print($self->processTemplate($var, undef, $template));
$self->session->output->print($foot, 1);
return "chunked";
return $self->processStyle(
$self->processTemplate( $var, $self->get('templateIdSearch') )
);
}
#----------------------------------------------------------------------------

View file

@ -1164,18 +1164,21 @@ sub www_editField {
#-------------------------------------------------------------------
sub www_editFieldSave {
my $self = shift;
return $self->session->privilege->insufficient
my $session = $self->session;
return $session->privilege->insufficient
unless $self->canEdit;
my $form = $self->session->form;
my $form = $session->form;
my $fieldName = $form->process('fieldName');
my $newName = $self->session->url->urlize($form->process('newName') || $form->process('label'));
my $newName = $session->url->urlize($form->process('newName') || $form->process('label'));
$newName =~ tr{-/}{};
# Make sure we don't rename special fields
my $isMailField = 0;
if ($fieldName) {
my $field = $self->getFieldConfig($fieldName);
if ($field->{isMailField}) {
$newName = $fieldName;
$isMailField = 1;
}
}
@ -1202,6 +1205,9 @@ sub www_editFieldSave {
vertical => $form->process("vertical", 'yesNo'),
extras => $form->process("extras"),
);
if ($isMailField) {
$field{isMailField} = 1;
}
my $newSelf = $self->addRevision;
if ($fieldName) {

View file

@ -824,7 +824,8 @@ sub www_getBadgesAsJson {
my ($db, $form) = $session->quick(qw(db form));
my %results = ();
$results{records} = [];
foreach my $badge (@{$self->getBadges}) {
BADGE: foreach my $badge (@{$self->getBadges}) {
next BADGE unless $badge->canView;
push(@{$results{records}}, {
title => $badge->getTitle,
description => $badge->get('description'),

View file

@ -346,7 +346,7 @@ sub DESTROY {
my $self = shift;
for my $key ( qw/ _nextAlbum _prevAlbum / ) {
my $asset = delete $self->{ $key };
$asset->DESTROY;
$asset->DESTROY if $asset;
}
}
@ -881,6 +881,8 @@ sub www_addArchive {
my $form = $self->session->form;
my $var = $self->getTemplateVars;
my $i18n = WebGUI::International->new($session);
$var->{ error } = $params->{ error };
$var->{ form_start }
@ -893,7 +895,7 @@ sub www_addArchive {
$var->{ form_submit }
= WebGUI::Form::submit( $session, {
name => "submit",
value => "Submit",
value => $i18n->get("submit",'WebGUI'),
});
$var->{ form_archive }

View file

@ -178,6 +178,12 @@ sub definition {
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
sub getContentLastModified {
return time;
}
#-------------------------------------------------------------------
sub getCookieJar {
my $self = shift;

Some files were not shown because too many files have changed in this diff Show more