From 01c0802c220e57a7dda990d7b9d60d3aca4954a0 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 23 Mar 2005 19:15:23 +0000 Subject: [PATCH] bunch of bug fixes --- docs/changelog/6.x.x.txt | 11 +++++++++++ lib/WebGUI/Asset.pm | 10 ++++++++-- lib/WebGUI/Asset/File.pm | 9 ++++----- lib/WebGUI/Asset/Post.pm | 5 +++-- lib/WebGUI/Asset/Wobject/Collaboration.pm | 2 +- lib/WebGUI/Macro/AdminToggle.pm | 4 ++-- lib/WebGUI/Operation.pm | 7 ------- lib/WebGUI/Storage/Image.pm | 2 +- lib/WebGUI/Style.pm | 4 ++-- lib/WebGUI/URL.pm | 9 +++++++-- www/extras/assetManager/Asset.js | 2 +- 11 files changed, 40 insertions(+), 25 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index c29e3688b..5218e9f8c 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -2,6 +2,17 @@ - fix [ 1160953 ] JavaScript Errors in admin console - IE - Fixed a drag and drop problem. - fix [ 1168195 ] Asset manager: Space between Size and unit + - Fixed a bug where sticky threads were not acting sticky in the CS. + - fix [ 1169116 ] AdminToggle macro doesn't display correct linktext + - fix [ 1168189 ] Asset Manager: Double Title entries + - fix [ 1168181 ] Edit in Asset manager -> wrong folder + - fix [ 1167971 ] attachment loop code for Asset::Post::getTemplateVariables + - fix [ 1168867 ] WebGUI Script XHTML 1.0 Non-Compliant + - Fixed a fatal crash bug caused by calling the old authentication urls. + - fix [ 1168318 ] Rating often not working + - fix [ 1167937 ] Asset Manager and No-Cache Imcompatible + - fix [ 1167917 ] Link to Page Tree and No-Cache Imcompatible + - fix [ 1168084 ] file uploads don't work. 6.5.3 diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 7b9e8dcd4..f7076d3c5 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -2315,6 +2315,7 @@ sub www_copy { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; my $newAsset = $self->duplicate; + $newAsset->update({ title=>$newAsset->get("title").' (copy)'}); $newAsset->cut; return $self->getContainer->www_view; } @@ -2334,6 +2335,7 @@ sub www_copyList { my $asset = WebGUI::Asset->newByDynamicClass($assetId); if ($asset->canEdit) { my $newAsset = $asset->duplicate; + $newAsset->update({ title=>$newAsset->get("title").' (copy)'}); $newAsset->cut; } } @@ -2529,12 +2531,16 @@ sub www_editSave { } $object->processPropertiesFromFormPost; $object->updateHistory("edited"); - return $self->www_manageAssets if ($session{form}{proceed} eq "manageAssets" && $session{form}{assetId} eq "new"); + if ($session{form}{proceed} eq "manageAssets") { + $session{asset} = $object->getParent; + return $object->getParent->www_manageAssets; + } if ($session{form}{proceed} ne "") { my $method = "www_".$session{form}{proceed}; $session{asset} = $object; return $object->$method(); } + $session{asset} = $object->getContainer; return $self->getContainer->www_view; } @@ -3035,7 +3041,7 @@ Main page to manage assets. Renders an AdminConsole with a list of assets. If ca sub www_manageAssets { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; - my $children = $self->getLineage(["children"],{returnQuickReadObjects=>1}); + my $children = $self->getLineage(["children"],{returnObjects=>1}); my $output = $self->getAssetManagerControl($children); $output .= '
  diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index 8bab84b65..9b70ba259 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -194,14 +194,13 @@ sub getStorageLocation { sub processPropertiesFromFormPost { my $self = shift; $self->SUPER::processPropertiesFromFormPost; - my $storage = $self->getStorageLocation->create; + # might have to create a new storage location for versioning + my $storage = ($self->get("storageId") eq "") ? $self->getStorageLocation : $self->getStorageLocation->create; my $filename = $storage->addFileFromFormPost("file"); if (defined $filename) { - my $oldVersions; + my $oldVersions = $self->get("olderVersions"); if ($self->get("filename")) { # do file versioning - my @old = split("\n",$self->get("olderVersions")); - push(@old,$self->get("storageId")."|".$self->get("filename")); - $oldVersions = join("\n",@old); + $oldVersions .= "\n".$self->get("storageId")."|".$self->get("filename"); } my %data; $data{filename} = $filename; diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 4b44895a8..b7153b282 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -418,6 +418,7 @@ sub getTemplateVars { $var{"attachment.url"} = $storage->getUrl($filename); $var{"attachment.icon"} = $storage->getFileIconUrl($filename); $var{"attachment.name"} = $filename; + $gotAttachment = 1; } push(@{$var{"attachment_loop"}}, { url=>$storage->getUrl($filename), @@ -691,11 +692,11 @@ An integer between 1 and 5 (5 being best) to rate this post with. sub rate { my $self = shift; - my $rating = shift; + my $rating = shift || 3; unless ($self->hasRated) { WebGUI::SQL->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (" .quote($self->getId).", ".quote($session{user}{userId}).", ".quote($session{env}{REMOTE_ADDR}).", - ".WebGUI::DateTime::time().", $rating)"); + ".WebGUI::DateTime::time().", ".quote($rating).")"); my ($count) = WebGUI::SQL->quickArray("select count(*) from Post_rating where assetId=".quote($self->getId)); $count = $count || 1; my ($sum) = WebGUI::SQL->quickArray("select sum(rating) from Post_rating where assetId=".quote($self->getId)); diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 562ddfc81..2ef477dc9 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -854,7 +854,7 @@ sub view { left join asset on Thread.assetId=asset.assetId left join Post on Post.assetId=asset.assetId where asset.parentId=".quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and $constraints - order by ".$sortBy." ".$sortOrder; + order by Thread.isLocked desc, ".$sortBy." ".$sortOrder; my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage")); $self->appendPostListTemplateVars(\%var, $sql, $p); $self->appendTemplateLabels(\%var); diff --git a/lib/WebGUI/Macro/AdminToggle.pm b/lib/WebGUI/Macro/AdminToggle.pm index b92f4911b..aef0a1b95 100644 --- a/lib/WebGUI/Macro/AdminToggle.pm +++ b/lib/WebGUI/Macro/AdminToggle.pm @@ -23,8 +23,8 @@ sub process { if (WebGUI::Grouping::isInGroup(12)) { my %var; my ($turnOn,$turnOff,$templateName) = WebGUI::Macro::getParams($_[0]); - $turnOn |= WebGUI::International::get(516); - $turnOff |= WebGUI::International::get(517); + $turnOn ||= WebGUI::International::get(516); + $turnOff ||= WebGUI::International::get(517); if (WebGUI::Session::isAdminOn()) { $var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin'); $var{'toggle.text'} = $turnOff; diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index 612bdd839..5546731c1 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -81,13 +81,6 @@ sub getOperations { 'switchOffAdmin' => 'WebGUI::Operation::Admin', 'switchOnAdmin' => 'WebGUI::Operation::Admin', 'auth' => 'WebGUI::Operation::Auth', - 'displayLogin' => 'WebGUI::Operation::Auth', - 'login' => 'WebGUI::Operation::Auth', - 'displayAccount' => 'WebGUI::Operation::Auth', - 'createAccount' => 'WebGUI::Operation::Auth', - 'deactivateAccount' => 'WebGUI::Operation::Auth', - 'logout' => 'WebGUI::Operation::Auth', - 'recoverPassword' => 'WebGUI::Operation::Auth', 'init' => 'WebGUI::Operation::Auth', 'copyDatabaseLink' => 'WebGUI::Operation::DatabaseLink', 'deleteDatabaseLink' => 'WebGUI::Operation::DatabaseLink', diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index 224161c0e..c0c23d56d 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -169,7 +169,7 @@ sub getSizeInPixels { my $image = Image::Magick->new; my $error = $image->Read($self->getPath($filename)); if ($error) { - WebGUI::ErrorHandler::warn("Couldn't read image for resizing: ".$error); + WebGUI::ErrorHandler::warn("Couldn't read image to check the size of it: ".$error); return 0; } return $image->Get('width','height'); diff --git a/lib/WebGUI/Style.pm b/lib/WebGUI/Style.pm index 269f6bb08..969703b4b 100644 --- a/lib/WebGUI/Style.pm +++ b/lib/WebGUI/Style.pm @@ -119,11 +119,11 @@ sub process { $var{'head.tags'} = ' - diff --git a/lib/WebGUI/URL.pm b/lib/WebGUI/URL.pm index 6fad53b83..6089c5836 100644 --- a/lib/WebGUI/URL.pm +++ b/lib/WebGUI/URL.pm @@ -234,7 +234,7 @@ sub makeCompliant { #------------------------------------------------------------------- -=head2 page ( [ pairs, useSiteUrl ] ) +=head2 page ( [ pairs, useSiteUrl, skipPreventProxyCache ] ) Returns the URL of the current page. @@ -248,11 +248,16 @@ Name value pairs to add to the URL in the form of: If set to "1" we'll use the full site URL rather than the script (gateway) URL. +=head3 skipPreventProxyCache + +If set to "1" we'll skip adding the prevent proxy cache code to the url. + =cut sub page { my $pairs = shift; my $useFullUrl = shift; + my $skipPreventProxyCache = shift; my $url; if ($useFullUrl) { $url = getSiteURL(); @@ -261,7 +266,7 @@ sub page { my $pathinfo = $session{env}{PATH_INFO}; $pathinfo =~ s/^\/(.*)/$1/; $url .= $pathinfo; - if ($session{setting}{preventProxyCache} == 1) { + if ($session{setting}{preventProxyCache} == 1 && !$skipPreventProxyCache) { $url = append($url,"noCache=".randint(0,1000).';'.time()); } if ($pairs) { diff --git a/www/extras/assetManager/Asset.js b/www/extras/assetManager/Asset.js index 6a6b4d940..1a1c326dd 100644 --- a/www/extras/assetManager/Asset.js +++ b/www/extras/assetManager/Asset.js @@ -174,7 +174,7 @@ this.getWrappedURL = function() { if (this.url.indexOf("?") == -1) { return "http://" + AssetManager_getManager().tools.getHostName(location.href) + this.url + "?"; }else { - return "http://" + AssetManager_getManager().tools.getHostName(location.href) + url + "&"; + return "http://" + AssetManager_getManager().tools.getHostName(location.href) + this.url + "&"; } }