a whole pile of bug fixes

This commit is contained in:
JT Smith 2005-03-28 00:10:47 +00:00
parent 4ddc5d66ec
commit a50fd5787a
18 changed files with 234 additions and 61 deletions

View file

@ -2,6 +2,25 @@
- Fixed a bug in the collaboration system that caused replies to fail.
- Fixed an inefficency in the asset system that caused a lot of extra work on
the server when pasting.
- Fixed a bug in the groups system where group expiration intervals weren't
saving properly.
- fix [ 1170879 ] "default extension" is added to asset's URL upon every Save
- fix [ 1170200 ] folder view template file_loop -> always current time
- fix [ 1170650 ] Group problem
- fix [ 1170245 ] paste returns deleted content
- Fixed a problem with the FormProcessor url sub that wouldn't allow URLs to
start with / or a macro.
- fix [ 1171447 ] Poll shows no result
- fix [ 1171060 ] delete file from cs
- fix [ 1170290 ] 6.2.x->6.5.4 doesn't add Page macro to config file
- fix [ 1171469 ] [edited] post insert wrong timezone
- Updated the macro picker in the rich editor.
- fix [ 1171505 ] Previewing a post appends signature every time.
- fix [ 1170095 ] Sort-by fields don't.
- fix [ 1165645 ] Search not working
- fix [ 1170264 ] can't copy file
- fix [ 1170242 ] cs email url
- fix [ 1171110 ] nav ancestor
6.5.4

View file

