Changeset - b7ba846fb562
[Not reviewed]
Merge default
0 2 0
Nathan Brink (binki) - 15 years ago 2010-09-23 20:36:28
ohnobinki@ohnopublishing.net
merge in normaldotcom's changes.
2 files changed with 63 insertions and 5 deletions:
0 comments (0 inline, 0 general)
input.php
Show inline comments
 
@@ -19,11 +19,13 @@ include_once 'inc/class.page.php';
 
			<em>(For example: Fall <?php echo Date("Y"); ?>)</em>
 
		</td>
 
	</tr>
 
	<tr>
 
		<td colspan="11" style="padding-bottom: 2em;">Sections at my school are <select id="isNumeric" type="text" class="required" name="isnumbered" ><option value="numbered">Numbered</option><option value="lettered">Lettered</option></select>
 

	
 
	<!-- Header -->
 
	<tr>
 
		<td>Class</td>
 
		<td class="center">Letter</td>
 
		<td class="center" id="letterNumber">Number</td>
 
		<td class="center">Start Time</td>
 
		<td class="center">End Time</td>
 
		<td class="center">M</td>
scripts/scheduleInput.js
Show inline comments
 
@@ -57,18 +57,46 @@
 
	var classNum = 0;
 
	var sectionsOfClass = new Array(); // holds number of sections for each class
 

	
 
        function numberedIds(name){
 
		return '<td class="sectionIdentifier">\
 
                                <select name="'+name+'"><option value="-">-</option><option value="1">1</option><option value="2">2</option>\
 
                                <option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option>\
 
                                <option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option></select></td>\
 
                                </select></td>';
 
        }
 
	function letteredIds(name){
 
		return '<td class="sectionIdentifier">\
 
                                <select name="'+name+'"><option value="-">-</option><option value="A">A</option><option value="B">B</option>\
 
                                <option value="C">C</option><option value="D">D</option><option value="E">E</option><option value="F">F</option><option value="G">G</option>\
 
                                <option value="H">H</option><option value="I">I</option><option value="J">J</option><option value="K">K</option></select></td>\
 
                                </select></td>';
 
	}
 

	
 

	
 
	//--------------------------------------------------
 
	// Returns the common inputs for each new section.
 
	//--------------------------------------------------
 
	function getCommonInputs(cnum) {
 
		var snum = sectionsOfClass[cnum];
 

	
 
		var result = '<td>\
 
		var result = '';
 
		if(jQuery('#isNumeric').val() == "lettered"){
 
			result = result + letteredIds('postData[' + cnum + '][' + snum + '][letter]') /* '<td class="sectionIdentifier">\
 
				<select name="postData[' + cnum + '][' + snum + '][letter]"><option value="-">-</option><option value="A">A</option><option value="B">B</option>\
 
				<option value="C">C</option><option value="D">D</option><option value="E">E</option><option value="F">F</option><option value="G">G</option>\
 
				<option value="H">H</option><option value="I">I</option><option value="J">J</option><option value="K">K</option></select></td>\
 
				</select></td>\
 
			<td><select class="selectRequired" name="postData[' + cnum + '][' + snum + '][start]"><option value="none"></option>\
 
				</select></td>'*/;
 
		}
 
		else {
 
                        result = result + numberedIds('postData[' + cnum + '][' + snum + '][letter]') /* '<td class="sectionIdentifier">\
 
                                <select name="postData[' + cnum + '][' + snum + '][letter]"><option value="-">-</option><option value="1">1</option><option value="2">2</option>\
 
                                <option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option>\
 
                                <option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option></select></td>\
 
                                </select></td>' */;
 
		}
 

	
 

	
 
		result = result + '<td><select class="selectRequired" name="postData[' + cnum + '][' + snum + '][start]"><option value="none"></option>\
 
				<option value="700">7:00 am</option><option value="730">7:30 am</option>\
 
				<option value="800">8:00 am</option><option value="830">8:30 am</option>\
 
				<option value="900">9:00 am</option><option value="930">9:30 am</option>\
 
@@ -177,7 +205,35 @@
 
            jQuery(this).val($(this)[0].title);
 
        }
 
    });
 
    jQuery(".defText").blur();    
 
    jQuery(".defText").blur();
 

	
 

	
 
    //--------------------------------------------------
 
    // Change between numbered and lettered on event
 
    //--------------------------------------------------
 
    jQuery("#isNumeric").live('change', function() {
 
      if(this.value == "lettered"){
 
         /* Replace with lettered */
 
         jQuery(".sectionIdentifier").each( function(index) {
 
           var name = jQuery("select", this).attr("name");
 
           jQuery(this).empty();
 
           jQuery(this).append(letteredIds(name));
 
           jQuery("#letterNumber").empty();
 
           jQuery("#letterNumber").append("Letter");
 
         });
 
      }
 
      else {
 
         /* Replace with numbered */
 
         jQuery(".sectionIdentifier").each( function(index) {
 
           var name = jQuery("select", this).attr("name");
 
           jQuery(this).empty();
 
           jQuery(this).append(numberedIds(name));
 
           jQuery("#letterNumber").empty();
 
           jQuery("#letterNumber").append("Number");
 
         });
 
      }
 
    });
 
    
 

	
 
});
 

	
0 comments (0 inline, 0 general)