From 9cca7a3ce17e6122ca3726810f4bff73efef9898 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Tue, 29 May 2012 10:59:40 -0300 Subject: [PATCH] updated properties form --- includes/object_properties.inc | 57 ++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/includes/object_properties.inc b/includes/object_properties.inc index 34a7b67e..c8589e62 100644 --- a/includes/object_properties.inc +++ b/includes/object_properties.inc @@ -1,8 +1,17 @@ owner){ - $params['ownerId'] = check_plain($owner); - $submit = TRUE; - } - if(isset($state) && $state != $islandora_object->state){ - $params['state'] = check_plain($state); - $submit = TRUE; + if (isset($owner) && $owner != $islandora_object->owner) { + try { + $islandora_object->owner = $owner; + drupal_set_message(t('Successfully updated owner %s', array('%s' => $owner))); + } catch (Exception $e) { + form_set_error('object_owner',t('Error updating owner %s', array('%s'=> $e->getMessage()))); + } } - if(isset($label) && $label != $islandora_object->label){ - $params['label'] = check_plain($label); - $submit = TRUE; + if (isset($state) && $state != $islandora_object->state) { + try { + $islandora_object->state = $state; + drupal_set_message(t('Successfully updated state %s', array('%s' => $state))); + } catch (Exception $e) { + form_set_error('object_state',t('Error updating state %s', array('%s'=> $e->getMessage()))); + } } - if($submit){ - $islandora_object->modifyObject($params); + if (isset($label) && $label != $islandora_object->label) { + try { + $islandora_object->label = $label; + drupal_set_message(t('Successfully updated label %s', array('%s' => check_plain($label)))); + } catch (Exception $e) { + form_set_error(t('Error updating label %s', array('%s' => $e->getMessage()))); + } } } @@ -45,10 +61,10 @@ function islandora_edit_properties_form_submit($form, &$form_state){ * an object id * @return array */ -function islandora_edit_properties_form ($form, &$form_state, $object_id){ +function islandora_edit_properties_form($form, &$form_state, $object_id) { $form = array(); $islandora_object = islandora_get_object($object_id); - if(!isset($islandora_object)){ + if (!isset($islandora_object)) { return NULL; } $form['pid'] = array( @@ -76,7 +92,7 @@ function islandora_edit_properties_form ($form, &$form_state, $object_id){ '#required' => TRUE, '#description' => t('The items state one of active, inactive or deleted'), '#type' => 'select', - '#options' => array ('A' => 'Active', 'I' => 'Inactive', 'D'=>'Deleted'), + '#options' => array('A' => 'Active', 'I' => 'Inactive', 'D' => 'Deleted'), ); $form['submit'] = array( '#type' => 'submit', @@ -84,4 +100,5 @@ function islandora_edit_properties_form ($form, &$form_state, $object_id){ ); return $form; } + ?>