From a902683e98650b735398649e38db561d3c52a98d Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Tue, 29 May 2012 12:12:20 -0300 Subject: [PATCH 1/3] used theme table for list of datastreams --- islandora-object-edit.tpl.php | 11 +---------- islandora.module | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/islandora-object-edit.tpl.php b/islandora-object-edit.tpl.php index f06d8f64..3145cf44 100644 --- a/islandora-object-edit.tpl.php +++ b/islandora-object-edit.tpl.php @@ -44,17 +44,8 @@ //dsm($object); drupal_set_title($islandora_object->label); -$islandora_datastreams = $variables['islandora_datastreams']; print($islandora_object->label . ' ' . $islandora_object->id); -print ('

datastreams

'); -foreach ($islandora_datastreams as $dsid => $ds) { - print (l($ds['label'],$ds['view_url'])); - print (' ' . l('download', $ds['download_url'])); - print (' ' . l('delete', $ds['delete_url'])); - print ('
'); -} -print (drupal_render($variables['add_datastream_form'])); -print (l(t('Edit Metadata'),$variables['islandora_editmetadata_url'])); +print ($variables['datastream_table']); ?> diff --git a/islandora.module b/islandora.module index 16732800..2c1c694c 100644 --- a/islandora.module +++ b/islandora.module @@ -149,7 +149,7 @@ function islandora_menu() { 'title' => 'Properties', 'page callback' => 'drupal_get_form', 'file' => 'includes/object_properties.inc', - 'page arguments' => array('islandora_edit_properties_form',2), + 'page arguments' => array('islandora_edit_properties_form', 2), 'type' => MENU_LOCAL_TASK, 'access arguments' => array(FEDORA_MODIFY_STATE), 'weight' => -5, @@ -181,7 +181,7 @@ function islandora_menu() { // 'type' => MENU_NORMAL_ITEM, // 'access arguments' => array(FEDORA_ADD_DS) // ); - + $items['islandora/object/%/datastream/%'] = array( 'title' => 'View datastream', @@ -381,7 +381,7 @@ function islandora_edit_object($object_id) { function islandora_edit_properties($object_id) { $object = islandora_get_object($object_id); if (isset($object)) { - module_load_include('inc','islandora','includes/object_properties'); + module_load_include('inc', 'islandora', 'includes/object_properties'); $form = drupal_get_form('islandora_edit_properties_form', $object); drupal_set_title($object->label); return drupal_render($form); @@ -643,13 +643,22 @@ function islandora_preprocess_islandora_default_edit(&$variables) { global $base_url; $datastreams = array(); $variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id; - module_load_include('inc','islandora','includes/datastream'); + module_load_include('inc', 'islandora', 'includes/datastream'); // $variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id); + $header = array( + array('data' => t('Label')), + array('data' => t('Operations'),'colspan' => '2'), + //array('data' => t('Delete')), + ); + $table_attributes = array('class' => array('manage-datastrea')); + $rows = array(); foreach ($islandora_object as $ds) { - $datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download'; - $datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view'; - $datastreams['delete_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/delete'; - $datastreams['label'] = $ds->label; - $variables['islandora_datastreams'][$ds->id] = $datastreams; + $rows[] = array( + array('class' => 'datastream-label', 'data' => l($ds->label, $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view')), + array('class' => 'datastream-download', 'data' => l(t('download'), $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download')), + array('class' => 'datastream-delete', 'data' => l(t('delete'), $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/delete')), + ); } + $table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => NULL, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes); + $variables['datastream_table'] = theme_table($table); } \ No newline at end of file From 465ea079a23115003f5bcb969e01973d27114bf4 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Tue, 29 May 2012 12:16:09 -0300 Subject: [PATCH 2/3] updated caption for datastreams table --- islandora-object-edit.tpl.php | 2 +- islandora.module | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/islandora-object-edit.tpl.php b/islandora-object-edit.tpl.php index 3145cf44..409c9781 100644 --- a/islandora-object-edit.tpl.php +++ b/islandora-object-edit.tpl.php @@ -44,7 +44,7 @@ //dsm($object); drupal_set_title($islandora_object->label); -print($islandora_object->label . ' ' . $islandora_object->id); +//print($islandora_object->label . ' ' . $islandora_object->id); print ($variables['datastream_table']); ?> diff --git a/islandora.module b/islandora.module index 2c1c694c..750fccaf 100644 --- a/islandora.module +++ b/islandora.module @@ -659,6 +659,7 @@ function islandora_preprocess_islandora_default_edit(&$variables) { array('class' => 'datastream-delete', 'data' => l(t('delete'), $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/delete')), ); } - $table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => NULL, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes); + $caption = $islandora_object->label . ' - ' . $islandora_object->id; + $table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => $caption, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes); $variables['datastream_table'] = theme_table($table); } \ No newline at end of file From 9dc897382e8aeaaad4e03d7c6d3e8d9b5b596b38 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Tue, 29 May 2012 12:24:39 -0300 Subject: [PATCH 3/3] Updated object template --- islandora-object.tpl.php | 55 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/islandora-object.tpl.php b/islandora-object.tpl.php index 06b11cab..6a6680d3 100644 --- a/islandora-object.tpl.php +++ b/islandora-object.tpl.php @@ -27,15 +27,46 @@ * this is a template for objects that do not have a module to registered to build their display. * * islandora_object is a fedora tuque Object - * $object->label - * $object->id + * $object->label - The label for this object. + * $object->id - The identifier of the object. + * $object->state - The state of this object. + * $object->createdDate - The date the object was ingested. + * $object->lastModifiedDate - The date teh object was last mofified. + * * to get the contents of a datastream - * $object['dsid']->content + * $object['dsid']->content + * + * to test if a datastream exists isset($object['dsid']) + * + * to iterate over datastreams: + * foreach($object as $ds) { + * $ds->label, etc + * } + * + * each $ds in the above loop has the following properties: + * $ds->label - The label for this datastream. + * $ds->id - The identifier of the datastream. + * $ds->controlGroup - The control group of the datastream. This + * property is read-only. This will return one of: "X", "M", "R", or "E". + * $ds->versionable - This defines if the datastream will be versioned + * or not. This is boolean. + * $ds->state - The state of the datastream. This will be one + * of: "A", "I", "D". + * $ds->mimetype - The mimetype of the datastrem. + * $ds->format - The format of the datastream + * $ds->size - The size of the datastream + * $ds->checksum - The checksum of the datastream + * $ds->checksumType - The type of checksum for the datastream. + * $ds->createdDate - The created date + * $ds->content - The content of the datastream + * $ds->url - The URL. This is only valid for R and E datastreams. * * $dublin_core is a Dublin_Core object * which is an array of elements, such as dc.title * and each element has an array of values. dc.title can have none, one or many titles * this is the case for all dc elements. + * + * * * we can get a list of datastreams by doing * foreach ($object as $ds){ @@ -90,4 +121,22 @@ drupal_set_title($islandora_object->label); + + + + + + + + + +
+ id; ?> + + label; ?> + + controlGroup; ?> + + mimetype; ?> +