external next up previous contents index
Next: 8.10 Permissions and Generic Up: 8.9 [TECFAMOO] ``WOO'' Tutorial Previous: Adding webby verbs

Customizing the :htext verb

 

The verb that displays most of the object on the web is ``:htext''. If you wish you can edit the verb to display information it normally would not. This verb is not too complicated, but you have to watch out what you do: It has to return some correct html ! Also to insure that people won't get lost, it is a good idea to keep the standard header of the html page.

The most important core objects have :htext verbs defined (see section 14.3.2 for details). So our holder verb inherits the :htext verb from $thing which in turn inherits it from #1.

Please note that the verb below may change now and then ! Also remember that we break up lines here to make them fit on a page (especially the paper version of this manual)

>@l #1:htext
#1:"htext"   this none this
 1:  "Returns the object:title as both the html title and as an <h1>
      header at the top of the web page.";
 2:  "Followed by the objects description, and checks to see if text
      is preformatted.";
 3:  "Generates a url for the object's location, adds in anything from
      the htext property, followed by any web_verbs, and ending with
      a standard footer.";
 4:  set_task_perms(caller_perms());
 5:  title = this:title();
 6:  desc = typeof(this.description) == LIST ? this.description |
     {this.description};
 7:  if (this.pre)
 8:    desc = {"<pre>", @desc, "</pre>-----<br>"};
 9:  endif
10:  loc = valid(this.location) ? tostr("<h3>Location:</h3> ",
     $www_utils:genref_obj(this.location)) | "";
11:  htext = typeof(this.htext) == LIST ? this.htext | {this.htext};
12:  verbs = this:list_web_verbs();
13:  "this.webhits = this.webhits + 1;";
14:  return {@$www_utils:do_html_header(title),
      tostr("<h1 align=\"center\">", title, "</h1>"), "<p>", 
      @desc, "<p>", loc, "<p>", @htext, "<p>", @verbs, 
     @$www_utils:do_html_footer()};
15:  "Last edited by Irradiate on Fri Aug 25 14:47:32 1995 MET DST";
--

You can copy this verb and tailor it for your needs if you wish. Be sure to delete the following line.

   4:  set_task_perms(caller_perms());
Since :htext verbs on core objects run under wizard permission execution permissions are changed at run-time. But only wizards can do that.

Also, if you really plan to write your own :htext verb, consult the $www_utils box, or at least try to understand what the $www_utils verbs used in the above :htext verb do.



Daniel K. Schneider
Thu Apr 17 12:43:52 MET DST 1997