Merge commit WebGUI_7.6.9-beta into survey-rfe

* commit 'tags/WebGUI_7.6.9-beta': (31 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/Survey.pm
This commit is contained in:
Patrick Donelan 2009-01-22 04:39:43 +00:00
commit 1376c8ae92
60 changed files with 999 additions and 1199 deletions

View file

@ -196,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;

View file

@ -753,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;
}
@ -1331,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");
@ -1430,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;
}
@ -1986,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) {

View file

@ -19,7 +19,7 @@ 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;
@ -221,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')
@ -461,7 +461,7 @@ sub updateExifDataFromFile {
}
$self->update({
exifData => encode_json( $info ),
exifData => to_json( $info ),
});
}

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

@ -2064,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

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

View file

@ -234,7 +234,11 @@ sub prepareView {
if ($vars{showAdmin}) {
# under normal circumstances we don't put HTML stuff in our code, but this will make it much easier
# for end users to work with our templates
$session->style->setScript($session->url->extras("draggable.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/yahoo-dom-event/yahoo-dom-event.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/animation/animation-min.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/dragdrop/dragdrop.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui-webgui/build/layout/draggable.js"),{ type=>"text/javascript" });
$session->style->setLink($session->url->extras("draggable.css"),{ type=>"text/css", rel=>"stylesheet", media=>"all" });
$session->style->setRawHeadTags('
<style type="text/css">

View file

@ -439,7 +439,7 @@ sub view {
# build nav variables
$pageData->{"page.rank"} = $asset->getRank;
$pageData->{"page.absDepth"} = $asset->getLineageLength;
$pageData->{"page.relDepth"} = $asset->getLineageLength - $start->getLineageLength;
$pageData->{"page.relDepth"} = $asset->getLineageLength - $absoluteDepthOfFirstPage;
$pageData->{"page.isSystem"} = $asset->get("isSystem");
$pageData->{"page.isHidden"} = $asset->get("isHidden");
$pageData->{"page.isViewable"} = $asset->canView;

View file

@ -192,7 +192,7 @@ sub freezeGraphConfig {
my $self = shift;
my $obj = shift;
return JSON::encode_json($obj);
return JSON::to_json($obj);
}
@ -404,7 +404,7 @@ sub thawGraphConfig {
my $string = shift;
return unless $string;
return JSON::decode_json($string);
return JSON::from_json($string);
}
#-------------------------------------------------------------------

View file

@ -277,7 +277,8 @@ sub view {
my @childShelves = ();
foreach my $child (@{$self->getLineage(['children'],{returnObjects=>1,includeOnlyClasses=>['WebGUI::Asset::Wobject::Shelf']})}) {
my $properties = $child->get;
$child->{url} = $self->getUrl;
$child->{url} = $child->getUrl;
$child->{title} = $child->getTitle;
push @childShelves, $child;
}

View file

@ -299,6 +299,8 @@ sub exportAsHtml {
my $message = sprintf( $i18n->get('bad user privileges') . "\n") . $asset->getUrl;
$self->session->output->print($message);
}
$exportSession->var->end;
$exportSession->close;
next;
}
@ -307,12 +309,16 @@ sub exportAsHtml {
if( !$quiet ) {
$self->session->output->print("$fullPath skipped, not exportable<br />");
}
$exportSession->var->end;
$exportSession->close;
next;
}
# tell the user which asset we're exporting.
unless ($quiet) {
my $message = sprintf $i18n->get('exporting page'), $fullPath;
$exportSession->var->end;
$exportSession->close;
$self->session->output->print($message);
}
@ -322,6 +328,8 @@ sub exportAsHtml {
$returnCode = 0;
$message = $@;
$self->session->output->print("could not export asset with URL " . $asset->getUrl . ": $@");
$exportSession->var->end;
$exportSession->close;
return ($returnCode, $message);
}
@ -332,6 +340,8 @@ sub exportAsHtml {
$returnCode = 0;
$message = $@;
$self->session->output->print("failed to export asset collateral for URL " . $asset->getUrl . ": $@");
$exportSession->var->end;
$exportSession->close;
return ($returnCode, $message);
}

View file

@ -2,7 +2,7 @@ package WebGUI::Content::AssetManager;
use strict;
use JSON qw( decode_json encode_json );
use JSON qw( from_json to_json );
use URI;
use WebGUI::Form;
use WebGUI::Paginator;
@ -221,7 +221,7 @@ sub getMoreMenu {
};
}
return encode_json \@more_fields;
return to_json \@more_fields;
}
#----------------------------------------------------------------------------
@ -309,7 +309,7 @@ sub www_ajaxGetManagerPage {
$session->http->setMimeType( 'application/json' );
return encode_json( $assetInfo );
return to_json( $assetInfo );
}
#----------------------------------------------------------------------------

View file

@ -454,7 +454,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
description => $i18n->get("We welcome your feedback."),
acknowledgement => $i18n->get("Thanks for for your interest in ^c;. We will review your message shortly."),
mailData => 1,
fieldConfiguration => JSON::encode_json(\@fieldConfig),
fieldConfiguration => JSON::to_json(\@fieldConfig),
});
}

View file

@ -35,6 +35,7 @@ our $HELP = {
'variables' => [
{ 'name' => 'title' },
{ 'name' => 'link' },
{ 'name' => 'date' },
{ 'name' => 'category' },
{ 'name' => 'author' },
{ 'name' => 'guid' },

View file

@ -137,7 +137,8 @@ sub generateCloud {
=head2 getKeywordsForAsset ( { asset => $asset } )
Returns a string of keywords separated by spaces.
Returns a string of keywords separated by spaces. If the keyword has spaces in it, it
will be quoted.
=head3 asset

View file

@ -69,7 +69,7 @@ sub www_spectreGetSiteData {
my $cookieName = $session->config->getCookieName;
my @instances = ();
foreach my $instance (@{WebGUI::Workflow::Instance->getAllInstances($session)}) {
next unless $instance->getWorkflow->get("enabled");
next unless $instance->getWorkflow && $instance->getWorkflow->get("enabled");
push(@instances, {
instanceId => $instance->getId,
priority => $instance->get("priority"),

View file

@ -202,7 +202,7 @@ sub www_demoteWorkflowActivity {
=head2 www_editWorkflow ( session, workflow )
Displays displays the editable properties of a workflow.
Displays the editable properties of a workflow.
=cut

View file

@ -42,10 +42,6 @@ back up to the top.
The class of the new PayDriver object to create.
=head4 $label
The label for this instance.
=head4 $options
A list of properties to assign to this PayDriver. See C<definition> for details.
@ -55,17 +51,14 @@ A list of properties to assign to this PayDriver. See C<definition> for details
sub addPaymentGateway {
my $self = shift;
my $requestedClass = shift;
my $label = shift;
my $options = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a class to create an object})
unless defined $requestedClass;
WebGUI::Error::InvalidParam->throw(error => q{The requested class is not enabled in your WebGUI configuration file}, param => $requestedClass)
unless isIn($requestedClass, (keys %{$self->getDrivers}) );
WebGUI::Error::InvalidParam->throw(error => q{Must provide a label to create an object})
unless $label;
WebGUI::Error::InvalidParam->throw(error => q{You must pass a hashref of options to create a new PayDriver object})
unless defined($options) and ref $options eq 'HASH' and scalar keys %{ $options };
my $driver = eval { WebGUI::Pluggable::instanciate($requestedClass, 'create', [ $self->session, $label, $options ]) };
my $driver = eval { WebGUI::Pluggable::instanciate($requestedClass, 'create', [ $self->session, $options ]) };
return $driver;
}

View file

@ -38,7 +38,6 @@ readonly session => my %session;
readonly className => my %className;
readonly paymentGatewayId => my %paymentGatewayId;
readonly options => my %options;
readonly label => my %label;
#-------------------------------------------------------------------
@ -49,7 +48,7 @@ Private method used to build objects, shared by new and create.
=cut
sub _buildObj {
my ($class, $session, $requestedClass, $paymentGatewayId, $label, $options) = @_;
my ($class, $session, $requestedClass, $paymentGatewayId, $options) = @_;
my $self = {};
bless $self, $requestedClass;
register $self;
@ -57,10 +56,9 @@ sub _buildObj {
my $id = id $self;
$session{ $id } = $session;
$paymentGatewayId{ $id } = $paymentGatewayId;
$label{ $id } = $label;
$options{ $id } = $options;
$className{ $id } = $requestedClass;
$paymentGatewayId{ $id } = $paymentGatewayId;
return $self;
}
@ -137,7 +135,7 @@ to do calculations.
#-------------------------------------------------------------------
=head2 create ( $session, $label, $options )
=head2 create ( $session, $options )
Constructor for new WebGUI::Shop::PayDriver objects. Returns a WebGUI::Shop::PayDriver object.
To access driver objects that have already been configured, use C<new>.
@ -146,10 +144,6 @@ To access driver objects that have already been configured, use C<new>.
A WebGUI::Session object.
=head4 $label
A human readable label for this payment.
=head4 $options
A list of properties to assign to this PayDriver. See C<definition> for details.
@ -161,23 +155,21 @@ sub create {
my $session = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a session variable})
unless ref $session eq 'WebGUI::Session';
my $label = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a human readable label in the hashref of options})
unless $label;
my $options = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a hashref of options})
unless ref $options eq 'HASH' and scalar keys %{ $options };
WebGUI::Error::InvalidParam->throw(error => q{Must provide a human readable label in the hashref of options})
unless exists $options->{label} && $options->{label};
# Generate a unique id for this payment
my $paymentGatewayId = $session->id->generate;
# Build object
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $label, $options);
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $options);
# and persist this instance in the db
$session->db->write('insert into paymentGateway (paymentGatewayId, label, className) VALUES (?,?,?)', [
$session->db->write('insert into paymentGateway (paymentGatewayId, className) VALUES (?,?)', [
$paymentGatewayId,
$label,
$class,
]);
@ -550,7 +542,7 @@ sub new {
my $options = from_json($properties->{options});
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $properties->{ label }, $options);
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $options);
return $self;
}
@ -600,7 +592,7 @@ sub processPropertiesFromFormPost {
);
}
}
$properties{title} = $fullDefinition->[0]{name} if ($properties{title} eq "" || lc($properties{title}) eq "untitled");
$properties{label} = $fullDefinition->[0]{name} if ($properties{label} eq "" || lc($properties{label}) eq "untitled");
$self->update(\%properties);
}

