Browse Source

Merge pull request #270 from nhart/6.x

6.x
pull/295/head
Jonathan Green 12 years ago
parent
commit
a6d904403b
  1. 42
      ContentModel.inc
  2. 22
      formClass.inc

42
ContentModel.inc

@ -1065,33 +1065,37 @@ class ContentModel extends XMLDatastream {
if (strtolower($ingest_form->getAttribute('hide_file_chooser')) == 'TRUE') {
$form['indicator']['ingest-file-location']['#type'] = 'hidden';
}
}
$dsid = $ingest_form->getAttribute('dsid');
$method = $ingest_form->getElementsByTagName('form_builder_method')->item(0);
$module = $method->getAttribute('module');
$path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file');
if (!file_exists($path)) {
self::$errors[] = 'Build Ingest Form: file \'' . $path . '\' does not exist.';
}
else {
@require_once($path);
$className = $method->getAttribute('class');
$methodName = ($method->getAttribute('method'));
if (!class_exists($className)) {
self::$errors[] = 'Build Ingest Form: class \'' . $className . ' does not exist.';
$dsid = $ingest_form->getAttribute('dsid');
$method = $ingest_form->getElementsByTagName('form_builder_method')->item(0);
$module = $method->getAttribute('module');
$path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file');
if (!file_exists($path)) {
self::$errors[] = 'Build Ingest Form: file \'' . $path . '\' does not exist.';
}
else {
$class = new $className;
$elements_array = $this->getIngestFormElements();
if (method_exists($class, $methodName)) {
$ret = $class->$methodName($form, $elements_array, $form_state);
@require_once($path);
$className = $method->getAttribute('class');
$methodName = ($method->getAttribute('method'));
if (!class_exists($className)) {
self::$errors[] = 'Build Ingest Form: class \'' . $className . ' does not exist.';
}
else {
self::$errors[] = 'Build Ingest Form: method \'' . $className . '->' . $methodName . '\' does not exist.';
$class = new $className;
$elements_array = $this->getIngestFormElements();
if (method_exists($class, $methodName)) {
$ret = $class->$methodName($form, $elements_array, $form_state);
}
else {
self::$errors[] = 'Build Ingest Form: method \'' . $className . '->' . $methodName . '\' does not exist.';
}
}
}
}
else {
self::$errors[] = 'No XML form association exists.';
}
}
return $ret;
}

22
formClass.inc

@ -235,7 +235,7 @@ class formClass {
'#default_value' => $triplepath,
'#description' => t('The url of the Fedora server\'s Triplestore. Change this only if you have set up an external triplestore'),
'#required' => TRUE,
);
@ -588,15 +588,17 @@ class formClass {
drupal_set_message($error, 'error');
}
}
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $collection_pid
);
$form['submit'] = array(
'#type' => 'submit',
'#submit' => array('fedora_repository_ingest_form_submit'),
'#value' => t('Ingest')
);
else {
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $collection_pid
);
$form['submit'] = array(
'#type' => 'submit',
'#submit' => array('fedora_repository_ingest_form_submit'),
'#value' => t('Ingest')
);
}
}
return $form;
}

Loading…
Cancel
Save