Consolidating discussin functionality and added an option to turn of edit stamps in posts.
This commit is contained in:
parent
0266285465
commit
30999c9982
5 changed files with 116 additions and 247 deletions
|
|
@ -89,7 +89,7 @@ INSERT INTO international VALUES (512,'WebGUI','English','Next Thread');
|
|||
INSERT INTO international VALUES (513,'WebGUI','English','Previous Thread');
|
||||
delete from international where internationalId=10 and namespace='MessageBoard';
|
||||
delete from international where internationalId=14 and namespace='MessageBoard';
|
||||
|
||||
INSERT INTO settings VALUES ('addEditStampToPosts','1');
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
|
|
@ -85,39 +85,32 @@ sub deleteMessageConfirm {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub editMessage {
|
||||
my ($html, %message);
|
||||
tie %message, 'Tie::CPHash';
|
||||
%message = getMessage($session{form}{mid});
|
||||
$html = '<h1>'.WebGUI::International::get(228).'</h1>';
|
||||
$html .= formHeader().'<table>';
|
||||
$html .= WebGUI::Form::hidden("func","editMessageSave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
$html .= WebGUI::Form::hidden("mid",$session{form}{mid});
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).
|
||||
'</td><td>'.WebGUI::Form::text("subject",30,255,$message{subject}).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).
|
||||
'</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
$html .= showMessage();
|
||||
return $html;
|
||||
sub formatHeader {
|
||||
my $output;
|
||||
$output = '<b>'.WebGUI::International::get(237).'</b> '.formatSubject($_[0]).'<br>';
|
||||
$output .= '<b>'.WebGUI::International::get(238).'</b>
|
||||
<a href="'.WebGUI::URL::page('op=viewProfile&uid='.$_[1]).'">'.$_[2].'</a><br>';
|
||||
$output .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($_[3],"%z %Z")."<br>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub editMessageSave {
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
WebGUI::SQL->write("update discussion set subject=".quote($session{form}{subject}).
|
||||
", message=".quote("\n --- (Edited at ".localtime(time).
|
||||
" by $session{user}{username}) --- \n\n".$session{form}{message}).
|
||||
", subId='$session{form}{sid}' where messageId=$session{form}{mid}");
|
||||
return showMessage();
|
||||
sub formatMessage {
|
||||
my $output;
|
||||
$output = $_[0];
|
||||
$output = WebGUI::HTML::filter($output);
|
||||
unless ($output =~ /\<div\>/ig || $output =~ /\<br\>/ig || $output =~ /\<p\>/ig) {
|
||||
$output =~ s/\n/\<br\>/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub formatSubject {
|
||||
my $output;
|
||||
$output = $_[0];
|
||||
$output = WebGUI::HTML::filter($output,'all');
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -125,90 +118,86 @@ sub getMessage {
|
|||
my (%message);
|
||||
tie %message, 'Tie::CPHash';
|
||||
%message = WebGUI::SQL->quickHash("select * from discussion where messageId='$_[0]'");
|
||||
$message{subject} = WebGUI::HTML::filter($message{subject},'all');
|
||||
$message{message} = WebGUI::HTML::filter($message{message},$session{setting}{filterContributedHTML});
|
||||
unless ($message{message} =~ /\<div\>/ig || $message{message} =~ /\<br\>/ig || $message{message} =~ /\<p\>/ig) {
|
||||
$message{message} =~ s/\n/\<br\>/g;
|
||||
}
|
||||
return %message;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub postNewMessage {
|
||||
my ($html);
|
||||
$html = '<h1>'.WebGUI::International::get(231).'</h1>';
|
||||
$html .= formHeader().'<table>';
|
||||
$html .= WebGUI::Form::hidden("func","postNewMessageSave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
if ($session{user}{userId} == 1) {
|
||||
$html .= tableFormRow(WebGUI::International::get(438),WebGUI::Form::text("visitorName",30,35));
|
||||
sub post {
|
||||
my ($html, $header, $footer, $f, %message);
|
||||
tie %message, 'Tie::CPHash';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
if ($session{form}{replyTo} ne "") { # is a reply
|
||||
$header = WebGUI::International::get(234);
|
||||
%message = getMessage($session{form}{replyTo});
|
||||
$footer = formatHeader($message{subject},$message{userId},$message{username},$message{dateOfPost}).'<p>'.formatMessage($message{message});
|
||||
$message{message} = "";
|
||||
$message{subject} = formatSubject("Re: ".$message{subject});
|
||||
$session{form}{mid} = "new";
|
||||
$f->hidden("replyTo",$session{form}{replyTo});
|
||||
if ($session{user}{userId} == 1) {
|
||||
$f->text("visitorName",WebGUI::International::get(438));
|
||||
}
|
||||
} elsif ($session{form}{mid} eq "new") { # is an entirely new thread
|
||||
$header = WebGUI::International::get(231);
|
||||
if ($session{user}{userId} == 1) {
|
||||
$f->text("visitorName",WebGUI::International::get(438));
|
||||
}
|
||||
} else { # is editing an existing message
|
||||
$header = WebGUI::International::get(228);
|
||||
%message = getMessage($session{form}{mid});
|
||||
$footer = formatHeader($message{subject},$message{userId},$message{username},$message{dateOfPost}).'<p>'.formatMessage($message{message});
|
||||
$message{subject} = formatSubject($message{subject});
|
||||
}
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
$f->hidden("func","postSave");
|
||||
$f->hidden("wid",$session{form}{wid});
|
||||
$f->hidden("sid",$session{form}{sid});
|
||||
$f->hidden("mid",$session{form}{mid});
|
||||
$f->text("subject",WebGUI::International::get(229),$message{subject});
|
||||
$f->HTMLArea("message",WebGUI::International::get(230),$message{message});
|
||||
$f->submit;
|
||||
$html = '<h1>'.$header.'</h1>';
|
||||
$html .= $f->print;
|
||||
$html .= '<p/>'.$footer;
|
||||
return $html;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub postNewMessageSave {
|
||||
my ($mid, $visitor);
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
if ($session{form}{visitorName} eq "") {
|
||||
$visitor = $session{user}{username};
|
||||
} else {
|
||||
$visitor = $session{form}{visitorName};
|
||||
}
|
||||
$mid = getNextId("messageId");
|
||||
WebGUI::SQL->write("insert into discussion values ($mid, $mid, $session{form}{wid}, 0, $session{user}{userId}, ".quote($visitor).", ".quote($session{form}{subject}).", ".quote($session{form}{message}).", ".time().", '$session{form}{sid}')");
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub postReply {
|
||||
my ($html, $subject);
|
||||
($subject) = WebGUI::SQL->quickArray("select subject from discussion where messageId=$session{form}{mid}");
|
||||
$subject = "Re: ".$subject;
|
||||
$html = '<h1>'.WebGUI::International::get(234).'</h1>';
|
||||
$html .= formHeader().'<table>';
|
||||
$html .= WebGUI::Form::hidden("func","postReplySave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
$html .= WebGUI::Form::hidden("mid",$session{form}{mid});
|
||||
if ($session{user}{userId} == 1) {
|
||||
$html .= tableFormRow(WebGUI::International::get(438),WebGUI::Form::text("visitorName",30,35));
|
||||
}
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255,$subject).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
$html .= showMessage();
|
||||
return $html;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub postReplySave {
|
||||
my ($rid, $mid, $visitor);
|
||||
sub postSave {
|
||||
my ($rid, $username, $pid);
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
if ($session{form}{visitorName} eq "") {
|
||||
$visitor = $session{user}{username};
|
||||
} else {
|
||||
$visitor = $session{form}{visitorName};
|
||||
}
|
||||
$mid = getNextId("messageId");
|
||||
($rid) = WebGUI::SQL->quickArray("select rid from discussion where messageId=$session{form}{mid}");
|
||||
WebGUI::SQL->write("insert into discussion values ($mid, $rid, $session{form}{wid}, $session{form}{mid}, $session{user}{userId}, ".quote($visitor).", ".quote($session{form}{subject}).", ".quote($session{form}{message}).", ".time().", '$session{form}{sid}')");
|
||||
if ($session{form}{mid} eq "new") {
|
||||
if ($session{user}{userId} = 1) {
|
||||
if ($session{form}{visitorName} eq "") {
|
||||
$username = $session{user}{username};
|
||||
} else {
|
||||
$username = $session{form}{visitorName};
|
||||
}
|
||||
} else {
|
||||
$username = $session{user}{username};
|
||||
}
|
||||
if ($session{form}{sid} eq "") {
|
||||
$session{form}{sid} = 0;
|
||||
}
|
||||
$session{form}{mid} = getNextId("messageId");
|
||||
if ($session{form}{replyTo} ne "") {
|
||||
($rid) = WebGUI::SQL->quickArray("select rid from discussion where messageId=$session{form}{replyTo}");
|
||||
$pid = $session{form}{replyTo};
|
||||
} else {
|
||||
$rid = $session{form}{mid};
|
||||
$pid = 0;
|
||||
}
|
||||
WebGUI::SQL->write("insert into discussion (messageId, wobjectId, subId, rid, pid, userId, username) values
|
||||
($session{form}{mid},$session{form}{wid},$session{form}{sid},$rid,$pid,$session{user}{userId},".quote($username).")");
|
||||
} elsif ($session{setting}{addEditStampToPosts}) {
|
||||
$session{form}{message} = "\n --- (Edited at ".localtime(time)." by $session{user}{username}) --- \n\n".$session{form}{message};
|
||||
}
|
||||
WebGUI::SQL->write("update discussion set subject=".quote($session{form}{subject}).",
|
||||
message=".quote($session{form}{message}).", dateOfPost=".time()." where messageId=$session{form}{mid}");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -230,9 +219,7 @@ sub showMessage {
|
|||
if ($message{messageId}) {
|
||||
$html .= '<h1>'.$message{subject}.'</h1>';
|
||||
$html .= '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
|
||||
$html .= '<b>'.WebGUI::International::get(238).'</b>
|
||||
<a href="'.WebGUI::URL::page('op=viewProfile&uid='.$message{userId}).'">'.$message{username}.'</a><br>';
|
||||
$html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($message{dateOfPost},"%z %Z")."<br>";
|
||||
$html .= formatHeader($message{subject},$message{userId},$message{username},$message{dateOfPost});
|
||||
$html .= '</td>';
|
||||
$html .= '<td rowspan=2 valign="top" class="tableMenu" nowrap>';
|
||||
$html .= $_[0];
|
||||
|
|
@ -249,7 +236,7 @@ sub showMessage {
|
|||
$session{form}{wid}).'">'.WebGUI::International::get(512).' »</a><br>';
|
||||
}
|
||||
$html .= '</tr><tr><td class="tableData">';
|
||||
$html .= $message{message}.'<p>';
|
||||
$html .= formatMessage($message{message}).'<p>';
|
||||
$html .= '</td></tr></table>';
|
||||
} else {
|
||||
$html = WebGUI::International::get(402);
|
||||
|
|
@ -296,15 +283,10 @@ sub showThreads {
|
|||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
if ($session{user}{discussionLayout} eq "flat") {
|
||||
while (%data = $sth->hash) {
|
||||
$html .= '<tr><td class="tableHeader"><b>'.WebGUI::International::get(237).'</b> '.$data{subject}.'<br>';
|
||||
$html .= '<b>'.WebGUI::International::get(238).'</b>
|
||||
<a href="'.WebGUI::URL::page('op=viewProfile&uid='.$data{userId}).'">'.$data{username}.'</a><br>';
|
||||
$html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($data{dateOfPost},"%z %Z")."<br>";
|
||||
$html .= '<tr><td class="tableHeader">';
|
||||
$html .= formatHeader($data{subject},$data{userId},$data{username},$data{dateOfPost});
|
||||
$html .= '</td></tr>';
|
||||
unless ($data{message} =~ /\<div\>/ig || $data{message} =~ /\<br\>/ig || $data{message} =~ /\<p\>/ig) {
|
||||
$data{message} =~ s/\n/\<br\>/g;
|
||||
}
|
||||
$html .= '<tr><td class="tableData">'.$data{message}.'</td></tr>';
|
||||
$html .= '<tr><td class="tableData">'.formatMessage($data{message}).'</td></tr>';
|
||||
}
|
||||
} else {
|
||||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
|
|
|
|||
|
|
@ -213,55 +213,18 @@ sub www_editSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessage {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
return WebGUI::Discussion::editMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessageSave {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
WebGUI::Discussion::editMessageSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessage {
|
||||
sub www_post {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessage();
|
||||
return WebGUI::Discussion::post();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessageSave {
|
||||
sub www_postSave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessageSave();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReply {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postReply();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
WebGUI::Discussion::postReplySave();
|
||||
WebGUI::Discussion::postSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -273,10 +236,10 @@ sub www_showMessage {
|
|||
my ($submenu, $output, $defaultMid);
|
||||
($defaultMid) = WebGUI::SQL->quickArray("select min(messageId) from discussion where wobjectId=$session{form}{wid}");
|
||||
$session{form}{mid} = $defaultMid if ($session{form}{mid} eq "");
|
||||
$submenu = '<a href="'.WebGUI::URL::page('func=postReply&mid='.$session{form}{mid}.'&wid='.$session{form}{wid})
|
||||
$submenu = '<a href="'.WebGUI::URL::page('func=post&replyTo='.$session{form}{mid}.'&wid='.$session{form}{wid})
|
||||
.'">'.WebGUI::International::get(24,$namespace).'</a><br>';
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=editMessage&mid='.$session{form}{mid}.
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=post&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(25,$namespace).'</a><br>';
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=deleteMessage&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(26,$namespace).'</a><br>';
|
||||
|
|
@ -330,7 +293,7 @@ sub www_view {
|
|||
WebGUI::URL::page('func=showMessage&wid='.$_[0]->get("wobjectId")).'">'.
|
||||
WebGUI::International::get(28,$namespace).' ('.$replies.')</a></td>';
|
||||
$output .= '<td align="center" width="50%" class="tableMenu"><a href="'.
|
||||
WebGUI::URL::page('func=postNewMessage&wid='.$_[0]->get("wobjectId")).'">'.
|
||||
WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")).'">'.
|
||||
WebGUI::International::get(24,$namespace).'</a></td></tr>';
|
||||
$output .= '</table>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,55 +150,18 @@ sub www_editSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessage {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
return WebGUI::Discussion::editMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessageSave {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
WebGUI::Discussion::editMessageSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessage {
|
||||
sub www_post {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessage();
|
||||
return WebGUI::Discussion::post();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessageSave {
|
||||
sub www_postSave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessageSave();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReply {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postReply();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
WebGUI::Discussion::postReplySave();
|
||||
WebGUI::Discussion::postSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -208,11 +171,10 @@ sub www_postReplySave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_showMessage {
|
||||
my ($output, $submenu);
|
||||
$submenu = '<a href="'.WebGUI::URL::page('func=postReply&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid})
|
||||
$submenu = '<a href="'.WebGUI::URL::page('func=post&replyTo='.$session{form}{mid}.'&wid='.$session{form}{wid})
|
||||
.'">'.WebGUI::International::get(13,$namespace).'</a><br>';
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=editMessage&mid='.$session{form}{mid}.
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=post&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(12,$namespace).'</a><br>';
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=deleteMessage&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(22,$namespace).'</a><br>';
|
||||
|
|
@ -236,7 +198,7 @@ sub www_view {
|
|||
$html = $_[0]->processMacros($html);
|
||||
$html .= '<table width="100%" cellpadding=2 cellspacing=1 border=0><tr>'.
|
||||
'<td align="right" valign="bottom" class="tableMenu"><a href="'.
|
||||
WebGUI::URL::page('func=postNewMessage&wid='.$_[0]->get("wobjectId")).'">'.
|
||||
WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")).'">'.
|
||||
WebGUI::International::get(17,$namespace).'</a></td></tr></table>';
|
||||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td>
|
||||
|
|
|
|||
|
|
@ -417,25 +417,6 @@ sub www_editSave {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessage {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
return WebGUI::Discussion::editMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessageSave {
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
WebGUI::Discussion::editMessageSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubmission {
|
||||
my ($output, %submission, $f, @submission, $sth);
|
||||
|
|
@ -521,37 +502,18 @@ sub www_editSubmissionSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessage {
|
||||
sub www_post {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessage();
|
||||
return WebGUI::Discussion::post();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessageSave {
|
||||
sub www_postSave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
WebGUI::Discussion::postNewMessageSave();
|
||||
return $_[0]->www_viewSubmission();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReply {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postReply();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"),$session{user}{userId})) {
|
||||
WebGUI::Discussion::postReplySave();
|
||||
WebGUI::Discussion::postSave();
|
||||
return $_[0]->www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -561,10 +523,10 @@ sub www_postReplySave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_showMessage {
|
||||
my ($submenu, $output);
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=postReply&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid})
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=post&replyTo='.$session{form}{mid}.'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid})
|
||||
.'">'.WebGUI::International::get(39,$namespace).'</a><br>';
|
||||
if (_canEditMessage($_[0],$session{form}{mid})) {
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=editMessage&mid='.$session{form}{mid}.
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=post&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(42,$namespace).'</a><br>';
|
||||
$submenu .= '<a href="'.WebGUI::URL::page('func=deleteMessage&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(43,$namespace).'</a><br>';
|
||||
|
|
@ -628,7 +590,7 @@ sub www_viewSubmission {
|
|||
WebGUI::International::get(26,$namespace).'</a><br>';
|
||||
}
|
||||
if ($_[0]->get("allowDiscussion")) {
|
||||
$output .= '<a href="'.WebGUI::URL::page('func=postNewMessage&wid='.$_[0]->get("wobjectId")
|
||||
$output .= '<a href="'.WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")
|
||||
.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(47,$namespace).'</a><br>';
|
||||
}
|
||||
$output .= '<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(28,$namespace).'</a><br>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue