Changeset - bbc0c3b4c101
[Not reviewed]
default
0 8 1
ethanzonca - 15 years ago 2010-09-30 20:02:26

Added temporary minimal theme, updated color scheme, fixed some formatting and structural issues, added printing of selected amount, code formatting, other random changes
9 files changed with 238 insertions and 128 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -256,8 +256,8 @@ class Schedule
 
			*/
 
		$footcloser = '';
 

	
 
                if(isset($_REQUEST['print'])){
 
	                $headcode = array('outputStyle', 'outputPrintStyle');
 
                if(isset($_REQUEST['print']) && $_REQUEST['print'] != ''){
 
	                $headcode = array('jQuery', 'outputStyle', 'outputPrintStyle');
 
		}
 
		else {
 
			$footcloser .="</div></div><script type=\"text/javascript\" charset=\"utf-8\">". 
 
@@ -268,11 +268,33 @@ class Schedule
 
		$outputPage = new page($this->getName(), $headcode);
 

	
 
		if(isset($_REQUEST['print'])){
 
			echo '<script type="text/javascript">window.print();</script>';
 
			echo '<p><a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0">Return to normal view</a> :: <a href="input.php">Home</a></p>';
 
			echo '<script type="text/javascript">';
 
			echo 'jQuery(document).ready( function() {';
 

	
 
			/* If user entered items to print */
 
			if($_REQUEST['print'] != 'all'){
 
			      echo 'jQuery(\'.section\').hide();';
 
			      $items = explode(',', $_REQUEST['print']);
 
			      foreach($items as $item){
 
				echo 'jQuery(\'#section'.$item.'\').show();';
 
			      }
 
			}
 

	
 
			echo 'jQuery(\'#selectItemsInput\').hide();
 
			      jQuery(\'#selectItems\').click( function() {
 
				jQuery(\'#selectItemsInput\').show();
 
			      });
 
			      jQuery(\'#cancelItems\').click( function() {
 
				jQuery(\'#selectItemsInput\').hide();
 
			      });';
 
			echo '});'; /* Close document.ready */
 
			echo 'window.print();
 
			      </script>';
 
			echo '<p><span id="selectItems"><a href="#">Select Schedules to Print</a></span> :: <a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0">Return to normal view</a> :: <a href="input.php">Home</a></p>';
 
			echo '<div  id="selectItemsInput"><p><form action="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0"><label><strong>Schedules to Print</strong> <em>(seperate with commas, "all" for all)</em></label><br /><input type="text" name="print" /><input type="submit" value="submit" /><span id="cancelItems"><input type="button" value="cancel" /></span></form></p></div>';
 
		}
 
		else {
 
			echo '<p><a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0&print=1">Print</a> :: <a href="input.php">Home</a></p>';
 
			echo '<p><a href="'.$_SERVER["SCRIPT_NAME"].'?savedkey=0&amp;print=all">Print</a> :: <a href="input.php">Home</a></p>';
 
		}
 

	
 
		echo "<p>There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>";
 
@@ -533,7 +555,7 @@ class Schedule
 
				$table .= "</table></div>";
 
			}
 

	
 
			echo $table . $footcloser;   
 
			echo $table . "</div>" . $footcloser; // Closes off the content div
 
		} else {
 
			echo '<html><body><p>There are no possible schedules. Please try again.</p></body></html>';
 
		}
 
@@ -550,7 +572,7 @@ class Schedule
 
		       */
 
		      $savedkey = max(array_keys($_SESSION['saved'])) + 1;
 
		  }
 
		echo '<form method="get" action="input.php"><input type="hidden" name="savedkey" value="' . $savedkey . '" /><input type="submit" value="edit" /></form>';
 
		echo '<form method="get" action="input.php"><p><input type="hidden" name="savedkey" value="' . $savedkey . '" /><input type="submit" value="edit" /></p></form>';
 

	
 
		$outputPage->foot();
 
	}
images/slatepermutate.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
inc/class.page.php
Show inline comments
 
