Merge branch 'dev' into live
authorDylan Lloyd <dylan@psu.edu>
Sat, 26 Mar 2011 20:04:38 +0000 (16:04 -0400)
committerDylan Lloyd <dylan@psu.edu>
Sat, 26 Mar 2011 20:04:38 +0000 (16:04 -0400)
1  2 
index.php

diff --combined index.php
+++ b/index.php
@@@ -6,6 -6,7 +6,7 @@@ abstract class cms 
    protected $db;
    protected $recaptcha_publickey;
    protected $recaptcha_privatekey;
+   protected  $scripts;
    public $title;
    public $home_link;
  
  
    public function display_head($title = "dylansserver",
                                    $home_link = "/") {
-     $scripts = "";
+     $scripts = $this->scripts;
      $stylesheets = "<link href='/includes/style.css' rel='stylesheet' type='text/css'>";
-     if (cms::determine_type() == "index") {
-       $scripts = "<script type='text/javascript' src='/includes/all.js'></script>"; 
-       $home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylansserver.com&amp;ucn_task=conformance#";
-     } else if ($this->determine_type() == 'note') {
-       $scripts = "<script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>";
-       $scripts .= "<script type='text/javascript' src='/includes/jquery-core.js'></script>";
-       $scripts .= "<script type='text/javascript' src='/includes/jquery-all-components.js'></script>";
-       $scripts .= "<script type='text/javascript' src='/includes/ajax.js'></script>";
-     }
+     $home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylansserver.com&amp;ucn_task=conformance#";
      echo <<<END_OF_HEAD
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
@@@ -140,6 -133,7 +133,7 @@@ END_OF_CLOSE
  class index extends cms {
  
    public function display() {
+     $this->scripts = "<script type='text/javascript' src='/includes/index.js'></script>"; 
      $this->display_head();
      $this->display_exhibits();
      echo "<ul id='portfolio' style='text-align:right'>";
@@@ -283,7 -277,7 +277,7 @@@ class page extends cms 
        $datetime_posted = explode(' ', $date_posted[2]);
        $day_posted = $datetime_posted[0];
        echo "<div class='note'>";
 -      echo "<h2><span style='color:grey;'>$year_posted/$month_posted/$day_posted/</span><a href='$url'>$title</a></h2>";
 +      echo "<h1><span class='date'>$year_posted/$month_posted/$day_posted/</span><a href='$url'>$title</a></h1>";
        echo $entry['text'];
        echo "</div>";
      }
  
    private function write_navigation() {
      echo "<div id='navigation'>";
 -    echo "<h2>";
 +    echo "<h1>";
      if($this->page > 1){
        $previous_page = $this->page - 1;
        echo "<a href='/notes/page/$previous_page'>prev</a>";
      $forward_page = $this->page + 1;
      echo " <a href='/notes/page/$forward_page'>next</a>";
      }
 -    echo "</h2>";
 +    echo "</h1>";
      echo "</div>";
    }
  
@@@ -324,6 -318,11 +318,11 @@@ class note extends cms 
    public $number_of_comments;
  
    public function __construct() {
+     if (isset($_GET['comments'])) {
+       $this->scripts = "
+         <script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>
+         <script type='text/javascript' src='/includes/comment.js'></script>";
+     }
      parent::__construct();
      if (isset($_GET['comments'])) {
        $this->comments_enabled = true;
    private function display_note() {
      echo <<<END_OF_NOTE
      <div id='note'>
 -    <h2><span style='color:grey;'>$this->year_posted/$this->month_posted/$this->day_posted/</span>$this->title</h2>
 +    <h1><span class='date'>$this->year_posted/$this->month_posted/$this->day_posted/</span>$this->title</h1>
      $this->text
      </div>
  END_OF_NOTE;
      echo <<<END_OF_NAVIGATION
      <br>
      <div id='navigation'>
 -    <h2>
 +    <h1>
  END_OF_NAVIGATION;
      if (!$this->comments_enabled) {
        $this->display_comment_link();
      }
      echo <<<END_OF_NAVIGATION
      <a href="/notes/">back to notes</a>/
 -    </h2>
 +    </h1>
      </div>
  END_OF_NAVIGATION;
    }
@@@ -589,9 -588,9 +588,9 @@@ class archive extends cms 
          $datetime_posted = explode(' ', $date_posted[2]);
          $day_posted = $datetime_posted[0];
          echo "<div class='note'>";
 -        echo "<h2><span style='color:grey;'>";
 +        echo "<h1><span class='date'>";
          echo "$year_posted/$month_posted/$day_posted/";
 -        echo "</span><a href='$url'>$title</a></h2>";
 +        echo "</span><a href='$url'>$title</a></h1>";
          echo $entry['text'];
          echo "</div>";
        }
        $this->write_navigation();
      } else {
        echo "<br>";
 -      echo "<h2 style='font-family:sans-serif;'>sorry, nothing here</h2>";
 +      echo "<h1>sorry, nothing here</h2>";
        echo "<pre>Empty set (0.00 sec)</pre>";
      }
      $this->display_close();
    private function write_navigation() {
      echo "<br>";
      echo "<div id='navigation'>";
 -    echo "<h2>";
      // fill me in!
 -    echo "</h2>";
      echo "</div>";
    }