merging 7.4 changes
This commit is contained in:
parent
5292426cc5
commit
1149fd54ed
19 changed files with 319 additions and 167 deletions
|
|
@ -33,6 +33,10 @@
|
|||
- fix: Mails sent from WebGUI now wrap at 78 characters, as the SMTP
|
||||
RFC asks, to fix problems with some SMTP servers when lines exceed
|
||||
998 characters. (The Next Phase / MedIntellibase)
|
||||
- fix: Fatal Errors Kill Login Session
|
||||
- fix: Calendar Event recurrence stretching over daylight savings time changes use wrong times
|
||||
- fix: In IE, 'Insert WebGUI Image' loses some attributes
|
||||
- fix: Collaboration System threads sometimes unable to find next/previous thread
|
||||
|
||||
7.4.20
|
||||
- fix: Assets with no committed versions may be left as orphans when parent is purged
|
||||
|
|
@ -40,10 +44,14 @@
|
|||
- fix: Calendar Edit template refers to non-existant and other unneeded javascript files
|
||||
|
||||
7.4.19
|
||||
- fix: Select all doesn't work in trash in IE or with a single item
|
||||
- fix: Import Package does nothing when re-importing trashed package
|
||||
- fix: CS Posts get re-ordered when copy/paste
|
||||
- fix: Matrix best/worst now must have 10 or more votes
|
||||
- fix: When upgrading, two revisions of same asset added in same second.
|
||||
- fix: Uncommitted Snippets get cached when not in admin mode and are then served to visitors
|
||||
- fix: Admin Console icons sometimes not shown in IE7
|
||||
- fix: Syndicated Content asset not decoding with entities properly
|
||||
|
||||
7.4.18
|
||||
- fix: Graph draws black triangle covering half the image
|
||||
|
|
@ -60,6 +68,7 @@
|
|||
|
||||
7.4.17
|
||||
- fix: double width characters encoded incorrectly in Collaboration RSS feed
|
||||
- fix: update method in various assets changes incoming parameters
|
||||
- fix: ExtrasUrl in conf http:// stripping / from URL (perlDreamer Consulting, LLC.)
|
||||
http://www.plainblack.com/bugs/tracker/extrasurl-in-conf-http/-stripping-/-from-url
|
||||
|
||||
|
|
@ -97,8 +106,8 @@
|
|||
- fix: EMS edit badge event list can display incorrectly in IE
|
||||
- fix: Expired SessionScratch not deleted (thanks to Michelle Lamar)
|
||||
http://www.plainblack.com/bugs/tracker/expired-sessionscratch-not-deleted
|
||||
- fix: Bad import of help template variables from other topics. (perlDreamer Consulting, LLC.)
|
||||
- fix: Remove old templates that used to belong to the Events Calendar (perlDreamer Consulting, LLC.)
|
||||
- fix: Bad import of help template variables from other topics. (perlDreamer Consulting, LLC.)
|
||||
|
||||
7.4.12
|
||||
- fix: extra empty/grey area at the bottom of pages
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
125
docs/upgrades/upgrade_7.4.20-7.4.21.pl
Normal file
125
docs/upgrades/upgrade_7.4.20-7.4.21.pl
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
|
||||
|
||||
my $toVersion = '7.4.21';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
##-------------------------------------------------
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet);
|
||||
# # and here's our code
|
||||
#}
|
||||
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
|
||||
updateTemplates($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "templates-".$toVersion);
|
||||
print "\tUpdating templates.\n" unless ($quiet);
|
||||
opendir(DIR,"templates-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.tmpl$/);
|
||||
open(FILE,"<templates-".$toVersion."/".$file);
|
||||
my $first = 1;
|
||||
my $create = 0;
|
||||
my $head = 0;
|
||||
my %properties = (className=>"WebGUI::Asset::Template");
|
||||
while (my $line = <FILE>) {
|
||||
if ($first) {
|
||||
$line =~ m/^\#(.*)$/;
|
||||
$properties{id} = $1;
|
||||
$first = 0;
|
||||
} elsif ($line =~ m/^\#create$/) {
|
||||
$create = 1;
|
||||
} elsif ($line =~ m/^\#(.*):\s*(.*)$/) {
|
||||
$properties{$1} = $2;
|
||||
} elsif ($line =~ m/^~~~$/) {
|
||||
$head = 1;
|
||||
} elsif ($head) {
|
||||
$properties{headBlock} .= $line;
|
||||
} else {
|
||||
$properties{template} .= $line;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
if ($create) {
|
||||
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
|
||||
my $template = $newFolder->addChild(\%properties, $properties{id});
|
||||
} else {
|
||||
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
|
||||
if (defined $template) {
|
||||
my $newRevision = $template->addRevision(\%properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub createNewTemplatesFolder {
|
||||
my $importNode = shift;
|
||||
my $newFolder = $importNode->addChild({
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
title => $toVersion." New Templates",
|
||||
menuTitle => $toVersion." New Templates",
|
||||
url=> $toVersion."_new_templates",
|
||||
groupIdView=>"12"
|
||||
});
|
||||
return $newFolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -68,6 +68,7 @@ sub handler {
|
|||
if ($request->uri =~ m{$regex}i) {
|
||||
my $output = eval { WebGUI::Pluggable::run($handler->{$regex}, "handler", [$request, $server, $config]) };
|
||||
if ($@) {
|
||||
die $@ if ($@ =~ "^fatal:");
|
||||
# bad
|
||||
return Apache2::Const::DECLINED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,48 +200,53 @@ sub generateRecurringEvents {
|
|||
}
|
||||
|
||||
# Get the distance between the event startDate and endDate
|
||||
# Only days, since event recurrence only changes the Date the event occurs, not
|
||||
# the time.
|
||||
# Include the time, as recurrence can change it when crossing a daylight
|
||||
# savings time border.
|
||||
# TODO: Allow recurrence patterns of less than a single day.
|
||||
my $duration_days = 0;
|
||||
|
||||
my $initialStart
|
||||
= WebGUI::DateTime->new($session, $properties->{startDate} . " "
|
||||
. ($properties->{startTime} || "00:00:00"));
|
||||
my $initialEnd
|
||||
= WebGUI::DateTime->new($session, $properties->{endDate} . " "
|
||||
. ($properties->{endTime} || "00:00:00"));
|
||||
my $duration = $initialEnd->subtract_datetime($initialStart);
|
||||
|
||||
my $event_start
|
||||
= WebGUI::DateTime->new($session, $properties->{startDate}." 00:00:00");
|
||||
my $event_end
|
||||
= WebGUI::DateTime->new($session, $properties->{endDate}." 00:00:00");
|
||||
$duration_days
|
||||
= $event_end->subtract_datetime($event_start)->days;
|
||||
|
||||
my $eventTime;
|
||||
my $localTime;
|
||||
if ($properties->{startTime}) {
|
||||
$eventTime = WebGUI::DateTime->new($session, $properties->{startDate} . " " . $properties->{startTime});
|
||||
$eventTime = $eventTime->set_time_zone($properties->{timeZone})->toMysqlTime;
|
||||
$localTime = $initialStart->clone->set_time_zone($properties->{timeZone})->toMysqlTime;
|
||||
}
|
||||
$properties->{feedUid} = undef;
|
||||
|
||||
my @dates = $self->getRecurrenceDates;
|
||||
|
||||
for my $date (@dates) {
|
||||
my $dt;
|
||||
if ($eventTime) {
|
||||
$dt = WebGUI::DateTime->new($session, mysql => $date . " " . $eventTime, time_zone => $properties->{timeZone});
|
||||
my $startDate;
|
||||
if ($localTime) {
|
||||
$startDate = WebGUI::DateTime->new($session,
|
||||
mysql => $date . " " . $localTime,
|
||||
time_zone => $properties->{timeZone},
|
||||
);
|
||||
}
|
||||
else {
|
||||
$dt = WebGUI::DateTime->new($session, $date." ". "00:00:00");
|
||||
$startDate = WebGUI::DateTime->new($session, $date." 00:00:00");
|
||||
}
|
||||
my $startDate = $dt->toDatabaseDate;
|
||||
my $endDate = $startDate->clone->add($duration);
|
||||
my $dbDate = $startDate->toDatabaseDate;
|
||||
# Only generate if the recurId does not exist on this day
|
||||
my ($exists)
|
||||
= $session->db->quickArray(
|
||||
"select count(*) from Event where recurId=? and startDate=?",
|
||||
[$properties->{recurId}, $startDate],
|
||||
[$properties->{recurId}, $dbDate],
|
||||
);
|
||||
|
||||
if (!$exists) {
|
||||
$properties->{startDate} = $startDate;
|
||||
$properties->{endDate}
|
||||
= $dt->clone->add(days => $duration_days)->toDatabaseDate;
|
||||
|
||||
$properties->{startDate} = $dbDate;
|
||||
$properties->{endDate} = $endDate->toDatabaseDate;
|
||||
if ($localTime) {
|
||||
$properties->{startTime} = $startDate->toDatabaseTime;
|
||||
$properties->{endTime} = $endDate->toDatabaseTime;
|
||||
}
|
||||
my $newEvent = $parent->addChild($properties);
|
||||
$newEvent->requestAutoCommit;
|
||||
}
|
||||
|
|
@ -1802,9 +1807,8 @@ Wrap update so that isHidden is always set to be a 1.
|
|||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
$properties->{isHidden} = 1;
|
||||
return $self->SUPER::update($properties);
|
||||
my $properties = shift;
|
||||
return $self->SUPER::update({%$properties, isHidden => 1});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1041,8 +1041,7 @@ sub update {
|
|||
view => $self->get("groupIdView"),
|
||||
edit => $self->get("groupIdEdit")
|
||||
);
|
||||
$properties->{isHidden} = 1;
|
||||
$self->SUPER::update($properties, @_);
|
||||
$self->SUPER::update({%$properties, isHidden => 1});
|
||||
if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) {
|
||||
my $storage = $self->getStorageLocation;
|
||||
if (-d $storage->getPath) {
|
||||
|
|
|
|||
|
|
@ -242,35 +242,40 @@ Returns a thread object for the next (newer) thread in the same forum.
|
|||
=cut
|
||||
|
||||
sub getNextThread {
|
||||
my $self = shift;
|
||||
unless (defined $self->{_next}) {
|
||||
my $self = shift;
|
||||
unless (defined $self->{_next}) {
|
||||
my $parent = $self->getParent;
|
||||
my $sortBy = $parent->getSortBy;
|
||||
my $sortByCompare = $sortBy eq 'assetData.revisionDate' ? $self->get('revisionDate') : $self->get($sortBy);
|
||||
$sortBy = join('.', map { $self->session->db->dbh->quote_identifier($_) } split(/\./, $sortBy));
|
||||
my $sortOrder = $parent->getSortOrder;
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy.($sortOrder eq 'asc' ? '>' : '<').$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." ".$sortOrder."
|
||||
");
|
||||
if ($id) {
|
||||
my $sortCompare = lc $sortOrder eq 'asc' ? '>=' : '<=';
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray(<<END_SQL, [$self->get("parentId"), $self->getId, $sortByCompare, $self->session->scratch->get("versionTag"), $self->session->user->userId]);
|
||||
select asset.assetId, asset.className, max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where
|
||||
asset.parentId=?,
|
||||
and asset.assetId <> ?
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and $sortBy $sortCompare ?
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=?
|
||||
or (assetData.ownerUserId=? and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by $sortBy $sortOrder, assetData.revisionDate asc
|
||||
limit 1
|
||||
END_SQL
|
||||
if ($id) {
|
||||
$self->{_next} = WebGUI::Asset->new($self->session, $id, $class, $version);
|
||||
}
|
||||
# delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
return $self->{_next};
|
||||
};
|
||||
return $self->{_next};
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -297,37 +302,42 @@ Returns a thread object for the previous (older) thread in the same forum.
|
|||
=cut
|
||||
|
||||
sub getPreviousThread {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
unless (defined $self->{_previous}) {
|
||||
my $parent = $self->getParent;
|
||||
my $sortBy = $parent->getSortBy;
|
||||
my $sortByCompare = $sortBy eq 'assetData.revisionDate' ? $self->get('revisionDate') : $self->get($sortBy);
|
||||
$sortBy = join('.', map { $self->session->db->dbh->quote_identifier($_) } split(/\./, $sortBy));
|
||||
my $sortOrder = lc($parent->getSortOrder) eq 'asc' ? 'desc' : 'asc';
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy.($sortOrder eq 'asc' ? '>' : '<').$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." ".$sortOrder.", assetData.revisionDate desc ");
|
||||
if($id) {
|
||||
$self->{_previous} = WebGUI::Asset::Post::Thread->new($self->session, $id,$class,$version);
|
||||
}
|
||||
# delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
||||
}
|
||||
return $self->{_previous};
|
||||
my $sortCompare = lc $sortOrder eq 'asc' ? '>=' : '<=';
|
||||
my ($id, $class, $version) = $self->session->dbSlave->quickArray(<<END_SQL, [$self->get("parentId"), $self->getId, $sortByCompare, $self->session->scratch->get("versionTag"), $self->session->user->userId]);
|
||||
select asset.assetId, asset.className, max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where
|
||||
asset.parentId=?,
|
||||
asset.assetId <> ?
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and $sortBy $sortCompare ?
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=?
|
||||
or (assetData.ownerUserId=? and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by $sortBy $sortOrder, assetData.revisionDate desc
|
||||
limit 1
|
||||
END_SQL
|
||||
if ($id) {
|
||||
$self->{_previous} = WebGUI::Asset->new($self->session, $id, $class, $version);
|
||||
}
|
||||
};
|
||||
return $self->{_previous};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStickUrl ( )
|
||||
|
|
|
|||
|
|
@ -156,7 +156,12 @@ sub purgeCache {
|
|||
sub view {
|
||||
my $self = shift;
|
||||
my $calledAsWebMethod = shift;
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($self->session, 1);
|
||||
my $noCache =
|
||||
$self->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;
|
||||
return $out if $out;
|
||||
}
|
||||
|
|
@ -166,7 +171,7 @@ sub view {
|
|||
if ($self->getValue("processAsTemplate")) {
|
||||
$output = WebGUI::Asset::Template->processRaw($self->session, $output, $self->get);
|
||||
}
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
|
||||
unless ($noCache) {
|
||||
WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout"));
|
||||
}
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -311,8 +311,7 @@ Wrap update to force isHidden to be on, all the time.
|
|||
sub update {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
$properties->{isHidden} = 1;
|
||||
$self->SUPER::update($properties, @_);
|
||||
return $self->SUPER::update({%$properties, isHidden => 1});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -225,39 +225,29 @@ sub definition {
|
|||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# strip all html tags from the given data structure. This is important to
|
||||
# prevent cross site scripting attacks
|
||||
#my $_stripped_html = {};
|
||||
|
||||
sub _strip_html {
|
||||
#my ($data) = @_;
|
||||
|
||||
if (ref($_[0]) eq 'HASH') {
|
||||
keys(%{$_[0]});
|
||||
while (my ($name, $val) = each (%{$_[0]})) {
|
||||
$_[0]->{$name} = _strip_html($val);
|
||||
}
|
||||
} elsif (ref($_[0]) eq 'ARRAY') {
|
||||
for (my $i = 0; $i < @{$_[0]}; $i++) {
|
||||
$_[0]->[$i] = _strip_html($_[0]->[$i]);
|
||||
}
|
||||
} else {
|
||||
if ($_[0]) {
|
||||
$_[0] =~ s/\</</g;
|
||||
$_[0] =~ s/\>/>/g;
|
||||
$_[0] = WebGUI::HTML::filter($_[0], 'all');
|
||||
##Unencode double encoded entities. This is usually done
|
||||
##by passing XML::RSSLite an already encoded entity.
|
||||
$_[0] =~ s/\&(?=(#[0-9]+|#x[0-9a-fA-F]+|\w+);)/&/g;
|
||||
}
|
||||
unless (ref $_[0]) {
|
||||
return $_[0] = WebGUI::HTML::Filter($_[0], 'all');
|
||||
}
|
||||
my $ref = shift;
|
||||
if (ref $ref eq 'HASH') {
|
||||
if (exists $ref->{description}) {
|
||||
$ref->{description} = HTML::Entities::decode_entities($ref->{description});
|
||||
}
|
||||
|
||||
return $_[0];
|
||||
foreach my $value (values %$ref) {
|
||||
_strip_html($value);
|
||||
}
|
||||
}
|
||||
elsif (ref $ref eq 'ARRAY') {
|
||||
foreach my $value (@$ref) {
|
||||
_strip_html($value);
|
||||
}
|
||||
}
|
||||
return $ref;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -399,7 +389,7 @@ sub _get_rss_data {
|
|||
$rss->{items} = [];
|
||||
}
|
||||
|
||||
_strip_html($rss);
|
||||
_strip_html($rss);
|
||||
$rss->{items} = [ $rss->{items} ] unless (ref $rss->{items} eq 'ARRAY');
|
||||
|
||||
_normalize_items($rss->{items});
|
||||
|
|
|
|||
|
|
@ -296,8 +296,7 @@ sub www_editBranchSave {
|
|||
$data{url} .= $descendant->get("url");
|
||||
}
|
||||
}
|
||||
# copy of %data instead of reference so modifications don't propagate to the next asset
|
||||
my $newRevision = $descendant->addRevision({%data}, undef, {skipAutoCommitWorkflows=>1});
|
||||
my $newRevision = $descendant->addRevision(\%data, undef, {skipAutoCommitWorkflows=>1});
|
||||
foreach my $form ($self->session->form->param) {
|
||||
if ($form =~ /^metadata_(.*)$/) {
|
||||
my $fieldName = $1;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ sub www_manageTrash {
|
|||
<script type=\"text/javascript\">
|
||||
//<![CDATA[
|
||||
var assetManager = new AssetManager();
|
||||
assetManager.AddColumn('".WebGUI::Form::checkbox($self->session,{name=>"checkAllAssetIds", extras=>'onchange="toggleAssetListSelectAll(this.form);"'})."','','center','form');
|
||||
assetManager.AddColumn('".WebGUI::Form::checkbox($self->session,{name=>"checkAllAssetIds", extras=>'onclick="toggleAssetListSelectAll(this.form);"'})."','','center','form');
|
||||
assetManager.AddColumn('".$i18n->get("99")."','','left','');
|
||||
assetManager.AddColumn('".$i18n->get("type")."','','left','');
|
||||
assetManager.AddColumn('".$i18n->get("last updated")."','','center','');
|
||||
|
|
@ -345,15 +345,20 @@ sub www_manageTrash {
|
|||
."','".$child->get("revisionDate")."','".$child->get("assetSize")."');\n";
|
||||
}
|
||||
$output .= '
|
||||
assetManager.AddButton("'.$i18n->get("restore").'","restoreList","manageTrash");
|
||||
assetManager.AddButton("'.$i18n->get("purge").'","purgeList","manageTrash");
|
||||
assetManager.Write();
|
||||
var assetListSelectAllToggle = false;
|
||||
function toggleAssetListSelectAll(form){
|
||||
assetListSelectAllToggle = assetListSelectAllToggle ? false : true;
|
||||
for(var i = 0; i < form.assetId.length; i++)
|
||||
assetManager.AddButton("'.$i18n->get("restore").'","restoreList","manageTrash");
|
||||
assetManager.AddButton("'.$i18n->get("purge").'","purgeList","manageTrash");
|
||||
assetManager.Write();
|
||||
var assetListSelectAllToggle = false;
|
||||
function toggleAssetListSelectAll(form) {
|
||||
assetListSelectAllToggle = assetListSelectAllToggle ? false : true;
|
||||
if (typeof form.assetId.length == "undefined") {
|
||||
form.assetId.checked = assetListSelectAllToggle;
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < form.assetId.length; i++)
|
||||
form.assetId[i].checked = assetListSelectAllToggle;
|
||||
}
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script> <div class="adminConsoleSpacer"> </div>';
|
||||
return $ac->render($output, $header);
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ sub execute {
|
|||
if ($operation->{$op}) {
|
||||
$output = eval { WebGUI::Pluggable::run("WebGUI::Operation::".$operation->{$op}, 'www_'.$op, [ $session ] ) };
|
||||
if ( $@ ) {
|
||||
die $@ if ($@ =~ "^fatal:");
|
||||
$session->errorHandler->error($@);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$session->errorHandler->security("execute an invalid operation: ".$op);
|
||||
}
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ package WebGUI::Pluggable;
|
|||
use strict;
|
||||
use Carp qw(croak);
|
||||
|
||||
# Carps should always bypass this package in error reporting
|
||||
$Carp::Internal{ __PACKAGE__ }++;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Pluggable
|
||||
|
|
@ -55,25 +58,21 @@ The name of the module you'd like to load like "WebGUI::Asset::Snippet";
|
|||
|
||||
sub instanciate {
|
||||
my ($module, $sub, $params) = @_;
|
||||
eval { load($module) };
|
||||
if ($@) {
|
||||
croak "Could not instanciate object using $sub on $module because $module could not be loaded.";
|
||||
if ( ! eval { load($module); 1 } ) {
|
||||
croak "Could not instanciate object using $sub on $module: $@";
|
||||
}
|
||||
else {
|
||||
unless ($module->can($sub)) {
|
||||
croak "Could not instanciate object using $sub on $module because $sub is not a valid method.";
|
||||
}
|
||||
my $object = eval{$module->$sub(@{$params})};
|
||||
if ($@) {
|
||||
croak "Could not instanciate object using $sub on $module because $@";
|
||||
}
|
||||
else {
|
||||
unless (defined $object) {
|
||||
croak "Could not instanciate object using $sub on $module. The result is undefined.";
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
# Module loaded properly
|
||||
unless ($module->can($sub)) {
|
||||
croak "Could not instanciate object using $sub on $module because $sub is not a valid method.";
|
||||
}
|
||||
my $object;
|
||||
if (! eval{$object = $module->$sub(@{$params}); 1}) {
|
||||
croak "Could not instanciate object using $sub on $module because $@";
|
||||
}
|
||||
if (defined $object) {
|
||||
return $object;
|
||||
}
|
||||
croak "Could not instanciate object using $sub on $module. The result is undefined.";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -88,12 +87,20 @@ The name of the module you'd like to load like "WebGUI::Asset::Snippet";
|
|||
|
||||
=cut
|
||||
|
||||
# Cache results of failures. Modules with compile errors will pass a require check if done a second time.
|
||||
my %moduleError;
|
||||
sub load {
|
||||
my $module = shift;
|
||||
my $modulePath = $module.".pm";
|
||||
$modulePath =~ s{::}{/}g;
|
||||
eval { require $modulePath };
|
||||
if ($@) {
|
||||
if ($moduleError{$module}) {
|
||||
croak "Could not load $module because $moduleError{$module}";
|
||||
}
|
||||
my $modulePath = $module . ".pm";
|
||||
$modulePath =~ s{::|'}{/}g;
|
||||
if (eval { require $modulePath; 1 }) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
$moduleError{$module} = $@;
|
||||
croak "Could not load $module because $@";
|
||||
}
|
||||
}
|
||||
|
|
@ -120,21 +127,15 @@ An array reference of parameters to pass in to the sub routine.
|
|||
|
||||
sub run {
|
||||
my ($module, $sub, $params) = @_;
|
||||
eval { load($module) };
|
||||
if ($@) {
|
||||
croak "Could not run $sub on $module because $module could not be loaded.";
|
||||
if (! eval { load($module); 1 }) {
|
||||
croak "Unable to run $sub on $module: $@";
|
||||
}
|
||||
elsif (my $sub = $module->can($sub)) {
|
||||
# Let any other errors propagate
|
||||
return $sub->(@$params);
|
||||
}
|
||||
else {
|
||||
my $command = $module."::".$sub;
|
||||
no strict qw(refs);
|
||||
my $out = eval { &$command(@{$params}) };
|
||||
use strict;
|
||||
if ($@) {
|
||||
croak "Could not run $sub on $module because $@";
|
||||
}
|
||||
else {
|
||||
return $out;
|
||||
}
|
||||
croak "Could not run $sub on $module because it does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use strict;
|
|||
use Log::Log4perl;
|
||||
use Apache2::RequestUtil;
|
||||
use JSON;
|
||||
use HTML::Entities;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -215,7 +216,7 @@ sub fatal {
|
|||
elsif ($self->canShowDebug()) {
|
||||
$self->session->output->print("<h1>WebGUI Fatal Error</h1><p>Something unexpected happened that caused this system to fault.</p>\n",1);
|
||||
$self->session->output->print("<p>".$message."</p>\n",1);
|
||||
$self->session->output->print($self->getStackTrace(), 1);
|
||||
$self->session->output->print("<pre>" . encode_entities($self->getStackTrace) . "</pre>", 1);
|
||||
$self->session->output->print($self->showDebug(),1);
|
||||
}
|
||||
else {
|
||||
|
|
@ -228,7 +229,7 @@ sub fatal {
|
|||
$self->session->output->print('<br />'.$self->session->setting->get("companyURL"),1);
|
||||
}
|
||||
$self->session->close();
|
||||
exit;
|
||||
die "fatal: " . $message;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ function switchToAdminConsole () {
|
|||
document.getElementById("console_workarea").className = "adminConsoleWorkArea";
|
||||
document.getElementById("console_toggle_off").className = "adminConsoleToggle";
|
||||
document.getElementById("console_toggle_on").className = "adminConsoleHidden";
|
||||
|
||||
// force reflow to fix IE7
|
||||
document.body.style.border = document.body.style.border;
|
||||
}
|
||||
|
||||
function toggleAdminConsole () {
|
||||
|
|
|
|||
|
|
@ -116,19 +116,19 @@ function OKClick() {
|
|||
var html = '<img src="' + src + '" alt="' + alt + '"';
|
||||
|
||||
if (border > 0) {
|
||||
html += ' border="'+border+'px" ';
|
||||
html += ' border="'+border+'" ';
|
||||
}
|
||||
if (hspace > 0) {
|
||||
html += ' hspace="'+hspace+'px" ';
|
||||
html += ' hspace="'+hspace+'" ';
|
||||
}
|
||||
if (vspace > 0) {
|
||||
html += ' vspace="'+vspace+'px" ';
|
||||
html += ' vspace="'+vspace+'" ';
|
||||
}
|
||||
if (height > 0) {
|
||||
html += ' height="'+height+'px" ';
|
||||
html += ' height="'+height+'" ';
|
||||
}
|
||||
if (width > 0) {
|
||||
html += ' width="'+width+'px" ';
|
||||
html += ' width="'+width+'" ';
|
||||
}
|
||||
if (align != null) {
|
||||
html += ' align="'+align+'" ';
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue