View/Edit #52:numberbar

Switch to edit mode.

Name(s): numberbar
1:  ":numberbar(anchor, min, now, max)"
2:  "Returns the HTML code for a snazy numbered selection bar."
3:  ""
4:  "anchor is the full anchor tag with a '#' in place of the selected num"
5:  "eg. <A TARGET='_parent' HREF='/1234?selection=#'>"
6:  "'min' and 'max' are the two extreme integer values."
7:  "'now' is the currently selected value."
8:  {anchor, min, now, max} = args
9:  if (min > max)
10:   return ""
11: endif
12: fileurl = $www:fileurl($html_utils, "")
13: msg = {"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>"}
14: if (now > min)
15:   msg = {@msg, tostr("<TD>", strsub(anchor, "#", tostr(now - 1)), "<IMG BORDER=0 height=17 width=67 SRC=\"", fileurl, "prev.gif\" ALT=\"prev\"></A></TD>")}
16: else
17:   msg = {@msg, "<TD WIDTH=67>&nbsp;</TD>"}
18: endif
19: for x in [min..max]
20:   if (x == now)
21:     msg = {@msg, tostr("<TD><IMG BORDER=0 height=17 width=18 SRC=\"", fileurl, "nav2.gif\" ALT=\"", x, "\"></TD>")}
22:   else
23:     msg = {@msg, tostr("<TD>", strsub(anchor, "#", tostr(x)), "<IMG BORDER=0 height=17 width=18 SRC=\"", fileurl, "nav1.gif\" ALT=\"", x, "\"></A></TD>")}
24:   endif
25: endfor
26: if (now < max)
27:   msg = {@msg, tostr("<TD>", strsub(anchor, "#", tostr(now + 1)), "<IMG BORDER=0 height=17 width=68 SRC=\"", fileurl, "next.gif\" ALT=\"next\"></A></TD>")}
28: else
29:   msg = {@msg, "<TD WIDTH=68>&nbsp;</TD>"}
30: endif
31: msg = {@msg, "</TR><TR>"}
32: if (now > min)
33:   msg = {@msg, tostr("<td align=center><font size=-2>", now - 1, "</font></td>")}
34: else
35:   msg = {@msg, "<TD>&nbsp;</TD>"}
36: endif
37: for x in [min..max]
38:   msg = {@msg, tostr("<td align=center><font size=-2>", x, "</font></td>")}
39: endfor
40: if (now < max)
41:   msg = {@msg, tostr("<td align=center><font size=-2>", now + 1, "</font></td>")}
42: else
43:   msg = {@msg, "<TD>&nbsp;</TD>"}
44: endif
45: return {@msg, "</TR></TABLE>"}
46: "Last modified by Dax (#789) on Wed Jul  1 11:27:35 1998 EDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]