Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Hex Artifact Content

Artifact 1e28d77b41d34fb61cd3a24d353ca9fec23e666d:

  • File features/hooks.th1 — part of check-in [c3f771e697] at 2020-11-13 20:58:20 on branch trunk — Apply $baseurl to projectname title link (user: mario size: 1935)

0000: 0a 23 20 4f 75 74 70 75 74 73 20 61 20 74 65 78  .# Outputs a tex
0010: 74 75 61 6c 20 2f 63 68 61 6e 67 65 6c 6f 67 0a  tual /changelog.
0020: 70 72 6f 63 20 77 65 62 70 61 67 65 5f 63 68 61  proc webpage_cha
0030: 6e 67 65 6c 6f 67 20 7b 7d 20 7b 0a 20 20 68 74  ngelog {} {.  ht
0040: 6d 6c 20 22 3c 21 2d 2d 20 4e 45 57 53 2d 73 74  ml "<!-- NEWS-st
0050: 79 6c 65 20 74 69 6d 65 6c 69 6e 65 20 2d 2d 3e  yle timeline -->
0060: 20 3c 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69   <meta http-equi
0070: 76 3d 5c 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65  v=\"Content-Type
0080: 5c 22 20 63 6f 6e 74 65 6e 74 3d 5c 22 74 65 78  \" content=\"tex
0090: 74 2f 70 6c 61 69 6e 5c 22 3e 20 3c 70 72 65 3e  t/plain\"> <pre>
00a0: 5c 6e 5c 6e 22 3b 0a 20 20 73 65 74 20 76 65 72  \n\n";.  set ver
00b0: 73 69 6f 6e 20 22 74 72 75 6e 6b 22 0a 20 20 70  sion "trunk".  p
00c0: 75 74 73 20 22 24 76 65 72 73 69 6f 6e 20 28 75  uts "$version (u
00d0: 6e 72 65 6c 65 61 73 65 64 29 5c 6e 22 3b 0a 20  nreleased)\n";. 
00e0: 20 71 75 65 72 79 20 7b 0a 20 20 20 20 20 53 45   query {.     SE
00f0: 4c 45 43 54 20 65 76 65 6e 74 2e 6d 74 69 6d 65  LECT event.mtime
0100: 2c 20 74 61 67 2e 74 61 67 6e 61 6d 65 2c 20 4d  , tag.tagname, M
0110: 41 58 28 74 61 67 2e 74 61 67 69 64 29 2c 20 44  AX(tag.tagid), D
0120: 41 54 45 28 65 76 65 6e 74 2e 6d 74 69 6d 65 29  ATE(event.mtime)
0130: 20 41 53 20 64 2c 0a 20 20 20 20 20 20 20 20 20   AS d,.         
0140: 20 20 20 52 45 50 4c 41 43 45 28 54 52 49 4d 28     REPLACE(TRIM(
0150: 52 45 50 4c 41 43 45 28 65 76 65 6e 74 2e 63 6f  REPLACE(event.co
0160: 6d 6d 65 6e 74 2c 20 63 68 61 72 28 31 30 2c 31  mment, char(10,1
0170: 30 29 2c 20 63 68 61 72 28 31 30 29 29 2c 20 63  0), char(10)), c
0180: 68 61 72 28 38 2c 31 30 2c 31 33 2c 33 32 29 29  har(8,10,13,32))
0190: 2c 20 63 68 61 72 28 31 30 29 2c 20 63 68 61 72  , char(10), char
01a0: 28 31 30 2c 33 32 2c 33 32 2c 33 32 29 29 20 41  (10,32,32,32)) A
01b0: 53 20 63 6f 6d 6d 65 6e 74 0a 20 20 20 20 20 46  S comment.     F
01c0: 52 4f 4d 20 65 76 65 6e 74 0a 20 20 20 20 20 20  ROM event.      
01d0: 4c 45 46 54 20 4a 4f 49 4e 20 74 61 67 78 72 65  LEFT JOIN tagxre
01e0: 66 20 4f 4e 20 65 76 65 6e 74 2e 6f 62 6a 69 64  f ON event.objid
01f0: 3d 74 61 67 78 72 65 66 2e 72 69 64 0a 20 20 20  =tagxref.rid.   
0200: 20 20 20 4c 45 46 54 20 4a 4f 49 4e 20 74 61 67     LEFT JOIN tag
0210: 20 4f 4e 20 74 61 67 78 72 65 66 2e 74 61 67 69   ON tagxref.tagi
0220: 64 3d 74 61 67 2e 74 61 67 69 64 0a 20 20 20 20  d=tag.tagid.    
0230: 20 57 48 45 52 45 20 74 79 70 65 3d 27 63 69 27   WHERE type='ci'
0240: 0a 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 6f  .     GROUP BY o
0250: 62 6a 69 64 0a 20 20 20 20 20 4f 52 44 45 52 20  bjid.     ORDER 
0260: 42 59 20 65 76 65 6e 74 2e 6d 74 69 6d 65 20 44  BY event.mtime D
0270: 45 53 43 0a 20 20 20 20 20 4c 49 4d 49 54 20 37  ESC.     LIMIT 7
0280: 35 30 0a 20 20 7d 20 7b 0a 20 20 20 20 20 69 66  50.  } {.     if
0290: 20 7b 5b 72 65 67 65 78 70 20 7b 5e 73 79 6d 2d   {[regexp {^sym-
02a0: 2e 2a 5c 64 2b 5c 2e 5c 64 2b 7d 20 24 74 61 67  .*\d+\.\d+} $tag
02b0: 6e 61 6d 65 5d 7d 20 7b 0a 20 20 20 20 20 20 20  name]} {.       
02c0: 20 66 6f 72 20 7b 7d 20 7b 5b 73 74 72 69 6e 67   for {} {[string
02d0: 20 6c 65 6e 67 74 68 20 24 74 61 67 6e 61 6d 65   length $tagname
02e0: 5d 20 3e 3d 20 33 20 26 26 20 5b 72 65 67 65 78  ] >= 3 && [regex
02f0: 70 20 7b 5e 5c 64 2b 5c 2e 7d 20 24 74 61 67 6e  p {^\d+\.} $tagn
0300: 61 6d 65 5d 20 3d 3d 20 30 7d 20 7b 7d 20 7b 0a  ame] == 0} {} {.
0310: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 74 61            set ta
0320: 67 6e 61 6d 65 20 5b 73 74 72 69 6e 67 20 72 61  gname [string ra
0330: 6e 67 65 20 24 74 61 67 6e 61 6d 65 20 31 20 31  nge $tagname 1 1
0340: 30 30 5d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20  00].        }.  
0350: 20 20 20 20 20 20 70 75 74 73 20 22 5c 6e 24 74        puts "\n$t
0360: 61 67 6e 61 6d 65 20 28 24 64 29 5c 6e 22 3b 0a  agname ($d)\n";.
0370: 20 20 20 20 20 7d 0a 20 20 20 20 20 70 75 74 73       }.     puts
0380: 20 22 20 2a 20 24 63 6f 6d 6d 65 6e 74 5c 6e 22   " * $comment\n"
0390: 3b 0a 20 20 7d 0a 20 20 70 75 74 73 20 22 5c 6e  ;.  }.  puts "\n
03a0: 5c 6e 22 3b 0a 7d 0a 0a 23 20 41 6c 74 65 72 6e  \n";.}..# Altern
03b0: 61 74 69 76 65 20 74 6f 20 2f 72 61 77 20 74 72  ative to /raw tr
03c0: 75 6e 6b 20 66 69 6c 65 20 61 63 63 65 73 73 20  unk file access 
03d0: 77 69 74 68 6f 75 74 20 3f 6e 61 6d 65 3d 75 75  without ?name=uu
03e0: 69 64 2c 0a 23 20 44 6f 65 73 6e 27 74 20 77 6f  id,.# Doesn't wo
03f0: 72 6b 20 77 69 74 68 20 43 4f 4e 54 45 4e 54 28  rk with CONTENT(
0400: 29 20 79 65 74 2e 0a 70 72 6f 63 20 77 65 62 70  ) yet..proc webp
0410: 61 67 65 5f 63 61 74 20 7b 7d 20 7b 0a 20 20 73  age_cat {} {.  s
0420: 65 74 20 6e 61 6d 65 20 5b 67 65 74 50 61 72 61  et name [getPara
0430: 6d 65 74 65 72 20 6e 61 6d 65 20 22 22 5d 0a 20  meter name ""]. 
0440: 20 69 66 20 7b 21 5b 73 74 72 69 6e 67 20 6c 65   if {![string le
0450: 6e 67 74 68 20 24 6e 61 6d 65 5d 7d 20 7b 20 70  ngth $name]} { p
0460: 75 74 73 20 22 4e 6f 20 66 69 6c 65 6e 61 6d 65  uts "No filename
0470: 20 67 69 76 65 6e 2e 22 3b 20 62 72 65 61 6b 3b   given."; break;
0480: 20 7d 0a 20 20 71 75 65 72 79 20 7b 0a 20 20 20   }.  query {.   
0490: 20 20 53 45 4c 45 43 54 20 75 75 69 64 0a 20 20    SELECT uuid.  
04a0: 20 20 20 46 52 4f 4d 20 62 6c 6f 62 20 4c 45 46     FROM blob LEF
04b0: 54 20 4a 4f 49 4e 20 6d 6c 69 6e 6b 20 4f 4e 20  T JOIN mlink ON 
04c0: 62 6c 6f 62 2e 72 69 64 3d 6d 6c 69 6e 6b 2e 66  blob.rid=mlink.f
04d0: 69 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  id.             
04e0: 20 20 4c 45 46 54 20 4a 4f 49 4e 20 66 69 6c 65    LEFT JOIN file
04f0: 6e 61 6d 65 20 4f 4e 20 6d 6c 69 6e 6b 2e 66 6e  name ON mlink.fn
0500: 69 64 3d 66 69 6c 65 6e 61 6d 65 2e 66 6e 69 64  id=filename.fnid
0510: 0a 20 20 20 20 20 57 48 45 52 45 20 6e 61 6d 65  .     WHERE name
0520: 20 3d 20 24 6e 61 6d 65 0a 20 20 20 20 20 4f 52   = $name.     OR
0530: 44 45 52 20 42 59 20 72 69 64 20 44 45 53 43 20  DER BY rid DESC 
0540: 4c 49 4d 49 54 20 31 0a 20 20 7d 20 7b 20 68 74  LIMIT 1.  } { ht
0550: 6d 6c 20 5b 61 72 74 69 66 61 63 74 20 22 24 75  ml [artifact "$u
0560: 75 69 64 22 5d 3b 20 7d 0a 7d 0a 0a 23 20 47 65  uid"]; }.}..# Ge
0570: 6e 65 72 61 74 65 20 61 20 74 65 78 74 2f 75 72  nerate a text/ur
0580: 69 2d 6c 69 73 74 20 66 6f 72 20 61 76 61 69 6c  i-list for avail
0590: 61 62 6c 65 20 66 69 6c 65 73 0a 70 72 6f 63 20  able files.proc 
05a0: 77 65 62 70 61 67 65 5f 75 72 69 2d 6c 69 73 74  webpage_uri-list
05b0: 20 7b 7d 20 7b 0a 20 20 68 74 6d 6c 20 22 23 20   {} {.  html "# 
05c0: 46 6f 73 73 69 6c 20 6c 61 74 65 73 74 20 66 69  Fossil latest fi
05d0: 6c 65 20 72 65 66 65 72 65 6e 63 65 73 20 3c 70  le references <p
05e0: 72 65 3e 5c 72 5c 6e 22 0a 20 20 71 75 65 72 79  re>\r\n".  query
05f0: 20 7b 0a 20 20 20 20 20 53 45 4c 45 43 54 20 66   {.     SELECT f
0600: 69 6c 65 6e 61 6d 65 2e 6e 61 6d 65 2c 20 75 75  ilename.name, uu
0610: 69 64 0a 20 20 20 20 20 46 52 4f 4d 20 62 6c 6f  id.     FROM blo
0620: 62 20 4c 45 46 54 20 4a 4f 49 4e 20 6d 6c 69 6e  b LEFT JOIN mlin
0630: 6b 20 4f 4e 20 62 6c 6f 62 2e 72 69 64 3d 6d 6c  k ON blob.rid=ml
0640: 69 6e 6b 2e 66 69 64 20 4c 45 46 54 20 4a 4f 49  ink.fid LEFT JOI
0650: 4e 20 66 69 6c 65 6e 61 6d 65 20 4f 4e 20 6d 6c  N filename ON ml
0660: 69 6e 6b 2e 66 6e 69 64 3d 66 69 6c 65 6e 61 6d  ink.fnid=filenam
0670: 65 2e 66 6e 69 64 0a 20 20 20 20 20 47 52 4f 55  e.fnid.     GROU
0680: 50 20 42 59 20 66 69 6c 65 6e 61 6d 65 2e 6e 61  P BY filename.na
0690: 6d 65 20 20 4f 52 44 45 52 20 42 59 20 72 69 64  me  ORDER BY rid
06a0: 20 44 45 53 43 0a 20 20 7d 20 7b 20 68 74 6d 6c   DESC.  } { html
06b0: 20 22 24 6e 61 6d 65 3f 6e 61 6d 65 3d 24 75 75   "$name?name=$uu
06c0: 69 64 5c 72 5c 6e 22 20 7d 0a 7d 0a 0a 23 20 49  id\r\n" }.}..# I
06d0: 6e 76 6f 6b 65 73 20 77 65 62 20 72 65 71 75 65  nvokes web reque
06e0: 73 74 20 70 61 67 65 20 70 72 6f 63 73 0a 70 72  st page procs.pr
06f0: 6f 63 20 77 65 62 70 61 67 65 5f 68 6f 6f 6b 20  oc webpage_hook 
0700: 7b 7d 20 7b 0a 20 20 23 69 66 20 7b 21 20 5b 61  {} {.  #if {! [a
0710: 6e 79 63 61 70 20 72 6f 5d 7d 20 7b 20 62 72 65  nycap ro]} { bre
0720: 61 6b 20 7d 0a 20 20 63 61 74 63 68 20 7b 20 22  ak }.  catch { "
0730: 77 65 62 70 61 67 65 5f 24 3a 3a 77 65 62 5f 6e  webpage_$::web_n
0740: 61 6d 65 22 3b 20 72 65 74 75 72 6e 20 2d 63 6f  ame"; return -co
0750: 64 65 20 32 20 66 6f 75 6e 64 3b 20 7d 20 72 63  de 2 found; } rc
0760: 0a 20 20 69 66 20 7b 22 24 72 63 22 20 65 71 20  .  if {"$rc" eq 
0770: 22 66 6f 75 6e 64 22 7d 20 7b 20 62 72 65 61 6b  "found"} { break
0780: 20 63 6f 6e 74 69 6e 75 65 20 7d 0a 7d 0a 0a      continue }.}..