Merge pull request #125 from cloud9ers/master

Adding Unix Sockets Support
gateone.py:  Made some minor changes to the recent pull request that added Unix socket support.  Just changed the name of the options slightly to be more like the others and clarified the help text a bit.  Also fixed a minor syntax error.  You can have Gate One listen on TCP sockets and Unix sockets simultaneously.
gateone.py:  Made a minor change to the logic that determines which address to listen on.  If you so desire you may set --address=None to have Gate One skip listening on any TCP/IP address (in case you *just* wanted it to listen on a Unix socket).
Documentation:  Loads upon loads of updates...  Also added some cool new collapsable indexes by way of a little template override and some (minor) CSS changes.  So it should be easier to navigate all those little functions and properties now.
gateone.py:  Changed up the authenticate() function a little bit to ensure that transient exceptions don't end up in the logs when a user's cookie has expired or the cookie_secret has been changed.  Notably, the WebSocket won't be cloed right away when an authenticated WebSocket connection fails to authenticate.  It will just sit there with the connection open waiting for the user to click OK to the reauthenticate() dialog.  However, if the client attempts to perform any other action over the WebSocket that requires authentication they will be disconnected immediately.
gateone.py:  Updated a number of log messages to be more useful/friendly.  The log replay attack detection message in particular should be a lot more useful since it now provides the full UPN of the user who's API authentication object was stolen, the remote IP address of the attacker, and the Origin that was used by the attacker (could reveal if and which of your web pages suffers from a cross-site scripting vulnerability; how's that for user-friendly security!).
gateone.js:  Fixed a bug where GateOne.Visual.enableScrollback would loop over and over if text was highlighted in a terminal while it was called--even if the scrollback buffer was visible.  This would never impact the user's experience so it is mostly just a code efficiency improvement.
gateone.js:  Fixed the bug where you could wind up with all sorts of HTML formatting when pasting in Mac OS X (and a few other paste methods).  Pastes will now automatically be converted to plaintext if they're registered by the browser as containing formatting.
gateone.js:  The bug where you'd get double pastes when text is highlighted and you perform a middle-click to paste has been fixed.
gateone.js:  A bit of copy & paste improvements all around: Timeouts have been adjusted, goDiv.onpaste won't end up getting set multiple times, and you shouldn't have to "left-click one more time" on Gate One to get the option to paste anymore (using all the various paste methods).
gateone.js:  GateOne.Net.reauthenticate() has been updated to delete the 'gateone_user' object in localStorage in addition to the cookie.
gateone.js:  GateOne.Net.reauthenticate() has been modified to detect whether or not API authentication was attempted and will display a different, more helpful error message if this is the case.
gateone.js:  Modified GateOne.Visual.togglePanel() so that after it scales away a panel it sets its style to 'display:none'.  This is to ensure that when the user presses the tab key to switch between elements in a panel or dialog they won't end up focusing on elements that aren't visible.
gateone.js:  Added GateOne.Visual.alert().  It emulates JavaScript's standard 'alert()' function but instead of blocking everything and bringing up a dialog it merely creates an "OK" dialog inside of the Gate One container.  GateOne.Utils.loadScript and GateOne.Net.reauthenticate have both been modified to use this function instead of alert().
gateone.js:  Just a note, really:  In Firefox 14.0.1 there's a bug that prevents you from highlighting (aka selecting) text when an onmousedown event removes an element floating above the text you're trying to highlight.  I tried every method I could think of to work around the problem but nothing worked.  It is a straight-up browser bug so I've filed a report (along with a test case in HTML form) here: https://bugzilla.mozilla.org/show_bug.cgi?id=785773 (please comment on it if this bug is bugging you!).  In the mean time you can work around the problem by double-clicking to highlight individual words you want to copy/paste or double-click-and-drag to select.
Bookmarks Plugin:  Fixed a minor annoyance related to right-clicking on bookmark links:  Prior to this fix if you right-clicked on a bookmark link it wouldn't give you the option of copying that link or opening it in a new tab/window.  Now it will auto-hide the invisible div that hovers above bookmarks whenever you invoke the context menu.
Theme CSS:  A few very minor visual tweaks to make things line up better/avoid overlap/easier to read.
Updated version strings everywhere to 1.1.
All plugins that create panels:  Made sure that all panels start out in a hidden state so you don't get that silly, "all the panels are scaling away" chaos when Gate One is loaded.
Chat Demo:  Added jquery.min.js to the static directory and changed the index.html to use that instead of the Google hosted version.  This will prevent "insecure content" errors from messing it up.
Chat Demo:  Updated so it doesn't use "embedded: true" anymore.  Instead it just sets "showToolbar: false".
Help Plugin:  When viewing "About Gate One" it will now show which version you're running (based on the version string of the GateOne object in gateone.js).
Shhh...  gateone_anywhere.js ◕‿↼
All (exposed) functions in gateone.js are now fully documented!  Now I just have to finish updating all the attributes/properties.
hello_embedded Tutorial:  Added a descriptive docstring to hello_embedded.py.
chat demo:  Updated the instructions that get printed out when chat.py is run to more clearly indicate that the 'auth' parameter must be set to 'api' in order for it to work.
gateone.py:  A few minor tweaks to TerminalWebSocket.authenticate() to provide a more user-friendly experience...  Exceptions in authenticate() will no longer be sent to the client and some of the error messages have been clarified.
gateone.js:  Got rid of goDivMouseDown() and moved it inside of GateOne.Input.capture() as an private/anonymous function.  There's no reason why it needs to be named.
gateone.js:  Moved startBenchmark() and stopBenchmark() into GateOne.Utils to make them available for plugins to use.  Also updated them to include a total number and average milliseconds (in case you're benchmarking stuff that runs many times).
Logging Plugin:  Made some style adjustments to the playback_log.html template to make it look nicer.  For example, since playbacks don't have scrollbars there's no reason to make room for them.
Logging Plugin:  Fixed the bug that was preventing "View Playback (Flat)" from working.  Apparently it hasn't been working for a very, very long time because the bug was caused by a reference to the old way of adding stylesheets to the page...  Something I changed many moons ago.  I guess no one uses this feature!
logviewer.py:  Modified the flatten_log() function so that it looked *much* nicer with more logical timestamps.  It also deals with 'text got overwritten' events much more gracefully now.  Hopefully this enhanced usability will make it so that more people actually use it!
Documentation of gateone.js is now 100% complete!
Documentation:  All configuration options are now 100% complete in "About Gate One - Configuration".  Looks real nice too!
Documentation:  The User Guide has been updated.  All screenshots too!  I even added a couple new ones from the SSH Identity Manager.
gateone.py:  The --enable_unix_socket option has been changed from a default of True to a default of False.  It's a highly specialized thing so it should only be enabled in those environments that will use it.
gateone.js:  The toolbar now scales with the fontSize parameter.  I swear it used to scale just fine before but recent updates of Chrome and Firefox stopped scaling SVG with font-size.  It uses CSS3 transforms to do it now.
Documentation:  Fixed a few minor things I noticed while reading the gateone.js docs.
Playback plugin: Replaced the playback arrow '▶' with '\u25B8' to make it more compatible with different encodings and minifiers.
gateone.js:  Moved the capabilities checks to GateOne.init() so they won't bug the user if Gate One is never actually initialized on the page.  Also, all missing capabilities will be combined into a single alert() instead of bugging the user up to three times per page load (with older browsers).
Documentation:  All plugin .py files are now documented!  Related to this I've updated a lot of docstrings to include reStructuredText formatting.
Documentation:  Added a "(source)" link to the code of gateone.js on Github.
gateone.js:  Added GateOne.prefs.skipChecks as an option that can be passed to GateOne.init().  If set to true it will skip all the capabilities checks/alerts that Gate One throws up if the browser doesn't support something like WebSockets.
Playback Plugin:  Added GateOne.prefs.showPlaybackControls (default: true) and updated newTerminalCallback() to take advantage of it.  By setting this preference to 'false' in GateOne.init() an application embedding Gate One can prevent the playback controls from being shown.  Also, the playback controls can still be added manually by calling GateOne.Playback.addPlaybackControls().  So it should be the best of both worlds.
Documentation:  Updated the gateone.js documentation to include the new GateOne.prefs.skipChecks option.
gateone.js:  GateOne.Terminal.termUpdateFromWorker(): When in embedded mode don't try to 'translateY()' the terminal screen up to hide the scrollback buffer since this kind of calculation can be unreliable when #gateone appears inside of complicated layouts (like tabs).
gateone.py:  Switched from using Tornado's built-in "static_path" option (that turns on the built-in StaticPathHandler) to using 'static_url' and a custom StaticHandler class.  The reason for this is to allow modifying the headers before sending static content to the client...  It turns out that when you embed Gate One into another web application the browser will happily load images, JS, and CSS from any origin but it will *not* allow loading font files.  This is why the default static handler had to be overridden: So we can set the Access-Control-Allow-Origin header to "*".  This shouldn't be a security concern since it is just static content and it is only from the perspective of the client (not the server) where that header matters.
All-around:  Fixed a few bugs associated with Python 3 support.  Particularly in relation to logs and the log viewer.  The flat log view still isn't working for some reason (some sort of gzip problem) but if experience tells me anything it is that no one cares about the flat log view :).  Python 3 support for the flat log view might have to wait.
setup.py:  Added some logic to detect if html5lib is already installed when using Python 3 and to skip the 2to3 conversion process if it is (it actually removes it from /opt/gateone/plugins/bookmarks/dependencies).  This should save a lot of time when installing Gate One with Python 3 (html5lib takes forever to convert; seriously annoying while debugging).
setup.py:  Fixed a bug with fix_shebang() where it was adding an extra '3' to 'python3' every time it ran on the same file.
Note: Removed the gorole.py file from the documentation since it isn't being used.
Logging Plugin:  Instead of keeping two identical copies of several log-related functions I've switched logging_plugin.py to just import those functions from termio.
gateone.js:  Minor fix for users that need to re-authenticate when using PAM authentication.  The "OK" dialog that pops up asking them to reauthenticate when the cookie secret is changed will now choose a random username in the window.location.href just like logout() does.
Help Plugin:  Disable keyboard shortcuts when in embedded mode.
Bookmarks Plugin:  Added a new Ctrl-Alt-B keyboard shortcut that brings up the Bookmarks panel.  Also tweaked some things to make it possible to navigate bookmarks efficiently with the keyboard.
gateone.js:  Made it so that you can press the ESC key to close panels and dialogs.
gateone.js:  Made some adjustments to how terminal rows/cols are calculated to fix a bug where in certain circumstances you could wind up with the toolbar overlapping the terminal.
Example Plugin:  Disable keyboard shortcuts when in embedded mode.
Logging Plugin:  Changed the way it detects whether or not GateOne.prefs.logLevel is set to be more explicit.
Playback Plugin:  Made the same change to GateOne.prefs.showPlaybackControls as was made to GateOne.prefs.logLevel except with this option it was absolutely necessary (it wouldn't work properly otherwise).
CSS Themes:  Changed the padding of #gateone to be 0 instead of 0.1em.  This should fix the bug where sometimes, after the Gate One server was restarted, the terminal dimensions would be off by one row.
SSH Plugin:  ssh_connect.py:  Fixed a bug where if the short_hash() function returned a string that started with a dash (-) it would prevent the ability of the script to duplicate a user's session.
gateone.py:  Fixed a bug in TerminalWebSocket.char_handler() where it wasn't gracefully handling terminal numbers that were sent as a string (e.g. '1' instead of 1).  This should get GateOne.Net.sendString() working properly when you don't specify a terminal number as the second argument.
gateone.py:  Added a line that makes sure that server.conf has an encoding comment at the top (e.g. '# -*- coding: utf-8 -*-') in case someone wants to use Unicode strings.
gateone.py:  API keys and secrets can now be Unicode strings (assumes UTF-8 encoding).
Documentation:  Added info about API authentication to the "Embedding Gate One" portion of the docs.  Includes example code for Python, PHP, and Ruby.
gateone.py:  A quick fix for Python 3 with the new Unicode server.conf support.
gateone.py:  Fixed the bug where Gate One would report, 'Listening on https://...' when disable_ssl was set to True.  Also added logic to make sure that an error message is displayed when both disable_ssl and https_redirect were enabled at the same time.