"};
">>>:TIME1.0: Compiled by ThwartedEfforts(#2) on Fri Jul 7 01:33:45 1995 MET DST";
.
@verb $html_utils:"table_row" this none this rx
@program $html_utils:table_row
row_data = args[1];
heading = args[2] || "";
for elm in [1..length(row_data)]
row_data[elm] = tostr("
", row_data[elm]);
endfor
return {"
", heading, @row_data, "
"};
">>>:TIME1.0: Compiled by ThwartedEfforts(#2) on Fri Jul 7 01:28:41 1995 MET DST";
.
@verb $html_utils:"object_anchor" this none this rx
@program $html_utils:object_anchor
object = args[1];
label = args[2] || object.name;
if (!$object_utils:has_verb(object, $httpd.request_method_name))
return label;
endif
value = tostr("/", tonum(object), "/");
ind = object in $web_objects.object_refs;
if (ind)
value = $web_objects.web_refs[ind];
endif
if (is_player(object))
value = tostr("/~", object.name, "/");
endif
return this:anchor(value, label);
">>>:TIME1.0: Compiled by ThwartedEfforts(#2) on Sun Aug 6 19:41:49 1995 MET DST";
.
@verb $html_utils:"form_start" this none this rx
@program $html_utils:form_start
"hu:form_start(char method, url action); the method defaults to POST, the action is required";
if (length(args) < 2)
return "";
">>>:TIME1.0: Compiled by Kangor (#235) on Fri Jul 7 19:10:53 1995 MET DST";
.
@verb $html_utils:"form_text" this none this rx
@program $html_utils:form_text
"hu:form_text(char name, char value, int maxlength, char align, int size);";
"all values are required, but if they are false they will be ignored as attributes";
name = args[1] ? tostr(args[1], "\"") | "default\"";
value = args[2] ? tostr(" VALUE=\"", args[2], "\"") | "";
maxlength = args[3] ? tostr(" MAXLENGTH=\"", args[3], "\"") | "";
align = args[4] ? tostr(" ALIGN=\"", args[4], "\"") | "";
size = args[5] ? tostr(" SIZE=\"", args[5], "\"") | "";
return tostr("");
">>>:TIME1.0: Compiled by Kangor (#235) on Thu Jul 13 00:25:40 1995 MET DST";
.
@verb $html_utils:"form_urldecode_value" this none this rx
@program $html_utils:form_urldecode_value
"$html_utils:form_urldecode_value(char name, char query_string);";
"Returns the value associated with name in the query_string.";
"See \"help html\"";
name = args[1];
query = args[2];
value = "";
if (x = index(query, name + "="))
x = (x + length(name)) + 1;
value = query[x..length(query)];
value = value[1..(y = index(value, "&")) ? y - 1 | length(value)];
value = strsub(value, "+", " ");
endif
return value;
">>>:TIME1.0: Compiled by Kangor (#235) on Wed Sep 27 15:59:32 1995 MET";
.
@verb $html_utils:"form_hidden" this none this rx
@program $html_utils:form_hidden
"hu:form_hidden(char name, char value);";
return tostr("");
">>>:TIME1.0: Compiled by Kangor (#235) on Mon Jul 10 21:35:04 1995 MET DST";
.
@verb $html_utils:"base" this none this rx
@program $html_utils:base
"$html_utils:base(char url);";
return tostr("");
">>>:TIME1.0: Compiled by Kangor (#235) on Tue Jul 11 18:36:17 1995 MET DST";
.
@verb $html_utils:"image" this none this rx
@program $html_utils:image
"$html_utils:image (char pic, char alt);";
"name is mandatory, alt is optional";
source = tostr("\"", $httpd.graphics_root, args[1] ? args[1] | "e_moo.gif", "\"");
alt = args[2] ? tostr(" ALT=\"", args[2], "\"") | "";
border = tostr(" BORDER=0");
return tostr("");
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Sat Sep 2 19:40:58 1995 MET DST";
.
@verb $html_utils:"form_checkbox" this none this rx
@program $html_utils:form_checkbox
"hu:form_checkbox(char name, char value, char align, int size, int checked);";
"all values are required, but if they are false they will be ignored as attributes";
"one of these is required for each checkbox in a set of the same name";
name = args[1] ? tostr(args[1], "\"") | "default\"";
value = args[2] ? tostr(" VALUE=\"", args[2], "\"") | "";
align = args[3] ? tostr(" ALIGN=\"", args[3], "\"") | "";
size = args[4] ? tostr(" SIZE=\"", args[4], "\"") | "";
checked = args[5] ? " CHECKED" | "";
return tostr("");
">>>:TIME1.0: Compiled by Kangor (#235) on Thu Jul 13 00:34:26 1995 MET DST";
.
@verb $html_utils:"form_image" this none this rx
@program $html_utils:form_image
"hu:form_image(char name, url source, char align, int size);";
"all values are required, but if they are false they will be ignored as attributes";
"an exception to the above is source which is required to have a value";
name = args[1] ? tostr(args[1], "\"") | "default\"";
source = args[2] ? tostr(args[2], "\"") | "http://tecfasun1.unige.ch/~abakun/e_moo.gif\"";
align = args[3] ? tostr(" ALIGN=\"", args[3], "\"") | "";
size = args[4] ? tostr(" SIZE=\"", args[4], "\"") | "";
return tostr("");
">>>:TIME1.0: Compiled by Kangor (#235) on Thu Aug 17 21:23:49 1995 MET DST";
.
@verb $html_utils:"form_radio" this none this rx
@program $html_utils:form_radio
"hu:form_radio(STR label, STR group name, STR value, STR align, NUM size, NUM checked);";
"all values are required, but if they are false they will be ignored as attributes";
"one of these is required for each radio button in a set of the same name";
"only one radio button in a set of the same set can be checked";
"label is the label that will appear to the right of the button (tef)";
name = args[2] ? tostr(args[1], "\"") | "default\"";
value = args[3] ? tostr(" VALUE=\"", args[2], "\"") | "";
align = args[4] ? tostr(" ALIGN=\"", args[3], "\"") | "";
size = args[5] ? tostr(" SIZE=\"", args[4], "\"") | "";
checked = args[6] ? " CHECKED" | "";
return tostr(" ", args[1]);
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Mon Oct 9 20:18:41 1995 MET";
.
@verb $html_utils:"form_reset" this none this rx
@program $html_utils:form_reset
"$hu:form_reset(char value); ";
"value is an optional argument that will be the button label.";
return tostr(" 0) ? args[1] ? tostr(" VALUE=\"", args[1], "\"") | "" | "", ">");
">>>:TIME1.0: Compiled by Kangor (#235) on Wed Jul 12 23:59:15 1995 MET DST";
.
@verb $html_utils:"form_submit" this none this rx
@program $html_utils:form_submit
"$hu:form_submit(char name, char value); ";
"Both values are optional, the name identifies the particular button to the script, and the value is the button label.";
return tostr(" 0) ? args[1] ? tostr(" NAME=\"", args[1], "\"") | "" | "", (length(args) > 1) ? args[2] ? tostr(" VALUE=\"", args[2], "\"") | "" | "", ">");
">>>:TIME1.0: Compiled by Kangor (#235) on Wed Jul 12 23:45:42 1995 MET DST";
.
@verb $html_utils:"form_select_start" this none this rx
@program $html_utils:form_select_start
"hu:form_select_start(char name, int size, int multiple);";
"Values are required for all arguments, however a true value is require only for name.";
"The size and multiple args are ignored when filled with a false value.";
name = args[1] ? tostr(args[1], "\"") | "default\"";
size = args[2] ? tostr(" SIZE=\"", args[2], "\"") | "";
multiple = args[3] ? " MULTIPLE" | "";
return tostr("";
">>>:TIME1.0: Compiled by Kangor (#235) on Tue Aug 15 21:10:48 1995 MET DST";
.
@verb $html_utils:"form_textarea" this none this rx
@program $html_utils:form_textarea
"hu:form_textarea (char name, int rows, int cols, char text)";
"name, rows, and cols are required arguments; text is optional";
name = tostr(" NAME=\"", args[1], "\"");
rows = tostr(" ROWS=\"", args[2], "\"");
cols = tostr(" COLS=\"", args[3], "\"");
text = args[4] ? args[4] | "";
return {tostr(""};
.
@verb $html_utils:"verb_code" this none this rx
@program $html_utils:verb_code
":verb_code ( OBJ, VERB [, {lower, upper} ] )";
range = args[3];
methodref = args[1..2];
set_task_perms(caller_perms());
code = verb_code(@methodref, 1, 1);
if (typeof(code) == ERR)
return code;
endif
if (range)
rstr = tostr("Lines ", range[1], " through ", range[2], ".");
pre = (range[1] == 1) ? {} | {"..."};
post = (range[2] == length(code)) ? {} | {"..."};
code = {@pre, @code[range[1]..range[2]], @post};
endif
code = this:pre(code);
assignments = {};
sys = $sys;
for x in [1..length(code)]
line = code[x];
if (index(line, " = $"))
y = match(line, "%([a-za-Z_]+%) = %$%([a-za-Z_]+%)");
object = substitute("%2", y);
if (valid(sys.(object)))
assignments = {@assignments, {substitute("%1", y), tostr("$", object)}};
endif
endif
code[x] = this:code_to_html(code[x], methodref[1], methodref[2], assignments);
endfor
code = {@rstr ? {this:heading3(rstr)} | {}, @code};
return code;
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Wed Nov 1 00:43:59 1995 MET";
.
@verb $html_utils:"form_urldecode_all" this none this rx
@program $html_utils:form_urldecode_all
"$html_utils:form_urldecode_all(char query_string);";
"Returns all name/value pairs in the given query_string.";
"See \"help html\"";
su = $string_utils;
query = strsub(args[1], "?", "");
query = su:explode(query, "&");
for x in [1..length(query)]
query[x] = su:explode(query[x], "=");
if (length(query[x]) > 1)
query[x][2] = strsub(query[x][2], "+", " ");
endif
endfor
return query;
">>>:TIME1.0: Compiled by Kangor (#235) on Wed Sep 27 16:20:05 1995 MET";
.
@verb $html_utils:"pre" this none this rx
@program $html_utils:pre
text = $list_utils:flatten(args);
columns = args[2] || 100;
su = $string_utils;
x = 0;
command_utils = $command_utils;
for line in [1..length(text)]
x = x + 1;
text[line] = this:special_chars_sub(text[line]);
text[line] = this:_linesplit(text[line], columns);
(!(x % 3)) && command_utils:suspend_if_needed(0);
endfor
return {"
", @$list_utils:flatten(text), "
"};
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Fri Sep 29 18:16:46 1995 MET";
.
@verb $html_utils:"_linesplit" this none this rx
@program $html_utils:_linesplit
":_linesplit(line,len) => list of substrings of line";
"used by :pre to split up long lines if len>0";
line = args[1];
len = args[2];
spaces = match(line, "^%( *%).*");
if (spaces)
spaces = spaces[3][1];
ident = line[spaces[1]..spaces[2]];
else
ident = " ";
endif
su = $string_utils;
cline = {};
while (length(line) > len)
cutoff = rindex(line[1..len], " ");
if (nospace = cutoff < (len / 3))
cutoff = len + 1;
nospace = line[cutoff] != " ";
endif
cline = {@cline, line[1..cutoff - 1]};
line = (nospace ? "" | ident) + line[cutoff..length(line)];
endwhile
return {@cline, line};
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Thu Aug 31 00:04:22 1995 MET DST";
.
@verb $html_utils:"special_chars_sub" this none this rx
@program $html_utils:special_chars_sub
return $string_utils:substitute(args[1], this.html_subs);
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Tue Sep 5 10:03:02 1995 MET DST";
.
@verb $html_utils:"html_title_list html_title_listc" this none this
@program $html_utils:html_title_list
"wr_utils:title_list/title_listc([, @)";
"Creates an english list out of the titles of the objects in . Optional are passed on to $string_utils:english_list.";
"title_listc uses :titlec() for the first item.";
hu = $html_utils;
titles = {};
for x in (args[1])
titles = {@titles, hu:object_anchor(x, x:title())};
endfor
if (verb[length(verb)] == "c")
if (titles)
titles[1] = hu:object_anchor(args[1][1], args[1][1]:titlec());
elseif (length(args) > 1)
args[2] = $string_utils:capitalize(args[2]);
else
args = listappend(args, "Nothing");
endif
endif
return $string_utils:english_list(titles, @args[2..length(args)]);
">>>Copied from string utilities (#20):html_title_list written by Hacker (#38) Fri Jul 28 00:05:04 1995 MET DST";
">>>:TIME1.0: Compiled by Kangor (#235) on Fri Jul 28 00:05:04 1995 MET DST";
.
@verb $html_utils:"mailto" this none this rx
@program $html_utils:mailto
address = this:special_chars_sub(args[1]);
return tostr(this:anchor(tostr("mailto:", address), args[2] || address));
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Fri Sep 22 03:59:46 1995 MET DST";
.
@verb $html_utils:"format format_moo" this none this rx
@program $html_utils:format
"$html_utisl:format( LIST text )";
"";
"Returns text with lines ending with , so as to preserve line breaks, but keep from using mono-spacced text";
text = args[1];
format_for_moo = verb == "format_moo";
if ((length(args) == 1) && (typeof(text) == STR))
return tostr(text, " ");
endif
text = $list_utils:flatten(args);
for x in [1..length(text)]
text[x] = tostr(this:special_chars_sub(text[x]), " ");
if (format_for_moo)
while (y = match(text[x], " %(%$[a-zA-Z_]+%(:%|%.%)[a-zA-Z1-90_]+%)"))
y = y[3][1];
text[x][y[1]..y[2]] = this:tt(text[x][y[1]..y[2]]);
endwhile
while (y = match(text[x], " %(%(:%|%.%)[a-zA-Z_]+%)"))
y = y[3][1];
text[x][y[1]..y[2]] = this:tt(text[x][y[1]..y[2]]);
endwhile
endif
endfor
return text;
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Tue Sep 5 21:52:31 1995 MET DST";
.
@verb $html_utils:"unordered_list" this none this rx
@program $html_utils:unordered_list
ulist = args[1];
lines = {};
for x in (ulist)
lines = {@lines, tostr("
", x)};
endfor
return {"
", @lines, "
"};
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Wed Aug 16 23:20:51 1995 MET DST";
.
@verb $html_utils:"ordered_list" this none this rx
@program $html_utils:ordered_list
on = "";
off = "";
args = args[1];
for x in [1..length(args)]
args[x] = tostr("
", args[x]);
endfor
return {on, @args, off};
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Sun Aug 27 09:59:19 1995 MET DST";
.
@verb $html_utils:"code_to_html" this none this rx
@program $html_utils:code_to_html
":code_to_html ( STR, OBJ )";
"STR should be a line of code, OBJ should be the value of 'this'";
line = args[1];
object = args[2];
methodname = args[3];
assignments = args[4];
lhs = $list_utils:slice(assignments, 1);
rhs = $list_utils:slice(assignments, 2);
passregexp = "%(^%|%.%.%|[[{@!( ]%)%(pass%)(";
passlink = "/code/";
bfregexp = "%(^%|%.%.%|[[{@!( ]%)%([a-zA-Z_]+%)(";
bflink = "/help/";
methodregexp = "%(^%|%.%.%|[[{@!( ]%)%(%$?[a-zA-Z_0-9]+:[a-zA-Z_0-9]+%)(";
methodlink = "/code/";
thisregexp = "%(^%|%.%.%|[[{@!( ]%)%(this:[a-zA-Z_0-9]+%)(";
thislink = "/code/";
playerregexp = "%(^%|%.%.%|[[{@!( ]%)%(%(who%|player%):[a-zA-Z_0-9]+%)(";
playerlink = "/code/";
replacements = {};
colorchange = "+++";
while (x = match(line, passregexp))
sub = x[3][2];
string = line[sub[1]..sub[2]];
defparent = $object_utils:has_verb(parent(object), methodname);
if (defparent)
defparent = defparent[1];
link = {tostr(crypt(tostr(defparent)), "*"), strsub(tostr($wiz_utils:core_ref(defparent), ":", methodname), "#", "")};
anchor = {tostr(crypt(tostr(defparent)), "*"), string};
line[sub[1]..sub[2]] = this:anchor(tostr(passlink, link[1]), anchor[1]);
replacements = {@replacements, link, anchor};
endif
endwhile
while (x = match(line, bfregexp))
sub = x[3][2];
string = line[sub[1]..sub[2]];
string = {tostr(crypt(string), "*"), string};
line[sub[1]..sub[2]] = this:anchor(tostr(bflink, string[1], "()"), string[1]);
replacements = {@replacements, string};
(((seconds_left() < 2) || ticks_left()) < 400) && suspend(0);
endwhile
while (x = match(line, thisregexp))
sub = x[3][2];
string1 = line[sub[1]..sub[2]];
link = string1;
o = $object_utils:has_verb(object, link[index(link, ":") + 1..length(link)]);
if (o)
o = o[1];
link[1..index(link, ":") - 1] = strsub(tostr($wiz_utils:core_ref(o)), "#", "");
link = {tostr(crypt(string1), "*"), link};
anchor = {tostr(crypt(string1), "*"), string1};
line[sub[1]..sub[2]] = this:anchor(tostr(thislink, link[1]), anchor[1]);
replacements = {@replacements, link, anchor};
else
org = line[sub[1]..sub[2]];
new = tostr(crypt(org), "*");
line[sub[1]..sub[2]] = new;
replacements = {@replacements, {new, strsub(colorchange, "+++", org)}};
endif
(((seconds_left() < 2) || ticks_left()) < 400) && suspend(0);
endwhile
while (x = match(line, playerregexp))
sub = x[3][2];
string1 = line[sub[1]..sub[2]];
link = string1;
object = $object_utils:has_verb($wiz, $string_utils:explode(string1, ":")[2]);
if (object)
link[1..index(link, ":") - 1] = tostr($wiz_utils:core_ref(object[1]));
link = {tostr(crypt(string1), "*"), link};
anchor = {tostr(crypt(string1), "*"), string1};
line[sub[1]..sub[2]] = this:anchor(tostr(playerlink, link[1]), anchor[1]);
replacements = {@replacements, link, anchor};
else
org = line[sub[1]..sub[2]];
new = tostr(crypt(org), "*");
line[sub[1]..sub[2]] = new;
replacements = {@replacements, {new, strsub(colorchange, "+++", org)}};
endif
(((seconds_left() < 2) || ticks_left()) < 400) && suspend(0);
endwhile
while (x = match(line, methodregexp))
sub = x[3][2];
string = line[sub[1]..sub[2]];
link = string;
"convert assigned core refs to their real counterparts";
colon = index(link, ":") - 1;
x = link[1..colon];
if (xInRHS = x in lhs)
link[1..colon] = rhs[xInRHS];
replacements = {@replacements, {tostr(crypt(link), "*"), link}};
endif
string = {tostr(crypt(string), "*"), string};
line[sub[1]..sub[2]] = this:anchor(tostr(methodlink, link), string[1]);
replacements = {@replacements, string};
(((seconds_left() < 2) || ticks_left()) < 400) && suspend(0);
endwhile
line = $string_utils:substitute(line, replacements);
return line;
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Wed Nov 1 00:47:52 1995 MET";
.
@verb $html_utils:"def_list" this none this rx
@program $html_utils:def_list
lines = {};
for x in (args[1])
lines = {@lines, tostr("
", x[1]), "
", x[2]};
endfor
return {"
", @lines, "
"};
">>>:TIME1.0: Compiled by ThwartedEfforts (#2) on Mon Sep 18 22:56:59 1995 MET DST";
.
@verb $html_utils:"menu" this none this rx
@program $html_utils:menu
on = "";
args = args[1];
for x in [1..length(args)]
args[x] = tostr("
", args[x]);
endfor
return {on, @args, off};
">>>:TIME1.0: Compiled by Kangor (#235) on Mon Oct 9 16:18:39 1995 MET";
.
@verb $html_utils:"anchor_name" this none this rx
@program $html_utils:anchor_name
":anchor( label, content )";
label = args[1];
content = args[2] || label;
return tostr("", content, "");
">>>Copied from HTML Utilities ($html_utils):anchor written by ThwartedEfforts (#2) Tue Oct 10 02:53:45 1995 MET";
">>>:TIME1.0: Compiled by Kangor (#235) on Tue Oct 10 02:56:18 1995 MET";
.
@rmverb $list_utils:flatten
@verb $list_utils:"flatten*_suspended" this none this rxd
@program $list_utils:flatten
":flatten*_suspended(LIST list_of_lists) => LIST of all lists in given list `flattened'";
newlist = {};
suspendable = verb == "flatten_suspended";
for elm in (args)
if (typeof(elm) == LIST)
newlist = {@newlist, @this:(verb)(@elm)};
else
newlist = {@newlist, elm};
endif
if (suspendable && (ticks_left() < 400 || seconds_left() < 2))
suspend(0);
endif
endfor
return newlist;
.
@verb $wiz_utils:"core_ref" this none this rxd
@program $wiz_utils:core_ref
"this isn't E_MOO's verb probably, but it does the job (at least on recent LambdaCore MOOs)";
return $code_utils:corify_object(args[1]);
.
@verb $string_utils:"matchable_string" this none this rxd
@program $string_utils:matchable_string
"$string_utils:matchable_string(OBJ) => STR";
"";
"Returns a string that will match the given object";
what = args[1];
if (is_player(what))
return tostr("~", what.name);
elseif ($object_utils:isa(what, $mail_recipient))
if (what.location == $mail_agent)
return tostr("*", what.aliases[1]);
else
return tostr(what);
endif
else
return tostr($wiz_utils:core_ref(what));
endif
.
@verb $code_utils:"format_traceback" this none this rxd Hacker
@program $code_utils:format_traceback
"Usage: :format_traceback(exception)";
"";
"format a traceback like the server does, given output from ";
"the exception handling traceback value or callers(line numbers)";
{error, msg, value, tb} = args;
{top, @tb} = tb;
msg = tostr(": ", msg);
oldplayer = player;
text = {this:_format_traceback_frame(top, oldplayer) + msg};
oldplayer = top[5];
for fr in (tb)
text = {@text, "... called from " + this:_format_traceback_frame(fr, oldplayer)};
oldplayer = fr[5];
endfor
text = {@text, "(End of traceback)"};
return text;
"Based on a verb from JaysHouseMOO";
.
@verb $code_utils:"_format_traceback_frame" this none this rxd Hacker
@program $code_utils:_format_traceback_frame
"Usage: :_format_traceback_frame(frame)";
"";
{frame, ?oldplayer = player} = args;
{ths, vname, prog, vloc, plyr, ?line = 0} = frame;
if (vloc == #-1 && prog == #-1 && vname != "")
vname = "built-in function " + vname + "()";
elseif (vloc == #-1 && vname == "")
vname = "Input to eval()";
elseif (vloc < #0 || prog < #0)
"how does this HAPPEN?";
vname = "vloc and prog are both < #0 -- what?";
else
vname = tostr($string_utils:matchable_string(vloc), ":", vname);
endif
if (vloc != ths)
thstr = tostr(" (this == ", $string_utils:matchable_string(ths), ")");
else
thstr = "";
endif
if (oldplayer != plyr)
plyrstr = tostr(" (player == ", plyr, ")");
else
plyrstr = "";
endif
return tostr(vname, thstr, ", line ", line || "?", plyrstr);
"Based on a verb from JaysHouseMOO";
.
@create $thing named Webbable Objects,web_objects
@prop #0."web_objects" #-1 rc
;;$web_objects = player:my_match_object("web_objects");
@prop $web_objects."default" #-1 rc
;;$web_objects.("default") = $httpd;
;"***Finished***"