Changeset - 85fd0c4b6efd
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2012-02-11 20:06:15
ohnobinki@ohnopublishing.net
Fix regression in d7044a583ccc where the semester could not be selected when editing a saved schedule.
1 file changed with 13 insertions and 1 deletions:
input.php
13
1
0 comments (0 inline, 0 general)
input.php
Show inline comments
 
@@ -166,49 +166,61 @@ else
 
  }
 
$my_hc .= '    class_last = add_class();' . PHP_EOL;
 
if ($qtips_always || !isset($_SESSION['saw_qtips']))
 
  {
 
    $my_hc .= '    addTips();' . PHP_EOL;
 
    $_SESSION['saw_qtips'] = TRUE;
 
  }
 
$my_hc .= '  });
 
';
 

	
 
$inputPage->headcode_add('scheduleInput', $inputPage->script_wrap($my_hc), TRUE);
 

	
 
if ($school['id'] != 'default'
 
    && empty($_REQUEST['selectschool'])
 
    && empty($_REQUEST['selectsemester']))
 
  {
 
    /*
 
     * If we have chosen a school, set the canonical URL so that it
 
     * contains the school and, optionall, the specified
 
     * schedule. This way, when Google caches the input.php page, the
 
     * <title/> it sees will reflect the selected school.
 
     */
 
    $query = array('school' => $school['id']);
 
    if ($sch)
 
      $query['s'] = $sch->id_get();
 
      {
 
	$query['s'] = $sch->id_get();
 
	/*
 
	 * When editing a schedule, also canonize on the
 
	 * semester. Changes to the selected schedule which are made
 
	 * when editing an existing schedule are not saved into the
 
	 * SESSION. Thus, for the user to be able to edit a schedule
 
	 * and load courses from an alternate semester, we must ensure
 
	 * that semester remains in GET.
 
	 */
 
	if (!empty($semester))
 
	  $query['semester'] = $semester['id'];
 
      }
 
    $inputPage->canonize('input.php', $query);
 
  }
 

	
 
$inputPage->head();
 

	
 
/*
 
 * Force a student to choose a school or declare he's a generic
 
 * student before displaying the input form. To do this, we need
 
 * another variable in $_SESSION: $_SESSION['school_chosen'].
 
 */
 
if (!empty($_REQUEST['school']) && !empty($_SESSION['school']) && !strcmp($_REQUEST['school'], $_SESSION['school']))
 
  $_SESSION['school_chosen'] = TRUE;
 
if (!empty($_REQUEST['selectschool'])
 
    || empty($school) || $school['id'] == 'default' && empty($_SESSION['school_chosen']))
 
  {
 
    $next_page = 'input.php?';
 
    if (isset($_GET['s']))
 
      $next_page .= 's=' . (int)$_GET['s'] . '&';
 
    if (isset($_GET['semester']))
 
      $next_page .= 'semester=' . htmlentities($$_GET['semester']) . '&';
 
?>
 
<h2>School Selection</h2>
 
<p>
 
  Choose the school you attend from the list below. <strong>If you cannot
0 comments (0 inline, 0 general)