Fossil

Check-in [d1b68cc0f3]
Login

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

Overview
Comment:Process the style sheet using TH1 prior to returning it. This branch is experimental.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | th1-css
Files: files | file ages | folders
SHA1: d1b68cc0f3c29a63572dc92a0c5ad2e8798cfc78
User & Date: drh 2012-01-04 18:29:39.854
Context
2012-01-04
18:29
Process the style sheet using TH1 prior to returning it. This branch is experimental. ... (Closed-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)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/report.c.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#  include "cson_amalgamation.h"
#endif

/* Forward references to static routines */
static void report_format_hints(void);

/*
** WEBPAGE: /reportlist
*/
void view_list(void){
  const char *zScript;
  Blob ril;   /* Report Item List */
  Stmt q;
  int rn = 0;
  int cnt = 0;







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#  include "cson_amalgamation.h"
#endif

/* Forward references to static routines */
static void report_format_hints(void);

/*
** WEBPAGE: reportlist
*/
void view_list(void){
  const char *zScript;
  Blob ril;   /* Report Item List */
  Stmt q;
  int rn = 0;
  int cnt = 0;
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
    sqlite3_finalize(pStmt);
  }
  report_unrestrict_sql();
  return zErr;
}

/*
** WEBPAGE: /rptsql
*/
void view_see_sql(void){
  int rn;
  const char *zTitle;
  const char *zSQL;
  const char *zOwner;
  const char *zClrKey;







|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
    sqlite3_finalize(pStmt);
  }
  report_unrestrict_sql();
  return zErr;
}

/*
** WEBPAGE: rptsql
*/
void view_see_sql(void){
  int rn;
  const char *zTitle;
  const char *zSQL;
  const char *zOwner;
  const char *zClrKey;
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
  @ </td>
  @ </tr></table>
  report_format_hints();
  style_footer();
}

/*
** WEBPAGE: /rptnew
** WEBPAGE: /rptedit
*/
void view_edit(void){
  int rn;
  const char *zTitle;
  const char *z;
  const char *zOwner;
  const char *zClrKey;







|
|







311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
  @ </td>
  @ </tr></table>
  report_format_hints();
  style_footer();
}

/*
** WEBPAGE: rptnew
** WEBPAGE: rptedit
*/
void view_edit(void){
  int rn;
  const char *zTitle;
  const char *z;
  const char *zOwner;
  const char *zClrKey;
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
  rc = sqlite3_finalize(pStmt);
  fossil_free(azVals);
  return rc;
}


/*
** WEBPAGE: /rptview
**
** Generate a report.  The rn query parameter is the report number
** corresponding to REPORTFMT.RN.  If the tablist query parameter exists,
** then the output consists of lines of tab-separated fields instead of
** an HTML table.
*/
void rptview_page(void){







|







889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
  rc = sqlite3_finalize(pStmt);
  fossil_free(azVals);
  return rc;
}


/*
** WEBPAGE: rptview
**
** Generate a report.  The rn query parameter is the report number
** corresponding to REPORTFMT.RN.  If the tablist query parameter exists,
** then the output consists of lines of tab-separated fields instead of
** an HTML table.
*/
void rptview_page(void){
1139
1140
1141
1142
1143
1144
1145
1146
  report_restrict_sql(&zErr1);
  sqlite3_exec_readonly(g.db, zSql, output_separated_file, &count, &zErr2);
  report_unrestrict_sql();
  if( zFilter ){
    free(zSql);
  }
}








<
1139
1140
1141
1142
1143
1144
1145

  report_restrict_sql(&zErr1);
  sqlite3_exec_readonly(g.db, zSql, output_separated_file, &count, &zErr2);
  report_unrestrict_sql();
  if( zFilter ){
    free(zSql);
  }
}

Changes to src/setup.c.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  }else{
    @ %h(zTitle)
  }
  @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
}

/*
** WEBPAGE: /setup
*/
void setup_page(void){
  login_check_credentials();
  if( !g.perm.Setup ){
    login_needed();
  }








|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  }else{
    @ %h(zTitle)
  }
  @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
}

