Browse Source

Autocomplete

pull/120/head
jonathangreen 13 years ago
parent
commit
b48aef3162
  1. 15
      includes/datastream.inc
  2. 17
      islandora.module

15
includes/datastream.inc

@ -339,6 +339,7 @@ function islandora_add_datastream_form($form, &$form_state, $object_id) {
'#value' => t('Add Datastream')
);
/*
if (!empty($unused_dsids)) {
$dsidsForForm = array();
foreach ($unused_dsids as $key => $value) {
@ -354,17 +355,29 @@ function islandora_add_datastream_form($form, &$form_state, $object_id) {
$form['add_fieldset']['stream_id']['#options'] = $dsidsForForm;
}
else {
*
*/
$form['add_fieldset']['stream_id'] = array(
'#title' => 'Datastream ID',
'#required' => 'TRUE',
'#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'),
'#type' => 'textfield',
'#weight' => -1,
'#autocomplete_path' => "islandora/object/$object_id/manage/datastreams/add/autocomplete",
);
}
//}
return $form;
}
function islandora_datastream_autocomplete_callback($object_id) {
$dsids = islandora_get_unused_dsids($object_id);
$output = array();
foreach($dsids as $id => $ds) {
$output[$id] = $id;
}
drupal_json_output($output);
}
function islandora_datastream_get_human_readable_size($ds) {
module_load_include('inc', 'islandora', 'includes/utilities');

17
islandora.module

@ -170,16 +170,13 @@ function islandora_menu() {
'access arguments' => array(FEDORA_ADD_DS)
);
// $items['islandora/object/%/add'] = array(
// 'title' => 'Add to an object',
// 'file' => 'includes/datastream.inc',
// 'page callback' => 'drupal_get_form',
// 'page arguments' => array('islandora_add_datastream_form',2),
// 'type' => MENU_NORMAL_ITEM,
// 'access arguments' => array(FEDORA_ADD_DS)
// );
$items['islandora/object/%/manage/datastreams/add/autocomplete'] = array(
'file' => 'includes/datastream.inc',
'page callback' => 'islandora_datastream_autocomplete_callback',
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'access arguments' => array(FEDORA_ADD_DS)
);
$items['islandora/object/%/datastream/%'] = array(
'title' => 'View datastream',

Loading…
Cancel
Save