Changeset - ed49fbf4f2e1
[Not reviewed]
default
0 4 0
Nathan Brink (binki) - 15 years ago 2010-10-19 19:15:49
ohnobinki@ohnopublishing.net
Slowly reindent some javascript, hiddenly slip the meeting location into the final table.
4 files changed with 32 insertions and 28 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -69,7 +69,7 @@ class Schedule
 
  //--------------------------------------------------
 
  // Adds a section to the desired class.
 
  //--------------------------------------------------
 
  function addSection($course_name, $letter, $time_start, $time_end, $days, $synonym = NULL, $faculty = NULL, $room = NULL)
 
  function addSection($course_name, $letter, $time_start, $time_end, $days, $synonym = NULL, $faculty = NULL, $location = NULL)
 
  {
 
    $found = false;
 
    $counter = 0;
 
@@ -96,7 +96,7 @@ class Schedule
 
	  $section = new Section($letter, array(), $synonym, $faculty);
 
	  $this->classStorage[$counter]->section_add($section);
 
	}
 
      $section->meeting_add(new SectionMeeting($days, $time_start, $time_end, $room));
 
      $section->meeting_add(new SectionMeeting($days, $time_start, $time_end, $location));
 
    }
 
  }
 

	
input.php
Show inline comments
 
@@ -44,7 +44,8 @@ if ($sch)
 
		. $meeting->getStartTime() . '\', \''
 
		. $meeting->getEndTime() . '\', '
 
		. json_encode(array('m' => $meeting->getDay(0), 't' => $meeting->getDay(1), 'w' => $meeting->getDay(2), 'h' => $meeting->getDay(3), 'f' => $meeting->getDay(4))) . ', \''
 
		. htmlentities($section->getProf(), ENT_QUOTES) . "');\n";
 
		. htmlentities($section->getProf(), ENT_QUOTES) . '\', \''
 
		. htmlentities($meeting->getLocation(), ENT_QUOTES) . "');\n";
 
	    }
 
	}
 
    }
process.php
Show inline comments
 
@@ -121,7 +121,7 @@ if(!$DEBUG)
 
				  /* Skip the section name, which isn't a section */
 
					if(is_array($section))
 
					{
 
					  $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'], 'alpha'), NULL, $section['professor']);
 
					  $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'], 'alpha'), NULL, $section['professor'], $section['location']);
 
					}
 
			}
 
		}
scripts/scheduleInput.js
Show inline comments
 
@@ -65,17 +65,18 @@ var sectionsOfClass = new Array();
 
    // General Input Functions
 
    //--------------------------------------------------
 

	
 
	//--------------------------------------------------
 
	// Returns the common inputs for each new section.
 
	//--------------------------------------------------
 
        function genSectionHtml(cnum)
 
	{
 
		genSectionHtml_n(cnum,'','','','','','');
 
	}
 
/**
 
 * \brief
 
 * Returns the common inputs for each new section.
 
 */
 
function genSectionHtml(cnum)
 
{
 
    genSectionHtml_n(cnum, '', '', '', '', '', '', '');
 
}
 

	
 
	/* @TODO: This should select & set items based on args, if the args != '' */
 
	function genSectionHtml_n(cnum,name,synonym,stime,etime,days,prof)
 
	{
 
/* @TODO: This should select & set items based on args, if the args != '' */
 
function genSectionHtml_n(cnum, name, synonym, stime, etime, days, prof, location)
 
{
 
		var snum = sectionsOfClass[cnum];
 

	
 
		var result = '<tr class="section class' + cnum + '"><td class="none"></td>';
 
@@ -136,7 +137,8 @@ var sectionsOfClass = new Array();
 
			<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][2]" value="1" ' + (days.w ? 'checked="checked"' : '') + ' /></td>\
 
			<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][3]" value="1" ' + (days.h ? 'checked="checked"' : '') + ' /></td>\
 
			<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][4]" value="1" ' + (days.f ? 'checked="checked"' : '') + ' /></td>';
 
		result = result + '<td><div class="deleteSection"><input type="button" value="x" class="gray" /></div></td><td></td></tr>';
 
		result = result + '<td><div class="deleteSection"><input type="button" value="x" class="gray" /></div></td><td>' 
 
		    + '<input type="hidden" name="postData[' + cnum + '][' + snum + '][location]" value="' + location + '" />'+ '</td></tr>';
 
		return result;
 
	}
 

	
 
@@ -152,18 +154,19 @@ function genOptionHtml(value, content, t
 
    return '<option value="' + value + '"' + selected + '>' + content + "</option>\n";
 
}
 

	
 
        //--------------------------------------------------
 
        // Add a section to a class
 
        //--------------------------------------------------
 
	function add_section_n(cnum,name,synonym,stime,etime,days,prof)
 
	{
 
		 jQuery('.pclass'+cnum).after(genSectionHtml_n(cnum,name,synonym,stime,etime,days,prof));
 
		 sectionsOfClass[cnum] ++;
 
	}
 
        function add_section(cnum)
 
	{
 
	    return add_section_n(cnum, '', '', '', '', {'m':false, 't':false, 'w':false, 'h':false, 'f':false}, '');
 
        }
 
/**
 
 * \brief
 
 *   Add a section to a class.
 
 */
 
function add_section_n(cnum, name, synonym, stime, etime, days, prof, location)
 
{
 
    jQuery('.pclass'+cnum).after(genSectionHtml_n(cnum, name, synonym, stime, etime, days, prof, location));
 
    sectionsOfClass[cnum] ++;
 
}
 
function add_section(cnum)
 
{
 
    return add_section_n(cnum, '', '', '', '', {'m':false, 't':false, 'w':false, 'h':false, 'f':false}, '', '');
 
}
 

	
 
/**
 
 * Add a list of sections gotten via an AJAX call.
 
@@ -176,7 +179,7 @@ function add_sections(cnum, data)
 
    for (i = data.sections.length - 1; i >= 0; i --)
 
	{
 
	    section = data.sections[i];
 
	    add_section_n(cnum, section.section, section.synonym, section.time_start, section.time_end, section.days, section.prof);
 
	    add_section_n(cnum, section.section, section.synonym, section.time_start, section.time_end, section.days, section.prof, section.location);
 
	}
 
}
 

	
0 comments (0 inline, 0 general)