?? bugdb.cpp
字號:
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"updateBug\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << myself << "\">"
"<TABLE><TH ALIGN=LEFT>Summary:</TH>"
"<TD><INPUT TYPE=text NAME=\"summary\" SIZE=40 VALUE=\""
<< bugs->sOneLineSummary << "\"></TD></TR>"
"<TR><TH ALIGN=LEFT>Category:</TH>"
"<TD><SELECT NAME=\"category\" SIZE=1>"
"<OPTION SELECTED VALUE=" << bugs->eCategory << ">"
<< eCATEGORY_STRING[bugs->eCategory] << "</OPTION>";
for (i = 1; eCATEGORY_STRING[i] != NULL; i++) {
con << TAG << "<OPTION VALUE=" << i << ">"
<< eCATEGORY_STRING[i] << "</OPTION>";
}
con << TAG <<
"</SELECT></TD></TR>"
"<TR><TH ALIGN=LEFT>Severity:</TH>"
"<TD><SELECT NAME=\"severity\" SIZE=1>"
"<OPTION SELECTED VALUE=" << bugs->eSeverity << ">"
<< eSEVERITY_STRING[bugs->eSeverity] << "</OPTION>";
for (i = 1; eSEVERITY_STRING[i] != NULL; i++) {
con << TAG << "<OPTION VALUE=" << i << ">"
<< eSEVERITY_STRING[i] << "</OPTION>";
}
con << TAG <<
"</SELECT></TD></TR>"
"<TR><TH ALIGN=LEFT>Priority:</TH>"
"<TD><SELECT NAME=\"priority\" SIZE=1>"
"<OPTION SELECTED VALUE=" << bugs->eFixingPriority << ">"
<< eFIXING_PRIORITY_STRING[bugs->eFixingPriority] << "</OPTION>";
for (i = 1; eFIXING_PRIORITY_STRING[i] != NULL; i++) {
con << TAG << "<OPTION VALUE=" << i << ">"
<< eFIXING_PRIORITY_STRING[i] << "</OPTION>";
}
con << TAG <<
"</SELECT></TD></TR>"
"<TR><TH ALIGN=LEFT>Platform:</TH>"
"<TD><INPUT TYPE=text NAME=\"platform\" VALUE=\""
<< bugs->sHardwarePlatform << "\"></TD></TR>"
"<TR><TH ALIGN=LEFT>OS:</TH>"
"<TD><INPUT TYPE=text NAME=\"os\"VALUE=\""
<< bugs->sOperatingSystem << "\"></TD></TR>"
"<TR><TH ALIGN=LEFT>Assigned to:</TH>"
"<TD><SELECT SIZE=1 NAME=\"name\">";
if (bugs->pAssignedTo != null) {
persons.at(bugs->pAssignedTo);
con << TAG << "<OPTION SELECTED VALUE=\"" << persons->sName
<< "\">" << persons->sName << "</OPTION>";
} else {
con << TAG << "<OPTION SELECTED VALUE=\"\"></OPTION>";
}
print(con, products->setEngineers);
con << TAG << "</SELECT></TD></TR>"
"<TR><TH ALIGN=LEFT>Similar with:</TH>"
"<TD><SELECT NAME=\"similar\" SIZE=1>"
"<OPTION SELECTED VALUE=\"\"></OPTION>";
allBugs.select();
print(con, allBugs);
con << TAG << "</SELECT></TD></TR></TABLE><BR>";
if (personStatus != Person::isUser) {
con << TAG <<
"<INPUT TYPE=submit NAME=\"action\" VALUE=\"Update\"> "
"<INPUT TYPE=reset VALUE=\"Reset\">";
}
con << TAG << "</FORM><P><FORM METHOD=POST ACTION=\"" << con.getStub()
<< "\"><INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\">"
"<INPUT TYPE=hidden NAME=\"page\" VALUE=\"updateReportForm\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << myself << "\">"
"<B>Report history:</B><BR><SELECT NAME=\"report\" SIZE=5>";
firstReport = bugs->pReportHistory;
if (reports.select(qAllReports) != 0) {
print(con, reports);
con << TAG <<
"</SELECT><BR><INPUT TYPE=submit NAME=\"action\" VALUE=\"Select\">"
" <INPUT TYPE=submit NAME=\"action\" VALUE=\"Add\">";
if (personStatus == Person::isAdministrator) {
con << TAG <<
" <INPUT TYPE=submit NAME=\"action\" VALUE=\"Remove\">";
}
} else {
con << TAG << EMPTY_LIST
"<BR><INPUT TYPE=submit NAME=\"action\" VALUE=\"Add\">";
}
con << TAG << "</FORM><P>";
con << TAG <<
"<FORM METHOD=POST ACTION=\"" << con.getStub() << "\">"
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"updateWorkAroundForm\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << myself << "\">"
"<B>Work arounds:</B><BR><SELECT NAME=\"workaround\" SIZE=5>";
firstReport = bugs->pWorkArounds;
if (reports.select(qAllReports) != 0) {
print(con, reports);
con << TAG <<
"</SELECT><BR><INPUT TYPE=submit NAME=\"action\" VALUE=\"Select\">"
" <INPUT TYPE=submit NAME=\"action\" VALUE=\"Add\">";
if (personStatus == Person::isAdministrator) {
con << TAG <<
" <INPUT TYPE=submit NAME=\"action\" VALUE=\"Remove\">";
}
} else {
con << TAG << EMPTY_LIST
"<BR><INPUT TYPE=submit NAME=\"action\" VALUE=\"Add\">";
}
con << TAG << "</FORM><P>";
if (bugs->setSimilarBugs.length() != 0) {
con << TAG <<
"<FORM METHOD=POST ACTION=\"" << con.getStub() << "\">"
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"bugForm\">"
"<INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << myself << "\">"
"<INPUT TYPE=hidden NAME=\"relatedbug\" VALUE=" << bugStr << ">"
"<B>Similar bugs:</B><BR><SELECT NAME=\"bug\" SIZE=1>";
print(con, bugs->setSimilarBugs);
con << TAG <<
"</SELECT><INPUT TYPE=submit NAME=\"action\" VALUE=\"Select\">";
if (personStatus == Person::isAdministrator) {
con << TAG <<
" <INPUT TYPE=submit NAME=\"action\" VALUE=\"Remove\">";
}
con << TAG << "</FORM><P>";
}
con << TAG <<
"</FORM><P>"
"<FONT SIZE=\"+1\"><UL>";
if (personStatus == Person::isUser) {
if (bugs->pAssignedTo != null) {
persons.at(bugs->pAssignedTo);
con << TAG << "<LI>Assigned to <A HREF=\"mailto:"
<< persons->sEmailAddress << "\">"
<< persons->sName << "</A>";
}
persons.at(bugs->pReportedBy);
con << TAG << "<LI>Reported by <A HREF=\"mailto:"
<< persons->sEmailAddress << "\">"
<< persons->sName << "</A></OL></FONT>";
} else {
if (bugs->pAssignedTo != null) {
persons.at(bugs->pAssignedTo);
con << TAG << "<LI>Assigned to <A HREF=\"" << con.getStub()
<< "?socket=" << con.getAddress()
<< "&page=userForm&myself=" << URL << myself
<< "&name=" << URL << persons->sName << "\">"
<< persons->sName << "</A>";
}
persons.at(bugs->pReportedBy);
con << TAG
<< "<LI>Reported by <A HREF=\"" << con.getStub() << "?socket="
<< con.getAddress()
<< "&page=userForm&myself=" << URL << myself
<< "&name=" << URL << persons->sName << "\">"
<< persons->sName << "</A></OL></FONT>";
}
mainMenuReference(con);
return true;
}
bool updateBug(WWWconnection& con)
{
char* bugStr = con.get("bug");
bugId = atoi(bugStr);
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
char* similar = con.get("similar");
if (*similar != '\0') {
int id = atoi(similar);
if (id != bugId) {
bugId = id;
if (allBugs.select(qBug) != 0) {
if (rindex(bugs->setSimilarBugs, allBugs.currentId()) < 0) {
bugs->setSimilarBugs.append(allBugs.currentId());
}
}
}
}
key = con.get("name");
if (*key != '\0') {
if (persons.select(qPerson) == 0 ||
persons->status == Person::isUser)
{
error(con, "No such engineer");
return true;
}
bugs->pAssignedTo = persons.currentId();
}
bugs.update();
return bugForm(con);
}
bool addReportForm(WWWconnection& con)
{
char* bugStr = con.get("bug");
bugId = atoi(bugStr);
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
con << TAG <<
HTML_HEAD "<TITLE>Bug report</TITLE></HEAD>"
BODY
"<H2>Bug report</H2>"
"<FORM METHOD=POST ACTION=\"" << con.getStub() << "\">"
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"addReport\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"index\" VALUE=" << ++bugs->nReports
<< "><INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << con.get("myself")
<< "\"><B>Status: </B><SELECT SIZE=1 NAME=\"status\">";
for (int i = 1; eSTATUS_STRING[i] != NULL; i++) {
con << TAG << "<OPTION VALUE=" << i << ">" << eSTATUS_STRING[i]
<< "</OPTION>";
}
con << TAG <<
"</SELECT><P>"
"<B>Bug description:</B><P>"
"<TEXTAREA COLS=40 ROWS=5 NAME=\"description\"></TEXTAREA><P>"
"<INPUT TYPE=submit VALUE=\"Add\"> "
"<INPUT TYPE=reset VALUE=\"Reset\"></FORM>";
bugs.update();
mainMenuReference(con);
return true;
}
bool addReport(WWWconnection& con)
{
bugId = atoi(con.get("bug"));
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
key = con.get("myself");
if (persons.select(qPerson) == 0) {
error(con, "No such person");
return true;
}
reportId = atoi(con.get("index"));
firstReport = bugs->pReportHistory;
if (reports.select(qReport) == 0) {
Report report;
report.pAuthor = persons.currentId();
persons->nReports += 1;
report.sDescription = con.get("description");
report.index = reportId;
report.pNext = bugs->pReportHistory;
report.status = atoi(con.get("status"));
report.creationDate = dbDateTime::current();
bugs->pReportHistory = insert(report);
persons.update();
bugs.update();
}
con.addPair("action", "Select");
return bugForm(con);
}
bool addWorkAroundForm(WWWconnection& con)
{
char* bugStr = con.get("bug");
bugId = atoi(bugStr);
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
con << TAG <<
HTML_HEAD "<TITLE>Work around</TITLE></HEAD>"
BODY
"<H2>Work around</H2>"
"<FORM METHOD=POST ACTION=\"" << con.getStub() << "\">"
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"addWorkAround\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"index\" VALUE=" << ++bugs->nReports
<< "><INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << con.get("myself")
<< "\"><B>Status: </B><SELECT SIZE=1 NAME=\"status\">";
for (int i = 1; eSTATUS_STRING[i] != NULL; i++) {
con << TAG << "<OPTION VALUE=" << i << ">" << eSTATUS_STRING[i]
<< "</OPTION>";
}
con << TAG <<
"</SELECT><P>"
"<B>Description:</B><P>"
"<TEXTAREA COLS=40 ROWS=5 NAME=\"description\"></TEXTAREA><P>"
"<INPUT TYPE=submit VALUE=\"Add\"> "
"<INPUT TYPE=reset VALUE=\"Reset\"></FORM>";
bugs.update();
mainMenuReference(con);
return true;
}
bool addWorkAround(WWWconnection& con)
{
bugId = atoi(con.get("bug"));
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
key = con.get("myself");
if (persons.select(qPerson) == 0) {
error(con, "No such person");
return true;
}
reportId = atoi(con.get("index"));
firstReport = bugs->pWorkArounds;
if (reports.select(qReport) == 0) {
Report report;
report.pAuthor = persons.currentId();
persons->nReports += 1;
report.sDescription = con.get("description");
report.index = reportId;
report.pNext = bugs->pWorkArounds;
report.status = atoi(con.get("status"));
report.creationDate = dbDateTime::current();
bugs->pWorkArounds = insert(report);
persons.update();
bugs.update();
}
con.addPair("action", "Select");
return bugForm(con);
}
bool updateReportForm(WWWconnection& con)
{
if (strcmp(con.get("action"), "Add") == 0) {
return addReportForm(con);
}
char* bugStr = con.get("bug");
bugId = atoi(bugStr);
if (bugs.select(qBug) == 0) {
error(con, "No such bug");
return true;
}
char* report = con.get("report");
if (report == NULL) {
error(con, "No report was selected");
return true;
}
int index = atoi(report);
dbReference<Report> prev, curr = null, next = bugs->pReportHistory;
do {
prev = curr;
if (next == null) {
error(con, "No such report");
return true;
}
reports.at(next);
curr = next;
next = reports->pNext;
} while (reports->index != index);
if (strcmp(con.get("action"), "Remove") == 0) {
reports.remove();
bugs->nReports -= 1;
if (prev == null) {
bugs->pReportHistory = next;
} else {
reports.at(prev);
reports->pNext = next;
reports.update();
}
bugs.update();
con.addPair("action", "Select");
return bugForm(con);
}
char date[64];
reports->creationDate.asString(date, sizeof date);
char* myself = con.get("myself");
key = myself;
if (persons.select(qPerson) == 0) {
error(con, "No such person");
return true;
}
int personStatus = persons->status;
persons.at(reports->pAuthor);
con << TAG <<
HTML_HEAD "<TITLE>Bug report from " << date << "</TITLE></HEAD>"
BODY
"<H2>Bug report from " << date << "</H2>"
"<FORM METHOD=POST ACTION=\"" << con.getStub() << "\">"
"<INPUT TYPE=HIDDEN NAME=\"socket\" VALUE=\""
<< con.getAddress() << "\"><INPUT TYPE=hidden "
"NAME=\"page\" VALUE=\"updateReport\">"
"<INPUT TYPE=hidden NAME=\"bug\" VALUE=" << bugStr << ">"
"<INPUT TYPE=hidden NAME=\"myself\" VALUE=\"" << myself <<
"\"><INPUT TYPE=hidden NAME=\"report\" VALUE=" << index << ">"
"<B>Created by ";
if (personStatus == Person::isUser) {
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -