package WebGUI::Widget::MessageBoard; #------------------------------------------------------------------- # WebGUI is Copyright 2001 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict; use Tie::CPHash; use WebGUI::DateTime; use WebGUI::International; use WebGUI::Macro; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; use WebGUI::Utility; use WebGUI::Widget; #------------------------------------------------------------------- sub _getBoardProperties { my (%board); tie %board, 'Tie::CPHash'; %board = WebGUI::SQL->quickHash("select * from widget, MessageBoard where widget.widgetId=MessageBoard.widgetId and widget.widgetId=$_[0]",$session{dbh}); return %board; } #------------------------------------------------------------------- sub _traverseReplyTree { my ($sth, @data, $html, $depth, $i); for ($i=0;$i<=$_[1];$i++) { $depth .= " "; } $sth = WebGUI::SQL->read("select messageId,subject,username,dateOfPost from message where pid=$_[0] order by messageId", $session{dbh}); while (@data = $sth->array) { $html .= '
';
$output .= '
';
$output .= '| '; if ($board{displayTitle}) { $html .= $board{title}; } $html .= ' | '.WebGUI::International::get(228).' |
| '; if ($board{displayTitle}) { $html .= $board{title}; } $html .= ' | '.WebGUI::International::get(231).' |
| '; if ($board{displayTitle}) { $html .= $board{title}; } $html .= ' | '.WebGUI::International::get(234).' |
| '; if ($board{displayTitle}) { $html .= $board{title}; } $html .= ' | '; if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{'userId'} eq $session{user}{userId}) { $html .= ''.WebGUI::International::get(235).' · '; } $html .= ''.WebGUI::International::get(236).' |
| ';
$html .= "".WebGUI::International::get(237)." ".$message{subject}." "; $html .= "".WebGUI::International::get(238)." ".$message{username}." "; $html .= "".WebGUI::International::get(239)." ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")." "; $html .= "".WebGUI::International::get(240)." ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}." "; $html .= ' | ';
$html .= '|
| ';
$message{message} =~ s/\n/\ /g; $html .= $message{message}; $html .= ' | |
| '.WebGUI::International::get(229).' | '.WebGUI::International::get(244).' | '.WebGUI::International::get(245).' |
| '.$data[2].' | '.epochToHuman($data[3],"%M/%D %H:%n%p").' |
'; } if ($board{processMacros}) { $html = WebGUI::Macro::process($html); } $html .= '
| '; if ($board{displayTitle}) { $html .= $board{title}; } $html .= ' | '.WebGUI::International::get(246).' |
| '.WebGUI::International::get(229).' | '.WebGUI::International::get(244).' | '.WebGUI::International::get(247).' | '.WebGUI::International::get(248).' | '.WebGUI::International::get(249).' |
| '.substr($data[1],0,30).' | '.$data[2].' | '.epochToHuman($data[3],"%M/%D %H:%n%p").' | '.$replies.' | '.substr($last[3],0,30).' @ '.epochToHuman($last[1],"%M/%D %H:%n%p").' by '.$last[2].' |