Fossil

Check-in [286d4bca]
Login

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

Overview
Comment:'edit css' styled and made it pass HTML-Validator, optimized handling of additional styles in style.c
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wolfgangFormat2CSS
Files: files | file ages | folders
SHA1:286d4bcaa0fb8c641c8efbfc5fd84d695d8453e8
User & Date: wolfgang 2010-09-11 16:14:20
Context
2010-09-11
20:49
admin pages without errors in HTML validator check-in: a62bfaf5 user: wolfgang tags: wolfgangFormat2CSS
16:14
'edit css' styled and made it pass HTML-Validator, optimized handling of additional styles in style.c check-in: 286d4bca user: wolfgang tags: wolfgangFormat2CSS
13:11
merged improved stat page from trunk and slightly optimized style.c check-in: 7d08c20f user: wolfgang tags: wolfgangFormat2CSS
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/login.c.

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
  if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
    zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin);
    if( db_int(1, "SELECT 0 FROM user"
                  " WHERE uid=%d AND (pw=%Q OR pw=%Q)", 
                  g.userUid, zPasswd, zSha1Pw) ){
      sleep(1);
      zErrMsg = 
         @ <p><font color="red">
         @ You entered an incorrect old password while attempting to change
         @ your password.  Your password is unchanged.
         @ </font></p>
      ;
    }else if( strcmp(zNew1,zNew2)!=0 ){
      zErrMsg = 
         @ <p><font color="red">
         @ The two copies of your new passwords do not match.
         @ Your password is unchanged.
         @ </font></p>
      ;
    }else{
      char *zNewPw = sha1_shared_secret(zNew1, g.zLogin);
      db_multi_exec(
         "UPDATE user SET pw=%Q WHERE uid=%d", zNewPw, g.userUid
      );
      redirect_to_g();
................................................................................
        "   AND login NOT IN ('anonymous','nobody','developer','reader')"
        "   AND (pw=%Q OR pw=%Q)",
        zUsername, zPasswd, zSha1Pw
    );
    if( uid<=0 ){
      sleep(1);
      zErrMsg = 
         @ <p><font color="red">
         @ You entered an unknown user or an incorrect password.
         @ </font></p>
      ;
    }else{
      char *zCookie;
      const char *zCookieName = login_cookie_name();
      const char *zExpire = db_get("cookie-expire","8766");
      int expires = atoi(zExpire)*3600;
      const char *zIpAddr = PD("REMOTE_ADDR","nil");
................................................................................
  }
  style_header("Login/Logout");
  @ %s(zErrMsg)
  @ <form action="login" method="post">
  if( P("g") ){
    @ <input type="hidden" name="g" value="%h(P("g"))" />
  }
  @ <table align="left" hspace="10">
  @ <tr>
  @   <td align="right">User ID:</td>
  if( anonFlag ){
    @   <td><input type="text" id="u" name="u" value="anonymous" size=30 /></td>
  }else{
    @   <td><input type="text" id="u" name="u" value="" size=30 /></td>
  }
  @ </tr>
  @ <tr>
  @  <td align="right">Password:</td>
  @   <td><input type="password" id="p" name="p" value="" size=30 /></td>
  @ </tr>
  if( g.zLogin==0 ){
    zAnonPw = db_text(0, "SELECT pw FROM user"
                         " WHERE login='anonymous'"
                         "   AND cap!=''");
  }
  @ <tr>
