Changeset - f0d9f37354b5
[Not reviewed]
default
0 8 0
Ethan Zonca - 15 years ago 2011-03-24 20:16:20
ez@ethanzonca.com
qTips added on output page to show data, course title inputs made pseudo-invisible. Other minor changes. Cedarville crawler now records course titles.
8 files changed with 42 insertions and 10 deletions:
0 comments (0 inline, 0 general)
inc/class.course.inc
Show inline comments
 
@@ -20,25 +20,25 @@
 

	
 
/**
 
 * \file
 
 *    This file represents a course (formerly class). It stores
 
 *    the section associated with the course.
 
 */
 

	
 
include_once 'class.section.php';
 

	
 
class Course implements IteratorAggregate
 
{
 
  private $name;	// String
 
  private $title;
 
  private $title;       // String
 
  private $sections;	// Array of sections
 
  private $nsections;	// int
 
  /**
 
   * \brief
 
   *   Other courses that this course depends on.
 
   *
 
   * Example: Many calvin courses depend on lab courses.
 
   */
 
  private $dependencies;
 

	
 
  /**
 
   * \brief
inc/class.page.php
Show inline comments
 
@@ -103,24 +103,25 @@ class page
 
    $this->headCode['jQuery'] = '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>';
 
    $this->headCode['jQueryUI'] = '<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script><link rel="stylesheet" href="styles/jqueryui.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $this->headCode['jAddress'] = '<script type="text/javascript" src="http://ohnopub.net/js/jquery.address-1.3.2.min.js"></script>';
 
    $this->headCode['qTip'] = '<script type="text/javascript" src="http://ohnopub.net/js/jquery.qtip-1.0.min.js"></script>';
 
    $this->headCode['qTip2'] = '<script type="text/javascript" src="http://ohnopub.net/js/2011.03.21/jquery.qtip.min.js"></script><link rel="stylesheet" href="http://ohnopub.net/js/2011.03.21/jquery.qtip.min.css" type="text/css" media="screen" />';
 
    $this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
    $this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js"></script>';
 
    $this->headCode['displayTables'] = '<script type="text/javascript" src="scripts/displayTables.js"></script>';
 
    $this->headCode['inPlace'] = '<script type="text/javascript" src="scripts/jeip.js"></script>';
 

	
 
    $this->pagetitle = $ntitle;
 
    $this->scripts = $nscripts;
 

	
 
   /* Compliant browsers which care, such as gecko, explicitly request xhtml: */
 
   if(empty($_SERVER['HTTP_ACCEPT'])  /* then the browser doesn't care :-) */
 
      || strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE)
 
       $this->xhtml = TRUE;
 

	
 
   if (count($ga_trackers))
 
