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 element. It will inlcude selected="selected"
* if the value param equals the test_value param.
*/
@@ -189,11 +104,94 @@ function addTips()
*/
function add_section_n(cnum, name, synonym, stime, etime, days, prof, location, type)
{
- jQuery('.pclass'+cnum).after(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 section_html = '
' +
+ '
' +
+ '
' +
+ '
\
+
\
+
\
+
\
+
\
+
\
+
\
+
' +
+ '
' +
+ '' +
+ '' +
+ '
';
+
+
+ jQuery('.pclass' + cnum).after(section_html);
sectionsOfClass[cnum] ++;
+ var section_tr = jQuery('.pclass' + cnum).next();
/* store course_i in a place the newly added section will look for it */
- jQuery('.pclass' + cnum).next().data({course_i: cnum});
+ section_tr.data({course_i: cnum});
+
+ /*
+ * Store data into the newly created HTML. With this method we
+ * have to _avoid_ escaping entities in the text we're setting as
+ * values because the DOM stuff will escape it for us.
+ */
+ section_tr.find('.section-letter-entry').val(name);
+ section_tr.find('.section-synonym-entry').val(synonym);
+ section_tr.find('.profName').val(prof);
+ section_tr.find('.section-location-entry').val(location);
+ section_tr.find('.section-type-entry').val(type);
/* unhide the saturday columns if it's used by autocomplete data */
if (days.s)
@@ -255,19 +253,22 @@ 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);
+{
+ /*
+ * 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('