Differences From:
File
src/style.c
part of check-in
[f08adf3d58]
- Added a "wiki" link to the main menu. Added built-in description of wiki
formatting rules. Added a wiki "homepage" that displays when the
"wiki" URI is used without a pagename. Added support for a wiki
sandbox that does not save to the repository.
by
drh on
2007-10-28 23:27:12.
[view]
To:
File
src/style.c
part of check-in
[555911dff5]
- Render the header of every page using subscript. Add a setup page that
for editing that subscript.
by
drh on
2007-11-21 03:01:40.
[view]
@@ -70,48 +70,42 @@
** Draw the header.
*/
void style_header(const char *zTitle){
const char *zLogInOut = "Logout";
- char *zProjectDescr = db_get("project-description", 0);
+ const char *zHeader = db_get("header", zDefaultHeader);
+ struct Subscript *p;
login_check_credentials();
- @ <html>
- @ <head>
- @ <title>%s(zTitle)</title>
- @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss">
- @ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen">
- if( zProjectDescr != 0 ){
- @ <meta name="description" content="%s(zProjectDescr)">
+
+ /* Generate the header up through the main menu */
+ p = SbS_Create();
+ SbS_Store(p, "title", zTitle, 0);
+ SbS_Store(p, "baseurl", g.zBaseURL, 0);
+ if( g.zLogin ){
+ SbS_Store(p, "login", g.zLogin, 0);
}
- @ </head>
- @ <body>
- @ <div id="page-title">%s(zTitle)</div>
- @ <div id="login-status">
- if( g.zLogin==0 ){
- @ not logged in
- zLogInOut = "Login";
- }else{
- @ logged in as %h(g.zLogin)
- }
- @ </div>
+ SbS_Render(p, zHeader);
+ SbS_Destroy(p);
+
+ /* Generate the main menu and the submenu (if any) */
@ <div id="main-menu">
@ <a href="%s(g.zBaseURL)/home">Home</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)/leaves">Leaves</a>
+ @ <a href="%s(g.zBaseURL)/timeline">Timeline</a>
}
if( g.okRdWiki ){
- @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a>
+ @ <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>
+ @ <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>
+ @ <a href="%s(g.zBaseURL)/setup">Setup</a>
}
if( !g.noPswd ){
- @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
+ @ <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
}
@ </div>
if( nSubmenu>0 ){
int i;
@@ -118,15 +112,12 @@
@ <div id="sub-menu">
qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
for(i=0; i<nSubmenu; i++){
struct Submenu *p = &aSubmenu[i];
- char *zTail = i<nSubmenu-1 ? " | " : "";
if( p->zLink==0 ){
@ <span class="label">%h(p->zLabel)</span>
- @ <span class="tail">%s(zTail)</span>
}else{
@ <a class="label" href="%s(p->zLink)">%h(p->zLabel)</a>
- @ <span class="tail">%s(zTail)</span>
}
}
@ </div>
}
@@ -143,8 +134,31 @@
@ <div id="style-footer">
@ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
@ </div>
}
+
+/*
+** The default page header.
+*/
+const char zDefaultHeader[] =
+@ <html>
+@ <head>
+@ <title>Edit CSS</title>
+@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
+@ href="[baseurl puts]/timeline.rss">
+@ <link rel="stylesheet" href="[baseurl puts]/style.css" type="text/css"
+@ media="screen">
+@ </head>
+@ <body>
+@ <div id="page-title">[title html]</div>
+@ <div id="login-status">
+@ [/login exists enable_output]
+@ logged in as [0 /login get html]
+@ [/login exists not enable_output]
+@ not logged in
+@ [1 enable_output]
+@ </div>
+;
/*
** The default Cascading Style Sheet.
**