diff --git a/lib/WebGUI/Discussion.pm b/lib/WebGUI/Discussion.pm index df33431ec..1d8fc3962 100644 --- a/lib/WebGUI/Discussion.pm +++ b/lib/WebGUI/Discussion.pm @@ -253,6 +253,37 @@ sub showReplyTree { return $html; } +#------------------------------------------------------------------- +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"; + $sth = WebGUI::SQL->read($sql); + while (@data = $sth->array) { + $data[1] = WebGUI::HTML::filter($data[1],'all'); + $html .= ''.substr($data[1],0,30). + ''; + $html .= WebGUI::Discussion::traverseReplyTree($data[0],1); + } + $html .= '
'.WebGUI::International::get(229).''.WebGUI::International::get(244).''.WebGUI::International::get(245).'
'.$data[2]. + ''.epochToHuman($data[3],"%z %Z"). + '
'; + return $html; +} + #------------------------------------------------------------------- sub traverseReplyTree { my ($sth, @data, $html, $depth, $i); diff --git a/lib/WebGUI/Wobject/UserSubmission.pm b/lib/WebGUI/Wobject/UserSubmission.pm index 01e78267c..2e12f3c65 100644 --- a/lib/WebGUI/Wobject/UserSubmission.pm +++ b/lib/WebGUI/Wobject/UserSubmission.pm @@ -53,33 +53,6 @@ sub _canEditMessage { } } -#------------------------------------------------------------------- -sub _showReplies { - my ($sth, @data, $html); - $html .= ''; - $html .= ' - - '; - $sth = WebGUI::SQL->read("select messageId,subject,username,dateOfPost,userId from discussion - where wobjectId=$session{form}{wid} and subId=$session{form}{sid} and pid=0 order by messageId desc"); - while (@data = $sth->array) { - $data[1] = WebGUI::HTML::filter($data[1],'all'); - $html .= ''.substr($data[1],0,30). - ''; - $html .= WebGUI::Discussion::traverseReplyTree($data[0],1); - } - $html .= '
'.WebGUI::International::get(229).''.WebGUI::International::get(40,$namespace).''.WebGUI::International::get(41,$namespace).'
'.$data[2]. - ''.epochToHuman($data[3],"%z %Z"). - '
'; - return $html; -} - #------------------------------------------------------------------- sub duplicate { my ($sth, $file, @row, $newSubmissionId, $w); @@ -462,7 +435,7 @@ sub www_showMessage { $html .= ''.WebGUI::International::get(28,$namespace).'
'; $html .= ''; $html .= $message{message}.'

'; - $html .= _showReplies(); + $html .= WebGUI::Discussion::showThreads(); $html .= ''; } else { $html = WebGUI::International::get(402); @@ -533,10 +506,10 @@ sub www_viewSubmission { $output .= ''.WebGUI::International::get(22,$namespace).' '.$submission{username}.'
'; $output .= ''.WebGUI::International::get(23,$namespace).' '.epochToHuman($submission{dateSubmitted},"%z %Z")."
"; - $output .= ''.WebGUI::International::get(14,$namespace).': '.$submission{status}; + $output .= ''.WebGUI::International::get(14,$namespace).': '.$submissionStatus{$submission{status}}; $output .= ''; #---menu - if ($submission{userId} == $session{user}{userId}) { + if ($submission{userId} == $session{user}{userId} && WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) { $output .= ''.WebGUI::International::get(37,$namespace).'
'; $output .= '