many bug fixes
This commit is contained in:
parent
caf9b3089e
commit
ae2acfffd8
12 changed files with 177 additions and 34 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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&replacementId=".$data->{replacementId})
|
||||
.editIcon("op=editReplacement&replacementId=".$data->{replacementId}).'</td>';
|
||||
$output .= '<td class="tableData">'.$data->{searchFor}.'</td></tr>';
|
||||
$data->{replaceWith} =~ s/\&/\&\;/g;
|
||||
$data->{replaceWith} =~ s/\</\<\;/g;
|
||||
$data->{replaceWith} =~ s/\>/\>\;/g;
|
||||
$output .= '<td class="tableData">'.$data->{searchFor}.'</td><td class="tableData">'.$data->{replaceWith}.'</td></tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
|
|
|
|||
|
|
@ -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}) {
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ our $I18N = {
|
|||
lastUpdated => 1109698614,
|
||||
},
|
||||
|
||||
'preview' => {
|
||||
'use preview' => {
|
||||
message => q|Use preview?|,
|
||||
lastUpdated => 1109698614,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue