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(+), 97 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Dec 03 22:32:33 2006 +0100
+++ b/.hgignore	Thu Dec 07 21:04:30 2006 +0100
@@ -6,7 +6,4 @@
 
 _Dev
 
-Banner.png
 Smilies
-favicon.ico
-robots.txt
--- a/Includes/Bbcodeparser.inc.php	Sun Dec 03 22:32:33 2006 +0100
+++ b/Includes/Bbcodeparser.inc.php	Thu Dec 07 21:04:30 2006 +0100
@@ -9,6 +9,11 @@
  */
 
 
+  define('SMILIE_DIR', 'Smilies/');  // path to smilies
+
+
+
+
   function parse_quote1($textinput,$level = 1) {                  // ohne Quelle
     $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe';
     $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1',
@@ -25,8 +30,6 @@
   }
 
   function smilies($text) {
-    $smilieDir = 'Pics/Smilies/';  // path to smilies
-
     $smilies = array( ':-)'        => 'Smile.gif',
                       ':)'         => 'Smile.gif',
                       ';-)'        => 'Wink.gif',
@@ -41,14 +44,14 @@
                       ':-S'        => 'Dontknow.gif',
                       ':dontknow:' => 'Dontknow.gif',
                       ':-@'        => 'Angry.gif',
-                      ':cool:'        => 'Cool.gif',
-                      '(H)'        => 'Cool.gif',
+                      ':cool:'     => 'Cool.gif',
+                      'B-)'        => 'Cool.gif',
                       '%-)'        => 'Crosseyed.gif',
                       '%-('        => 'Crosseyed.gif',
                       ':rolleyes:' => 'Rolleyes.gif',
                       ':eek:'      => 'Shocked.gif');
     while(list($key, $val) = each($smilies)) {
-      $text = str_replace($key,'[img]'.$smilieDir.$val.'[/img]',$text);
+      $text = str_replace($key,'[img]'. SMILIE_DIR . $val .'[/img]', $text);
     }
     return $text;
   }
