Diff
Not logged in

Differences From:

File src/setup.c part of check-in [929d28e358] - Added the "e" capability for viewing ticket submitter email addresses. Additional tinkering toward the design of tickets. This check-in is only thinly tested. by drh on 2007-11-05 02:42:58. [view]

To:

File src/setup.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]

@@ -68,10 +68,12 @@
   setup_menu_entry("Configuration", "setup_config",
     "Configure the WWW components of the repository");
   setup_menu_entry("Tickets", "tktsetup",
     "Configure the trouble-ticketing system for this repository");
-  setup_menu_entry("CSS", "editcss",
+  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");
   @ </dl>
 
   style_footer();
 }
@@ -480,19 +482,21 @@
   const char *zLabel,   /* The text label on the textarea */
   int rows,             /* Rows in the textarea */
   int cols,             /* Columns in the textarea */
   const char *zVar,     /* The corresponding row in the VAR table */
-  const char *zQParm,   /* The query parameter */
+  const char *zQP,      /* The query parameter */
   char *zDflt           /* Default value if VAR table entry does not exist */
 ){
-  const char *zVal = db_get(zVar, zDflt);
-  const char *zQ = P(zQParm);
-  if( zQ && strcmp(zQ,zVal)!=0 ){
+  const char *z = db_get(zVar, zDflt);
+  const char *zQ = P(zQP);
+  if( zQ && strcmp(zQ,z)!=0 ){
     db_set(zVar, zQ, 0);
-    zVal = zQ;
+    z = zQ;
   }
-  @ <textarea name="%s(zQParm)" rows="%d(rows)" cols="%d(cols)">%h(zVal)</textarea>
-  @ %s(zLabel)
+  if( rows>0 && cols>0 ){
+    @ <textarea name="%s(zQP)" rows="%d(rows)" cols="%d(cols)">%h(z)</textarea>
+    @ %s(zLabel)
+  }
 }
 
 
 /*
@@ -551,9 +555,10 @@
   entry_attribute("Project Name", 60, "project-name", "pn", "");
   @ <p>Give your project a name so visitors know what this site is about.
   @ The project name will also be used as the RSS feed title.</p>
   @ <hr />
-  textarea_attribute("Project Description", 5, 60, "project-description", "pd", "");
+  textarea_attribute("Project Description", 5, 60,
+                     "project-description", "pd", "");
   @ <p>Describe your project. This will be used in page headers for search
   @ engines as well as a short RSS description.</p>
   @ <hr />
   @ <p><input type="submit"  name="submit" value="Apply Changes"></p>
@@ -562,20 +567,58 @@
   style_footer();
 }
 
 /*
-** WEBPAGE: editcss
+** WEBPAGE: setup_editcss
 */
 void setup_editcss(void){
   login_check_credentials();
   if( !g.okSetup ){
     login_needed();
   }
   style_header("Edit CSS");
-  @ <form action="%s(g.zBaseURL)/editcss" method="POST">
+  @ <form action="%s(g.zBaseURL)/setup_editcss" method="POST">
   @ Edit the CSS:<br />
   textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
   @ <br />
   @ <input type="submit" name="submit" value="Apply Changes">
   @ </form>
+  @ <hr>
+  @ Here is the default CSS:
+  @ <blockquote><pre>
+  @ %h(zDefaultCSS)
+  @ </pre></blockquote>
   style_footer();
+}
+
+/*
+** WEBPAGE: setup_header
+*/
+void setup_header(void){
+  login_check_credentials();
+  if( !g.okSetup ){
+    login_needed();
+  }
+  db_begin_transaction();
+  if( P("clear")!=0 ){
+    db_multi_exec("DELETE FROM config WHERE name='header'");
+    cgi_replace_parameter("header", zDefaultHeader);
+  }else{
+    textarea_attribute(0, 0, 0, "header", "header", zDefaultHeader);
+  }
+  style_header("Edit Page Header");
+  @ <form action="%s(g.zBaseURL)/setup_header" method="POST">
+  @ <p>Edit HTML text with embedded subscript that will be used to
+  @ generate the beginning of every page through start of the main
+  @ menu.</p>
+  textarea_attribute("", 40, 80, "header", "header", zDefaultHeader);
+  @ <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 header:
+  @ <blockquote><pre>
+  @ %h(zDefaultHeader)
+  @ </pre></blockquote>
+  db_end_transaction(0);
 }