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 .= "graphicsUrl/widgets/cancel.gif\" border=0 >\n"; } $sToRender .= "
Subject\n"; diff --git a/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentBL.php b/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentBL.php index c5fa9ff..e20fc5b 100644 --- a/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentBL.php @@ -45,7 +45,7 @@ if (checkSession()) { $oComment = DiscussionComment::get($iCommentID); $oUser = User::get($oComment->getUserID()); $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php?fDocumentID=$iDocumentID&fCommentID=$iCommentID&fReplyComment=1"); - $oPatternCustom->setHtml(getCommentBody($oComment,$iDocumentID,$oUser)); + $oPatternCustom->setHtml(getCommentBody($oComment,$iDocumentID,$oUser,$iThreadID)); } else { $main->setErrorMessage("You didn't specify a comment to view"); } diff --git a/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentUI.inc b/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentUI.inc index a4f35e9..d529a52 100644 --- a/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/discussions/viewCommentUI.inc @@ -31,8 +31,9 @@ * @param $iDocumentID -> a valid Document ID * @param $oComment -> a valid Comment Object * @param $oUser -> a valid User Object (Logged in user) + * @param $iThreadID -> the ThreadID passed through */ -function getCommentBody($oComment, $iDocumentID, $oUser) { +function getCommentBody($oComment, $iDocumentID, $oUser, $iThreadID) { global $default; $sHeading = "Document Comment"; @@ -61,7 +62,7 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { $sToRender .= "
\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\t\n"; $sToRender .= "\t\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; $jlog->info("commentTree[$j][comment]=" . $aCommentTree[$j]["comment"]); + $default->log->info("commentTree[$j][comment]=" . arrayToString($aCommentTree[$j]["comment"])); $sToRender .= getViewComment($iCount++, $aDocumentThreads[$i], $aCommentTree[$j]["comment"], getIndent($aCommentTree[$j]["level"])); } }
Author: " . $oUser->getUserName() . "\n"; - $sToRender .= "getID()) . "\">graphicsUrl/widgets/reply.gif\" border=\"0\" />"; + $sToRender .= "getID()) . "&fThreadID=" . $iThreadID . "\">graphicsUrl/widgets/reply.gif\" border=\"0\" />"; $sToRender .= "graphicsUrl/widgets/back.gif\" border=0 >
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$sIndentgetSubject() . "\">\n"; + $sToRender .= "\t\t$sIndentgetSubject() . "\">\n"; $sToRender .= substr($oComment->getSubject(),0,$iSubjectChars ) . $dotdot . "\n"; $sToRender .= "\t\t$sUserName