this is a mjt library file. the definitions here can be imported using mjt.load_from_iframe() on an iframe containing this file. there should be a corresponding style sheet in libmjt.css.

/* use mjt.script rather than a script tag in order to get */
/*  things evaluated in the context of the main frame instead */
/*  of in the library iframe. */

/* generate an url query section that will pass through */
/*  some mjt variables like mjt.service_url and mjt.debug. */
var app_url = this.defs.app_url = function(u, values) {
    /* tedious values copy to add new items */
    var myvalues = {};
    if (typeof(values) != 'undefined') {
        for (var k in values)
            myvalues[k] = values[k];
    }

    if (mjt.service_url != mjt.default_service_url)
        myvalues['mjt.server'] = mjt.service_url

    if (mjt.debug)
        myvalues['mjt.debug'] = '' + mjt.debug;

    var q = mjt.formencode(myvalues);

    if (q == '')
       return u;

    return u + (u.match(/\?/) ? '&' : '?') + q;
}
header(title) displays the page header

$title

footer() displays the page footer

>
link(o) tries to generate a good link to an object
         var name = o.name;
         if (!name) name = o.id;
         if (!name) name = o.value;
         if (!name) name = '[unknown object]';

         var tid = o.id;
         if (!tid &&
             typeof(o.namespace) == 'object' && 
             o.namespace.id) {
             tid = o.namespace.id;
         }
     
$name $name
$o
task_state(task) shows the task state, unless it's 'ready' in which cast the application should do something.
loading ...
error:
$msg.code: $msg.message
showjson displays a json value as html. null [
${showjson(v)}
]
{
$k: ${showjson(v)}
}
$o $o "$o"