Hex Artifact Content
Not logged in

Artifact 74f0d8458fc1ea93a2385d3641154d2c12343610:

File src/style.c part of check-in [07eaead5dc] - Added RSS feed. You can set the RSS title, description in Setup. Added header to style to include title and pointer to the new RSS feed. The new RSS feed is BaseURL/timeline.rss by jnc on 2007-09-23 18:24:21. Also file src/style.c part of check-in [dad40ffac0] - Merge the RSS changes. by drh on 2007-09-23 20:18:58.

0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20  /*.** Copyright 
0010: 28 63 29 20 32 30 30 36 20 44 2e 20 52 69 63 68  (c) 2006 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54  ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66  his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f  ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75  u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20  te it and/or.** 
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20  modify it under 
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65  the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62   GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76  lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c  ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65  ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69  ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73  s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20  tributed in the 
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c  hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20  l be useful,.** 
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20  but WITHOUT ANY 
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75  WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69  t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a  ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54  * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52  Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55   A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20  RPOSE.  See the 
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50  GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f  ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a  r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c  ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20  d have received 
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e  a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63  U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e  .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72  g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69  ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65  te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20  ation, Inc., 59 
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53  Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73  uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31  ton, MA  02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20  307, USA..**.** 
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69  Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20  nformation:.**  
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a   drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68  *   http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a  waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65  .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 74   contains code t
0380: 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20  o implement the 
0390: 62 61 73 69 63 20 77 65 62 20 70 61 67 65 20 6c  basic web page l
03a0: 6f 6f 6b 20 61 6e 64 20 66 65 65 6c 2e 0a 2a 2a  ook and feel..**
03b0: 0a 2a 2f 0a 23 69 6e 63 6c 75 64 65 20 22 63 6f  .*/.#include "co
03c0: 6e 66 69 67 2e 68 22 0a 23 69 6e 63 6c 75 64 65  nfig.h".#include
03d0: 20 22 73 74 79 6c 65 2e 68 22 0a 0a 0a 2f 2a 0a   "style.h".../*.
03e0: 2a 2a 20 45 6c 65 6d 65 6e 74 73 20 6f 66 20 74  ** Elements of t
03f0: 68 65 20 73 75 62 6d 65 6e 75 20 61 72 65 20 63  he submenu are c
0400: 6f 6c 6c 65 63 74 65 64 20 69 6e 74 6f 20 74 68  ollected into th
0410: 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 2a 2a 20 73  e following.** s
0420: 74 72 75 63 74 75 72 65 20 61 6e 64 20 64 69 73  tructure and dis
0430: 70 6c 61 79 65 64 20 62 65 6c 6f 77 20 74 68 65  played below the
0440: 20 6d 61 69 6e 20 6d 65 6e 75 20 62 79 20 73 74   main menu by st
0450: 79 6c 65 5f 68 65 61 64 65 72 28 29 2e 0a 2a 2a  yle_header()..**
0460: 0a 2a 2a 20 50 6f 70 75 6c 61 74 65 20 74 68 69  .** Populate thi
0470: 73 20 73 74 72 75 63 74 75 72 65 20 77 69 74 68  s structure with
0480: 20 63 61 6c 6c 73 20 74 6f 20 73 74 79 6c 65 5f   calls to style_
0490: 73 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 28  submenu_element(
04a0: 29 0a 2a 2a 20 70 72 69 6f 72 20 74 6f 20 63 61  ).** prior to ca
04b0: 6c 6c 69 6e 67 20 73 74 79 6c 65 5f 68 65 61 64  lling style_head
04c0: 65 72 28 29 2e 0a 2a 2f 0a 73 74 61 74 69 63 20  er()..*/.static 
04d0: 73 74 72 75 63 74 20 53 75 62 6d 65 6e 75 20 7b  struct Submenu {
04e0: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a  .  const char *z
04f0: 4c 61 62 65 6c 3b 0a 20 20 63 6f 6e 73 74 20 63  Label;.  const c
0500: 68 61 72 20 2a 7a 54 69 74 6c 65 3b 0a 20 20 63  har *zTitle;.  c
0510: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4c 69 6e 6b  onst char *zLink
0520: 3b 0a 7d 20 61 53 75 62 6d 65 6e 75 5b 33 30 5d  ;.} aSubmenu[30]
0530: 3b 0a 73 74 61 74 69 63 20 69 6e 74 20 6e 53 75  ;.static int nSu
0540: 62 6d 65 6e 75 20 3d 20 30 3b 0a 0a 2f 2a 0a 2a  bmenu = 0;../*.*
0550: 2a 20 41 64 64 20 61 20 6e 65 77 20 65 6c 65 6d  * Add a new elem
0560: 65 6e 74 20 74 6f 20 74 68 65 20 73 75 62 6d 65  ent to the subme
0570: 6e 75 0a 2a 2f 0a 76 6f 69 64 20 73 74 79 6c 65  nu.*/.void style
0580: 5f 73 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74  _submenu_element
0590: 28 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a  (.  const char *
05a0: 7a 4c 61 62 65 6c 2c 0a 20 20 63 6f 6e 73 74 20  zLabel,.  const 
05b0: 63 68 61 72 20 2a 7a 54 69 74 6c 65 2c 0a 20 20  char *zTitle,.  
05c0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4c 69 6e  const char *zLin
05d0: 6b 0a 29 7b 0a 20 20 61 73 73 65 72 74 28 20 6e  k.){.  assert( n
05e0: 53 75 62 6d 65 6e 75 20 3c 20 73 69 7a 65 6f 66  Submenu < sizeof
05f0: 28 61 53 75 62 6d 65 6e 75 29 2f 73 69 7a 65 6f  (aSubmenu)/sizeo
0600: 66 28 61 53 75 62 6d 65 6e 75 5b 30 5d 29 20 29  f(aSubmenu[0]) )
0610: 3b 0a 20 20 61 53 75 62 6d 65 6e 75 5b 6e 53 75  ;.  aSubmenu[nSu
0620: 62 6d 65 6e 75 5d 2e 7a 4c 61 62 65 6c 20 3d 20  bmenu].zLabel = 
0630: 7a 4c 61 62 65 6c 3b 0a 20 20 61 53 75 62 6d 65  zLabel;.  aSubme
0640: 6e 75 5b 6e 53 75 62 6d 65 6e 75 5d 2e 7a 54 69  nu[nSubmenu].zTi
0650: 74 6c 65 20 3d 20 7a 54 69 74 6c 65 3b 0a 20 20  tle = zTitle;.  
0660: 61 53 75 62 6d 65 6e 75 5b 6e 53 75 62 6d 65 6e  aSubmenu[nSubmen
0670: 75 5d 2e 7a 4c 69 6e 6b 20 3d 20 7a 4c 69 6e 6b  u].zLink = zLink
0680: 3b 0a 20 20 6e 53 75 62 6d 65 6e 75 2b 2b 3b 0a  ;.  nSubmenu++;.
0690: 7d 0a 0a 2f 2a 0a 2a 2a 20 43 6f 6d 70 61 72 65  }../*.** Compare
06a0: 20 74 77 6f 20 73 75 62 6d 65 6e 75 20 69 74 65   two submenu ite
06b0: 6d 73 20 66 6f 72 20 73 6f 72 74 69 6e 67 20 70  ms for sorting p
06c0: 75 72 70 6f 73 65 73 0a 2a 2f 0a 73 74 61 74 69  urposes.*/.stati
06d0: 63 20 69 6e 74 20 73 75 62 6d 65 6e 75 43 6f 6d  c int submenuCom
06e0: 70 61 72 65 28 63 6f 6e 73 74 20 76 6f 69 64 20  pare(const void 
06f0: 2a 61 2c 20 63 6f 6e 73 74 20 76 6f 69 64 20 2a  *a, const void *
0700: 62 29 7b 0a 20 20 63 6f 6e 73 74 20 73 74 72 75  b){.  const stru
0710: 63 74 20 53 75 62 6d 65 6e 75 20 2a 41 20 3d 20  ct Submenu *A = 
0720: 28 63 6f 6e 73 74 20 73 74 72 75 63 74 20 53 75  (const struct Su
0730: 62 6d 65 6e 75 2a 29 61 3b 0a 20 20 63 6f 6e 73  bmenu*)a;.  cons
0740: 74 20 73 74 72 75 63 74 20 53 75 62 6d 65 6e 75  t struct Submenu
0750: 20 2a 42 20 3d 20 28 63 6f 6e 73 74 20 73 74 72   *B = (const str
0760: 75 63 74 20 53 75 62 6d 65 6e 75 2a 29 42 3b 0a  uct Submenu*)B;.
0770: 20 20 72 65 74 75 72 6e 20 73 74 72 63 6d 70 28    return strcmp(
0780: 41 2d 3e 7a 4c 61 62 65 6c 2c 20 42 2d 3e 7a 4c  A->zLabel, B->zL
0790: 61 62 65 6c 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20  abel);.}../*.** 
07a0: 44 72 61 77 20 74 68 65 20 68 65 61 64 65 72 2e  Draw the header.
07b0: 0a 2a 2f 0a 76 6f 69 64 20 73 74 79 6c 65 5f 68  .*/.void style_h
07c0: 65 61 64 65 72 28 63 6f 6e 73 74 20 63 68 61 72  eader(const char
07d0: 20 2a 7a 54 69 74 6c 65 29 7b 0a 20 20 63 6f 6e   *zTitle){.  con
07e0: 73 74 20 63 68 61 72 20 2a 7a 4c 6f 67 49 6e 4f  st char *zLogInO
07f0: 75 74 20 3d 20 22 4c 6f 67 6f 75 74 22 3b 0a 20  ut = "Logout";. 
0800: 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65   login_check_cre
0810: 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 40 20  dentials();.  @ 
0820: 3c 68 74 6d 6c 3e 0a 20 20 40 20 3c 68 65 61 64  <html>.  @ <head
0830: 3e 0a 20 20 40 20 3c 74 69 74 6c 65 3e 25 73 28  >.  @ <title>%s(
0840: 7a 54 69 74 6c 65 29 3c 2f 74 69 74 6c 65 3e 0a  zTitle)</title>.
0850: 20 20 40 20 3c 6c 69 6e 6b 20 72 65 6c 3d 22 61    @ <link rel="a
0860: 6c 74 65 72 6e 61 74 65 22 20 74 79 70 65 3d 22  lternate" type="
0870: 61 70 70 6c 69 63 61 74 69 6f 6e 2f 72 73 73 2b  application/rss+
0880: 78 6d 6c 22 20 74 69 74 6c 65 3d 22 52 53 53 20  xml" title="RSS 
0890: 46 65 65 64 22 20 68 72 65 66 3d 22 25 73 28 67  Feed" href="%s(g
08a0: 2e 7a 42 61 73 65 55 52 4c 29 2f 74 69 6d 65 6c  .zBaseURL)/timel
08b0: 69 6e 65 2e 72 73 73 22 3e 0a 20 20 40 20 3c 2f  ine.rss">.  @ </
08c0: 68 65 61 64 3e 0a 20 20 40 20 3c 62 6f 64 79 20  head>.  @ <body 
08d0: 62 67 63 6f 6c 6f 72 3d 22 77 68 69 74 65 22 3e  bgcolor="white">
08e0: 0a 20 20 40 20 3c 68 72 20 73 69 7a 65 3d 22 31  .  @ <hr size="1
08f0: 22 3e 0a 20 20 40 20 3c 74 61 62 6c 65 20 62 6f  ">.  @ <table bo
0900: 72 64 65 72 3d 22 30 22 20 63 65 6c 6c 70 61 64  rder="0" cellpad
0910: 64 69 6e 67 3d 22 30 22 20 63 65 6c 6c 73 70 61  ding="0" cellspa
0920: 63 69 6e 67 3d 22 30 22 20 77 69 64 74 68 3d 22  cing="0" width="
0930: 31 30 30 25 25 22 3e 0a 20 20 40 20 3c 74 72 3e  100%%">.  @ <tr>
0940: 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22  <td valign="top"
0950: 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e 0a 20   align="left">. 
0960: 20 40 20 3c 62 69 67 3e 3c 62 69 67 3e 3c 62 3e   @ <big><big><b>
0970: 25 73 28 7a 54 69 74 6c 65 29 3c 2f 62 3e 3c 2f  %s(zTitle)</b></
0980: 62 69 67 3e 3c 2f 62 69 67 3e 3c 62 72 3e 0a 20  big></big><br>. 
0990: 20 69 66 28 20 67 2e 7a 4c 6f 67 69 6e 3d 3d 30   if( g.zLogin==0
09a0: 20 29 7b 0a 20 20 20 20 40 20 3c 73 6d 61 6c 6c   ){.    @ <small
09b0: 3e 6e 6f 74 20 6c 6f 67 67 65 64 20 69 6e 3c 2f  >not logged in</
09c0: 73 6d 61 6c 6c 3e 0a 20 20 20 20 7a 4c 6f 67 49  small>.    zLogI
09d0: 6e 4f 75 74 20 3d 20 22 4c 6f 67 69 6e 22 3b 0a  nOut = "Login";.
09e0: 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 40 20 3c    }else{.    @ <
09f0: 73 6d 61 6c 6c 3e 6c 6f 67 67 65 64 20 69 6e 20  small>logged in 
0a00: 61 73 20 25 68 28 67 2e 7a 4c 6f 67 69 6e 29 3c  as %h(g.zLogin)<
0a10: 2f 73 6d 61 6c 6c 3e 0a 20 20 7d 0a 20 20 40 20  /small>.  }.  @ 
0a20: 3c 2f 74 64 3e 3c 74 64 20 76 61 6c 69 67 6e 3d  </td><td valign=
0a30: 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 72 69 67  "top" align="rig
0a40: 68 74 22 3e 0a 20 20 40 20 3c 61 20 68 72 65 66  ht">.  @ <a href
0a50: 3d 22 25 73 28 67 2e 7a 42 61 73 65 55 52 4c 29  ="%s(g.zBaseURL)
0a60: 2f 69 6e 64 65 78 22 3e 48 6f 6d 65 3c 2f 61 3e  /index">Home</a>
0a70: 0a 20 20 69 66 28 20 67 2e 6f 6b 52 65 61 64 20  .  if( g.okRead 
0a80: 29 7b 0a 20 20 20 20 40 20 7c 20 3c 61 20 68 72  ){.    @ | <a hr
0a90: 65 66 3d 22 25 73 28 67 2e 7a 42 61 73 65 55 52  ef="%s(g.zBaseUR
0aa0: 4c 29 2f 6c 65 61 76 65 73 22 3e 4c 65 61 76 65  L)/leaves">Leave
0ab0: 73 3c 2f 61 3e 0a 20 20 20 20 40 20 7c 20 3c 61  s</a>.    @ | <a
0ac0: 20 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73   href="%s(g.zBas
0ad0: 65 55 52 4c 29 2f 74 69 6d 65 6c 69 6e 65 22 3e  eURL)/timeline">
0ae0: 54 69 6d 65 6c 69 6e 65 3c 2f 61 3e 0a 20 20 7d  Timeline</a>.  }
0af0: 0a 20 20 69 66 28 20 67 2e 6f 6b 52 64 57 69 6b  .  if( g.okRdWik
0b00: 69 20 29 7b 0a 20 20 20 20 40 20 7c 20 3c 61 20  i ){.    @ | <a 
0b10: 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73 65  href="%s(g.zBase
0b20: 55 52 4c 29 2f 77 69 6b 69 22 3e 57 69 6b 69 3c  URL)/wiki">Wiki<
0b30: 2f 61 3e 0a 20 20 7d 0a 23 69 66 20 30 0a 20 20  /a>.  }.#if 0.  
0b40: 40 20 7c 20 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d  @ | <font color=
0b50: 22 23 38 38 38 38 38 38 22 3e 53 65 61 72 63 68  "#888888">Search
0b60: 3c 2f 66 6f 6e 74 3e 0a 20 20 40 20 7c 20 3c 66  </font>.  @ | <f
0b70: 6f 6e 74 20 63 6f 6c 6f 72 3d 22 23 38 38 38 38  ont color="#8888
0b80: 38 38 22 3e 54 69 63 6b 65 74 3c 2f 66 6f 6e 74  88">Ticket</font
0b90: 3e 0a 20 20 40 20 7c 20 3c 66 6f 6e 74 20 63 6f  >.  @ | <font co
0ba0: 6c 6f 72 3d 22 23 38 38 38 38 38 38 22 3e 52 65  lor="#888888">Re
0bb0: 70 6f 72 74 73 3c 2f 66 6f 6e 74 3e 0a 23 65 6e  ports</font>.#en
0bc0: 64 69 66 0a 20 20 69 66 28 20 67 2e 6f 6b 53 65  dif.  if( g.okSe
0bd0: 74 75 70 20 29 7b 0a 20 20 20 20 40 20 7c 20 3c  tup ){.    @ | <
0be0: 61 20 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61  a href="%s(g.zBa
0bf0: 73 65 55 52 4c 29 2f 73 65 74 75 70 22 3e 53 65  seURL)/setup">Se
0c00: 74 75 70 3c 2f 61 3e 0a 20 20 7d 0a 20 20 69 66  tup</a>.  }.  if
0c10: 28 20 21 67 2e 6e 6f 50 73 77 64 20 29 7b 0a 20  ( !g.noPswd ){. 
0c20: 20 20 20 40 20 7c 20 3c 61 20 68 72 65 66 3d 22     @ | <a href="
0c30: 25 73 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 6c  %s(g.zBaseURL)/l
0c40: 6f 67 69 6e 22 3e 25 73 28 7a 4c 6f 67 49 6e 4f  ogin">%s(zLogInO
0c50: 75 74 29 3c 2f 61 3e 0a 20 20 7d 0a 20 20 69 66  ut)</a>.  }.  if
0c60: 28 20 6e 53 75 62 6d 65 6e 75 3e 30 20 29 7b 0a  ( nSubmenu>0 ){.
0c70: 20 20 20 20 69 6e 74 20 69 3b 0a 20 20 20 20 40      int i;.    @
0c80: 20 3c 62 72 3e 0a 20 20 20 20 71 73 6f 72 74 28   <br>.    qsort(
0c90: 61 53 75 62 6d 65 6e 75 2c 20 6e 53 75 62 6d 65  aSubmenu, nSubme
0ca0: 6e 75 2c 20 73 69 7a 65 6f 66 28 61 53 75 62 6d  nu, sizeof(aSubm
0cb0: 65 6e 75 5b 30 5d 29 2c 20 73 75 62 6d 65 6e 75  enu[0]), submenu
0cc0: 43 6f 6d 70 61 72 65 29 3b 0a 20 20 20 20 66 6f  Compare);.    fo
0cd0: 72 28 69 3d 30 3b 20 69 3c 6e 53 75 62 6d 65 6e  r(i=0; i<nSubmen
0ce0: 75 3b 20 69 2b 2b 29 7b 0a 20 20 20 20 20 20 73  u; i++){.      s
0cf0: 74 72 75 63 74 20 53 75 62 6d 65 6e 75 20 2a 70  truct Submenu *p
0d00: 20 3d 20 26 61 53 75 62 6d 65 6e 75 5b 69 5d 3b   = &aSubmenu[i];
0d10: 0a 20 20 20 20 20 20 63 68 61 72 20 2a 7a 54 61  .      char *zTa
0d20: 69 6c 20 3d 20 69 3c 6e 53 75 62 6d 65 6e 75 2d  il = i<nSubmenu-
0d30: 31 20 3f 20 22 20 7c 20 22 20 3a 20 22 22 3b 0a  1 ? " | " : "";.
0d40: 20 20 20 20 20 20 69 66 28 20 70 2d 3e 7a 4c 69        if( p->zLi
0d50: 6e 6b 3d 3d 30 20 29 7b 0a 20 20 20 20 20 20 20  nk==0 ){.       
0d60: 20 40 20 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 22   @ <font color="
0d70: 23 38 38 38 38 38 38 22 3e 25 68 28 70 2d 3e 7a  #888888">%h(p->z
0d80: 4c 61 62 65 6c 29 3c 2f 66 6f 6e 74 3e 20 25 73  Label)</font> %s
0d90: 28 7a 54 61 69 6c 29 0a 20 20 20 20 20 20 7d 65  (zTail).      }e
0da0: 6c 73 65 7b 0a 20 20 20 20 20 20 20 20 40 20 3c  lse{.        @ <
0db0: 61 20 68 72 65 66 3d 22 25 54 28 70 2d 3e 7a 4c  a href="%T(p->zL
0dc0: 69 6e 6b 29 22 3e 25 68 28 70 2d 3e 7a 4c 61 62  ink)">%h(p->zLab
0dd0: 65 6c 29 3c 2f 61 3e 20 25 73 28 7a 54 61 69 6c  el)</a> %s(zTail
0de0: 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a  ).      }.    }.
0df0: 20 20 7d 0a 20 20 40 20 3c 2f 74 64 3e 3c 2f 74    }.  @ </td></t
0e00: 72 3e 3c 2f 74 61 62 6c 65 3e 0a 20 20 40 20 3c  r></table>.  @ <
0e10: 68 72 20 73 69 7a 65 3d 22 31 22 3e 0a 20 20 67  hr size="1">.  g
0e20: 2e 63 67 69 50 61 6e 69 63 20 3d 20 31 3b 0a 7d  .cgiPanic = 1;.}
0e30: 0a 0a 2f 2a 0a 2a 2a 20 44 72 61 77 20 74 68 65  ../*.** Draw the
0e40: 20 66 6f 6f 74 65 72 20 61 74 20 74 68 65 20 62   footer at the b
0e50: 6f 74 74 6f 6d 20 6f 66 20 74 68 65 20 70 61 67  ottom of the pag
0e60: 65 2e 0a 2a 2f 0a 76 6f 69 64 20 73 74 79 6c 65  e..*/.void style
0e70: 5f 66 6f 6f 74 65 72 28 76 6f 69 64 29 7b 0a 20  _footer(void){. 
0e80: 20 40 20 3c 68 72 3e 0a 20 20 40 20 3c 70 20 61   @ <hr>.  @ <p a
0e90: 6c 69 67 6e 3d 22 6c 65 66 74 22 3e 3c 66 6f 6e  lign="left"><fon
0ea0: 74 20 73 69 7a 65 3d 22 31 22 3e 0a 20 20 40 20  t size="1">.  @ 
0eb0: 46 6f 73 73 69 6c 20 76 65 72 73 69 6f 6e 20 25  Fossil version %
0ec0: 73 28 4d 41 4e 49 46 45 53 54 5f 56 45 52 53 49  s(MANIFEST_VERSI
0ed0: 4f 4e 29 20 25 73 28 4d 41 4e 49 46 45 53 54 5f  ON) %s(MANIFEST_
0ee0: 44 41 54 45 29 0a 20 20 40 20 3c 2f 66 6f 6e 74  DATE).  @ </font
0ef0: 3e 3c 2f 70 3e 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57  ></p>.}../*.** W
0f00: 45 42 50 41 47 45 3a 20 69 6e 64 65 78 0a 2a 2a  EBPAGE: index.**
0f10: 20 57 45 42 50 41 47 45 3a 20 68 6f 6d 65 0a 2a   WEBPAGE: home.*
0f20: 2a 20 57 45 42 50 41 47 45 3a 20 6e 6f 74 5f 66  * WEBPAGE: not_f
0f30: 6f 75 6e 64 0a 2a 2f 0a 76 6f 69 64 20 70 61 67  ound.*/.void pag
0f40: 65 5f 69 6e 64 65 78 28 76 6f 69 64 29 7b 0a 20  e_index(void){. 
0f50: 20 63 68 61 72 20 2a 7a 48 6f 6d 65 20 3d 20 64   char *zHome = d
0f60: 62 5f 67 65 74 28 22 68 6f 6d 65 70 61 67 65 22  b_get("homepage"
0f70: 2c 20 30 29 3b 0a 20 20 69 66 28 20 7a 48 6f 6d  , 0);.  if( zHom
0f80: 65 20 29 7b 0a 20 20 20 20 67 2e 7a 45 78 74 72  e ){.    g.zExtr
0f90: 61 20 3d 20 7a 48 6f 6d 65 3b 0a 20 20 20 20 67  a = zHome;.    g
0fa0: 2e 6f 6b 52 64 57 69 6b 69 20 3d 20 31 3b 0a 20  .okRdWiki = 1;. 
0fb0: 20 20 20 77 69 6b 69 5f 70 61 67 65 28 29 3b 0a     wiki_page();.
0fc0: 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 73 74 79    }else{.    sty
0fd0: 6c 65 5f 68 65 61 64 65 72 28 22 4d 61 69 6e 20  le_header("Main 
0fe0: 54 69 74 6c 65 20 50 61 67 65 22 29 3b 0a 20 20  Title Page");.  
0ff0: 20 20 40 20 4e 6f 20 68 6f 6d 65 70 61 67 65 20    @ No homepage 
1000: 63 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 20 74  configured for t
1010: 68 69 73 20 73 65 72 76 65 72 0a 20 20 20 20 73  his server.    s
1020: 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 20  tyle_footer();. 
1030: 20 7d 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50   }.}../*.** WEBP
1040: 41 47 45 3a 20 74 65 73 74 5f 65 6e 76 0a 2a 2f  AGE: test_env.*/
1050: 0a 76 6f 69 64 20 70 61 67 65 5f 74 65 73 74 5f  .void page_test_
1060: 65 6e 76 28 76 6f 69 64 29 7b 0a 20 20 73 74 79  env(void){.  sty
1070: 6c 65 5f 68 65 61 64 65 72 28 22 45 6e 76 69 72  le_header("Envir
1080: 6f 6e 6d 65 6e 74 20 54 65 73 74 22 29 3b 0a 20  onment Test");. 
1090: 20 63 67 69 5f 70 72 69 6e 74 5f 61 6c 6c 28 29   cgi_print_all()
10a0: 3b 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72  ;.  style_footer
10b0: 28 29 3b 0a 7d 0a                                ();.}.