Adding pages forgot to add last commit, a=chris

Chris Pollett [2012-03-17 20:Mar:th]
Adding pages forgot to add last commit, a=chris
Filename
controllers/static_controller.php
locale/en-US/pages/blog.thtml
locale/en-US/pages/privacy.thtml
locale/tr/bot.thtml
views/static_view.php
diff --git a/controllers/static_controller.php b/controllers/static_controller.php
new file mode 100644
index 000000000..dcf5d1fb5
--- /dev/null
+++ b/controllers/static_controller.php
@@ -0,0 +1,122 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2012  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage controller
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2012
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/**Load base controller class, if needed. */
+require_once BASE_DIR."/controllers/controller.php";
+
+/**
+ * This controller is  used by the Yioop web site to display static pages.
+ *
+ * @author Chris Pollett
+ * @package seek_quarry
+ * @subpackage controller
+ */
+class StaticController extends Controller
+{
+    /**
+     * Says which models to load for this controller.
+     * @var array
+     */
+    var $models = array();
+    /**
+     * Says which views to load for this controller.
+     * @var array
+     */
+    var $views = array("static");
+    /**
+     * Says which activities (roughly methods invoke from the web)
+     * this controller will respond to
+     * @var array
+     */
+    var $activities = array("show_page");
+
+    /**
+     *  This is the main entry point for handling people arriving to the
+     * SeekQuarry site.
+     */
+    function processRequest()
+    {
+        $data = array();
+        $view = "static";
+        if(isset($_SESSION['USER_ID'])) {
+            $user = $_SESSION['USER_ID'];
+        } else {
+            $user = $_SERVER['REMOTE_ADDR'];
+        }
+        if(isset($_REQUEST['a'])) {
+            if(in_array($_REQUEST['a'], $this->activities)) {
+                $activity = $_REQUEST['a'];
+            } else {
+                $activity = "show_page";
+            }
+        } else {
+            $activity = "show_page";
+        }
+        $data['VIEW'] = $view;
+        $data = array_merge($data, $this->$activity());
+
+        $data['YIOOP_TOKEN'] = $this->generateCSRFToken($user);
+
+        $this->displayView($view, $data);
+    }
+
+
+    /**
+     * This activity is used to display one of a set of static pages used
+     * by the Yioop Web Site
+     *
+     * @return array $data has which static page to display
+     */
+    function show_page()
+    {
+        $data = array();
+        if(isset($_REQUEST['p']) &&
+            in_array($_REQUEST['p'], $this->staticView->pages)) {
+            $data['page'] = $_REQUEST['p'];
+        } else {
+            $data['page'] = "about";
+        }
+        if((isset($this->staticView->head_objects[$data['page']]['title']))) {
+            $data["subtitle"]=" - ".
+            $this->staticView->head_objects[$data['page']]['title'];
+            $this->staticView->head_objects[$data['page']]['title'] = "Yioop!".
+                $data["subtitle"];
+        } else {
+            $data["subtitle"] = "";
+        }
+        return $data;
+    }
+}
+?>
diff --git a/locale/en-US/pages/blog.thtml b/locale/en-US/pages/blog.thtml
new file mode 100755
index 000000000..ff76cc556
--- /dev/null
+++ b/locale/en-US/pages/blog.thtml
@@ -0,0 +1,5 @@
+title=Blog
+description=Describes what crawls this search site has performed and what occurred during those crawls
+END_HEAD_VARS
+<h2>Crawl Notes</h2>
+<p>This was an especially interesting crawl...</p>
diff --git a/locale/en-US/pages/privacy.thtml b/locale/en-US/pages/privacy.thtml
new file mode 100755
index 000000000..8e66739a0
--- /dev/null
+++ b/locale/en-US/pages/privacy.thtml
@@ -0,0 +1,4 @@
+title=Privacy Policy
+description=Describes what information this site collects and retains about users and how it uses that information
+END_HEAD_VARS
+<h2>We are concerned with your privacy</h2>
diff --git a/locale/tr/bot.thtml b/locale/tr/bot.thtml
new file mode 100755
index 000000000..e69de29bb
diff --git a/views/static_view.php b/views/static_view.php
new file mode 100644
index 000000000..a13c6d084
--- /dev/null
+++ b/views/static_view.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2012  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage view
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2012
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/**
+ * This View is responsible for drawing the landing page
+ * of the Seek Quarry app
+ *
+ * @author Chris Pollett
+ * @package seek_quarry
+ * @subpackage view
+ */
+
+class StaticView extends View
+{
+
+    /** This view is makes use of the localized static page overview.thtml
+     *  @var array
+     */
+    var $pages = array('privacy', 'blog');
+
+    /** This view is drawn on a web layout
+     *  @var string
+     */
+    var $layout = "web";
+
+    /**
+     *  Draws the login web page.
+     *
+     *  @param array $data  contains the anti CSRF token YIOOP_TOKEN
+     *  the view
+     */
+    function renderView($data) {
+?>
+<div class="center">
+<h1 class="logo"><a href="."><img src="resources/yioop.png"
+    alt="<?php e(tl('static_view_title')); ?>" /></a><span><?php
+    e($data['subtitle']);?></span></h1>
+</div>
+<div class="content">
+<?php e($this->page_objects[$data['page']]); ?>
+</div>
+<div class="landing-footer">
+    <div>- <a href="?c=static&p=blog"><?php e(tl('static_view_blog')); ?></a> -
+        <a href="?c=static&p=privacy"><?php e(tl('static_view_privacy'));
+        ?></a> - <a href="http://www.seekquarry.com/"><?php
+    e(tl('static_view_developed_seek_quarry')); ?></a> -</div>
+</div>
+<?php
+    }
+}
+?>
ViewGit