Browse Source

Merge branch '6.x' of git://github.com/Islandora/islandora into 6.x

pull/99/merge
Adam Vessey 13 years ago
parent
commit
99a84f9414
  1. 4
      CollectionClass.inc
  2. 19
      ConnectionHelper.inc
  3. 1
      ContentModel.inc
  4. 3
      ObjectHelper.inc
  5. 21
      api/fedora_item.inc
  6. 2
      fedora_repository.info
  7. 30
      fedora_repository.module
  8. 18
      formClass.inc
  9. 2
      plugins/Flv.inc
  10. 2
      plugins/Refworks.inc
  11. 2
      plugins/fedora_imageapi.info

4
CollectionClass.inc

@ -1,4 +1,4 @@
<?php /<?php
/** /**
* @file * @file
@ -447,7 +447,7 @@ class CollectionClass {
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
$connectionHelper = new ConnectionHelper(); $connectionHelper = new ConnectionHelper();
try { try {
$soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'));
$pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); $pidNameSpace = variable_get('fedora_repository_pid', 'vre:');
$pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":"));
$params = array( $params = array(

19
ConnectionHelper.inc

@ -1,7 +1,5 @@
<?php <?php
/** /**
* @file * @file
* Connection Helper Class * Connection Helper Class
@ -90,6 +88,23 @@ class ConnectionHelper {
return NULL; return NULL;
} }
} }
if (isset($_SESSION['islandora_soapcookies'])) {
// just set the cookies
$client->_cookies = ($_SESSION['islandora_soapcookies']);
}
else {
try {
//we need to make a call to set the cookie this extra call would only happen once per session
$client->__soapCall('describeRepository', array());
$_SESSION['islandora_soapcookies'] = $client->_cookies;
} catch (exception $e) {
//connection is tested elsewhere so eat this for now here we just want the cookie
}
}
return $client; return $client;
} }

1
ContentModel.inc

@ -1374,6 +1374,7 @@ class ContentModel extends XMLDatastream {
else { else {
$status = $class->$methodName($param_array, $method->getAttribute('dsid'), $file, $method->getAttribute('modified_files_ext')); $status = $class->$methodName($param_array, $method->getAttribute('dsid'), $file, $method->getAttribute('modified_files_ext'));
if ($status !== TRUE) { if ($status !== TRUE) {
self::$errors[] = 'Execute Ingest Rules: method \'' . $className . '->' . $methodName . '\' failed.';
$ret = FALSE; $ret = FALSE;
} }
} }

3
ObjectHelper.inc

@ -122,8 +122,7 @@ class ObjectHelper {
$dsID = variable_get('fedora_default_display_dsid', 'TN'); $dsID = variable_get('fedora_default_display_dsid', 'TN');
$mimeType = 'image/jpeg'; $mimeType = 'image/jpeg';
} }
$url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/datastreams/' . $dsID . '/content';
$url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $pid . '/' . $dsID;
if ($version) { if ($version) {
$url .= '/' . $version; //drupal_urlencode($version); $url .= '/' . $version; //drupal_urlencode($version);
} }

21
api/fedora_item.inc

@ -59,7 +59,7 @@ class Fedora_Item {
self::$connection_helper = new ConnectionHelper(); self::$connection_helper = new ConnectionHelper();
} }
$raw_objprofile = $this->soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => "")); $raw_objprofile = $this->soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => ""), TRUE);
if (!empty($raw_objprofile)) { if (!empty($raw_objprofile)) {
$this->objectProfile = $raw_objprofile->objectProfile; $this->objectProfile = $raw_objprofile->objectProfile;
@ -141,10 +141,18 @@ class Fedora_Item {
* @return type * @return type
*/ */
function add_datastream_from_url($datastream_url, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { function add_datastream_from_url($datastream_url, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) {
global $base_url;
if (empty($datastream_label)) { if (empty($datastream_label)) {
$datastream_label = $datastream_id; $datastream_label = $datastream_id;
} }
// Fedora has some problems getting files from HTTPS connections sometimes, so if we are getting a file
// from the local drupal, we try to pass a HTTP url instead of a HTTPS one.
if(stripos($datastream_url, 'https://') !== FALSE && stripos($datastream_url, $base_url) !== FALSE) {
$datastream_url = str_ireplace('https://', 'http://', $datastream_url);
}
$params = array( $params = array(
'pid' => $this->pid, 'pid' => $this->pid,
'dsID' => $datastream_id, 'dsID' => $datastream_id,
@ -470,15 +478,18 @@ RDF;
* Get datastream dissemination * Get datastream dissemination
* @param type $dsid * @param type $dsid
* @param type $as_of_date_time * @param type $as_of_date_time
* @return string * @param type $quiet
* @return null
*/ */
function get_datastream_dissemination($dsid, $as_of_date_time = "") { function get_datastream_dissemination($dsid, $as_of_date_time = "", $quiet=TRUE) {
$params = array( $params = array(
'pid' => $this->pid, 'pid' => $this->pid,
'dsID' => $dsid, 'dsID' => $dsid,
'asOfDateTime' => $as_of_date_time, 'asOfDateTime' => $as_of_date_time,
); );
$object = self::soap_call('getDataStreamDissemination', $params);
// Make soap call with quite
$object = self::soap_call('getDataStreamDissemination', $params, $quiet);
if (!empty($object)) { if (!empty($object)) {
$content = $object->dissemination->stream; $content = $object->dissemination->stream;
$content = trim($content); $content = trim($content);
@ -1086,7 +1097,7 @@ RDF;
} }
$url = ( $url = (
in_array($function, self::$SoapManagedFunctions)? in_array($function, self::$SoapManagedFunctions)?
variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'): variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M') :
variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl') variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')
); );
try { try {

2
fedora_repository.info

@ -4,5 +4,5 @@ dependencies[] = tabs
dependencies[] = islandora_content_model_forms dependencies[] = islandora_content_model_forms
description = Shows a list of items in a fedora collection. description = Shows a list of items in a fedora collection.
package = Islandora package = Islandora
version = 11.3.1 version = 6.x-dev
core = 6.x core = 6.x

30
fedora_repository.module

@ -538,7 +538,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
); );
try { try {
$soapHelper = new ConnectionHelper(); $soapHelper = new ConnectionHelper();
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'));
$object = $client->__soapCall('purgeObject', array($params)); $object = $client->__soapCall('purgeObject', array($params));
unset($form_state['storage']['confirm']); unset($form_state['storage']['confirm']);
} catch (exception $e) { } catch (exception $e) {
@ -597,7 +597,6 @@ function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) {
function fedora_repository_purge_stream_form_submit($form, &$form_state) { function fedora_repository_purge_stream_form_submit($form, &$form_state) {
global $base_url; global $base_url;
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
$pid = $form_state['values']['pid']; $pid = $form_state['values']['pid'];
$item = new Fedora_Item($pid); $item = new Fedora_Item($pid);
$dsid = $form_state['values']['dsid']; $dsid = $form_state['values']['dsid'];
@ -617,7 +616,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) {
* @param type $collectionName * @param type $collectionName
* @return type * @return type
*/ */
function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { function fedora_repository_replace_stream($pid, $dsId, $dsLabel = '', $collectionName = NULL) {
if ($pid == NULL || $dsId == NULL) { if ($pid == NULL || $dsId == NULL) {
drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error');
return ''; return '';
@ -636,9 +635,7 @@ function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName
* @return type * @return type
*/ */
function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) {
//module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'fedora_repository', '');
module_load_include('inc', 'Fedora_Repository', 'formClass'); module_load_include('inc', 'Fedora_Repository', 'formClass');
//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
$replaceDataStreamForm = new formClass(); $replaceDataStreamForm = new formClass();
return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state); return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state);
} }
@ -707,8 +704,20 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
$dformat = $mimetype->getType($file->filepath); $dformat = $mimetype->getType($file->filepath);
$item = new Fedora_Item($pid); $item = new Fedora_Item($pid);
$info = $item->get_datastream_info($dsid);
if($info->datastream->controlGroup == 'M') {
$item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat);
} elseif ($info->datastream->controlGroup == 'X') {
if($dformat == 'text/xml') {
$item->modify_datastream_by_value(file_get_contents($file->filepath), $dsid, $dsLabel, $dformat);
}
else {
drupal_set_message('File must be of mimetype text/xml in order to replace inline XML datastream.', 'error');
}
} else {
drupal_set_message('Cannot replace Redirect or Managed Datastream.', 'error');
}
$form_state['redirect'] = 'fedora/repository/' . $pid; $form_state['redirect'] = 'fedora/repository/' . $pid;
} }
@ -813,9 +822,8 @@ function fedora_repository_edit_qdc_form_submit($form, &$form_state) {
global $base_url; global $base_url;
if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) {
//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
$soap_helper = new ConnectionHelper(); $soap_helper = new ConnectionHelper();
$client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'));
// Check the content model for a custom edit metadata form submit function. // Check the content model for a custom edit metadata form submit function.
if (isset($form_state['values']['pid'])) { if (isset($form_state['values']['pid'])) {
@ -875,6 +883,7 @@ function fedora_repository_access($op, $node, $account) {
* @param $dsID String * @param $dsID String
*/ */
function makeObject($pid, $dsID) { function makeObject($pid, $dsID) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
if (!valid_pid($pid)) { if (!valid_pid($pid)) {
drupal_set_message(t("Invalid PID!"), 'error'); drupal_set_message(t("Invalid PID!"), 'error');
@ -1007,6 +1016,9 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
// Add a 'manage object' tab for all objects, where detailed list of content is shown. // Add a 'manage object' tab for all objects, where detailed list of content is shown.
$obj = new FedoraObjectDetailedContent($pid); $obj = new FedoraObjectDetailedContent($pid);
//can disable showing the object details tab in admin UI
if (variable_get('fedora_repository_show_object_details_tab', TRUE)) {
$object_details = $obj->showFieldSets(); $object_details = $obj->showFieldSets();
if ($object_details['fedora_object_details']['#selected'] == TRUE) { if ($object_details['fedora_object_details']['#selected'] == TRUE) {
foreach ($cmodels_tabs as &$cmodel_tab) { foreach ($cmodels_tabs as &$cmodel_tab) {
@ -1015,6 +1027,10 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
} }
} }
} }
}
else {
$object_details = array();
}
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid); $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid);
$cmodels_tabs = array_merge($cmodels_tabs, $object_details, $hook_tabs); $cmodels_tabs = array_merge($cmodels_tabs, $object_details, $hook_tabs);

18
formClass.inc

@ -245,7 +245,7 @@ class formClass {
$form['fedora_soap_manage_url'] = array( $form['fedora_soap_manage_url'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Fedora SOAP management URL'), '#title' => t('Fedora SOAP management URL'),
'#default_value' => variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'), '#description' => t('The URL to use for SOAP API-M connections'), '#default_value' => variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'), '#description' => t('The URL to use for SOAP API-M connections'),
'#required' => TRUE, '#required' => TRUE,
'#weight' => -10 '#weight' => -10
); );
@ -291,6 +291,22 @@ class formClass {
'#default_value' => variable_get('fedora_repository_title', 'Digital Repository'), '#default_value' => variable_get('fedora_repository_title', 'Digital Repository'),
'#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'), '#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'),
); );
//have tabs options (like disable)
$form['tabs'] = array(
'#type' => 'fieldset',
'#title' => t('Tabs Configuration'),
'#description' => t('Configure the tabs avaialble when viewing Fedora objects.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
//when checked show object details tab
$form['tabs']['fedora_repository_show_object_details_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Show Object Details Tab'),
'#default_value' => variable_get('fedora_repository_show_object_details_tab', TRUE),
'#description' => t("When enabled, the 'Object Details' tab will be visible to users with the correct permissions when viewing an object in the repository"),
);
$form['advanced'] = array( $form['advanced'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => t('Advanced configuration options'), '#title' => t('Advanced configuration options'),

2
plugins/Flv.inc

@ -110,7 +110,7 @@ class FormBuilder {
try { try {
$soapHelper = new ConnectionHelper(); $soapHelper = new ConnectionHelper();
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'));
if ($client == NULL) { if ($client == NULL) {
drupal_set_message(t('Error getting SOAP client.'), 'error'); drupal_set_message(t('Error getting SOAP client.'), 'error');

2
plugins/Refworks.inc

@ -286,7 +286,7 @@ class Refworks {
try { try {
$soapHelper = new ConnectionHelper(); $soapHelper = new ConnectionHelper();
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'));
if ($client == NULL) { if ($client == NULL) {
drupal_set_message(t('Error getting SOAP client.'), 'error'); drupal_set_message(t('Error getting SOAP client.'), 'error');

2
plugins/fedora_imageapi.info

@ -3,5 +3,5 @@ description = Adds image manipulation support through a REST interface
package = Islandora Dependencies package = Islandora Dependencies
dependencies[] = fedora_repository dependencies[] = fedora_repository
dependencies[] = imageapi dependencies[] = imageapi
version = 11.3.1 version = 6.x-dev
core = 6.x core = 6.x

Loading…
Cancel
Save