OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-meta Date: 11-Mar-2006 17:33:00
Branch: HEAD Handle: 2006031116325900
Modified files:
openpkg-meta canvas-js.php canvas-layout.php canvas-nav-bar.php
canvas-nav-path.php canvas-nav-tab.php
canvas-nav-title.php canvas-style.php canvas.php
Log:
switch to global configuration array variables instead of a dozend
individual variables
Summary:
Revision Changes Path
1.4 +5 -5 openpkg-meta/canvas-js.php
1.14 +11 -11 openpkg-meta/canvas-layout.php
1.10 +3 -3 openpkg-meta/canvas-nav-bar.php
1.5 +2 -2 openpkg-meta/canvas-nav-path.php
1.8 +4 -4 openpkg-meta/canvas-nav-tab.php
1.4 +2 -2 openpkg-meta/canvas-nav-title.php
1.9 +2 -2 openpkg-meta/canvas-style.php
1.16 +54 -39 openpkg-meta/canvas.php
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-js.php
============================================================================
$ cvs diff -u -r1.3 -r1.4 canvas-js.php
--- openpkg-meta/canvas-js.php 9 Mar 2006 20:50:31 -0000 1.3
+++ openpkg-meta/canvas-js.php 11 Mar 2006 16:32:59 -0000 1.4
@@ -31,13 +31,13 @@
<!-- Yahoo! UI DOM -->
<!-- see http://developer.yahoo.net/yui/dom/index.html for more details. -->
-<script src="<?php echo $rooturl ?>canvas-js-dhtml/yui/YAHOO.js"
type="text/javascript"></script>
-<script src="<?php echo $rooturl ?>canvas-js-dhtml/yui/event.js"
type="text/javascript"></script>
-<script src="<?php echo $rooturl ?>canvas-js-dhtml/yui/dom.js"
type="text/javascript"></script>
+<script src="<?php echo $cfg["url.base"] ?>canvas-js-dhtml/yui/YAHOO.js"
type="text/javascript"></script>
+<script src="<?php echo $cfg["url.base"] ?>canvas-js-dhtml/yui/event.js"
type="text/javascript"></script>
+<script src="<?php echo $cfg["url.base"] ?>canvas-js-dhtml/yui/dom.js"
type="text/javascript"></script>
<!-- CSS-style DOM node selection -->
<!-- see http://dean.edwards.name/my/cssQuery/ for more details. -->
-<script src="<?php echo $rooturl ?>canvas-js-dhtml/cssquery/cssquery.js"
type="text/javascript"></script>
+<script src="<?php echo $cfg["url.base"]
?>canvas-js-dhtml/cssquery/cssquery.js" type="text/javascript"></script>
<!-- create own convenience JavaScript object -->
<script type="text/javascript">
@@ -71,6 +71,6 @@
<!-- see http://dean.edwards.name/IE7/ for more details. -->
<!--[if lt IE 7]>
<script type="text/javascript">IE7_PNG_SUFFIX = "-T.png";</script>
-<script src="<?php echo $rooturl ?>canvas-js-dhtml/ie7/ie7-standard-p.js"
type="text/javascript"></script>
+<script src="<?php echo $cfg["url.base"]
?>canvas-js-dhtml/ie7/ie7-standard-p.js" type="text/javascript"></script>
<![endif]-->
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-layout.php
============================================================================
$ cvs diff -u -r1.13 -r1.14 canvas-layout.php
--- openpkg-meta/canvas-layout.php 9 Mar 2006 21:10:32 -0000 1.13
+++ openpkg-meta/canvas-layout.php 11 Mar 2006 16:32:59 -0000 1.14
@@ -35,7 +35,7 @@
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: #000000;
- background-image: url('<?php echo $rooturl
?>canvas/canvas-crop-gradient.png');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-gradient.png');
background-position: left top;
background-repeat: repeat-x;
background-attachment: fixed;
@@ -46,7 +46,7 @@
DIV#canvas {
left: 0px;
right: 0px;
- <script language="php">if ($stretch == "margin") {</script>
+ <script language="php">if ($opt["stretch"] == "margin") {</script>
position: relative;
margin-left: auto;
margin-right: auto;
@@ -67,7 +67,7 @@
background-color: #ffffff;
background-repeat: no-repeat;
background-position: right top;
- background-image: url('<?php echo $rooturl
?>canvas/canvas-crop-background.jpg');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-background.jpg');
z-index: 1;
}
@@ -113,7 +113,7 @@
height: auto;
}
-<script language="php">if ($pane == "1") {</script>
+<script language="php">if ($opt["pane"] == "1") {</script>
H1 {
top: 220px;
@@ -135,7 +135,7 @@
height: 20px;
}
-<script language="php">} else if ($pane == "2") {</script>
+<script language="php">} else if ($opt["pane"] == "2") {</script>
H1 {
top: 190px;
@@ -193,8 +193,8 @@
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<link rel="ICON" href="<?php echo $rooturl ?>canvas/canvas-favicon.ico"/>
-<link rel="SHORTCUT ICON" href="<?php echo $rooturl
?>canvas/canvas-favicon.ico"/>
+<link rel="ICON" href="<?php echo $cfg["url.base"]
?>canvas/canvas-favicon.ico"/>
+<link rel="SHORTCUT ICON" href="<?php echo $cfg["url.base"]
?>canvas/canvas-favicon.ico"/>
<!-- CANVAS: HEAD -->
<script language="php">
@@ -203,10 +203,10 @@
<div id="canvas">
<div id="canvas_head">
- <img src="<?php echo $rooturl
?>canvas/canvas-crop-head-regular-T.png" width="800" height="110" alt=""/>
+ <img src="<?php echo $cfg["url.base"]
?>canvas/canvas-crop-head-regular-T.png" width="800" height="110" alt=""/>
</div>
<div id="canvas_logo">
- <img src="<?php echo $rooturl ?>canvas/canvas-crop-logo-T.png"
width="310" height="210" alt="OpenPKG"/>
+ <img src="<?php echo $cfg["url.base"]
?>canvas/canvas-crop-logo-T.png" width="310" height="210" alt="OpenPKG"/>
</div>
<div id="canvas_tabs">
<script language="php">echo undivert("canvas-tabs");</script>
@@ -225,8 +225,8 @@
<script language="php">echo undivert("canvas-foot");</script>
<div class="canvas_foot_left">
Quick Links:
- <a href="<?php echo $rooturl ?>imprint">Imprint</a> <span
class="sep">|</span>
- <a href="<?php echo $rooturl ?>search">Search</a>
+ <a href="<?php echo $cfg["url.base"] ?>imprint">Imprint</a>
<span class="sep">|</span>
+ <a href="<?php echo $cfg["url.base"] ?>search">Search</a>
</div>
<div class="canvas_foot_right">
Validate:
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-nav-bar.php
============================================================================
$ cvs diff -u -r1.9 -r1.10 canvas-nav-bar.php
--- openpkg-meta/canvas-nav-bar.php 11 Mar 2006 13:08:17 -0000 1.9
+++ openpkg-meta/canvas-nav-bar.php 11 Mar 2006 16:32:59 -0000 1.10
@@ -81,14 +81,14 @@
if (preg_match("/<li id=\"(.+?)\">/", $html[$i], $match)) {
$prefix = preg_replace("/\.?[^.]+$/", "", $match[1]);
$style = "display: none;";
- if (preg_match("/^$prefix/", $path)) {
+ if (preg_match("/^$prefix/", $opt["path"])) {
$style = "display: block;";
}
$html[$i] = preg_replace("/(<li id=\")(.+?\")(>)/", "$1navbar.$2
style=\"$style\"$3", $html[$i]);
}
}
$html = implode("\n", $html);
- $html = preg_replace("/(<li id=\"navbar.$path\")/s", "$1
class=\"active\"", $html);
+ $html = preg_replace("/(<li id=\"navbar.".$opt["path"]."\")/s", "$1
class=\"active\"", $html);
divert("canvas-nav");
echo "<div class=\"navbar\" id=\"navbar\">\n";
echo $html;
@@ -121,7 +121,7 @@
/* dynamic navigation bar item expading/collapsing */
-var navbar_default = "<script language="php">echo "navbar.".$path</script>";
+var navbar_default = "<script language="php">echo
"navbar.".$opt["path"]</script>";
var navbar_active = navbar_default;
function navbar_over (e) {
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-nav-path.php
============================================================================
$ cvs diff -u -r1.4 -r1.5 canvas-nav-path.php
--- openpkg-meta/canvas-nav-path.php 20 Feb 2006 08:34:35 -0000 1.4
+++ openpkg-meta/canvas-nav-path.php 11 Mar 2006 16:32:59 -0000 1.5
@@ -44,13 +44,13 @@
for ($i = 0; $i < $count; $i++) {
if (preg_match("/<li id=\"(.+?)\">(<a[^>]+>.+?<\/a>)/", $html[$i],
$match)) {
$prefix = $match[1];
- if (preg_match("/^$prefix/", $path)) {
+ if (preg_match("/^$prefix/", $opt["path"])) {
array_push($list, "<span
id=\"navpath.$prefix\">$match[2]</span>");
}
}
}
$html = implode(" → ", $list);
- $html = preg_replace("/(<span id=\"navpath.$path\")/s", "$1
class=\"active\"", $html);
+ $html = preg_replace("/(<span id=\"navpath.".$opt["path"]."\")/s", "$1
class=\"active\"", $html);
divert("canvas-nav");
echo "<span class=\"navpath\" id=\"navpath\">\n";
echo $html;
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-nav-tab.php
============================================================================
$ cvs diff -u -r1.7 -r1.8 canvas-nav-tab.php
--- openpkg-meta/canvas-nav-tab.php 9 Mar 2006 20:59:05 -0000 1.7
+++ openpkg-meta/canvas-nav-tab.php 11 Mar 2006 16:32:59 -0000 1.8
@@ -48,7 +48,7 @@
background-attachment: scroll;
background-repeat: no-repeat; /* FIXME: doesn't work for Konqueror */
background-position: left top;
- background-image: url('canvas/canvas-crop-glass-light-T.png');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-glass-light-T.png');
color: #333333;
}
ul.navtab li.active {
@@ -56,7 +56,7 @@
border-left: 1px solid #f0f0f0;
border-right: 1px solid #333333;
background-position: 0px 0px; /* dynamically adjusted! (see below) */
- background-image: url('canvas/canvas-crop-background.jpg');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-background.jpg');
background-color: #ffffff;
color: #000000;
}
@@ -65,7 +65,7 @@
border-left: 1px solid #807060;
border-right: 1px solid #504030;
background-position: left top;
- background-image: url('canvas/canvas-crop-glass-dark-T.png');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-glass-dark-T.png');
color: #f0f0f0;
}
ul.navtab li a {
@@ -118,7 +118,7 @@
$class["project"] = "inactive";
$class["corporation"] = "inactive";
$class["foundation"] = "inactive";
- $class[$this["site"]] = "active";
+ $class[$opt["path.site"]] = "active";
</script>
<ul class="navtab">
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-nav-title.php
============================================================================
$ cvs diff -u -r1.3 -r1.4 canvas-nav-title.php
--- openpkg-meta/canvas-nav-title.php 9 Mar 2006 19:12:10 -0000 1.3
+++ openpkg-meta/canvas-nav-title.php 11 Mar 2006 16:32:59 -0000 1.4
@@ -34,7 +34,7 @@
for ($i = 0; $i < $count; $i++) {
if (preg_match("/<li id=\"(.+?)\"><a[^>]+>(.+?)<\/a>/", $html[$i],
$match)) {
$prefix = $match[1];
- if (preg_match("/^$prefix/", $path)) {
+ if (preg_match("/^$prefix/", $opt["path"])) {
array_push($list, $match[2]);
}
}
@@ -47,7 +47,7 @@
# render as content title
divert("canvas-title");
- echo "<img
src=\"".$rooturl."canvas/canvas-crop-title-".$this["site"]."-T.png\"";
+ echo "<img
src=\"".$cfg["url.base"]."canvas/canvas-crop-title-".$opt["path.site"]."-T.png\"";
echo " width=\"500\" height=\"50\" alt=\"".$list[0]."\"/>";
</script>
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas-style.php
============================================================================
$ cvs diff -u -r1.8 -r1.9 canvas-style.php
--- openpkg-meta/canvas-style.php 9 Mar 2006 21:30:45 -0000 1.8
+++ openpkg-meta/canvas-style.php 11 Mar 2006 16:32:59 -0000 1.9
@@ -68,7 +68,7 @@
/* lists */
UL {
list-style-type: square;
- list-style-image: url('<?php echo $rooturl
?>canvas/canvas-box.png');
+ list-style-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-box.png');
margin-left: 0px;
padding-left: 32px;
margin-top: 4px;
@@ -151,6 +151,6 @@
padding: 10px;
background-attachment: scroll;
background-position: left top;
- background-image: url('<?php echo $rooturl
?>canvas/canvas-crop-glass-dark-T.png');
+ background-image: url('<?php echo $cfg["url.base"]
?>canvas/canvas-crop-glass-dark-T.png');
}
@@ .
patch -p0 <<'@@ .'
Index: openpkg-meta/canvas.php
============================================================================
$ cvs diff -u -r1.15 -r1.16 canvas.php
--- openpkg-meta/canvas.php 10 Mar 2006 21:56:32 -0000 1.15
+++ openpkg-meta/canvas.php 11 Mar 2006 16:32:59 -0000 1.16
@@ -38,52 +38,66 @@
## | # root URL type
## ("root=" . ("absolute"|"relative"))
-# determine input parameters
-$type = isset($_GET["type"]) ? $_GET["type"] : "html";
-$embed = isset($_GET["embed"]) ? $_GET["embed"] : "";
-$path = isset($_GET["path"]) ? $_GET["path"] : "project";
-$pane = isset($_GET["pane"]) ? $_GET["pane"] : "2";
-$stretch = isset($_GET["stretch"]) ? $_GET["stretch"] : "margin";
-$root = isset($_GET["root"]) ? $_GET["root"] : "relative";
+# create global variables
+$hdr = array(); # request header
+$opt = array(); # request options
+$cfg = array(); # configuration
+
+# determine HTTP request headers
+if (isset($_SERVER["SERVER_VERSION"]))
+ $hdr = apache_request_headers();
+
+# determine URL input parameters
+$opt["type"] = isset($_GET["type"]) ? $_GET["type"] : "html";
+$opt["embed"] = isset($_GET["embed"]) ? $_GET["embed"] : "";
+$opt["path"] = isset($_GET["path"]) ? $_GET["path"] : "project";
+$opt["pane"] = isset($_GET["pane"]) ? $_GET["pane"] : "2";
+$opt["stretch"] = isset($_GET["stretch"]) ? $_GET["stretch"] : "margin";
+$opt["root"] = isset($_GET["root"]) ? $_GET["root"] : "relative";
# parse path into parts
-$x = explode(".", $path);
-$this = array();
-$this["site"] = $x[0];
-$this["area"] = $x[1];
-$this["page"] = $x[2];
-$this["part"] = $x[3];
+$x = explode(".", $opt["path"]);
+$opt["path.site"] = $x[0];
+$opt["path.area"] = $x[1];
+$opt["path.page"] = $x[2];
+$opt["path.part"] = $x[3];
+unset($x);
# parse embedding specification
-$x = explode(",", $embed);
-$embed = Array("css" => 0, "js" => 0);
+$x = explode(",", $opt["embed"]);
+$opt["embed.css"] = 0;
+$opt["embed.js"] = 0;
foreach ($x as $name) {
- $embed[$name] = 1;
+ $opt["embed.$name"] = 1;
}
+unset($x);
-# determine root URL
-if ($root == "absolute") {
+# determine base URL
+if ($opt["root"] == "absolute") {
# advantage: faster
# disadvantage: IE fails to load javascript, HTTPS complains
- $rooturl = "http://meta.openpkg.org/";
+ $cfg["url.base"] = "http://meta.openpkg.org/";
}
-else {
+else if ($opt["root"] == "relative") {
# advantage: IE loads javascript, HTTPS seamless integration
# disadvantage: slower
- $rooturl = "/openpkg-meta/";
+ $cfg["url.base"] = "/openpkg-meta/";
+}
+else {
+ # default (doesn't really work)
+ $cfg["url.base"] = "";
}
-# determine last-modification
+# determine last-modification and
+# short circuit processing if HTTP If-Modified-Since applies
$gmtime = gmdate("D, d M Y H:i:s", filemtime($_SERVER["SCRIPT_FILENAME"])) .
" UTC";
-$headers = isset($_SERVER["SERVER_VERSION"]) ? apache_request_headers() :
array();
-$if_modified_since = preg_replace('/;.*$/', '',
$headers["If-Modified-Since"]);
-if ($if_modified_since) {
- if ($if_modified_since == $gmtime) {
- header("HTTP/1.1 304 Not Modified");
- exit(0);
- }
-}
header("Last-Modified: $gmtime");
+$if_modified_since = preg_replace('/;.*$/', '', $hdr["If-Modified-Since"]);
+if ($if_modified_since == $gmtime) {
+ header("HTTP/1.1 304 Not Modified");
+ exit(0);
+}
+unset($gmtime, $if_modified_since);
# determine content-type and expiry time
$spec = array(
@@ -91,8 +105,9 @@
"css" => array(type => "text/css", maxage => 0),
"js" => array(type => "text/javascript", maxage => 0),
);
-header(sprintf("Content-type: %s", $spec[$type]["type"]));
-header(sprintf("Cache-Control: max-age=%d, must-revalidate",
$spec[$type]["maxage"]));
+header(sprintf("Content-type: %s", $spec[$opt["type"]]["type"]));
+header(sprintf("Cache-Control: max-age=%d, must-revalidate",
$spec[$opt["type"]]["maxage"]));
+unset($spec);
# diversion support
$diversion_name = "";
@@ -136,9 +151,9 @@
include("canvas-nav.php");
include("canvas-nav-title.php");
include("canvas-nav-tab.php");
-if ($pane == "1")
+if ($opt["pane"] == "1")
include("canvas-nav-path.php");
-else if ($pane == "2")
+else if ($opt["pane"] == "2")
include("canvas-nav-bar.php");
include("canvas-style.php");
include("canvas-js.php");
@@ -160,7 +175,7 @@
echo undivert("html-head");
# Cascading Style Sheet (CSS)
- if ($embed["css"]) {
+ if ($opt["embed"]["css"]) {
# internally embedded
echo "<style type=\"text/css\">\n";
echo undivert("css");
@@ -170,11 +185,11 @@
# externally linked
# (path intentionally left out for caching because
functionally unimportant)
echo "<link rel=\"stylesheet\" type=\"text/css\"";
- echo "
href=\"$rooturl?type=css&pane=$pane&stretch=$stretch\"/>\n";
+ echo "
href=\"".$cfg["url.base"]."?type=css&pane=".$opt["pane"]."&stretch=".$opt["stretch"]."\"/>\n";
}
# JavaScript (JS)
- if ($embed["js"]) {
+ if ($opt["embed"]["js"]) {
# internally embedded
echo "<script language=\"javascript\"
type=\"text/javascript\">\n";
echo undivert("js");
@@ -184,7 +199,7 @@
# externally linked
# (path intentionally included because functionally
important)
echo "<script type=\"text/javascript\"";
- echo "
src=\"$rooturl?type=js&pane=$pane&path=$path\"></script>\n";
+ echo "
src=\"".$cfg["url.base"]."?type=js&pane=".$opt["pane"]."&path=".$opt["path"]."\"></script>\n";
}
</script>
</head>
@@ -195,7 +210,7 @@
<script language="php">
# generate content
divert_end();
- $content = undivert($type);
+ $content = undivert($opt["type"]);
header(sprintf("Content-Length: %d", strlen($content)));
print $content;
</script>
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]