Commit 70954aec authored by Leigh B Stoller's avatar Leigh B Stoller

Change default project such that if the profile is in one of the user's

own projects, default to the profile's project 2) Otherwise, default to
the project that the user has most recently used (the current default).
This closes issue #187.
parent f94e2952
...@@ -463,11 +463,21 @@ if (!isset($create)) { ...@@ -463,11 +463,21 @@ if (!isset($create)) {
$defaults["profile"] = (isset($profile) ? $defaults["profile"] = (isset($profile) ?
$profile->uuid() : $profile_default); $profile->uuid() : $profile_default);
$defaults["where"] = $DEFAULT_AGGREGATE; $defaults["where"] = $DEFAULT_AGGREGATE;
#
# If the user is in the same project as the profile, default to that
# project, else use the first in the list (which is ordered by last
# time the user instantiated in it).
#
if ($this_user && count($projlist)) { if ($this_user && count($projlist)) {
list($project, $grouplist) = each($projlist); if (array_key_exists($profile->pid(), $projlist)) {
$project = $profile->pid();
}
else {
list($project, $grouplist) = each($projlist);
reset($projlist);
}
$defaults["pid"] = $project; $defaults["pid"] = $project;
$defaults["gid"] = $project; $defaults["gid"] = $project;
reset($projlist);
} }
else { else {
$defaults["pid"] = ""; $defaults["pid"] = "";
......
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