owls

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 diff
     1.1 --- a/Includes/Nav.inc.php	Thu Dec 14 21:51:44 2006 +0100
     1.2 +++ b/Includes/Nav.inc.php	Sun May 27 02:13:46 2007 +0200
     1.3 @@ -72,21 +72,6 @@
     1.4  
     1.5  ?>
     1.6  
     1.7 -    <li id="login">
     1.8 -<?php
     1.9 -      if ($lsys->loggedIn()) {
    1.10 -        echo '    <a href="'. $_GET['id'] .'logout" style="color: #c00;">logout</a>';
    1.11 -      } else {
    1.12 -?>
    1.13 -      <form name="loginform" action="<?php echo $_GET['id']; ?>login" method="post" enctype="multipart/form-data">
    1.14 -        <input name="login_loginname" type="text" />
    1.15 -        <input name="login_password" type="password" />
    1.16 -        <input name="login" type="submit" value="login" style="padding: 0; cursor: pointer;" />
    1.17 -      </form>
    1.18 -<?php
    1.19 -      }
    1.20 -?>
    1.21 -    </li>
    1.22  
    1.23    </ul>
    1.24  
     2.1 --- a/Owls.css.php	Thu Dec 14 21:51:44 2006 +0100
     2.2 +++ b/Owls.css.php	Sun May 27 02:13:46 2007 +0200
     2.3 @@ -23,7 +23,7 @@
     2.4    $c_NavHover         = $c_LinkHover;
     2.5    $c_NavSelected      = '#eee';
     2.6  
     2.7 -  $c_Login            = $c_Nav;
     2.8 +  $c_Login            = $c_LinkVisited;
     2.9    $c_Admin            = '#ffff80';
    2.10  
    2.11  
    2.12 @@ -173,18 +173,12 @@
    2.13  
    2.14  
    2.15  /*  login  */
    2.16 -li#login {
    2.17 -  margin-top: 3em;
    2.18 -}
    2.19 -#login input {
    2.20 -  color: <?php echo $c_Login; ?>;
    2.21 +#loginform input {
    2.22    background-color: transparent;
    2.23    border: none;
    2.24 -  border-left: <?php echo $c_Login; ?> 1px solid;    /* TODO: think about other color */
    2.25 -  display: block;
    2.26 +  border-bottom: <?php echo $c_Login; ?> 1px solid;    /* TODO: think about other color */
    2.27    font-size: 0.8em;
    2.28 -  margin-bottom: 2px;
    2.29 -  padding-left: 4px;
    2.30 +  width: 8em;
    2.31  }
    2.32  
    2.33  
    2.34 @@ -196,6 +190,7 @@
    2.35  .ctrl {
    2.36    text-align: right;
    2.37    font-size: 0.8em;
    2.38 +  color: <?php echo $c_Login; ?>;
    2.39  }
    2.40  .ctrl a,
    2.41  .ctrl a:visited,
     3.1 --- a/Owls.php	Thu Dec 14 21:51:44 2006 +0100
     3.2 +++ b/Owls.php	Sun May 27 02:13:46 2007 +0200
     3.3 @@ -3,7 +3,7 @@
     3.4    define('DB_PREFIX', 'rem__1_');
     3.5    define('TITLE', 'Owls');
     3.6  
     3.7 -  require_once '../Db.inc.php';
     3.8 +  require_once '../../Db.inc.php';
     3.9    require_once 'Includes/Loginsys.class.php';
    3.10    include_once 'Includes/Bbcodeparser.inc.php';
    3.11  
    3.12 @@ -72,9 +72,6 @@
    3.13  <?php
    3.14  
    3.15  
    3.16 -
    3.17 -
    3.18 -
    3.19    if ($_GET['action'] == 'show') {    // show
    3.20      show($lsys);
    3.21  
    3.22 @@ -123,9 +120,6 @@
    3.23  
    3.24  
    3.25  
    3.26 -
    3.27 -
    3.28 -
    3.29  /*
    3.30      displays content of the node
    3.31      performs action 'edit'
    3.32 @@ -133,6 +127,7 @@
    3.33  */
    3.34  function show($lsys) {
    3.35  
    3.36 +
    3.37    // perform action: write edited node to db
    3.38    if (isset($_POST['editDoc']) && $lsys->loggedIn()) {
    3.39      $_POST['editDoc_title'] = addslashes($_POST['editDoc_title']);
    3.40 @@ -149,6 +144,8 @@
    3.41    include 'Includes/Nav.inc.php';
    3.42  
    3.43  
    3.44 +
    3.45 +
    3.46    // query data of the node
    3.47    $result = mysql_query("select * from ". DB_PREFIX ."Owls where id=$_GET[id]");
    3.48    
    3.49 @@ -179,20 +176,64 @@
    3.50      $row = mysql_fetch_array($result);
    3.51      echo '  <div id="content">'."\n";
    3.52  
    3.53 -      // display admin controls if logged in
    3.54 +      // display admin controls or login form
    3.55 +?>
    3.56 +        <div class="ctrl">
    3.57 +
    3.58 +<?php
    3.59 +          // display last update
    3.60 +          if ($_GET['id'] == 1) {
    3.61 +            // root node displays date of last modification of any node
    3.62 +            $sql = sprintf("
    3.63 +              select
    3.64 +                max(date)
    3.65 +              from %sOwls
    3.66 +              ",
    3.67 +              DB_PREFIX
    3.68 +            );
    3.69 +          } else {
    3.70 +            $sql = sprintf("
    3.71 +              select
    3.72 +                date
    3.73 +              from %sOwls
    3.74 +              where
    3.75 +                id = ". $_GET['id'] ."
    3.76 +              ",
    3.77 +              DB_PREFIX
    3.78 +            );
    3.79 +          }
    3.80 +          $result = mysql_query($sql) or die(mysql_error());
    3.81 +          unset($sql);
    3.82 +
    3.83 +          $rowUpdate = mysql_fetch_row($result);
    3.84 +          $lastUpdate = $rowUpdate[0];
    3.85 +?>
    3.86 +          <span style="font-size: 0.8em;">
    3.87 +            last update: <?php echo date('d.m.Y H:i', $lastUpdate); ?>
    3.88 +          </span>
    3.89 +
    3.90 +<?php
    3.91        if ($lsys->loggedIn()) {
    3.92  ?>
    3.93 -        <div class="ctrl">
    3.94            <a href="<?php echo $row['id'] .'n'; ?>">new</a>
    3.95            <a href="<?php echo $row['id'] .'e'; ?>">edit</a>
    3.96  <?php
    3.97            if ($row['id'] != 1) {
    3.98              echo '<a href="javascript:sureToDelete('. $row['id'] .')">delete</a>';
    3.99            }
   3.100 +          echo '    <a href="'. $_GET['id'] .'logout" style="color: #c00;">logout</a>';
   3.101 +      } else {
   3.102 +?>
   3.103 +        <form name="loginform" id="loginform" action="<?php echo $_GET['id']; ?>login" method="post" enctype="multipart/form-data" style="display: inline;">
   3.104 +          <input name="login_loginname" type="text" />
   3.105 +          <input name="login_password" type="password" />
   3.106 +          <input name="login" type="submit" value="login" style="padding: 0; cursor: pointer; width: 5em;" />
   3.107 +        </form>
   3.108 +<?php
   3.109 +      }
   3.110  ?>
   3.111          </div>
   3.112  <?php
   3.113 -      }
   3.114  
   3.115      // print content of the node
   3.116      echo '    <h2>'.stripslashes($row['name']).'</h2>'."\n";