@ -1616,6 +1616,7 @@ $macros->{"AssetProxy"} = "AssetProxy";
$macros->{"RandomAssetProxy"} = "RandomAssetProxy";
$macros->{"FileUrl"} = "FileUrl";
$macros->{"PageUrl"} = "PageUrl";
$macros->{"Page"} = "Page";
$conf->set("paymentPlugins"=>"ITransact");
$conf->set("macros"=>$macros);
$conf->set("assets"=>[

View file

@ -0,0 +1,42 @@
#!/usr/bin/perl
use lib "../../lib";
use File::Path;
use Getopt::Long;
use strict;
use WebGUI::Session;
use WebGUI::SQL;
my $configFile;
my $quiet;
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
WebGUI::Session::open("../..",$configFile);
#--------------------------------------------
print "\tPartitioning limbo\n" unless ($quiet);
my $sth = WebGUI::SQL->read("select lineage from asset where state='trash'");
while (my ($lineage) = $sth->array) {
WebGUI::SQL->write("update asset set state='trash-limbo' where lineage like ".quote($lineage.'%')." and state='limbo'");
}
$sth->finish;
WebGUI::SQL->write("update asset set state='clipboard-limbo' where state='limbo'");
#--------------------------------------------
print "\tRemoving old files\n" unless ($quiet);
# should have been removed in the 6.2-6.3 upgrade
unlink("../../sbin/Hourly/EmptyTrash.pm");
unlink("../../lib/WebGUI/Wobject/IndexedSearch.pm");
rmtree("../../lib/WebGUI/Wobject/IndexedSearch");
unlink("../../lib/WebGUI/Wobject/Product.pm");
unlink("../../lib/WebGUI/Wobject/SyndicatedContent.pm");
unlink("../../lib/WebGUI/Wobject/Survey.pm");
WebGUI::Session::close();

View file

@ -97,7 +97,6 @@ A lineage is a concatenated series of sequence numbers, each six digits long, th
newByLineage
newByPropertyHashRef
newByUrl
republish
paste
processPropertiesFromFormPost
promote
@ -302,14 +301,14 @@ sub checkExportPath {
=head2 cut ( )
Removes asset from lineage, places it in clipboard state. The "gap" in the lineage is changed in state to limbo.
Removes asset from lineage, places it in clipboard state. The "gap" in the lineage is changed in state to clipboard-limbo.
=cut
sub cut {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='clipboard-limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%')." and state='published'");
WebGUI::SQL->write("update asset set state='clipboard', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->updateHistory("cut");
@ -591,7 +590,9 @@ sub fixUrl {
if (length($url) > 250) {
$url = substr($url,220);
}
$url .= ".".$session{setting}{urlExtension} if ($url =~ /\./ && $session{setting}{urlExtension} ne "");
if ($session{setting}{urlExtension} ne "" && !($url =~ /\./)) {
$url .= ".".$session{setting}{urlExtension};
}
my ($test) = WebGUI::SQL->quickArray("select url from asset where assetId<>".quote($self->getId)." and url=".quote($url));
if ($test) {
my @parts = split(/\./,$url);
@ -812,6 +813,10 @@ sub getAssetManagerControl {
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);\n";
$output .= "manager.assetType='".$controlType."';\n" if (defined $controlType);
$output .= "manager.disableDisplay(0);\n" if (defined $removeRank);
if ($controlType eq "ManageTrash" || $controlType eq "ManageClipboard") {
# $output .= "manager.displayCrumbTrail = false;\n";
# $output .= "manager.sortEnabled = false;\n";
}
$output .= "manager.renderAssets();\n";
$output .= "</script>\n";
return $output;
@ -1177,7 +1182,7 @@ A hash reference comprising modifiers to relative listing. Rules include:
=head4 statesToInclude
An array reference containing a list of states that should be returned. Defaults to 'published'. Options include 'published', 'trash', 'cliboard', and 'limbo'.
An array reference containing a list of states that should be returned. Defaults to 'published'. Options include 'published', 'trash', 'cliboard', 'clipboard-limbo' and 'trash-limbo'.
=head4 endingLineageLength
@ -1846,20 +1851,6 @@ sub newByUrl {
#-------------------------------------------------------------------
=head2 republish ( )
Sets Asset properties state to published.
=cut
sub republish {
my $self = shift;
WebGUI::SQL->write("update asset set state='published', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
$self->{_properties}{state} = "published";
}
#-------------------------------------------------------------------
=head2 paste ( assetId )
Returns 1 if can paste an asset to a Parent. Sets the Asset to published. Otherwise returns 0.
@ -1873,9 +1864,10 @@ Alphanumeric ID tag of Asset.
sub paste {
my $self = shift;
my $assetId = shift;
my $pastedAsset = WebGUI::Asset->new($assetId);
my $pastedAsset = WebGUI::Asset->newByDynamicClass($assetId);
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) {
$pastedAsset->republish;
WebGUI::SQL->write("update asset set state='published', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%')." and (state='clipboard' or state='clipboard-limbo')");
$self->{_properties}{state} = "published";
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
return 1;
}
@ -1905,7 +1897,11 @@ sub processPropertiesFromFormPost {
}
$data{title} = "Untitled" unless ($data{title});
$data{menuTitle} = $data{title} unless ($data{menuTitle});
$data{url} = $self->getParent->get("url").'/'.$data{menuTitle} unless ($data{url});
unless ($data{url}) {
$data{url} = $self->getParent->get("url");
$data{url} =~ s/(.*)\..*/$1/;
$data{url} .= '/'.$data{menuTitle};
}
$self->update(\%data);
foreach my $form (keys %{$session{form}}) {
if ($form =~ /^metadata_(\d+)$/) {
@ -1992,6 +1988,20 @@ sub promote {
#-------------------------------------------------------------------
=head2 publish ( )
Sets an asset and it's descendants to a state of 'published' regardless of it's current state.
=cut
sub publish {
my $self = shift;
WebGUI::SQL->write("update asset set state='published', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
$self->{_properties}{state} = "published";
}
#-------------------------------------------------------------------
=head2 purge ( )
Returns 1. Deletes an asset from tables and removes anything bound to that asset.
@ -2022,7 +2032,7 @@ Returns 1. Purges self and all descendants.
sub purgeTree {
my $self = shift;
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1, statesToInclude=>['trash','limbo']});
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1, statesToInclude=>['trash','trash-limbo']});
foreach my $descendant (@{$descendants}) {
$descendant->purge;
}
@ -2153,14 +2163,14 @@ sub swapRank {
=head2 trash ( )
Removes asset from lineage, places it in trash state. The "gap" in the lineage is changed in state to limbo.
Removes asset from lineage, places it in trash state. The "gap" in the lineage is changed in state to trash-limbo.
=cut
sub trash {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash-limbo', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash', lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=".time()." where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->{_properties}{state} = "trash";
@ -2263,7 +2273,11 @@ Returns "".
=cut
sub view {
return "";
my $self = shift;
if ($session{var}{adminOn}) {
return $self->getToolbar;
}
return undef;
}
#-------------------------------------------------------------------
@ -2329,7 +2343,7 @@ sub www_copy {
Copies to clipboard assets in a list, then returns self calling method www_manageAssets(), if canEdit. Otherwise returns AdminConsole rendered insufficient privilege.
=cut
cut
sub www_copyList {
my $self = shift;
@ -3220,6 +3234,43 @@ sub www_promote {
}
#-------------------------------------------------------------------
=head2 www_restoreList ( )
Restores a piece of content from the trash back to it's original location.
=cut
sub www_purgeList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $id ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($id);
$asset->purge;
}
return $self->www_manageTrash();
}
#-------------------------------------------------------------------
=head2 www_restoreList ( )
Restores a piece of content from the trash back to it's original location.
=cut
sub www_restoreList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $id ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($id);
$asset->publish;
}
return $self->www_manageTrash();
}
#-------------------------------------------------------------------
=head2 www_setParent ( )

View file

@ -95,6 +95,7 @@ sub duplicate {
my $newAsset = $self->SUPER::duplicate(shift);
my $newStorage = $self->getStorageLocation->copy;
$newAsset->update({storageId=>$newStorage->getId,olderVersions=>''});
return $newAsset;
}

View file

@ -394,7 +394,7 @@ sub getTemplateVars {
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#'.$self->getId;
$var{'url'} = WebGUI::URL::getSiteURL().$self->getUrl.'#'.$self->getId;
$var{'rating.value'} = $self->get("rating")+0;
$var{'rate.url.1'} = $self->getRateUrl(1);
@ -467,7 +467,9 @@ sub getUploadControl {
if ($self->get("storageId")) {
my $i;
foreach my $filename (@{$self->getStorageLocation->getFiles}) {
$uploadControl .= '<a href="'.$self->getStorageLocation->getUrl($filename).'">'.$filename.'</a><br />';
$uploadControl .= deleteIcon("func=deleteFile&filename=".$filename,$self->get("url"),WebGUI::International::get("delete file warning","Collaboration"))
.' <a href="'.$self->getStorageLocation->getUrl($filename).'">'.$filename.'</a>'
.'<br />';
$i++;
}
return $uploadControl unless ($i < $maxAttachments);
@ -650,7 +652,7 @@ sub processPropertiesFromFormPost {
$data{endDate} = $self->getThread->getParent->get("endDate") unless ($session{form}{endDate});
($data{synopsis}, $data{content}) = $self->getSynopsisAndContentFromFormPost;
if ($self->getThread->getParent->get("addEditStampToPosts")) {
$data{content} .= "\n\n --- (Edited on ".WebGUI::DateTime::epochToHuman()." by ".$session{user}{alias}.") --- \n";
$data{content} .= "\n\n --- (Edited on ".WebGUI::DateTime::epochToHuman(undef,"%z %Z [GMT%O]")." by ".$session{user}{alias}.") --- \n";
if ($self->getValue("contentType") eq "mixed" || $self->getValue("contentType") eq "html") {
$data{content} = '<p>'.$data{content}.'</p>';
}
@ -809,6 +811,14 @@ sub www_approve {
return $self->www_view;
}
#-------------------------------------------------------------------
sub www_deleteFile {
my $self = shift;
$self->getStorageLocation->deleteFile($session{form}{filename}) if $self->canEdit;
return $self->www_edit;
}
#-------------------------------------------------------------------
=head2 www_deny ( )
@ -883,7 +893,7 @@ sub www_edit {
value=>$session{form}{subscribe} || 1
});
}
$content .= "\n\n".$session{user}{signature} if ($session{user}{signature});
$content .= "\n\n".$session{user}{signature} if ($session{user}{signature} && !$session{form}{content});
} else { # edit
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
$var{'form.header'} = WebGUI::Form::formHeader({action=>$self->getUrl})

View file

@ -127,6 +127,7 @@ sub getName {
}
#-------------------------------------------------------------------
sub www_edit {
my $self = shift;
@ -145,10 +146,10 @@ A web executable method that redirects the user to the specified page, or displa
sub www_view {
my $self = shift;
if ($session{var}{adminOn}) {
return $self->www_edit;
return $self->getContainer->www_view;
}
WebGUI::HTTP::setRedirect($self->get("redirectUrl"));
return "";
return undef;
}

View file

@ -100,6 +100,18 @@ sub definition {
}
#-------------------------------------------------------------------
=head2 deletePageCache ( )
Deletes the rendered page cache for this wobject.
=cut
sub deletePageCache {
my $self = shift;
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
}
#-------------------------------------------------------------------
@ -395,6 +407,12 @@ sub processMacros {
}
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
$self->deletePageCache;
}
#-------------------------------------------------------------------
@ -553,13 +571,14 @@ sub setCollateral {
#-------------------------------------------------------------------
=head2 www_view ( )
=head2 www_view ( [ disableCache ] )
Renders self->view based upon current style, subject to timeouts. Returns Privilege::noAccess() if canView is False.
=cut
sub www_view {
my $self = shift;
my $disableCache = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
if ($self->get("encryptPage") && $session{env}{HTTPS} ne "on") {
WebGUI::HTTP::setRedirect($self->getUrl);
@ -569,12 +588,12 @@ sub www_view {
my $cache;
my $output;
my $useCache = (
$session{form}{op} eq "" && $session{form}{pn} eq "" &&
(
( $self->get("cacheTimeout") > 10 && $session{user}{userId} ne '1') ||
( $self->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')
) &&
not $session{var}{adminOn}
$session{form}{op} eq "" && $session{form}{pn} eq ""
&& (
( $self->get("cacheTimeout") > 10 && $session{user}{userId} ne '1')
|| ( $self->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')
)
&& !( $session{var}{adminOn} || $disableCache)
);
if ($useCache) {
$cache = WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId});

View file

@ -1025,6 +1025,14 @@ sub _xml_encode {
return $text;
}
#-------------------------------------------------------------------
sub www_view {
my $self = shift;
my $disableCache = ($session{form}{sortBy} ne "");
return $self->SUPER::www_view($disableCache);
}
#-------------------------------------------------------------------
# print out RSS 2.0 feed describing the items visible on the first page
sub www_viewRSS {
@ -1078,6 +1086,7 @@ sub www_viewRSS {
1;

View file

@ -159,7 +159,7 @@ sub view {
title=>$child->get("title"),
synopsis=>$child->get("synopsis"),
size=>WebGUI::Utility::formatBytes($child->get("assetSize")),
"date.epoch"=>$child->get("dateStamp"),
"date.epoch"=>$child->get("lastUpdated"),
"icon.small"=>$child->getIcon(1),
"icon.big"=>$child->getIcon,
type=>$child->getName,

View file

@ -387,6 +387,13 @@ sub www_edit {
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("26","IndexedSearch"));
}
#-------------------------------------------------------------------
sub www_view {
my $self = shift;
return $self->SUPER::www_view(1);
}
#-------------------------------------------------------------------
sub _buildPageList {
my ($self, @userSpecifiedRoots, @roots, @allowedRoots, $pageId, @pages);

View file

@ -340,8 +340,8 @@ sub view {
$pageData->{"page.isChild"} = ($asset->get("parentId") eq $current->getId);
$pageData->{"page.isParent"} = ($asset->getId eq $current->get("parentId"));
$pageData->{"page.isCurrent"} = ($asset->getId eq $current->getId);
$pageData->{"page.isDescendant"} = ( $currentLineage =~ m/^$pageLineage/ && !$pageData->{"page.isCurrent"});
$pageData->{"page.isAnscestor"} = ( $pageLineage =~ m/^$currentLineage/ && !$pageData->{"page.isCurrent"});
$pageData->{"page.isDescendant"} = ( $pageLineage =~ m/^$currentLineage/ && !$pageData->{"page.isCurrent"});
$pageData->{"page.isAncestor"} = ( $currentLineage =~ m/^$pageLineage/ && !$pageData->{"page.isCurrent"});
my $currentBranchLineage = substr($currentLineage,0,12);
$pageData->{"page.inBranchRoot"} = ($currentBranchLineage =~ m/^$pageLineage/);
$pageData->{"page.isSibling"} = (

View file

@ -368,6 +368,7 @@ sub www_vote {
$u = WebGUI::User->new($session{user}{userId});
$u->karma($self->get("karmaPerVote"),"Poll (".$self->getId.")","Voted on this poll.");
}
$self->deletePageCache;
}
return $self->getContainer->www_view;
}

View file

@ -621,7 +621,7 @@ sub url {
return $session{form}{$_[0]};
} elsif (_checkEmailAddy($session{form}{$_[0]})) {
return "mailto:".$session{form}{$_[0]};
} elsif ($session{form}{$_[0]} =~ /:\/\//) {
} elsif ($session{form}{$_[0]} =~ /^\// || $session{form}{$_[0]} =~ /:\/\// || $session{form}{$_[0]} =~ /^\^/) {
return $session{form}{$_[0]};
}
return "http://".$session{form}{$_[0]};

View file

@ -265,7 +265,11 @@ sub www_editGroup {
$f->readOnly($g->groupId,WebGUI::International::get(379));
$f->text("groupName",WebGUI::International::get(84),$g->name);
$f->textarea("description",WebGUI::International::get(85),$g->description);
$f->interval("expireOffset",WebGUI::International::get(367), WebGUI::DateTime::secondsToInterval($g->expireOffset));
$f->interval(
-name=>"expireOffset",
-label=>WebGUI::International::get(367),
-value=>$g->expireOffset
);
$f->yesNo(
-name=>"expireNotify",
-value=>$g->expireNotify,
@ -332,7 +336,11 @@ sub www_editGroup {
-value=>$g->dbQuery,
-label=>WebGUI::International::get(1005)
);
$f->interval("dbCacheTimeout",WebGUI::International::get(1004), WebGUI::DateTime::secondsToInterval($g->dbCacheTimeout));
$f->interval(
-name=>"dbCacheTimeout",
-label=>WebGUI::International::get(1004),
-value=>$g->dbCacheTimeout
);
$f->submit;
$output .= $f->print;
return _submenu($output,'87',"group add/edit");

View file

@ -1,6 +1,11 @@
package WebGUI::i18n::English::Collaboration;
our $I18N = {
'delete file warning' => {
message => q|Are you sure you wish to delete this file?|,
lastUpdated => 1109618544,
},
'display last reply' => {
message => q|Display last reply?|,
lastUpdated => 1109618544,

View file

@ -3,12 +3,12 @@
//Creates a new asset object.
function ManageTrash() {
var asset = new Asset();
asset.dragEnabled = false;
asset.allowMultiSelect = true;
//displays the right click context menu
asset.getContextMenu = function () {
var arr = new Array();
arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()");
arr[arr.length] = new ContextMenuItem(this.labels["restore"],"javascript:" + this.evalReference() + ".restore()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:" + this.evalReference() + ".purge()");
return arr;
@ -19,6 +19,10 @@ asset.purge = function() {
location.href = this.parent.getWrappedURL() + "func=purgeList" + AssetManager_getManager().getSelectedAssetIds();
}
asset.restore = function() {
location.href = this.parent.getWrappedURL() + "func=restoreList" + AssetManager_getManager().getSelectedAssetIds();
}
return asset;
}

View file

@ -21,16 +21,11 @@ function returnSelected(in_values) {
<select name="textPulldown" onchange="returnSelected(this.value)">
<option value=''>Collateral...</option>
<option value='^I("logo");'>Image</option>
<option value='^SI("logo","100");'>Scaled Image</option>
<option value='^Thumbnail("logo");'>Thumbnail</option>
<option value='^ThumbnailLinker("logo");'>Linked Thumbnail</option>
<option value='^File("product specs");'>File with Icon</option>
<option value='^i("status report");'>File URL</option>
<option value='^RandomImage("collateral folder");'>Random Image</option>
<option value='^RandomSnippet("collateral folder");'>Random Snippet</option>
<option value='^Snippet("flash code");'>Snippet</option>
<option value=''>Assets...</option>
<option value='^AssetProxy(url);'>Asset Proxy</option>
<option value='^RandomAssetProxy(url);'>Random Asset Proxy</option>
<option value='^FileUrl(assetUrl);'>File URL</option>
<option value='^Page(property name);'>Asset Property</option>
</select>
@ -56,7 +51,7 @@ function returnSelected(in_values) {
<option value='^Navigation(rootmenu);'>Root Menu (Horizontal)</option>
<option value='^H;'>Home Link</option>
<option value='^/;'>System URL</option>
<option value='^\;'>Current Page URL</option>
<option value='^PageUrl;'>Current Page URL</option>
</select>
@ -87,10 +82,10 @@ function returnSelected(in_values) {
<option value='^r;'>Make Page Printable</option>
<option value='^RootTitle;'>Root Title</option>
<option value='^Extras;'>Extras Folder</option>
<option value='^AdminBar(2);'>Admin Bar</option>
<option value='^AdminBar;'>Admin Bar</option>
</select>
</div>
</form>
</body></html>
</body></html>