@@ -33,12 +33,12 @@ class page {
 
  public function __construct($ntitle, $nscripts = array(), $immediate = TRUE)
 
  {
 
    // Scripts and styles available to include
 
    $this->headCode['jQuery'] = '<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>';
 
    $this->headCode['jQuery'] = '<script src="http://www.google.com/jsapi" type="text/javascript"></script><script type="text/javascript" charset="utf-8"> google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2");</script>';
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
    $this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8">';
 
    $this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8">'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8"><script src="scripts/prototype.js" type="text/javascript" charset="utf-8"></script><script src="scripts/effects.js" type="text/javascript" charset="utf-8"></script><script src="scripts/glider.js" type="text/javascript" charset="utf-8"></script>'; 
 
    $this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" /><script src="scripts/prototype.js" type="text/javascript" charset="utf-8"></script><script src="scripts/effects.js" type="text/javascript" charset="utf-8"></script><script src="scripts/glider.js" type="text/javascript" charset="utf-8"></script>'; 
 

	
 
   $this->pagetitle = $ntitle;
 
   $this->scripts = $nscripts;
 
@@ -69,8 +69,12 @@ class page {
 

	
 
  private function top(){
 
    echo '<div id="header">
 
          <h1><em>SlatePermutate</em> - '.$this->pagetitle.'</h1>
 
          </div>
 
	    <h2 id="title"><a href="index.php"><img src="images/slatepermutate.png" alt="SlatePermutate" class="noborder" /></a><br /><span style="margin-left: 1em;">'.$this->pagetitle.'</span></h2>
 
	    
 
	    <span id="menu">
 
	      <!-- <a href="index.php">Home</a> :: <a href="input.php">Scheduler</a> :: <a href="about.php">About</a> -->
 
	    </span>
 
	  </div>
 
          <div id="content">';
 
  }
 

	
 
@@ -83,7 +87,8 @@ class page {
 
	  <html ' . $this->htmlargs . '>
 
	  <head>
 
	    <title>' . $this->pagetitle . ' :: ' . $this->base_title . '</title>
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8">';
 
	    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8" />';
 

	
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $i){
 
@@ -91,14 +96,14 @@ class page {
 
    }
 

	
 
    echo '</head>
 
	  <body '.$this->bodyargs.' >';
 
	  <body '.$this->bodyargs.' ><div id="page">';
 
    echo $this->top(); // Write out top
 
  }
 

	
 
  public function foot(){
 
    echo '</div>';
 
    $this->pageGenTime = round(microtime(), 3);
 
    echo '<div id="footer"><h5>&copy; '. date('Y').' <a href="http://protofusion.org/~nathang/">Nathan Gelderloos</a> <br /> <a href="http://ethanzonca.com">Ethan Zonca</a></h5></div>';
 
    echo '<div id="footer"><h5>&copy; '. date('Y').' <a href="http://protofusion.org/~nathang/">Nathan Gelderloos</a><br /><a href="http://ethanzonca.com">Ethan Zonca</a></h5></div></div>';
 
    echo $this->trackingcode;
 
    echo '</body></html>';
 
  }
 
@@ -120,9 +125,9 @@ class page {
 
		echo '<div id="savedBox" ><h3>Saved Schedules:</h3>';
 
		foreach($session['saved'] as $key => $schedule){
 
			$sch = unserialize($schedule);
 
			echo "<a href=\"process.php?savedkey=$key\">#" . ($key + 1) . " - " . $sch->getName()
 
			  . '</a> <form style="display: inline" method="get" action="input.php"><input type="hidden" name="savedkey" value="' . $key . '" /><input type="submit" value="edit"/></form>'
 
			  . "<em><a href=\"process.php?delsaved=$key\"><img src=\"images/close.png\" style=\"border:0;\" alt=\"[del]\"/></a></em>"
 
			echo "#" . ($key + 1) . " - " . $sch->getName()
 
			  . " - <a href=\"process.php?savedkey=$key\">view</a>" .'</a> <a href="input.php?savedkey="' . $key . '">edit</a> '
 
			  . "<a href=\"process.php?delsaved=$key\">delete</a>"
 
			  . "<br /><br />\n";
 
		}
 
		echo '</div>';
index.php
Show inline comments
 
<?php 
 
	include_once 'inc/class.page.php'; 
 
	$mypage = new page('Scheduler');
 
	$mypage = new page('Welcome');
 
?>
 

	
 
<h3>Find the schedule that works for you!</h3>
input.php
Show inline comments
 
@@ -44,8 +44,8 @@ var sectionsOfClass = Array();
 
?>
 
<p>Welcome to SlatePermutate! To get started, enter in some of your classes, and add available sections for each class.</p>
 
<form method="post" action="process.php" id="scheduleForm">
 
<table>
 
  <tr>
 
<table id="container">
 
  <tr><td>
 
    <table id="jsrows">
 
      <tr>
 
	<td colspan="11">
 
@@ -56,12 +56,14 @@ var sectionsOfClass = Array();
 
      </tr>
 
      <tr>
 
	<td class="advanced" colspan="11" style="padding-bottom: 2em;">
 
	  Section Labels are <select id="isNumeric" type="text" class="required" name="isnumbered" value="<?php if ($sch) echo $sch->section_format; else echo 'numerous'; ?>" >
 
	    <option value="numerous">Custom</option>
 
	    <option value="numbered">Numbered</option>
 
	    <option value="lettered">Lettered</option>
 
	  Section Labels are <select id="isNumeric" class="required" name="isnumbered">
 
	    <?php $isSelected = 'selected="selected"'; ?>
 
	    <option value="numerous" <? if(!$sch || $sch->section_format == "numerous") echo $isSelected ?> >Custom</option>
 
	    <option value="numbered" <? if($sch && $sch->section_format == "numbered") echo $isSelected ?> >Numbered</option>
 
	    <option value="lettered" <? if($sch && $sch->section_format == "lettered") echo $isSelected ?> >Lettered</option>
 
	  </select>
 

	
 
	</td>
 
	</tr>
 
	<!-- Header -->
 
	<tr>
 
		<td>Class</td>
 
@@ -78,7 +80,9 @@ var sectionsOfClass = Array();
 
	</tr>
 
	<?php if ($sch) echo $sch->input_form_render(); ?>
 
    </table>
 
  </td>
 
  </tr>
 
  
 
  <tr><td> <span class="gray" style="padding: 0 3.5em 0 3.5em;" id="addclass">Add Class</span></td></tr>
 
</table>
 

	
 
@@ -87,9 +91,9 @@ var sectionsOfClass = Array();
 

	
 
</form>
 

	
 
<p>&nbsp;<br /></p>
 
<p><span id="showadvanced"><a href="#">Show Advanced Options</a></span></p>
 
<span class="advanced">
 
<p>&nbsp;<br /><br /><br /></p>
 
<p><span id="showadvanced" style="margin-left: 1em;"><a href="#">Advanced</a></span></p>
 
<div class="advanced">
 
<h3>TODO:</h3>
 

	
 
<ul>
 
@@ -101,8 +105,8 @@ var sectionsOfClass = Array();
 
        <li>Move the add class button to somewhere nicer, maybe a gray row at the bottom. Make the submit button more obvious.</li>
 
	<li>Form validation to ensure endtime is after starttime, at least one day is checked.</li>
 
	<li>Auto-populate form based on saved schedule?</li>
 
        <li>Grab data from school sites such as <a href="http://www.cedarville.edu/courses/schedule/2010fa_be_bebl.htm" target="_blank">this?</a></li>
 
        <li>Grab data from school sites such as <a href="http://www.cedarville.edu/courses/schedule/2010fa_be_bebl.htm" rel="external">this?</a></li>
 
</ul>
 

	
 
</div>
 
<?php
 
$inputPage->foot();
scripts/scheduleInput.js
Show inline comments
 
	/* Set all default error messages to this */
 

	
 
    //--------------------------------------------------
 
    // Validation Functions
 
    //--------------------------------------------------      
 

	
 

	
 
	//--------------------------------------------------
 
	// Default Error Message
 
	//--------------------------------------------------
 
	jQuery.each(jQuery.validator.messages, function(i) {
 
		jQuery.validator.messages[i] = "<p class=\"error\">Please fill the field</p>";
 
	});
 

	
 
	//--------------------------------------------------
 
	// Time Selection Validation
 
	//--------------------------------------------------
 
	jQuery.validator.addMethod( 
 
		"selectNone", 
 
		function(value, element) { 
 
@@ -14,6 +25,10 @@
 
		}, 
 
		"<p class=\"error\">Please select a time</p>" 
 
	); 
 
	
 
	//--------------------------------------------------
 
	// Days of Week validation
 
	//--------------------------------------------------
 
	jQuery.validator.addMethod( 
 
		"daysRequired", 
 
		function(value, element) { 
 
@@ -27,17 +42,20 @@
 
			} 
 
			else return true; 
 
		}, 
 
		"<p class=\"error\">Pick a day!</p>" 
 
		"<p class=\"error\">Select a day!</p>" 
 
	); 
 

	
 
	//--------------------------------------------------
 
	// Add validation rules
 
	//--------------------------------------------------
 
	jQuery.validator.addClassRules("selectRequired", {
 
		selectNone: true
 
	});
 
	
 
	jQuery.validator.addClassRules("daysRequired", {
 
		daysRequired: true
 
	});
 

	
 

	
 
    jQuery(document).ready(function() {
 
	//--------------------------------------------------
 
	// Validates the form (pre-submission check)
 
@@ -49,7 +67,6 @@
 

	
 
	/* classNum is declared in the <head/> to enable loading of saved classes */
 
	/* sectionsOfClass is declared in the <head/> to enable loading of saved sections */
 

	
 
        function numberedIds(name){
 
		return '<td class="sectionIdentifier">\
 
                                <select name="'+name+'"><option value="-">-</option><option value="1">1</option><option value="2">2</option>\
 
@@ -167,7 +184,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><div class="deleteSection"><input type="button" value="X" /></div></td><td></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><div class="deleteSection"><input type="button" value="x" /></div></td><td></td></tr>');
 
	});
 

	
 
	//--------------------------------------------------
 
@@ -175,32 +192,32 @@
 
	//--------------------------------------------------
 
	jQuery('#reset').click(function() {
 
		jQuery('#scheduleForm').resetForm();
 
    });
 
	});
 

	
 
	//--------------------------------------------------
 
	// Default text stuff
 
	// Default text
 
	//--------------------------------------------------
 
    jQuery(".defText").focus(function(srcc)
 
    {
 
        if (jQuery(this).val() == jQuery(this)[0].title)
 
        {
 
            jQuery(this).removeClass("defaultTextActive");
 
            jQuery(this).val("");
 
        }
 
    });
 
    jQuery(".defText").blur(function()
 
    {
 
        if (jQuery(this).val() == "")
 
        {
 
            jQuery(this).addClass("defaultTextActive");
 
            jQuery(this).val($(this)[0].title);
 
        }
 
    });
 
    jQuery(".defText").blur();
 
	jQuery(".defText").focus(function(srcc)
 
	{
 
	    if (jQuery(this).val() == jQuery(this)[0].title)
 
	    {
 
		jQuery(this).removeClass("defaultTextActive");
 
		jQuery(this).val("");
 
	    }
 
	});
 
	jQuery(".defText").blur(function()
 
	{
 
	    if (jQuery(this).val() == "")
 
	    {
 
		jQuery(this).addClass("defaultTextActive");
 
		jQuery(this).val($(this)[0].title);
 
	    }
 
	});
 
	jQuery(".defText").blur();
 

	
 

	
 
    //--------------------------------------------------
 
    // Change between numbered and lettered on event
 
    // Change section identifier type (from dropdown)
 
    //--------------------------------------------------
 
    jQuery("#isNumeric").live('change', function() {
 
      if(this.value == "lettered"){
 
@@ -231,10 +248,13 @@
 

	
 
    });
 

	
 
  jQuery('.advanced').hide();    
 
  jQuery('#showadvanced').click( function() {
 
    jQuery('#showadvanced').hide();
 
    jQuery('.advanced').slideToggle();
 
  });
 
    //--------------------------------------------------
 
    // Show/Hide advanced items
 
    //--------------------------------------------------
 
    jQuery('.advanced').hide();    
 
    jQuery('#showadvanced').click( function() {
 
      jQuery('#showadvanced').hide();
 
      jQuery('.advanced').slideToggle();
 
    });
 

	
 
});
 

	
styles/general.css
Show inline comments
 
  body {
 
    width: 80%;
 
    margin:auto;
 
    font-family: sans-serif;
 
  }
 
	#savedBox {
 
		width: 15em;
 
		padding: 1em;
 
		border: 1px solid #000;
 
		float:right;
 
		background: #DDD;
 
		font-size: .8em;
 
	}
 
	#header {
 
		text-align: left;
 
		background: rgb(220,220,220); /* IE fallback */
 
		background: rgba(200,200,200, .3);  
 
	}
 
	#footer {
 
		text-align: right;
 
		background: rgb(220,220,220); /* IE fallback */
 
		background: rgba(200,200,200, .3); 
 
	}
 
	.defaultText { 
 
		width: 300px; }
 
	.defaultTextActive { 
 
		color: #a1a1a1; 
 
		font-style: italic; 
 
	}
 
	.error {
 
		color: #F00; /* For validation errors */
 
	} 
 
	.error p {
 
		padding: 0;
 
		margin: 0;
 
		font-size: .7em;
 
	}
 
	td.center {
 
		text-align:center;
 
	}
 
	.section:nth-child(even) {
 
		background: #DDDDDD;
 
	}
 
	.none {
 
		background: #fff;
 
	}
 
	.class {
 
		background: #99FF99;
 
	}
 
	#classage {
 
		float:left;
 
	}
 
	.paddingtop {
 
		padding: .5em;
 
		padding-top: 1.5em;
 
	}
 