View file

@ -158,7 +158,7 @@ sub get {
$opts = {};
}
else {
$opts = decode_json($opts);
$opts = JSON::from_json($opts);
}
if (defined $param) {
return $opts->{$param};
@ -303,7 +303,7 @@ sub update {
my $options = shift || {};
WebGUI::Error::InvalidParam->throw(error => 'update was not sent a hashref of options to store in the database')
unless ref $options eq 'HASH' and scalar keys %{ $options };
my $jsonOptions = encode_json($options);
my $jsonOptions = JSON::to_json($options);
$options{id $self} = $jsonOptions;
$self->session->db->write('update shipper set options=? where shipperId=?', [$jsonOptions, $self->getId]);
return undef;

View file

@ -128,7 +128,7 @@ sub execute {
if ($belowThreshold) {
my $inbox = WebGUI::Inbox->new($self->session);
$inbox->addMessage({
status => 'completed',
status => 'unread',
subject => $self->get('subject'),
groupId => $self->get('toGroup'),
message => $message,

View file

@ -725,8 +725,8 @@ our $I18N = {
},
'imageDensity description' => {
message => q{The density of the image. Print-quality images are more than three times the size of web-quality images.},
lastUpdated => 0,
message => q{The density of the image. Print-quality images are more than three times the resolution of web-quality images.},
lastUpdated => 1231764657,
context => q{Description of asset property},
},

View file

@ -331,8 +331,8 @@ it would be best to make sure the names are the same.|,
},
'CATEGORY_NAME_loop' => {
message => q|A loop containting attributes and values for those attributes is created for each category in this matrix. The name of the loop is the category name with spaces replaced with hyphens and a _loop added to the end. So if you have a category called "Bells and Whistles" then the loop would be called "bells-and-whistles_loop".|,
lastUpdated => 0,
message => q|A loop containing attributes, and values for those attributes, is created for each category in this matrix. The name of the loop is the category name with spaces replaced with hyphens and a _loop added to the end. So if you have a category called "Bells and Whistles" then the loop would be called "bells-and-whistles_loop".|,
lastUpdated => 1231764520,
context => q|Description of the CATEGORY_NAME_loop tmpl_var for the template help.|,
},

View file

@ -121,6 +121,11 @@ our $I18N = {
lastUpdated => 0,
},
'date' => {
message => q|The publication date for this item.|,
lastUpdated => 0,
},
'author' => {
message => q|The publisher of this item.|,
lastUpdated => 0,