# HG changeset patch # User Nathan Phillip Brink # Date 2012-02-19 00:32:05 # Node ID 0f858c9808fda30d3de6cb2c70fbc28fa8d02c32 # Parent da3582f113b9cb8f1bc32d393b8609925488b13d On the school selection page, show the user the school which slate_permutate thinks he should use (the `detected' school). diff --git a/inc/school.inc b/inc/school.inc --- a/inc/school.inc +++ b/inc/school.inc @@ -128,14 +128,17 @@ function school_load($school_id, $load_a * side-effect. We're doing this so that the user can do * autocomplete for two different school/semester pairs in two * different browser tabs under the same session. - * + * \param $pure_guess + * Ignore $_SESSION and $_REQUEST. Used for informing the browser of + * what we would guess if his session/URI did not predispose us + * toward something else. * \return * A school profile or NULL if the school isn't in the session and * can't be guessed. */ -function school_load_guess($update_session = TRUE) +function school_load_guess($update_session = TRUE, $pure_guess = FALSE) { - if (isset($_REQUEST['school'])) + if (isset($_REQUEST['school']) && !$pure_guess) { $school = school_load($_REQUEST['school']); if ($school) @@ -147,7 +150,7 @@ function school_load_guess($update_sessi } /* assume that we stored a valid school in the $_SESSION */ - if (isset($_SESSION['school'])) + if (isset($_SESSION['school']) && !$pure_guess) return school_load($_SESSION['school']); if (isset($_SERVER['REMOTE_HOST']) || isset($_SERVER['REMOTE_ADDR'])) @@ -241,14 +244,28 @@ function school_list_html($highlight = N $linkto .= 'school='; $linkto = htmlentities($linkto); + $pure_guess = school_load_guess(FALSE, TRUE); + $html = "\n";