From dd1d7c84f59acb3fa489e35bca6cdee622c492e7 Mon Sep 17 00:00:00 2001
From: Brett Bieber <brett.bieber@gmail.com>
Date: Fri, 15 May 2009 14:43:15 +0000
Subject: [PATCH] Add initial work on the mobile proxy.

---
 .buildpath |  5 +++++
 .project   | 22 ++++++++++++++++++++++
 README     | 15 +++++++++++++++
 index.php  | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+)
 create mode 100644 .buildpath
 create mode 100644 .project
 create mode 100644 README
 create mode 100644 index.php

diff --git a/.buildpath b/.buildpath
new file mode 100644
index 0000000..8bcb4b5
--- /dev/null
+++ b/.buildpath
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+	<buildpathentry kind="src" path=""/>
+	<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>
diff --git a/.project b/.project
new file mode 100644
index 0000000..bca3cb2
--- /dev/null
+++ b/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>wdnmobile</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.dltk.core.scriptbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.php.core.PHPNature</nature>
+	</natures>
+</projectDescription>
diff --git a/README b/README
new file mode 100644
index 0000000..8a4c5fe
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+Basic idea:
+This service is a mobile proxy for UNL template pages.
+
+The proxy grabs the page, pulls out the maincontentarea and navigation and
+displays it in a popup template. The navigation UL is placed at the bottom of
+the page below the content.
+
+TODO:
+There's a cleaner way to scan the pages, I just can't find the api for it now.
+Capture link clicks so links to other UNL pages are run through the proxy.
+Rewrite images so they're absolute.
+Resize images that are too big?
+Add link to view the html version of the page ala Google mobile version.
+Get the m.unl.edu domain and put it up.
+Detect mobile screen size and adjust css accordingly?
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..7f3c8e7
--- /dev/null
+++ b/index.php
@@ -0,0 +1,36 @@
+<?php
+require_once 'Validate.php';
+require_once 'UNL/Templates.php';
+require_once 'UNL/DWT/Generator.php';
+$p = UNL_Templates::factory('Popup');
+$options = array('allowed_schemes' => array('http'));
+if (isset($_GET['u']) && Validate::uri($_GET['u'], $options)) {
+    $f = file_get_contents($_GET['u']);
+    $dwt = new UNL_DWT_Generator();
+    $dwt->scanRegions($f);
+    foreach ($dwt->_regions[''] as $region) {
+        $p->{$region->name} = $region->value;
+    }
+} else {
+    $p->maincontentarea = '<h2>Enter a UNL template based page to try out a different template</h2>';
+}
+
+$p->addStyleDeclaration('
+body * {max-width:300px !important;}
+#maincontent .right, #maincontent .left{float:none;}
+#maincontent .col {width:auto !important;}
+#maincontent .two_col {width:auto !important;}
+#maincontent {font-size:150%;line-height:120%;
+}
+input {font-size:1em;}
+');
+
+$p->head .= '<meta name="viewport" content="width = 320" />';
+$p->maincontentarea .= '<h2>Navigation</h2>'.$p->navlinks;
+
+$p->maincontentarea .= '<form style="clear:both" action="?" method="GET">
+    URL:<input type="text" name="u" size="15" />
+    <input type="submit" name="s" value="submit" />
+</form>';
+
+echo $p->toHtml();
\ No newline at end of file
-- 
GitLab