diff --git a/include/comment.php b/include/comment.php index 703cf62..d26f088 100644 --- a/include/comment.php +++ b/include/comment.php @@ -163,11 +163,6 @@ class Comment { return true; } - function getOutputEditorValues($aClean) - { - /* Stub */ - } - /** * Removes the current comment from the database. @@ -200,48 +195,65 @@ class Comment { return $oRow->cnt; } - /** - * class static functions - */ + function getOutputEditorValues($aClean) + { + $this->sSubject = $aClean['sSubject']; + $this->sBody = $aClean['sBody']; + $this->iParentId = $aClean['iThread']; + $this->iVersionId = $aClean['iVersionId']; + + if(!$this->oOwner) + $this->oOwner = $_SESSION['current']; + + if(!$this->sDateCreated) + $this->sDateCreated = date("l F jS Y, H:i"); + } /** * display a single comment (in $oRow) */ function view_app_comment($oRow) + { + $oComment = new comment(null, $oRow); + $oComment->display(); + } + + function display() { echo html_frame_start('','98%'); echo '',"\n"; // message header - echo "\n"; - $oComment = new comment($oRow->commentId); // delete message button, for admins - if ($oComment->canEdit()) + if ($this->canEdit()) { - $oVersion = new version($oRow->versionId); echo ""; echo "
commentId.">\n"; - echo " ".$oRow->subject."
\n"; - echo " by ".forum_lookup_user($oRow->userId)." on ".$oRow->time."
\n"; + echo "
iCommentId.">\n"; + echo " ".$this->sSubject."
\n"; + echo " by ".forum_lookup_user($this->oOwner->iUserId)." on ".$this->sDateCreated."
\n"; echo "
\n"; // body - echo htmlify_urls($oRow->body), "

\n"; + echo htmlify_urls($this->sBody), "

\n"; // only add RE: once - if(eregi("RE:", $oRow->subject)) - $subject = $oRow->subject; + if(eregi("RE:", $this->sSubject)) + $sSubject = $this->sSubject; else - $subject = "RE: ".$oRow->subject; + $sSubject = "RE: ".$this->sSubject; + $oVersion = new version($this->iVersionId); + $oM = new objectManager("comment", "Post new ocmment"); + $oM->setReturnTo($oVersion->objectMakeUrl()); // reply post buttons - echo " [appId&iVersionId=$oRow->versionId\">post new] \n"; - echo " [appId&iVersionId=$oRow->versionId&sSubject=". - urlencode("$subject")."&iThread=$oRow->commentId\">reply to this] \n"; + echo " [makeUrl("add")."&iAppId=$this->iAppId&iVersionId=$this->iVersionId\">post new] \n"; + echo " [makeUrl("add")."&iAppId=$this->iAppId&iVersionId=$this->iVersionId&sSubject=". + urlencode("$sSubject")."&iThread=$this->iCommentId\">reply to this] \n"; echo "
\n"; - echo "commentId\" />"; + echo "iCommentId\" />"; echo ""; echo ""; echo ""; @@ -474,7 +486,9 @@ class Comment { echo '',"\n"; echo '
',"\n"; - + + $oVersion = new version($versionId); + // message display mode changer if ($_SESSION['current']->isLoggedIn()) { @@ -482,7 +496,6 @@ class Comment { if (!empty($aClean['sCmode'])) $_SESSION['current']->setPref("comments:mode", $aClean['sCmode']); - $oVersion = new version($versionId); $sel[$_SESSION['current']->getPref("comments:mode", "threaded")] = 'selected'; echo '',"\n"; - + + $oM = new objectManager("comment", "Add comment"); + $oM->setReturnTo($oVersion->objectMakeUrl()); + // post new message button - echo '',"\n"; //end comment format table @@ -541,6 +560,67 @@ class Comment { echo '
',"\n"; @@ -498,9 +511,15 @@ class Comment { // blank space echo '   ',"\n"; + echo ''; + echo ''; + echo $oM->makeUrlFormData(); + echo ' ',"\n"; echo '
',"\n"; } + function allowAnonymousSubmissions() + { + return TRUE; + } + + function objectGetCustomVars($sAction) + { + switch($sAction) + { + case "add": + return array("iThread", "iAppId", "iVersionId"); + + default: + return null; + } + } + + function outputEditor($aClean) + { + $sMesTitle = "Post New Comment"; + + if($aClean['iThread'] > 0) + { + $hResult = query_parameters("SELECT * FROM appComments WHERE commentId = '?'", + $aClean['iThread']); + $oRow = query_fetch_object($hResult); + if($oRow) + { + $sMesTitle = "Replying To ... $oRow->subject\n"; + echo html_frame_start($oRow->subject,500); + echo htmlify_urls($oRow->body), "

\n"; + echo html_frame_end(); + } + } + + echo "

Enter your comment in the box below."; + echo "
Please do not paste large terminal or debug outputs here.

"; + + echo html_frame_start($sMesTitle,500,"",0); + + echo '',"\n"; + echo "\n"; + echo " \n"; + echo "\n"; + echo " \n"; + echo "\n"; + + echo "
From:  ".$_SESSION['current']->sRealname."
Subject:  sSubject."\" />
\n"; + + echo html_frame_end(); + + echo "\n"; + echo "\n"; + echo "\n"; + } + + function objectShowPreview() + { + return TRUE; + } + function objectMakeUrl() { $oVersion = new version($this->iVersionId);