diff --git a/CollectionClass.inc b/CollectionClass.inc index 6fa83b630..27a497d7a 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -1,4 +1,4 @@ -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 = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); $params = array( diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index f34581e3b..a385199cd 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -1,7 +1,5 @@ _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; } diff --git a/ContentModel.inc b/ContentModel.inc index 444f485cf..be362c705 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -1374,6 +1374,7 @@ class ContentModel extends XMLDatastream { else { $status = $class->$methodName($param_array, $method->getAttribute('dsid'), $file, $method->getAttribute('modified_files_ext')); if ($status !== TRUE) { + self::$errors[] = 'Execute Ingest Rules: method \'' . $className . '->' . $methodName . '\' failed.'; $ret = FALSE; } } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index b671e1d50..aeaf09d00 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -122,8 +122,7 @@ class ObjectHelper { $dsID = variable_get('fedora_default_display_dsid', 'TN'); $mimeType = 'image/jpeg'; } - - $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $pid . '/' . $dsID; + $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/datastreams/' . $dsID . '/content'; if ($version) { $url .= '/' . $version; //drupal_urlencode($version); } diff --git a/api/fedora_item.inc b/api/fedora_item.inc index d107a844c..279a3e514 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -59,7 +59,7 @@ class Fedora_Item { 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)) { $this->objectProfile = $raw_objprofile->objectProfile; @@ -141,10 +141,18 @@ class Fedora_Item { * @return type */ 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)) { $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( 'pid' => $this->pid, 'dsID' => $datastream_id, @@ -470,15 +478,18 @@ RDF; * Get datastream dissemination * @param type $dsid * @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( 'pid' => $this->pid, 'dsID' => $dsid, '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)) { $content = $object->dissemination->stream; $content = trim($content); @@ -1086,7 +1097,7 @@ RDF; } $url = ( 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') ); try { diff --git a/fedora_repository.info b/fedora_repository.info index 5d3762e46..018910bf6 100644 --- a/fedora_repository.info +++ b/fedora_repository.info @@ -4,5 +4,5 @@ dependencies[] = tabs dependencies[] = islandora_content_model_forms description = Shows a list of items in a fedora collection. package = Islandora -version = 11.3.1 +version = 6.x-dev core = 6.x diff --git a/fedora_repository.module b/fedora_repository.module index 45f99d018..abec4b9ef 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -538,7 +538,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { ); try { $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)); unset($form_state['storage']['confirm']); } 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) { global $base_url; 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']; $item = new Fedora_Item($pid); $dsid = $form_state['values']['dsid']; @@ -617,7 +616,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) { * @param type $collectionName * @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) { drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); return ''; @@ -636,9 +635,7 @@ function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName * @return type */ 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'); -//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $replaceDataStreamForm = new formClass(); 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); $item = new Fedora_Item($pid); + $info = $item->get_datastream_info($dsid); - $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); + if($info->datastream->controlGroup == 'M') { + $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; } @@ -813,11 +822,10 @@ function fedora_repository_edit_qdc_form_submit($form, &$form_state) { global $base_url; 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(); - $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'])) { module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { @@ -875,6 +883,7 @@ function fedora_repository_access($op, $node, $account) { * @param $dsID String */ function makeObject($pid, $dsID) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); @@ -1007,13 +1016,20 @@ 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. $obj = new FedoraObjectDetailedContent($pid); - $object_details = $obj->showFieldSets(); - if ($object_details['fedora_object_details']['#selected'] == TRUE) { - foreach ($cmodels_tabs as &$cmodel_tab) { - if (is_array($cmodel_tab)) { - $cmodel_tab['#selected'] = FALSE; - } - } + + //can disable showing the object details tab in admin UI + if (variable_get('fedora_repository_show_object_details_tab', TRUE)) { + $object_details = $obj->showFieldSets(); + if ($object_details['fedora_object_details']['#selected'] == TRUE) { + foreach ($cmodels_tabs as &$cmodel_tab) { + if (is_array($cmodel_tab)) { + $cmodel_tab['#selected'] = FALSE; + } + } + } + } + else { + $object_details = array(); } $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid); diff --git a/formClass.inc b/formClass.inc index e6a3523b0..c11221824 100644 --- a/formClass.inc +++ b/formClass.inc @@ -245,7 +245,7 @@ class formClass { $form['fedora_soap_manage_url'] = array( '#type' => 'textfield', '#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, '#weight' => -10 ); @@ -291,6 +291,22 @@ class formClass { '#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.'), ); + //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( '#type' => 'fieldset', '#title' => t('Advanced configuration options'), diff --git a/plugins/Flv.inc b/plugins/Flv.inc index b5f159b2e..8d2079b67 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -110,7 +110,7 @@ class FormBuilder { try { $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) { drupal_set_message(t('Error getting SOAP client.'), 'error'); diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index 2c86caa7f..70b0abeba 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -286,7 +286,7 @@ class Refworks { try { $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) { drupal_set_message(t('Error getting SOAP client.'), 'error'); diff --git a/plugins/fedora_imageapi.info b/plugins/fedora_imageapi.info index 3a9deea73..cbd6b2ae0 100644 --- a/plugins/fedora_imageapi.info +++ b/plugins/fedora_imageapi.info @@ -3,5 +3,5 @@ description = Adds image manipulation support through a REST interface package = Islandora Dependencies dependencies[] = fedora_repository dependencies[] = imageapi -version = 11.3.1 +version = 6.x-dev core = 6.x