NSS Dropbox: Form Referral

A department on campus once wanted to use the Dropbox for poster submissions for an upcoming conference. Ideally, they wanted to augment the usual dropoff web form seen on the Dropbox site with additional fields: presenter name and affiliation, account billing code for printing fees, etc. This could easily have been accomplished by their creating their own Dropbox server with UD's Dropbox software dedicated solely to this single purpose. The amount of effort required to provision necessary hardware and install and manage the software made that prospect less than palatable.

Since the Dropobox is, by design, open to the world for file dropoffs, no concerns were obvious in allowing other units on campus to create HTML forms on any other web server that use the Dropbox server as their form-processing target. This form referral service would collect additional form fields and add them to the dropoff as a single file (in addition to whatever files were uploaded from the form).

Basic Form Structure

Any HTML form wishing to use the referral service should use an action attribute of https://pandora.nss.udel.edu/referral.php. The form should also possess a hidden field named Action with the value dropoff:

<form method="post" action="https://pandora.nss.udel.edu/referral.php" enctype="multipart/form-data">
  <input type="hidden" name="Action" value="dropoff"/>
</form>

The same fields that are present on the standard dropoff page should be used for the sender identity, recipient(s), and file(s):

Sender Identity & Options

senderName
Text field; common name of the sender of the dropoff
senderOrganization
Text field; optional organizational affiliation for the sender
senderEmail
Text field; sender's email address required
confirmDelivery
Checkbox; should an email be sent to the sender when the first file in this dropoff is downloaded?
msgFromSender
Text field; optional message the sender wishes to be included in the email notifications sent to recipient(s)

Recipients

recipName_1 .. recipName_N
Text field; common name of the Nth recipient
recipEmail_1 .. recipEmail_N
Text field; email address of the Nth recipient (at least one is required if not using the recipient_csv field)
recipient_1 .. recipient_N
Text field; should contain the integer N for each recipient required
recipient_csv
File field; allows for upload of many recipient addresses en masse using a CSV file

Files

file_1 .. file_N
File field; the Nth file to upload (at least one is required)
desc_1 .. desc_N
Text field; description of the Nth uploaded file

Returning to the impetus for this service, the basic form might look like this:

<form method="post" action="https://pandora.nss.udel.edu/referral.php" enctype="multipart/form-data">
  <input type="hidden" name="Action" value="dropoff"/>
  <input type="hidden" name="recipEmail_1" value="poster-help@dept.udel.edu"/>
  <input type="hidden" name="recipient_1" value="1"/>
  <label for="senderName">Sender name:</label><input type="text" name="senderName" id="senderName"/>
  <label for="senderOrg">Sender organization:</label><input type="text" name="senderOrganization" id="senderOrg"/>
  <label for="senderEmail">Sender email:</label><input type="text" name="senderEmail" id="senderEmail"/>
  <input type="checkbox" name="confirmDelivery" id="confirmDelivery" checked="yes"/><label for="confirmDelivery">Deliver confirmation email?</label>
  <hr/>
  <label for="file_1">Poster (as a .zip file, please):</label><input type="file" name="file_1" id="file_1"/>
  <label for="desc_1">Brief description of poster:</label><input type="text" name="desc_1" id="desc_1"/>
</form>

In order for the referral service to find and package any additional fields, a few additional fields must be present on an HTML form that uses the service (the name of the file will be AdditionalFormData.[extension] where extension is dictated by the chosen format).

Form Referral

affPrefix
Text field; any form fields for which the name is prefixed by this string will be added to the dropoff required
affFormat
Text field; matching form fields are summarized in a file of format xml, html, or text required
affSuccessURL
Text field; the URL to which the form referral processor should redirect the remote agent upon successful dropoff (if not provided, the standard Dropbox success page will be displayed)
affFailureURL
Text field; the URL to which the form referral processor should redirect the remote agent when the dropoff fails (if not provided, the standard Dropbox success page will be displayed)

Note that the affFailureURL will have a CGI query parameter (message) attached to it containing the nature of the error when the redirect is effected. The example form now might look like this:

<form method="post" action="https://pandora.nss.udel.edu/referral.php" enctype="multipart/form-data">
  <input type="hidden" name="Action" value="dropoff"/>
  <input type="hidden" name="recipEmail_1" value="poster-help@dept.udel.edu"/>
  <input type="hidden" name="recipient_1" value="1"/>
  <input type="hidden" name="affPrefix" value="poster_"/>
  <input type="hidden" name="affFormat" value="xml"/>
  <input type="hidden" name="affSuccessURL" value="https://dept.udel.edu/posters/dropoff_okay.php"/>
  <input type="hidden" name="affFailureURL" value="https://dept.udel.edu/posters/dropoff_error.php"/>
  <label for="senderName">Sender name:</label><input type="text" name="senderName" id="senderName"/>
  <label for="senderOrg">Sender organization:</label><input type="text" name="senderOrganization" id="senderOrg"/>
  <label for="senderEmail">Sender email:</label><input type="text" name="senderEmail" id="senderEmail"/>
  <input type="checkbox" name="confirmDelivery" id="confirmDelivery" checked="yes"/><label for="confirmDelivery">Deliver confirmation email?</label>
  <hr/>
  <label for="sponsor">Sponsor/principal researcher:</label><input type="text" name="poster_sponsor" id="sponsor"/>
  <label for="acct_code">Account code for prints:</label><input type="text" name="poster_acct_code" id="acct_code"/>
  <label for="file_1">Poster (as a .zip file, please):</label><input type="file" name="file_1" id="file_1"/>
  <label for="desc_1">Brief description of poster:</label><input type="text" name="desc_1" id="desc_1"/>
</form>

For this form, the AdditionalFormData.xml file might look like this:

<?xml version="1.0" ?>
<form-data>
  <sponsor>Big-Name Researcher Guy</sponsor>
  <acct_code>ACCT-CODE-001-00</acct_code>
</form-data>

The text format uses key=value pairs, one per line, while the html format summarizes the key-value pairs in an HTML table.