diff --git a/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php b/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php index b1753a6..61ea0f7 100644 --- a/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php @@ -54,11 +54,14 @@ if(checkSession()) { // if this is a new thread, then set inReplyTo to -1 $fInReplyTo = -1; } else { + // replying // retrieve the thread id - $iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); + //$iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); + $default->log->info("adding comment: SEtting thread id: " . $fThreadID); + $iThreadID = $fThreadID; } if ($iThreadID) { - $default->log->info("addComment fInReplyTo=$fInReplyTo"); + $default->log->info("addComment fInReplyTo=$fInReplyTo, threadID=$iThreadID"); // Create the new comment $oComment = & new DiscussionComment($fComment, $fSubject, $_SESSION["userID"], $iThreadID, $fInReplyTo); $oComment->setThreadID($iThreadID); @@ -92,7 +95,7 @@ if(checkSession()) { } else { // the user has not entered BOTH a subject and a text body $main->setErrorMessage("The subject line and/or body should not be empty."); $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); - $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1)); + $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1, $fThreadID)); } // end of IF for Subject and Body test } else if (isset($fReplyComment)) { // if user is replying to existing comment $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); @@ -115,16 +118,16 @@ if(checkSession()) { $sReply = "Re: "; } else { $sReply = ""; } - $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" )); + $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" , $fThreadID)); } else if (isset($fNewThread)){ // Start adding a new Thread $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1"); - $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1")); + $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1", $fThreadID)); } else { // input validation if (isset($fDocumentID)) { $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); - $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1)); + $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1, $fThreadID)); } else { $main->setErrorMessage("You did not specify a document to add a comment to."); } diff --git a/presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc b/presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc index 404f5be..34211c3 100644 --- a/presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc @@ -45,7 +45,7 @@ function getSubmitSuccessPage($iDocumentID){ * @param $sSubject -> a Subject text * @param $sBody -> a Body text */ -function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewComment = null) { +function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewComment = null, $fThreadID) { global $default; $sHeading = "Add a Comment"; @@ -61,6 +61,7 @@ function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewCommen $sToRender .= ""; } else { // If the user is replying to a comment $sToRender .= ""; + $sToRender .= ""; $sToRender .= "
| Author: " . $oUser->getUserName() . " | \n"; $sToRender .= "\n";
- $sToRender .= "getID()) . "\"> | ||
| Subject: | "; $sToRender .= $oComment->getSubject(); diff --git a/presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc b/presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc index dded45a..07fe2cc 100644 --- a/presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc @@ -86,7 +86,7 @@ function getViewComment($iNum, $oThread, $oComment, $sIndent) { $sToRender .= " | ||
| \n"; - $sToRender .= "\t\t$sIndentgetID() . "&iDocumentID=" . $oThread->getDocumentID()) . "\" title=\"" . $oComment->getSubject() . "\">\n"; + $sToRender .= "\t\t$sIndentgetID() . "&iDocumentID=" . $oThread->getDocumentID() . "&iThreadID=" . $oThread->getID()) . "\" title=\"" . $oComment->getSubject() . "\">\n"; $sToRender .= substr($oComment->getSubject(),0,$iSubjectChars ) . $dotdot . " | \n"; $sToRender .= "\t\n"; $sToRender .= "\t\t$sUserName | \n"; @@ -119,7 +119,7 @@ function getPage($iDocumentID, $aDocumentThreads) { $aCommentTree = getCommentTree($aDocumentThreads[$i]->getID(), -1); // now loop through the comments, and indent comments that have the same reply_to at the same level .... ?? for ($j=0; $j||