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:   12-Mar-2006 19:36:58
  Branch: HEAD                             Handle: 2006031218365800

  Added files:
    openpkg-meta            canvas-html.php
  Modified files:
    openpkg-meta            canvas-php.php canvas.php

  Log:
    move diversion stuff into canvas-php.php and HTML template into a new
    canvas-html.php

  Summary:
    Revision    Changes     Path
    1.1         +72 -0      openpkg-meta/canvas-html.php
    1.2         +32 -21     openpkg-meta/canvas-php.php
    1.18        +7  -89     openpkg-meta/canvas.php
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-html.php
  ============================================================================
  $ cvs diff -u -r0 -r1.1 canvas-html.php
  --- /dev/null 2006-03-12 19:36:27 +0100
  +++ canvas-html.php   2006-03-12 19:36:58 +0100
  @@ -0,0 +1,72 @@
  +<script language="php">
  +##
  +##  Copyright (c) 2005-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  +##  Copyright (c) 2005-2006 Ralf S. Engelschall <http://engelschall.com/>
  +##
  +##  Permission to use, copy, modify, and distribute this software for
  +##  any purpose with or without fee is hereby granted, provided that
  +##  the above copyright notice and this permission notice appear in all
  +##  copies.
  +##
  +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +##  SUCH DAMAGE.
  +##
  +##  canvas-layout.php: canvas page layout
  +##
  +
  +#   generate the outer HTML document
  +divert("html");
  +</script>
  +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  +  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
  +<html>
  +    <head>
  +        <meta name="Copyright" content="2005-2006 OpenPKG Foundation e.V."/>
  +        <meta name="Copyright" content="2005-2006 Ralf S. Engelschall"/>
  +        <script language="php">
  +            #   the standard HTML head element
  +            echo undivert("html-head");
  +
  +            #   Cascading Style Sheet (CSS)
  +            if ($opt["embed"]["css"]) {
  +                #   internally embedded 
  +                echo "<style type=\"text/css\">\n";
  +                echo undivert("css");
  +                echo "</style>\n";
  +            }
  +            else {
  +                #   externally linked
  +                #   (path intentionally left out for caching because 
functionally unimportant)
  +                echo "<link rel=\"stylesheet\" type=\"text/css\"";
  +                echo " 
href=\"".$cfg["url.base"]."?type=css&amp;pane=".$opt["pane"]."&amp;stretch=".$opt["stretch"]."\"/>\n";
  +            }
  +
  +            #   JavaScript (JS)
  +            if ($opt["embed"]["js"]) {
  +                #   internally embedded
  +                echo "<script language=\"javascript\" 
type=\"text/javascript\">\n";
  +                echo undivert("js");
  +                echo "</script>\n";
  +            }
  +            else {
  +                #   externally linked
  +                #   (path intentionally included because functionally 
important)
  +                echo "<script type=\"text/javascript\"";
  +                echo " 
