Commit e4bfd63ac63717b6dd0214f8a0b552ec3a3d725c
1 parent
63a5446a
*** empty log message ***
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1766 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
407 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* BL information for viewing a Discussion | |
| 4 | +* | |
| 5 | +* @author Omar Rahbeeni | |
| 6 | +* @date 5 May 2003 | |
| 7 | +* @package presentation.lookAndFeel.knowledgeTree. | |
| 8 | +* | |
| 9 | +*/ | |
| 10 | + require_once("../../../../config/dmsDefaults.php"); | |
| 11 | + | |
| 12 | +if (checkSession()) { | |
| 13 | + //require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 14 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 15 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | |
| 16 | + //require_once("addUnitUI.inc"); | |
| 17 | + //require_once("../adminUI.inc"); | |
| 18 | + require_once("addCommentUI.inc"); //### | |
| 19 | + | |
| 20 | + require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 21 | + require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 22 | + require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 23 | + require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 24 | + //require_once("../viewDiscussionUI.inc"); //### | |
| 25 | + //require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 26 | + //require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 27 | + require_once("$default->fileSystemRoot/lib/security/permission.inc"); | |
| 28 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 29 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 30 | + require_once("$default->fileSystemRoot/lib/discussions/DiscussionThread.inc"); //### | |
| 31 | + require_once("$default->fileSystemRoot/lib/discussions/DiscussionComment.inc"); //### | |
| 32 | + //require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 33 | + //require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 34 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 35 | + | |
| 36 | + $oPatternCustom = & new PatternCustom(); | |
| 37 | + | |
| 38 | + if(checksession) { | |
| 39 | + if (isset($fAddComment)) { | |
| 40 | + if ($fDocumentID > 0) { | |
| 41 | + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); | |
| 42 | + $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody)); | |
| 43 | + } | |
| 44 | + else { | |
| 45 | + //nothing | |
| 46 | + } | |
| 47 | + } else if (isset($fViewComment)){ | |
| 48 | + if (isset($iCommentID)) { | |
| 49 | + $oComment = DiscussionComment::get($iCommentID); | |
| 50 | + $oUser = User::get($oComment->getUserID()); | |
| 51 | + | |
| 52 | + $oPatternCustom->setHtml(getCommentBody($oComment->getBody(), $oComment->getSubject(),$oComment->getDate(),$iDocumentID,$oUser->getUserName())) ; | |
| 53 | + } | |
| 54 | + } else if (isset($fAddCommentSubmit)) { | |
| 55 | + $iThreadID = DiscussionThread::getThreadIDforDoc($iDocumentID); | |
| 56 | + | |
| 57 | + if ($iThreadID > 0){ | |
| 58 | + if ($_POST["NewComment"] != "" and $_POST["NewCommentSubject"] != "") | |
| 59 | + { | |
| 60 | + // Create the new comment | |
| 61 | + $oComment = & new DiscussionComment(urlencode($_POST["NewComment"]),$_POST["NewCommentSubject"],$_SESSION["userID"],$iDocumentID); | |
| 62 | + $oComment->setThreadID($iThreadID); | |
| 63 | + $oComment->create(); | |
| 64 | + | |
| 65 | + if($oComment->getID() > 0) { | |
| 66 | + $oThread = DiscussionThread::get($iThreadID); | |
| 67 | + $oThread->setLastCommentID($oComment->getID()); | |
| 68 | + $oThread->setNumberOfReplies(); | |
| 69 | + if ($oThread->Update()) { | |
| 70 | + $oPatternCustom->addHtml(getSubmitSuccessPage($iDocumentID)); | |
| 71 | + }else { | |
| 72 | + $oPatternCustom->addHtml(getViewFailPage("Thread Object failed to update.")); | |
| 73 | + } | |
| 74 | + }else { | |
| 75 | + $oPatternCustom->addHtml(getViewFailPage("Comment Object failed in creation.") ); | |
| 76 | + } | |
| 77 | + }else { | |
| 78 | + $oPatternCustom->addHtml(getViewFailPage("The subject line and/or body may be empty.") ); | |
| 79 | + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); | |
| 80 | + $oPatternCustom->addHtml(getAddComment($fDocumentID,$_POST["NewCommentSubject"],$_POST["NewComment"])); | |
| 81 | + } | |
| 82 | + }else{ | |
| 83 | + $oPatternCustom->addHtml(getViewFailPage("No threadID($iThreadID) exists for this document")); | |
| 84 | + } | |
| 85 | + | |
| 86 | + } else if (isset($fReplyComment)){ // if user is replying to existing comment | |
| 87 | + $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); | |
| 88 | + $oPatternCustom->addHtml(getAddComment($fDocumentID,"Re: " . $CommentSubject , "\n\n\n[Start Text Body]\n\n" . $Comment . "\n\n[End Text Body]")); | |
| 89 | + | |
| 90 | + }else { // If no discussion exists | |
| 91 | + $oPatternCustom->setHtml(getViewFailPage("No discussions exist")); | |
| 92 | + } | |
| 93 | + | |
| 94 | + } // end of if checksession | |
| 95 | + | |
| 96 | + $main->setCentralPayload($oPatternCustom); | |
| 97 | + $main->render(); | |
| 98 | +} | |
| 99 | +?> | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Presentation information for adding a unit | |
| 4 | +* | |
| 5 | +* @author Omar Rahbeeni | |
| 6 | +* @date 5 May 2003 | |
| 7 | +* @package presentation.lookAndFeel.knowledgeTree. | |
| 8 | +* | |
| 9 | +*/ | |
| 10 | + | |
| 11 | +// On a successful save | |
| 12 | +function getSubmitSuccessPage($iDocumentID){ | |
| 13 | + global $default; | |
| 14 | + $sMessage = "Your submission has been successful."; | |
| 15 | + | |
| 16 | + $sToRender .= "$sMessage<br><br><a href=\"" . generateControllerLink("viewDiscussion", "fDocumentID=" . $iDocumentID . "&fForDiscussion=1") . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a>"; | |
| 17 | +// $sToRender .= ""; | |
| 18 | +// $sToRender .= ""; | |
| 19 | + | |
| 20 | + return $sToRender; | |
| 21 | +} | |
| 22 | + | |
| 23 | +// If there are no threads to view for a document | |
| 24 | +function getViewFailPage($sMessage) | |
| 25 | +{ | |
| 26 | + global $default; | |
| 27 | + | |
| 28 | + if (strlen($sMessage)>0){ | |
| 29 | + $sToRender = $sMessage; | |
| 30 | + } | |
| 31 | + else $sToRender = "Current document has no discussion. Press the ADD button to start a discussion."; | |
| 32 | + | |
| 33 | + return $sToRender; | |
| 34 | +} | |
| 35 | + | |
| 36 | +function renderHeading($sHeading) { | |
| 37 | + global $default; | |
| 38 | + | |
| 39 | + $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); | |
| 40 | + $sColor = $default->siteMap->getSectionColour($sSectionName, "th"); | |
| 41 | + $sToRender = "<table border=\"0\" width=\"600\">\n"; | |
| 42 | + $sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\"><font color=\"ffffff\">$sHeading</font></th></tr>\n"; | |
| 43 | + $sToRender .= "<tr/>\n"; | |
| 44 | + $sToRender .= "<tr/>\n"; | |
| 45 | + $sToRender .= "</table>\n"; | |
| 46 | + return $sToRender; | |
| 47 | +} | |
| 48 | + | |
| 49 | +function renderDocumentPath($iDocumentID) { | |
| 50 | + global $default; | |
| 51 | + | |
| 52 | + $oDocument = & Document::get($iDocumentID); | |
| 53 | + $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); | |
| 54 | + $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); | |
| 55 | + $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > "; | |
| 56 | + $sDocumentPath .= "<a href=\"$default->rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $oDocument->getID() . "&fForInlineView=1\">" . $oDocument->getName() . "</a>"; | |
| 57 | + return "<table border=0 cellpadding=\"5\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n"; | |
| 58 | +} | |
| 59 | + | |
| 60 | + | |
| 61 | +function getAddComment($fDocumentID, $sSubject, $sBody) { | |
| 62 | + global $default; | |
| 63 | + | |
| 64 | + $iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); | |
| 65 | + $oThread = DiscussionThread::get($iThreadID); | |
| 66 | + if($oThread) { // if thread object exists | |
| 67 | + $sHeading = "Add a Comment"; | |
| 68 | + | |
| 69 | + $sToRender .= renderHeading($sHeading); | |
| 70 | + $sToRender .= renderDocumentPath($oThread->getDocumentID()); | |
| 71 | + $sToRender .= "<table width=\"100%\" border=0><tr><td></td>\n"; | |
| 72 | + $sToRender .= "<td align=right><input type=\"submit\" style=\"BORDER-RIGHT: 0px groove; BORDER-TOP: 0px groove; BACKGROUND-IMAGE: url($default->graphicsUrl/widgets/submit.gif); BORDER-LEFT: 0px groove; WIDTH: 45px; BORDER-BOTTOM: 0px groove; HEIGHT: 18; BACKGROUND-COLOR: white\" width=\"45\" height=\"20\" value=\" \" width=\"100\"></td></tr>\n"; | |
| 73 | + $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td>\n"; | |
| 74 | + $sToRender .= "<input type=\"text\" style=\"width:100%\" name=\"NewCommentSubject\" id=\"NewCommentSubject\" value=\"$sSubject\"></td></tr>\n"; | |
| 75 | + $sToRender .= "<tr><td valign=\"top\"><b>Body</b></td><td><textarea style=\"width:100%\" rows=\"21\" name=\"NewComment\" id=\"NewComment\" style=\"FONT-STYLE: normal; FONT-FAMILY: sans-serif; FONT-VARIANT: normal\">$sBody</textarea></td></tr></table>\n"; | |
| 76 | + $sToRender .= "</table>"; | |
| 77 | + } | |
| 78 | + return $sToRender; | |
| 79 | + | |
| 80 | +} | |
| 81 | + | |
| 82 | +function getCommentBody($sCommentBody, $sCommentSubject,$dDate,$iDocumentID, $sUserName) { | |
| 83 | + global $default; | |
| 84 | + | |
| 85 | + $sHeading = "Document Comment"; | |
| 86 | + | |
| 87 | + $sToRender .= renderHeading($sHeading); | |
| 88 | + $sToRender .= renderDocumentPath($iDocumentID); | |
| 89 | + $sToRender .= "<br> <b>Author: </b>$sUserName"; | |
| 90 | + $sToRender .= "<table width=\"96%\" border=\"1\"><tr>"; | |
| 91 | + $sToRender .= "<td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\"> <font color=#056DCE>$sCommentSubject</font></td>"; | |
| 92 | + $sToRender .= "<td><b>Date: </b><font color=\"#056DCE\">$dDate</font></td></tr><tr><td colspan=3><br>$sCommentBody</a></td>"; | |
| 93 | + $sToRender .= "</tr></table>"; | |
| 94 | + return $sToRender; | |
| 95 | +} | |
| 96 | + | |
| 97 | +function viewDiscussionPage() { | |
| 98 | + global $default; | |
| 99 | + | |
| 100 | + $sToRender = ""; | |
| 101 | + return $sToRender; | |
| 102 | +} | |
| 103 | +?> | |
| 0 | 104 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionBL.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* BL information for viewing a Discussion | |
| 4 | +* | |
| 5 | +* @author Omar Rahbeeni | |
| 6 | +* @date 5 May 2003 | |
| 7 | +* @package presentation.lookAndFeel.knowledgeTree. | |
| 8 | +* | |
| 9 | +*/ | |
| 10 | + | |
| 11 | + require_once("../../../../config/dmsDefaults.php"); | |
| 12 | + | |
| 13 | +if (checkSession()) { | |
| 14 | + //require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 15 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 16 | + //require_once("addUnitUI.inc"); | |
| 17 | + //require_once("../adminUI.inc"); | |
| 18 | + require_once("viewDiscussionUI.inc"); //### | |
| 19 | + | |
| 20 | + require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 21 | + require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | |
| 22 | + require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 23 | + require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 24 | + //require_once("../viewDiscussionUI.inc"); //### | |
| 25 | + //require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 26 | + //require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 27 | + require_once("$default->fileSystemRoot/lib/security/permission.inc"); | |
| 28 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 29 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 30 | + require_once("$default->fileSystemRoot/lib/discussions/DiscussionThread.inc"); //### | |
| 31 | + require_once("$default->fileSystemRoot/lib/discussions/DiscussionComment.inc"); //### | |
| 32 | + //require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 33 | + //require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 34 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 35 | + | |
| 36 | + $oPatternCustom = & new PatternCustom(); | |
| 37 | + | |
| 38 | +if(checksession) { | |
| 39 | + if (isset($fForDiscussion)) { | |
| 40 | + if ($fDocumentID > 0) { | |
| 41 | + $iThreadID = DiscussionThread::getThreadIDforDoc($fDocumentID); | |
| 42 | + if ($iThreadID) {// if thread ID does exist | |
| 43 | + $oThread = DiscussionThread::get($iThreadID); | |
| 44 | + if($oThread) { // if thread object exists | |
| 45 | + // Iterate through the number of comments | |
| 46 | + $sAllCommentID = $oThread->getAllCommentID(); | |
| 47 | + $arrAllCommentID = explode(",", $sAllCommentID); | |
| 48 | + $iNumMax = $oThread->getNumberOfReplies(); | |
| 49 | + for ($i = 0; $i < $iNumMax; $i++) { | |
| 50 | + $iCommentID = $arrAllCommentID[$i]; | |
| 51 | + $oComment = DiscussionComment::get($iCommentID); | |
| 52 | + $oUser = User::get($oComment->getUserID()); | |
| 53 | + $oPatternCustom->addHtml(getViewComment($i+1,$oThread,$oComment,$oUser)); | |
| 54 | + } | |
| 55 | + // On opening, increment the number of views of current thread & update database | |
| 56 | + if($_SESSION['Discussion'][0]->bViews !=true ){ | |
| 57 | + $oThread->setNumberOfViews(); | |
| 58 | + if($oThread->Update() == false) $oPatternCustom->addHtml("Failed to update. Please Contact Database Administrator in this regard") ; | |
| 59 | + $_SESSION['Discussion'][0]->bViews = true; | |
| 60 | + } | |
| 61 | + } else { $oPatternCustom->setHtml(getViewFailPage("")) ;} | |
| 62 | + } else { $oPatternCustom->addHtml(getViewFailPage("No threadID for this document.")); } | |
| 63 | + } else { } | |
| 64 | + } else if (isset($fViewComment)){ | |
| 65 | + if (isset($iCommentID)) { | |
| 66 | + $oComment = DiscussionComment::get($iCommentID); | |
| 67 | + $oUser = User::get($oComment->getUserID()); | |
| 68 | + | |
| 69 | + //$main->setFormAction(generateControllerLink("addComment", "fDocumentID=$iDocumentID&fCommentID=$iCommentID&fReplyComment=1")); | |
| 70 | + $main->setFormAction("/presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php?fDocumentID=$iDocumentID&fCommentID=$iCommentID&fReplyComment=1"); | |
| 71 | + //$main->setFormAction($_SERVER['PHP_SELF'] . "?fReplyComment=1"); | |
| 72 | + $oPatternCustom->setHtml(getCommentBody($oComment,$iDocumentID,$oUser)) ; | |
| 73 | + } | |
| 74 | + } else if (isset($fReplyComment)){ | |
| 75 | + $oPatternCustom->setHtml("###" . count($_POST) . "###" . $Comment . "###" . $CommentSubject); | |
| 76 | + } else { // If no discussion exists | |
| 77 | + } | |
| 78 | + | |
| 79 | + } // end of if checksession | |
| 80 | + | |
| 81 | + $main->setCentralPayload($oPatternCustom); | |
| 82 | + $main->render(); | |
| 83 | + | |
| 84 | +} | |
| 85 | +?> | ... | ... |
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Presentation information for adding a unit | |
| 4 | +* | |
| 5 | +* @author Omar Rahbeeni | |
| 6 | +* @date 5 May 2003 | |
| 7 | +* @package presentation.lookAndFeel.knowledgeTree. | |
| 8 | +* | |
| 9 | +*/ | |
| 10 | + | |
| 11 | + | |
| 12 | +// If there are no threads to view for a document | |
| 13 | +function getViewFailPage($sMessage) | |
| 14 | +{ | |
| 15 | + global $default; | |
| 16 | + | |
| 17 | + if (strlen($sMessage)>0){ | |
| 18 | + $sToRender = $sMessage; | |
| 19 | + } | |
| 20 | + else $sToRender = "Current document has no discussion. Press the ADD button to start a discussion."; | |
| 21 | + | |
| 22 | + return $sToRender; | |
| 23 | +} | |
| 24 | + | |
| 25 | +function renderHeading($sHeading) { | |
| 26 | + global $default; | |
| 27 | + | |
| 28 | + $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); | |
| 29 | + $sColor = $default->siteMap->getSectionColour($sSectionName, "th"); | |
| 30 | + $sToRender = "<table border=\"0\" width=\"600\">\n"; | |
| 31 | + $sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\"><font color=\"ffffff\">$sHeading</font></th></tr>\n"; | |
| 32 | + $sToRender .= "<tr/>\n"; | |
| 33 | + $sToRender .= "<tr/>\n"; | |
| 34 | + $sToRender .= "</table>\n"; | |
| 35 | + return $sToRender; | |
| 36 | +} | |
| 37 | + | |
| 38 | +function renderDocumentPath($iDocumentID) { | |
| 39 | + global $default; | |
| 40 | + | |
| 41 | + $oDocument = & Document::get($iDocumentID); | |
| 42 | + $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); | |
| 43 | + $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); | |
| 44 | + $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > "; | |
| 45 | + $sDocumentPath .= "<a href=\"$default->rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $oDocument->getID() . "&fForInlineView=1\">" . $oDocument->getName() . "</a>"; | |
| 46 | + return "<table border=0 cellpadding=\"5\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n"; | |
| 47 | +} | |
| 48 | + | |
| 49 | +function getViewComment($iNum,$oThread,$oComment,$oUser) { | |
| 50 | + global $default; | |
| 51 | + | |
| 52 | + $iSubjectChars = 59; | |
| 53 | + // If iNum is odd then highlight it | |
| 54 | + if (($iNum%2) == 1) $BGcolor = "#F5F6EE"; | |
| 55 | + if (($iNum%2) == 0) $UserBGcolor = "#F5F6EE"; | |
| 56 | + | |
| 57 | + // If the Subject string is too long | |
| 58 | + if (strlen($oComment->getSubject())>$iSubjectChars ) $dotdot = " ..."; | |
| 59 | + if (strlen($oUser->getUserName())> 13 ) $Userdotdot = " ..."; | |
| 60 | + | |
| 61 | + // If this is the first Subject line then create a table | |
| 62 | + if ($iNum == 1) { | |
| 63 | + $sHeading = "Document Discussion Comments"; | |
| 64 | + | |
| 65 | + $sToRender .= renderHeading($sHeading ); | |
| 66 | + $sToRender .= renderDocumentPath($oThread->getDocumentID()); | |
| 67 | + $sToRender .= "<table border=0 width=0><tr>"; | |
| 68 | + $sToRender .= "<td><b>Views: </b> " . $oThread->getNumberOfViews() . "</td>"; | |
| 69 | + $sToRender .= "<td width=20></td>"; | |
| 70 | + $sToRender .= "<td><b>Replies: </b> " . $oThread->getNumberOfReplies() . "</td>"; | |
| 71 | + $sToRender .= "</tr></table>\n"; | |
| 72 | + $sToRender .= "<table border=0 width=100%><tr><td width=0></td><td align=right><a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a></td></tr></table>\n"; | |
| 73 | + $sToRender .= "<table border=\"0\" width=\"100%\" cellspacing=0><tr>\n"; | |
| 74 | + $sToRender .= "<td><b> Subject</b></td>\n"; | |
| 75 | + $sToRender .= "<td><b>Author</b></td>\n"; | |
| 76 | + $sToRender .= "<td><b>Date</b></td>\n"; | |
| 77 | + $sToRender .= "</tr>\n"; | |
| 78 | + } | |
| 79 | + | |
| 80 | + $sToRender .= "<tr><td style=\"background-color:$BGcolor\" width=450>$iNum. <a style=\"width:94%\" href=\"" . $_SERVER['PHP_SELF'] . "?fViewComment=1&iCommentID=" . $oComment->getID() . "&iDocumentID=" . $oThread->getDocumentID() . "\" title=\"" . $oComment->getSubject() . "\">" . substr($oComment->getSubject(),0,$iSubjectChars ) . $dotdot . "</a></td>\n"; | |
| 81 | + $sToRender .= "<td style=\"background-color:$UserBGcolor\" width=\"100\" title=\"$oUser->getUserName()\">" . substr($oUser->getUserName(),0,10) . $Userdotdot . "</td>\n"; | |
| 82 | + $sToRender .= "<td style=\"background-color:$BGcolor\" width=\"70\">" . $oComment->getDate() . "<td></tr>\n"; | |
| 83 | + | |
| 84 | + // If this is the last subject line then close the table | |
| 85 | + if ($iNum == $iNumMax) { $sToRender .= "</table>\n\n";} | |
| 86 | + return $sToRender; | |
| 87 | +} | |
| 88 | + | |
| 89 | +//function getCommentBody($sCommentBody, $sCommentSubject,$dDate,$iDocumentID, $sUserName) { | |
| 90 | +function getCommentBody($oComment, $iDocumentID, $oUser) { | |
| 91 | + global $default; | |
| 92 | + | |
| 93 | + $sHeading = "Document Comment"; | |
| 94 | + | |
| 95 | + $sToRender .= renderHeading($sHeading); | |
| 96 | + $sToRender .= renderDocumentPath($iDocumentID); | |
| 97 | + | |
| 98 | + $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; | |
| 99 | + $sToRender .= "<td align=right>\n"; | |
| 100 | + $sToRender .= "<input type=\"submit\" style=\"BORDER-RIGHT: 0px groove; BORDER-TOP: 0px groove; BACKGROUND-IMAGE: url($default->graphicsUrl/widgets/reply.gif); BORDER-LEFT: 0px groove; WIDTH: 40px; BORDER-BOTTOM: 0px groove; HEIGHT: 18; BACKGROUND-COLOR: white\" height=\"20\" value=\" \" width=\"200\">"; | |
| 101 | + $sToRender .= "</td></tr>\n"; | |
| 102 | + $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">"; | |
| 103 | + $sToRender .= "<input name=\"CommentSubject\" id=\"CommentSubject\" style=\"background-color:#F5F6EE;BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 100%; BORDER-RIGHT-WIDTH: 0px\" readOnly width=0 value=\"" . $oComment->getSubject() . "\">"; | |
| 104 | + $sToRender .= "</td><td><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font></td></tr><tr><td colspan=3 valign=top>"; | |
| 105 | + $sToRender .= "<TEXTAREA readOnly name=\"Comment\" id=\"Comment\" style=\"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; SCROLLBAR-SHADOW-COLOR: white; SCROLLBAR-3DLIGHT-COLOR: white; SCROLLBAR-ARROW-COLOR: white; SCROLLBAR-DARKSHADOW-COLOR: white; SCROLLBAR-BASE-COLOR: white; BORDER-RIGHT-WIDTH: 0px;FONT-FAMILY: sans-serif;\" rows=70 cols=40> "; | |
| 106 | + $sToRender .= urldecode($oComment->getBody()); | |
| 107 | + $sToRender .= "</textarea></td>"; | |
| 108 | + $sToRender .= "</tr></table> "; | |
| 109 | + | |
| 110 | + | |
| 111 | + return $sToRender; | |
| 112 | +} | |
| 113 | + | |
| 114 | +function viewDiscussionPage() { | |
| 115 | + global $default; | |
| 116 | + | |
| 117 | + $sToRender = ""; | |
| 118 | + return $sToRender; | |
| 119 | +} | |
| 120 | +?> | |
| 0 | 121 | \ No newline at end of file | ... | ... |