Commit 20db430bdf4b8cbd083dfc32cd5d4c277c43d235

Authored by Neil Blakey-Milner
1 parent a76502b0

Consistently use fDocumentID for passing the document ID between pages.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3186 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php
... ... @@ -50,8 +50,8 @@ if(checkSession()) {
50 50 $default->log->info("adding comment: subject=$fSubject; comment=$fComment");
51 51 if ( (strlen($fSubject) > 0) && (strlen($fComment) > 0) ) {
52 52 // create a new thread, unless we're replying
53   - if (isset($fNewComment)) {
54   - $oThread = & new DiscussionThread(-1, $iDocumentID, $_SESSION["userID"]);
  53 + if (isset($fNewThread)) {
  54 + $oThread = & new DiscussionThread(-1, $fDocumentID, $_SESSION["userID"]);
55 55 $oThread->create();
56 56 $iThreadID = $oThread->getID();
57 57 // if this is a new thread, then set inReplyTo to -1
... ... @@ -77,15 +77,15 @@ if(checkSession()) {
77 77 $oThread->setFirstCommentID($oComment->getID());
78 78 }
79 79 // Session variable is set to true if user views the thread
80   - if ($_SESSION['Discussion' . $iDocumentID][0]->bViews != true ){
  80 + if ($_SESSION['Discussion' . $fDocumentID][0]->bViews != true ){
81 81 $oThread->incrementNumberOfViews();
82   - $_SESSION['Discussion' . $iDocumentID][0]->bViews = true;
  82 + $_SESSION['Discussion' . $fDocumentID][0]->bViews = true;
83 83 }
84 84 $oThread->incrementNumberOfReplies();
85 85  
86 86 if ($oThread->Update()) { //
87   - controllerRedirect("viewDiscussion", "fForDiscussion=1&fDocumentID=$iDocumentID");
88   - //$oPatternCustom->addHtml(getSubmitSuccessPage($iDocumentID));
  87 + controllerRedirect("viewDiscussion", "fForDiscussion=1&fDocumentID=$fDocumentID");
  88 + //$oPatternCustom->addHtml(getSubmitSuccessPage($fDocumentID));
89 89 } else {
90 90 $main->setErrorMessage(_("Thread Object failed to update"));
91 91 }
... ... @@ -97,11 +97,11 @@ if(checkSession()) {
97 97 }
98 98 } else { // the user has not entered BOTH a subject and a text body
99 99 $main->setErrorMessage(_("The subject line and/or body should not be empty."));
100   - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID");
  100 + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&fDocumentID=$fDocumentID");
101 101 $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1, $fThreadID));
102 102 } // end of IF for Subject and Body test
103 103 } else if (isset($fReplyComment)) { // if user is replying to existing comment
104   - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID");
  104 + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&fDocumentID=$fDocumentID");
105 105  
106 106 $oComment = DiscussionComment::get($fCommentID);
107 107 $oUser = User::get($oComment->getUserID());
... ... @@ -124,12 +124,12 @@ if(checkSession()) {
124 124 $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" , $fThreadID));
125 125  
126 126 } else if (isset($fNewThread)){ // Start adding a new Thread
127   - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1");
  127 + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&fDocumentID=$fDocumentID&fNewThread=1");
128 128 $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1", $fThreadID));
129 129 } else {
130 130 // input validation
131 131 if (isset($fDocumentID)) {
132   - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID");
  132 + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&fDocumentID=$fDocumentID");
133 133 $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1, $fThreadID));
134 134 } else {
135 135 $main->setErrorMessage(_("You did not specify a document to add a comment to."));
... ...