................................................................................
  @ the login to take.</p>
  if( zAnonPw ){
    unsigned int uSeed = captcha_seed();
    char const *zDecoded = captcha_decode(uSeed);
    int bAutoCaptcha = db_get_boolean("auto-captcha", 1);
    char *zCaptcha = captcha_render(zDecoded);

    @ <input type="hidden" name="cs" value="%u(uSeed)" />
    @ <p>Visitors may enter <b>anonymous</b> as the user-ID with
    @ the 8-character hexadecimal password shown below:</p>
    @ <center><table border="1" cellpadding="10"><tr><td><pre>
    @ %s(zCaptcha)
    @ </pre></td></tr></table>
    if( bAutoCaptcha ) {
        @ <input type="button" value="Fill out captcha"
        @  onclick="document.getElementById('u').value='anonymous';
        @           document.getElementById('p').value='%s(zDecoded)';" />
    }
    @ </center>
    free(zCaptcha);
  }
  if( g.zLogin ){
    @ <br><hr>
    @ <p>To log off the system (and delete your login cookie)
    @  press the following button:<br>
    @ <input type="submit" name="out" value="Logout" /></p>
  }
  @ </form>
  if( g.okPassword ){
    @ <br><hr>
    @ <p>To change your password, enter your old password and your
    @ new password twice below then press the "Change Password"
    @ button.</p>
    @ <form action="login" method="POST">
    @ <table>
    @ <tr><td align="right">Old Password:</td>
    @ <td><input type="password" name="p" size=30 /></td></tr>
    @ <tr><td align="right">New Password:</td>
    @ <td><input type="password" name="n1" size=30 /></td></tr>
    @ <tr><td align="right">Repeat New Password:</td>
    @ <td><input type="password" name="n2" size=30 /></td></tr>
    @ <tr><td></td>
    @ <td><input type="submit" value="Change Password" /></td></tr>
    @ </table>
    @ </form>
  }
  style_footer();
}







|


|



|


|







 







|

|







 







|

|

|

|



|
|







 







|
|

|







|



|

|




|



|

|
|
|
|
|
|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
  if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
    zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin);
    if( db_int(1, "SELECT 0 FROM user"
                  " WHERE uid=%d AND (pw=%Q OR pw=%Q)", 
                  g.userUid, zPasswd, zSha1Pw) ){
      sleep(1);
      zErrMsg = 
         @ <p><span class="loginError">
         @ You entered an incorrect old password while attempting to change
         @ your password.  Your password is unchanged.
         @ </span></p>
      ;
    }else if( strcmp(zNew1,zNew2)!=0 ){
      zErrMsg = 
         @ <p><span class="loginError">
         @ The two copies of your new passwords do not match.
         @ Your password is unchanged.
         @ </span></p>
      ;
    }else{
      char *zNewPw = sha1_shared_secret(zNew1, g.zLogin);
      db_multi_exec(
         "UPDATE user SET pw=%Q WHERE uid=%d", zNewPw, g.userUid
      );
      redirect_to_g();
................................................................................
        "   AND login NOT IN ('anonymous','nobody','developer','reader')"
        "   AND (pw=%Q OR pw=%Q)",
        zUsername, zPasswd, zSha1Pw
    );
    if( uid<=0 ){
      sleep(1);
      zErrMsg = 
         @ <p><span class="loginError">
         @ You entered an unknown user or an incorrect password.
         @ </span></p>
      ;
    }else{
      char *zCookie;
      const char *zCookieName = login_cookie_name();
      const char *zExpire = db_get("cookie-expire","8766");
      int expires = atoi(zExpire)*3600;
      const char *zIpAddr = PD("REMOTE_ADDR","nil");
................................................................................
  }
  style_header("Login/Logout");
  @ %s(zErrMsg)
  @ <form action="login" method="post">
  if( P("g") ){
    @ <input type="hidden" name="g" value="%h(P("g"))" />
  }
  @ <table class="login_out">
  @ <tr>
  @   <td class="login_out_label">User ID:</td>
  if( anonFlag ){
    @   <td><input type="text" id="u" name="u" value="anonymous" size="30" /></td>
  }else{
    @   <td><input type="text" id="u" name="u" value="" size="30" /></td>
  }
  @ </tr>
  @ <tr>
  @  <td class="login_out_label">Password:</td>
  @   <td><input type="password" id="p" name="p" value="" size="30" /></td>
  @ </tr>
  if( g.zLogin==0 ){
    zAnonPw = db_text(0, "SELECT pw FROM user"
                         " WHERE login='anonymous'"
                         "   AND cap!=''");
  }
  @ <tr>
