# HG changeset patch # User Nathan Phillip Brink # Date 2011-02-04 22:59:53 # Node ID f652ff09d2738b58b744498b841104137adc37e6 # Parent 2dcedb8734d1b451dd7de8a22a9c8987c4a5e16b Add an example course ID to the school profile's metadata and use this example course ID on input.php and in the qTip. diff --git a/inc/school.inc b/inc/school.inc --- a/inc/school.inc +++ b/inc/school.inc @@ -42,6 +42,7 @@ * array with the following keys: * - name: a friendly name for the school. Must be a valid XHTML attribute string. * - url: the school's website URL as a valid XHTML attribute string. (i.e., escape ampersands). + * - example_course_id: An example course identifier representative of a school's course IDs. (e.g., CS-101 for Calvin). * * \param $school_id * The school's alphanumeric identifier (which determines the name @@ -290,6 +291,25 @@ function school_default_courses($school) /** * \brief + * Return an example course id for the school. + * + * Each school may specify an example course ID by placing a key + * called 'example_course_id' into the array returned by its + * _info() function. See school_load(). + * + * \param $school + * The school's handle. + * \return + * A string containing a representative example of a course ID for + * the given school. + */ +function school_example_course_id(array $school) +{ + return $school['example_course_id']; +} + +/** + * \brief * Determine if a school has crawler data stored. * * \param $school diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -38,7 +38,9 @@ if (isset($_REQUEST['s'])) $sch = schedule_store_retrieve($schedule_store, $schedule_id); } -$my_hc = 'jQuery(document).ready( +$my_hc = 'var slate_permutate_example_course_id = \'' . str_replace('\'', '\\\'', school_example_course_id($inputPage->get_school())) . '\'; + +jQuery(document).ready( function() { var class_last = 0; @@ -62,7 +64,7 @@ else } if ($qtips_always || !isset($_SESSION['saw_qtips'])) { - $my_hc .= ' addTips();'; + $my_hc .= ' addTips();' . PHP_EOL; $_SESSION['saw_qtips'] = TRUE; } $my_hc .= ' }); @@ -104,8 +106,10 @@ if (!empty($_REQUEST['selectschool'])

Welcome to SlatePermutateaddressStudent(', ', '', FALSE); ?>! get_school())): ?> - To get started, enter in some a course identifier and click the - autosuggestion to automatically load available sections for each class. + To get started, enter in some a course identifier (e.g., + get_school()); ?>) + and click the autosuggestion to automatically load available sections + for each class. To get started, enter a course number and add some sections to it. Then specify each section's letter/number and what times it meets, diff --git a/school.d/calvin.inc b/school.d/calvin.inc --- a/school.d/calvin.inc +++ b/school.d/calvin.inc @@ -29,6 +29,7 @@ function calvin_info() 'domains' => array( 'calvin.edu', ), + 'example_course_id' => 'CS-232', 'student_address' => 'Knight', ); } diff --git a/school.d/cedarville.inc b/school.d/cedarville.inc --- a/school.d/cedarville.inc +++ b/school.d/cedarville.inc @@ -25,6 +25,7 @@ function cedarville_info() 'domains' => array( 'cedarville.edu', ), + 'example_course_id' => 'MATH-2510', 'student_address' => 'Cedarville Student', ); } diff --git a/school.d/default.inc b/school.d/default.inc --- a/school.d/default.inc +++ b/school.d/default.inc @@ -28,6 +28,7 @@ function default_info() */ 'domains' => array( ), + 'example_course_id' => 'ENGL-101', 'student_address' => 'student', ); } diff --git a/school.d/msu.inc b/school.d/msu.inc --- a/school.d/msu.inc +++ b/school.d/msu.inc @@ -25,6 +25,7 @@ function msu_info() 'domains' => array( 'msu.edu', ), + 'example_course_id' => 'ENG-129', 'student_address' => 'Spartan', ); } diff --git a/school.d/umich.inc b/school.d/umich.inc --- a/school.d/umich.inc +++ b/school.d/umich.inc @@ -25,6 +25,7 @@ function umich_info() 'domains' => array( 'umich.edu', ), + 'example_course_id' => 'MATH-161', 'student_address' => 'Wolverine', ); } diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -224,7 +224,8 @@ function addTips() var td = tr.eq(tr.length-2); jQuery('td:first', td).qtip({ - content: 'Start typing your class ID (such as PEF-1010) and click a suggestion to add sections', + /* slate_permutate_example_course_id is set globally in input.php. */ + content: 'Start typing your class ID (such as ' + slate_permutate_example_course_id + ') and click a suggestion to add sections', style: { border: { width: 3,