Commit 40eda01ef5a7eccf2c3e6ba15a7adce6e37339e5
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
Showing
1 changed file
with
5 additions
and
11 deletions
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
| @@ -154,27 +154,21 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { | @@ -154,27 +154,21 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { | ||
| 154 | $sBody = ""; | 154 | $sBody = ""; |
| 155 | $numChars = 80; // number of chars in a line | 155 | $numChars = 80; // number of chars in a line |
| 156 | 156 | ||
| 157 | + | ||
| 157 | // Used for wrapping text that may be too long on one any line | 158 | // Used for wrapping text that may be too long on one any line |
| 158 | for ($i=0; $i <= sizeof($aBody) ;$i++) { | 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 | $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; | 163 | $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; |
| 170 | $sToRender .= "<td align=right>\n"; | 164 | $sToRender .= "<td align=right>\n"; |
| 171 | $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; | 165 | $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; |
| 172 | $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"; | 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 | $sToRender .= "<a>" . $oComment->getSubject() . "</a>"; | 168 | $sToRender .= "<a>" . $oComment->getSubject() . "</a>"; |
| 175 | $sToRender .= "</td><td colspan=2><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font> </td></tr><tr><td colspan=4 valign=top>"; | 169 | $sToRender .= "</td><td colspan=2><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font> </td></tr><tr><td colspan=4 valign=top>"; |
| 176 | $sToRender .= "<table width=10 border=0><tr><td><a>"; | 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 | $sToRender .= "</a></td></tr></table>"; | 172 | $sToRender .= "</a></td></tr></table>"; |
| 179 | $sToRender .= "</td>\n"; | 173 | $sToRender .= "</td>\n"; |
| 180 | 174 |