many bug fixes

This commit is contained in:
JT Smith 2005-03-16 01:23:58 +00:00
parent caf9b3089e
commit ae2acfffd8
12 changed files with 177 additions and 34 deletions

View file

@ -1,3 +1,23 @@
6.5.2
- Fixed a caching bug in the collaboration system that wouldn't allow you to
view other posts if you were in threaded mode.
- fix [ 1160969 ] 6.5.x plainblack.com - Second edit of Post fails
- fix [ 1161571 ] 6.5.0, pagination on view forum always returns page 1
- fix [ 1163780 ] Pagination not working for Thread in Nested view
- fix [ 1163761 ] session from 10.0.0.2 in create.sql
- fix [ 1160971 ] 6.5.x - Use Preview setting ignored in collaboration
systems
- fix [ 1159395 ] Rating causes Problem with request
- fix [ 1150169 ] archive posts
- fix [ 1149830 ] Collaboration System privileges not correct
- fix [ 1157197 ] content filters shows only word to be replaced
- fix [ 1088201 ] Deleted discussion thread negatively offsets reply count
- fix [ 1162056 ] No default template for Data Form with no tabs
- fix [ 1029170 ] Forum: Sorting thread by date
- Fixed a sort by last reply crash bug.
- fix [ 1160947 ] Make page printable does not work
6.5.1
- Fixed a bug in the lineage tree that caused funky ranks to be created when
pasting assets.

View file

@ -2733,8 +2733,6 @@ CREATE TABLE userLoginLog (
--
INSERT INTO userLoginLog VALUES ('3','success',1109989498,'10.0.0.2','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1');
INSERT INTO userLoginLog VALUES ('3','success',1109989768,'10.0.0.2','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1');
--
-- Table structure for table `userProfileCategory`
@ -2869,11 +2867,6 @@ CREATE TABLE userSession (
--
INSERT INTO userSession VALUES ('82WNZSBtGILYo',1109992028,1109988428,0,'66.196.91.102','1');
INSERT INTO userSession VALUES ('19y/YcYUDLoHw',1109991892,1109988292,0,'68.142.251.125','1');
INSERT INTO userSession VALUES ('24jJHPg295S56',1109990899,1109987299,0,'68.142.250.47','1');
INSERT INTO userSession VALUES ('32eqpqD/QNpew',1109993461,1109989861,0,'10.0.0.2','3');
INSERT INTO userSession VALUES ('68RJ6HMaKCbp6',1110383374,1110379774,0,'','1');
--
-- Table structure for table `userSessionScratch`

View file

@ -0,0 +1,104 @@
#!/usr/bin/perl
use lib "../../lib";
use Getopt::Long;
use strict;
use WebGUI::Session;
use WebGUI::Asset;
my $configFile;
my $quiet;
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
WebGUI::Session::open("../..",$configFile);
#--------------------------------------------
print "\tAdding data form template\n" unless ($quiet);
my $template = <<STOP;
<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
<tmpl_if displayTitle>
<h1><tmpl_var title></h1>
</tmpl_if>
<tmpl_if error_loop>
<ul>
<tmpl_loop error_loop>
<li><b><tmpl_var error.message></b>
</tmpl_loop>
</ul>
</tmpl_if>
<tmpl_if description>
<tmpl_var description><p />
</tmpl_if>
<tmpl_if canEdit>
<a href="<tmpl_var entryList.url>"><tmpl_var entryList.label></a>
&middot; <a href="<tmpl_var export.tab.url>"><tmpl_var export.tab.label></a>
<tmpl_if entryId>
&middot; <a href="<tmpl_var delete.url>"><tmpl_var delete.label></a>
</tmpl_if>
<tmpl_if session.var.adminOn>
&middot; <a href="<tmpl_var addField.url>"><tmpl_var addField.label></a>
&middot; <a href="<tmpl_var addTab.url>"><tmpl_var addTab.label></a>
</tmpl_if>
<p />
</tmpl_if>
<table>
<tmpl_loop field_loop>
<tmpl_unless field.isHidden>
<tr>
<td class="formDescription" valign="top">
<tmpl_if session.var.adminOn>
<tmpl_if canEdit>
<tmpl_var field.controls>
</tmpl_if>
</tmpl_if>
<tmpl_var field.label>
</td>
<td class="tableData" valign="top">
<tmpl_if field.isDisplayed>
<tmpl_var field.value>
<tmpl_else>
<tmpl_var field.form>
</tmpl_if>
<tmpl_if field.isRequired>*</tmpl_if>
<span class="formSubtext">
<br />
<tmpl_var field.subtext>
</span>
</td>
</tr>
</tmpl_unless>
</tmpl_loop>
</table>
<br>
<tmpl_var form.save>
<tmpl_var form.end>
STOP
my $importNode = WebGUI::Asset->getImportNode;
$importNode->addChild({
className=>"WebGUI::Asset::Template",
template=>$template,
namespace=>"DataForm",
title=>'Default DataForm',
menuTitle=>'Default DataForm',
ownerUserId=>'3',
groupIdView=>'7',
groupIdEdit=>'4',
isHidden=>1
}, 'PBtmpl0000000000000141'
);
WebGUI::Session::close();

View file

@ -1,3 +1,4 @@
insert into webguiVersion values ('6.5.2','upgrade',unix_timestamp());
update template set template = '<a name=\"<tmpl_var assetId>\"></a> <h1><tmpl_var newheader></h1>\r\n\r\n<tmpl_var form.header>\r\n<table>\r\n\r\n<tmpl_if user.isVisitor>\r\n <tr><td><tmpl_var visitorName.label></td><td><tmpl_var visitorName.form></td></tr>\r\n</tmpl_if>\r\n\r\n<tr><td><tmpl_var subject.label></td><td><tmpl_var title.form></td></tr>\r\n<tr><td><tmpl_var message.label></td><td><tmpl_var content.form></td></tr>\r\n\r\n<tmpl_if newisNewMessage>\r\n <tmpl_unless user.isVisitor>\r\n <tr><td><tmpl_var subscribe.label></td><td><tmpl_var subscribe.form></td></tr>\r\n </tmpl_unless>\r\n <tmpl_if user.isModerator>\r\n <tr><td><tmpl_var lock.label></td><td><tmpl_var lock.form></td></tr>\r\n <tr><td><tmpl_var sticky.label></td><td><tmpl_var sticky.form></td></tr>\r\n </tmpl_if>\r\n</tmpl_if>\r\n\r\n<tr><td><tmpl_var contentType.label></td><td><tmpl_var contentType.form></td></tr>\r\n<tr><td></td><td><tmpl_if usePreview><tmpl_var form.preview></tmpl_if><tmpl_var form.submit></td></tr>\r\n\r\n</table>\r\n<tmpl_var form.footer>\r\n\r\n<p>\r\n<tmpl_var full>\r\n</p>' where assetId='PBtmpl0000000000000029';
update asset set endDate=32472169200 where endDate=9223372036854775807;
alter table asset change endDate endDate bigint(20) not null default 32472169200;

View file

@ -629,8 +629,6 @@ sub processPropertiesFromFormPost {
}
%data = (
ownerUserId => $session{user}{userId},
groupIdView => $self->getThread->getParent->get("groupIdView"),
groupIdEdit => $self->getThread->getParent->get("groupIdEdit"),
isHidden => 1,
dateSubmitted=>time()
);
@ -638,7 +636,11 @@ sub processPropertiesFromFormPost {
$self->getThread->lock if ($session{form}{'lock'});
$self->getThread->stick if ($session{form}{stick});
}
} else {
$data{ownerUserId} = $session{form}{userId};
}
$data{groupIdView} =$self->getThread->getParent->get("groupIdView");
$data{groupIdEdit} = $self->getThread->getParent->get("groupIdEdit");
$data{startDate} = $self->getThread->getParent->get("startDate") unless ($session{form}{startDate});
$data{endDate} = $self->getThread->getParent->get("endDate") unless ($session{form}{endDate});
($data{synopsis}, $data{content}) = $self->getSynopsisAndContentFromFormPost;
@ -832,14 +834,13 @@ sub www_edit {
value=>$session{form}{class}
});
$var{'isNewPost'} = 1;
$content = $session{form}{content};
$title = $session{form}{title};
if ($session{form}{class} eq "WebGUI::Asset::Post") { # new reply
$self->{_thread} = $self->getParent->getThread;
return WebGUI::Privilege::insufficient() unless ($self->getThread->canReply);
$var{isReply} = 1;
if ($session{form}{content} || $session{form}{title}) {
$content = $session{form}{content};
$title = $session{form}{title};
} else {
unless ($session{form}{content} || $session{form}{title}) {
$content = "[quote]".$self->getParent->get("content")."[/quote]" if ($session{form}{withQuote});
$title = $self->getParent->get("title");
$title = "Re: ".$title unless ($title =~ /^Re:/);
@ -873,6 +874,10 @@ sub www_edit {
.WebGUI::Form::hidden({
name=>"func",
value=>"edit"
})
.WebGUI::Form::hidden({
name=>"userId",
value=>$self->getValue("ownerUserId")
});
$var{isEdit} = 1;
$content = $self->getValue("content");
@ -993,7 +998,7 @@ sub www_view {
my $self = shift;
$self->markRead;
$self->incrementViews;
return $self->getThread->www_view;
return $self->getThread->www_view($self->getId);
}

View file

@ -728,6 +728,7 @@ sub www_unsubscribe {
#-------------------------------------------------------------------
sub www_view {
my $self = shift;
my $postId = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
my $cache;
my $output;
@ -742,7 +743,7 @@ sub www_view {
not $session{var}{adminOn}
);
if ($useCache) {
$cache = WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId});
$cache = WebGUI::Cache->new("cspost_".($postId||$self->getId)."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn});
$output = $cache->get;
}
unless ($output) {

View file

@ -530,7 +530,7 @@ sub getEditForm {
);
$tabform->getTab("properties")->yesNo(
-name=>"usePreview",
-label=>WebGUI::International::get('preview', 'Collaboration'),
-label=>WebGUI::International::get('use preview', 'Collaboration'),
-value=>$self->getValue("usePreview")
);
$tabform->getTab("security")->yesNo(
@ -737,9 +737,10 @@ Calculates the rating of this forum from its threads and stores the new value in
sub recalculateRating {
my $self = shift;
my ($count) = WebGUI::SQL->quickArray("select count(*) from Thread left join asset on Thread.assetId=asset.assetId
where asset.parentId=".quote($self->getId)." and Thread.rating>0");
left join Post on Thread.assetId=Post.assetId where asset.parentId=".quote($self->getId)." and Post.rating>0");
$count = $count || 1;
my ($sum) = WebGUI::SQL->quickArray("select sum(Thread.rating) from Thread left join asset on Thread.assetId=asset.assetId where asset.parentId=".quote($self->getId)." and Thread.rating>0");
my ($sum) = WebGUI::SQL->quickArray("select sum(Post.rating) from Thread left join asset on Thread.assetId=asset.assetId
left join Post on Thread.assetId=Post.assetId where asset.parentId=".quote($self->getId)." and Post.rating>0");
my $average = round($sum/$count);
$self->update({rating=>$average});
}
@ -835,12 +836,16 @@ sub view {
$constraints .= " or Post.status='pending'";
}
$constraints .= ")";
my $sortBy = $self->getValue("sortBy");
if ($sortBy eq "lastreply") {
$sortBy = "Thread.lastPostDate";
}
my $sql = "select *
from Thread
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 ".$self->getValue("sortBy")." ".$self->getValue("sortOrder");
order by ".$sortBy." ".$self->getValue("sortOrder");
my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage"));
$self->appendPostListTemplateVars(\%var, $sql, $p);
$self->appendTemplateLabels(\%var);

View file

@ -50,6 +50,14 @@ sub getEditForm {
}
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/messageBoard.gif' if ($small);
return $session{config}{extrasURL}.'/assets/messageBoard.gif';
}
#-------------------------------------------------------------------
sub getName {
return WebGUI::International::get(2,"MessageBoard");

View file

@ -89,11 +89,15 @@ sub www_editReplacementSave {
sub www_listReplacements {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my $output = '<table>';
my $sth = WebGUI::SQL->read("select replacementId,searchFor from replacements order by searchFor");
$output .= '<tr><td></td><td class="tableHeader">'.WebGUI::International::get(1050).'</td><td class="tableHeader">'.WebGUI::International::get(1051).'</td></tr>';
my $sth = WebGUI::SQL->read("select replacementId,searchFor,replaceWith from replacements order by searchFor");
while (my $data = $sth->hashRef) {
$output .= '<tr><td>'.deleteIcon("op=deleteReplacement&amp;replacementId=".$data->{replacementId})
.editIcon("op=editReplacement&amp;replacementId=".$data->{replacementId}).'</td>';
$output .= '<td class="tableData">'.$data->{searchFor}.'</td></tr>';
$data->{replaceWith} =~ s/\&/\&amp\;/g;
$data->{replaceWith} =~ s/\</\&lt\;/g;
$data->{replaceWith} =~ s/\>/\&gt\;/g;
$output .= '<td class="tableData">'.$data->{searchFor}.'</td><td class="tableData">'.$data->{replaceWith}.'</td></tr>';
}
$sth->finish;
$output .= '</table>';

View file

@ -109,8 +109,8 @@ sub process {
my %var;
$var{'body.content'} = shift;
my $templateId = shift;
if ($session{page}{makePrintable}) {
$templateId = $session{page}{printableStyleId};
if ($session{page}{makePrintable} && exists $session{asset}) {
$templateId = $session{asset}->get("printableStyleTemplateId");
} elsif ($session{scratch}{personalStyleId} ne "") {
$templateId = $session{scratch}{personalStyleId};
} elsif ($session{page}{useEmptyStyle}) {

View file

@ -406,7 +406,7 @@ our $I18N = {
lastUpdated => 1109698614,
},
'preview' => {
'use preview' => {
message => q|Use preview?|,
lastUpdated => 1109698614,
},

View file

@ -12,21 +12,23 @@ package Hourly::ArchiveOldPosts;
use strict;
use WebGUI::Asset::Post;
use WebGUI::DateTime;
use WebGUI::Session;
use WebGUI::SQL;
#-----------------------------------------
sub process {
return ""; # disabled for the time being
my $epoch = WebGUI::DateTime::time();
my $a = WebGUI::SQL->read("select assetId,archiveAfter,masterForumId from forum");
while (my $forum = $a->hashRef) {
my $archiveDate = $epoch - $forum->{archiveAfter};
my $b = WebGUI::SQL->read("select forumThreadId from forumThread where forumId=".quote($forum->{forumId})." and lastPostDate<$archiveDate");
while (my ($threadId) = $b->array) {
WebGUI::SQL->write("update forumPost set status='archived' where status='approved' and forumThreadId=".quote($threadId));
WebGUI::SQL->write("update forumThread set status='archived' where status='approved' and forumThreadId=".quote($threadId));
my $a = WebGUI::SQL->read("select asset.lineage,Collaboration.archiveAfter from Collaboration left join asset on Collaboration.assetId=asset.assetId");
while (my ($lineage, $archiveAfter) = $a->array) {
my $archiveDate = $epoch - $archiveAfter;
my $sql = "select * from Post left join asset on Post.assetId=asset.assetId left join Thread on Thread.assetId=Post.assetId
where Post.dateUpdated<$archiveDate and Post.status='approved' and asset.lineage like ".quote($lineage."%");
my $b = WebGUI::SQL->read($sql);
while (my $properties = $b->hashRef) {
my $post = WebGUI::Asset::Post->newByPropertyHashRef($properties);
$post->setStatusArchived;
}
$b->finish;
}