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:   14-Mar-2006 18:00:43
  Branch: HEAD                             Handle: 2006031417004001

  Added files:
    openpkg-meta            global-download.php global-index.php
  Modified files:
    openpkg-meta            canvas-foot.php canvas-layout.php
                            canvas-nav-bar.php canvas-nav.php global-about.php
                            global-imprint.php global-search.php
                            global-sitemap.php meta.php sample.php

  Log:
    many cleanups and more documentation

  Summary:
    Revision    Changes     Path
    1.5         +7  -1      openpkg-meta/canvas-foot.php
    1.20        +19 -5      openpkg-meta/canvas-layout.php
    1.17        +5  -7      openpkg-meta/canvas-nav-bar.php
    1.15        +9  -8      openpkg-meta/canvas-nav.php
    1.2         +1  -1      openpkg-meta/global-about.php
    1.1         +25 -0      openpkg-meta/global-download.php
    1.2         +16 -21     openpkg-meta/global-imprint.php
    1.1         +26 -0      openpkg-meta/global-index.php
    1.3         +1  -1      openpkg-meta/global-search.php
    1.3         +8  -10     openpkg-meta/global-sitemap.php
    1.5         +45 -23     openpkg-meta/meta.php
    1.3         +16 -14     openpkg-meta/sample.php
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-foot.php
  ============================================================================
  $ cvs diff -u -r1.4 -r1.5 canvas-foot.php
  --- openpkg-meta/canvas-foot.php      13 Mar 2006 22:26:39 -0000      1.4
  +++ openpkg-meta/canvas-foot.php      14 Mar 2006 17:00:40 -0000      1.5
  @@ -58,7 +58,7 @@
   </script>
   
   <div class="canvas_foot_left">
  -    Meta:
  +    <a href="http://meta.openpkg.org/global-index.php";>Meta</a><span 
class="sep">:</span>
       <a href="http://meta.openpkg.org/global-about.php";>About</a> <span 
class="sep">|</span>
       <a href="http://meta.openpkg.org/global-imprint.php";>Imprint</a> <span 
class="sep">|</span>
       <a href="http://meta.openpkg.org/global-sitemap.php";>Sitemap</a> <span 
