Home Development Blog The Puzzle Submission Interface
The Puzzle Submission Interface PDF Print E-mail
User Rating: / 0
PoorBest 
Friday, 01 October 2010 11:48

An important part of the development is to provide an interactive interface for the submission of new puzzles.   This brought me up against the GWT default setup which is only really meant to have one window.

To solve this I had to create two extra GWT modules (using the eclipse add new ... menus), move the code from my orginal module into one of them and add the code for my new interface in the second.   Then I had to remove the declaration of the EntryPoint in my original module.   Both of my new modules now inherited from the original one, but the original one no longer had any window.   This was because I could not inherit from one module with an entry point and implement a new entry point in the child module.   One minor complication is that I have to exclude the original module every time I do a GWT compile (i.e generate javascript code) of the project.

I then had to setup the servlet mapping for the two new modules in my applicaions web.xml - firebug was invaluable here since it told me what the GWT apps were actually trying to call!   Servlet mapping was to rear it's ugly head again when I moved to the live server...

Adding the ability to calculate an SHA to the GWT clients required a javascript implementation of the algorithms.   I used jsSHA which I would recommend to anyone.   To call it, I had add the following javascript to my html file:

:        function calcHash(input) {
:                var hashObj;
:                hashObj = new jsSHA(input,"ASCII");
:                var hashOut;
:                hashOut = hashObj.getHash("SHA-256", "HEX");
:                return hashOut;
:        }

and then I called it with the following code in my GWT java entry point class:

:    private native String doSHA256(String input)/*-{
:    var SHAOut;
:    SHAOut = $wnd.calcHash(input);
:    return SHAOut;
:    }-*/;

Works wonderfully.

The submission user interface itself is similar to the solution interface, except that the crypto alphabets work the other way - plain text is fixed and the user can change the cipher letters.   The user can also enter varous additional information about the puzzle that may or may not be shown to the end-user depending on who they are.

 
Copyright © 2019 Crypto League. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.