@@ -44,13 +44,15 @@
}
.paddingtop {
padding: .5em;
padding-top: .8em;
</style>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript" charset="utf-8">
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
</script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>
@@ -95,12 +97,13 @@
);
*/
jQuery.validator.addClassRules("selectRequired", {
selectNone: true
});
jQuery.validator.addClassRules("daysRequire", {
daysRequired: true
jQuery(document).ready(function() {
//--------------------------------------------------
@@ -108,19 +111,19 @@
jQuery('#scheduleForm').validate({
debug: false,
var classNum = 0;
var sectionsOfClass = new Array(); // holds number of sections for each class
//---------------------------------------------
function getCommonInputs(cnum)
{
// Returns the common inputs for each new section.
function getCommonInputs(cnum) {
var snum = sectionsOfClass[cnum];
var result = '<td>\
<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>\
@@ -162,24 +165,20 @@
<td><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][2]" value="1" /></td>\
<td><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][3]" value="1" /></td>\
<td><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][4]" value="1" /></td>';
return result;
// Adds a new class to the input.
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" name="postData[' + classNum + '][name]" /></td>' + getCommonInputs(classNum) + '<td><div class="addSection"><input type="button" value="Add section" /></div></td><td><div class="deleteClass"><input type="button" value="Delete" /></div></td></tr>');
classNum++;
};
addRow(); // Add initial row
// Adds a new class when the add class button is
@@ -219,27 +218,39 @@
jQuery('#scheduleForm').resetForm();
</head>
<body>
<div id="header">
<h1><em>SlatePermutate</em> - Scheduler</h1>
<h1>
<em>
SlatePermutate
</em>
- Scheduler
</h1>
</div>
<div id="content">
<h3>Saved Schedules:</h3>
<h3>
Saved Schedules:
</h3>
<p>
<?php
if(isset($_SESSION['saved']))
foreach($_SESSION['saved'] as $key => $schedule)
echo "<a href=\"process.php?savedkey=$key\">Saved Schedule $key</a><br />";
foreach($_SESSION['saved'] as $schedule)
echo "Saved Schedule<br />";
else
echo "No saved schedules!<br />";
?>
</p>
<form method="post" action="process.php" id="scheduleForm">
<table id="jsrows">
<!-- Header -->
@@ -256,28 +267,51 @@ else
<td class="center">Add</td>
<td class="center">Delete</td>
</tr>
</table>
<div class="paddingtop" id="classage"><input type="button" value="Add class" /></div>
<div class="paddingtop"><input style="float:left;" type="submit" value="Submit" /></div>
<p><br /></p>
<br />
<div class="paddingtop" id="reset"><input style="float:left;" type="button" value="Reset" /></div>
</form>
<p> <br /></p>
 
<h3>TODO:</h3>
<ul>
<li>Form validation to ensure endtime is after starttime, at least one day is checked.</li>
<li>Check the saved schedule function. After input my default schedule, the output was the same
as that of the demo. However, when I went back and clicked the "Saved Schedule 0" link, there
were then 48 possible schedules. It seems that the classes were added twice for some reason.</li>
</ul>
<div id="footer">
<h5>© <?php echo Date("Y"); ?> <a href="http://protofusion.org/~nathang/">Nathan Gelderloos</a><br />
with special thanks to <a href="http://ethanzonca.com">Ethan Zonca</a></h5>
<h5>
©
<?php echo Date("Y"); ?>
<a href="http://protofusion.org/~nathang/">
Nathan Gelderloos
</a>
with special thanks to
<a href="http://ethanzonca.com">
Ethan Zonca
</h5>
</body>
</html>
\ No newline at end of file
Status change: