proc isin {val lst} {
set tot [llength $lst]
for {set i 0} {$i < $tot} {set i [expr {$i + 1}]} {
set cur [lindex $lst $i]
if {$val eq $cur} {
return 0
}
}
return 1
}
proc menulink {pagename url name} {
upvar current_page current
upvar home home
set compsetup [string compare [string range $current 0 4] setup]
set comphome [string compare [string range $current 0 3] home]
set comptag [string compare $current tagtimeline]
set compbr [string compare $current brtimeline]
set compdir [isin $current "artifact ci finfo hexdump"]
set comptl [string compare $current info]
set comptkt [isin $current "modreq rptedit tktnew rptsql rptview"]
html "$name"
}
menulink "home" $index_page Home
if {[anycap jor]} {
menulink "timeline" "/timeline" Timeline
}
if {[hascap oh]} {
menulink "dir" "/dir?ci=tip" Files
}
if {[hascap o]} {
menulink "brlist" "/brlist" Branches
menulink "taglist" "/taglist" Tags
}
if {[hascap r]} {
menulink "ticket" "/ticket" Tickets
}
if {[hascap j]} {
menulink "wiki" "/wiki" Wiki
}
if {[hascap s]} {
menulink "setup" "/setup" Admin
} elseif {[hascap a]} {
menulink "setup_ulist" "/setup_ulist" Users
}