Changeset - ae8cada84fa2
[Not reviewed]
default
0 9 0
Nathan Brink (binki) - 15 years ago 2011-01-31 23:21:38
ohnobinki@ohnopublishing.net
Create pages with an object factory (start solving bug 75 -- allowing overriding the page class will now be just a few more lines of code ;-)).
9 files changed with 39 insertions and 13 deletions:
0 comments (0 inline, 0 general)
admin.php
Show inline comments
 
@@ -23,7 +23,7 @@ require_once('inc/admin.inc');
 

	
 

	
 
  $scripts = array('jQuery','jQueryUI'); 
 
  $adminpage = new page('Administration',$scripts,FALSE);
 
$adminpage = page::page_create('Administration', $scripts);
 
  $datepicker = '$(function() {
 
                   $( "#datepicker" ).datepicker();
 
                   $( "#datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" );
auto.php
Show inline comments
 
@@ -35,7 +35,7 @@ require_once('inc/school.inc');
 
require_once('inc/class.page.php');
 
require_once('inc/class.course.inc');
 

	
 
Page::session_start();
 
page::session_start();
 

	
 
if (isset($_REQUEST['txt'])) {
 
  header('Content-Type: text/plain; encoding=utf-8');
feedback-submit.php
Show inline comments
 
@@ -26,7 +26,8 @@ if ($use_captcha)
 
    $securimage = new Securimage();
 
  }
 

	
 
$feedbackpage = new page('Feedback');
 
$feedbackpage = page::page_create('Feedback');
 
$feedbackpage->head();
 
$subject = '[SlatePermutate] - Feedback';
 
?>
 

	
feedback.php
Show inline comments
 
@@ -20,7 +20,8 @@
 

	
 
include_once 'inc/class.page.php'; 
 

	
 
$feedbackpage = new page('Feedback');
 
$feedbackpage = page::page_create('Feedback');
 
$feedbackpage->head();
 
$ipi = $_SERVER['REMOTE_ADDR'];
 
$fromdom = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
$httpagenti = $_SERVER['HTTP_USER_AGENT'];
inc/class.page.php
Show inline comments
 
@@ -164,6 +164,27 @@ class page
 

	
 
  /**
 
   * \brief
 
   *   Instantiate a new page for the caller.
 
   *
 
   * The caller must explicitly call the page::head() function upon
 
   * the value that is returned. No implicit actions are supported
 
   * anymore.
 
   *
 
   * \param $title
 
   *   The title of the page. Must be completely UTF-8 (will be
 
   *   escaped for you with htmlentitites()).
 
   * \param $scripts
 
   *   A list of scripts which the page desires to be included in the
 
   *   <head /> of the page. Should this param just be moved to the
 
   *   page::head() function?
 
   */
 
  public static function page_create($title, array $scripts = array())
 
  {
 
    return new page(htmlentities($title), $scripts, FALSE);
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Adds some headcode to this page.
 
   *
 
   * \param $key
 
@@ -189,7 +210,7 @@ class page
 
    $this->pageGenTime = round(microtime(), 3);
 

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

	
 
    echo '<!DOCTYPE ' . $this->doctype . '>'. PHP_EOL .
 
	  '<html ' . $this->htmlargs . '>'. PHP_EOL .
 
@@ -361,7 +382,8 @@ class page
 
   */
 
  public static function show_404($message = 'I couldn\'t find what you were looking for :-/.')
 
  {
 
    $page_404 = new Page('404: Content Not Found');
 
    $page_404 = page::page_create('404: Content Not Found');
 
    $page_404->head();
 

	
 
    echo "<h2>404: Content Not Found</h2>\n"
 
      . "<p>\n"
inc/class.schedule.php
Show inline comments
 
@@ -245,7 +245,8 @@ class Schedule
 
    else {
 
      $headcode = array('outputStyle',  'jQuery', 'jQueryUI', 'uiTabsKeyboard', 'displayTables');
 
    }
 
    $outputPage = new Page(htmlentities($this->getName()), $headcode);
 
    $outputPage = page::page_create(htmlentities($this->getName()), $headcode);
 
    $outputPage->head();
 

	
 

	
 

	
index.php
Show inline comments
 
@@ -18,8 +18,10 @@
 
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
  include_once 'inc/class.page.php'; 
 
  $welcomepage = new page('Welcome');
 
require_once 'inc/class.page.php'; 
 

	
 
$welcomepage = page::page_create('Welcome');
 
$welcomepage->head();
 
?>
 

	
 
<h3>Find the schedule that works for you!</h3>
input.php
Show inline comments
 
@@ -25,9 +25,7 @@ include_once 'inc/class.page.php';
 
require_once('inc/schedule_store.inc');
 

	
 
$scripts = array('jQuery', 'jQueryUI', 'jValidate','qTip','schedInput');
 
$inputPage = new page('Scheduler', $scripts, FALSE);
 

	
 

	
 
$inputPage = page::page_create('Scheduler', $scripts, FALSE);
 

	
 
$schedule_store = FALSE;
 
$sch = FALSE;
project.php
Show inline comments
 
@@ -19,7 +19,8 @@
 
 */
 

	
 
  include_once 'inc/class.page.php'; 
 
  $projectpage = new page('Project');
 
$projectpage = page::page_create('Project');
 
$projectpage->head();
 
?>
 

	
 
<h3>The SlatePermutate Project</h3>
0 comments (0 inline, 0 general)