Did you know ... Search Documentation:
Pack prologmud -- prolog/prologmud_web/src_webui/mudconsole/mudconsole.pl
PublicShow source
 mc_start is det
 mc_start(+Options) is det
Start the mudconsole. This opens your browser using www_open_url/1. Options processed:
title(+Title)
Title for window and h1 header
allow(+IP)
Only allow connections whose peer unify to IP. IP is a term IP(A,B,C,D), where A,B,C,D are integers in the range 0..255.

The user can customize the output page by defining an HTTP handler with the id mc_home (see http_handler/3). The predicate mc_home/1 provides the simple default page.

 mc_output_area(+Options)// is det
Creates a mudconsole div element. Multiple output areas can be created, each with their own id. The default id is mc_output.
 mc_format(+Format, +Args) is det
 mc_format(+WCId, +Format, +Args) is det
 mc_format(+WCId, +Format, +Args, +Options) is det
Formats a string (like fmt/3) to the web console. For example:
?- mc_format('Hello ~w', [world]).

Options:

clear(Boolean)
If true, clear the output area before adding the new content.
Arguments:
WCId- is the identifier of the output area. Default is mc_output.
Format- and Args are passed to fmt/3.
 mc_html(+HTML) is det
 mc_html(+WCId, +HTML) is det
 mc_html(+WCId, +HTML, +Options) is det
Adds an HTML element to the output area. HTML must be valid input for html//1 from library(http/html_write). For example:
?- mc_write([p(['Hello ', b(world)])]).

Options:

clear(Boolean)
If true, clear the output area before adding the new content.
 mc_error_area//
Create an output area for errors and warnings. This is a normal output area, using the identifier ic_error.
 mc_form_area(+Options)//
Create a form-area. This is a div holding a form with ID mc_form. A form-area is used with mc_ask/3 and mc_ask/4.
 mc_ask(-Result, +Specification) is det
 mc_ask(+InputId, -Result, +Specification, +Options) is det
Ask a question. Result is a list Name(Value). Specification is an HTML specification (as mc_html/1, see also html//1) which is used as the content for a form element. Each Name in the Result list must be covered by an equally named input element in the form.
?- mc_ask([ age(Age)
          ],
          [ p('How old are you?'),
            input([name(age)])
          ]).
Age = 24.
Arguments:
Options- is currently ignored
See also
- We need a form that doesn't submit. Generic code I found sofar is http://www.9lessons.info/2011/09/submit-form-without-refreshing-page.html

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 mc_start(Arg1)
 mc_format(Arg1, Arg2, Arg3)
 mc_format(Arg1, Arg2, Arg3, Arg4)
 mc_html(Arg1, Arg2)
 mc_html(Arg1, Arg2, Arg3)
 mc_ask(Arg1, Arg2, Arg3, Arg4)