more bug fixes

This commit is contained in:
JT Smith 2005-02-18 18:59:12 +00:00
parent 9238c028c6
commit 864206b05b
7 changed files with 33 additions and 139 deletions

View file

@ -9,6 +9,25 @@ save you many hours of grief.
6.3.0
--------------------------------------------------------------------
* Your upgrade process will be a little different from here on out.
Use the following steps to do the upgrade:
a) Back up everything.
b) Extract the 6.3 archive over your existing install.
c) Restart apache (don't shut down as normal, just restart).
d) Run upgrade.pl in the sbin folder.
e) Test.
The reason for this is that WebGUI has an innovative new way
of releasing sites for public view as soon as they become
available during the upgrade, even while the other sites are
still being upgraded. Each site will have a maintenance
message displayed until its upgrade is complete.
* This upgrade process will run for a very long time and output a
lot of debug information which will be useful if something
goes wrong. You may wish to pipe the debug info to a log

View file

@ -374,15 +374,9 @@ while (my $data = $sth->hashRef) {
} elsif ($data->{method} eq "generation") {
$newNav{assetsToInclude} = "self\nsisters";
} elsif ($data->{method} eq "ancestors") {
$newNav{endPoint} += $newNav{startPoint} unless ($newNav{startType} eq "specificUrl");
$newNav{startType} = "relativeToRoot";
$newNav{startPoint} = $data->{stopAtLevel}+1;
$newNav{assetsToInclude} = "descendants";
$newNav{assetsToInclude} = "ancestors";
} elsif ($data->{method} eq "self_and_ancestors") {
$newNav{endPoint} += $newNav{startPoint} unless ($newNav{startType} eq "specificUrl");
$newNav{startType} = "relativeToRoot";
$newNav{startPoint} = $data->{stopAtLevel}+1;
$newNav{assetsToInclude} = "self\ndescendants";
$newNav{assetsToInclude} = "self\nancestors";
} elsif ($data->{method} eq "pedigree") {
$newNav{endPoint} = 55;
$newNav{startType} = "relativeToRoot";
@ -1196,6 +1190,7 @@ $sth->finish;
print "\tDeleting files which are no longer used.\n" unless ($quiet);
#unlink("../../lib/WebGUI/Macro/SI_scaledImage.pm");
#unlink("../../lib/WebGUI/Export.pm");
#unlink("../../lib/WebGUI/MetaData.pm");
#unlink("../../lib/WebGUI/Operation/MetaData.pm");
@ -1262,6 +1257,7 @@ my $macros = $conf->get("macros");
delete $macros->{"\\"};
delete $macros->{"Backslash_pageUrl"};
delete $macros->{"I_imageWithTags"};
delete $macros->{"SI_scaledImage"};
delete $macros->{"Snippet"};
delete $macros->{"Navigation"};
delete $macros->{"File"};
@ -1354,7 +1350,7 @@ $nestedMacro = qr /(\^ # Start with carat
}gx;
push(@parsed, undef) if substr($params,-1,1) eq ',';
my $result;
if (isIn($searchString, qw(Navigation I Snippet File))) {
if (isIn($searchString, qw(Navigation SI I Snippet File))) {
my $url = (exists $macroCache{$parsed[0]}) ? $macroCache{$parsed[0]} : $parsed[0];
$result = '^AssetProxy("'.$url.'");';
} elsif (isIn($searchString, qw(RandomSnippet RandomImage))) {
@ -1809,7 +1805,7 @@ sub walkTree {
my $b = WebGUI::SQL->read("select assetId, templatePosition from wobject where pageId=".quote($page->{pageId})."
order by templatePosition, sequenceNumber");
while (my ($assetId, $position) = $b->array) {
if ($position ne $last) {
if ($position != $last) {
push(@positions,join(",",@assets));
@assets = ();
}
@ -1817,6 +1813,7 @@ sub walkTree {
push(@assets,$assetId);
}
$b->finish;
push(@positions,join(",",@assets));
my $contentPositions = join("\.",@positions);
WebGUI::SQL->write("update Layout set contentPositions=".quote($contentPositions)." where assetId=".quote($pageId));
}

View file

@ -222,8 +222,8 @@ INSERT INTO template VALUES ('7','Side By Side','<a href=\"<tmpl_var assetId>\">
INSERT INTO template VALUES ('6','Right Column','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 1 -->\r\n<div style=\"width: 66%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<!-- begin position 2 -->\r\n<div style=\"width: 34%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('1','Default Page','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('1','File','<tmpl_if session.var.adminOn>\r\n<tmpl_var controls>\r\n</tmpl_if>\r\n<a href=\"<tmpl_var fileUrl>\"><img src=\"<tmpl_var fileIcon>\" alt=\"<tmpl_var title>\" border=\"0\" /><tmpl_var filename></a>','FileAsset',1,1);
INSERT INTO template VALUES ('2','Image','<tmpl_if session.var.adminOn>\r\n<tmpl_var controls>\r\n</tmpl_if>\r\n<img src=\"<tmpl_var fileUrl>\" <tmpl_var parameters> />','ImageAsset',1,1);
INSERT INTO template VALUES ('1','File','<tmpl_if session.var.adminOn><tmpl_if controls><p><tmpl_var controls></p></tmpl_if></tmpl_if><a href=\"<tmpl_var fileUrl>\"><img src=\"<tmpl_var fileIcon>\" alt=\"<tmpl_var title>\" border=\"0\" /><tmpl_var filename></a>','FileAsset',1,1);
INSERT INTO template VALUES ('2','Image','<tmpl_if session.var.adminOn><tmpl_if controls><p><tmpl_var controls></p></tmpl_if></tmpl_if><img src=\"<tmpl_var fileUrl>\" <tmpl_var parameters> />','ImageAsset',1,1);
INSERT INTO template VALUES ('15','File Folder','<a name=\"<tmpl_var assetId>\"></a><tmpl_if session.var.adminOn>\r\n <p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"content\">\r\n<tmpl_loop subfolder_loop>\r\n<tr>\r\n <td class=\"tableData\" valign=\"top\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n<td valign=\"top\" colspan=\"3\"><tmpl_var synopsis></td></tr>\r\n</tmpl_loop>\r\n<tmpl_loop file_loop>\r\n<tr>\r\n <td valign=\"top\" class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\">^D(\"%z %Z\",<tmpl_var date.epoch>);</td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var size></td>\r\n</tr>\r\n</tmpl_loop>\r\n\r\n</table>', 'Folder',1,1);

View file

@ -248,7 +248,6 @@ sub view {
my $self = shift;
my %var = %{$self->get};
$var{controls} = $self->getToolbar;
$var{controls} = '<p>'.$var{controls}.'</p>' if (exists $var{controls});
$var{fileUrl} = $self->getFileUrl;
$var{fileIcon} = $self->getFileIconUrl;
return $self->processTemplate(\%var,"PBtmpl0000000000000024");

View file

@ -193,7 +193,6 @@ sub view {
my $self = shift;
my %var = %{$self->get};
$var{controls} = $self->getToolbar;
$var{controls} = '<p>'.$var{controls}.'</p>' if (exists $var{controls});
$var{fileUrl} = $self->getFileUrl;
$var{fileIcon} = $self->getFileIconUrl;
$var{thumbnail} = $self->getThumbnailUrl;

View file

@ -111,6 +111,11 @@ sub getEditForm {
$tabform->getTab("properties")->readOnly(
-label=>"Relatives to Include",
-value=>WebGUI::Form::checkbox({
checked=>$selfChecked,
name=>"assetsToInclude",
value=>"ancestors"
}).'Ancestors<br />'
.WebGUI::Form::checkbox({
checked=>$selfChecked,
name=>"assetsToInclude",
value=>"self"

View file

@ -1,125 +0,0 @@
package WebGUI::Macro::SI_scaledImage;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 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 strict;
use WebGUI::Collateral;
use WebGUI::Macro;
use WebGUI::ErrorHandler;
use WebGUI::Session;
use WebGUI::Utility;
# test for Image::Magick
# (Would be nice if the results of this test were availiable somewhere
# central)
my $hasImageMagick=1;
eval " use Image::Magick; "; $hasImageMagick=0 if $@;
#-------------------------------------------------------------------
sub _getImage {
my ($collateral) = @_;
return undef unless ($hasImageMagick);
my $image = Image::Magick->new();
if (my $error = $image->Read($collateral->getPath)) {
WebGUI::ErrorHandler::warn("Couldn't read image for resizing: ".$error);
return undef;
}
return $image;
}
#-------------------------------------------------------------------
sub process {
my ($collateralIdent,$width,$height,$parameters) = WebGUI::Macro::getParams($_[0]);
my ($collateral,$url);
if ($collateralIdent =~ /[\w|\-]{22}/) {
$collateral = WebGUI::Collateral->new($collateralIdent);
}
else {
$collateral = WebGUI::Collateral->find($collateralIdent);
}
unless ($collateral) {
WebGUI::ErrorHandler::warn("collateral not found: $collateralIdent");
return '';
}
unless ($collateral->isImage()) {
WebGUI::ErrorHandler::warn("Bad image type: $collateralIdent");
return '';
}
if ($width || $height) {
$url = scaleImage(
collateral => $collateral,
width => $width,
height => $height
);
}
else {
WebGUI::ErrorHandler::warn("width or heigth must be specified");
}
$url ||= $collateral->getURL;
return qq!<img src="$url" $parameters/>!;
}
#-------------------------------------------------------------------
sub scaleImage {
my (%p) = @_;
my ($collateral,$width,$height) = @p{qw(collateral width height)};
# paranoia
return undef unless ($height || $width);
my $filename = "SIThumb_".($width || 'r')."x".($height || 'r')."_".$collateral->getFilename();
$filename .= '.png' if (isIn($collateral->getType(), qw(tif tiff bmp)));
my $pathName = $collateral->{_node}->getPath().$session{os}{slash}.$filename;
unless (-e $pathName) {
my $image = _getImage($collateral);
return undef unless $image;
my ($newWidth,$newHeight);
if ($width && $height) {
($newWidth,$newHeight) = ($width,$height);
}
else {
my ($x, $y) = $image->Get('width','height');
my $ratio = $x / $y;
$newWidth = $width ? $width : $height * $ratio;
$newHeight = $height ? $height : $width / $ratio;
}
my $max = $session{setting}{maxImageSize};
if ($newHeight > $max || $newWidth > $max) {
WebGUI::ErrorHandler::warn(
"Image too large ($newWidth,$newHeight) :".$collateral->get('name')
);
return undef;
}
$image->Scale(width => $newWidth, height => $newHeight);
if (my $error = $image->Write($pathName)) {
WebGUI::ErrorHandler::warn("Couldn't resize image: ".$error);
}
}
return $collateral->{_node}->getURL."/$filename";
}
1;