Changeset - 7cac9a0cbf3a
[Not reviewed]
default
0 3 0
ethanzonca - 15 years ago 2010-09-23 22:09:33

Custom course numbering system implemented, formatting changes
3 files changed with 29 insertions and 14 deletions:
0 comments (0 inline, 0 general)
input.php
Show inline comments
 
@@ -20,12 +20,12 @@ include_once 'inc/class.page.php';
 
		</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><option value="numerous">Incredibly numerous</option></select>
 
		<td colspan="11" style="padding-bottom: 2em;">Section Numbering Style: <select id="isNumeric" type="text" class="required" name="isnumbered" ><option value="numerous">Custom</option><option value="numbered">Numbered</option><option value="lettered">Lettered</option></select>
 

	
 
	<!-- Header -->
 
	<tr>
 
		<td>Class</td>
 
		<td class="center" id="letterNumber">Number</td>
 
		<td class="center" id="letterNumber">Section</td>
 
		<td class="center">Start Time</td>
 
		<td class="center">End Time</td>
 
		<td class="center">M</td>
 
@@ -33,8 +33,8 @@ include_once 'inc/class.page.php';
 
		<td class="center">W</td>
 
		<td class="center">Th</td>
 
		<td class="center">F</td>
 
		<td class="center">Add</td>
 
		<td class="center">Delete</td>
 
		<td class="center"></td>
 
		<td class="center"></td>
 
	</tr>
 
</table>
 

	
 
@@ -48,6 +48,7 @@ include_once 'inc/class.page.php';
 
<h3>TODO:</h3>
 

	
 
<ul>
 
	<li>Add print stylesheet and button to output page</li>
 
	<li>After selecting a start time, set the end time to one hour after the start time</li>
 
        <li><strong>Append</strong> sections</li>
 
        <li>Move the add class button to somewhere nicer, maybe a gray row at the bottom. Make the submit button more obvious.</li>
scripts/scheduleInput.js
Show inline comments
 
@@ -71,7 +71,9 @@
 
                                <option value="H">H</option><option value="I">I</option><option value="J">J</option><option value="K">K</option></select></td>\
 
                                </select></td>';
 
	}
 

	
 
	function customIds(name){
 
		return '<td class="sectionIdentifier"><input type="text" size="1" class="required" title="Schedule Name" name="' + name + '" /></td>';
 
	}
 

	
 
	//--------------------------------------------------
 
	// Returns the common inputs for each new section.
 
@@ -83,8 +85,11 @@
 
		if(jQuery('#isNumeric').val() == "lettered"){
 
			result = result + letteredIds('postData[' + cnum + '][' + snum + '][letter]');
 
		}
 
		else if(jQuery('#isNumeric').val() == "numbered") {
 
                        result = result + numberedIds('postData[' + cnum + '][' + snum + '][letter]');
 
		}
 
		else {
 
                        result = result + numberedIds('postData[' + cnum + '][' + snum + '][letter]');
 
                        result = result + customIds('postData[' + cnum + '][' + snum + '][letter]');
 
		}
 

	
 
		result = result + '<td><select class="selectRequired" name="postData[' + cnum + '][' + snum + '][start]"><option value="none"></option>\
 
@@ -133,7 +138,7 @@
 
	//--------------------------------------------------
 
	function addRow(){
 
		sectionsOfClass[classNum] = 0; // This is class 0, initialize at 0
 
		jQuery('#jsrows').append('<tr title="' + classNum + '" class="class class' + classNum + '"><td><input type="text" class="required defText" title="Class Name" name="postData[' + classNum + '][name]" /></td><td colspan="8"></td><td><div class="addSection"><input type="button" value="Add section" /></div></td><td><div class="deleteClass"><input type="button" value="Delete" /></div></td></tr>');
 
		jQuery('#jsrows').append('<tr title="' + classNum + '" class="class class' + classNum + '"><td><input type="text" class="required defText" title="Class Name" name="postData[' + classNum + '][name]" /></td><td colspan="8"></td><td class="tdInput"><div class="addSection"><input type="button" value="Add section" /></div></td><td class="tdInput"><div class="deleteClass"><input type="button" value="Remove" /></div></td></tr>');
 
		classNum++;
 
	};
 
	
 
@@ -151,6 +156,7 @@
 
	// Deletes the selected class from input.
 
	//--------------------------------------------------
 
	jQuery('.deleteClass').live('click', function() {
 
		alert('Delete class and all sections of this class?');
 
		jQuery('.class'+ jQuery(this).parent().parent().attr("title")).remove();
 
	});
 

	
 
@@ -167,7 +173,7 @@
 
	//--------------------------------------------------
 
	jQuery('.addSection').live('click', function() {
 
		sectionsOfClass[jQuery(this).parent().parent().attr("title")]++; // Increases sectionsOfClass[classNum]
 
		jQuery(this).parent().parent().after('<tr class="section class' + jQuery(this).parent().parent().attr("title") + '"><td class="none"></td>' + getCommonInputs(jQuery(this).parent().parent().attr("title")) + '<td></td><td><div class="deleteSection"><input type="button" value="Delete" /></div></td></tr>');
 
		jQuery(this).parent().parent().after('<tr class="section class' + jQuery(this).parent().parent().attr("title") + '"><td class="none"></td>' + getCommonInputs(jQuery(this).parent().parent().attr("title")) + '<td></td><td><div class="deleteSection"><input type="button" value="X" /></div></td></tr>');
 
	});
 

	
 
	//--------------------------------------------------
 
@@ -209,20 +215,26 @@
 
           var name = jQuery("select", this).attr("name");
 
           jQuery(this).empty();
 
           jQuery(this).append(letteredIds(name));
 
           jQuery("#letterNumber").empty();
 
           jQuery("#letterNumber").append("Letter");
 
         });
 
      }
 
      else {
 
      else if(this.value == "numbered"){
 
         /* 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");
 
         });
 
      }
 
      else {
 
         /* Replace with custom */
 
         jQuery(".sectionIdentifier").each( function(index) {
 
           var name = jQuery("select", this).attr("name");
 
           jQuery(this).empty();
 
           jQuery(this).append(customIds(name));
 
         });
 

	
 
      }
 

	
 
    });
 
    
 

	
styles/general.css
Show inline comments
 
@@ -54,4 +54,6 @@
 
		padding: .5em;
 
		padding-top: .8em;
 
	}
 

	
 
.tdInput {
 
  background: #fff;
 
}
0 comments (0 inline, 0 general)