diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index 71013339..e17fddb6 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -141,7 +141,8 @@ function islandora_basic_image_node_postinsert($node) { ); } - httprl_request("http://127.0.0.1:8888/islandora/rest/basic-image/?uuid=$parent_collection", + $url = "http://127.0.0.1:8181/cxf/islandora/image/$parent_collection"; + httprl_request($url, $options); $response = httprl_send_request(); } @@ -184,7 +185,28 @@ function islandora_basic_image_node_postupdate($node) { ); } - httprl_request("http://127.0.0.1:8888/islandora/rest/basic-image/?uuid={$node->uuid}", + httprl_request("http://127.0.0.1:8181/cxf/islandora/image/{$node->uuid}", $options); $response = httprl_send_request(); } + +/** + * Implements hook_node_postdelete(). + */ +function islandora_basic_image_node_postdelete($node) { + if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) { + return; + } + + // Exit early if it's not a collection. + if (strcmp($node->type, ISLANDORA_BASIC_IMAGE_CONTENT_TYPE) != 0) { + return; + } + + $uuid = $node->uuid; + httprl_request("http://127.0.0.1:8181/cxf/islandora/image/$uuid", + array( + 'method' => 'DELETE', + )); + $response = httprl_send_request(); +} diff --git a/islandora_collection/islandora_collection.module b/islandora_collection/islandora_collection.module index 12baa132..deeb1921 100644 --- a/islandora_collection/islandora_collection.module +++ b/islandora_collection/islandora_collection.module @@ -124,12 +124,15 @@ function islandora_collection_node_postinsert($node) { } $node = array_pop($nodes); - $url = "http://127.0.0.1:8181/islandora/rest/collection/$parent_collection"; + $url = "http://127.0.0.1:8181/cxf/islandora/collection/$parent_collection"; // Don't forget the trailing slash. httprl_request($url, array( 'method' => 'POST', + 'headers' => array( + 'Content-Type' => 'application/json', + ), 'data' => json_encode($node), )); $response = httprl_send_request(); @@ -161,9 +164,12 @@ function islandora_collection_node_postupdate($node) { $node = array_pop($nodes); $uuid = $node->uuid; - httprl_request("http://127.0.0.1:8181/islandora/rest/collection/$uuid", + httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid", array( 'method' => 'PUT', + 'headers' => array( + 'Content-Type' => 'application/json', + ), 'data' => json_encode($node), )); $response = httprl_send_request(); @@ -183,7 +189,7 @@ function islandora_collection_node_postdelete($node) { } $uuid = $node->uuid; - httprl_request("http://127.0.0.1:8181/islandora/rest/collection/$uuid", + httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid", array( 'method' => 'DELETE', ));