/*
** WEBPAGE: setup
*/
void setup_page(void){
  login_check_credentials();
  if( !g.perm.Setup ){
    login_needed();
  }

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
  if( zPw==0 ) return 0;
  if( zPw[0]==0 ) return 1;
  while( zPw[0]=='*' ){ zPw++; }
  return zPw[0]!=0;
}

/*
** WEBPAGE: /setup_uedit
*/
void user_edit(void){
  const char *zId, *zLogin, *zInfo, *zCap, *zPw;
  char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap;
  char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae;
  char *oat, *oau, *oav, *oab, *oax, *oaz;
  const char *zGroup;







|







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
  if( zPw==0 ) return 0;
  if( zPw[0]==0 ) return 1;
  while( zPw[0]=='*' ){ zPw++; }
  return zPw[0]!=0;
}

/*
** WEBPAGE: setup_uedit
*/
void user_edit(void){
  const char *zId, *zLogin, *zInfo, *zCap, *zPw;
  char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap;
  char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae;
  char *oat, *oau, *oav, *oab, *oax, *oaz;
  const char *zGroup;
Changes to src/style.c.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

103
104
105
106
107
108
109
  char *zTitle;
  const char *zHeader = db_get("header", (char*)zDefaultHeader);  
  login_check_credentials();

  va_start(ap, zTitleFormat);
  zTitle = vmprintf(zTitleFormat, ap);
  va_end(ap);
  
  cgi_destination(CGI_HEADER);
  cgi_printf("%s","<!DOCTYPE html>");
  
  if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);

  /* Generate the header up through the main menu */
  Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
  Th_Store("title", zTitle);
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("home", g.zTop);
  Th_Store("index_page", db_get("index-page","/home"));
  Th_Store("current_page", g.zPath);

  Th_Store("release_version", RELEASE_VERSION);
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  Th_Store("compiler_name", COMPILER_NAME);
  if( g.zLogin ){
    Th_Store("login", g.zLogin);
  }







|












>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  char *zTitle;
  const char *zHeader = db_get("header", (char*)zDefaultHeader);  
  login_check_credentials();

  va_start(ap, zTitleFormat);
  zTitle = vmprintf(zTitleFormat, ap);
  va_end(ap);

  cgi_destination(CGI_HEADER);
  cgi_printf("%s","<!DOCTYPE html>");
  
  if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);

  /* Generate the header up through the main menu */
  Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
  Th_Store("title", zTitle);
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("home", g.zTop);
  Th_Store("index_page", db_get("index-page","/home"));
  Th_Store("current_page", g.zPath);
  Th_Store("stylesheet", db_get("style-stylesheet", "style.css"));
  Th_Store("release_version", RELEASE_VERSION);
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  Th_Store("compiler_name", COMPILER_NAME);
  if( g.zLogin ){
    Th_Store("login", g.zLogin);
  }
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
*/
const char zDefaultHeader[] = 
@ <html>
@ <head>
@ <title>$<project_name>: $<title></title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@       href="$home/timeline.rss" />
@ <link rel="stylesheet" href="$home/style.css?default" type="text/css"
@       media="screen" />
@ </head>
@ <body>
@ <div class="header">
@   <div class="logo">
@     <img src="$home/logo" alt="logo" />
@   </div>







|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
*/
const char zDefaultHeader[] = 
@ <html>
@ <head>
@ <title>$<project_name>: $<title></title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@       href="$home/timeline.rss" />
@ <link rel="stylesheet" href="$home/$stylesheet" type="text/css"
@       media="screen" />
@ </head>
@ <body>
@ <div class="header">
@   <div class="logo">
@     <img src="$home/logo" alt="logo" />
@   </div>
696
697
698
699
700
701
702
703