--- a/Includes/Footer.inc.php	Sun Dec 03 22:32:33 2006 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-  </div>
-
-
-</div>
-
-</body>
-</html>
--- a/Includes/Header.inc.php	Sun Dec 03 22:32:33 2006 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-<?php
-
-  define('DB_PREFIX', 'rem__1_');
-  define('TITLE', 'Owls');
-
-  require_once '../Db.inc.php';
-  require_once 'Includes/Loginsys.class.php';
-  include_once 'Includes/Bbcodeparser.inc.php';
-
-  $lsys = &new Loginsys();
-
-?>
-<!--
-
-                       `Owls' - some kind of wiki system
-
-
-                (c) Copyright  2006 &>  by Meillo  r e t u r n s
-
-         This program is free software; you can redistribute it and/or
-          modify it under the terms of the GNU General Public License
-         as published by the Free Software Foundation; either version 2
-             of the License, or (at your option) any later version.
-
-        This program is distributed in the hope that it will be useful,
-         but WITHOUT ANY WARRANTY; without even the implied warranty of
-         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-                  GNU General Public License for more details.
-
-
-                          http://prog.marmaro.de/owls/
-
--->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-
-<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <title><?php echo htmlentities(TITLE); ?></title>
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-  <link rel="shortcut icon" href="favicon.ico" />
-  <link rel="stylesheet" type="text/css" href="Owls.css.php" />
-  <script type="text/javascript">
-  <!--
-    function sureToDelete(id) {
-      if (window.prompt("Type 'delete' to delete","") == "delete") {
-        location.href = id +"d";
-      }
-    }
-
-    
-    function toggleVisibility(boxId) {
-      if (document.getElementById('node'+ boxId).style.display == 'none') {
-        document.getElementById('node'+ boxId).style.display = "";
-        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "-";
-      } else{
-        document.getElementById('node'+ boxId).style.display = "none";
-        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "+";
-      }
-    }
-    
-  //-->  
-  </script>
-</head>
-
-<body>
-<div id="websiteContainer">
-
-  <!-- Banner -->
-  <img src="Banner.png" id="banner" alt="<?php echo htmlentities(TITLE); ?>" />
-
--- a/Includes/Nav.inc.php	Sun Dec 03 22:32:33 2006 +0100
+++ b/Includes/Nav.inc.php	Thu Dec 07 21:04:30 2006 +0100
@@ -2,11 +2,16 @@
   <ul id="nav">
 
 <?php
+    // all nodes that are displayed in the nav
+    global $nodesDisplayed;
+    $nodesDisplayed = '';
+
+
     // build nav tree
     echo '    '. navtree(0) ."\n";
 
 
-    // find unmatched nodes (orphans)
+    // find nodes without existing parent (orphans)
     $sql = sprintf("
       select distinct
         idParent
@@ -14,7 +19,6 @@
       where 
         idParent not in (select id from %sOwls) 
         and idParent != 0    -- not the real root
---        and idParent != id   -- avoid endless recursion
       order by name asc
       ",
       DB_PREFIX,
@@ -35,6 +39,37 @@
 
       echo '</ul></li>';
     }
+
+
+
+    // find broken nodes - nodes not displayed in nav or orphans (i.e. rings)
+    $sql = sprintf("
+      select
+        id, name
+      from %sOwls 
+      where 
+        id not in ( %s )
+      order by name asc
+      ",
+      DB_PREFIX,
+      substr($nodesDisplayed, 2)
+    );
+    $result = mysql_query($sql) or die(mysql_error());
+    unset($sql);
+
+    // output only if there are broken nodes
+    if (mysql_num_rows($result)) {
+      echo '    <li id="broken">broken<ul>';
+      // output list of nodes (no tree, cause there may be rings!)
+      while($row = mysql_fetch_array($result)) {
+        echo '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a></li>';
+      }
+      unset($row);
+      mysql_free_result($result);
+
+      echo '</ul></li>';
+    }
+
 ?>
 
     <li id="login">
@@ -57,17 +92,34 @@
 
 <?php
 
+
+
     function navtree($root) {
       // fetch subcategories
-      $result = mysql_query("select * from ". DB_PREFIX ."Owls where idParent = $root order by name asc");
+      $sql = sprintf("
+        select
+          id, idParent, name
+        from %sOwls
+        where
+          idParent = $root
+        order by name asc
+        ",
+        DB_PREFIX
+      );
+      $result = mysql_query($sql) or die(mysql_error());
+      unset($sql);
 
       $return = '';
       while($row = mysql_fetch_array($result)) {
+        // add to list of displayed nodes
+        global $nodesDisplayed;
+        $nodesDisplayed .= ', '. $row['id'];
+
         $return .= '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a>';
         if ($row['id'] != $row['idParent']) {
           $subtree = navtree($row['id']);
           if (!empty($subtree)) {
-            $return .= '&nbsp;&nbsp;<a href="javascript:toggleVisibility(\''. $row[id] .'\')" id="ctrl'. $row['id'] .'" style="display: none;">-</a>';
+            #$return .= '&nbsp;&nbsp;<a href="javascript:toggleVisibility(\''. $row['id'] .'\')" id="ctrl'. $row['id'] .'" style="display: none;">-</a>';
             $return .= '<ul id="node'. $row['id'] .'">'. $subtree .'</ul>';
           }
           unset($subtree);
--- a/Owls.css.php	Sun Dec 03 22:32:33 2006 +0100
+++ b/Owls.css.php	Thu Dec 07 21:04:30 2006 +0100
@@ -10,7 +10,7 @@
 
 
   // colors
-  $cProject           = '#96c';
+  $cProject           = '#ff8040';    // #96c
 
   $cBackgroundGlobal  = '#666';
   //$cBackgroundContent = '#666';  //eee
@@ -146,12 +146,14 @@
 }
 
 
-li#orphans {
+li#orphans,
+li#broken {
   margin-top: 2em;
   font-style: italic;
   color: #aaa;
 }
 
+
 li#login {
   margin-top: 3em;
 }
--- a/Owls.php	Sun Dec 03 22:32:33 2006 +0100
+++ b/Owls.php	Thu Dec 07 21:04:30 2006 +0100
@@ -1,5 +1,78 @@
 <?php
-  require_once 'Includes/Header.inc.php';
+
+  define('DB_PREFIX', 'rem__1_');
+  define('TITLE', 'Owls');
+
+  require_once '../Db.inc.php';
+  require_once 'Includes/Loginsys.class.php';
+  include_once 'Includes/Bbcodeparser.inc.php';
+
+  $lsys = &new Loginsys();
+
+?>
+<!--
+
+                       `Owls' - some kind of wiki system
+
+
+                (c) Copyright  2006 &>  by Meillo  r e t u r n s
+
+         This program is free software; you can redistribute it and/or
+          modify it under the terms of the GNU General Public License
+         as published by the Free Software Foundation; either version 2
+             of the License, or (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful,
+         but WITHOUT ANY WARRANTY; without even the implied warranty of
+         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+                  GNU General Public License for more details.
+
+
+                          http://prog.marmaro.de/owls/
+
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <title><?php echo htmlentities(TITLE); ?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+  <link rel="shortcut icon" href="favicon.ico" />
+  <link rel="stylesheet" type="text/css" href="Owls.css.php" />
+  <script type="text/javascript">
+  <!--
+    function sureToDelete(id) {
+      if (window.prompt("Type 'delete' to delete","") == "delete") {
+        location.href = id +"d";
+      }
+    }
+
+/*  I want to use this function later ... perhaps
+    function toggleVisibility(boxId) {
+      if (document.getElementById('node'+ boxId).style.display == 'none') {
+        document.getElementById('node'+ boxId).style.display = "";
+        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "-";
+      } else{
+        document.getElementById('node'+ boxId).style.display = "none";
+        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "+";
+      }
+    }
+*/
+  //-->  
+  </script>
+</head>
+
+<body>
+<div id="websiteContainer">
+
+  <!-- Banner -->
+  <img src="Owls.png" id="banner" alt="<?php echo htmlentities(TITLE); ?>" />
+
+<?php
+
+
+
 
 
   if ($_GET['action'] == 'show') {    // show
@@ -29,7 +102,19 @@
   }
 
 
-  require_once 'Includes/Footer.inc.php';
+
+
+
+?>
+
+  </div>
+
+
+</div>
+
+</body>
+</html>
+<?php
 
 
 
@@ -142,16 +227,34 @@
 ?>
       <select name="editDoc_idCategory" style="width: 99%;">
 <?php
-      $result = mysql_query("select * from ". DB_PREFIX ."Owls order by name asc") or die(mysql_error());
+      $sql = sprintf("
+        select 
+          * 
+        from %sOwls 
+        where 
+          id != %d
+          and idParent != %d
+-- not in (
+--            select idParent from %sOwls
+--          )
+        order by name asc
+        ",
+        DB_PREFIX,
+        $row['id'],
+        $row['id'],
+        DB_PREFIX
+      );
+      $result = mysql_query($sql) or die(mysql_error());
+      unset($sql);
       while($rowCats = mysql_fetch_array($result)) {
-        echo '  <option value="'.$rowCats['id'].'"'. (($row['idParent'] == $rowCats['id']) ? ' selected="selected"' : '') .'>'.stripslashes($rowCats['name']).'</option>';
+        echo '  <option value="'.$rowCats['id'].'"'. (($row['idParent'] == $rowCats['id']) ? ' selected="selected" style="font-weight: bold;"' : '') .'>'.stripslashes($rowCats['name']).'</option>';
       }
 ?>
       </select><br /><br />
 <?php
     }
 ?>
-    <input name="editDoc_title" type="text" value="<?php echo stripslashes($row['name']); ?>" style="width: 99%;" /><br />
+    <input name="editDoc_title" type="text" value="<?php echo stripslashes($row['name']); ?>" style="width: 99%; font-weight: bold;" /><br />
     <textarea name="editDoc_text" cols="60" rows="15" style="width: 99%; height: 30em;"><?php
       echo stripslashes($row['text']);
     ?></textarea><br /><br />
Binary file Owls.png has changed
Binary file favicon.ico has changed