Tk Library Source Code

Artifact [b611e04edf]
Login

Artifact b611e04edfd8b04d577b1dce25a36f23ac1d68b5:

Attachment "h.tcl" to ticket [484117ffff] added by decosterjos 2001-11-23 17:06:12.
# html::minorList
#
#	Create a list of links given a list of label, URL pairs.
#	If the URL is the current page, it is not highlighted.
#
#       Based on html::minorMenu
#
# Arguments:
#
#	list	List that alternates label, url, label, url
#
# Results:
#	A <ul><li><a...><\li>.....<\ul> fragment
#    or a <ol><li><a...><\li>.....<\ol> fragment

proc html::minorList {list {ordered 0}} {
    global page
    ::set s ""
    ::set html ""
    ::if { $ordered } {
	append html [html::openTag ol]
    } else {
	append html [html::openTag ul]
    }
    regsub -- {index.h?tml$} [ncgi::urlStub] {} this
    ::foreach {label url} $list {
	append html [html::openTag li]
	regsub -- {index.h?tml$} $url {} that
	::if {[string compare $this $that] == 0} {
	    append html "$s$label"
	} else {
	    append html "$s<a href=\"$url\">$label</a>"
	}
	append html [html::closeTag]
	append html \n
    }
    append html [html::closeTag]
    return $html
}

# html::paramRow
#
#	Format a table row.  If the default font has been set, this
#	takes care of wrapping the table cell contents in a font tag.
#
#       Based on html::row
#
# Arguments:
#	list	Values to put into the row
#       rparam   Parameters for row
#       cparam   Parameters for cells
#
# Results:
#	A <tr><td>...</tr> fragment

proc html::paramRow {list {rparam {}} {cparam {}}} {
    ::set html "<tr $rparam>\n"
    ::foreach x $list {
	append html \t[html::cell $cparam $x td]\n
    }
    append html "</tr>\n"
    return $html
}