|
1
|
<header> |
|
2
|
<div class="logo"> |
|
3
|
<th1> |
|
4
|
## |
|
5
|
## NOTE: The purpose of this procedure is to take the base URL of the |
|
6
|
## Fossil project and return the root of the entire web site using |
|
7
|
## the same URI scheme as the base URL (e.g. http or https). |
|
8
|
## |
|
9
|
proc getLogoUrl { baseurl } { |
|
10
|
set idx(first) [string first // $baseurl] |
|
11
|
if {$idx(first) != -1} { |
|
12
|
## |
|
13
|
## NOTE: Skip second slash. |
|
14
|
## |
|
15
|
set idx(first+1) [expr {$idx(first) + 2}] |
|
16
|
## |
|
17
|
## NOTE: (part 1) The [string first] command does NOT actually |
|
18
|
## support the optional startIndex argument as specified |
|
19
|
## in the TH1 support manual; therefore, we fake it by |
|
20
|
## using the [string range] command and then adding the |
|
21
|
## necessary offset to the resulting index manually |
|
22
|
## (below). In Tcl, we could use the following instead: |
|
23
|
## |
|
24
|
## set idx(next) [string first / $baseurl $idx(first+1)] |
|
25
|
## |
|
26
|
set idx(nextRange) [string range $baseurl $idx(first+1) end] |
|
27
|
set idx(next) [string first / $idx(nextRange)] |
|
28
|
if {$idx(next) != -1} { |
|
29
|
## |
|
30
|
## NOTE: (part 2) Add the necessary offset to the result of |
|
31
|
## the search for the next slash (i.e. the one after |
|
32
|
## the initial search for the two slashes). |
|
33
|
## |
|
34
|
set idx(next) [expr {$idx(next) + $idx(first+1)}] |
|
35
|
## |
|
36
|
## NOTE: Back up one character from the next slash. |
|
37
|
## |
|
38
|
set idx(next-1) [expr {$idx(next) - 1}] |
|
39
|
## |
|
40
|
## NOTE: Extract the URI scheme and host from the base URL. |
|
41
|
## |
|
42
|
set scheme [string range $baseurl 0 $idx(first)] |
|
43
|
set host [string range $baseurl $idx(first+1) $idx(next-1)] |
|
44
|
## |
|
45
|
## NOTE: Try to stay in SSL mode if we are there now. |
|
46
|
## |
|
47
|
if {[string compare $scheme http:/] == 0} { |
|
48
|
set scheme http:// |
|
49
|
} else { |
|
50
|
set scheme https:// |
|
51
|
} |
|
52
|
set logourl $scheme$host/ |
|
53
|
} else { |
|
54
|
set logourl $baseurl |
|
55
|
} |
|
56
|
} else { |
|
57
|
set logourl $baseurl |
|
58
|
} |
|
59
|
return $logourl |
|
60
|
} |
|
61
|
set logourl [getLogoUrl $baseurl] |
|
62
|
</th1> |
|
63
|
<a href="$logourl"> |
|
64
|
<img src="$logo_image_url" border="0" alt="$<project_name>"> |
|
65
|
</a> |
|
66
|
</div> |
|
67
|
<div class="title">$<title></div> |
|
68
|
<div class="status"><nobr><th1> |
|
69
|
if {[info exists login]} { |
|
70
|
puts "Logged in as $login" |
|
71
|
} else { |
|
72
|
puts "Not logged in" |
|
73
|
} |
|
74
|
</th1></nobr><small><div id="clock"></div></small></div> |
|
75
|
</header> |
|
76
|
<th1>html "<script nonce='$nonce'>"</th1> |
|
77
|
function updateClock(){ |
|
78
|
var e = document.getElementById("clock"); |
|
79
|
if(e){ |
|
80
|
var d = new Date(); |
|
81
|
function f(n) { |
|
82
|
return n < 10 ? '0' + n : n; |
|
83
|
} |
|
84
|
e.innerHTML = d.getUTCFullYear()+ '-' + |
|
85
|
f(d.getUTCMonth() + 1) + '-' + |
|
86
|
f(d.getUTCDate()) + ' ' + |
|
87
|
f(d.getUTCHours()) + ':' + |
|
88
|
f(d.getUTCMinutes()); |
|
89
|
setTimeout(updateClock,(60-d.getUTCSeconds())*1000); |
|
90
|
} |
|
91
|
} |
|
92
|
updateClock(); |
|
93
|
</script> |
|
94
|
<nav class="mainmenu" title="Main Menu"> |
|
95
|
<th1> |
|
96
|
set sitemap 0 |
|
97
|
foreach {name url expr class} $mainmenu { |
|
98
|
if {![capexpr $expr]} continue |
|
99
|
if {[string match /* $url]} {set url $home$url} |
|
100
|
html "<a href='$url' class='$class'>$name</a>\n" |
|
101
|
if {[string match */sitemap $url]} {set sitemap 1} |
|
102
|
} |
|
103
|
if {!$sitemap} { |
|
104
|
html "<a href='$home/sitemap'>...</a>" |
|
105
|
} |
|
106
|
</th1> |
|
107
|
</nav> |
|
108
|
|