src=\"".$cfg["url.base"]."?type=js&amp;pane=".$opt["pane"]."&amp;path=".$opt["path"]."\"></script>\n";
  +            }
  +        </script>
  +    </head>
  +    <body>
  +        <script language="php">echo undivert("html-body");</script>
  +    </body>
  +</html>
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas-php.php
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 canvas-php.php
  --- openpkg-meta/canvas-php.php       9 Mar 2006 19:00:25 -0000       1.1
  +++ openpkg-meta/canvas-php.php       12 Mar 2006 18:36:58 -0000      1.2
  @@ -23,29 +23,40 @@
   ##
   ##  canvas-php.php: PHP reuseable components
   ##
  -</script>
  -
  -<script language="php">
  -    divert("html-head");
  -    echo "<script language=\"php\">";
  -</script>
   
  -#   scramble an email address/link somewhat to prevent
  -#   trivial address crawlers from picking it up
  -function email ($url, $link) {
  -    $html = $url;
  -    $html = preg_replace('/@/',  '<!-- XXX -->&#64;<!-- XXX -->', $html);
  -    $html = preg_replace('/\./', '<!-- XXX -->&#46;<!-- XXX -->', $html);
  -    if ($link) {
  -        $href = $url;
  -        $href = preg_replace('/@/', '&#64;', $href);
  -        $href = preg_replace('/\./', '&#46;', $href);
  -        $html = "<a href=\"mailto:$href\";>$html</a>";
  +#   diversion support
  +$div = array();
  +$div["name"] = "";
  +$div["data"] = array();
  +function divert_start ($name) {
  +    global $div;
  +    $div["name"] = $name;
  +    if (!isset($div["data"][$diversion_name])) {
  +        $div["data"][$diversion_name] = "";
  +    }
  +    ob_start();
  +}
  +function divert_end () {
  +    global $div;
  +    if ($div["name"] != "") {
  +        $div["data"][$div["name"]] .= ob_get_contents();
  +        ob_end_clean();
       }
  -    echo $html;
  +}
  +function divert ($name) {
  +    global $div;
  +    if ($div["name"] != $name) {
  +        divert_end();
  +        divert_start($name);
  +    }
  +}
  +function undivert ($name) {
  +    global $div;
  +    if ($div["name"] == $name) {
  +        $div["data"][$div["name"]] .= ob_get_contents();
  +        ob_clean();
  +    }
  +    return $div["data"][$name];
   }
   
  -<script language="php">
  -    echo "</script>";
   </script>
  -
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-meta/canvas.php
  ============================================================================
  $ cvs diff -u -r1.17 -r1.18 canvas.php
  --- openpkg-meta/canvas.php   11 Mar 2006 16:38:45 -0000      1.17
  +++ openpkg-meta/canvas.php   12 Mar 2006 18:36:58 -0000      1.18
  @@ -109,43 +109,8 @@
   header(sprintf("Cache-Control: max-age=%d, must-revalidate", 
$spec[$opt["type"]]["maxage"]));
   unset($spec);
   
  -#   diversion support
  -$div = array();
  -$div["name"] = "";
  -$div["data"] = array();
  -function divert_start ($name) {
  -    global $div;
  -    $div["name"] = $name;
  -    if (!isset($div["data"][$diversion_name])) {
  -        $div["data"][$diversion_name] = "";
  -    }
  -    ob_start();
  -}
  -function divert_end () {
  -    global $div;
  -    if ($div["name"] != "") {
  -        $div["data"][$div["name"]] .= ob_get_contents();
  -        ob_end_clean();
  -    }
  -}
  -function divert ($name) {
  -    global $div;
  -    if ($div["name"] != $name) {
  -        divert_end();
  -        divert_start($name);
  -    }
  -}
  -function undivert ($name) {
  -    global $div;
  -    if ($div["name"] == $name) {
  -        $div["data"][$div["name"]] .= ob_get_contents();
  -        ob_clean();
  -    }
  -    return $div["data"][$name];
  -}
  -
   #   load content generation parts
  -divert("/dev/null");
  +include("canvas-php.php");
   include("canvas-nav.php");
   include("canvas-nav-title.php");
   include("canvas-nav-tab.php");
  @@ -155,60 +120,13 @@
       include("canvas-nav-bar.php");
   include("canvas-style.php");
   include("canvas-js.php");
  -include("canvas-php.php");
   include("canvas-layout.php");
  +include("canvas-html.php");
   
  -#   divert into HTML diversion by default
  -#   and start generating the HTML document
  -divert("html");
  -</script>
  -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  -  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
  -<html>
  -    <head>
  -        <meta name="Copyright" content="2005-2006 OpenPKG Foundation e.V."/>
  -        <meta name="Copyright" content="2005-2006 Ralf S. Engelschall"/>
  -        <script language="php">
  -            #   the standard HTML head element
  -            echo undivert("html-head");
  -
  -            #   Cascading Style Sheet (CSS)
  -            if ($opt["embed"]["css"]) {
  -                #   internally embedded 
  -                echo "<style type=\"text/css\">\n";
  -                echo undivert("css");
  -                echo "</style>\n";
  -            }
  -            else {
  -                #   externally linked
  -                #   (path intentionally left out for caching because 
functionally unimportant)
  -                echo "<link rel=\"stylesheet\" type=\"text/css\"";
  -                echo " 
href=\"".$cfg["url.base"]."?type=css&amp;pane=".$opt["pane"]."&amp;stretch=".$opt["stretch"]."\"/>\n";
  -            }
  +#   generate content
  +divert_end();
  +$content = undivert($opt["type"]);
  +header(sprintf("Content-Length: %d", strlen($content)));
  +print $content;
   
  -            #   JavaScript (JS)
  -            if ($opt["embed"]["js"]) {
  -                #   internally embedded
  -                echo "<script language=\"javascript\" 
type=\"text/javascript\">\n";
  -                echo undivert("js");
  -                echo "</script>\n";
  -            }
  -            else {
  -                #   externally linked
  -                #   (path intentionally included because functionally 
important)
  -                echo "<script type=\"text/javascript\"";
  -                echo " 
src=\"".$cfg["url.base"]."?type=js&amp;pane=".$opt["pane"]."&amp;path=".$opt["path"]."\"></script>\n";
  -            }
  -        </script>
  -    </head>
  -    <body>
  -        <script language="php">echo undivert("html-body");</script>
  -    </body>
  -</html>
  -<script language="php">
  -    #   generate content
  -    divert_end();
  -    $content = undivert($opt["type"]);
  -    header(sprintf("Content-Length: %d", strlen($content)));
  -    print $content;
   </script>
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to