Check-in [34af72801d]
Not logged in
Overview

SHA1 Hash:34af72801d08a58a3c97d1ef75557b21fabb2e94
Date: 2007-11-23 22:09:47
User: drh
Comment:New default header and footer and CSS. Add the ability to edit the footer.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [5b0da28053] to [999409e67f].

@@ -133,11 +133,11 @@
     const char *zUser = db_column_text(&q, 3);
     const char *zCom = db_column_text(&q, 4);
     cnt++;
     if( cnt==1 ){
       if( zTitle ){
-        @ <div class="section-title">%s(zTitle)</div>
+        @ <div class="section">%s(zTitle)</div>
       }
       @ <ul>
     }
     @ <li>
     hyperlink_to_uuid(zUuid);
@@ -184,11 +184,11 @@
     const char *zUser = db_column_text(&q, 3);
     const char *zCom = db_column_text(&q, 4);
     cnt++;
     if( cnt==1 ){
       if( zTitle ){
-        @ <div class="section-title">%s(zTitle)</div>
+        @ <div class="section">%s(zTitle)</div>
       }
       @ <ul>
     }
     @ <li>
     hyperlink_to_uuid(zUuid);
@@ -224,11 +224,11 @@
     const char *zDate = db_column_text(&q, 1);
     const char *zUser = db_column_text(&q, 2);
     const char *zCom = db_column_text(&q, 3);
     cnt++;
     if( cnt==1 ){
-      @ <div class="section-title">Leaves</div>
+      @ <div class="section">Leaves</div>
       @ <ul>
     }
     @ <li>
     hyperlink_to_uuid(zUuid);
     @ %w(zCom) (by %s(zUser) on %s(zDate))
@@ -260,11 +260,11 @@
     const char *zValue = db_column_text(&q, 4);
     const char *zDate = db_column_text(&q, 5);
     int tagtype = db_column_int(&q, 6);
     cnt++;
     if( cnt==1 ){
-      @ <div class="section-title">Tags And Properties</div>
+      @ <div class="section">Tags And Properties</div>
       @ <ul>
     }
     @ <li>
     @ <b>%h(zTagname)</b>
     if( zValue ){
@@ -321,11 +321,11 @@
     const char *zUuid = db_column_text(&q, 0);
     char *zTitle = mprintf("Version: [%.10s]", zUuid);
     style_header(zTitle);
     free(zTitle);
     /*@ <h2>Version %s(zUuid)</h2>*/
-    @ <div class="section-title">Overview</div>
+    @ <div class="section">Overview</div>
     @ <p><table class="label-value">
     @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
     @ <tr><th>Date:</th><td>%s(db_column_text(&q, 1))</td></tr>
     if( g.okSetup ){
       @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
@@ -344,11 +344,11 @@
   }else{
     style_header("Version Information");
   }
   db_finalize(&q);
   showTags(rid);
-  @ <div class="section-title">Changes</div>
+  @ <div class="section">Changes</div>
   @ <ul>
   db_prepare(&q,
      "SELECT name, pid, fid"
      "  FROM mlink, filename"
      " WHERE mid=%d"
@@ -411,11 +411,11 @@
     const char *zName = db_column_text(&q, 0);
     const char *zUuid = db_column_text(&q, 1);
     char *zTitle = mprintf("Wiki Page %s", zName);
     style_header(zTitle);
     free(zTitle);
-    @ <div class="section-title">Overview</div>
+    @ <div class="section">Overview</div>
     @ <p><table class="label-value">
     @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
     @ <tr><th>Date:</th><td>%s(db_column_text(&q, 2))</td></tr>
     if( g.okSetup ){
       @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>

Modified src/setup.c from [6f12e979c3] to [9f3fedc058].

@@ -71,10 +71,12 @@
     "Configure the trouble-ticketing system for this repository");
   setup_menu_entry("CSS", "setup_editcss",
     "Edit the Cascading Style Sheet used by all pages of this repository");
   setup_menu_entry("Header", "setup_header",
     "Edit HTML text inserted at the top of every page");
+  setup_menu_entry("Footer", "setup_footer",
+    "Edit HTML text inserted at the bottom of every page");
   @ </dl>
 
   style_footer();
 }
 
@@ -617,8 +619,40 @@
   @ </form>
   @ <hr>
   @ Here is the default page header:
   @ <blockquote><pre>
   @ %h(zDefaultHeader)
+  @ </pre></blockquote>
+  db_end_transaction(0);
+}
+
+/*
+** WEBPAGE: setup_footer
+*/
+void setup_footer(void){
+  login_check_credentials();
+  if( !g.okSetup ){
+    login_needed();
+  }
+  db_begin_transaction();
+  if( P("clear")!=0 ){
+    db_multi_exec("DELETE FROM config WHERE name='footer'");
+    cgi_replace_parameter("footer", zDefaultFooter);
+  }else{
+    textarea_attribute(0, 0, 0, "footer", "footer", zDefaultFooter);
+  }
+  style_header("Edit Page Footer");
+  @ <form action="%s(g.zBaseURL)/setup_footer" method="POST">
+  @ <p>Edit HTML text with embedded subscript that will be used to
+  @ generate the end of every page.</p>
+  textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter);
+  @ <br />
+  @ <input type="submit" name="submit" value="Apply Changes">
+  @ <input type="submit" name="clear" value="Revert To Default">
+  @ </form>
+  @ <hr>
+  @ Here is the default page footer:
+  @ <blockquote><pre>
+  @ %h(zDefaultFooter)
   @ </pre></blockquote>
   db_end_transaction(0);
 }

