From 5efbd4a7096d21c84ec66064af8e2d534b713d38 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 21 Sep 2005 20:04:15 +0000 Subject: [PATCH] - The export system now attempts to create the export path if it doesn't already exist. - fix [ 1287741 ] 6.7.3 Cannot insert a WebGUI collateral image in IE. - fix [ 1293163 ] Error when using Syndication - fix [ 1295718 ] Moderating submissions/posts is broken - fix [ 1288770 ] Couldn't call method www_view on asset - fix [ 1278672 ] Timezones does not still not work properly in webgui --- docs/changelog/6.x.x.txt | 11 ++++++++++- lib/WebGUI/Asset.pm | 5 +++++ lib/WebGUI/Asset/Post.pm | 4 ++-- lib/WebGUI/Asset/Post/Thread.pm | 2 +- lib/WebGUI/Asset/Wobject/Collaboration.pm | 5 ++--- lib/WebGUI/AssetExportHtml.pm | 5 ++++- lib/WebGUI/AssetVersioning.pm | 4 ++-- lib/WebGUI/DateTime.pm | 7 ++++++- 8 files changed, 32 insertions(+), 11 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 9194150c2..a3eb306dd 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -8,7 +8,8 @@ - Workedaround a bug for broken xml docs in Syndicated Content. (mwilson) - fix [ 1293947 ] 6.7.3 Cannot use a second AssetProxy with IE, Stack overflow (Wouter van Oijen / ProcoliX) - Added a few more performance enhanceers which can cut the number of - database queries per page in half in some cases. + database queries per page in half in some cases. And can reduce the number + of queries on Collaboration System related pages even further. - fix [ 1292597 ] Trash not emptied - fix [ 1292209 ] purgeTree called in runHourly.pl (6.7.4) - fix [ 1290600 ] 6.6.5-6.7.0 upgrade script (fix) (Nicklous Roberts) @@ -22,6 +23,14 @@ - fix [ 1295921 ] Problem with Survey content. - fix [ 1290460 ] Survey error when adding multiple choice answers - fix [ 1288887 ] new user information mail dos'nt contains the username + - The export system now attempts to create the export path if it doesn't + already exist. + - fix [ 1287741 ] 6.7.3 Cannot insert a WebGUI collateral image in IE. + - fix [ 1293163 ] Error when using Syndication + - fix [ 1295718 ] Moderating submissions/posts is broken + - fix [ 1288770 ] Couldn't call method www_view on asset + - fix [ 1278672 ] Timezones does not still not work properly in webgui + 6.7.4 - fix [ 1279861 ] POD errors in 6.7.3 diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index f2b64c9b4..217033c64 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -204,6 +204,11 @@ sub definition { fieldType=>'dateTime', defaultValue=>32472169200 }, + status=>{ + noFormPost=>1, + fieldType=>'hidden', + defaultValue=>'approved' + }, assetSize=>{ noFormPost=>1, fieldType=>'hidden', diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index e18745f2b..04d1ad71d 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -756,7 +756,7 @@ Sets the post to approved and sends any necessary notifications. sub setStatusApproved { my $self = shift; - $self->update({status=>'approved'}); + $self->commit; $self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if $self->isReply; unless ($self->isPoster) { WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->getUrl,579); @@ -810,7 +810,7 @@ sub setStatusPending { } else { $self->update({status=>'pending'}); WebGUI::MessageLog::addInternationalizedEntry('',$self->getThread->getParent->get("moderateGroupId"), - $self->getUrl("func=view"),578,'WebGUI','pending'); + $self->getUrl,578,'WebGUI','pending'); } } diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 4619cedb7..8c9eb7350 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -650,7 +650,7 @@ sub view { $var->{'unlock.url'} = $self->getUnlockUrl; my $p = WebGUI::Paginator->new($self->getUrl,$self->getParent->get("postsPerPage")); - my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) from asset + my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) as revisionDate from asset left join assetData on assetData.assetId=asset.assetId left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate where asset.lineage like ".quote($self->get("lineage").'%') diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index ce9c524d4..581383591 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -41,7 +41,6 @@ sub appendPostListTemplateVars { my $page = $p->getPageData; my $i = 0; foreach my $row (@$page) { - #my $post = WebGUI::Asset::Wobject::Collaboration->newByPropertyHashRef($row); my $post = WebGUI::Asset::Wobject::Collaboration->new($row->{assetId}, $row->{className}, $row->{revisionDate}); $post->{_parent} = $self; # caching parent for efficiency my $controls = deleteIcon('func=delete',$post->get("url"),"Delete").editIcon('func=edit',$post->get("url")); @@ -903,7 +902,7 @@ sub view { $constraints .= " or assetData.status='pending'"; } $constraints .= ")"; - my $sql = "select asset.assetId,asset.className,max(assetData.revisionDate) + my $sql = "select asset.assetId,asset.className,max(assetData.revisionDate) as revisionDate from Thread left join asset on Thread.assetId=asset.assetId left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate @@ -1030,7 +1029,7 @@ sub www_search { } # please note that the SQL generated here-in is not for the feint of heart, mind, or stomach # this is for trained professionals only and should not be attempted at home - my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) + my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) as revisionDate from asset left join assetData on assetData.assetId=asset.assetId left join Post on Post.assetId=assetData.assetId and assetData.revisionDate = Post.revisionDate diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index 4eed53c7c..836c8941f 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -54,7 +54,10 @@ sub checkExportPath { Make sure that the webserver has permissions to write to that directory'; } } else { - $error .= 'Error: The export path '.$session{config}{exportPath}.' does not exist.'; + eval {mkpath($session{config}{exportPath},0)}; + if ($@) { + $error .= 'Error: The export path '.$session{config}{exportPath}.' does not exist, and couldn\'t create it because '.$@; + } } } else { $error.= 'Error: The export path is not configured. Please set the exportPath variable in the WebGUI config file'; diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index b61261c9a..83fd3c642 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -70,8 +70,8 @@ sub addRevision { my $newVersion = WebGUI::Asset->new($self->getId, $self->get("className"), $now); $newVersion->updateHistory("created revision"); $newVersion->update($self->get); - $newVersion->update($properties) if ($properties); $newVersion->setVersionLock unless ($session{setting}{autoCommit}); + $newVersion->update($properties) if ($properties); return $newVersion; } @@ -127,7 +127,7 @@ Unlock's the asset and sets it to approved. sub commit { my $self = shift; $self->unsetVersionLock; - WebGUI::SQL->write("update assetData set status='approved' where assetId=".quote($self->getId)." and revisionDate=".quote($self->get("revisionDate"))); + $self->update({status=>'approved'}); $self->purgeCache; } diff --git a/lib/WebGUI/DateTime.pm b/lib/WebGUI/DateTime.pm index 704acf994..c6663a34e 100644 --- a/lib/WebGUI/DateTime.pm +++ b/lib/WebGUI/DateTime.pm @@ -744,8 +744,13 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. =cut sub setToEpoch { + my $set = shift; + # in epochToSet we use epochToHuman, which includes the time + # offset of the user, so we need to remove that here. + my $offset = $session{user}{timeOffset} || 0; + $set -= $offset*3600; my @now = epochToArray(WebGUI::DateTime::time()); - my ($date,$time) = split(/ /,$_[0]); + my ($date,$time) = split(/ /,$set); my ($year, $month, $day) = split(/\-/,$date); my ($hour, $minute, $second) = split(/\:/,$time); if (int($year) < 3000 && int($year) > 1000) {