ws: Cleaner building of control messages

Remove the dubios BUILD_INT logic when we want to add non-strings
to a control message, and just return a JsonObject from an interim
function which can be further modified. The simple string-only case
remains the same.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: New resource2 payload protocol

This is something that several future enhancements need. We need to
send back a header payload before the actual data that can carry
information that affects the HTTP Headers of the response.

Closes #1464
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Fix AMD dependency loader bug to do with circular deps

Our AMD loader would find circular dependencies when there were
none.

Closes #1469
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Remove argument counting logic from AMD loader

This is optional and complicates things. Lets make it a bit simpler.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Only provide default dependencies if factory is function

If there's no function involved, such as a module exporting an
object directly, then we don't need to provide default dependencies

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Simpler requring of jquery in cockpit.js

Less fancy tricks, more debuggable

Closes #1470
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Simpler function for parsing cookies

We never need to parse all the cookies, we're simply looking
for one, so we can make this function a lot simpler.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Add function for parsing header Languages

This is the Accept-Language header, unless a specific cookie is
defined, in which case that overrides it.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Add new cockpit.locale API for doing gettext()

This uses the conversion format from po2json in the nodejs packages
https://www.npmjs.org/package/po2json

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
tools: New po2json tool based on nodejs

Implement a new po2json tool based on nodejs which can define json
data as an AMD module. It also checks the plural forms for validity
before having cockpit.js parse it. Has an option to build an AMD
module out of the data.

We use locally installed nodejs modules and set them up during
autogen.sh.

Distribute the pre-processed javascript data in our tarball, so that
builders are not required to have nodejs installed. If they modify
po stuff in a tarball then they will get the standard autoconf
'missing' message.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Choose appropriate translated files based on language

Use the Accept-Language and Cookie headers to choose translated files.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Update the shell for the translation changes

This disables translation in the shell, but makes the dialog selector
box work correctly with the new localization infrastructure.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
playground: Include a translated string in the playground

Closes #1466
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
Don't ignore all *.min.js files, some are actually committed

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
tools: Add jsmerge tool which combines javascript with newlines

Just combining javascript files can lead to syntax errors if the
files don't have consistent newlines at the end. So we force a
blank line between files using the jsmerge tool.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Combine jQuery plugins with jQuery itself

There's no good way to load jQuery plugins as AMD modules unless
they already support it. By combining with jQuery we get two
advantages:

 * Less files to load, less back and forth
 * Piggy back off of jQuery's AMD support to register the modules

Pull in our versions of Flot and Bootstrap minified and not,
to complete our set.

Closes #1471
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: Dash is valid in package names

Forgot this earlier.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
pkg: Move server to server-systemd with an alias of server

This package will contain the basic set of server and configuration
user interface components, for a server that is built on systemd.

The terminal is part of the basic server components.

Other non-systemd server systems will have their own packages also
aliased to server.

Closes #1472
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
 * Adapt check-multi-machine
tools: Allow building privileged docker containers from released versions

Instead of just building from git HEAD, we can also build from
released versions. To do this make sure there are no rpms in the
current directory, and run:

 $ cd tools/
 $ docker build -t stefwalter/cockpit-atomic:wip .

Obviously edit the tag to your choosing

Closes #1480
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: Fix possible NULL dereference in error condition

And fix the error message to make sense while we're at it.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>