Changeset 83

Show
Ignore:
Timestamp:
29/05/05 17:52:06 (4 years ago)
Author:
dez
Message:

* Added stub for Blog settings menu option
* Fixed admin menu to display in the sidebar only
* In doing this, discovered login and logout functions are being called in
the middle of the page rather than right at the beginning, which means
that when you first log in, the $_SESSION variable isn't initialised until
it's too late. Fixed this.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • admin.lib.php

    r82 r83  
    120120                                $this->userName = $_SESSION['userName']; 
    121121                                $this->realName = $_SESSION['realName']; 
    122                                 $this->menu(); 
    123122                        } 
    124123                } 
     
    127126        //admin menu 
    128127        function menu() { 
    129                 echo "<p><a href=\"".$this->adminPath."newentry"."\">Add a new entry</a></p>"; 
     128                echo "<ul class=\"side-menu\">\n"; 
     129                echo "<li><a href=\"".$this->adminPath."newentry"."\">Add a new entry</a></li>\n"; 
     130                echo "<li><a href=\"",$this->adminPath."settings"."\">Edit Blog settings</a></li>\n"; 
     131                echo "</ul>\n"; 
    130132        } 
    131133         
     
    134136        { 
    135137                session_unset(); 
    136                 $this->printLoginForm(); 
    137138        } 
    138139         
     
    315316        } 
    316317 
     318 
     319        //print the blog settings form... 
     320        function printSettingsForm() 
     321        { 
     322                echo "<div class=\"entry\">\n"; 
     323                echo "<h2>Blog Settings</h2>\n"; 
     324                echo "</div>\n";         
     325        } 
     326 
    317327/* Some functions to manage posts, users etc. */ 
    318328 
  • admin.php

    r79 r83  
    44        $admin = new admin(); 
    55 
     6// Check if we're logging in or out - must be done before any HTML is displayed 
     7        switch (array_shift($request)) { 
     8        case "login": 
     9                $admin->login(); 
     10                break; 
     11        case "logout": 
     12                $admin->logout(); 
     13                break; 
     14        } 
    615?> 
    716<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     
    2130        <div id="sidepanel"> 
    2231            <p class="sideblurb"> 
    23                 <?$admin->menu();?><br /> 
     32                <? if($_SESSION['userName']) $admin->menu(); ?><br /> 
    2433                <a href="http://sucs.org"><img src="<? echo $admin->httpPath."img/sucspow.png"; ?>" alt="Powered by SUCS" height="13" width="80" /></a> 
    2534            </p> 
     
    2938                        if ($_SESSION['userName']) echo "<p>"._("Hello")." {$admin->realName} (<a href=\"{$admin->adminPath}/logout\">"._("Logout")."</a>)</p>"; 
    3039                        switch (array_shift($request)) { 
    31                         case "login": 
    32                                 $admin->login(); 
    33                                 break; 
    34                         case "logout": 
    35                                 $admin->logout(); 
    36                                 break; 
    3740                        case "newentry": 
    3841                                $admin->printEntryForm() ; 
    3942                                break; 
     43                        case "settings": 
     44                                $admin->printSettingsForm() ; 
     45                                break; 
    4046                        case "postentry": 
    4147                                $admin->postEntry() ; 
     
    4854                                break; 
    4955                        default: 
    50                                 $admin->menu(); 
     56                                //Should display blog entries here 
     57 
     58                                //temporary - to force box to be big enough for menu to display 
     59                                echo "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>\n"; 
     60 
    5161                                break; 
    5262                        } 
  • blog.css

    r72 r83  
    232232color : #F00; 
    233233} 
     234 
     235.side-menu { 
     236    margin: 0; 
     237    padding: 0; 
     238    list-style-type: none; 
     239}