Commit b79b9a80e97ecd0b6241bc74d86e52f936f817ce
1 parent
1dab2d56
Type: Bug fix
Description: Pass through the TreadID so that the comments for the correct thread is displayed git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2874 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
5 changed files
with
17 additions
and
12 deletions
presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php
| ... | ... | @@ -54,11 +54,14 @@ if(checkSession()) { |
| 54 | 54 | // if this is a new thread, then set inReplyTo to -1 |
| 55 | 55 | $fInReplyTo = -1; |
| 56 | 56 | } else { |
| 57 | + // replying | |
| 57 | 58 | // retrieve the thread id |
| 58 | - $iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); | |
| 59 | + //$iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); | |
| 60 | + $default->log->info("adding comment: SEtting thread id: " . $fThreadID); | |
| 61 | + $iThreadID = $fThreadID; | |
| 59 | 62 | } |
| 60 | 63 | if ($iThreadID) { |
| 61 | - $default->log->info("addComment fInReplyTo=$fInReplyTo"); | |
| 64 | + $default->log->info("addComment fInReplyTo=$fInReplyTo, threadID=$iThreadID"); | |
| 62 | 65 | // Create the new comment |
| 63 | 66 | $oComment = & new DiscussionComment($fComment, $fSubject, $_SESSION["userID"], $iThreadID, $fInReplyTo); |
| 64 | 67 | $oComment->setThreadID($iThreadID); |
| ... | ... | @@ -92,7 +95,7 @@ if(checkSession()) { |
| 92 | 95 | } else { // the user has not entered BOTH a subject and a text body |
| 93 | 96 | $main->setErrorMessage("The subject line and/or body should not be empty."); |
| 94 | 97 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); |
| 95 | - $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1)); | |
| 98 | + $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1, $fThreadID)); | |
| 96 | 99 | } // end of IF for Subject and Body test |
| 97 | 100 | } else if (isset($fReplyComment)) { // if user is replying to existing comment |
| 98 | 101 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); |
| ... | ... | @@ -115,16 +118,16 @@ if(checkSession()) { |
| 115 | 118 | $sReply = "Re: "; |
| 116 | 119 | } else { $sReply = ""; } |
| 117 | 120 | |
| 118 | - $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" )); | |
| 121 | + $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" , $fThreadID)); | |
| 119 | 122 | |
| 120 | 123 | } else if (isset($fNewThread)){ // Start adding a new Thread |
| 121 | 124 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1"); |
| 122 | - $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1")); | |
| 125 | + $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1", $fThreadID)); | |
| 123 | 126 | } else { |
| 124 | 127 | // input validation |
| 125 | 128 | if (isset($fDocumentID)) { |
| 126 | 129 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); |
| 127 | - $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1)); | |
| 130 | + $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1, $fThreadID)); | |
| 128 | 131 | } else { |
| 129 | 132 | $main->setErrorMessage("You did not specify a document to add a comment to."); |
| 130 | 133 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc
| ... | ... | @@ -45,7 +45,7 @@ function getSubmitSuccessPage($iDocumentID){ |
| 45 | 45 | * @param $sSubject -> a Subject text |
| 46 | 46 | * @param $sBody -> a Body text |
| 47 | 47 | */ |
| 48 | -function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewComment = null) { | |
| 48 | +function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewComment = null, $fThreadID) { | |
| 49 | 49 | global $default; |
| 50 | 50 | |
| 51 | 51 | $sHeading = "Add a Comment"; |
| ... | ... | @@ -61,6 +61,7 @@ function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewCommen |
| 61 | 61 | $sToRender .= "<input type=\"hidden\" name=\"fNewComment\" value=\"1\"/>"; |
| 62 | 62 | } else { // If the user is replying to a comment |
| 63 | 63 | $sToRender .= "<input type=\"hidden\" name=\"fInReplyTo\" value=\"$iCommentID\"/>"; |
| 64 | + $sToRender .= "<input type=\"hidden\" name=\"fThreadID\" value=\"". $fThreadID . "\"/>"; | |
| 64 | 65 | $sToRender .= "<td width=\"10\" valign=top><a href=\"" . generateControllerLink("viewComment", "fViewComment=1&iDocumentID=$fDocumentID&iCommentID=$iCommentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n"; |
| 65 | 66 | } |
| 66 | 67 | $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td colspan=2>\n"; | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/viewCommentBL.php
| ... | ... | @@ -45,7 +45,7 @@ if (checkSession()) { |
| 45 | 45 | $oComment = DiscussionComment::get($iCommentID); |
| 46 | 46 | $oUser = User::get($oComment->getUserID()); |
| 47 | 47 | $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php?fDocumentID=$iDocumentID&fCommentID=$iCommentID&fReplyComment=1"); |
| 48 | - $oPatternCustom->setHtml(getCommentBody($oComment,$iDocumentID,$oUser)); | |
| 48 | + $oPatternCustom->setHtml(getCommentBody($oComment,$iDocumentID,$oUser,$iThreadID)); | |
| 49 | 49 | } else { |
| 50 | 50 | $main->setErrorMessage("You didn't specify a comment to view"); |
| 51 | 51 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/viewCommentUI.inc
| ... | ... | @@ -31,8 +31,9 @@ |
| 31 | 31 | * @param $iDocumentID -> a valid Document ID |
| 32 | 32 | * @param $oComment -> a valid Comment Object |
| 33 | 33 | * @param $oUser -> a valid User Object (Logged in user) |
| 34 | + * @param $iThreadID -> the ThreadID passed through | |
| 34 | 35 | */ |
| 35 | -function getCommentBody($oComment, $iDocumentID, $oUser) { | |
| 36 | +function getCommentBody($oComment, $iDocumentID, $oUser, $iThreadID) { | |
| 36 | 37 | global $default; |
| 37 | 38 | |
| 38 | 39 | $sHeading = "Document Comment"; |
| ... | ... | @@ -61,7 +62,7 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { |
| 61 | 62 | |
| 62 | 63 | $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; |
| 63 | 64 | $sToRender .= "<td align=right>\n"; |
| 64 | - $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; | |
| 65 | + $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "&fThreadID=" . $iThreadID . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; | |
| 65 | 66 | $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"; |
| 66 | 67 | $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" ><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">"; |
| 67 | 68 | $sToRender .= $oComment->getSubject(); | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
| ... | ... | @@ -86,7 +86,7 @@ function getViewComment($iNum, $oThread, $oComment, $sIndent) { |
| 86 | 86 | |
| 87 | 87 | $sToRender .= "<tr>\n"; |
| 88 | 88 | $sToRender .= "\t<td style=\"background-color:$BGcolor\" width=450>\n"; |
| 89 | - $sToRender .= "\t\t$sIndent<a href=\"" . generateControllerLink("viewComment", "iCommentID=" . $oComment->getID() . "&iDocumentID=" . $oThread->getDocumentID()) . "\" title=\"" . $oComment->getSubject() . "\">\n"; | |
| 89 | + $sToRender .= "\t\t$sIndent<a href=\"" . generateControllerLink("viewComment", "iCommentID=" . $oComment->getID() . "&iDocumentID=" . $oThread->getDocumentID() . "&iThreadID=" . $oThread->getID()) . "\" title=\"" . $oComment->getSubject() . "\">\n"; | |
| 90 | 90 | $sToRender .= substr($oComment->getSubject(),0,$iSubjectChars ) . $dotdot . "</a></td>\n"; |
| 91 | 91 | $sToRender .= "\t<td style=\"background-color:$UserBGcolor\" width=\"100\" title=\"$sUserName\">\n"; |
| 92 | 92 | $sToRender .= "\t\t$sUserName</td>\n"; |
| ... | ... | @@ -119,7 +119,7 @@ function getPage($iDocumentID, $aDocumentThreads) { |
| 119 | 119 | $aCommentTree = getCommentTree($aDocumentThreads[$i]->getID(), -1); |
| 120 | 120 | // now loop through the comments, and indent comments that have the same reply_to at the same level .... ?? |
| 121 | 121 | for ($j=0; $j<count($aCommentTree); $j++) { |
| 122 | - $default->log->info("commentTree[$j][comment]=" . $aCommentTree[$j]["comment"]); | |
| 122 | + $default->log->info("commentTree[$j][comment]=" . arrayToString($aCommentTree[$j]["comment"])); | |
| 123 | 123 | $sToRender .= getViewComment($iCount++, $aDocumentThreads[$i], $aCommentTree[$j]["comment"], getIndent($aCommentTree[$j]["level"])); |
| 124 | 124 | } |
| 125 | 125 | } | ... | ... |