................................................................................
  @ the login to take.</p>
  if( zAnonPw ){
    unsigned int uSeed = captcha_seed();
    char const *zDecoded = captcha_decode(uSeed);
    int bAutoCaptcha = db_get_boolean("auto-captcha", 1);
    char *zCaptcha = captcha_render(zDecoded);

    @ <p><input type="hidden" name="cs" value="%u(uSeed)" />
    @ Visitors may enter <b>anonymous</b> as the user-ID with
    @ the 8-character hexadecimal password shown below:</p>
    @ <div class="captcha"><table class="captcha"><tr><td><pre>
    @ %s(zCaptcha)
    @ </pre></td></tr></table>
    if( bAutoCaptcha ) {
        @ <input type="button" value="Fill out captcha"
        @  onclick="document.getElementById('u').value='anonymous';
        @           document.getElementById('p').value='%s(zDecoded)';" />
    }
    @ </div>
    free(zCaptcha);
  }
  if( g.zLogin ){
    @ <hr />
    @ <p>To log off the system (and delete your login cookie)
    @  press the following button:<br />
    @ <input type="submit" name="out" value="Logout" /></p>
  }
  @ </form>
  if( g.okPassword ){
    @ <hr />
    @ <p>To change your password, enter your old password and your
    @ new password twice below then press the "Change Password"
    @ button.</p>
    @ <form action="login" method="post">
    @ <table>
    @ <tr><td class="login_out_label">Old Password:</td>
    @ <td><input type="password" name="p" size="30" /></td></tr>
    @ <tr><td class="login_out_label">New Password:</td>
    @ <td><input type="password" name="n1" size="30" /></td></tr>
    @ <tr><td class="login_out_label">Repeat New Password:</td>
    @ <td><input type="password" name="n2" size="30" /></td></tr>
    @ <tr><td></td>
    @ <td><input type="submit" value="Change Password" /></td></tr>
    @ </table>
    @ </form>
  }
  style_footer();
}

Changes to src/setup.c.

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
696
697
698
699
700
701
702

703
704
705
706
707
708
709
710
...
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
....
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
    @ <td align="center">%s(zCap)</td>
    @ <td>&nbsp;&nbsp;&nbsp;</td>
    @ <td align="left">%s(db_column_text(&s,3))</td>
    @ </tr>
  }
  @ </table></td></tr></table>
  @ <td valign="top">
  @ <b>Notes:</b>
  @ <ol>
  @ <li><p>The permission flags are as follows:</p>
  @ <table>
     @ <tr><td valign="top"><b>a</b></td>
     @   <td><i>Admin:</i> Create and delete users</td></tr>
     @ <tr><td valign="top"><b>b</b></td>
     @   <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr>
................................................................................
  if( zQ && strcmp(zQ,z)!=0 ){
    login_verify_csrf_secret();
    db_set(zVar, zQ, 0);
    z = zQ;
  }
  if( rows>0 && cols>0 ){
    @ <textarea name="%s(zQP)" rows="%d(rows)" cols="%d(cols)">%h(z)</textarea>

    @ <b>%s(zLabel)</b>
  }
}


/*
** WEBPAGE: setup_access
*/
................................................................................
    textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
  }
  if( P("submit")!=0 ){
    db_end_transaction(0);
    cgi_redirect("setup_editcss");
  }
  style_header("Edit CSS");
  @ <form action="%s(g.zBaseURL)/setup_editcss" method="POST">
  login_insert_csrf_secret();
  @ Edit the CSS below:<br />
  textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
  @ <br />
  @ <input type="submit" name="submit" value="Apply Changes">
  @ <input type="submit" name="clear" value="Revert To Default">
  @ </form>
  @ <p><b>Note:</b> Press your browser Reload button after modifying the
  @ CSS in order to pull in the modified CSS file.</p>
  @ <hr>
  @ The default CSS is shown below for reference.  Other examples
  @ of CSS files can be seen on the <a href="setup_skin">skins page</a>.
  @ See also the <a href="setup_header">header</a> and
  @ <a href="setup_footer">footer</a> editing screens.
  @ <blockquote><pre>
  cgi_append_default_css();
  @ </pre></blockquote>
