Skip to content

Commit

Permalink
Merge branch '6.x' of git://github.com/Islandora/islandora into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Apr 17, 2012
2 parents aa7f8fe + df90c2d commit 99a84f9
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 32 deletions.
4 changes: 2 additions & 2 deletions CollectionClass.inc
@@ -1,4 +1,4 @@
<?php /<?php


/** /**
* @file * @file
Expand Down Expand Up @@ -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(
Expand Down
19 changes: 17 additions & 2 deletions ConnectionHelper.inc
@@ -1,7 +1,5 @@
<?php <?php




/** /**
* @file * @file
* Connection Helper Class * Connection Helper Class
Expand Down Expand Up @@ -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;
} }


Expand Down
1 change: 1 addition & 0 deletions ContentModel.inc
Expand Up @@ -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;
} }
} }
Expand Down
3 changes: 1 addition & 2 deletions ObjectHelper.inc
Expand Up @@ -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);
} }
Expand Down
21 changes: 16 additions & 5 deletions api/fedora_item.inc
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion fedora_repository.info
Expand Up @@ -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
48 changes: 32 additions & 16 deletions fedora_repository.module
Expand Up @@ -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) {
Expand Down Expand Up @@ -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'];
Expand All @@ -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 '';
Expand All @@ -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);
} }
Expand Down Expand Up @@ -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);


$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; $form_state['redirect'] = 'fedora/repository/' . $pid;
} }
Expand Down Expand Up @@ -813,11 +822,10 @@ 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'])) {
module_load_include('inc', 'fedora_repository', 'ContentModel'); module_load_include('inc', 'fedora_repository', 'ContentModel');
if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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. // Add a 'manage object' tab for all objects, where detailed list of content is shown.
$obj = new FedoraObjectDetailedContent($pid); $obj = new FedoraObjectDetailedContent($pid);
$object_details = $obj->showFieldSets();
if ($object_details['fedora_object_details']['#selected'] == TRUE) { //can disable showing the object details tab in admin UI
foreach ($cmodels_tabs as &$cmodel_tab) { if (variable_get('fedora_repository_show_object_details_tab', TRUE)) {
if (is_array($cmodel_tab)) { $object_details = $obj->showFieldSets();
$cmodel_tab['#selected'] = FALSE; 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); $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid);
Expand Down
18 changes: 17 additions & 1 deletion formClass.inc
Expand Up @@ -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
); );
Expand Down Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion plugins/Flv.inc
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion plugins/Refworks.inc
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion plugins/fedora_imageapi.info
Expand Up @@ -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

0 comments on commit 99a84f9

Please sign in to comment.