704
705
706
707
708
709
710
    @ **  to the header and configure the java script file with
    @ **   1. use as bindClass :checkinUserColor
    @ **   2. change the default hash adding behaviour to ON
    @ ** or change the class defition of element identified by id="clrcust"
    @ ** to a standard jscolor definition with java script in the footer. */
  },
  { "div.endContent",
    "format for end of content area, to be used to clear page flow(sidebox on branch,..",

    @   clear: both;
  },
  { "p.generalError",
    "format for general errors",
    @   color: red;
  },
  { "p.tktsetupError",







|
>







697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
    @ **  to the header and configure the java script file with
    @ **   1. use as bindClass :checkinUserColor
    @ **   2. change the default hash adding behaviour to ON
    @ ** or change the class defition of element identified by id="clrcust"
    @ ** to a standard jscolor definition with java script in the footer. */
  },
  { "div.endContent",
    "format for end of content area, to be used to clear "
    "page flow(sidebox on branch,..",
    @   clear: both;
  },
  { "p.generalError",
    "format for general errors",
    @   color: red;
  },
  { "p.tktsetupError",
773
774
775
776
777
778
779







780
781
782
783


784

785
786
787

788









789


790
791
792
793
794
795
796
797
798
799

800


801
802
803
804
805
806
807
		);
    }
  }
}

/*
** WEBPAGE: style.css







*/
void page_style_css(void){
  const char *zCSS    = 0;
  int i;




  cgi_set_content_type("text/css");
  zCSS = db_get("css",(char*)zDefaultCSS);
  /* append user defined css */

  cgi_append_content(zCSS, -1);









  /* add special missing definitions */


  for (i=1;cssDefaultList[i].elementClass;i++)
    if (!strstr(zCSS,cssDefaultList[i].elementClass)) {
      cgi_append_content("/* ", -1);
      cgi_append_content(cssDefaultList[i].comment, -1);
      cgi_append_content(" */\n", -1);
      cgi_append_content(cssDefaultList[i].elementClass, -1);
      cgi_append_content(" {\n", -1);
      cgi_append_content(cssDefaultList[i].value, -1);
      cgi_append_content("}\n\n", -1);
    }

  g.isConst = 1;


}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){
  char c;







>
>
>
>
>
>
>


|

>
>

>

|
|
>
|
>
>
>
>
>
>
>
>
>
|
>
>


|
|
<
|
<
|
<

>
|
>
>







775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817

818

819

820
821
822
823
824
825
826
827
828
829
830
831
		);
    }
  }
}

/*
** WEBPAGE: style.css
** WEBPAGE: style
**
** The first form (style.css) is the default.  The second form (style) is
** intended to be used with a query path (ex: style/76a6de45.css) where the
** extra suffix (the "76a6de45.css") is a randomly-generated name that 
** changes every time the style sheet changes.  Changing the name causes
** the style-sheet to be reloaded by the web browser.
*/
void page_style_css(void){
  const char *zCSS;
  int i;
  Blob css;
  Stmt q;

  /* The mime-type for CSS */
  cgi_set_content_type("text/css");

  /* Content is cacheable */
  g.isConst = 1;

  /* Initialize TH1 variables that can appear in the stylesheet
  ** template.
  */
  db_prepare(&q, "SELECT substr(name,7), value FROM config"
                 " WHERE name GLOB 'style-*');
  while( db_step(&q)==SQLITE_ROW ){
    Th_Store(db_column_text(&q,0), db_column_text(&q,1));
  }
  db_finalize(&q);

  /* Construct the CSS text */
  blob_init(&css, db_get("css", (char*)zDefaultCSS), -1);
  for (i=1;cssDefaultList[i].elementClass;i++)
    if (!strstr(zCSS,cssDefaultList[i].elementClass)) {
      blob_appendf(&css, "/* %s */\n%s {\n%s}\n\n",
           cssDefaultList[i].comment,

           cssDefaultList[i].elementClass,

           cssDefaultList[i].value);

    }
  }

  /* Render the CSS */
  Th_Render(blob_str(&css));
}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){
  char c;
Changes to src/tag.c.
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
  return;

tag_cmd_usage:
  usage("add|cancel|find|list ...");
}

/*
** WEBPAGE: /taglist
*/
void taglist_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){
    login_needed();







|







521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
  return;

tag_cmd_usage:
  usage("add|cancel|find|list ...");
}

/*
** WEBPAGE: taglist
*/
void taglist_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){
    login_needed();
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
  }
  @ </ul>
  db_finalize(&q);
  style_footer();
}

/*
** WEBPAGE: /tagtimeline
*/
void tagtimeline_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(); return; }








|







559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
  }
  @ </ul>
  db_finalize(&q);
  style_footer();
}

/*
** WEBPAGE: tagtimeline
*/
void tagtimeline_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(); return; }