................................................................................
  login_insert_csrf_secret();
  @ Logo Image file:
  @ <input type="file" name="im" size="60" accepts="image/*"><br>
  @ <input type="submit" name="set" value="Change Logo">
  @ <input type="submit" name="clr" value="Revert To Default">
  @ </form>
  @
  @ <p><b>Note:</b>  Your browser has probably cached the logo image, so
  @ you will probably need to press the Reload button on your browser after
  @ changing the logo to provoke your browser to reload the new logo image.
  @ </p>
  style_footer();
  db_end_transaction(0);
}







|







 







>
|







 







|




|
|
|
|

|







 







|






128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
...
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
....
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
    @ <td align="center">%s(zCap)</td>
    @ <td>&nbsp;&nbsp;&nbsp;</td>
    @ <td align="left">%s(db_column_text(&s,3))</td>
    @ </tr>
  }
  @ </table></td></tr></table>
  @ <td valign="top">
  @ <span class="note">Notes:</span>
  @ <ol>
  @ <li><p>The permission flags are as follows:</p>
  @ <table>
     @ <tr><td valign="top"><b>a</b></td>
     @   <td><i>Admin:</i> Create and delete users</td></tr>
     @ <tr><td valign="top"><b>b</b></td>
     @   <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr>
................................................................................
  if( zQ && strcmp(zQ,z)!=0 ){
    login_verify_csrf_secret();
    db_set(zVar, zQ, 0);
    z = zQ;
  }
  if( rows>0 && cols>0 ){
    @ <textarea name="%s(zQP)" rows="%d(rows)" cols="%d(cols)">%h(z)</textarea>
    if (zLabel && *zLabel)
      @ <span class="textareaLabel">%s(zLabel)</span>
  }
}


/*
** WEBPAGE: setup_access
*/
................................................................................
    textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
  }
  if( P("submit")!=0 ){
    db_end_transaction(0);
    cgi_redirect("setup_editcss");
  }
  style_header("Edit CSS");
  @ <form action="%s(g.zBaseURL)/setup_editcss" method="post"><div>
  login_insert_csrf_secret();
  @ Edit the CSS below:<br />
  textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
  @ <br />
  @ <input type="submit" name="submit" value="Apply Changes" />
  @ <input type="submit" name="clear" value="Revert To Default" />
  @ </div></form>
  @ <p><span class="note">Note:</span> Press your browser Reload button after modifying the
  @ CSS in order to pull in the modified CSS file.</p>
  @ <hr />
  @ The default CSS is shown below for reference.  Other examples
  @ of CSS files can be seen on the <a href="setup_skin">skins page</a>.
  @ See also the <a href="setup_header">header</a> and
  @ <a href="setup_footer">footer</a> editing screens.
  @ <blockquote><pre>
  cgi_append_default_css();
  @ </pre></blockquote>
................................................................................
  login_insert_csrf_secret();
  @ Logo Image file:
  @ <input type="file" name="im" size="60" accepts="image/*"><br>
  @ <input type="submit" name="set" value="Change Logo">
  @ <input type="submit" name="clr" value="Revert To Default">
  @ </form>
  @
  @ <p><span class="note">Note:</span>  Your browser has probably cached the logo image, so
  @ you will probably need to press the Reload button on your browser after
  @ changing the logo to provoke your browser to reload the new logo image.
  @ </p>
  style_footer();
  db_end_transaction(0);
}

