Commit e88a8ea6 authored by Timothy Stack's avatar Timothy Stack

Tweak the "My Bug Database" menu link so it points to a particular project
in the bugdb.

	* www/gotobugdb.php3: Pass on the project_title argument if one is
	given.

	* www/menu.php3: Make the bugdb link context-sensitive or have it
	link to the project the user was first approved for.
	Context-sensitivity is determined by whether or not a "pid"
	argument is given.
parent 1cbf6305
......@@ -14,16 +14,24 @@ if (!$BUGDBSUPPORT) {
# No Pageheader since we spit out a redirection below.
$uid = GETLOGIN();
LOGGEDINORDIE($uid, CHECKLOGIN_USERSTATUS|
CHECKLOGIN_WEBONLY|CHECKLOGIN_WIKIONLY);
CHECKLOGIN_WEBONLY|CHECKLOGIN_WIKIONLY); # XXX BUGDBONLY ?
#
# The project to zap to on the other side
#
if (isset($project_title) && $project_title == "") {
unset($project_title);
}
#
# Look for our cookie. If the browser has it, then there is nothing
# more to do; just redirect the user over to the wiki.
# more to do; just redirect the user over to the bugdb.
#
if (isset($_COOKIE[$BUGDBCOOKIENAME])) {
$myhash = $_COOKIE[$BUGDBCOOKIENAME];
header("Location: ${BUGDBURL}?username=${uid}&bosscred=${myhash}");
header("Location: ${BUGDBURL}?username=${uid}&bosscred=${myhash}" .
(isset($project_title) ? "&project_title=${project_title}" : ""));
return;
}
......@@ -36,5 +44,6 @@ $myhash = GENHASH();
SUEXEC("nobody", "nobody", "bugdbxlogin $uid $myhash", SUEXEC_ACTION_DIE);
setcookie($BUGDBCOOKIENAME, $myhash, 0, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES);
header("Location: ${BUGDBURL}?do=authenticate&username=${uid}&bosscred=${myhash}&prev_page=${BUGDBURL}");
header("Location: ${BUGDBURL}?do=authenticate&username=${uid}&bosscred=${myhash}&prev_page=${BUGDBURL}" .
(isset($project_title) ? "&project_title=${project_title}" : ""));
?>
......@@ -221,7 +221,7 @@ function WRITEPLABBOTTOMBAR() {
# sees depends on the login status and the DB status.
#
function WRITESIDEBAR() {
global $login_status, $login_uid;
global $login_status, $login_uid, $pid;
global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $WIKIURL;
global $BUGDBSUPPORT, $BUGDBURL;
global $CHECKLOGIN_WIKINAME;
......@@ -388,8 +388,26 @@ function WRITESIDEBAR() {
}
if ($BUGDBSUPPORT) {
if (isset($pid) && !empty($pid)) {
$bugdburl = "gotobugdb.php3?project_title=$pid";
}
else {
$query_result = DBQueryFatal(
"select pid from group_membership where ".
"uid='$login_uid' and pid=gid and trust!='none' ".
"order by date_approved asc limit 1");
if (mysql_num_rows($query_result) == 0) {
$bugdburl = "gotobugdb.php3";
}
else {
$row = mysql_fetch_array($query_result);
$bugdburl = "gotobugdb.php3?project_title=" .
$row[pid];
}
}
WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
"gotobugdb.php3", "gotobugdb.php3");
$bugdburl,
$bugdburl);
}
WRITESIDEBARBUTTON("Update User Information",
......@@ -418,8 +436,26 @@ function WRITESIDEBAR() {
}
if ($BUGDBSUPPORT) {
if (isset($pid) && !empty($pid)) {
$bugdburl = "gotobugdb.php3?project_title=$pid";
}
else {
$query_result = DBQueryFatal(
"select pid from group_membership where ".
"uid='$login_uid' and pid=gid and trust!='none' ".
"order by date_approved asc limit 1");
if (mysql_num_rows($query_result) == 0) {
$bugdburl = "gotobugdb.php3";
}
else {
$row = mysql_fetch_array($query_result);
$bugdburl = "gotobugdb.php3?project_title=" .
$row[pid];
}
}
WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
"gotobugdb.php3", "gotobugdb.php3");
$bugdburl,
$bugdburl);
}
# Since a user can be a member of more than one project,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment