# $Id: s.HtmlPlace.xotcl 1.9 01/03/23 21:55:31+01:00 neumann@somewhere.wu-wien.ac.at $
package provide xotcl::actiweb::htmlPlace 0.8

package require xotcl::trace
package require xotcl::actiweb::httpPlace
package require xotcl::store::persistence
package require xotcl::actiweb::agent
package require xotcl::actiweb::pageTemplate

Class HtmlPlace -superclass Place -parameter {allowExit}

HtmlPlace instproc init args {
  next
  #
  # just define a minimal object that can react 
  # with HTML decoration, if the called object
  # doesn't exist
  PageTemplateHtml create [self]::start.html

  my startingObj [self]::start.html
  if {[my exists allowExit]} {
    set exitObj [WebObject create [self]::[my set allowExit]]
    [Place getInstance] exportObjs $exitObj
    $exitObj proc default {} {after 500 ::exit; return "Server terminates"}
  }
}
HtmlPlace instproc default {} {
  set place [string trimleft [self] :]
  set msg "<HTML><TITLE>Place $place</TITLE>
	<BODY><H2>Place $place</H2> Try one of the following links:<UL>"
  foreach o [my exportedObjs] {
    set o [string trimleft $o :]
    append msg "<LI><A HREF='[url encodeItem $o]'>$o</A></LI>"
  }
  append msg "</UL></BODY>\n"
}
