all wobjects integrated into new discussion system
This commit is contained in:
parent
65a9ecbd34
commit
2302c372fb
6 changed files with 43 additions and 18 deletions
|
|
@ -58,12 +58,6 @@ create table forumRead (
|
||||||
primary key (userId, forumPostId)
|
primary key (userId, forumPostId)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table forumBookmark (
|
|
||||||
userId int not null,
|
|
||||||
forumPostId int not null,
|
|
||||||
primary key (userId, forumPostId)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table forumThreadSubscription (
|
create table forumThreadSubscription (
|
||||||
forumThreadId int not null,
|
forumThreadId int not null,
|
||||||
userId int not null,
|
userId int not null,
|
||||||
|
|
|
||||||
|
|
@ -660,12 +660,21 @@ If you want to add anything special to the form header like javascript actions o
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub formHeader {
|
sub formHeader {
|
||||||
my ($action, $method, $enctype);
|
my $action = $_[0]->{action} || WebGUI::URL::page();
|
||||||
$action = $_[0]->{action} || WebGUI::URL::page();
|
my $hidden;
|
||||||
$method = $_[0]->{method} || "POST";
|
if ($action =~ /\?/) {
|
||||||
$enctype = $_[0]->{enctype} || "multipart/form-data";
|
my ($path,$query) = split(/\?/,$action);
|
||||||
return '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$_[0]->{extras}.'>';
|
$action = $path;
|
||||||
|
my @params = split(/\&/,$query);
|
||||||
|
foreach my $param (@params) {
|
||||||
|
$param =~ s/amp;(.*)/$1/;
|
||||||
|
my ($name,$value) = split(/\=/,$param);
|
||||||
|
$hidden .= hidden({name=>$name,value=>$value});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $method = $_[0]->{method} || "POST";
|
||||||
|
my $enctype = $_[0]->{enctype} || "multipart/form-data";
|
||||||
|
return '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$_[0]->{extras}.'>'.$hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,14 +92,13 @@ sub new {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub purge {
|
sub purge {
|
||||||
my ($self);
|
my ($self) = @_;
|
||||||
my $a = WebGUI::SQL->read("select * from forumThread where forumId=".$self->get("forumId"));
|
my $a = WebGUI::SQL->read("select * from forumThread where forumId=".$self->get("forumId"));
|
||||||
while (my ($threadId) = $a->array) {
|
while (my ($threadId) = $a->array) {
|
||||||
my $b = WebGUI::SQL->read("select * from forumPost where forumThreadId=".$threadId);
|
my $b = WebGUI::SQL->read("select * from forumPost where forumThreadId=".$threadId);
|
||||||
while (my ($postId) = $b->array) {
|
while (my ($postId) = $b->array) {
|
||||||
WebGUI::SQL->write("delete from forumPostAttachment where forumPostId=".$postId);
|
WebGUI::SQL->write("delete from forumPostAttachment where forumPostId=".$postId);
|
||||||
WebGUI::SQL->write("delete from forumPostRating where forumPostId=".$postId);
|
WebGUI::SQL->write("delete from forumPostRating where forumPostId=".$postId);
|
||||||
WebGUI::SQL->write("delete from forumBookmark where forumPostId=".$postId);
|
|
||||||
}
|
}
|
||||||
$b->finish;
|
$b->finish;
|
||||||
WebGUI::SQL->write("delete from forumThreadSubscription where forumThreadId=".$threadId);
|
WebGUI::SQL->write("delete from forumThreadSubscription where forumThreadId=".$threadId);
|
||||||
|
|
|
||||||
|
|
@ -745,8 +745,10 @@ NOTE: This method is meant to be extended by all sub-classes.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub purge {
|
sub purge {
|
||||||
my $forum = WebGUI::Forum->new($_[0]->get("forumId"));
|
if ($_[0]->get("forumId")) {
|
||||||
$forum->purge;
|
my $forum = WebGUI::Forum->new($_[0]->get("forumId"));
|
||||||
|
$forum->purge;
|
||||||
|
}
|
||||||
WebGUI::SQL->write("delete from ".$_[0]->get("namespace")." where wobjectId=".$_[0]->get("wobjectId"));
|
WebGUI::SQL->write("delete from ".$_[0]->get("namespace")." where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
WebGUI::SQL->write("delete from wobject where wobjectId=".$_[0]->get("wobjectId"));
|
WebGUI::SQL->write("delete from wobject where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
my $node = WebGUI::Node->new($_[0]->get("wobjectId"));
|
my $node = WebGUI::Node->new($_[0]->get("wobjectId"));
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,18 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub purge {
|
||||||
|
my $sth = WebGUI::SQL->read("select forumId from MessageBoard_forums where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
|
while (my ($forumId) = $sth->array) {
|
||||||
|
my $forum = WebGUI::Forum->new($forumId);
|
||||||
|
$forum->purge;
|
||||||
|
}
|
||||||
|
$sth->finish;
|
||||||
|
WebGUI::SQL->write("delete from MessageBoard_forums where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
|
$_[0]->SUPER::purge();
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_deleteForum {
|
sub www_deleteForum {
|
||||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
|
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
|
||||||
|
|
@ -68,6 +80,7 @@ sub www_deleteForumConfirm {
|
||||||
my $forum = WebGUI::Forum->new($session{form}{forumId});
|
my $forum = WebGUI::Forum->new($session{form}{forumId});
|
||||||
$forum->purge;
|
$forum->purge;
|
||||||
WebGUI::SQL->write("delete from MessageBoard_forums where forumId=".$session{form}{forumId});
|
WebGUI::SQL->write("delete from MessageBoard_forums where forumId=".$session{form}{forumId});
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,12 @@ sub new {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub purge {
|
sub purge {
|
||||||
|
my $sth = WebGUI::SQL->read("select forumId from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
|
while (my ($forumId) = $sth->array) {
|
||||||
|
my $forum = WebGUI::Forum->new($forumId);
|
||||||
|
$forum->purge;
|
||||||
|
}
|
||||||
|
$sth->finish;
|
||||||
WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
|
WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
|
||||||
$_[0]->SUPER::purge();
|
$_[0]->SUPER::purge();
|
||||||
}
|
}
|
||||||
|
|
@ -178,8 +184,10 @@ sub www_deleteSubmission {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_deleteSubmissionConfirm {
|
sub www_deleteSubmissionConfirm {
|
||||||
my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=$session{form}{sid}");
|
my ($owner, $forumId) = WebGUI::SQL->quickArray("select userId,forumId from USS_submission where USS_submissionId=$session{form}{sid}");
|
||||||
if ($owner == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
|
if ($owner == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
|
||||||
|
my $forum = WebGUI::Forum->new($forumId);
|
||||||
|
$forum->purge;
|
||||||
$_[0]->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
$_[0]->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
||||||
my $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
|
my $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
|
||||||
$file->deleteNode;
|
$file->deleteNode;
|
||||||
|
|
@ -566,7 +574,7 @@ sub www_viewSubmission {
|
||||||
$var{"attachment.name"} = $file->getFilename;
|
$var{"attachment.name"} = $file->getFilename;
|
||||||
}
|
}
|
||||||
if ($_[0]->get("allowDiscussion")) {
|
if ($_[0]->get("allowDiscussion")) {
|
||||||
if ($session{form}{forumOp}) {
|
if ($session{form}{forumOp}) {
|
||||||
$var{"replies"} = WebGUI::Forum::UI::forumOp($callback);
|
$var{"replies"} = WebGUI::Forum::UI::forumOp($callback);
|
||||||
} else {
|
} else {
|
||||||
$var{"replies"} = WebGUI::Forum::UI::www_viewForum($callback,$submission->{forumId});
|
$var{"replies"} = WebGUI::Forum::UI::www_viewForum($callback,$submission->{forumId});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue