From c6a89ddfdff2bb1334b516df32380dd13a8f0bf4 Mon Sep 17 00:00:00 2001 From: Leendert Bottelberghs Date: Wed, 25 Aug 2004 11:08:12 +0000 Subject: [PATCH] RFE [ 855761 ]. Move forum to another Message Board. --- lib/WebGUI/Wobject/MessageBoard.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Wobject/MessageBoard.pm b/lib/WebGUI/Wobject/MessageBoard.pm index 96355b54a..e7d19a8e3 100644 --- a/lib/WebGUI/Wobject/MessageBoard.pm +++ b/lib/WebGUI/Wobject/MessageBoard.pm @@ -194,6 +194,22 @@ sub www_editForum { -label=>WebGUI::International::get(85) ); $f->raw(WebGUI::Forum::UI::forumProperties($forum->get("forumId"))); + if($session{form}{forumId} ne "new"){ + my ($sth, $data, %MBoards); + tie %MBoards, "Tie::IxHash"; + $MBoards{0} = "--- Move Forum ---"; + $sth = WebGUI::SQL->read("SELECT wobject.wobjectId, wobject.title as wobjectTitle, page.title as pageTitle FROM wobject LEFT JOIN page using(pageId) WHERE wobject.namespace='MessageBoard' and page.pageId NOT IN (2,3,4,5) AND wobject.wobjectId!=".quote($_[0]->get("wobjectId"))." order by page.title ASC"); + while ($data = $sth->hashRef){ + $MBoards{$data->{wobjectId}} = $data->{pageTitle}." - ".$data->{wobjectTitle}; + } + $f->selectList( + -name=>"toMBoardId", + -label=>"Move Forum to Message Board", + -options=>\%MBoards, + -value=>[$session{form}{toMBoardId}] + ); + } + $f->submit; return helpIcon("forum add/edit",$_[0]->get("namespace")).'

'.WebGUI::International::get(77,$_[0]->get("namespace")).'

'.$f->print; } @@ -208,7 +224,12 @@ sub www_editForumSave { WebGUI::SQL->write("insert into MessageBoard_forums (wobjectId, forumId, title, description, sequenceNumber) values (" .quote($_[0]->get("wobjectId")).", ".quote($forumId).", ".quote($session{form}{title}).", ".quote($session{form}{description}) .", ".$seq.")"); - } else { + }elsif($session{form}{toMBoardId} ne 0){ + # WebGUI::SQL->write("update MessageBoard_forums set wobjectId=".quote($session{form}{toMBoardId})." where forumId=".quote($forumId)." and wobjectId=".quote($_[0]->get("wobjectId"))); + WebGUI::SQL->write("update MessageBoard_forums set wobjectId=".quote($session{form}{toMBoardId}).", title=".quote($session{form}{title}).", description=" + .quote($session{form}{description})." where forumId=".quote($forumId)." and wobjectId=".quote($_[0]->get("wobjectId"))); + + }else{ WebGUI::SQL->write("update MessageBoard_forums set title=".quote($session{form}{title}).", description=" .quote($session{form}{description})." where forumId=".quote($forumId)." and wobjectId=".quote($_[0]->get("wobjectId"))); }