Update ZenTag query limit to 300
This commit updates ZenTag's query limit from 20 (used in testing) to 300.
Merge pull request #41 from gsolbeck/development

[minor] Update ZenTag query limit to 300
Merge pull request #40 from gsolbeck/game-reskins

Apply Zentag querying to Zentag reskins, and update Zentag media limit to 300
STUPIDROBOT: Add logging of player events for analysis
This commit introduces basic event-logging to allow developers to analyze
gameplay and make changes accordingly. Currently, it is only active for
StupidRobot, where it records keystrokes within the textbox and clicks on
functional buttons. When the player leaves the page, the log is stored as a
JSON text file on the server.
STUPIDROBOT - Add logging for non-player events, other minor changes
This commit refines the event-logging introduced previously. Primarily, it adds
logging for non-player events in StupidRobot, including the image displayed and
the game's reactions to tag submissions. It also makes some other minor
changes:
 - add browser details to event log
 - add actor to event (either player or game)
 - change details of keypress from key code to character
    - add helper function to determine character using KeyboardEvent
 - move logEvent and sendLog functions out of StupidRobot to Game API
    - This will allow the functions to be used by other games in the future

Notes about getPrintableKey helper function: the W3C specifications for the
KeyboardEvent event include a "key" property that contains the key value.
However, as this is not actually supported by many popular browsers, the helper
function uses the keyCode and shiftKey properties to determine the key value.
STUPIDROBOT: Store session logs in individual files on the server
The session logs were previously appended to a single text file. With this
commit, they will be stored in individual files, within the analytics folder.
Merge remote-tracking branch 'upstream/development' into development
Add separate controller action for saving event logs
Previously, logs were saved by sending a POST request to the existing play
action of the GamesController, which rerouted them to the proper function. This
commit adds a separate saveLog action to the GamesController, and sends the
POST requests to that action instead.

Note: actions are functions registered with a controller, which can be accessed
via a URL. For more info, look at the Yii documentation.

Other changes:
 - Store logs in game-specific folders within the analytics folder
   - e.g: StupidRobot logs will be stored in a separate folder than ZenTag logs
   - Note that only StupidRobot has event-logging currently
Move analytics directory inside protected directory
Minor commit to protect the analytics data on the server. Previously, because
it was outside the protected/ directory, it was publicly accessible.
StupidRobot: Change analytics log filenames to be timestamps
The filenames for the analytics logs have been changed to timestamps, in the
following format: YYYY-MM-DD.hhmmss.uid.json, where uid is a three-digit number
used to distinguish multiple logs created at the same time.
Example of a filename: 2014-07-14.185919.001.json

Other changes:
 - Remove runtime directory creation
 - Commit analytics/StupidRobot directory (with .gitignore)
Add scoring for StupidRobot
Adds scoring to StupidRobot with a simple formula. In addition, this commit
creates a new reset action for the GamesController which saves the score to the
database (UserToGame). After saving, it resets the game engine and starts a new
played game session.

The scoring algorithm awards N points for each accepted tag, where N is the
length of the word. Thus, the maximum points possible per round is 49.

Known issues:
 - Because the reset action creates a new PlayedGame entry, it ends up adding
   one empty entry to the database per window session.
Merge branch 'gsolbeck-development' into development
Merge branch 'development' into game-reskins
Add JSON formatting for analytics to improve human-readability
The analytics for StupidRobot exports event logs as JSON files. This commit
adds whitespace to the encoded JSON data before exporting it, making the files
accessible to people as well as other programs.

The JSONFormat class extends the existing CJSON class with formatting
capabilities. It implements the JSON formatter used in Chris Dary's JSON linter
(http://github.com/arc90/jsonlintdotcom), which is under the MIT License.

Other changes:
 - Remove duplicate code in mg.game.api.js (sendLog now calls logEvent to log
   the "close window" event).
StupidRobot: Fix cut to end-screen after 7 words, re_init word limit

This commit fixes the StupidRobot code intended to cut to the end-screen early
if the player enters seven accepted words. Previously, if the user entered all
seven words, they would have to wait for the timer to run out or click "Quit"
to continue.

Specifically, it fixes a conditional (acceptedWords > maxLevel) to be
(acceptedWords > maxLevel - 4) because the user cannot enter 1, 2, or 3-letter
words.

Other changes:
 - Changed definition of maxLevel in re_init to 10.
   The re_init function is intended to reset various game constants to their
   initial values. However, the maxLevel in re_init was not changed from 13 to
   10 when the original constant was. This meant that in subsequent games,
   players could type longer words, although they would not be accepted.
   (This also caused problems with the conditional mentioned above.)
StupidRobot: Add magnifying glass to image
A magnifying glass icon is now displayed in the upper left corner of the image
to indicate that the image can be zoomed. Because each image can be a different
size, the icon is positioned dynamically. Functionally, clicking on the icon is
no different than clicking anywhere else on the image, although the icon
highlights yellow when moused over.

The code where both image and icon positioning happens should be refactored in
a separate commit, as it makes multiple identical calls to the jQuery selector.
Add parsing for analytics data

The parsers for StupidRobot analytics are based on the Tetris parsers; the two
use the same framework. Currently, there are two StupidRobot parsers written:
 - displaySession:  displays a log of the game session
    - (StupidRobot specific)
    - concatenates letters
    - displays image thumbnails
 - exportCSV: exports events as CSV without processing
Improve displaySession parser, add new StupidRobot events

These changes reflect feedback on the original displaySession parser. The actor
for each event (player/game) has been capitalized for emphasis. Repeats of the
image being displayed have been removed. In addition, two additional event
types have been added to the log: "start session" and "end game". The first is
logged when the game starts, and the second when the score screen is displayed.
StupidRobot: Add in-game score display to final screen
Adds an in-game score display to accompany the StupidRobot scoring algorithm.
Note that the two are completely independent - while it is possible to falsify
the in-game display, it will not affect the overall scoreboard.

As a part of adding the score display, the HTML structure of the final screen
has been redone, removing the questionable use of <span> elements and
line breaks, and replacing them with a table. This also allows for easy
alignment of the score counters with their respective words. In addition, the
empty 11- to 13-letter word spaces remaining from an earlier revision have now
been removed entirely.

Aesthetic changes will likely be made to the display before merging this branch
back into the development branch, but the functionality is finished. In
addition, there is a known bug where the display will sometimes not animate;
this is an inconsistent problem and the cause is not yet known.
StupidRobot: Fix flashMessage overwriting final screen

The flashMessage function is used to display StupidRobot's response to a user
submission, first showing the response, then restoring the text to its
original prompt ("Human: what is in this image?"). However, if it was called
and then the final screen was immediately shown (either by time limit or by
clicking the "Quit" button), then it would overwrite the final response ("I
now comprehend X more words...") with the original prompt.

This was due to an HTML element ID conflict between the in-game and final
screen messages. The latter's ID has been changed from "gameMessage" to
"endgameMessage", resolving the issue.