Changes to src/stat.c.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
...
115
116
117
118
119
120
121
122
123
124
  int n, m, fsize;
  int szMax, szAvg;
  char zBuf[100];
  char *zVers;
  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Repository Statistics");
  @ <p><table class="label-value">
  @ <tr><th>Repository&nbsp;Size:</th><td>
  fsize = file_size(g.zRepositoryName);
  @ %d(fsize) bytes
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
  n = db_int(0, "SELECT count(*) FROM blob");
  m = db_int(0, "SELECT count(*) FROM delta");
................................................................................
  @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
  @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
  @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
  @ %s(db_text(0, "PRAGMA %s.encoding", g.zRepoDb)),
  @ %s(db_text(0, "PRAGMA %s.journal_mode", g.zRepoDb)) mode
  @ </td></tr>

  @ </table></p>
  style_footer();
}







|







 







|


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
...
115
116
117
118
119
120
121
122
123
124
  int n, m, fsize;
  int szMax, szAvg;
  char zBuf[100];
  char *zVers;
  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Repository Statistics");
  @ <table class="label-value">
  @ <tr><th>Repository&nbsp;Size:</th><td>
  fsize = file_size(g.zRepositoryName);
  @ %d(fsize) bytes
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
  n = db_int(0, "SELECT count(*) FROM blob");
  m = db_int(0, "SELECT count(*) FROM delta");
................................................................................
  @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
  @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
  @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
  @ %s(db_text(0, "PRAGMA %s.encoding", g.zRepoDb)),
  @ %s(db_text(0, "PRAGMA %s.journal_mode", g.zRepoDb)) mode
  @ </td></tr>

  @ </table>
  style_footer();
}

Changes to src/style.c.

371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
...
590
591
592
593
594
595
596
597
598





599


