Changes On Branch th1-css
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch th1-css Excluding Merge-Ins

This is equivalent to a diff from a1e667e6b5 to d1b68cc0f3

2012-01-05
13:09
Merge the trunk changes into the retro-sbsdiff branch. check-in: 4b432961ac user: drh tags: retro-sbsdiff
2012-01-04
18:29
Process the style sheet using TH1 prior to returning it. This branch is experimental. Leaf check-in: d1b68cc0f3 user: drh tags: th1-css
2012-01-01
15:57
Simplified display of side-by-side diff in the web browser. check-in: a1e667e6b5 user: drh tags: retro-sbsdiff
2011-12-31
12:51
Escape the contact information for users when displaying. check-in: a3e625e954 user: drh tags: trunk

Changes to src/report.c.

    25     25   #  include "cson_amalgamation.h"
    26     26   #endif
    27     27   
    28     28   /* Forward references to static routines */
    29     29   static void report_format_hints(void);
    30     30   
    31     31   /*
    32         -** WEBPAGE: /reportlist
           32  +** WEBPAGE: reportlist
    33     33   */
    34     34   void view_list(void){
    35     35     const char *zScript;
    36     36     Blob ril;   /* Report Item List */
    37     37     Stmt q;
    38     38     int rn = 0;
    39     39     int cnt = 0;
................................................................................
   265    265       sqlite3_finalize(pStmt);
   266    266     }
   267    267     report_unrestrict_sql();
   268    268     return zErr;
   269    269   }
   270    270   
   271    271   /*
   272         -** WEBPAGE: /rptsql
          272  +** WEBPAGE: rptsql
   273    273   */
   274    274   void view_see_sql(void){
   275    275     int rn;
   276    276     const char *zTitle;
   277    277     const char *zSQL;
   278    278     const char *zOwner;
   279    279     const char *zClrKey;
................................................................................
   311    311     @ </td>
   312    312     @ </tr></table>
   313    313     report_format_hints();
   314    314     style_footer();
   315    315   }
   316    316   
   317    317   /*
   318         -** WEBPAGE: /rptnew
   319         -** WEBPAGE: /rptedit
          318  +** WEBPAGE: rptnew
          319  +** WEBPAGE: rptedit
   320    320   */
   321    321   void view_edit(void){
   322    322     int rn;
   323    323     const char *zTitle;
   324    324     const char *z;
   325    325     const char *zOwner;
   326    326     const char *zClrKey;
................................................................................
   889    889     rc = sqlite3_finalize(pStmt);
   890    890     fossil_free(azVals);
   891    891     return rc;
   892    892   }
   893    893   
   894    894   
   895    895   /*
   896         -** WEBPAGE: /rptview
          896  +** WEBPAGE: rptview
   897    897   **
   898    898   ** Generate a report.  The rn query parameter is the report number
   899    899   ** corresponding to REPORTFMT.RN.  If the tablist query parameter exists,
   900    900   ** then the output consists of lines of tab-separated fields instead of
   901    901   ** an HTML table.
   902    902   */
   903    903   void rptview_page(void){
................................................................................
  1139   1139     report_restrict_sql(&zErr1);
  1140   1140     sqlite3_exec_readonly(g.db, zSql, output_separated_file, &count, &zErr2);
  1141   1141     report_unrestrict_sql();
  1142   1142     if( zFilter ){
  1143   1143       free(zSql);
  1144   1144     }
  1145   1145   }
  1146         -

Changes to src/setup.c.

    46     46     }else{
    47     47       @ %h(zTitle)
    48     48     }
    49     49     @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
    50     50   }
    51     51   
    52     52   /*
    53         -** WEBPAGE: /setup
           53  +** WEBPAGE: setup
    54     54   */
    55     55   void setup_page(void){
    56     56     login_check_credentials();
    57     57     if( !g.perm.Setup ){
    58     58       login_needed();
    59     59     }
    60     60   
................................................................................
   239    239     if( zPw==0 ) return 0;
   240    240     if( zPw[0]==0 ) return 1;
   241    241     while( zPw[0]=='*' ){ zPw++; }
   242    242     return zPw[0]!=0;
   243    243   }
   244    244   
   245    245   /*
   246         -** WEBPAGE: /setup_uedit
          246  +** WEBPAGE: setup_uedit
   247    247   */
   248    248   void user_edit(void){
   249    249     const char *zId, *zLogin, *zInfo, *zCap, *zPw;
   250    250     char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap;
   251    251     char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae;
   252    252     char *oat, *oau, *oav, *oab, *oax, *oaz;
   253    253     const char *zGroup;

Changes to src/style.c.

    83     83     char *zTitle;
    84     84     const char *zHeader = db_get("header", (char*)zDefaultHeader);  
    85     85     login_check_credentials();
    86     86   
    87     87     va_start(ap, zTitleFormat);
    88     88     zTitle = vmprintf(zTitleFormat, ap);
    89     89     va_end(ap);
    90         -  
           90  +
    91     91     cgi_destination(CGI_HEADER);
    92     92     cgi_printf("%s","<!DOCTYPE html>");
    93     93     
    94     94     if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);
    95     95   
    96     96     /* Generate the header up through the main menu */
    97     97     Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
    98     98     Th_Store("title", zTitle);
    99     99     Th_Store("baseurl", g.zBaseURL);
   100    100     Th_Store("home", g.zTop);
   101    101     Th_Store("index_page", db_get("index-page","/home"));
   102    102     Th_Store("current_page", g.zPath);
          103  +  Th_Store("stylesheet", db_get("style-stylesheet", "style.css"));
   103    104     Th_Store("release_version", RELEASE_VERSION);
   104    105     Th_Store("manifest_version", MANIFEST_VERSION);
   105    106     Th_Store("manifest_date", MANIFEST_DATE);
   106    107     Th_Store("compiler_name", COMPILER_NAME);
   107    108     if( g.zLogin ){
   108    109       Th_Store("login", g.zLogin);
   109    110     }
