Check-in [8ffd32c2b7]
Not logged in
Overview

SHA1 Hash:8ffd32c2b7ff83e4d4071d0ad785c67311433d1c
Date: 2007-10-28 20:52:52
User: drh
Comment:Add the ability to edit the CSS for all pages in the Setup menu. Other miscellaneous changes toward getting ticketing to work.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/setup.c from [9f35614dc3] to [44eafbc596].

@@ -67,10 +67,12 @@
     "Control access settings.");
   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",
+    "Edit the Cascading Style Sheet used by all pages of this repository");
   @ </dl>
 
   style_footer();
 }
 
@@ -538,24 +540,37 @@
   }
 
   style_header("WWW Configuration");
   db_begin_transaction();
   @ <form action="%s(g.zBaseURL)/setup_config" method="POST">
-
-  @ <hr />
-
+  @ <hr />
   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 />
-
+  @ <hr />
   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>
   @ </form>
   db_end_transaction(0);
+  style_footer();
+}
+
+/*
+** WEBPAGE: 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">
+  @ Edit the CSS:<br />
+  textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
+  @ <br />
+  @ <input type="submit" name="submit" value="Apply Changes">
+  @ </form>
   style_footer();
 }

Modified src/style.c from [43dff7bad0] to [dd33d05f02].

@@ -140,10 +140,90 @@
   @ <div id="style-footer">
   @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
   @ </div>
 }
 
+/*
+** 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[] =
+@ body {
+@   margin: 0px;
+@   padding: 0px;
+@   background-color: white;
+@ }
+@ #page-title {
+@   padding: 10px 10px 10px 10px;
+@   font-size: 1.8em;
+@   font-weight: bold;
+@   background-color: #6a7ec7;
+@   color: #0a1e67;
+@ }
+@ #login-status {
+@   padding: 0px 10px 10px 0px;
+@   font-size: 0.9em;
+@   text-align: right;
+@   background-color: #6a7ec7;
+@   color: white;
+@   position: absolute;
+@   top: 10;
+@   right: 0;
+@ }
+@ #main-menu {
+@   padding: 5px 10px 5px 10px;
+@   font-size: 0.9em;
+@   font-weight: bold;
+@   text-align: center;
+@   letter-spacing: 1px;
+@   background-color: #414f84;
+@   color: white;
+@ }
+@ #sub-menu {
+@   padding: 3px 10px 3px 0px;
+@   font-size: 0.9em;
+@   text-align: center;
+@   background-color: #414f84;
+@   color: white;
+@ }
+@ #main-menu a, #main-menu a:visited, #sub-menu a, #sub-menu a:visited {
+@   padding: 3px 10px 3px 10px;
+@   color: white;
+@ }
+@ #main-menu a:hover, #sub-menu a:hover {
+@   color: #414f84;
+@   background-color: white;
+@ }
+@ #page {
+@   padding: 10px 20px 10px 20px;
+@ }
+@ #style-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;
+@ }
+;
 
 /*
 ** WEBPAGE: style.css
 */
 void page_style_css(void){
@@ -152,87 +232,11 @@
   cgi_set_content_type("text/css");
   zCSS = db_get("css",0);
   if( zCSS ){
     cgi_append_content(zCSS, -1);
   }else{
-    /* No CSS file found, use our own */
-    /*
-    ** 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.
-    */
-    @ body {
-    @   margin: 0px;
-    @   padding: 0px;
-    @   background-color: white;
-    @ }
-    @ #page-title {
-    @   padding: 10px 10px 10px 10px;
-    @   font-size: 1.8em;
-    @   font-weight: bold;
-    @   background-color: #6a7ec7;
-    @   color: #0a1e67;
-    @ }
-    @ #login-status {
-    @   padding: 0px 10px 10px 0px;
-    @   font-size: 0.9em;
-    @   text-align: right;
-    @   background-color: #6a7ec7;
-    @   color: white;
-    @   position: absolute;
-    @   top: 10;
-    @   right: 0;
-    @ }
-    @ #main-menu {
-    @   padding: 5px 10px 5px 10px;
-    @   font-size: 0.9em;
-    @   font-weight: bold;
-    @   text-align: center;
-    @   letter-spacing: 1px;
-    @   background-color: #414f84;
-    @   color: white;
-    @ }
-    @ #sub-menu {
-    @   padding: 3px 10px 3px 0px;
-    @   font-size: 0.9em;
-    @   text-align: center;
-    @   background-color: #414f84;
-    @   color: white;
-    @ }
-    @ #main-menu a, #main-menu a:visited, #sub-menu a, #sub-menu a:visited {
-    @   padding: 3px 10px 3px 10px;
-    @   color: white;
-    @ }
-    @ #main-menu a:hover, #sub-menu a:hover {
-    @   color: #414f84;
-    @   background-color: white;
-    @ }
-    @ #page {
-    @   padding: 10px 20px 10px 20px;
-    @ }
-    @ #style-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;
-    @ }
+    cgi_append_content(zDefaultCSS, -1);
   }
 }
 
 /*
 ** WEBPAGE: test_env

Modified src/subscript.c from [dd44ba1520] to [ad67c7f9bb].

@@ -25,12 +25,33 @@
 **
 ** Subscript attempts to be an extremely light-weight scripting
 ** language.  It contains the barest of bare essentials.  It is
 ** stack-based and forth-like.  Everything is in a single global
 ** namespace.  There is only a single datatype of zero-terminated
-** string.  The stack is of fixed, limited depth.  The hash table
+** string.  The stack is of fixed, limited depth.  The symbal table
 ** is of a limited and fixed size.
+**
+** TOKENS:
+**
+**      *  All tokens are separated from each other by whitespace.
+**      *  Leading and trailing whitespace is ignored.
+**      *  Text within nested {...} is a single string token.  The outermost
+**         curly braces are not part of the token.
+**      *  An identifier with a leading "/" is a string token.
+**      *  A token that looks like a number is a string token.
+**      *  An identifier token is called a "verb".
+**
+** PROCESSING:
+**
+**      *  The input is divided into tokens.  Whitespace is discarded.
+**         String and verb tokens are passed into the engine.
+**      *  String tokens are pushed onto the stack.
+**      *  If a verb token corresponds to a procedure, that procedure is
+**         run.  The procedure might use, pop, or pull elements from
+**         the stack.
+**      *  If a verb token corresponds to a variable, the value of that
+**         variable is pushed onto the stack.
 **
 ** This module attempts to be completely self-contained so that it can
 ** be portable to other projects.
 */
 #include "config.h"
