owls

changeset 2:ab74e95a8040

added display of broken nodes; Header and Footer in Owls.php now; added logos
author "Meillo r e t u r n s <meillo@marmaro.de>"
date Thu, 07 Dec 2006 21:04:30 +0100
parents 6268cdb5fc0b
children 92a8978e68c5
files .hgignore Includes/Bbcodeparser.inc.php Includes/Footer.inc.php Includes/Header.inc.php Includes/Nav.inc.php Owls.css.php Owls.php Owls.png favicon.ico robots.txt
diffstat 9 files changed, 176 insertions(+), 96 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Sun Dec 03 22:32:33 2006 +0100
     1.2 +++ b/.hgignore	Thu Dec 07 21:04:30 2006 +0100
     1.3 @@ -6,7 +6,4 @@
     1.4  
     1.5  _Dev
     1.6  
     1.7 -Banner.png
     1.8  Smilies
     1.9 -favicon.ico
    1.10 -robots.txt
     2.1 --- a/Includes/Bbcodeparser.inc.php	Sun Dec 03 22:32:33 2006 +0100
     2.2 +++ b/Includes/Bbcodeparser.inc.php	Thu Dec 07 21:04:30 2006 +0100
     2.3 @@ -9,6 +9,11 @@
     2.4   */
     2.5  
     2.6  
     2.7 +  define('SMILIE_DIR', 'Smilies/');  // path to smilies
     2.8 +
     2.9 +
    2.10 +
    2.11 +
    2.12    function parse_quote1($textinput,$level = 1) {                  // ohne Quelle
    2.13      $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe';
    2.14      $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1',
    2.15 @@ -25,8 +30,6 @@
    2.16    }
    2.17  
    2.18    function smilies($text) {
    2.19 -    $smilieDir = 'Pics/Smilies/';  // path to smilies
    2.20 -
    2.21      $smilies = array( ':-)'        => 'Smile.gif',
    2.22                        ':)'         => 'Smile.gif',
    2.23                        ';-)'        => 'Wink.gif',
    2.24 @@ -41,14 +44,14 @@
    2.25                        ':-S'        => 'Dontknow.gif',
    2.26                        ':dontknow:' => 'Dontknow.gif',
    2.27                        ':-@'        => 'Angry.gif',
    2.28 -                      ':cool:'        => 'Cool.gif',
    2.29 -                      '(H)'        => 'Cool.gif',
    2.30 +                      ':cool:'     => 'Cool.gif',
    2.31 +                      'B-)'        => 'Cool.gif',
    2.32                        '%-)'        => 'Crosseyed.gif',
    2.33                        '%-('        => 'Crosseyed.gif',
    2.34                        ':rolleyes:' => 'Rolleyes.gif',
    2.35                        ':eek:'      => 'Shocked.gif');
    2.36      while(list($key, $val) = each($smilies)) {
    2.37 -      $text = str_replace($key,'[img]'.$smilieDir.$val.'[/img]',$text);
    2.38 +      $text = str_replace($key,'[img]'. SMILIE_DIR . $val .'[/img]', $text);
    2.39      }
    2.40      return $text;
    2.41    }
     3.1 --- a/Includes/Footer.inc.php	Sun Dec 03 22:32:33 2006 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,7 +0,0 @@
     3.4 -  </div>
     3.5 -
     3.6 -
     3.7 -</div>
     3.8 -
     3.9 -</body>
    3.10 -</html>
     4.1 --- a/Includes/Header.inc.php	Sun Dec 03 22:32:33 2006 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,71 +0,0 @@
     4.4 -<?php
     4.5 -
     4.6 -  define('DB_PREFIX', 'rem__1_');
     4.7 -  define('TITLE', 'Owls');
     4.8 -
     4.9 -  require_once '../Db.inc.php';
    4.10 -  require_once 'Includes/Loginsys.class.php';
    4.11 -  include_once 'Includes/Bbcodeparser.inc.php';
    4.12 -
    4.13 -  $lsys = &new Loginsys();
    4.14 -
    4.15 -?>
    4.16 -<!--
    4.17 -
    4.18 -                       `Owls' - some kind of wiki system
    4.19 -
    4.20 -
    4.21 -                (c) Copyright  2006 &>  by Meillo  r e t u r n s
    4.22 -
    4.23 -         This program is free software; you can redistribute it and/or
    4.24 -          modify it under the terms of the GNU General Public License
    4.25 -         as published by the Free Software Foundation; either version 2
    4.26 -             of the License, or (at your option) any later version.
    4.27 -
    4.28 -        This program is distributed in the hope that it will be useful,
    4.29 -         but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.30 -         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.31 -                  GNU General Public License for more details.
    4.32 -
    4.33 -
    4.34 -                          http://prog.marmaro.de/owls/
    4.35 -
    4.36 --->
    4.37 -
    4.38 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    4.39 -
    4.40 -<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
    4.41 -<head>
    4.42 -  <title><?php echo htmlentities(TITLE); ?></title>
    4.43 -  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    4.44 -  <link rel="shortcut icon" href="favicon.ico" />
    4.45 -  <link rel="stylesheet" type="text/css" href="Owls.css.php" />
    4.46 -  <script type="text/javascript">
    4.47 -  <!--
    4.48 -    function sureToDelete(id) {
    4.49 -      if (window.prompt("Type 'delete' to delete","") == "delete") {
    4.50 -        location.href = id +"d";
    4.51 -      }
    4.52 -    }
    4.53 -
    4.54 -    
    4.55 -    function toggleVisibility(boxId) {
    4.56 -      if (document.getElementById('node'+ boxId).style.display == 'none') {
    4.57 -        document.getElementById('node'+ boxId).style.display = "";
    4.58 -        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "-";
    4.59 -      } else{
    4.60 -        document.getElementById('node'+ boxId).style.display = "none";
    4.61 -        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "+";
    4.62 -      }
    4.63 -    }
    4.64 -    
    4.65 -  //-->  
    4.66 -  </script>
    4.67 -</head>
    4.68 -
    4.69 -<body>
    4.70 -<div id="websiteContainer">
    4.71 -
    4.72 -  <!-- Banner -->
    4.73 -  <img src="Banner.png" id="banner" alt="<?php echo htmlentities(TITLE); ?>" />
    4.74 -
     5.1 --- a/Includes/Nav.inc.php	Sun Dec 03 22:32:33 2006 +0100
     5.2 +++ b/Includes/Nav.inc.php	Thu Dec 07 21:04:30 2006 +0100
     5.3 @@ -2,11 +2,16 @@
     5.4    <ul id="nav">
     5.5  
     5.6  <?php
     5.7 +    // all nodes that are displayed in the nav
     5.8 +    global $nodesDisplayed;
     5.9 +    $nodesDisplayed = '';
    5.10 +
    5.11 +
    5.12      // build nav tree
    5.13      echo '    '. navtree(0) ."\n";
    5.14  
    5.15  
    5.16 -    // find unmatched nodes (orphans)
    5.17 +    // find nodes without existing parent (orphans)
    5.18      $sql = sprintf("
    5.19        select distinct
    5.20          idParent
    5.21 @@ -14,7 +19,6 @@
    5.22        where 
    5.23          idParent not in (select id from %sOwls) 
    5.24          and idParent != 0    -- not the real root
    5.25 ---        and idParent != id   -- avoid endless recursion
    5.26        order by name asc
    5.27        ",
    5.28        DB_PREFIX,
    5.29 @@ -35,6 +39,37 @@
    5.30  
    5.31        echo '</ul></li>';
    5.32      }
    5.33 +
    5.34 +
    5.35 +
    5.36 +    // find broken nodes - nodes not displayed in nav or orphans (i.e. rings)
    5.37 +    $sql = sprintf("
    5.38 +      select
    5.39 +        id, name
    5.40 +      from %sOwls 
    5.41 +      where 
    5.42 +        id not in ( %s )
    5.43 +      order by name asc
    5.44 +      ",
    5.45 +      DB_PREFIX,
    5.46 +      substr($nodesDisplayed, 2)
    5.47 +    );
    5.48 +    $result = mysql_query($sql) or die(mysql_error());
    5.49 +    unset($sql);
    5.50 +
    5.51 +    // output only if there are broken nodes
    5.52 +    if (mysql_num_rows($result)) {
    5.53 +      echo '    <li id="broken">broken<ul>';
    5.54 +      // output list of nodes (no tree, cause there may be rings!)
    5.55 +      while($row = mysql_fetch_array($result)) {
    5.56 +        echo '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a></li>';
    5.57 +      }
    5.58 +      unset($row);
    5.59 +      mysql_free_result($result);
    5.60 +
    5.61 +      echo '</ul></li>';
    5.62 +    }
    5.63 +
    5.64  ?>
    5.65  
    5.66      <li id="login">
    5.67 @@ -57,17 +92,34 @@
    5.68  
    5.69  <?php
    5.70  
    5.71 +
    5.72 +
    5.73      function navtree($root) {
    5.74        // fetch subcategories
    5.75 -      $result = mysql_query("select * from ". DB_PREFIX ."Owls where idParent = $root order by name asc");
    5.76 +      $sql = sprintf("
    5.77 +        select
    5.78 +          id, idParent, name
    5.79 +        from %sOwls
    5.80 +        where
    5.81 +          idParent = $root
    5.82 +        order by name asc
    5.83 +        ",
    5.84 +        DB_PREFIX
    5.85 +      );
    5.86 +      $result = mysql_query($sql) or die(mysql_error());
    5.87 +      unset($sql);
    5.88  
    5.89        $return = '';
    5.90        while($row = mysql_fetch_array($result)) {
    5.91 +        // add to list of displayed nodes
    5.92 +        global $nodesDisplayed;
    5.93 +        $nodesDisplayed .= ', '. $row['id'];
    5.94 +
    5.95          $return .= '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a>';
    5.96          if ($row['id'] != $row['idParent']) {
    5.97            $subtree = navtree($row['id']);
    5.98            if (!empty($subtree)) {
    5.99 -            $return .= '&nbsp;&nbsp;<a href="javascript:toggleVisibility(\''. $row[id] .'\')" id="ctrl'. $row['id'] .'" style="display: none;">-</a>';
   5.100 +            #$return .= '&nbsp;&nbsp;<a href="javascript:toggleVisibility(\''. $row['id'] .'\')" id="ctrl'. $row['id'] .'" style="display: none;">-</a>';
   5.101              $return .= '<ul id="node'. $row['id'] .'">'. $subtree .'</ul>';
   5.102            }
   5.103            unset($subtree);
     6.1 --- a/Owls.css.php	Sun Dec 03 22:32:33 2006 +0100
     6.2 +++ b/Owls.css.php	Thu Dec 07 21:04:30 2006 +0100
     6.3 @@ -10,7 +10,7 @@
     6.4  
     6.5  
     6.6    // colors
     6.7 -  $cProject           = '#96c';
     6.8 +  $cProject           = '#ff8040';    // #96c
     6.9  
    6.10    $cBackgroundGlobal  = '#666';
    6.11    //$cBackgroundContent = '#666';  //eee
    6.12 @@ -146,12 +146,14 @@
    6.13  }
    6.14  
    6.15  
    6.16 -li#orphans {
    6.17 +li#orphans,
    6.18 +li#broken {
    6.19    margin-top: 2em;
    6.20    font-style: italic;
    6.21    color: #aaa;
    6.22  }
    6.23  
    6.24 +
    6.25  li#login {
    6.26    margin-top: 3em;
    6.27  }
     7.1 --- a/Owls.php	Sun Dec 03 22:32:33 2006 +0100
     7.2 +++ b/Owls.php	Thu Dec 07 21:04:30 2006 +0100
     7.3 @@ -1,5 +1,78 @@
     7.4  <?php
     7.5 -  require_once 'Includes/Header.inc.php';
     7.6 +
     7.7 +  define('DB_PREFIX', 'rem__1_');
     7.8 +  define('TITLE', 'Owls');
     7.9 +
    7.10 +  require_once '../Db.inc.php';
    7.11 +  require_once 'Includes/Loginsys.class.php';
    7.12 +  include_once 'Includes/Bbcodeparser.inc.php';
    7.13 +
    7.14 +  $lsys = &new Loginsys();
    7.15 +
    7.16 +?>
    7.17 +<!--
    7.18 +
    7.19 +                       `Owls' - some kind of wiki system
    7.20 +
    7.21 +
    7.22 +                (c) Copyright  2006 &>  by Meillo  r e t u r n s
    7.23 +
    7.24 +         This program is free software; you can redistribute it and/or
    7.25 +          modify it under the terms of the GNU General Public License
    7.26 +         as published by the Free Software Foundation; either version 2
    7.27 +             of the License, or (at your option) any later version.
    7.28 +
    7.29 +        This program is distributed in the hope that it will be useful,
    7.30 +         but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.31 +         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.32 +                  GNU General Public License for more details.
    7.33 +
    7.34 +
    7.35 +                          http://prog.marmaro.de/owls/
    7.36 +
    7.37 +-->
    7.38 +
    7.39 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    7.40 +
    7.41 +<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
    7.42 +<head>
    7.43 +  <title><?php echo htmlentities(TITLE); ?></title>
    7.44 +  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    7.45 +  <link rel="shortcut icon" href="favicon.ico" />
    7.46 +  <link rel="stylesheet" type="text/css" href="Owls.css.php" />
    7.47 +  <script type="text/javascript">
    7.48 +  <!--
    7.49 +    function sureToDelete(id) {
    7.50 +      if (window.prompt("Type 'delete' to delete","") == "delete") {
    7.51 +        location.href = id +"d";
    7.52 +      }
    7.53 +    }
    7.54 +
    7.55 +/*  I want to use this function later ... perhaps
    7.56 +    function toggleVisibility(boxId) {
    7.57 +      if (document.getElementById('node'+ boxId).style.display == 'none') {
    7.58 +        document.getElementById('node'+ boxId).style.display = "";
    7.59 +        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "-";
    7.60 +      } else{
    7.61 +        document.getElementById('node'+ boxId).style.display = "none";
    7.62 +        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "+";
    7.63 +      }
    7.64 +    }
    7.65 +*/
    7.66 +  //-->  
    7.67 +  </script>
    7.68 +</head>
    7.69 +
    7.70 +<body>
    7.71 +<div id="websiteContainer">
    7.72 +
    7.73 +  <!-- Banner -->
    7.74 +  <img src="Owls.png" id="banner" alt="<?php echo htmlentities(TITLE); ?>" />
    7.75 +
    7.76 +<?php
    7.77 +
    7.78 +
    7.79 +
    7.80  
    7.81  
    7.82    if ($_GET['action'] == 'show') {    // show
    7.83 @@ -29,7 +102,19 @@
    7.84    }
    7.85  
    7.86  
    7.87 -  require_once 'Includes/Footer.inc.php';
    7.88 +
    7.89 +
    7.90 +
    7.91 +?>
    7.92 +
    7.93 +  </div>
    7.94 +
    7.95 +
    7.96 +</div>
    7.97 +
    7.98 +</body>
    7.99 +</html>
   7.100 +<?php
   7.101  
   7.102  
   7.103  
   7.104 @@ -142,16 +227,34 @@
   7.105  ?>
   7.106        <select name="editDoc_idCategory" style="width: 99%;">
   7.107  <?php
   7.108 -      $result = mysql_query("select * from ". DB_PREFIX ."Owls order by name asc") or die(mysql_error());
   7.109 +      $sql = sprintf("
   7.110 +        select 
   7.111 +          * 
   7.112 +        from %sOwls 
   7.113 +        where 
   7.114 +          id != %d
   7.115 +          and idParent != %d
   7.116 +-- not in (
   7.117 +--            select idParent from %sOwls
   7.118 +--          )
   7.119 +        order by name asc
   7.120 +        ",
   7.121 +        DB_PREFIX,
   7.122 +        $row['id'],
   7.123 +        $row['id'],
   7.124 +        DB_PREFIX
   7.125 +      );
   7.126 +      $result = mysql_query($sql) or die(mysql_error());
   7.127 +      unset($sql);
   7.128        while($rowCats = mysql_fetch_array($result)) {
   7.129 -        echo '  <option value="'.$rowCats['id'].'"'. (($row['idParent'] == $rowCats['id']) ? ' selected="selected"' : '') .'>'.stripslashes($rowCats['name']).'</option>';
   7.130 +        echo '  <option value="'.$rowCats['id'].'"'. (($row['idParent'] == $rowCats['id']) ? ' selected="selected" style="font-weight: bold;"' : '') .'>'.stripslashes($rowCats['name']).'</option>';
   7.131        }
   7.132  ?>
   7.133        </select><br /><br />
   7.134  <?php
   7.135      }
   7.136  ?>
   7.137 -    <input name="editDoc_title" type="text" value="<?php echo stripslashes($row['name']); ?>" style="width: 99%;" /><br />
   7.138 +    <input name="editDoc_title" type="text" value="<?php echo stripslashes($row['name']); ?>" style="width: 99%; font-weight: bold;" /><br />
   7.139      <textarea name="editDoc_text" cols="60" rows="15" style="width: 99%; height: 30em;"><?php
   7.140        echo stripslashes($row['text']);
   7.141      ?></textarea><br /><br />
     8.1 Binary file Owls.png has changed
     9.1 Binary file favicon.ico has changed