     {
 
       $ga_www = 'http://www.';
inc/class.schedule.php
Show inline comments
 
@@ -279,25 +279,25 @@ class Schedule
 
    if ($this->nPermutations && $page >= $npages)
 
      Page::show_404('Unable to find page ' . $page . ', there are only ' . $this->nPermutations . ' non-conflicting permutations, for a total of ' . $npages . ' pages.');
 
    /* zero-based */
 
    $first_permutation = $page * SP_PERMUTATIONS_PER_PAGE;
 
    $last_permutation = min($this->nPermutations, $first_permutation + SP_PERMUTATIONS_PER_PAGE);
 

	
 
    $footcloser = '';
 

	
 
    if(isset($_REQUEST['print']) && $_REQUEST['print'] != ''){
 
      $headcode = array('jQuery', 'jQueryUI', 'uiTabsKeyboard', 'outputStyle', 'outputPrintStyle', 'displayTables');
 
    }
 
    else {
 
      $headcode = array('outputStyle',  'jQuery', 'jQueryUI', 'jAddress', 'uiTabsKeyboard', 'displayTables');
 
      $headcode = array('outputStyle',  'jQuery', 'jQueryUI', 'jAddress', 'uiTabsKeyboard', 'qTip2','displayTables');
 
    }
 
    $outputPage = page::page_create(htmlentities($this->getName()), $headcode);
 
    $outputPage->head();
 

	
 

	
 

	
 
    if(isset($_REQUEST['print'])) {
 
 
 
     echo '<script type="text/javascript">';
 
      echo 'jQuery(document).ready( function() {';
 
 
 
      /* If user entered items to print */
 
@@ -515,30 +515,32 @@ class Schedule
 
					;
 
				      $rowspan[$dayLoop] = $my_r - $r;
 

	
 
				      $single_multi = 'single';
 
				      if ($rowspan[$dayLoop] > 1)
 
					$single_multi = 'multi';
 

	
 
				      $title = $course->title_get();
 
				      if (empty($title))
 
					$title = '';
 
				      else
 
					$title .= ' ';
 

	
 
				      $carret = '&#013;' . htmlentities("<br />");
 
				      echo '            <td rowspan="' . $rowspan[$dayLoop]
 
					. '" class="' . $single_multi . ' class' . $j
 
					. '" title="' . htmlentities($title, ENT_QUOTES)
 
					. 'prof: ' . htmlentities($section->getProf(), ENT_QUOTES)
 
					. ', room: ' . htmlentities($current_meeting->getLocation(), ENT_QUOTES)
 
					. ', type: ' . htmlentities($current_meeting->type_get(), ENT_QUOTES) . '">'
 
					. '" class="qTipCell ' . $single_multi . ' class' . $j
 
					. '" title="' . htmlentities($title, ENT_QUOTES) . $carret
 
					. 'Prof: ' . htmlentities($section->getProf(), ENT_QUOTES) . $carret
 
					. 'Room: ' . htmlentities($current_meeting->getLocation(), ENT_QUOTES) . $carret
 
					. 'Type: ' . htmlentities($current_meeting->type_get(), ENT_QUOTES) . $carret . '">'
 
					. '<span class="course-title block">' . htmlentities($title) . '</span>' . PHP_EOL
 
					. htmlentities($course->getName(), ENT_QUOTES) . '-'
 
					. htmlentities($section->getLetter(), ENT_QUOTES) . "\n"
 
					. '<span class="prof block">' . htmlentities($section->getProf(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="location block">' . htmlentities($current_meeting->getLocation(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="synonym block">' . htmlentities($section->getSynonym(), ENT_QUOTES) . "</span>\n"
 
					. "</td>\n";
 

	
 
				      /* for the ``Registration Codes'' dialogue: */
 
				      if (empty($permutations_courses[$j]))
 
					{
 
					  $singleton_course = new Course($course->getName(), $course->title_get());
input.php
Show inline comments
 
@@ -15,25 +15,25 @@
 
 * GNU Affero General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU Affero General Public License
 
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.schedule.php';
 
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.course.inc';
 
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.section.php';
 
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.page.php';
 
require_once('inc' . DIRECTORY_SEPARATOR . 'schedule_store.inc');
 

	
 
$scripts = array('jQuery', 'jQueryUI', 'qTip2','schedInput');
 
$scripts = array('jQuery', 'jQueryUI', 'qTip2', 'inPlace', 'schedInput');
 
$inputPage = page::page_create('Scheduler', $scripts, FALSE);
 

	
 
$schedule_store = FALSE;
 
$sch = FALSE;
 
$errors_fix = FALSE;
 
$school = $inputPage->get_school();
 

	
 
$parent_schedule_id = NULL;
 
if (isset($_REQUEST['s']))
 
  {
 
    $schedule_store = schedule_store_init();
 
    $parent_schedule_id = (int)$_REQUEST['s'];
school.d/cedarville.crawl.inc
Show inline comments
 
@@ -179,24 +179,25 @@ function cedarville_crawl(array &$semest
 
	   */
 

	
 
	  $synonym = $course_table[0];
 
	  $section_parts = Section::parse($course_table[1]);
 
	  if (count($section_parts) < 3)
 
	    {
 
	      school_crawl_logf($school_crawl_log, 6, "Error parsing section_id. Given `%s'; interpreted as `%s'. Skipping.",
 
				$course_table[1], implode('-', $section_parts));
 
	      continue;
 
	    }
 

	
 
	  $instructor = $course_table[3];
 
          $title = $course_table[2];
 

	
 
	  /*
 
	   * Each course may have multiple meeting times associated
 
	   * with it at Cedarville. We are not sure how to handle this
 
	   * quite, because different class sections may be tied with
 
	   * different lab meetings and stuff...
 
	   */
 
	  $meetings_str = $course_table[6];
 
	  if (strpos($meetings_str, 'TBA') !== FALSE)
 
	    {
 
	      school_crawl_logf($school_crawl_log, 8, "Skipping %s because its meeting time info has `TBA' in it.", implode('-', $section_parts));
 
	      continue;
 
@@ -249,25 +250,25 @@ function cedarville_crawl(array &$semest
 
		    {
 
		      $semester->time_start_set_test($date_start);
 
		      $semester->time_end_set_test($date_end);
 
		    }
 
		}
 

	
 
	      $meetings[] = new SectionMeeting($days, $time_start, $time_end,
 
					       $room, $type);
 
	    }
 

	
 
	  $semester->section_add($section_parts['department'], $section_parts['course'],
 
				 new Section($section_parts['section'], $meetings,
 
					     $synonym, $instructor));
 
					     $synonym, $instructor), $title);
 
	}
 
    }
 

	
 
  $semesters[] = $semester;
 
    }
 

	
 
  return 0;
 
}
 

	
 
/**
 
 * \brief
 
 *   Scan cedarville's course listing pages for departments.
scripts/displayTables.js
Show inline comments
 
@@ -112,17 +112,31 @@ jQuery(document).ready( function()
 
	/* hmm... why isn't this information just stored in a global JS variable? */
 
	var tab_i = jQuery('#tabs').tabs('option','selected');
 
	var tab_fragment_i = /-([^-]+)$/.exec(jQuery('#the-tabs li:eq(' + tab_i + ') a').attr('href'))[1];
 
        var tab_course_data_json_selector = '#tabs-' + tab_fragment_i + ' .course-data';
 
	
 
        var tab_course_data_json = jQuery(tab_course_data_json_selector).text();
 
        var tab_course_data = eval('(' + tab_course_data_json + ')');
 

	
 
	slate_permutate_load(jQuery('#regDialog-content'), {school_registration_html: true, courses: tab_course_data});
 

	
 
        jQuery("#regDialog").dialog('open');
 

	
 
	
 
	
 
	return false;
 
      });
 

	
 
      jQuery('.qTipCell').qtip(
 
       {
 
          style: {
 
            tip: true,
 
            classes: "ui-tooltip-dark ui-tooltip-shadow ui-tooltip-rounded"
 
          },
 
          position:{
 
            my: 'bottom left',
 
            at: 'center',
 
          }
 
      });  
 
  }
 
);
 

	
scripts/scheduleInput.js
Show inline comments
 
@@ -255,25 +255,25 @@ function add_sections(cnum, data)
 
 *   The javascript-local course entry identifying number.
 
 */
 
function add_class_n(course_id, title)
 
	{
 
	    /*
 
	     * If we're adding a course entry form with preadded
 
	     * content, first remove the empty course.
 
	     */
 
	    if (course_id.length && slate_permutate_course_free != -1)
 
		course_remove(slate_permutate_course_free);
 

	
 
		sectionsOfClass[classNum] = 0; // Initialize at 0
 
		jQuery('#jsrows').append('<tr id="tr-course-' + classNum + '" class="class class' + classNum + ' pclass' + classNum + '"><td class="nameTip"><input type="text" id="input-course-' + classNum + '" class="classRequired defText className'+classNum+' className" title="Class Name" name="postData[' + classNum + '][name]" value="' + course_id + '" /></td><td colspan="10"><label for="postData[' + classNum + '][title]">Course Title:</label><input type="text" name="postData[' + classNum + '][title]" class="course-title-entry" value="' + title + '" /></td><td class="tdInput"><div class="deleteClass"><input type="button" value="Remove" class="gray" /></div></td><td class="none"><button type="button" class="addSection gray">+</button></td></tr>');
 
		jQuery('#jsrows').append('<tr id="tr-course-' + classNum + '" class="class class' + classNum + ' pclass' + classNum + '"><td class="nameTip"><input type="text" id="input-course-' + classNum + '" class="classRequired defText className'+classNum+' className" title="Class Name" name="postData[' + classNum + '][name]" value="' + course_id + '" /></td><td colspan="10"><input type="text" name="postData[' + classNum + '][title]" class="inPlace course-title-entry" value="' + title + '" /></td><td class="tdInput"><div class="deleteClass"><input type="button" value="Remove" class="gray" /></div></td><td class="none"><button type="button" class="addSection gray">+</button></td></tr>');
 

	
 
		/* store classNum as course_i into the <tr />: */
 
		jQuery('#tr-course-' + classNum).data({course_i: classNum});
 

	
 
		var class_elem = jQuery('.className' + classNum);
 

	
 

	
 
		/*
 
		 * Don't let the user accidentally submit the form by
 
		 * pressing <ENTER>. Instead, select the first
 
		 * autocomplete result if possible.
 
		 */
 
@@ -566,13 +566,22 @@ jQuery(document).ready(function() {
 
        jQuery('#showMore').click( function() {
 
		jQuery('.hidden').show();
 
		jQuery('#showMore').hide();
 
		jQuery('#showLess').show();
 
        });
 
        jQuery('#showLess').click( function() {
 
		jQuery('.hidden').hide();
 
		jQuery('#showMore').show();
 
		jQuery('#showLess').hide();
 
	});
 

	
 

	
 
        //-------------------------------------------------
 
        // Style course titles as inputs when clicked
 
        //-------------------------------------------------
 
        jQuery('.course-title-entry').live('click', function() {
 
          jQuery(this).toggleClass('inPlace');
 
        });
 
        jQuery('.course-title-entry').live('blur', function() {
 
          jQuery(this).addClass('inPlace');
 
        });
 
});
styles/general.css
Show inline comments
 
@@ -381,12 +381,17 @@ a:hover {
 
/* qTip2 Styling */
 
.ui-tooltip-dark .ui-tooltip-content{
 
  border-color: #303030;
 
  border-width: 2px;
 
  color: #f3f3f3;
 
  background-color: #505050;
 

	
 
  background: rgba(80,80,80,.9)!important;
 

	
 
  font: normal bold 1.2em sans-serif;
 
}
 

	
 
.inPlace {
 
  color: #000;
 
  border: none;
 
  background: transparent;
 
}
0 comments (0 inline, 0 general)