Browse Source

Added custom PID to ingest form.

pull/2/head
Alexander O'Neill 14 years ago
parent
commit
4db6df2122
  1. 14
      ilives/book.inc

14
ilives/book.inc

@ -21,6 +21,15 @@ class IslandoraBook {
// Set #cache to true to create the $form_state cache // Set #cache to true to create the $form_state cache
$form['#cache'] = TRUE; $form['#cache'] = TRUE;
// Give the user an option to enter a custom PID
$form['custom_pid'] = array(
'#type' => 'textfield',
'#title' => 'Custom PID',
'#description' => 'If you want to manually specify the PID for the new object, enter it here. '.
'Leave it blank for an automatically-generated PID.',
);
// Prompt the user to enter a record ID to be looked up in Evergreen. // Prompt the user to enter a record ID to be looked up in Evergreen.
$form['unapi_url'] = array( $form['unapi_url'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@ -90,7 +99,7 @@ class IslandoraBook {
return TRUE; return TRUE;
} }
public function handleIngestForm($form_values, $form, &$form_state) { public function handleIngestForm($form_values) {
/* /*
* process the metadata form * process the metadata form
* Create fedora object * Create fedora object
@ -115,7 +124,8 @@ class IslandoraBook {
global $user; global $user;
$mimetype = new MimeClass(); $mimetype = new MimeClass();
$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $title,
$new_item = Fedora_Item::ingest_new_item(!empty($form_values['custom_pid']) ? $form_values['custom_pid'] : $form_values['pid'], 'A', $title,
$user->name); $user->name);
$new_item->add_datastream_from_string($form_values['mods']['mods_record'], 'MODS', $new_item->add_datastream_from_string($form_values['mods']['mods_record'], 'MODS',

Loading…
Cancel
Save