................................................................................
   191    192   */
   192    193   const char zDefaultHeader[] = 
   193    194   @ <html>
   194    195   @ <head>
   195    196   @ <title>$<project_name>: $<title></title>
   196    197   @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
   197    198   @       href="$home/timeline.rss" />
   198         -@ <link rel="stylesheet" href="$home/style.css?default" type="text/css"
          199  +@ <link rel="stylesheet" href="$home/$stylesheet" type="text/css"
   199    200   @       media="screen" />
   200    201   @ </head>
   201    202   @ <body>
   202    203   @ <div class="header">
   203    204   @   <div class="logo">
   204    205   @     <img src="$home/logo" alt="logo" />
   205    206   @   </div>
................................................................................
   696    697       @ **  to the header and configure the java script file with
   697    698       @ **   1. use as bindClass :checkinUserColor
   698    699       @ **   2. change the default hash adding behaviour to ON
   699    700       @ ** or change the class defition of element identified by id="clrcust"
   700    701       @ ** to a standard jscolor definition with java script in the footer. */
   701    702     },
   702    703     { "div.endContent",
   703         -    "format for end of content area, to be used to clear page flow(sidebox on branch,..",
          704  +    "format for end of content area, to be used to clear "
          705  +    "page flow(sidebox on branch,..",
   704    706       @   clear: both;
   705    707     },
   706    708     { "p.generalError",
   707    709       "format for general errors",
   708    710       @   color: red;
   709    711     },
   710    712     { "p.tktsetupError",
................................................................................
   773    775   		);
   774    776       }
   775    777     }
   776    778   }
   777    779   
   778    780   /*
   779    781   ** WEBPAGE: style.css
          782  +** WEBPAGE: style
          783  +**
          784  +** The first form (style.css) is the default.  The second form (style) is
          785  +** intended to be used with a query path (ex: style/76a6de45.css) where the
          786  +** extra suffix (the "76a6de45.css") is a randomly-generated name that 
          787  +** changes every time the style sheet changes.  Changing the name causes
          788  +** the style-sheet to be reloaded by the web browser.
   780    789   */
   781    790   void page_style_css(void){
   782         -  const char *zCSS    = 0;
          791  +  const char *zCSS;
   783    792     int i;
          793  +  Blob css;
          794  +  Stmt q;
   784    795   
          796  +  /* The mime-type for CSS */
   785    797     cgi_set_content_type("text/css");
   786         -  zCSS = db_get("css",(char*)zDefaultCSS);
   787         -  /* append user defined css */
   788         -  cgi_append_content(zCSS, -1);
   789         -  /* add special missing definitions */
          798  +
          799  +  /* Content is cacheable */
          800  +  g.isConst = 1;
          801  +
          802  +  /* Initialize TH1 variables that can appear in the stylesheet
          803  +  ** template.
          804  +  */
          805  +  db_prepare(&q, "SELECT substr(name,7), value FROM config"
          806  +                 " WHERE name GLOB 'style-*');
          807  +  while( db_step(&q)==SQLITE_ROW ){
          808  +    Th_Store(db_column_text(&q,0), db_column_text(&q,1));
          809  +  }
          810  +  db_finalize(&q);
          811  +
          812  +  /* Construct the CSS text */
          813  +  blob_init(&css, db_get("css", (char*)zDefaultCSS), -1);
   790    814     for (i=1;cssDefaultList[i].elementClass;i++)
   791    815       if (!strstr(zCSS,cssDefaultList[i].elementClass)) {
   792         -      cgi_append_content("/* ", -1);
   793         -      cgi_append_content(cssDefaultList[i].comment, -1);
   794         -      cgi_append_content(" */\n", -1);
   795         -      cgi_append_content(cssDefaultList[i].elementClass, -1);
   796         -      cgi_append_content(" {\n", -1);
   797         -      cgi_append_content(cssDefaultList[i].value, -1);
   798         -      cgi_append_content("}\n\n", -1);
          816  +      blob_appendf(&css, "/* %s */\n%s {\n%s}\n\n",
          817  +           cssDefaultList[i].comment,
          818  +           cssDefaultList[i].elementClass,
          819  +           cssDefaultList[i].value);
   799    820       }
   800         -  g.isConst = 1;
          821  +  }
          822  +
          823  +  /* Render the CSS */
          824  +  Th_Render(blob_str(&css));
   801    825   }
   802    826   
   803    827   /*
   804    828   ** WEBPAGE: test_env
   805    829   */
   806    830   void page_test_env(void){
   807    831     char c;

Changes to src/tag.c.

   521    521     return;
   522    522   
   523    523   tag_cmd_usage:
   524    524     usage("add|cancel|find|list ...");
   525    525   }
   526    526   
   527    527   /*
   528         -** WEBPAGE: /taglist
          528  +** WEBPAGE: taglist
   529    529   */
   530    530   void taglist_page(void){
   531    531     Stmt q;
   532    532   
   533    533     login_check_credentials();
   534    534     if( !g.perm.Read ){
   535    535       login_needed();
................................................................................
   559    559     }
   560    560     @ </ul>
   561    561     db_finalize(&q);
   562    562     style_footer();
   563    563   }
   564    564   
   565    565   /*
   566         -** WEBPAGE: /tagtimeline
          566  +** WEBPAGE: tagtimeline
   567    567   */
   568    568   void tagtimeline_page(void){
   569    569     Stmt q;
   570    570   
   571    571     login_check_credentials();
   572    572     if( !g.perm.Read ){ login_needed(); return; }
   573    573