Commit 40eda01ef5a7eccf2c3e6ba15a7adce6e37339e5

Authored by michael
1 parent aa6d69b7

(#2977) use wordwrap and don't display comment text as html


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2697 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
... ... @@ -154,27 +154,21 @@ function getCommentBody($oComment, $iDocumentID, $oUser) {
154 154 $sBody = "";
155 155 $numChars = 80; // number of chars in a line
156 156  
  157 +
157 158 // Used for wrapping text that may be too long on one any line
158 159 for ($i=0; $i <= sizeof($aBody) ;$i++) {
159   - if (strlen($aBody[$i]) >$numChars){
160   - $loop = (strlen($aBody[$i]) - (strlen($aBody[$i])) % $numChars)/$numChars +1;
161   -
162   - $j=$numChars;
163   - for($j=0; $j < $loop; $j++ ) {
164   - $sBody .= "<br>" . substr($aBody[$i],($j*$numChars), $numChars) . "";
165   - }
166   - } else { $sBody .= "<br>" . $aBody[$i]; }
167   - }
  160 + $sBody .= $aBody[$i] . "\n";
  161 + }
168 162  
169 163 $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n";
170 164 $sToRender .= "<td align=right>\n";
171 165 $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>";
172 166 $sToRender .= "</td><td width=30><a href=\"" . generateControllerLink("viewDiscussion", "fForDiscussion=1&fDocumentID=$iDocumentID") . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=0 ><a></td></tr>\n";
173   - $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">";
  167 + $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">";
174 168 $sToRender .= "<a>" . $oComment->getSubject() . "</a>";
175 169 $sToRender .= "</td><td colspan=2><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font>&nbsp;&nbsp;&nbsp;</td></tr><tr><td colspan=4 valign=top>";
176 170 $sToRender .= "<table width=10 border=0><tr><td><a>";
177   - $sToRender .= $sBody; // Div Views as HTML
  171 + $sToRender .= wordwrap("<pre>" . $sBody . "</pre>", 80); // Div Views as HTML
178 172 $sToRender .= "</a></td></tr></table>";
179 173 $sToRender .= "</td>\n";
180 174  
... ...