Commit d147188856d7775eb5dacf4b803e4a378ec2e3d7

Authored by omar
1 parent 7d823812

Text wrapping for netscape


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1948 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc
@@ -26,7 +26,7 @@ function getSubmitSuccessPage($iDocumentID){ @@ -26,7 +26,7 @@ function getSubmitSuccessPage($iDocumentID){
26 * 26 *
27 * @param $sHeading -> text heading for the page 27 * @param $sHeading -> text heading for the page
28 */ 28 */
29 -/*function renderHeading($sHeading) { 29 +function renderHeading($sHeading) {
30 global $default; 30 global $default;
31 31
32 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); 32 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
@@ -37,7 +37,7 @@ function getSubmitSuccessPage($iDocumentID){ @@ -37,7 +37,7 @@ function getSubmitSuccessPage($iDocumentID){
37 $sToRender .= "<tr/>\n"; 37 $sToRender .= "<tr/>\n";
38 $sToRender .= "</table>\n"; 38 $sToRender .= "</table>\n";
39 return $sToRender; 39 return $sToRender;
40 -}*/ 40 +}
41 41
42 /** 42 /**
43 * Renders the path for the document 43 * Renders the path for the document
@@ -69,16 +69,15 @@ function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewCommen @@ -69,16 +69,15 @@ function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewCommen
69 $sToRender .= renderHeading($sHeading); 69 $sToRender .= renderHeading($sHeading);
70 $sToRender .= renderDocumentPath($fDocumentID); 70 $sToRender .= renderDocumentPath($fDocumentID);
71 $sToRender .= "<table width=\"100%\" border=\"0\" cellpadding=0 ><tr><td></td>\n"; 71 $sToRender .= "<table width=\"100%\" border=\"0\" cellpadding=0 ><tr><td></td>\n";
72 - $sToRender .= "<td align=right width=100%><input onmouseover=\"this.style.cursor='hand'\" type=\"image\" src=\"$default->graphicsUrl/widgets/submit.gif\"></td>"; 72 + $sToRender .= "<td align=right width=100%><input onmouseover=\"this.style.cursor='hand'\" type=\"image\" src=\"$default->graphicsUrl/widgets/submit.gif\" border=0></td>";
73 if($fNewComment>0){ // If user is creating a new comment 73 if($fNewComment>0){ // If user is creating a new comment
74 $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fForDiscussion=1&fDocumentID=$fDocumentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n"; 74 $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fForDiscussion=1&fDocumentID=$fDocumentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n";
75 }else { // If the user is replying to a comment 75 }else { // If the user is replying to a comment
76 $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fViewComment=1&iDocumentID=$fDocumentID&iCommentID=$iCommentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n"; 76 $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fViewComment=1&iDocumentID=$fDocumentID&iCommentID=$iCommentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n";
77 } 77 }
78 $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td colspan=2>\n"; 78 $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td colspan=2>\n";
79 - $sToRender .= "<input type=\"text\" style=\"width:385\" name=\"NewCommentSubject\" id=\"NewCommentSubject\" value=\"$sSubject\"></td></tr>\n";  
80 - $sToRender .= "<tr><td valign=\"top\"><b>Body</b></td><td colspan=2><textarea cols=60 rows=\"21\" name=\"NewComment\" id=\"NewComment\" style=\"FONT-STYLE: normal; FONT-FAMILY: sans-serif; FONT-VARIANT: normal\">$sBody</textarea></td></tr></table>\n";  
81 - 79 + $sToRender .= "<input type=\"text\" style=\"width:385\" name=\"NewCommentSubject\" id=\"NewCommentSubject\" value=\"$sSubject\"></td></tr>\n";
  80 + $sToRender .= "<tr><td valign=\"top\"><b>Body</b></td><td colspan=2><textarea cols=60 rows=\"21\" name=\"NewComment\" id=\"NewComment\" wrap=\"physical\" style=\"FONT-STYLE: normal; FONT-FAMILY: sans-serif; FONT-VARIANT: normal\">$sBody</textarea></td></tr></table>\n";
82 return $sToRender; 81 return $sToRender;
83 } 82 }
84 83
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
@@ -57,7 +57,7 @@ function getNewThreadOption($fDocumentID) { @@ -57,7 +57,7 @@ function getNewThreadOption($fDocumentID) {
57 * 57 *
58 * @param $sHeading -> text heading for the page 58 * @param $sHeading -> text heading for the page
59 */ 59 */
60 -/*function renderHeading($sHeading) { 60 +function renderHeading($sHeading) {
61 global $default; 61 global $default;
62 62
63 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); 63 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
@@ -68,7 +68,7 @@ function getNewThreadOption($fDocumentID) { @@ -68,7 +68,7 @@ function getNewThreadOption($fDocumentID) {
68 $sToRender .= "<tr/>\n"; 68 $sToRender .= "<tr/>\n";
69 $sToRender .= "</table>\n"; 69 $sToRender .= "</table>\n";
70 return $sToRender; 70 return $sToRender;
71 -}*/ 71 +}
72 72
73 /** 73 /**
74 * Renders the path for the document 74 * Renders the path for the document
@@ -152,17 +152,34 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { @@ -152,17 +152,34 @@ function getCommentBody($oComment, $iDocumentID, $oUser) {
152 152
153 $sToRender .= renderHeading($sHeading); 153 $sToRender .= renderHeading($sHeading);
154 $sToRender .= renderDocumentPath($iDocumentID); 154 $sToRender .= renderDocumentPath($iDocumentID);
  155 + $sBody = urldecode(str_replace("%0D%0A","<br>",str_replace("+", "&nbsp;",$oComment->getBody())));
  156 + $aBody = explode("<br>",$sBody);
  157 + $sBody = "";
  158 + $numChars = 80; // number of chars in a line
155 159
  160 + // Used for wrapping text that may be too long on one any line
  161 + for ($i=0; $i <= sizeof($aBody) ;$i++) {
  162 + if (strlen($aBody[$i]) >$numChars){
  163 + $loop = (strlen($aBody[$i]) - (strlen($aBody[$i])) % $numChars)/$numChars +1;
  164 +
  165 + $j=$numChars;
  166 + for($j=0; $j < $loop; $j++ ) {
  167 + $sBody .= "<br>" . substr($aBody[$i],($j*$numChars), $numChars) . "";
  168 + }
  169 + } else { $sBody .= "<br>" . $aBody[$i]; }
  170 + }
  171 +
156 $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; 172 $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n";
157 $sToRender .= "<td align=right>\n"; 173 $sToRender .= "<td align=right>\n";
158 $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; 174 $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>";
159 $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"; 175 $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";
160 $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">"; 176 $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">";
161 $sToRender .= "<a>" . $oComment->getSubject() . "</a>"; 177 $sToRender .= "<a>" . $oComment->getSubject() . "</a>";
162 - $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>";  
163 - $sToRender .= "<DIV> ";  
164 - $sToRender .= urldecode(str_replace("%0D%0A","<br>",str_replace("+", "&nbsp;",$oComment->getBody()))); // Div Views as HTML  
165 - $sToRender .= "</DIV></td>"; 178 + $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>";
  179 + $sToRender .= "<table width=10 border=0><tr><td><a>";
  180 + $sToRender .= $sBody; // Div Views as HTML
  181 + $sToRender .= "</a></td></tr></table>";
  182 + $sToRender .= "</td>\n";
166 183
167 $sToRender .= "</tr></table> "; 184 $sToRender .= "</tr></table> ";
168 185