better implementation of realnames support. remove overhead of two sql

calls from bug_form.
This commit is contained in:
cyeh%bluemartini.com 2000-04-26 01:44:28 +00:00
Родитель 4cb6fe2a7b
Коммит b77c0bc665
2 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -118,11 +118,8 @@ my $assignedtoid = $bug{'assigned_to'};
my $reporterid = $bug{'reporter'}; my $reporterid = $bug{'reporter'};
my $qacontactid = $bug{'qa_contact'}; my $qacontactid = $bug{'qa_contact'};
$bug{'assigned_to'} = DBID_to_real_or_loginname($bug{'assigned_to'});
$bug{'assigned_name'} = DBID_to_real_name($bug{'assigned_to'}); $bug{'reporter'} = DBID_to_real_or_loginname($bug{'reporter'});
$bug{'reporter_name'} = DBID_to_real_name($bug{'reporter'});
$bug{'assigned_to'} = DBID_to_name($bug{'assigned_to'});
$bug{'reporter'} = DBID_to_name($bug{'reporter'});
print qq{<FORM NAME="changeform" METHOD="POST" ACTION="process_bug.cgi">\n}; print qq{<FORM NAME="changeform" METHOD="POST" ACTION="process_bug.cgi">\n};
@ -186,7 +183,7 @@ print "
<TD ALIGN=RIGHT><B>OS:</B></TD> <TD ALIGN=RIGHT><B>OS:</B></TD>
<TD><SELECT NAME=op_sys>" . <TD><SELECT NAME=op_sys>" .
make_options(\@::legal_opsys, $bug{'op_sys'}) . make_options(\@::legal_opsys, $bug{'op_sys'}) .
"</SELECT><TD ALIGN=RIGHT><B>Reporter:</B></TD><TD>$bug{'reporter'} $bug{'reporter_name'}</TD> "</SELECT><TD ALIGN=RIGHT><B>Reporter:</B></TD><TD>$bug{'reporter'}</TD>
</TDTR><TR> </TDTR><TR>
<TD ALIGN=RIGHT><B><A HREF=\"bug_status.html\">Status:</A></B></TD> <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html\">Status:</A></B></TD>
<TD>$bug{'bug_status'}</TD> <TD>$bug{'bug_status'}</TD>
@ -205,7 +202,7 @@ print "
</TR><TR> </TR><TR>
<TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned&nbsp;To: <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned&nbsp;To:
</A></B></TD> </A></B></TD>
<TD>$bug{'assigned_to'} $bug{'assigned_name'}</TD>"; <TD>$bug{'assigned_to'}</TD>";
if (Param("usetargetmilestone")) { if (Param("usetargetmilestone")) {
my $url = ""; my $url = "";
@ -431,6 +428,10 @@ if ($canedit || $::userid == $assignedtoid ||
Resolve bug, mark it as duplicate of bug # Resolve bug, mark it as duplicate of bug #
<INPUT NAME=dup_id SIZE=6 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\"><br>\n"; <INPUT NAME=dup_id SIZE=6 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\"><br>\n";
$knum++; $knum++;
if ( $bug{'assigned_to'} =~ /(.*)\((.*)\)/ ) {
$bug{'assigned_to'} = $1;
chop($bug{'assigned_to'});
}
my $assign_element = "<INPUT NAME=\"assigned_to\" SIZE=32 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\" VALUE=\"$bug{'assigned_to'}\">"; my $assign_element = "<INPUT NAME=\"assigned_to\" SIZE=32 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\" VALUE=\"$bug{'assigned_to'}\">";
print "<INPUT TYPE=radio NAME=knob VALUE=reassign> print "<INPUT TYPE=radio NAME=knob VALUE=reassign>

Просмотреть файл

@ -546,14 +546,14 @@ sub InsertNewUser {
return $password; return $password;
} }
sub DBID_to_real_name { sub DBID_to_real_or_loginname {
my ($id) = (@_); my ($id) = (@_);
SendSQL("SELECT realname FROM profiles WHERE userid = $id"); SendSQL("SELECT login_name,realname FROM profiles WHERE userid = $id");
my ($r) = FetchSQLData(); my ($l, $r) = FetchSQLData();
if ($r eq "") { if ($r eq "") {
return; return $l;
} else { } else {
return "($r)"; return "$l ($r)";
} }
} }