changeset 10:144bc36a6c27

moved login form from nav to top of content added last modified date
author meillo@marmaro.de
date Sun, 27 May 2007 02:13:46 +0200
parents eb5bff360deb
children 46617062bef5
files .hgignore .hgtags .htaccess Includes/Bbcodeparser.inc.php Includes/Loginsys.class.php Includes/Nav.inc.php Owls.css.php Owls.php Owls.png Setup.php favicon.ico robots.txt
diffstat 3 files changed, 56 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Includes/Nav.inc.php	Thu Dec 14 21:51:44 2006 +0100
+++ b/Includes/Nav.inc.php	Sun May 27 02:13:46 2007 +0200
@@ -72,21 +72,6 @@
 
 ?>
 
-    <li id="login">
-<?php
-      if ($lsys->loggedIn()) {
-        echo '    <a href="'. $_GET['id'] .'logout" style="color: #c00;">logout</a>';
-      } else {
-?>
-      <form name="loginform" action="<?php echo $_GET['id']; ?>login" method="post" enctype="multipart/form-data">
-        <input name="login_loginname" type="text" />
-        <input name="login_password" type="password" />
-        <input name="login" type="submit" value="login" style="padding: 0; cursor: pointer;" />
-      </form>
-<?php
-      }
-?>
-    </li>
 
   </ul>
 
--- a/Owls.css.php	Thu Dec 14 21:51:44 2006 +0100
+++ b/Owls.css.php	Sun May 27 02:13:46 2007 +0200
@@ -23,7 +23,7 @@
   $c_NavHover         = $c_LinkHover;
   $c_NavSelected      = '#eee';
 
-  $c_Login            = $c_Nav;
+  $c_Login            = $c_LinkVisited;
   $c_Admin            = '#ffff80';
 
 
@@ -173,18 +173,12 @@
 
 
 /*  login  */
-li#login {
-  margin-top: 3em;
-}
-#login input {
-  color: <?php echo $c_Login; ?>;
+#loginform input {
   background-color: transparent;
   border: none;
-  border-left: <?php echo $c_Login; ?> 1px solid;    /* TODO: think about other color */
-  display: block;
+  border-bottom: <?php echo $c_Login; ?> 1px solid;    /* TODO: think about other color */
   font-size: 0.8em;
-  margin-bottom: 2px;
-  padding-left: 4px;
+  width: 8em;
 }
 
 
@@ -196,6 +190,7 @@
 .ctrl {
   text-align: right;
   font-size: 0.8em;
+  color: <?php echo $c_Login; ?>;
 }
 .ctrl a,
 .ctrl a:visited,
--- a/Owls.php	Thu Dec 14 21:51:44 2006 +0100
+++ b/Owls.php	Sun May 27 02:13:46 2007 +0200
@@ -3,7 +3,7 @@
   define('DB_PREFIX', 'rem__1_');
   define('TITLE', 'Owls');
 
-  require_once '../Db.inc.php';
+  require_once '../../Db.inc.php';
   require_once 'Includes/Loginsys.class.php';
   include_once 'Includes/Bbcodeparser.inc.php';
 
@@ -72,9 +72,6 @@
 <?php
 
 
-
-
-
   if ($_GET['action'] == 'show') {    // show
     show($lsys);
 
@@ -123,9 +120,6 @@
 
 
 
-
-
-
 /*
     displays content of the node
     performs action 'edit'
@@ -133,6 +127,7 @@
 */
 function show($lsys) {
 
+
   // perform action: write edited node to db
   if (isset($_POST['editDoc']) && $lsys->loggedIn()) {
     $_POST['editDoc_title'] = addslashes($_POST['editDoc_title']);
@@ -149,6 +144,8 @@
   include 'Includes/Nav.inc.php';
 
 
+
+
   // query data of the node
   $result = mysql_query("select * from ". DB_PREFIX ."Owls where id=$_GET[id]");
   
@@ -179,20 +176,64 @@
     $row = mysql_fetch_array($result);
     echo '  <div id="content">'."\n";
 
-      // display admin controls if logged in
+      // display admin controls or login form
+?>
+        <div class="ctrl">
+
+<?php
+          // display last update
+          if ($_GET['id'] == 1) {
+            // root node displays date of last modification of any node
+            $sql = sprintf("
+              select
+                max(date)
+              from %sOwls
+              ",
+              DB_PREFIX
+            );
+          } else {
+            $sql = sprintf("
+              select
+                date
+              from %sOwls
+              where
+                id = ". $_GET['id'] ."
+              ",
+              DB_PREFIX
+            );
+          }
+          $result = mysql_query($sql) or die(mysql_error());
+          unset($sql);
+
+          $rowUpdate = mysql_fetch_row($result);
+          $lastUpdate = $rowUpdate[0];
+?>
+          <span style="font-size: 0.8em;">
+            last update: <?php echo date('d.m.Y H:i', $lastUpdate); ?>
+          </span>
+
+<?php
       if ($lsys->loggedIn()) {
 ?>
-        <div class="ctrl">
           <a href="<?php echo $row['id'] .'n'; ?>">new</a>
           <a href="<?php echo $row['id'] .'e'; ?>">edit</a>
 <?php
           if ($row['id'] != 1) {
             echo '<a href="javascript:sureToDelete('. $row['id'] .')">delete</a>';
           }
+          echo '    <a href="'. $_GET['id'] .'logout" style="color: #c00;">logout</a>';
+      } else {
+?>
+        <form name="loginform" id="loginform" action="<?php echo $_GET['id']; ?>login" method="post" enctype="multipart/form-data" style="display: inline;">
+          <input name="login_loginname" type="text" />
+          <input name="login_password" type="password" />
+          <input name="login" type="submit" value="login" style="padding: 0; cursor: pointer; width: 5em;" />
+        </form>
+<?php
+      }
 ?>
         </div>
 <?php
-      }
 
     // print content of the node
     echo '    <h2>'.stripslashes($row['name']).'</h2>'."\n";