Modified src/style.c from [c9b574b264] to [2f6f70a287].

@@ -65,31 +65,38 @@
   const struct Submenu *B = (const struct Submenu*)b;
   return strcmp(A->zLabel, B->zLabel);
 }
 
 /*
+** The Subscript interpreter used to render header and footer.
+*/
+static struct Subscript *pInterp;
+
+/*
 ** Draw the header.
 */
 void style_header(const char *zTitle){
   const char *zLogInOut = "Login";
   const char *zHeader = db_get("header", (char*)zDefaultHeader);
-  struct Subscript *p;
   login_check_credentials();
 
   /* Generate the header up through the main menu */
-  p = SbS_Create();
-  SbS_Store(p, "title", zTitle, 0);
-  SbS_Store(p, "baseurl", g.zBaseURL, 0);
+  pInterp = SbS_Create();
+  SbS_Store(pInterp, "project_name",
+                     db_get("project-name","Unnamed Fossil Project"), 0);
+  SbS_Store(pInterp, "title", zTitle, 0);
+  SbS_Store(pInterp, "baseurl", g.zBaseURL, 0);
+  SbS_Store(pInterp, "manifest_version", MANIFEST_VERSION, 0);
+  SbS_Store(pInterp, "manifest_date", MANIFEST_DATE, 0);
   if( g.zLogin ){
-    SbS_Store(p, "login", g.zLogin, 0);
+    SbS_Store(pInterp, "login", g.zLogin, 0);
     zLogInOut = "Logout";
   }
-  SbS_Render(p, zHeader);
-  SbS_Destroy(p);
+  SbS_Render(pInterp, zHeader);
 
   /* Generate the main menu and the submenu (if any) */
-  @ <div id="main-menu">
+  @ <div class="mainmenu">
   @ <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>
   }
@@ -108,11 +115,11 @@
     @ <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
   }
   @ </div>
   if( nSubmenu>0 ){
     int i;
-    @ <div id="sub-menu">
+    @ <div class="submenu">
     qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
     for(i=0; i<nSubmenu; i++){
       struct Submenu *p = &aSubmenu[i];
       if( p->zLink==0 ){
         @ <span class="label">%h(p->zLabel)</span>
@@ -120,126 +127,176 @@
         @ <a class="label" href="%s(p->zLink)">%h(p->zLabel)</a>
       }
     }
     @ </div>
   }
-  @ <div id="page">
+  @ <div class="content">
   g.cgiPanic = 1;
 }
 
 /*
 ** Draw the footer at the bottom of the page.
 */
 void style_footer(void){
-  /* end the <div id="page"> from style_header() */
+  const char *zFooter = db_get("footer", (char*)zDefaultFooter);
   @ </div>
-  @ <div id="style-footer">
-  @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
-  @ </div>
+  SbS_Render(pInterp, zFooter);
+  SbS_Destroy(pInterp);
 }
 
+/* @-comment: // */
 /*
 ** The default page header.
 */
 const char zDefaultHeader[] =
 @ <html>
 @ <head>
