// Obtain the inputs (i.e. metadata fields we are going to display)
Item item = submission.getItem();
Collection collection = submission.getCollection();
String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";
DCInputSet inputSet;
DCInput[] inputs;
try
{
inputSet = getInputsReader().getInputs(submission.getCollection().getHandle());
inputs = inputSet.getPageRows(getPage()-1, submission.hasMultipleTitles(), submission.isPublishedBefore());
}
catch (DCInputsReaderException se)
{
throw new UIException(se);
}
Division div = body.addInteractiveDivision("submit-describe",actionURL,Division.METHOD_POST,"primary submission");
div.setHead(T_submission_head);
addSubmissionProgressList(div);
List form = div.addList("submit-describe",List.TYPE_FORM);
form.setHead(T_head);
// Fetch the document type (dc.type)
String documentType = "";
if( (item.getMetadataByMetadataString("dc.type") != null) && (item.getMetadataByMetadataString("dc.type").length >0) )
{
documentType = item.getMetadataByMetadataString("dc.type")[0].value;
}
// Iterate over all inputs and add it to the form.
for(DCInput dcInput : inputs)
{
String scope = submissionInfo.isInWorkflow() ? DCInput.WORKFLOW_SCOPE : DCInput.SUBMISSION_SCOPE;
boolean readonly = dcInput.isReadOnly(scope);
// Omit fields not allowed for this document type
if(!dcInput.isAllowedFor(documentType))
{
continue;
}
// If the input is invisible in this scope, then skip it.
if (!dcInput.isVisible(scope) && !readonly)
{
continue;
}
String schema = dcInput.getSchema();
String element = dcInput.getElement();
String qualifier = dcInput.getQualifier();
Metadatum[] dcValues = item.getMetadata(schema, element, qualifier, Item.ANY);
String fieldName = FlowUtils.getFieldName(dcInput);
String inputType = dcInput.getInputType();
// if this field is configured as choice control and its
// presentation format is SELECT, render it as select field:
String fieldKey = MetadataAuthorityManager.makeFieldKey(schema, element, qualifier);
ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
if (cmgr.isChoicesConfigured(fieldKey) &&
Params.PRESENTATION_SELECT.equals(cmgr.getPresentation(fieldKey)))
{
renderChoiceSelectField(form, fieldName, collection, dcInput, dcValues, readonly);
}
else if (inputType.equals("name"))
{
renderNameField(form, fieldName, dcInput, dcValues, readonly);
}
else if (inputType.equals("date"))
{
renderDateField(form, fieldName, dcInput, dcValues, readonly);
}
else if (inputType.equals("series"))
{
renderSeriesField(form, fieldName, dcInput, dcValues, readonly);
}
else if (inputType.equals("twobox"))
{
// We don't have a twobox field, instead it's just a
// one box field that the theme can render in two columns.
renderOneboxField(form, fieldName, dcInput, dcValues, readonly);
}
else if (inputType.equals("qualdrop_value"))
{
// Determine the real field's values. Since the qualifier is
// selected we need to search through all the metadata and see
// if any match for another field, if not we assume that this field
// should handle it.
Metadatum[] unfiltered = item.getMetadata(dcInput.getSchema(), dcInput.getElement(), Item.ANY, Item.ANY);
ArrayList<Metadatum> filtered = new ArrayList<Metadatum>();
for (Metadatum dcValue : unfiltered)
{
String unfilteredFieldName = dcValue.element + "." + dcValue.qualifier;
if ( ! inputSet.isFieldPresent(unfilteredFieldName) )
{
filtered.add( dcValue );
}
}