class="sep">|</span>
  @@ -70,3 +70,9 @@
       <a href="http://jigsaw.w3.org/css-validator/check/referer";>CSS</a>
   </div>
   
  +<script language="php">
  +    divert("canvas-footbox");
  +</script>
  +
  +<!-- TODO -->
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-layout.php
  ============================================================================
  $ cvs diff -u -r1.19 -r1.20 canvas-layout.php
  --- openpkg-meta/canvas-layout.php    13 Mar 2006 20:26:32 -0000      1.19
  +++ openpkg-meta/canvas-layout.php    14 Mar 2006 17:00:40 -0000      1.20
  @@ -57,7 +57,7 @@
       margin-right:          40px;
       width:                 auto;
       <script language="php">}</script>
  -    min-height:            900px;
  +    min-height:            800px;
       margin-bottom:         20px;
       top:                   20px;
       border-top:            1px solid #a09080;
  @@ -129,7 +129,7 @@
       margin-top:            250px;
       margin-left:           60px;
       margin-right:          60px;
  -    margin-bottom:         80px;
  +    margin-bottom:         60px;
       z-index:               1;
   }
   
  @@ -161,15 +161,15 @@
       margin-top:            230px;
       margin-left:           60px;
       margin-right:          300px;
  -    margin-bottom:         80px;
  +    margin-bottom:         60px;
       z-index:               1;
   }
   
   div#canvas_nav {
       position:              absolute;
  -    right:                 40px;
  +    right:                 60px;
       top:                   230px;
  -    width:                 180px;
  +    width:                 160px;
   }
   
   <script language="php">}</script>
  @@ -183,6 +183,17 @@
       z-index:               10;
   }
   
  +div#canvas_footbox {
  +    position:              absolute;
  +    right:                 60px;
  +    bottom:                60px;
  +    width:                 120px;
  +    height:                240px;
  +    z-index:               10;
  +    vertical-align:        bottom;
  +    text-align:            right;
  +}
  +
   <script language="php">
       divert("html-head");
   </script>
  @@ -224,6 +235,9 @@
       <div id="canvas_nav">
           <script language="php">echo undivert("canvas-nav");</script>
       </div>
  +    <div id="canvas_footbox">
  +        <script language="php">echo undivert("canvas-footbox");</script>
  +    </div>
       <div id="canvas_foot">
           <script language="php">echo undivert("canvas-foot");</script>
       </div>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-nav-bar.php
  ============================================================================
  $ cvs diff -u -r1.16 -r1.17 canvas-nav-bar.php
  --- openpkg-meta/canvas-nav-bar.php   13 Mar 2006 18:06:15 -0000      1.16
  +++ openpkg-meta/canvas-nav-bar.php   14 Mar 2006 17:00:40 -0000      1.17
  @@ -37,20 +37,17 @@
   div.navbar ul {
       padding:                 0px 0px 0px 0px;
       margin:                  0px 0px 0px 0px;
  -    white-space:             nowrap;
   }
   div.navbar li {
       list-style:              none;
       padding:                 0px 0px 0px 0px;
       margin:                  0px 0px 0px 0px;
  -    white-space:             nowrap;
   }
   div.navbar a {
       display:                 block;
  -    width:                   180px;
  +    width:                   160px;
       padding:                 1px 0px 1px 0px;
       margin:                  0px 0px 0px 0px;
  -    white-space:             nowrap;
       text-decoration:         none;
       font-weight:             normal;
       color:                   #000000;
  @@ -62,15 +59,15 @@
       background-image:        url('<?php echo $cfg["url.base"] 
?>canvas/canvas-crop-glass-dark-T.png');
   }
   div.navbar ul ul li a {
  -    width:                   170px;
  +    width:                   150px;
       padding:                 1px 0px 1px 10px;
   }
   div.navbar ul ul ul li a {
  -    width:                   160px;
  +    width:                   140px;
       padding:                 1px 0px 1px 20px;
   }
   div.navbar ul ul ul ul li a {
  -    width:                   150px;
  +    width:                   130px;
       padding:                 1px 0px 1px 30px;
   }
   div.navbar > ul {
  @@ -119,6 +116,7 @@
     echo "<div class=\"navbar\" id=\"navbar\">\n";
     echo $html;
     echo "</div>\n";
  +  echo "<!-- CANVAS: SIDE -->\n";
   </script>
   
   <script language="php">
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-nav.php
  ============================================================================
  $ cvs diff -u -r1.14 -r1.15 canvas-nav.php
  --- openpkg-meta/canvas-nav.php       13 Mar 2006 22:31:21 -0000      1.14
  +++ openpkg-meta/canvas-nav.php       14 Mar 2006 17:00:40 -0000      1.15
  @@ -102,14 +102,6 @@
             <li id="faq"><a href="faq">F.A.Q.</a></li>
           </ul>
         </li>
  -      <li id="meta"><a href="http://meta.openpkg.org/global-index";>Meta</a>
  -        <ul>
  -          <li id="about"><a href="global-about">About Websites</a></li>
  -          <li id="imprint"><a href="global-faq">Websites Imprint</a></li>
  -          <li id="sitemap"><a href="global-sitemap">Websites SiteMap</a></li>
  -          <li id="search"><a href="global-search">Websites Search</a></li>
  -        </ul>
  -      </li>
       </ul>
     </li>
     <li id="corporation"><a href="http://www.openpkg.com/";>OpenPKG 
Corporation</a>
  @@ -186,6 +178,15 @@
         </li>
       </ul>
     </li>
  +  <li id="meta"><a href="http://meta.openpkg.org/global-index.php";>OpenPKG 
Meta</a>
  +    <ul>
  +      <li id="about"><a href="global-about.php">About Websites</a></li>
  +      <li id="imprint"><a href="global-imprint.php">Websites Imprint</a></li>
  +      <li id="sitemap"><a href="global-sitemap.php">Websites SiteMap</a></li>
  +      <li id="search"><a href="global-search.php">Websites Search</a></li>
  +      <li id="template"><a href="global-template.php">Websites 
Template</a></li>
  +    </ul>
  +  </li>
   </ul>
   
   <script language="php">
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-about.php
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 global-about.php
  --- openpkg-meta/global-about.php     13 Mar 2006 21:09:47 -0000      1.1
  +++ openpkg-meta/global-about.php     14 Mar 2006 17:00:41 -0000      1.2
  @@ -1,6 +1,6 @@
   <script language="php">
     include("meta.php");
  -  meta_start("path=project.meta.about&pane=2");
  +  meta_start("path=meta.about&pane=2");
   </script>
   
   <h1>Meta: About Websites</h1>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-download.php
  ============================================================================
  $ cvs diff -u -r0 -r1.1 global-download.php
  --- /dev/null 2006-03-14 18:00:41 +0100
  +++ global-download.php       2006-03-14 18:00:42 +0100
  @@ -0,0 +1,25 @@
  +<?php
  +
  +$type = array(
  +    "php" => "text/plain",
  +    "cfg" => "text/plain",
  +    "*"   => "application/octet-stream",
  +);
  +
  +$file = $_GET["file"];
  +if (!preg_match('/^[^\/\s]+$/s', $file))
  +    die("invalid file name: " . $file);
  +if (!is_file($file))//
  +    die("invalid file: " . $file);
  +$ext = "";
  +if (preg_match('/\.([^.]+)$/', $file, $match)) 
  +    $ext = $match[1];
  +
  +$content = file_get_contents($file);
  +$t = isset($type[$ext]) ? $type[$ext] : $type["*"];
  +
  +header(sprintf("Content-Type: %s", $t));
  +header(sprintf("Content-Length: %d", strlen($content)));
  +print $content;
  +
  +?>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-imprint.php
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 global-imprint.php
  --- openpkg-meta/global-imprint.php   13 Mar 2006 21:09:47 -0000      1.1
  +++ openpkg-meta/global-imprint.php   14 Mar 2006 17:00:41 -0000      1.2
  @@ -1,27 +1,23 @@
   <script language="php">
     include("meta.php");
  -  meta_start("path=project.meta.imprint&pane=2");
  +  meta_start("path=meta.imprint&pane=2");
   </script>
   
  -<script language="php">
  -  divert("html:head");
  -</script>
  -<style type="text/css">
  -  table.contact tr.title td {
  -    font-weight:  bold;
  -  }
  -  table.contact tr td {
  -    padding-right: 10px;
  -  }
  -  table.responsibility tr td {
  -    padding-right: 10px;
  -    vertical-align: top;
  -    width: 50%;
  -  }
  -</style>
  -<script language="php">
  -  divert("html:body");
  -</script>
  +<head>
  +  <style type="text/css">
  +    table.contact tr.title td {
  +      font-weight:  bold;
  +    }
  +    table.contact tr td {
  +      padding-right: 10px;
  +    }
  +    table.responsibility tr td {
  +      padding-right: 10px;
  +      vertical-align: top;
  +      width: 50%;
  +    }
  +  </style>
  +<head>
   
   <h1>Meta: Websites Imprint</h1>
   
  @@ -64,7 +60,6 @@
     </tr>
   </table>
   
  -
   <h2>Copyright</h2>
   
   <p/>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-index.php
  ============================================================================
  $ cvs diff -u -r0 -r1.1 global-index.php
  --- /dev/null 2006-03-14 18:00:41 +0100
  +++ global-index.php  2006-03-14 18:00:42 +0100
  @@ -0,0 +1,26 @@
  +<script language="php">
  +  include("meta.php");
  +  meta_start("path=meta&pane=2");
  +</script>
  +
  +<h1>Meta</h1>
  +
  +OpenPKG Meta is the central website service providing meta data for all
  +OpenPKG websites (<tt>*.openpkg.{org,com,net}</tt>). It provides both
  +the <a href="global-template.php">uniform page canvas template</a> and
  +some globally shared pages.
  +
  +The following globally shared pages currently exists:
  +
  +<p/>
  +<ul>
  +  <li><a href="global-about.php">About Websites</a></li>
  +  <li><a href="global-imprint.php">Websites Imprint</a></li>
  +  <li><a href="global-sitemap.php">Websites SiteMap</a></li>
  +  <li><a href="global-search.php">Websites Search</a></li>
  +  <li><a href="global-template.php">Websites Template</a></li>
  +</ul>
  +
  +<script language="php">
  +  meta_end();
  +</script>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-search.php
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 global-search.php
  --- openpkg-meta/global-search.php    13 Mar 2006 21:39:06 -0000      1.2
  +++ openpkg-meta/global-search.php    14 Mar 2006 17:00:41 -0000      1.3
  @@ -1,6 +1,6 @@
   <script language="php">
     include("meta.php");
  -  meta_start("path=project.meta.search&pane=2");
  +  meta_start("path=meta.search&pane=2");
   </script>
   
   <h1>Meta: Websites Search</h1>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/global-sitemap.php
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 global-sitemap.php
  --- openpkg-meta/global-sitemap.php   13 Mar 2006 21:37:09 -0000      1.2
  +++ openpkg-meta/global-sitemap.php   14 Mar 2006 17:00:41 -0000      1.3
  @@ -1,11 +1,9 @@
   <script language="php">
     include("meta.php");
  -  meta_start("path=project.meta.sitemap&pane=1");
  +  meta_start("path=meta.sitemap&pane=1");
   </script>
   
  -<script language="php">
  -  divert("html:head");
  -</script>
  +<head>
   <style type="text/css">
     div.sitemap a:link {
         font-weight:    normal;
  @@ -17,7 +15,7 @@
     }
     div.sitemap table tr td {
         vertical-align: top;
  -      width:          30%;
  +      width:          25%;
     }
     div.sitemap ul {
         margin-left:    0px;
  @@ -45,9 +43,7 @@
         font-weight:    bold;
     }
   </style>
  -<script language="php">
  -  divert("html:body");
  -</script>
  +</head>
   
   <h1>Meta: Websites Sitemap</h1>
   
  @@ -64,14 +60,16 @@
       $tmp = preg_replace("/\n<\\/ul>/", "", $tmp);
       $tmp = preg_replace('/(\n  <li .*?\n  <\/li>)' .
                            '(\n  <li .*?\n  <\/li>)' .
  +                         '(\n  <li .*?\n  <\/li>)' .
                            '(\n  <li .*?\n  <\/li>)/s',
                            "<td><ul class=\"site1\">$1</ul></td>\n" .
                            "<td><ul class=\"site2\">$2</ul></td>\n" .
  -                         "<td><ul class=\"site3\">$3</ul></td>\n",
  +                         "<td><ul class=\"site3\">$3</ul></td>\n" .
  +                         "<td><ul class=\"site4\">$4</ul></td>\n",
                            $tmp);
   
       #   output navigation tree
  -    divert("html:body");
  +    divert("body");
       echo $tmp;
   </script>
   </tr>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/meta.php
  ============================================================================
  $ cvs diff -u -r1.4 -r1.5 meta.php
  --- openpkg-meta/meta.php     13 Mar 2006 22:26:39 -0000      1.4
  +++ openpkg-meta/meta.php     14 Mar 2006 17:00:41 -0000      1.5
  @@ -21,9 +21,24 @@
   ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   ##  SUCH DAMAGE.
   ##
  -##  meta.php: meta consumer glue code
  +##  meta.php: meta consumer glue code (version: 1.0 2006-03-14)
   ##
   
  +#   configuration
  +$my = array(
  +    "canvas_url" => "http://meta.openpkg.org/canvas.php";,
  +    "base_dir"   => null,
  +);
  +
  +#   determine path to _this_ script
  +if (is_null($my["base_dir"])) {
  +    $my["base_dir"] = $_SERVER["SCRIPT_FILENAME"];
  +    while ($my["base_dir"] = preg_replace('/\/?[^\/]+$/', '', 
$my["base_dir"])) {
  +        if (file_exists($my["base_dir"]."/meta.php"))
  +            break;
  +    }
  +}
  +
   #   diversion support
   $div = array();
   $div["name"] = "";
  @@ -76,10 +91,13 @@
   
   #   URL fetching with local caching
   function fetch_url($url, $max_caching) {
  +    global $my;
       $content = null;
   
       #   try to read content from cache
  -    $dba = dba_open("meta.d/meta.db", "c", "db4");
  +    $dba = null;
  +    if (file_exists($my["base_dir"] . "/meta.d"))
  +        $dba = dba_open($my["base_dir"] . "/meta.d/meta.db", "c", "db4");
       if (!is_null($dba)) {
           $obj = dba_fetch($url, $dba);
           if ($obj) {
  @@ -127,40 +145,44 @@
   $html = "";
   function meta_start ($options) {
       global $html;
  +    global $my;
   
       #   fetch meta HTML template
  -    $options .= "&canvas=absolute";
  -    if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"]))
  -        $options .= "&embed=js";
  -    $url = "http://meta.openpkg.org/?$options";;
  +    $url = $my["canvas_url"] . "?$options";
       $html = fetch_url($url, 10);
   
       #   by default divert into body
  -    divert("html:body");
  +    divert("body");
   }
   function meta_end () {
       global $html;
       
  -    #   flush buffers
  -    divert_end();
  -
  -    #   assemble content by inserting head and body into template
  -    $content = "";
  +    #   the insertion tags in the generated canvas
       $tag_head = "<!-- CANVAS: HEAD -->";
       $tag_body = "<!-- CANVAS: BODY -->";
  -    $n = strpos($html, $tag_head);
  -    $content .= substr($html, 0, $n);
  -    $html = substr($html, $n+strlen($tag_head));
  -    $content .= undivert("html:head");
  -    $n = strpos($html, $tag_body);
  -    $content .= substr($html, 0, $n);
  -    $html = substr($html, $n+strlen($tag_body));
  -    $content .= undivert("html:body");
  -    $content .= $html;
  +    $tag_side = "<!-- CANVAS: SIDE -->";
  +
  +    #   assemble content parts
  +    $body = undivert("body");
  +    $head = "";
  +    $side = "";
  +    if (preg_match('/<head>(.*?)<\/head>/si', $body, $match)) {
  +        $body = preg_replace('/<head>.*?<\/head>/si', '', $body);
  +        $head = $match[1]; 
  +    }
  +    if (preg_match('/<side>(.*?)<\/side>/si', $body, $match)) {
  +        $body = preg_replace('/<side>.*?<\/side>/si', '', $body);
  +        $side = $match[1];
  +    }
  +
  +    #   insert content parts into canvas
  +    $html = preg_replace('/('.$tag_body.')/si', "$1$body", $html);
  +    $html = preg_replace('/('.$tag_head.')/si', "$1$head", $html);
  +    $html = preg_replace('/('.$tag_side.')/si', "$1$side", $html);
   
       #   determine content length and output content
  -    header(sprintf("Content-Length: %d", strlen($content)));
  -    print $content;
  +    header(sprintf("Content-Length: %d", strlen($html)));
  +    print $html;
   }
   
   </script>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/sample.php
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 sample.php
  --- openpkg-meta/sample.php   12 Mar 2006 17:51:32 -0000      1.2
  +++ openpkg-meta/sample.php   14 Mar 2006 17:00:41 -0000      1.3
  @@ -1,24 +1,26 @@
   <script language="php">
     include("meta.php");
  -  meta_start("path=project.registry.help&pane=2");
  +  meta_start("path=meta&pane=2");
   </script>
   
  -<script language="php">
  -  divert("html:head");
  -</script>
  -<style type="text/css">
  -  span.sample {
  -    font-weight:  bold;
  -    color:        #cc3333;
  -  }
  -</style>
  -<script language="php">
  -  divert("html:body");
  -</script>
  +<head>
  +  <style type="text/css">
  +    span.sample {
  +      font-weight:  bold;
  +      color:        #cc3333;
  +    }
  +  </style>
  +</head>
   
   <h1>Sample Page</h1>
   
  -This is a <span class="sample">Sample</span> page for meta.openpkg.org.
  +This is a <span class="sample">Sample</span> consumer page for 
meta.openpkg.org.
  +This is the primary body content area.
  +
  +<side>
  +This is a <span class="sample">Sample</span> consumer page for 
meta.openpkg.org.
  +This is the secondary side-bar content area.
  +</side>
   
   <script language="php">
     meta_end();
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to