-@ <title>Edit CSS</title>
+@ <title>[project_name html]: [title html]</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 class="header">
+@   <div class="logo">
+@     <!-- <img src="logo.gif" alt="logo"><br></br> -->
+@     <nobr>[project_name html]</nobr>
+@   </div>
+@   <div class="title">[title html]</div>
+@   <div class="status"><nobr>
+@     [login exists enable_output]     Logged in as [0 /login get html]
+@     [login exists not enable_output] Not logged in
+@     [1 enable_output]
+@   </nobr></div>
+@ </div>
+;
+
+/*
+** The default page footer
+*/
+const char zDefaultFooter[] =
+@ <div class="footer">
+@ Fossil version [manifest_version puts] [manifest_date puts]
 @ </div>
+@ </body></html>
 ;
 
 /*
 ** The default Cascading Style Sheet.
-**
-** Selector order: tags, ids, classes, other
-** Content order: margin, borders, padding, fonts, colors, other
-** Note: Once things are finialize a bit we can collapse this and
-**       make it much smaller, if necessary. Right now, it's verbose
-**       but easy to edit.
 */
 const char zDefaultCSS[] =
+@ /* General settings for the entire page */
 @ body {
-@   margin: 0px;
+@   margin: 0ex 1ex;
 @   padding: 0px;
 @   background-color: white;
-@ }
-@ #page-title {
-@   padding: 10px 10px 10px 10px;
-@   font-size: 1.8em;
+@   font-family: "sans serif";
+@ }
+@
+@ /* The project logo in the upper left-hand corner of each page */
+@ div.logo {
+@   display: table-cell;
+@   text-align: center;
+@   vertical-align: bottom;
+@   font-weight: bold;
+@   color: #558195;
+@ }
+@
+@ /* The page title centered at the top of each page */
+@ div.title {
+@   display: table-cell;
+@   font-size: 2em;
 @   font-weight: bold;
-@   background-color: #6a7ec7;
-@   color: #0a1e67;
+@   text-align: center;
+@   color: #558195;
+@   vertical-align: bottom;
+@   width: 100%;
 @ }
-@ #login-status {
-@   padding: 0px 10px 10px 0px;
-@   font-size: 0.9em;
+@
+@ /* The login status message in the top right-hand corner */
+@ div.status {
+@   display: table-cell;
 @   text-align: right;
-@   background-color: #6a7ec7;
-@   color: white;
-@   position: absolute;
-@   top: 10;
-@   right: 0;
+@   vertical-align: bottom;
+@   color: #558195;
+@   font-size: 0.8em;
+@   font-weight: bold;
+@ }
+@
+@ /* The header across the top of the page */
+@ div.header {
+@   display: table;
+@   width: 100%;
 @ }
-@ #main-menu {
+@
+@ /* The main menu bar that appears at the top of the page beneath
+@ ** the header */
+@ div.mainmenu {
 @   padding: 5px 10px 5px 10px;
 @   font-size: 0.9em;
 @   font-weight: bold;
 @   text-align: center;
 @   letter-spacing: 1px;
-@   background-color: #414f84;
+@   background-color: #558195;
 @   color: white;
 @ }
-@ #sub-menu {
+@
+@ /* The submenu bar that *sometimes* appears below the main menu */
+@ div.submenu {
 @   padding: 3px 10px 3px 0px;
 @   font-size: 0.9em;
 @   text-align: center;
-@   background-color: #414f84;
+@   background-color: #456878;
 @   color: white;
 @ }
-@ #main-menu a, #main-menu a:visited, #sub-menu a, #sub-menu a:visited {
+@ div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited {
 @   padding: 3px 10px 3px 10px;
 @   color: white;
+@   text-decoration: none;
 @ }
-@ #main-menu a:hover, #sub-menu a:hover {
-@   color: #414f84;
+@ div.mainmenu a:hover, div.submenu a:hover {
+@   color: #558195;
 @   background-color: white;
 @ }
