diff --git a/lib/WebGUI/Discussion.pm b/lib/WebGUI/Discussion.pm index e4777ed59..061288c3a 100644 --- a/lib/WebGUI/Discussion.pm +++ b/lib/WebGUI/Discussion.pm @@ -287,31 +287,48 @@ sub showReplyTree { #------------------------------------------------------------------- sub showThreads { my ($sth, %data, $html, $sql); - $html .= ''; - $html .= ' - - '; - $sql = "select messageId,subject,username,dateOfPost,userId from discussion where wobjectId=$session{form}{wid}"; - if ($session{form}{sid}) { - $sql .= " and subId=$session{form}{sid}"; - } - $sql .= " and pid=0 order by messageId desc"; + $sql = "select * from discussion where wobjectId=$session{form}{wid}"; + if ($session{form}{sid}) { + $sql .= " and subId=$session{form}{sid}"; + } + $sql .= " and pid=0 order by messageId desc"; $sth = WebGUI::SQL->read($sql); - while (%data = $sth->hash) { - $data{subject} = WebGUI::HTML::filter($data{subject},'all'); - $html .= 'hash) { + $html .= ''; + unless ($data{message} =~ /\/ig || $data{message} =~ /\/ig || $data{message} =~ /\/ig) { + $data{message} =~ s/\n/\/g; + } + $html .= ''; + } + } else { + $html .= '
'.WebGUI::International::get(229).''.WebGUI::International::get(244).''.WebGUI::International::get(245).'
'.WebGUI::International::get(237).' '.$data{subject}.'
'; + $html .= ''.WebGUI::International::get(238).' + '.$data{username}.'
'; + $html .= "".WebGUI::International::get(239)." ".epochToHuman($data{dateOfPost},"%z %Z")."
"; + $html .= '
'.$data{message}.'
'; + $html .= ' + + '; + while (%data = $sth->hash) { + $data{subject} = WebGUI::HTML::filter($data{subject},'all'); + $html .= ''.substr($data{subject},0,30). ''; - $html .= WebGUI::Discussion::traverseReplyTree($data{messageId},1); - } - $html .= '
'.WebGUI::International::get(229).''.WebGUI::International::get(244).''.WebGUI::International::get(245).'
'.$data{username}. ''.epochToHuman($data{dateOfPost},"%z %Z"). '
'; + $html .= WebGUI::Discussion::traverseReplyTree($data{messageId},1); + } + $html .= ''; + } + $html .= ''; + $sth->finish; return $html; }