The BID18xxSubmit Page

From BOARD18 Project WIKI
Jump to navigation Jump to search

The bid18xxSubmit page is called from an email generated by bid18xxStart. This page accepts and verifies the player's bid and then updates the database. It then checks to see if all players have submitted their bids. If they have then it reports the bid results to each player.

This page's URL should contain a urlkey parameter. This is a 12 character pseudo random string that begins with the bid ID and the player ID.

function getBidResult()

The getBidResult function is the call back function for the ajax calls to getBid.php. It sets up the bid18xxSubmit page.

Output from getBid.php is a JSON encoded array. The "return" value will be either "success" or "fail". If it is "fail" then it will be the only item in the array. If the "return" value is "success", then the rest of the array will be the JSON string from the specified table row.

function processBid()

The processBid function uses the entered bid to update the current player. It then calls the updtBid.php function to update the database.

function updateBidResult(result)

Function updtBidResult is the success callback function for the ajax updtBid.php call made by the processBid() function. It checks for a failure or a collision and then it checks if all bids are done and if not it sets up the response screen for this bid.

function bidDone()

The bidDone function deletes any previously displayed bid status table. It then appends the final bid status table to the bidrpt division. The final bid status table shows all bids for all players. It then calls the sortPlayers function. Finally, The bidDone function appends a completed message to the 'bid' paragraph.

function sortPlayers()

The sortPlayers function deletes any previously displayed playerOrder table. It then appends the sorted player order table to the player order div.

function emailResultCallback(response)

Function emailResultCallback is the call back function for the ajax calls to emailBidResult.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.