-@ #page {
-@   padding: 10px 20px 10px 20px;
+@
+@ /* All page content from the bottom of the menu or submenu down to
+@ ** the footer */
+@ div.content {
+@   padding: 0ex 1ex 0ex 2ex;
+@ }
+@
+@ /* Some pages have section dividers */
+@ div.section {
+@   margin-bottom: 0px;
+@   margin-top: 1em;
+@   padding: 1px 1px 1px 1px;
+@   font-size: 1.2em;
+@   font-weight: bold;
+@   background-color: #558195;
+@   color: white;
+@ }
+@
+@ /* The "Date" that occurs on the left hand side of timelines */
+@ div.divider {
+@   background: #a1c4d4;
+@   border: 2px #558195 solid;
+@   font-size: 1em; font-weight: normal;
+@   padding: .25em;
+@   margin: .2em 0 .2em 0;
+@   float: left;
+@   clear: left;
 @ }
-@ #style-footer {
+@
+@ /* The footer at the very bottom of the page */
+@ div.footer {
 @   font-size: 0.8em;
 @   margin-top: 12px;
 @   padding: 5px 10px 5px 10px;
 @   text-align: right;
-@   background-color: #414f84;
-@   color: white;
-@ }
-@ table.label-value th {
-@   text-align: right;
-@   vertical-align: top;
-@ }
-@ div.section-title {
-@   margin-bottom: 0px;
-@   padding: 1px 1px 1px 1px;
-@   font-size: 1.2em;
-@   font-weight: bold;
-@   background-color: #6a7ec7;
-@   color: #0a1e67;
+@   background-color: #558195;
+@   color: white;
 @ }
 ;
 
 /*
 ** WEBPAGE: style.css
@@ -246,16 +303,12 @@
 */
 void page_style_css(void){
   char *zCSS = 0;
 
   cgi_set_content_type("text/css");
-  zCSS = db_get("css",0);
-  if( zCSS ){
-    cgi_append_content(zCSS, -1);
-  }else{
-    cgi_append_content(zDefaultCSS, -1);
-  }
+  zCSS = db_get("css",(char*)zDefaultCSS);
+  cgi_append_content(zCSS, -1);
 }
 
 /*
 ** WEBPAGE: test_env
 */

Modified src/subscript.c from [1ea8902693] to [fb8956976f].

@@ -112,11 +112,11 @@
 typedef struct SbsHashEntry SbsHashEntry;
 struct SbsHashEntry {
   SbsHashEntry *pNext;     /* Next entry with the same hash on zKey */
   SbSValue val;            /* The payload */
   int nKey;               /* Length of the key */
-  char zKey[0];           /* The key */
+  char zKey[1];           /* The key */
 };
 
 /*
 ** A hash table is an instance of the following structure.
 */
@@ -383,20 +383,22 @@
 */
 int SbS_Store(
   struct Subscript *p,   /* Store into this interpreter */
   const char *zName,     /* Name of the variable */
   const char *zValue,    /* Value of the variable */
-  int makeCopy           /* If true, interpreter makes its own copy */
+  int persistence        /* 0: static.  1: ephemeral.  2: dynamic */
 ){
   SbSValue v;
   v.flags = SBSVAL_STR;
   v.u.str.size = strlen(zValue);
-  if( makeCopy ){
-    v.u.str.z = mprintf("%s", zValue);
-    v.flags |= SBSVAL_DYN;
+  if( persistence==1 ){
+    v.u.str.z = mprintf("%s", zValue);
   }else{
     v.u.str.z = (char*)zValue;
+  }
+  if( persistence>0 ){
+    v.flags |= SBSVAL_DYN;
   }
   return sbs_store(&p->symTab, zName, -1, &v);
 }
 
 /*

Modified src/timeline.c from [4abc5a4987] to [088a229b70].

@@ -129,16 +129,11 @@
       xCallback(rid, pArg);
     }
     if( memcmp(zDate, zPrevDate, 10) ){
       sprintf(zPrevDate, "%.10s", zDate);
       @ <tr><td colspan=3>
-      @ <table cellpadding=2 border=0>
-      @ <tr><td bgcolor="#a0b5f4" class="border1">
-      @ <table cellpadding=2 cellspacing=0 border=0><tr>
-      @ <td bgcolor="#d0d9f4" class="bkgnd1">%s(zPrevDate)</td>
-      @ </tr></table>
-      @ </td></tr></table>
+      @   <div class="divider">%s(zPrevDate)</div>
       @ </td></tr>
     }
     @ <tr>
     @ <td valign="top">%s(&zDate[11])</td>
     @ <td width="20" align="center" valign="top">