Permalink
Browse files

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

  • Loading branch information...
2 parents aa7f8fe + df90c2d commit 99a84f94147555df1782da62c29b82c0f01b3250 @adam-vessey adam-vessey committed Apr 17, 2012
View
@@ -1,4 +1,4 @@
-<?php
+/<?php
/**
* @file
@@ -447,7 +447,7 @@ class CollectionClass {
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
$connectionHelper = new ConnectionHelper();
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 = substr($pidNameSpace, 0, strpos($pidNameSpace, ":"));
$params = array(
View
@@ -1,7 +1,5 @@
<?php
-
-
/**
* @file
* Connection Helper Class
@@ -90,6 +88,23 @@ class ConnectionHelper {
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;
}
View
@@ -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;
}
}
View
@@ -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);
}
View
@@ -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 {
@@ -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
@@ -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);
View
@@ -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'),
View
@@ -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');
@@ -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');
@@ -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

0 comments on commit 99a84f9

Please sign in to comment.