diff --git a/docs/upgrades/upgrade_6.2.11-6.3.0.pl b/docs/upgrades/upgrade_6.2.11-6.3.0.pl index 696ef03fc..acd2891b2 100644 --- a/docs/upgrades/upgrade_6.2.11-6.3.0.pl +++ b/docs/upgrades/upgrade_6.2.11-6.3.0.pl @@ -967,7 +967,7 @@ while (my ($id, $template, $namespace) = $sth->array) { } elsif ($namespace eq "USS/Submission") { $newNamespace = "Collaboration/Thread"; if ($template =~ /attachment\.box/ixsg) { - my $box = '
'; + my $box = '
<tmpl_var attachment.name>
'; $template =~ s/\/$box/ixsg; } } @@ -1013,10 +1013,326 @@ while (my ($id, $template, $namespace) = $sth->array) { $template =~ s/back\.url/collaboration.url/ixsg; $template =~ s/submissions_loop/post_loop/ixsg; $template = '

'.$template; + my $replies = ' + +

+
+ + + + + + +
+

+
+
+ +
+ +
+
+
+ + + + + + + + + + + + + + + +
+ +
+ +
+
+
+ : + + + + + +
+ :
+
+
+ :
+ : + +     [ 1, 2, 3, 4, 5 ] + +
+ + :     [ | ]
+ + + :
+
+
+
+
+
+ +
+ +
+ + [] + + + [] + [] + +
+
+
+
+
+
+ + + + + + + + + + + + class="currentThread"> + + + + + + + +
   
+ +
+ + + + + + + +
+ +
+ +
+
+
+ : + + + + + +
+ :
+
+
+ :
+ : + +     [ 1, 2, 3, 4, 5 ] + +
+ + :     [ | ]
+ + + :
+
+
+
+
+
+ +
+ +
+ + [] + + + [] + [] + +
+
+
+
+
+ +
+ + + + + + + +
+
+ +
+ +
+
+
+ : + + + + + +
+ :
+
+
+ :
+ : + +     [ 1, 2, 3, 4, 5 ] + +
+ + :     [ | ]
+ + + :
+
+
+
+
+
+ +
+ +
+ + [] + + + [] + [] + +
+
+
+
+
+
+ +
+ + + + + + + + +
+ + + [] + + [] + + + [] + + [] + + + + + [] + + [] + + +
'; + $template =~ s//$replies/ixsg; WebGUI::SQL->write("update template set template=".quote($template).", namespace=".quote($newNamespace)." where templateId=".quote($id)." and namespace=".quote($namespace)); } $sth->finish; + + + print "\tMigrating EventsCalendar templates\n" unless ($quiet); my $sth = WebGUI::SQL->read("select templateId,template from template where namespace = 'EventsCalendar'"); while (my ($id, $template) = $sth->array) { @@ -1030,6 +1346,8 @@ while (my ($id, $template) = $sth->array) { $sth->finish; + + print "\tConverting template system to asset tree\n" unless ($quiet); WebGUI::SQL->write("update template set namespace='Layout' where namespace='page'"); WebGUI::SQL->write("alter table template add column assetId varchar(22) not null"); @@ -1089,7 +1407,7 @@ WebGUI::SQL->write("alter table template drop column name"); WebGUI::SQL->write("delete from template where assetId is null or assetId = ''"); # protect ourselves from crap WebGUI::SQL->write("alter table template add primary key (assetId)"); my @wobjectTypes = qw(Article Poll Survey WSClient DataForm Layout EventsCalendar Navigation HttpProxy IndexedSearch MessageBoard Product SQLReport SyndicatedContent Shortcut); -my @allWobjectTypes = (@wobjectTypes,@otherWobjects); +my @allWobjectTypes = (@wobjectTypes,@otherWobjects,'Folder'); print "\t\tMigrating wobject templates to new IDs\n" unless ($quiet); foreach my $type (@allWobjectTypes) { print "\t\t\t$type\n" unless ($quiet); @@ -1532,11 +1850,11 @@ sub walkTree { WebGUI::SQL->write("update wobject set namespace='Navigation' where assetId=".quote($wobjectId)); } elsif ($wobject->{namespace} eq "FileManager") { print "\t\t\tConverting File Manager ".$wobject->{wobjectId}." into File Folder\n" unless ($quiet); - WebGUI::SQL->write("update asset set className='WebGUI::Asset::Folder' where assetId=".quote($wobjectId)); + WebGUI::SQL->write("update asset set className='WebGUI::Asset::Wobject::Folder' where assetId=".quote($wobjectId)); WebGUI::SQL->write("insert into Folder (assetId,templateId) values (".quote($wobjectId).", '15')"); WebGUI::SQL->write("update wobject set namespace='Folder' where wobjectId=".quote($wobject->{wobjectId})); print "\t\t\tMigrating attachments for File Manager ".$wobject->{wobjectId}."\n" unless ($quiet); - my $sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".quote($wobjectId)." order by sequenceNumber"); + my $sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".quote($wobject->{wobjectId})." order by sequenceNumber"); my $rank = 1; while (my $data = $sth->hashRef) { foreach my $field ("downloadFile","alternateVersion1","alternateVersion2") { @@ -1559,7 +1877,7 @@ sub walkTree { WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, className, state, title, menuTitle, url, startDate, endDate, isHidden, ownerUserId, groupIdView, groupIdEdit, synopsis, assetSize ) values (". - quote($newId).", ".quote($wobjectId).", ".quote($wobjectLineage.sprintf("%06d",1)).", + quote($newId).", ".quote($wobjectId).", ".quote($wobjectLineage.sprintf("%06d",$rank)).", '".$class."','published',".quote($data->{fileTitle}).", ". quote($data->{fileTitle}).", ".quote(fixUrl($newId,$wobjectUrl.'/'.$data->{$field})).", ".quote($wobject->{startDate}).", ".quote($wobject->{endDate}).", 1, ".quote($ownerId).", @@ -1669,6 +1987,14 @@ sub walkTree { lineage=>$threadLineage, isHidden => 1 }); + my $storageId; + if ($submission->{image}) { + $storageId = copyFile($submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId}); + copyFile('thumb-'.$submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId},$storageId); + } + if ($submission->{attachment}) { + $storageId = copyFile($submission->{attachment},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId},$storageId); + } WebGUI::SQL->setRow("Post","assetId",{ assetId=>$id, threadId=>$id, @@ -1684,6 +2010,7 @@ sub walkTree { userDefined3=>$submission->{userDefined3}, userDefined4=>$submission->{userDefined4}, userDefined5=>$submission->{userDefined5}, + storageId=>$storageId, rating=>0 },undef,$id); my $threadSubscriptionGroup = WebGUI::Group->new("new"); @@ -1740,13 +2067,6 @@ sub walkTree { rating=>$post->{rating} },undef,$postId); $postRank++; - if ($submission->{image}) { - my $storageId = copyFile($submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId}); - copyFile('thumb-'.$submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId},$storageId); - } - if ($submission->{attachment}) { - my $storageId = copyFile($submission->{attachment},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId}); - } } $posts->finish; WebGUI::SQL->setRow("Thread","assetId",{ diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index a2a38f706..f11cead7e 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -444,7 +444,9 @@ Completely remove an asset from existence. sub DESTROY { my $self = shift; - $self->{_parent}->DESTROY if (exists $self->{_parent}); + # something bad happens when the following is enabled, not sure why + # must check this out later + #$self->{_parent}->DESTROY if (exists $self->{_parent}); $self->{_firstChild}->DESTROY if (exists $self->{_firstChild}); $self->{_lastChild}->DESTROY if (exists $self->{_lastChild}); $self = undef; diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 8b86944f8..c033e3dca 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -43,7 +43,7 @@ sub definition { my $class = shift; my $definition = shift; push(@{$definition}, { - tableName=>'EventsCalendar_Event', + tableName=>'EventsCalendar_event', className=>'WebGUI::Asset::Event', properties=>{ description => { @@ -392,7 +392,7 @@ sub www_deleteEventConfirm { my $self = shift; return WebGUI::Privilege::insufficient() unless ($self->canEdit); if ($session{form}{rid} ne "") { - my $where = "EventsCalendar_Event.EventsCalendar_recurringId=".quote($session{form}{rid}); + my $where = "EventsCalendar_event.EventsCalendar_recurringId=".quote($session{form}{rid}); my $series = $self->getParent->getLineage(["descendants"],{returnObjects=>1, joinClass=>"WebGUI::Asset::Event",whereClause=>$where}); foreach my $trashedEvent (@{$series}) { diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 8e35a2372..c95e9c3e7 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -157,7 +157,6 @@ sub definition { sub DESTROY { my $self = shift; $self->{_thread}->DESTROY if (exists $self->{_thread}); - $self->{_storageLocation}->DESTROY if (exists $self->{_storageLocation}); $self->SUPER::DESTROY; } diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index b621539f1..f4c252cd9 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -186,6 +186,7 @@ sub getNextThread { order by ".$self->getParent->getValue("sortBy")." asc ",WebGUI::SQL->getSlave) ); + delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/); }; return $self->{_next}; } @@ -218,6 +219,7 @@ sub getPreviousThread { ) order by ".$self->getParent->getValue("sortBy")." desc ",WebGUI::SQL->getSlave) ); + delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/); }; return $self->{_previous}; } diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm index 4acfd7095..ee921fa06 100644 --- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm @@ -217,7 +217,6 @@ sub view { my $self = shift; - return WebGUI::Privilege::noAccess() unless $self->canView; #define default view month range. Note that this could be different from #the range a user is allowed to view - set by the events calendar limitations. my $monthRangeLength = int($self->getValue("paginateAfter")); diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 4634d4d77..91af30b84 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -156,7 +156,7 @@ sub view { push(@{$vars{"position".$i."_loop"}},{ id=>$child->getId, content=>$child->view - }); + }) if $child->canView; push(@found, $child->getId); } } @@ -169,7 +169,7 @@ sub view { push(@{$vars{"position1_loop"}},{ id=>$child->getId, content=>$child->view - }); + }) if $child->canView; } } $vars{showAdmin} = ($session{var}{adminOn} && $self->canEdit); diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index 3c9848b70..82ace355f 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -272,19 +272,19 @@ sub view { my $skip = 0; my $pageLineage = $asset->get("lineage"); foreach my $lineage (@linesToSkip) { - $skip = 1 if ($lineage =~ m/^$pageLineage/); + $skip = 1 if ($pageLineage =~ m/^$lineage/); } next if ($skip); if ($asset->get("isHidden") && !$self->get("showHiddenPages")) { - push (@linesToSkip,$asset->getId); + push (@linesToSkip,$asset->get("lineage")) unless ($asset->get("lineage") eq "000001"); next; } if ($asset->get("isSystem") && !$self->get("showSystemPages")) { - push (@linesToSkip,$asset->getId); + push (@linesToSkip,$asset->get("lineage")) unless ($asset->get("lineage") eq "000001"); next; } unless ($self->get("showUnprivilegedPages") || $asset->canView) { - push (@linesToSkip,$asset->getId); + push (@linesToSkip,$asset->get("lineage")) unless ($asset->get("lineage") eq "000001"); next; } my $pageData = {}; diff --git a/lib/WebGUI/Style.pm b/lib/WebGUI/Style.pm index 87dacfb7e..f97643e9e 100644 --- a/lib/WebGUI/Style.pm +++ b/lib/WebGUI/Style.pm @@ -138,7 +138,13 @@ sub process { } $var{'head.tags'} .= generateAdditionalHeadTags(); $var{'head.tags'} .= "\n\n"; - my $output = WebGUI::Asset::Template->new($templateId)->process(\%var); + my $style = WebGUI::Asset::Template->new($templateId); + my $output; + if (defined $style) { + $output = $style->process(\%var); + } else { + $output = "WebGUI was unable to instanciate your style template.".$var{'body.content'}; + } $output = WebGUI::Macro::process($output); my $macroHeadTags = generateAdditionalHeadTags(); $macroHeadTags = WebGUI::Macro::process($macroHeadTags);