Add DOCTYPE to _page.tx wrapper (aka, all pages)
Add "count" and "test_name" cols to job_result table

We get something like:

    ok 1 name of test
    not ok 2 name of other test
    # some diag text

For the none diag lines, we want to split out:

    - state (ok/not ok)
    - count/number
    - test name

Which for now, we achieve with some ugly regex parsing of the raw tap result
line.  In due course, it would be nicer if the client tracked these fields
seperately, and submitted them separately.

Primarily, this would give us the ability to associate specific "diag" lines
with a specific "test_name".  For example, rather than:

    top.like(got, /some regex/, 'test for some regex');

when failing producing:

    not ok 1 'test for some regex'
    # Got 'another regex'
    # Expected /some regex/

as three unconnected lines, we'd instead like something akin to:

    var results = [
        {
            'state'     : 'not ok',
            'count'     : 1,
            'test_name' : 'test for some regex',
            'diag'      : [
                "Got 'another regex'",
                "Expected /some regex/",
            ]
        }

Which we would pass back to the server to log/store.  We can still take that
and convert it back to the native/naive TAP multiline output, but now we can
also know that the diag lines are associated with that specific test.

Thus, when later reviewing test results, for failing tests we can also show the
associated diag lines.
Ensure multi client tap output numbers tests correctly.

We've got the same test, run on multiple clients.

    # client 1
    ok 1 test a
    ok 2 test b
    ...

    # client 2
    ok 1 test a
    ok 2 test b

however, from the perspective of TAP, it wants a list of results to be linear
and with no gaps.  Thus we need to do some "fudging" in order that the output
will parse correctly.

In short, make this work correctly:

    $ cat foo.t
      #!/bin/bash
      curl -s "http://.../TESTING/api/run/123?block=1&tap=1"
    $ prove -v ./foo.t
Return job, not error, if api/run/get finds 'running' tasks.

Consider:

    - Load HQ on http://example.com/...
    - Starts working ....
    - Sent test for http://foo.com/

At this point we want HQ to reload itself on the new domain, preserving the
existing app/client ids.

Having reloaded, we'll request work to do.

The current server side state tells us this client has already been given a
job, which was the one that initiated the HQ page reload, and which won't have
been run yet.

So rather than returning an error saying "that client already has a task",
instead we return the oldest job for this client that's marked as being in
state 'running'.  Which hopefully, is the same job we originally gave it, that
caused the reload.

In short, this should ensure the client resumes the existing job after a
page-reload, which we've done to facilitate the change of domain.
Allow client HQ to be fetch via POST
Propogate HQ app/client/restart args from POST to tmpl
Add jsuri.js lib for parsing uris

jsuri-1.1.1.min.js

http://code.google.com/p/jsuri/
Abstract body of 'save test' into function
Abstract out body of "disconnect" code

So that it can be called/used from places other than the
click handler for the #stop button.
Move HQ functions to global page scope
Abstract out logic to run after connecting
js functions to ensure correct domain for tests

and load jsuri.js and convert <script> tags to HTML5 by dropping type attr.
Set app/client_id in the template if POSTing to HQ

This will let us retain the existing ids over reloads, which we do via POST to
avoid these details littering the browsers location bar.
Auto redirect task/edit to correct domain for current task

When we first load, ensure the browser domain matches the test url domain and
if not, redirect.  We will have just loaded, urgo it's safe to save the test.

XXX Do we need to save when first loading?

When we get a chance on the test url input field, check if we need to redirect.

If we do, confirm it's okay to save the test (required to ensure the new test
url is saved across the redirect, and to avoid loosing changes to the test js)

Then redirect, so that the current browser domain matches our new test url.
Auto redirect HQ to correct domain for current job/task

We're initially loaded on

    example.com

then we get an incoming test for:

    other.com

we need to have the page reload itself onto the correct domain for the test
(other.com).

To do this, we pass through the client & app id, which ensures after we've
reloaded ourselves on the new domain that these values are retained and not
reset.  Note that the app_id is stored on localStorage, but this is keyed on
the current domain, hence why we still need to pass this through.

Finally, we tell ourselves to restart working.  Because we haven't explicitly
disconnected, the server will still consider our current client to be active.

Hence we simply need to ask the server for more work.  The server should be
smart enough to re-send the previous (running) job, that was the original cause
of having to reload the page onto the new/correct domain.
Adjust layout of the task/edit page

- Code / textarea is top right, 50% height, 50% width.
- iframe is now 50% of the document height, full width, positioned at the
  bottom of the page.
- Which leaves the top left quadrant for the other controls.

Also set tabindex on the various form elements

And remove both <p id=log> and <div id=log>.  Former is redundant, the latter
was causing some layout issues, and wasn't being used anyway.

We *will* want a log, but for now, given it wasn't working anyway ... kill it.
Add basic codemirror editor UI
Add link to codemirror license files
Add 'name' field to task, db cols & tweak layout
Add /task/list page