diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index d30af147..573d7c62 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -115,6 +115,10 @@ class IslandoraFedoraRepository extends FedoraRepository { foreach ($object as $dsid => $datastream) { islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_INGESTED_HOOK, $object->models, $dsid, $object, $datastream); } + // Fire of event if rules is enabled. + if (module_exists('rules')) { + rules_invoke_event('islandora_object_ingested', $object); + } return $ret; } catch (Exception $e) { diff --git a/islandora.module b/islandora.module index 9e7809eb..fd71bb3c 100644 --- a/islandora.module +++ b/islandora.module @@ -1531,6 +1531,11 @@ function islandora_entity_property_info() { 'label' => t('Content Models'), 'description' => t('The list of content models which the object has.'), ); + $p['createdDate'] = array( + 'type' => 'text', + 'label' => t('Created Date'), + 'description' => t('When the object was created.'), + ); return $info; } diff --git a/islandora.rules.inc b/islandora.rules.inc index 4045b1b9..02f5c822 100644 --- a/islandora.rules.inc +++ b/islandora.rules.inc @@ -5,11 +5,30 @@ * Does rule type stuff, */ +/** + * Implements hook_rules_event_info(). + */ +function islandora_rules_event_info() { + return array( + 'islandora_object_ingested' => array( + 'group' => t('Islandora'), + 'label' => t('Object ingested'), + 'variables' => array( + 'object' => array( + 'type' => 'islandora_object', + 'label' => t('The ingested object'), + 'description' => t('A Tuque object for the ingested Fedora object, as an entity.'), + ), + ), + ), + ); +} + /** * Helper function to get reused "parameter" array. */ function islandora_rules_relationship_parameter_array() { - $to_return = array( + return array( 'subject' => array( 'type' => 'islandora_object', 'label' => t('Subject'), @@ -39,8 +58,6 @@ function islandora_rules_relationship_parameter_array() { 'default value' => 0, ), ); - - return $to_return; } /** diff --git a/islandora.rules_defaults.inc b/islandora.rules_defaults.inc new file mode 100644 index 00000000..17f83b63 --- /dev/null +++ b/islandora.rules_defaults.inc @@ -0,0 +1,26 @@ +label = 'E-mail admin'; + $rule->active = FALSE; + $rule + ->event('islandora_object_ingested') + ->action( + 'mail', + array( + 'to' => '[site:mail]', + 'subject' => '[[site:name]] "[object:label]" has been ingested', + 'message' => '[object:label] has been ingested as [object:id].', + ) + ); + return array('islandora_object_ingested_notify_admin' => $rule); +}