Non-Inline Function Definitions
// Print this comment. Each comment is contained in a one-cell
// table (so that a border is shown). If the comment is completed,
// show that it is completed. Otherwise, if CompleteLink is true
// (and this is set only in the Author override of View), show
// a link allowing the comment to be completed.
IString CommentType::Print(IBoolean CompleteLink) {
// Print the start of the table
IString Result=
"<br><table border=1><tr><td>";
// Print the User ID of the user who created the comment
// Underscores in User ID should become spaces
Result+="Created by: <font color=\"#005555\">"
+UserId.change("_"," ")
+"</font>" ;
// Print the Date and time of comment creation
Result+=" on: <font color=\"#005555\">"
+Date
+"</font> at <font color=\"#005555\">"
+Time
+"</font></td></tr>";
// On a new row, print the comment text
Result+="<tr><td>"
+Text
+"</td></tr>\n";
// Indicate that comment is complete
if (Completed)
Result+="<tr><td><font color=\"#FF0033\">Completed</font></td></tr>";
// Otherwise, add link to complete it if requested by caller
else if (CompleteLink)
Result+="<tr><td><a href=\"review.exe?Op=Complete+key="
+Req->GetKey()
+"+file="+Req->GetFilename()
+"+line="+IString(LineNum)
+"+cmt="+IString(CommentNum)
+"\">Mark as Completed</a></td></tr>";
Result+="</table>\n";
return Result;
}
// Set method for creating a comment within this comment section
// Only creates the comment if it is one of the first 16 comments
// as only 16 comments are allowed per paragraph or list item.
void CommentSection::SetComment(
IString Text, IString User,
IString Date, IString Time,
IBoolean Completed) {
if (Count>=0 && Count<16) {
Comment[Count].SetText(Text);
Comment[Count].SetUser(User);
Comment[Count].SetDate(Date);
Comment[Count].SetTime(Time);
Comment[Count].SetReq(Req);
Comment[Count].SetCompleted(Completed);
Comment[Count].SetLineNum(Number);
Comment[Count].SetCommentNum(Count+1);
}
}
// CommentSection::Print() prints the tag for the section;
// if the section is not section 0 (everything up to the first
// paragraph or list item tag) it prints a hyperlinked number
// that allows comment insertion;
// if there are any comments for this section, it calls
// CommentType::Print() for each of them;
// finally, it prints its text, that is, the original HTML up
// to the next paragraph or list item tag.
IString CommentSection::Print() {
IString SNumber=Number;
IString Result=Tag;
if (Number>0)
Result+="<a href=\""+EXE+"?Op=ShowAdd+key="+Req->GetKey()
+"+file="+Req->GetFilename()
+"+line="+SNumber+"#Ct"+SNumber+"\">"+SNumber+"</a> ";
for (int cxc=0;cxc<=Count;cxc++)
Result+=Comment[cxc].Print(CompleteLink);
Result+="<a name=\"Ct"+SNumber+"\">";
Result+=Text;
return Result;
}
