Extension:GWToolset/Technical Implementation/Handlers/MetadataMappingHandler


 * 1) Validates the  ’ed edit token
 * 2) if invalid, a user error message is displayed.
 * 3) if valid, calls

The expected outcome of ’ing the metadata mapping form is that the extension will receive several items from the form:
 * 1) A record element name that identifies the root element in the metadatafile that contains the mediafile’s metadata.
 * 2) A MediaWiki template selection that will be used to map the metadata found in the metadatafile to the MediaWiki template.
 * 3) A wiki Title to a previously saved metadata mapping ( optional ).
 * 4) A stash key that references the metadata file uploaded in step 1: metadata detection.
 * 5) A record count based on step 1: metadata detection.
 * 6) Metadata mapping field/values
 * 7) Global categories ( optional )
 * 8) Item specific categories ( optional )
 * 9) A partner template ( optional )
 * 10) A summary ( optional )
 * 11) Whether or not to re-upload the mediafile ( optional )

Step 2: Metadata Mapping
This handler is used between step 2: metadata mapping, and step 3: batch preview, in the upload process. The following describes what happens within the  method:


 * 1) In this scenario $user_options['preview'] === true
 * 2)   retrieves an UploadStashFile instance based on the stash key provided in step 1; this is the metadata file provided by the user.
 * 3) * if an exception is thrown a user message is displayed.
 * 4)   is sent:
 * 5) * the ’ed form variables as
 * 6) * the FS path to the uploaded stash file
 * 7)   is sent:
 * 8) * the ’ed form variables as
 * 9) * the FS path to the uploaded stash file
 * 10) * a callback method in the XmlMappingHandler
 * 11)    starts a read process that will:
 * 12) * use the callback method provided to process the metadata records found during the read process.
 * 13) * continue to the end of the metadata file or stop reading if  is set to true.
 * , the callback passed to  will:
 * 1) * Determine if XmlHandler->readXmlAsFile is on the record it should start processing
 * 2) * Set  if the   has been reached
 * 3) * Use  to handle a metadata record if the   has not been reached
 * 4)   will:
 * 5) * Use  to save the mediafile to the wiki and return the Title to XmlMappingHandler, which will return it to XmlHandler, which will add it to an array of successfully created mediafile Titles.
 * 6) When   sends   to , it returns its array of Titles back to.
 * 7)   then uses   to set up the HTML form and returns it to   to be displayed.

Step 3: Batch preview
This handler is used between step 3: Batch preview, and step 4: Batch upload, in the upload process. The following describes what happens within the  method:


 * 1) In this scenario   is empty.
 * 2) * Creates a new
 * 3) * Uses  to place it in the JobQueue.
 * 4) ** If the job is successfully added to the job queue a user message is created and sent to  to be displayed as step 4: Batch upload.
 * 5) ** If the job is not successfully created an error message is displayed.
 * 1) ** If the job is not successfully created an error message is displayed.