Switch to edit mode.
Name(s): webtable_list1: "Usage: this:webtable_list( LIST (specially formatted list - see below) )"
2: ""
3: "mylist={{width, cellpadding, cellspacing, border, align}, {table_title, table_title_link, rowspan, fontparams}, {{header, link, colspan, rowspan, fontparams},{header, link, colspan, rowspan, fontparams},...}, {{cell_content, link, colspan, rowspan, fontparams},{cell_content, link, colspan, rowspan, fontparams},...}}}"
4: ""
5: "width, cellpadding, cellspacing, and border are INT, as well as ALL colspans."
6: "The rest are strings. fontparams are the GUTS to a font tag, but do not"
7: "include the actual FONT element. Hopefully, anything left as an empty"
8: "string, will not be included in the markup. Assumptions might be made."
9: ""
10: inform = this.owner
11: count = 1
12: t = {}
13: inform:tell("Webhit on ", tostr(this), ":", verb, " via ", tostr(this), ":", callers()[1][2])
14: "primitive error checking"
15: if (!args)
16: return {tostr(this) + ":" + verb + " needs args and got none."}
17: elseif (args[1][1][1] < 1)
18: return {tostr(this) + ":" + verb + " => Width setting must be at least 1."}
19: endif
20: mylist = args[1]
21: " build a table "
22: t = {@t, "<TABLE align=\"" + mylist[1][5] + "\" cellpadding=\"" + tostr(mylist[1][2]) + "\" cellspacing==\"" + tostr(mylist[1][3]) + "\" border=\"" + tostr(mylist[1][4]) + "\">"}
23: "title?"
24: if (mylist[2])
25: "no need for colspan... crosses entire width of list."
26: "we MAY need to set it at width though"
27: title = mylist[2]
28: temp = temp2 = {}
29: "First, the title text"
30: temp = {@temp, title[1]}
31: "Title link url?"
32: temp = title[2] ? {"<A HREF=\"" + title[2] + "\">", @temp, "</A>"} | temp
33: "Title font setting?"
34: temp = title[4] ? {"<FONT " + title[4] + ">", @temp, "</FONT>"} | temp
35: "do the title markup. Use width for colspan."
36: temp2 = {"<TH"}
37: temp2 = {@temp2, " colspan=\"" + tostr(mylist[1][1]) + "\""}
38: "use rowspan if it exists"
39: temp2 = title[3] ? {@temp2, " rowspan=\"" + tostr(title[3]) + "\""} | temp2
40: temp = {@temp2, ">", @temp, "</TH>"}
41: t = {@t, $string_utils:from_list(temp)}
42: t = {@t, "<TR></TR>"}
43: endif
44: "headers?"
45: if (mylist[3])
46: for header in (mylist[3])
47: temp = temp2 = {}
48: "First, the header text"
49: temp = {@temp, header[1]}
50: "header link url?"
51: temp = header[2] ? {"<A HREF=\"" + header[2] + "\">", @temp, "</A>"} | temp
52: "header font setting?"
53: temp = header[5] ? {"<FONT " + header[5] + ">", @temp, "</FONT>"} | temp
54: "do the header markup. col and row span included"
55: temp2 = {@temp2, "<TH"}
56: "use colspan if it exists"
57: temp2 = header[3] ? {@temp2, " colspan=\"" + tostr(header[3]) + "\""} | temp2
58: "use rowspan if it exists"
59: temp2 = header[4] ? {@temp2, " rowspan=\"" + tostr(header[4]) + "\""} | temp2
60: temp = {@temp2, ">", @temp, "</TH>"}
61: t = {@t, $string_utils:from_list(temp)}
62: endfor
63: t = {@t, "<TR></TR>"}
64: endif
65: "cells?"
66: if (mylist[4])
67: width = length(mylist[3])
68: curwidth = 0
69: for cell in (mylist[4])
70: temp = temp2 = {}
71: "First, the cell text"
72: temp = {@temp, cell[1]}
73: "cell link url?"
74: temp = cell[2] ? {"<A HREF=\"" + cell[2] + "\">", @temp, "</A>"} | temp
75: "cell font setting? (having a cell link... overrides)"
76: temp = cell[5] ? {"<FONT " + cell[5] + ">", @temp, "</FONT>"} | temp
77: "do the cell markup. col and row span included"
78: temp2 = {@temp2, "<TD"}
79: "use colspan if it exists"
80: temp2 = cell[3] ? {@temp2, " colspan=\"" + tostr(cell[3]) + "\""} | temp2
81: "use rowspan if it exists"
82: temp2 = cell[4] ? {@temp2, " rowspan=\"" + tostr(cell[4]) + "\""} | temp2
83: temp = {@temp2, ">", @temp, "</TD>"}
84: t = {@t, $string_utils:from_list(temp)}
85: curwidth = curwidth + 1
86: if (curwidth == width)
87: t = {@t, "<TR></TR>"}
88: curwidth = 0
89: endif
90: endfor
91: t = {@t, "<TR></TR>"}
92: endif
93: t = {@t, "</TABLE>"}
94: return t
95: "Compiled on Thu Feb 28 18:28:32 2002 EST by Wingy (#1163)"
96: "Last modified by Wingy (#9223) on Mon Mar 18 09:52:54 2002 MST."