|
|
@ -696,11 +696,57 @@ class formClass { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates a drupal form to edit either the QDC or DC datastream |
|
|
|
* Creates a drupal form to edit either the QDC or DC datastream |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function createMetaDataForm($pid, $dsId = NULL, $client) { |
|
|
|
function createMetaDataForm($pid, $dsId = NULL, $client, &$form_state) { |
|
|
|
|
|
|
|
if (module_exists('islandora_content_model_forms')) { |
|
|
|
|
|
|
|
// Get the content model. |
|
|
|
|
|
|
|
$content_model = ContentModel::loadFromObject($pid); |
|
|
|
|
|
|
|
$form_names = islandora_content_model_get_form_names($content_model->pid); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset($form_state['storage']['step']) || (isset($form_names) && count($form_names) > 0)) { |
|
|
|
|
|
|
|
// Form Exists... |
|
|
|
|
|
|
|
$form_state['storage']['step'] = isset($form_state['storage']['step']) ? $form_state['storage']['step'] : 1; |
|
|
|
|
|
|
|
switch ($form_state['storage']['step']) { |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
$form['indicator'] = array( |
|
|
|
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
|
|
|
'#title' => t('Choose edit form.') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$form['indicator']['forms'] = array( |
|
|
|
|
|
|
|
'#type' => 'select', |
|
|
|
|
|
|
|
'#title' => t('Forms'), |
|
|
|
|
|
|
|
'#options' => $form_names, |
|
|
|
|
|
|
|
'#description' => t('Select the form to populate the metadata of the new object.') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$form['submit'] = array( |
|
|
|
|
|
|
|
'#type' => 'submit', |
|
|
|
|
|
|
|
'#submit' => array('fedora_repository_edit_qdc_form_submit'), |
|
|
|
|
|
|
|
'#value' => 'Next' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return $form; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
// XML Forms |
|
|
|
|
|
|
|
module_load_include('inc', 'xml_form_api', 'XMLForm'); |
|
|
|
|
|
|
|
$xml_form = new XMLForm($form_state); |
|
|
|
|
|
|
|
if (isset($form_state['values']['forms']) || $xml_form->isInitialized()) { |
|
|
|
|
|
|
|
if (!$xml_form->isInitialized()) { |
|
|
|
|
|
|
|
module_load_include('inc', 'xml_form_api', 'XMLFormDefinition'); |
|
|
|
|
|
|
|
module_load_include('inc', 'xml_form_builder', 'FormBuilder'); |
|
|
|
|
|
|
|
$form_name = $form_state['values']['forms']; |
|
|
|
|
|
|
|
$definition = FormBuilder::GetFormDefinition($form_name); |
|
|
|
|
|
|
|
$form = XMLFormDefinition::GetDrupalForm($definition); |
|
|
|
|
|
|
|
$properties = XMLFormDefinition::GetFormProperties($definition); |
|
|
|
|
|
|
|
$document = new XMLDocument($properties['document']['root'], $properties['document']['namespaces'], $properties['document']['schema']); |
|
|
|
|
|
|
|
$xml_form->initialize($form, $document); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $xml_form->toArray(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
if (!isset($dsId)) { |
|
|
|
if (!isset($dsId)) { |
|
|
|
$dsId = 'QDC'; |
|
|
|
$dsId = 'QDC'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//$client = getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
//$client = getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
$params = array('pid' => "$pid", 'dsID' => "$dsId", 'asOfDateTime' => ""); |
|
|
|
$params = array('pid' => "$pid", 'dsID' => "$dsId", 'asOfDateTime' => ""); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -784,6 +830,7 @@ class formClass { |
|
|
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
return $form; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates a form for replacing datastream |
|
|
|
* Creates a form for replacing datastream |
|
|
|