Commit 5090cba71360b3f93d5bf7b704eff74bea7d1886

Authored by omar
1 parent 07e3e8e2

Changed back buttons and cancel buttons to use HREF instead of history.go(-1)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1910 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/discussions/addCommentBL.php
@@ -31,7 +31,7 @@ if (checkSession()) { @@ -31,7 +31,7 @@ if (checkSession()) {
31 if (isset($fAddComment)) { // User wishes to add a comment 31 if (isset($fAddComment)) { // User wishes to add a comment
32 if ($fDocumentID > 0) { // The document ID is positive 32 if ($fDocumentID > 0) { // The document ID is positive
33 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); 33 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID");
34 - $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody)); 34 + $oPatternCustom->setHtml(getAddComment($fDocumentID,$sSubject,$sBody, $fCommentID, 1));
35 } 35 }
36 else { // And invalid Document ID was sent 36 else { // And invalid Document ID was sent
37 $main->setErrorMessage("The Document id cannot be lss than 0. ID is invalid."); 37 $main->setErrorMessage("The Document id cannot be lss than 0. ID is invalid.");
@@ -99,7 +99,7 @@ if (checkSession()) { @@ -99,7 +99,7 @@ if (checkSession()) {
99 }else { // the user has not entered BOTH a subject and a text body 99 }else { // the user has not entered BOTH a subject and a text body
100 $main->setErrorMessage("The subject line and/or body may be empty" . $NewCommentSubject . "#" . $NewComment); 100 $main->setErrorMessage("The subject line and/or body may be empty" . $NewCommentSubject . "#" . $NewComment);
101 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID"); 101 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID");
102 - $oPatternCustom->addHtml(getAddComment($fDocumentID,$_POST["NewCommentSubject"],$_POST["NewComment"])); 102 + $oPatternCustom->addHtml(getAddComment($fDocumentID,$_POST["NewCommentSubject"],$_POST["NewComment"], $fCommentID, 1));
103 } // end of IF for Subject and Body test 103 } // end of IF for Subject and Body test
104 104
105 } else if (isset($fReplyComment)){ // if user is replying to existing comment 105 } else if (isset($fReplyComment)){ // if user is replying to existing comment
@@ -122,11 +122,11 @@ if (checkSession()) { @@ -122,11 +122,11 @@ if (checkSession()) {
122 $sReply = "Re: "; 122 $sReply = "Re: ";
123 }else { $sReply = ""; } 123 }else { $sReply = ""; }
124 124
125 - $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody) )); 125 + $oPatternCustom->addHtml(getAddComment($fDocumentID, $sReply . $oComment->getSubject() , urldecode($sReplyBody), $fCommentID, "-1" ));
126 126
127 } else if (isset($fNewThread)){ // Start adding a new Thread 127 } else if (isset($fNewThread)){ // Start adding a new Thread
128 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1"); 128 $main->setFormAction($_SERVER['PHP_SELF'] . "?fAddCommentSubmit=1&iDocumentID=$fDocumentID&fNewThread=1");
129 - $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject , $Comment )); 129 + $oPatternCustom->addHtml(getAddComment($fDocumentID, $CommentSubject , $Comment, $fCommentID, "1"));
130 130
131 } else { // If no discussion exists 131 } else { // If no discussion exists
132 $main->setErrorMessage("Error: No discussion thread available"); 132 $main->setErrorMessage("Error: No discussion thread available");
presentation/lookAndFeel/knowledgeTree/discussions/addCommentUI.inc
@@ -62,15 +62,19 @@ function renderDocumentPath($iDocumentID) { @@ -62,15 +62,19 @@ function renderDocumentPath($iDocumentID) {
62 * @param $sSubject -> a Subject text 62 * @param $sSubject -> a Subject text
63 * @param $sBody -> a Body text 63 * @param $sBody -> a Body text
64 */ 64 */
65 -function getAddComment($fDocumentID, $sSubject, $sBody) { 65 +function getAddComment($fDocumentID, $sSubject, $sBody, $iCommentID, $fNewComment = null) {
66 global $default; 66 global $default;
67 67
68 $sHeading = "Add a Comment"; 68 $sHeading = "Add a Comment";
69 $sToRender .= renderHeading($sHeading); 69 $sToRender .= renderHeading($sHeading);
70 $sToRender .= renderDocumentPath($fDocumentID); 70 $sToRender .= renderDocumentPath($fDocumentID);
71 $sToRender .= "<table width=\"100%\" border=\"0\" cellpadding=0 ><tr><td></td>\n"; 71 $sToRender .= "<table width=\"100%\" border=\"0\" cellpadding=0 ><tr><td></td>\n";
72 - $sToRender .= "<td align=right width=100%><input onmouseover=\"this.style.cursor='hand'\" type=\"image\" src=\"$default->graphicsUrl/widgets/submit.gif\"></td>";  
73 - $sToRender .= "<td width=\"10\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" ></td></tr>\n"; 72 + $sToRender .= "<td align=right width=100%><input onmouseover=\"this.style.cursor='hand'\" type=\"image\" src=\"$default->graphicsUrl/widgets/submit.gif\"></td>";
  73 + if($fNewComment>0){ // If user is creating a new comment
  74 + $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fForDiscussion=1&fDocumentID=$fDocumentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n";
  75 + }else { // If the user is replying to a comment
  76 + $sToRender .= "<td width=\"10\"><a href=\"" . generateControllerLink("viewDiscussion", "fViewComment=1&iDocumentID=$fDocumentID&iCommentID=$iCommentID") . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=0 ></a></td></tr>\n";
  77 + }
74 $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td colspan=2>\n"; 78 $sToRender .= "<br><tr><td valign=\"top\" width=10><b>Subject</b></td><td colspan=2>\n";
75 $sToRender .= "<input type=\"text\" style=\"width:385\" name=\"NewCommentSubject\" id=\"NewCommentSubject\" value=\"$sSubject\"></td></tr>\n"; 79 $sToRender .= "<input type=\"text\" style=\"width:385\" name=\"NewCommentSubject\" id=\"NewCommentSubject\" value=\"$sSubject\"></td></tr>\n";
76 $sToRender .= "<tr><td valign=\"top\"><b>Body</b></td><td colspan=2><textarea cols=60 rows=\"21\" name=\"NewComment\" id=\"NewComment\" style=\"FONT-STYLE: normal; FONT-FAMILY: sans-serif; FONT-VARIANT: normal\">$sBody</textarea></td></tr></table>\n"; 80 $sToRender .= "<tr><td valign=\"top\"><b>Body</b></td><td colspan=2><textarea cols=60 rows=\"21\" name=\"NewComment\" id=\"NewComment\" style=\"FONT-STYLE: normal; FONT-FAMILY: sans-serif; FONT-VARIANT: normal\">$sBody</textarea></td></tr></table>\n";
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionUI.inc
@@ -13,8 +13,8 @@ function getPageButtons($oThread){ @@ -13,8 +13,8 @@ function getPageButtons($oThread){
13 global $default; 13 global $default;
14 14
15 $sToRender .= "<table width=100%><tr>\n"; 15 $sToRender .= "<table width=100%><tr>\n";
16 - $sToRender .= "<td align=right width=100%><a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a></td>\n";  
17 - $sToRender .= "<td align=right width=10><img src=\"$default->graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" /></td>\n"; 16 + $sToRender .= "<td align=right width=100%><a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1&fNewComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a></td>\n";
  17 + $sToRender .= "<td align=right width=10><a href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a></td>\n";
18 18
19 $sToRender .= "</tr></table>\n"; 19 $sToRender .= "</tr></table>\n";
20 //$sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a>\n"; 20 //$sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a>\n";
@@ -118,7 +118,7 @@ function getViewComment($iNum,$oThread,$oComment,$oUser) { @@ -118,7 +118,7 @@ function getViewComment($iNum,$oThread,$oComment,$oUser) {
118 $sToRender .= "<td width=100><b>Views: </b> " . $oThread->getNumberOfViews() . "</td>"; 118 $sToRender .= "<td width=100><b>Views: </b> " . $oThread->getNumberOfViews() . "</td>";
119 $sToRender .= "<td width=20></td>"; 119 $sToRender .= "<td width=20></td>";
120 $sToRender .= "<td><b>Replies: </b> " . $oThread->getNumberOfReplies() . "</td>"; 120 $sToRender .= "<td><b>Replies: </b> " . $oThread->getNumberOfReplies() . "</td>";
121 - $sToRender .= "<td align=right><a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1") . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a>"; 121 + $sToRender .= "<td align=right><a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $oThread->getDocumentID() . "&fAddComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/addcomment.gif\" border=\"0\" /></a>";
122 $sToRender .= "<img src=\"$default->graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" ></td>"; 122 $sToRender .= "<img src=\"$default->graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" ></td>";
123 $sToRender .= "</tr></table><br>\n"; 123 $sToRender .= "</tr></table><br>\n";
124 $sToRender .= "<table border=\"0\" width=\"100%\">\n"; 124 $sToRender .= "<table border=\"0\" width=\"100%\">\n";
@@ -156,7 +156,7 @@ function getCommentBody($oComment, $iDocumentID, $oUser) { @@ -156,7 +156,7 @@ function getCommentBody($oComment, $iDocumentID, $oUser) {
156 $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n"; 156 $sToRender .= "<br><table width=100% border=0><tr ><td colspan=2><b>Author: </b>" . $oUser->getUserName() . "</td>\n";
157 $sToRender .= "<td align=right>\n"; 157 $sToRender .= "<td align=right>\n";
158 $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>"; 158 $sToRender .= "<a href=\"" . generateControllerLink("addComment", "fDocumentID=" . $iDocumentID . "&fReplyComment=1&fCommentID=" . $oComment->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/reply.gif\" border=\"0\" /></a>";
159 - $sToRender .= "</td><td width=30><img src=\"$default->graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" ></td></tr>\n"; 159 + $sToRender .= "</td><td width=30><a href=\"" . generateControllerLink("viewDiscussion", "fForDiscussion=1&fDocumentID=$iDocumentID") . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=0 ><a></td></tr>\n";
160 $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">"; 160 $sToRender .= "<tr><td width=\"1\" style=\"background-color:#F5F6EE;\" valign=\"top\"><b>Subject: </b></td><td width=405 style=\"background-color:#F5F6EE;\">";
161 $sToRender .= "<a>" . $oComment->getSubject() . "</a>"; 161 $sToRender .= "<a>" . $oComment->getSubject() . "</a>";
162 $sToRender .= "</td><td colspan=2><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font>&nbsp;&nbsp;&nbsp;</td></tr><tr><td colspan=4 valign=top>"; 162 $sToRender .= "</td><td colspan=2><b>Date: </b><font color=\"#056DCE\">" . $oComment->getDate() . "</font>&nbsp;&nbsp;&nbsp;</td></tr><tr><td colspan=4 valign=top>";