Browse Source

broken?

pull/3/merge
Nigel Banks 14 years ago
parent
commit
4e6dad81a4
  1. 32
      fedora_repository.module
  2. 4
      formClass.inc

32
fedora_repository.module

@ -119,16 +119,17 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
function fedora_repository_ingest_form_submit($form, &$form_state) {
//only validate the form if the submit button was pressed (other buttons may be used for AHAH
if (module_exists('xml_form_api')) {
if ($form_state['storage']['xml']) {
module_load_include('inc', 'xml_form_api', 'XMLForm');
$form = new XMLForm($form_state);
$xml_form = new XMLForm($form_state);
if ($xml_form->isInitialized()) {
$doc = $form->submit($drupal_form, $form_state);
$document = $doc->document;
dom_document_pretty_print($document);
exit();
}
else {
if ($form_state['clicked_button']['#id'] == 'edit-submit') {
}
else if ($form_state['clicked_button']['#id'] == 'edit-submit') {
global $base_url;
module_load_include('inc', 'fedora_repository', 'CollectionClass');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
@ -166,7 +167,6 @@ function fedora_repository_ingest_form_submit($form, &$form_state) {
$form_state['redirect'] = ($err) ? ' ' : $base_url . "/fedora/repository/{$form_state['values']['collection_pid']}";
}
}
}
}
function fedora_repository_ingest_form_validate($form, &$form_state) {
@ -180,7 +180,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
case 2:
// XML based form.
if (module_exists('xml_form_api')) {
if ($form_state['storage']['xml']) {
module_load_include('inc', 'xml_form_api', 'XMLForm');
$xml_form = new XMLForm($form_state);
$xml_form->validate($form, $form_state);
@ -618,10 +618,17 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) {
}
function fedora_repository_edit_qdc_form_validate($form, &$form_state) {
if (isset($form_state['storage']['step']) && $form_state['storage']['step'] == 1) {
if (isset($form_state['storage']['step'])) {
if ($form_state['storage']['step'] == 1) {
$form_state['storage']['step']++;
$form_state['rebuild'] = TRUE;
}
else {
module_load_include('inc', 'xml_form_api', 'XMLForm');
$xml_form = new XMLForm($form_state);
$xml_form->validate($form, $form_state);
}
}
}
/**
@ -634,8 +641,15 @@ function fedora_repository_edit_qdc_form_validate($form, &$form_state) {
* @return
*/
function fedora_repository_edit_qdc_form_submit($form, &$form_state) {
if (true) {
if ($form_state['storage']['xml']) {
module_load_include('inc', 'xml_form_api', 'XMLForm');
$xml_form = new XMLForm($form_state);
if ($xml_form->isInitialized()) {
$doc = $form->submit($drupal_form, $form_state);
$document = $doc->document;
dom_document_pretty_print($document);
exit();
}
}
else {
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');

4
formClass.inc

@ -502,6 +502,8 @@ class formClass {
$form_names = islandora_content_model_get_form_names($contentModels[0]->pid);
}
$form_state['storage']['xml'] = false;
switch ($form_state['storage']['step']) {
case 1:
$form['indicator'] = array(
@ -535,6 +537,7 @@ class formClass {
module_load_include('inc', 'xml_form_api', 'XMLForm');
$xml_form = new XMLForm($form_state);
if (isset($form_state['values']['forms']) || $xml_form->isInitialized()) {
$form_state['storage']['xml'] = true;
if (!$xml_form->isInitialized()) {
module_load_include('inc', 'xml_form_api', 'XMLFormDefinition');
module_load_include('inc', 'xml_form_builder', 'FormBuilder');
@ -749,6 +752,7 @@ class formClass {
$document = new XMLDocument($properties['document']['root'], $properties['document']['namespaces'], $properties['document']['schema'], $xml);
$xml_form->initialize($form, $document);
}
$form_state['storage']['xml'] = true;
return $xml_form->toArray();
}
break;

Loading…
Cancel
Save