@@ -290,11 +311,11 @@
   p->aStack[p->nStack++] = *pVal;
   return SBS_OK;
 }
 
 /*
-** Destroy an underscore interpreter
+** Destroy an subscript interpreter
 */
 void SbS_Destroy(struct Subscript *p){
   int i;
   sbs_hash_reset(&p->symTab);
   for(i=0; i<p->nStack; i++){
@@ -514,11 +535,11 @@
   return 0;
 }
 
 
 /*
-** Create a new underscore interpreter
+** Create a new subscript interpreter
 */
 struct Subscript *SbS_Create(void){
   Subscript *p;
 
   p = malloc( sizeof(*p) );

Modified src/tkt.c from [5149f78c34] to [afc132298b].

@@ -141,11 +141,11 @@
   Stmt q;
   int i;
   char *zSep = "SELECT ";
   blob_zero(&sql);
   for(i=0; i<nField; i++){
-    blob_appendf(&sql, "%s%s", zSep, azField[i]);
+    blob_appendf(&sql, "%stkt_%s", zSep, azField[i]);
     zSep = ", ";
   }
   blob_appendf(" FROM ticket WHERE uuid=%Q", PD("name",""));
   db_prepare(&q, "%b", &sql);
   if( db_step(&q)==SQLITE_ROW ){
@@ -239,11 +239,13 @@
   pInterp = SbS_Create();
   SbS_AddVerb(pInterp, "setfields", setFieldsCmd, 0);
   zConfig = db_get("ticket-config","");
   SbS_Eval(pInter, zConfig, -1);
   for(i=0; i<sizeof(aVerb)/sizeof(aVerb[0]); i++){
-    SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);
+    if( flags & aVerb[i].mask ){
+      SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);
+    }
   }
   /* Extract appropriate template */
   return pInterp;
 }
 
@@ -254,10 +256,19 @@
   struct Subscript *pInterp;
   const char *zPage;
   int nPage;
 
   tkt_screen_init(M_NEW);
+  if( P("submit")!=0 ){
+    // * Construct the ticket artifact
+    //    + Prefix
+    //    + Field/Value pairs in sorted order
+    //    + Suffix
+    // * Register the artifact
+    // * Update the ticket table
+    // * redirect to the ticket viewer
+  }
   style_header("New Ticket");
   @ This will become a page for entering new tickets.
   style_footer();
 }
 
@@ -264,16 +275,41 @@
 /*
 ** PAGE: tktview
 ** URL: tktview?name=UUID
 **
 */
-void tktnew_page(void){
+void tktedit_page(void){
+  struct Subscript *pInterp;
+  const char *zPage;
+  int nPage;
+
+  tkt_screen_init(M_VIEW);
+  style_header("View Ticket");
+  @ This will become a page for entering new tickets.
+  style_footer();
+}
+
+/*
+** PAGE: tktedit
+** URL: tktedit?name=UUID
+**
+*/
+void tktedit_page(void){
   struct Subscript *pInterp;
   const char *zPage;
   int nPage;
 
-  tkt_screen_init(M_NEW);
-  style_header("New Ticket");
+  tkt_screen_init(M_EDIT);
+  if( P("submit") ){
+    // * Construct ticket change artifact
+    //   +  Prefix
+    //   +  Modified field/value pairs in sorted order
+    //   +  Suffix
+    // * Register the artifact
+    // * Update the ticket table
+    // * redirect to the ticket viewer
+  }
+  style_header("Edit Ticket");
   @ This will become a page for entering new tickets.
   style_footer();
 }
 #endif