Commit 01d89b9854baa40de53af8d8f5abcca39879aa7c
1 parent
56c1e550
#3497 fixed refactor bug, removed fAddComment parameter
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2802 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
13 additions
and
24 deletions
presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php
| ... | ... | @@ -43,22 +43,7 @@ require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 43 | 43 | if(checkSession()) { |
| 44 | 44 | $oPatternCustom = & new PatternCustom(); |
| 45 | 45 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 46 | - // input validation | |
| 47 | - if (isset($fAddComment)) { | |
| 48 | - if (isset($fDocumentID)) { | |
| 49 | - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); | |
| 50 | - $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1)); | |
| 51 | - } else { | |
| 52 | - $main->setErrorMessage("You did not specify a document to add a comment to."); | |
| 53 | - } | |
| 54 | - // User wishes to view a comment | |
| 55 | - } else if (isset($fViewComment)) { | |
| 56 | - if (isset($iCommentID)) { | |
| 57 | - $oComment = DiscussionComment::get($iCommentID); | |
| 58 | - $oUser = User::get($oComment->getUserID()); | |
| 59 | - $oPatternCustom->setHtml(getCommentBody($oComment->getBody(), $oComment->getSubject(), $oComment->getDate(), $iDocumentID,$oUser->getUserName())) ; | |
| 60 | - } | |
| 61 | - } else if (isset($fAddCommentSubmit)) { | |
| 46 | + if (isset($fAddCommentSubmit)) { | |
| 62 | 47 | $default->log->info("adding comment: subject=$fSubject; comment=$fComment"); |
| 63 | 48 | if ( (strlen($fSubject) > 0) && (strlen($fComment) > 0) ) { |
| 64 | 49 | // create a new thread, unless we're replying |
| ... | ... | @@ -108,8 +93,8 @@ if(checkSession()) { |
| 108 | 93 | $main->setErrorMessage("The subject line and/or body should not be empty."); |
| 109 | 94 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); |
| 110 | 95 | $oPatternCustom->addHtml(getAddComment($fDocumentID, $fSubject, $fComment, $fCommentID, 1)); |
| 111 | - } // end of IF for Subject and Body test | |
| 112 | - } else if (isset($fReplyComment)){ // if user is replying to existing comment | |
| 96 | + } // end of IF for Subject and Body test | |
| 97 | + } else if (isset($fReplyComment)) { // if user is replying to existing comment | |
| 113 | 98 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); |
| 114 | 99 | |
| 115 | 100 | $oComment = DiscussionComment::get($fCommentID); |
| ... | ... | @@ -135,12 +120,16 @@ if(checkSession()) { |
| 135 | 120 | } else if (isset($fNewThread)){ // Start adding a new Thread |
| 136 | 121 | $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1"); |
| 137 | 122 | $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject ,$Comment, $fCommentID, "1")); |
| 138 | - | |
| 139 | - } else { // If no discussion exists | |
| 140 | - $main->setErrorMessage("Error: No discussion thread available"); | |
| 141 | - } | |
| 142 | - | |
| 123 | + } else { | |
| 124 | + // input validation | |
| 125 | + if (isset($fDocumentID)) { | |
| 126 | + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); | |
| 127 | + $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1)); | |
| 128 | + } else { | |
| 129 | + $main->setErrorMessage("You did not specify a document to add a comment to."); | |
| 130 | + } | |
| 131 | + } | |
| 143 | 132 | $main->setCentralPayload($oPatternCustom); |
| 144 | 133 | $main->render(); |
| 145 | -} // end of if checksession | |
| 134 | +} | |
| 146 | 135 | ?> |
| 147 | 136 | \ No newline at end of file | ... | ... |