body {
 
  background: #fff;
 
}
 

	
 

	
 
/* Page Layout Styling */
 

	
 
#page {
 
  font: normal 14px sans-serif;
 
  background: transparent;
 
  width: 80%;
 
  margin:auto;
 
}
 
#content {
 
  background: #fff;
 
  padding: 12px;
 
}
 
#header {
 
  border-bottom: 1px dashed #888;
 
  text-align: left;
 
}
 
#header h2 {
 
  font:  italic 20px sans-serif;
 
}
 
#footer {
 
  border-top: 1px dashed #888;
 
  text-align: right;
 
}
 
#savedBox {
 
  width: 20em;
 
  padding: 1em;
 
  border: 1px solid #CCC;
 
  float:right;
 
  background: #EEE;
 
  font-size: .8em;
 
}
 

	
 

	
 
/* Link Styling */
 

	
 
a:link, a:visited, a:active {
 
  color: #777;
 
}
 

	
 
a:hover {
 
  color: #AAA;
 
}
 

	
 
#footer a:link, #footer a:visited, #footer a:active, #footer a:hover {
 
  color: #000;
 
  text-decoration: none;
 
}
 
#footer a:hover {
 
  text-decoration: underline;
 
}
 

	
 

	
 
/* Table Styling */
 

	
 
td.center {
 
  text-align:center;
 
}
 
.section:nth-child(even) {
 
  background: #DDDDDD;
 
}
 
.none {
 
  background: #fff;
 
}
 
.class {
 
  /* background: #99FF99; */
 
  background: #70a97c;
 
}
 

	
 

	
 
/* Input Formatting */
 

	
 
.defaultText { 
 
  width: 300px;
 
}
 
.defaultTextActive { 
 
  color: #a1a1a1; 
 
  font-style: italic; 
 
}
 
.error {
 
  color: #F00; /* For validation errors */
 
} 
 
.error p {
 
  padding: 0;
 
  margin: 0;
 
  font-size: .7em;
 
}
 
#classage {
 
  float:left;
 
}
 
.paddingtop {
 
  padding: .5em;
 
  padding-top: 1.5em;
 
}
 
.tdInput {
 
  background: #fff;
 
}
 

	
 
.addClassRow {
 
  padding: 2px;
 
  width: 30em;
 

	
 
}
 
.gray {
 
  border: 1px dashed #999;
 
  border-radius: 5px;
 
  -moz-border-radius: 5px;
 
  -webkit-border-radius: 5px;
 
  border: 1px solid #999;
 
  text-align: center!important;
 
  background: #BBB!important;
 
  background: #CCC!important;
 
  cursor:default;
 
}
 
