Added basic flat discussion view.
This commit is contained in:
parent
745367ce62
commit
97adfd6be6
1 changed files with 36 additions and 19 deletions
|
|
@ -287,31 +287,48 @@ sub showReplyTree {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub showThreads {
|
sub showThreads {
|
||||||
my ($sth, %data, $html, $sql);
|
my ($sth, %data, $html, $sql);
|
||||||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
$sql = "select * from discussion where wobjectId=$session{form}{wid}";
|
||||||
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td>
|
if ($session{form}{sid}) {
|
||||||
<td class="tableHeader">'.WebGUI::International::get(244).'</td>
|
$sql .= " and subId=$session{form}{sid}";
|
||||||
<td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
|
}
|
||||||
$sql = "select messageId,subject,username,dateOfPost,userId from discussion where wobjectId=$session{form}{wid}";
|
$sql .= " and pid=0 order by messageId desc";
|
||||||
if ($session{form}{sid}) {
|
|
||||||
$sql .= " and subId=$session{form}{sid}";
|
|
||||||
}
|
|
||||||
$sql .= " and pid=0 order by messageId desc";
|
|
||||||
$sth = WebGUI::SQL->read($sql);
|
$sth = WebGUI::SQL->read($sql);
|
||||||
while (%data = $sth->hash) {
|
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||||
$data{subject} = WebGUI::HTML::filter($data{subject},'all');
|
if ($session{user}{discussionLayout} eq "flat") {
|
||||||
$html .= '<tr';
|
while (%data = $sth->hash) {
|
||||||
if ($data{messageId} == $session{form}{mid}) {
|
$html .= '<tr><td class="tableHeader"><b>'.WebGUI::International::get(237).'</b> '.$data{subject}.'<br>';
|
||||||
$html .= ' class="highlight"';
|
$html .= '<b>'.WebGUI::International::get(238).'</b>
|
||||||
}
|
<a href="'.WebGUI::URL::page('op=viewProfile&uid='.$data{userId}).'">'.$data{username}.'</a><br>';
|
||||||
$html .= '><td class="tableData"><a href="'.WebGUI::URL::page('func=showMessage&mid='.
|
$html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($data{dateOfPost},"%z %Z")."<br>";
|
||||||
|
$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>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||||
|
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td>
|
||||||
|
<td class="tableHeader">'.WebGUI::International::get(244).'</td>
|
||||||
|
<td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
|
||||||
|
while (%data = $sth->hash) {
|
||||||
|
$data{subject} = WebGUI::HTML::filter($data{subject},'all');
|
||||||
|
$html .= '<tr';
|
||||||
|
if ($data{messageId} == $session{form}{mid}) {
|
||||||
|
$html .= ' class="highlight"';
|
||||||
|
}
|
||||||
|
$html .= '><td class="tableData"><a href="'.WebGUI::URL::page('func=showMessage&mid='.
|
||||||
$data{messageId}.'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}).'">'.substr($data{subject},0,30).
|
$data{messageId}.'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}).'">'.substr($data{subject},0,30).
|
||||||
'</a></td><td class="tableData"><a href="'.
|
'</a></td><td class="tableData"><a href="'.
|
||||||
WebGUI::URL::page('op=viewProfile&uid='.$data{userId}).'">'.$data{username}.
|
WebGUI::URL::page('op=viewProfile&uid='.$data{userId}).'">'.$data{username}.
|
||||||
'</a></td><td class="tableData">'.epochToHuman($data{dateOfPost},"%z %Z").
|
'</a></td><td class="tableData">'.epochToHuman($data{dateOfPost},"%z %Z").
|
||||||
'</td></tr>';
|
'</td></tr>';
|
||||||
$html .= WebGUI::Discussion::traverseReplyTree($data{messageId},1);
|
$html .= WebGUI::Discussion::traverseReplyTree($data{messageId},1);
|
||||||
}
|
}
|
||||||
$html .= '</table>';
|
$html .= '</table>';
|
||||||
|
}
|
||||||
|
$html .= '</table>';
|
||||||
|
$sth->finish;
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue