working out some kinks
This commit is contained in:
parent
b9de5b1a3c
commit
65a9ecbd34
5 changed files with 36 additions and 39 deletions
|
|
@ -193,7 +193,7 @@ sub www_view {
|
|||
$templateId = $_[0]->get("templateId");
|
||||
}
|
||||
if ($session{form}{forumOp}) {
|
||||
return WebGUI::Forum::UI::forumOp($callback,$_[0]->get("forumId"));
|
||||
return WebGUI::Forum::UI::forumOp($callback);
|
||||
} else {
|
||||
return $_[0]->processTemplate($templateId,\%var);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,27 +50,11 @@ sub new {
|
|||
my $property = shift;
|
||||
my $self = WebGUI::Wobject->new(
|
||||
-properties=>$property,
|
||||
-extendedProperties=>{
|
||||
messagesPerPage=>{
|
||||
defaultValue=>50
|
||||
}
|
||||
},
|
||||
-useTemplate=>1
|
||||
);
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub status {
|
||||
if ($_[0] eq "Approved") {
|
||||
return WebGUI::International::get(560);
|
||||
} elsif ($_[0] eq "Denied") {
|
||||
return WebGUI::International::get(561);
|
||||
} elsif ($_[0] eq "Pending") {
|
||||
return WebGUI::International::get(562);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteForum {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
|
||||
|
|
@ -89,14 +73,7 @@ sub www_deleteForumConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $properties = WebGUI::HTMLForm->new;
|
||||
my $layout = WebGUI::HTMLForm->new;
|
||||
$layout->integer(
|
||||
-name=>"messagesPerPage",
|
||||
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
|
||||
-value=>$_[0]->getValue("messagesPerPage")
|
||||
);
|
||||
return $_[0]->SUPER::www_edit(
|
||||
-layout=>$layout->printRowsOnly,
|
||||
-properties=>$properties->printRowsOnly,
|
||||
-headingId=>6,
|
||||
-helpId=>1
|
||||
|
|
@ -166,11 +143,6 @@ sub www_moveForumUp {
|
|||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_showMessage {
|
||||
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</a><br>');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my $callback = WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId"));
|
||||
|
|
@ -210,7 +182,7 @@ sub www_view {
|
|||
'forum.url' => WebGUI::Forum::UI::formatForumURL($callback,$forum->get("forumId")),
|
||||
'forum.lastPost.url' => WebGUI::Forum::UI::formatThreadURL($callback,$lastPost->get("forumPostId")),
|
||||
'forum.lastPost.date' => WebGUI::Forum::UI::formatPostDate($lastPost->get("dateOfPost")),
|
||||
'forum.lastPost.time' => WebGUI::Forum::UI::formatPostDate($lastPost->get("dateOfPost")),
|
||||
'forum.lastPost.time' => WebGUI::Forum::UI::formatPostTime($lastPost->get("dateOfPost")),
|
||||
'forum.lastPost.epoch' => $lastPost->get("dateOfPost"),
|
||||
'forum.lastPost.subject' => WebGUI::Forum::UI::formatSubject($lastPost->get("subject")),
|
||||
'forum.lastPost.user.id' => $lastPost->get("userId"),
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Forum;
|
||||
use WebGUI::Forum::UI;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
|
|
@ -314,6 +315,11 @@ sub www_editSubmissionSave {
|
|||
&& WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")))
|
||||
|| WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
|
||||
if ($session{form}{sid} eq "new") {
|
||||
my $forum = WebGUI::Forum->create({
|
||||
masterForumId=>$_[0]->get("forumId"),
|
||||
forumId=>"new"
|
||||
});
|
||||
$hash{forumId} = $forum->get("forumId");
|
||||
$hash{username} = $session{form}{visitorName} || $session{user}{alias};
|
||||
$hash{userId} = $session{user}{userId};
|
||||
$hash{USS_submissionId} = "new";
|
||||
|
|
@ -382,7 +388,7 @@ sub www_view {
|
|||
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
|
||||
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults);
|
||||
$p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username
|
||||
$p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username, forumId
|
||||
from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc");
|
||||
$page = $p->getPageData;
|
||||
$i = 0;
|
||||
|
|
@ -399,8 +405,8 @@ sub www_view {
|
|||
$thumbnail = "";
|
||||
$imageURL;
|
||||
}
|
||||
($responses) = WebGUI::SQL->quickArray("select count(*) from discussion
|
||||
where wobjectId=".$_[0]->get("wobjectId")." and subId=".$row->{USS_submissionId});
|
||||
($responses) = WebGUI::SQL->quickArray("select count(*) from forumPost left join forumThread on
|
||||
forumThread.forumThreadId=forumPost.forumThreadId where forumThread.forumId=".$row->{forumId});
|
||||
push (@submission,{
|
||||
"submission.id"=>$page->[$i]->{USS_submissionId},
|
||||
"submission.url"=>WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=viewSubmission&sid='.$page->[$i]->{USS_submissionId}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue