Changeset - 42656e88bc44
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 15 years ago 2010-09-30 20:30:44
ohnobinki@ohnopublishing.net
Ask for stricter standards-compliance, add <?xml ?> header, and use application/xhtml+xml and XHTML if the browser supports it.
2 files changed with 27 insertions and 11 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
<?php
 

	
 
/* Class for general page generation */
 
class page {
 

	
 
  private $base_title = 'SlatePermutate';
 
  private $doctype = 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"';
 
  private $htmlargs = 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"';
 
  private $bodyargs = '';
 
  public $lastJobTable = '';
 
  private $pageGenTime = 0;
 
  private $indexpath = 'http://protofusion.org/SlatePermutate/'; // full url to index for php header redirection
 
  /* whether or not to output valid XHTML */
 
  public $xhtml = FALSE;
 

	
 
  // Scripts and styles
 
  private $headCode = array();
 

	
 
  private $trackingcode = '<script type="text/javascript">
 
				var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
				document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
 
        		   </script>
 

	
 
  /* the inclusion of ga.js is augmented in __construct(). */
 
  private $trackingcode = '
 
			  <script type="text/javascript">
 
				var nathangPageTracker = _gat._getTracker("UA-17441156-1");
 
				nathangPageTracker._trackPageview();
 
				
 
				var ethanzPageTracker = _gat._getTracker("UA-2800455-1");
 
				ethanzPageTracker._trackPageview();
 
			</script>'; // Google analytics ga.js tracking code
 

	
 
  private $pagetitle = ''; // Title of page
 
  private $scripts = array(); // Scripts to include on 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" 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->pagetitle = $ntitle;
 
   $this->scripts = $nscripts;
 

	
 
   /* compliant browsers which care, such as gecko, explicitly request xhtml: */
 
   if(!empty($_SERVER['HTTP_ACCEPT'])
 
      && strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE
 
      || !strlen($_SERVER['HTTP_ACCEPT']) /* then the browser doesn't care :-) */)
 
     {
 
       $this->xhtml = TRUE;
 
       header('Content-type: application/xhtml+xml');
 
     }
 

	
 
   $ga_www = 'http://www.';
 
   if ($_SERVER['SERVER_PORT'] != 80)
 
     $ga_www = 'https://ssl.';
 
   $this->trackingcode = '<script type="text/javascript" src="' . $ga_www . 'google-analytics.com/ga.js"' . ($this->xhtml ? '/' : '') . ">\n"
 
     . $this->trackingcode;
 

	
 
    session_start();
 
    if($immediate
 
       && $ntitle != "NOHEAD")
 
      $this->head();
 
 }
 

	
 
  /**
 
   * \brief
 
   *   Adds some headcode to this page.
 
   *
 
   * \param $key
 
   *   The key to register this headcode under.
 
@@ -74,30 +88,32 @@ class page {
 
	    <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">';
 
  }
 

	
 
// Public functions/vars
 

	
 
  public function head(){
 
    $this->pageGenTime = round(microtime(), 3);
 

	
 
    if ($this->xhtml)
 
       echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
 

	
 
    echo '<!DOCTYPE ' . $this->doctype . '>
 
	  <html ' . $this->htmlargs . '>
 
	  <head>
 
	    <title>' . $this->pagetitle . ' :: ' . $this->base_title . '</title>
 
	    <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" />';
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8"' . ($this->xhtml ? '/' : '') . '>';
 

	
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $i){
 
    	echo $this->headCode["$i"];
 
    }
 

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

	
 
  public function foot(){
 
@@ -117,22 +133,22 @@ class page {
 
      $seconds = bcmod(intval($seconds),60);
 
      $ret .= "$seconds";
 
      return $ret;
 
  }
 

	
 
  public function showSavedScheds($session) {
 
       echo '<p>';
 
	if(isset($session['saved']) && count($session['saved']) > 0){
 
		echo '<div id="savedBox" ><h3>Saved Schedules:</h3>';
 
		foreach($session['saved'] as $key => $schedule){
 
			$sch = unserialize($schedule);
 
			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?savedkey=$key\">view</a>" .' <a href="input.php?savedkey="' . $key . '">edit</a> '
 
			  . "<a href=\"process.php?delsaved=$key\">delete</a>"
 
			  . "<br /><br />\n";
 
		}
 
		echo '</div>';
 
	}
 
       echo '</p>';
 
}
 

	
 
}
input.php
Show inline comments
 
@@ -49,27 +49,27 @@ var sectionsOfClass = Array();
 
    <table id="jsrows">
 
      <tr>
 
	<td colspan="11">
 
	  <input id="scheduleName" style="margin-bottom: 2em;" class="defText required" type="text" size="25" title="Schedule Name (e.g., Spring <?php echo Date('Y'); ?>)" name="postData[name]"
 
		 <?php if ($sch) echo 'value="' . str_replace('"', '&quot;', $sch->getName()) . '"'; /*"*/ ?>
 
		 />
 
	</td>
 
      </tr>
 
      <tr>
 
	<td class="advanced" colspan="11" style="padding-bottom: 2em;">
 
	  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>
 
	    <option value="numerous" <?php if(!$sch || $sch->section_format == "numerous") echo $isSelected ?> >Custom</option>
 
	    <option value="numbered" <?php if($sch && $sch->section_format == "numbered") echo $isSelected ?> >Numbered</option>
 
	    <option value="lettered" <?php if($sch && $sch->section_format == "lettered") echo $isSelected ?> >Lettered</option>
 
	  </select>
 
	</td>
 
	</tr>
 
	<!-- Header -->
 
	<tr>
 
		<td>Class</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>
 
		<td class="center">Tu</td>
 
		<td class="center">W</td>
0 comments (0 inline, 0 general)