.gray:hover {
 
  background: #CCC!important;
 
  background: #DDD!important;
 
}
 

	
 

	
 
/* General Classes */
 

	
 
.clear {
 
  clear: all;
 
}
 
.noborder {
 
  border: none;
 
}
styles/glider.css
Show inline comments
 
@@ -34,12 +34,14 @@ margin-bottom: 2px;
 
}
 
.controls a{
 
  -moz-border-radius-topright: 10px;
 
  border-top-right-radius: 10px;
 
  -moz-border-radius-topleft: 10px;
 
  border-top-left-radius: 10px;
 

	
 
  text-decoration: none;
 
  background: rgba(152,1,1,0.9);
 
  background: rgb(0,35,0); /* Fallback */
 
  background: rgba(0,35,0,0.9);
 
  padding: 2px;
 
//OLD:  margin-left: 3px;
 
//OLD:  margin-right: 3px;
 
}
 
.controls a:link{
 
	color: rgba(255,255,255,1);
 
@@ -49,7 +51,7 @@ margin-bottom: 2px;
 
}
 
.controls a:hover{
 
	background: rgba(255,255,255,1);
 
	color: rgba(152,1,1,0.9);
 
	color: rgb(0,0,0);
 
}
 
.controls a:active{
 
	color: rgba(200,200,200,1);
styles/print.css
Show inline comments
 
@@ -27,3 +27,7 @@ div.scroller div.section div.txt {
 
.section {
 
	background: #fff!important;
 
}
 

	
 
#footer {
 
  text-align: center;
 
}
 
\ No newline at end of file
0 comments (0 inline, 0 general)