diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -50,7 +50,7 @@ elseif (!empty($_REQUEST['e'])) $parent_schedule_id = (int)$_POST['postData']['parent_schedule_id']; } -$my_hc = 'var slate_permutate_example_course_id = \'' . str_replace('\'', '\\\'', school_example_course_id($inputPage->get_school())) . '\'; +$my_hc = 'var slate_permutate_example_course_id = ' . json_encode(school_example_course_id($inputPage->get_school())) . '; jQuery(document).ready( function() @@ -77,18 +77,18 @@ elseif ($errors_fix) if (empty($course['name'])) $my_hc .= ' class_last = add_class();' . PHP_EOL; else - $my_hc .= ' class_last = add_class_n(\'' . htmlentities($course['name'], ENT_QUOTES) . '\', \'' . htmlentities($title, ENT_QUOTES) . '\');' . PHP_EOL; + $my_hc .= ' class_last = add_class_n(' . json_encode($course['name']) . ', ' . json_encode($title) . ');' . PHP_EOL; foreach ($course as $section) if (is_array($section)) - $my_hc .= ' add_section_n(class_last, \'' . htmlentities($section['letter'], ENT_QUOTES) . '\', \'' - . htmlentities($section['synonym'], ENT_QUOTES) . '\', \'' . htmlentities($section['start'], ENT_QUOTES) . '\', \'' - . htmlentities($section['end'], ENT_QUOTES) . '\', ' + $my_hc .= ' add_section_n(class_last, ' . json_encode($section['letter']) . ', ' + . json_encode($section['synonym']) . ', ' . json_encode($section['start']) . ', ' + . json_encode($section['end']) . ', ' . json_encode(array('m' => !empty($section['days'][0]), 't' => !empty($section['days'][1]), 'w' => !empty($section['days'][2]), 'h' => !empty($section['days'][3]), 'f' => !empty($section['days'][4]), 's' => !empty($section['days'][5]))) - . ', \'' . htmlentities($section['professor'], ENT_QUOTES) . '\', \'' - . htmlentities($section['location'], ENT_QUOTES) . '\', \'' - . htmlentities($section['type'], ENT_QUOTES) . '\');' . PHP_EOL; + . ', ' . json_encode($section['professor']) . ', ' + . json_encode($section['location']) . ', ' + . json_encode($section['type']) . ');' . PHP_EOL; $my_hc .= PHP_EOL; } } @@ -187,7 +187,7 @@ if (!empty($_REQUEST['selectsemester'])) echo 'value="' . htmlentities($_POST['postData']['name'], ENT_QUOTES) . '"'; ?> /> - +

@@ -253,8 +253,8 @@ function input_class_js(Course $course, $title = $course->title_get(); if (empty($title)) $title = ''; - $js = $whitespace . 'class_last = add_class_n(\'' . htmlentities($course->getName(), ENT_QUOTES) . '\', \'' - . htmlentities($title, ENT_QUOTES) . "');\n"; + $js = $whitespace . 'class_last = add_class_n(' . json_encode($course->getName()) . ', ' + . json_encode($title) . ');' . PHP_EOL; $nsections = $course->getnsections(); for ($section_key = $nsections - 1; $section_key >= 0; $section_key --) @@ -263,15 +263,15 @@ function input_class_js(Course $course, $meetings = $section->getMeetings(); foreach ($meetings as $meeting) { - $js .= $whitespace . 'add_section_n(class_last, \'' . htmlentities($section->getLetter(), ENT_QUOTES) . '\', \'' - . htmlentities($section->getSynonym(), ENT_QUOTES) . '\', \'' - . $meeting->getStartTime() . '\', \'' - . $meeting->getEndTime() . '\', ' + $js .= $whitespace . 'add_section_n(class_last, ' . json_encode($section->getLetter()) . ', ' + . json_encode($section->getSynonym()) . ', ' + . json_encode($meeting->getStartTime()) . ', ' + . json_encode($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), - 's' => $meeting->getDay(5))) . ', \'' - . htmlentities($section->getProf(), ENT_QUOTES) . '\', \'' - . htmlentities($meeting->getLocation(), ENT_QUOTES) . '\',\'' - . htmlentities($meeting->type_get(), ENT_QUOTES) . "');\n"; + 's' => $meeting->getDay(5))) . ', ' + . json_encode($section->getProf()) . ', ' + . json_encode($meeting->getLocation()) . ',' + . json_encode($meeting->type_get()) . ');' . PHP_EOL; } } diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -60,91 +60,6 @@ var slate_permutate_course_free = -1; */ /** - * \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, location, type) -{ - var snum = last_section_i ++; - - var cssclasses = 'section class' + cnum; - if(type == 'lab') { - cssclasses += ' lab'; - } - - var result = ''; - result = result + ''; - result = result + ''; - result = result + '\ - \ - \ - \ - \ - \ - \ - '; - result = result + '
' + - '' + - '' + - ''; - return result; - } - -/** * Outputs an