Difference between revisions of "The DRAFT1846Start Page"
(initial contents of this page) |
(added index) |
||
Line 1: | Line 1: | ||
Control is | {{Draft1846 Design Document Index}} | ||
Control is transferred to the draft1846Start page from the | |||
index page. The index page also supplies the number of | index page. The index page also supplies the number of | ||
players the draft1846Start page as a URL parameter.<br> | players the draft1846Start page as a URL parameter.<br> |
Revision as of 13:45, 20 May 2020
DRAFT1846 Design edit |
Control is transferred to the draft1846Start page from the
index page. The index page also supplies the number of
players the draft1846Start page as a URL parameter.
The draft1846Start page displays a form in to
which the names and email addresses of the players should
be entered. For less than 5 players, it also displays a
selection box which should be used to select the unused
privates.
function SetupDraft()
The SetupDraft function uses the functions below to setup a new draft by creating a new row in the draft_table and then sending a confirmation email to each player in the draft.
function makeDeck()
The makeDeck function sets up a D1846.deck array with all private companies present in the array. It then removes the privates that will not be used in the game. Then it adds the required number of blank cards to the array. And finally it shuffles the array.
function shuffle(array)
Function shuffle is used to shuffle a javascript array. I found various forms of this function on many web pages. This particular one is a modified version of the function shown on the javascript.info page at https://javascript.info/task/shuffle
The shuffle function accepts an array as input and shuffles the array in place.
function purgeitem(array, item)
Function purgeitem is used to remove an item from a javascript array.
The purgeitem function accepts two parameters:
- The first is the array that will be modified.
- The second is the item that will be removed.
The function modifies the array in place.
function makePinfo()
The makePinfo function sets up the D1846.nlist array and the D1846.elist array by accessing the player name and email addresse fields from the setup form on the draft1846Start page. It also checks for duplicate names.
function makeDraftRow()
Function makeDraftRow creates "D1846.draft", and then uses JSON.stringify to convert it to the JSON component of the new draft_table row for this usage of DRAFT1846. It then does an ajax call to makeDraft.php.
function newDraftOK(response)
Function newDraftOK is the success callback function for the ajax php/makeDraft.php call. The php/makeDraft.php call returns the numeric draft_id of the new table row or the integer 0 if a failure occurred. The newDraftOK function checks for a failure (0) and then reports the new draft ID to the start page. Finally it calls the emailConfirmation.php function.
function startupEmailsResult(response)
Function startupEmailsResult is the call back function for the ajax calls to emailConfirmation.php. It will have to process returns from multiple emails for the same call. It only needs to check for errors and it only needs to report the first error.