600
601
602
603
604
605
606
@
@ /* Hyperlink colors in the footer */
@ div.footer a { color: white; }
@ div.footer a:link { color: white; }
@ div.footer a:visited { color: white; }
@ div.footer a:hover { background-color: white; color: #558195; }
@ 
@ /* <verbatim> blocks */
@ pre.verbatim {
@    background-color: #f5f5f5;
@    padding: 0.5em;
@}
@
;
const char zTableLabelValueCSS[] = 
@ /* The label/value pairs on (for example) the ci page */
@ table.label-value th {
@   vertical-align: top;
@   text-align: right;
@   padding: 0.2ex 2ex;
@ }
@
;
const char zDivSidebox[] =
@ /* The nomenclature sidebox for branches,.. */
@ div.sidebox {
@   float: right;
@   background-color: white;
@   border-width: medium;
@   border-style: double;
@   margin: 10;
@ }
@
;
const char zDivSideboxTitle[] =
@ /* The nomenclature title in sideboxes for branches,.. */
@ div.sideboxTitle {
@   display: inline;
@   font-weight: bold;
@ }
@
;
const char zDivSideboxDescribed[] =
@ /* The defined element in sideboxes for branches,.. */
@ div.sideboxDescribed {
@   display: inline;
@   font-weight: bold;
@ }
@
;
const char zSpanDisabled[] =
@ /* The defined element in sideboxes for branches,.. */
@ span.disabled {
@   color: red;
@ }
@
;
const char zSpanTimelineSuppressed[] =
@ /* The suppressed duplicates lines in timeline, .. */
@ span.timelineDisabled {
@   font-style: italic;
@   font-size: small;
@ }
@
;
const char zTableTimelineTable[] =
@ /* the format for the timeline data table */
@ table.timelineTable {
@   cellspacing: 0;
@   border: 0;
@   cellpadding: 0
@ }
@
;
const char zTdTimelineTableCell[] =
@ /* the format for the timeline data cells */
@ td.timelineTableCell {
@   valign: top;
@   align: left;
@ }
@
;
const char zSpanTimelineLeaf[] =
@ /* the format for the timeline leaf marks */
@ span.timelineLeaf {
@   font-weight: bold;
@ }
@
;
const char zATimelineHistLink[] =
@ /* the format for the timeline version links */
@ a.timelineHistLink {
@ }
@
;
const char zSpanTimelineHistDsp[] =
@ /* the format for the timeline version display(no history permission!) */
@ span.timelineHistDsp {
@   font-weight: bold;
@ }
@
;
const char zTdTimelineTime[] =
@ /* the format for the timeline time display */
@ td.timelineTime {
@   vertical-align: top;
@   text-align: right;
@ }
@
;
const char zATagLink[] =
@ /* the format for the tag links */
@ a.tagLink {
@ }
@
;
const char zSpanTagDsp[] =
@ /* the format for the tag display(no history permission!) */
@ span.tagDsp {
@   font-weight: bold;
@ }
@
;
const char zSpanWikiError[] =
@ /* the format for wiki errors */
@ span.wikiError {
@   font-weight: bold;
@   color: red;
@ }
@
;
const char zSpanInfoTagCancelled[] =
@ /* the format for wiki errors */
@ span.infoTagCancelled {
@   font-weight: bold;
@   text-decoration: line-through;
@ }
@
;
const char zSpanInfoTag[] =
@ /* the format for wiki errors */
@ span.infoTag {
@   font-weight: bold;
@ }
@
;
const char zSpanWikiTagCancelled[] =
@ /* the format for wiki errors */
@ span.wikiTagCancelled {
@   text-decoration: line-through;
@ }
@
;
const char zTableBrowser[] =
@ /* the format for wiki errors */
@ table.browser {
@   width: 100%%;
@   border: 0;
@ }
@
;
const char zTdBrowser[] =
@ /* the format for wiki errors */
@ td.browser {
@   width: 25%%;
@   vertical-align: top;
@ }
@
;
const char zUlBrowser[] =
@ /* the format for wiki errors */
@ ul.browser {
@   margin-left: 0.5em;
@   padding-left: 0.5em;
@ }
@
;
const struct strctCssDefaults {
  char const * const name;
  char const * const value;
} cssDefaultList[] = {
  { "",                      zDefaultCSS             },
  { "table.label-value",     zTableLabelValueCSS     },
  { "div.sidebox",           zDivSidebox             },
  { "div.sideboxTitle",      zDivSideboxTitle        },
  { "div.sideboxDescribed",  zDivSideboxDescribed    },
  { "span.disabled",         zSpanDisabled           },
  { "span.timelineDisabled", zSpanTimelineSuppressed },
  { "table.timelineTable",   zTableTimelineTable     },
  { "td.timelineTableCell",  zTdTimelineTableCell    },
  { "span.timelineLeaf",     zSpanTimelineLeaf       },
  { "a.timelineHistLink",    zATimelineHistLink      },
  { "span.timelineHistDsp",  zSpanTimelineHistDsp    },
  { "td.timelineTime",       zTdTimelineTime         },
  { "a.tagLink",             zATagLink               },
  { "span.tagDsp",           zSpanTagDsp             },
  { "span.wikiError",        zSpanWikiError          },
  { "span.infoTagCancelled", zSpanInfoTagCancelled   },
  { "span.infoTag",          zSpanInfoTag            },
  { "span.wikiTagCancelled", zSpanWikiTagCancelled   },
  { "table.browser",         zTableBrowser           },
  { "td.browser",            zTdBrowser              },
  { "ul.browser",            zUlBrowser              },
  { 0,                       0                       }
};

void cgi_append_default_css(void) {
  int i;

  for (i=0;cssDefaultList[i].name;i++)
    cgi_printf(cssDefaultList[i].value);
}

/*
** 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].name;i++)
    if (!strstr(zCSS,cssDefaultList[i].name))





      cgi_append_content(cssDefaultList[i].value, -1);


  g.isConst = 1;
}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){







|





|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
|
>
>
>
>
>

>
>







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551






























552
553
554
555
556
557
558
...
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
@
@ /* Hyperlink colors in the footer */
@ div.footer a { color: white; }
@ div.footer a:link { color: white; }
@ div.footer a:visited { color: white; }
@ div.footer a:hover { background-color: white; color: #558195; }
@ 
@ /* verbatim blocks */
@ pre.verbatim {
@    background-color: #f5f5f5;
@    padding: 0.5em;
@}
@
@ /* The label/value pairs on (for example) the ci page */
@ table.label-value th {
@   vertical-align: top;
@   text-align: right;
@   padding: 0.2ex 2ex;
@ }
@
;
const struct strctCssDefaults {
  char const * const elementClass;
  char const * const comment;
  char const * const value;
} cssDefaultList[] = {
  { "",
    "",
    zDefaultCSS
  },
  { "div.sidebox",
    "The nomenclature sidebox for branches,..",
    @   float: right;
    @   background-color: white;
    @   border-width: medium;
    @   border-style: double;
    @   margin: 10;
  },
  { "div.sideboxTitle",
    "The nomenclature title in sideboxes for branches,..",
    @   display: inline;
    @   font-weight: bold;
  },
  { "div.sideboxDescribed",
    "The defined element in sideboxes for branches,..",
    @   display: inline;
    @   font-weight: bold;
  },
  { "span.disabled",
    "The defined element in sideboxes for branches,..",
    @   color: red;
  },
  { "span.timelineDisabled",
    "The suppressed duplicates lines in timeline, ..",
    @   font-style: italic;
    @   font-size: small;
  },
  { "table.timelineTable",
    "the format for the timeline data table",
    @   cellspacing: 0;
    @   border: 0;
    @   cellpadding: 0
  },
  { "td.timelineTableCell",
    "the format for the timeline data cells",
    @   valign: top;
    @   align: left;
  },
  { "span.timelineLeaf",
    "the format for the timeline leaf marks",
    @   font-weight: bold;
  },
  { "a.timelineHistLink",
    "the format for the timeline version links",
    @
  },
  { "span.timelineHistDsp",
    "the format for the timeline version display(no history permission!)",
    @   font-weight: bold;
  },
  { "td.timelineTime",
    "the format for the timeline time display",
    @   vertical-align: top;
    @   text-align: right;
  },
  { "a.tagLink",
    "the format for the tag links",
    @
  },
  { "span.tagDsp",
    "the format for the tag display(no history permission!)",
    @   font-weight: bold;
  },
  { "span.wikiError",
    "the format for wiki errors",
    @   font-weight: bold;
    @   color: red;
  },
  { "span.infoTagCancelled",
    "the format for fixed/canceled tags,..",
    @   font-weight: bold;
    @   text-decoration: line-through;
  },
  { "span.infoTag",
    "the format for tags,..",
    @   font-weight: bold;
  },
  { "span.wikiTagCancelled",
    "the format for fixed/cancelled tags,.. on wiki pages",
    @   text-decoration: line-through;
  },
  { "table.browser",
    "format for the file display table",
    @ /* the format for wiki errors */
    @   width: 100%%;
    @   border: 0;
  },
  { "td.browser",
    "format for cells in the file browser",
    @   width: 25%%;
    @   vertical-align: top;
  },
  { "ul.browser",
    "format for the list in the file browser",
    @   margin-left: 0.5em;
    @   padding-left: 0.5em;
  },
  { "table.login_out",
    "table format for login/out label/input table",
    @   text-align: left;
    @   margin-right: 10px;
    @   margin-left: 10px;
    @   margin-top: 10px;
  },
  { "div.captcha",
    "captcha display options",
    @   text-align: center;
  },
  { "table.captcha",
    "format for the layout table, used for the captcha display",
    @   margin: auto;
    @   padding: 10px;
    @   outline-width: 1;
    @   outline-style: double;
  },
  { "td.login_out_label",
    "format for the label cells in the login/out table",
    @   text-align: center;
  },
  { "span.loginError",
    "format for login error messages",
    @   color: red;
  },
  { "span.note",
    "format for leading text for notes",
    @   font-weight: bold;
  },
  { "span.textareaLabel",
    "format for textare labels",
    @   font-weight: bold;
  },
  { 0,
    0,
    0
  }
};

void cgi_append_default_css(void) {
  int i;

  for (i=0;cssDefaultList[i].elementClass;i++)
    if (cssDefaultList[i].elementClass[0])
      cgi_printf("/* %s */\n%s {\n%s\n}\n\n",
		 cssDefaultList[i].comment,
		 cssDefaultList[i].elementClass,
		 cssDefaultList[i].value
		);
    else
      cgi_printf("%s",
		 cssDefaultList[i].value
		);






























}

/*
** 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){

Changes to src/translate.c.

64
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
..
83
84
85
86
87
88
89
90

91
92

93
94
95
96
97
98
99
100
  }
}

/*
** Translate the input stream into the output stream
*/
static void trans(FILE *in, FILE *out){
  int i, j, k;        /* Loop counters */
  char c1, c2;        /* Characters used to start a comment */
  int lastWasEq = 0;  /* True if last non-whitespace character was "=" */

  char zLine[2000];   /* A single line of input */
  char zOut[4000];    /* The input line translated into appropriate output */

  c1 = c2 = '-';
  while( fgets(zLine, sizeof(zLine), in) ){
    for(i=0; zLine[i] && isspace(zLine[i]); i++){}
    if( zLine[i]!='@' ){
      if( inPrint || inStr ) end_block(out);
      fprintf(out,"%s",zLine);
................................................................................
                       /* 0123456789 12345 */
      if( strncmp(zLine, "/* @-comment: ", 14)==0 ){
        c1 = zLine[14];
        c2 = zLine[15];
      }
      i += strlen(&zLine[i]);
      while( i>0 && isspace(zLine[i-1]) ){ i--; }
      lastWasEq = i>0 && zLine[i-1]=='=';

    }else if( lastWasEq ){
      /* If the last non-whitespace character before the first @ was

      ** an "=" then generate a string literal.  But skip comments
      ** consisting of all text between c1 and c2 (default "--")
      ** and end of line.
      */
      int indent, omitline;
      i++;
      if( isspace(zLine[i]) ){ i++; }
      indent = i - 2;







|
|
|
>
|
|







 







|
>
|

>
|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  }
}

/*
** Translate the input stream into the output stream
*/
static void trans(FILE *in, FILE *out){
  int i, j, k;          /* Loop counters */
  char c1, c2;          /* Characters used to start a comment */
  int lastWasEq = 0;    /* True if last non-whitespace character was "=" */
  int lastWasComma = 0; /* True if last non-whitespace character was "," */
  char zLine[2000];     /* A single line of input */
  char zOut[4000];      /* The input line translated into appropriate output */

  c1 = c2 = '-';
  while( fgets(zLine, sizeof(zLine), in) ){
    for(i=0; zLine[i] && isspace(zLine[i]); i++){}
    if( zLine[i]!='@' ){
      if( inPrint || inStr ) end_block(out);
      fprintf(out,"%s",zLine);
................................................................................
                       /* 0123456789 12345 */
      if( strncmp(zLine, "/* @-comment: ", 14)==0 ){
        c1 = zLine[14];
        c2 = zLine[15];
      }
      i += strlen(&zLine[i]);
      while( i>0 && isspace(zLine[i-1]) ){ i--; }
      lastWasEq    = i>0 && zLine[i-1]=='=';
      lastWasComma = i>0 && zLine[i-1]==',';
    }else if( lastWasEq || lastWasComma){
      /* If the last non-whitespace character before the first @ was
      ** an "="(var init/set) or a ","(const definition in list) then
      ** generate a string literal.  But skip comments
      ** consisting of all text between c1 and c2 (default "--")
      ** and end of line.
      */
      int indent, omitline;
      i++;
      if( isspace(zLine[i]) ){ i++; }
      indent = i - 2;