Changeset - d996590336e3
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 14 years ago 2012-02-14 22:17:13
ohnobinki@ohnopublishing.net
Add support for hiding hysterical (historical) semesters on the semester selection page.
2 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -513,70 +513,82 @@ class page
 
    echo school_list_html($this->school['id'], $linkto);
 
    echo "</p>\n";
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Display a list of semesters the user might be interested in.
 
   * \param $linkto
 
   *   The link to which a &semester= or ?semester= query string
 
   *   should be appended.
 
   */
 
  public function showSemesters($linkto = 'input.php')
 
  {
 
    if (strpos($linkto, '?'))
 
      $linkto .= '&';
 
    else
 
      $linkto .= '?';
 
    /*
 
     * We can pre-htmlentities() $linkto because we're only appending
 
     * a safe string.
 
     */
 
    $linkto = htmlentities($linkto . 'semester=');
 

	
 
    $time = time();
 
    /**
 
     * Hysterical... or historical? Uncle John Brink prefers
 
     * ``hysterical''...
 
     */
 
    $hysterical = FALSE;
 

	
 
    echo "    <p>\n";
 
    echo "      <ul>\n";
 
    foreach (school_semesters($this->school) as $semester)
 
      {
 
	$text_extra = array();
 
	$class_extra = '';
 
	if ($semester['id'] == $this->semester['id'])
 
	  {
 
	    $class_extra = ' highlight';
 
	    $text_extra[] = 'selected';
 
	  }
 
	if ($semester['time_start'] > 36000 && $semester['time_start'] < ($time - 365*24*60*60))
 
	  {
 
	    $class_extra .= ' hysterical';
 
	    $hysterical = TRUE;
 
	  }
 

	
 
	if ($semester['time_start'] < $time && $semester['time_end'] > $time)
 
	  $text_extra[] = 'current';
 

	
 
	$text_extra = implode($text_extra, ', ');
 
	if (strlen($text_extra))
 
	  $text_extra = ' (' . $text_extra . ')';
 

	
 
	echo '        <li class="semester' . $class_extra . '"><a href="' . $linkto . $semester['id'] . '">' . htmlentities($semester['name']) . '</a>' . $text_extra . "</li>\n";
 
      }
 
    if ($hysterical)
 
	echo '       <li style="display: none;" class="hysterical-show"><a class="hysterical-show-a" href="#">(Show hysterical semesters…)</a></li>' . PHP_EOL;
 
    echo "      </ul>\n";
 
    echo "    </p>\n";
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Display school-specific instructions for using slate_permutate.
 
   */
 
  public function showSchoolInstructions()
 
  {
 
    echo '<div id="schoolInstructionsBox">' . PHP_EOL
 
       . school_instructions_html($this->school) . PHP_EOL
 
       . '</div> <!-- id="schoolInstructionsBox" -->' . PHP_EOL;
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Print out a vocative form of a student's identity. For example,
 
   *   Dearborn Christin Schoolers are called ``Knights'' as are
 
   *   Calvin College students.
 
   *
 
   * The third argument is used to determine whether or not this
 
   * address _needs_ to be printed out. For example, in some sentences
 
   * when addressing generic students, it makes no sense to say the
scripts/scheduleInput.js
Show inline comments
 
@@ -913,25 +913,33 @@ jQuery(document).ready(function() {
 
        });
 
    /*
 
     * Prevent accidental form submission for className and course
 
     * title entry text fields.
 
     */
 
    jQuery('.input-submit-disable').live('keyup keydown', slate_permutate_nullify_enter);
 
    jQuery('.className').live('keyup keydown', function(e)
 
			      {
 
				  if (e.which == 13)
 
				  {
 
				      course_autocomplete(jQuery(this).parent().parent().data('course_i'));
 

	
 
				      /* Prevent form submission like slate_permutate_nullify_enter() does. */
 
				      return false;
 
				  }
 
			      });
 
        jQuery('.inPlace-enable').live('blur', function() {
 
          jQuery(this).addClass('inPlace');
 
        });
 

	
 
	credit_hours_shown = jQuery('#content').is('.credit-hours-shown');
 
	jQuery('.section-credit-hours-entry').live('change', function() {
 
		credit_hours_change(jQuery(this).closest('.section').data('course_i'));
 
	});
 

	
 
	/* For the ``Select Semester'' page */
 
	jQuery('.hysterical-show-a').click(function() {
 
	    jQuery('.hysterical').show();
 
	    jQuery('.hysterical-show').hide();
 
});
 
	jQuery('.hysterical-show').show();
 
	jQuery('.hysterical').hide();
 
});
0 comments (0 inline, 0 general)