Differences From:
File
src/style.c
part of check-in
[3ad9a5e210]
- TH1 script now used to render the header and footer of each page.
by
drh on
2008-02-13 18:18:50.
[view]
To:
File
src/style.c
part of check-in
[ffe92f1a2f]
- The entire header, including the menu bar, is now generated by TH script.
This allows the menu bar to be customized by editing the header script.
by
drh on
2008-02-13 19:50:27.
[view]
@@ -73,9 +73,8 @@
/*
** Draw the header.
*/
void style_header(const char *zTitle){
- const char *zLogInOut = "Login";
const char *zHeader = db_get("header", (char*)zDefaultHeader);
login_check_credentials();
cgi_destination(CGI_HEADER);
@@ -87,38 +86,10 @@
Th_InitVar("manifest_version", MANIFEST_VERSION);
Th_InitVar("manifest_date", MANIFEST_DATE);
if( g.zLogin ){
Th_InitVar("login", g.zLogin);
- zLogInOut = "Logout";
}
Th_Render(zHeader);
-
- /* Generate the main menu */
- @ <div class="mainmenu">
- @ <a href="%s(g.zBaseURL)/home">Home</a>
- if( g.okHistory ){
- @ <a href="%s(g.zBaseURL)/dir">Files</a>
- }
- if( g.okRead ){
- @ <a href="%s(g.zBaseURL)/leaves">Leaves</a>
- @ <a href="%s(g.zBaseURL)/timeline">Timeline</a>
- @ <a href="%s(g.zBaseURL)/tagview">Tags</a>
- }
- if( g.okRdWiki ){
- @ <a href="%s(g.zBaseURL)/wiki">Wiki</a>
- }
-#if 0
- @ <font color="#888888">Search</font>
- @ <font color="#888888">Ticket</font>
- @ <font color="#888888">Reports</font>
-#endif
- if( g.okSetup ){
- @ <a href="%s(g.zBaseURL)/setup">Setup</a>
- }
- if( !g.noPswd ){
- @ <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
- }
- @ </div>
cgi_destination(CGI_BODY);
g.cgiPanic = 1;
}
@@ -163,9 +134,9 @@
*/
const char zDefaultHeader[] =
@ <html>
@ <head>
-@ <title><th1>puts "$project_name: $title"</th1></title>
+@ <title>$<project_name>: $<title></title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@ href="$baseurl/timeline.rss">
@ <link rel="stylesheet" href="$baseurl/style.css" type="text/css"
@ media="screen">
@@ -173,11 +144,11 @@
@ <body>
@ <div class="header">
@ <div class="logo">
@ <!-- <img src="logo.gif" alt="logo"><br></br> -->
-@ <nobr><th1>puts $project_name</th1></nobr>
+@ <nobr>$<project_name></nobr>
@ </div>
-@ <div class="title"><th1>puts $title</th1></div>
+@ <div class="title">$<title></div>
@ <div class="status"><nobr><th1>
@ if {[info exists login]} {
@ html "Logged in as <a href='$baseurl/my'>$login</a>"
@ } else {
@@ -184,8 +155,30 @@
@ puts "Not logged in"
@ }
@ </th1></nobr></div>
@ </div>
+@ <div class="mainmenu"><th1>
+@ html "<a href='$baseurl/home'>Home</a>"
+@ if {[hascap h]} {
+@ html "<a href='$baseurl/dir'>Files</a>"
+@ }
+@ if {[hascap i]} {
+@ html "<a href='$baseurl/leaves'>Leaves</a>"
+@ html "<a href='$baseurl/timeline'>Timeline</a>"
+@ html "<a href='$baseurl/tagview'>Tags</a>"
+@ }
+@ if {[hascap j]} {
+@ html "<a href='$baseurl/wiki'>Wiki</a>"
+@ }
+@ if {[hascap s]} {
+@ html "<a href='$baseurl/setup'>Setup</a>"
+@ }
+@ if {[info exists login]} {
+@ html "<a href='$baseurl/login'>Login</a>"
+@ } else {
+@ html "<a href='$baseurl/login'>Logout</a>"
+@ }
+@ </th1></div>
;
/*
** The default page footer