Browse Source

Merge pull request #107 from grf/postgres-fixes

Postgres fixes
pull/104/merge
Jonathan Green 13 years ago
parent
commit
5918624b91
  1. 10
      CollectionClass.inc
  2. 2
      CollectionPolicy.inc
  3. 4
      ObjectHelper.inc
  4. 10
      SearchClass.inc
  5. 6
      SecurityClass.inc
  6. 2
      XMLDatastream.inc
  7. 14
      fedora_repository.module
  8. 2
      plugins/DarwinCore.inc
  9. 2
      plugins/FlvFormBuilder.inc
  10. 8
      plugins/FormBuilder.inc
  11. 2
      plugins/ModsFormBuilder.inc
  12. 8
      plugins/PersonalCollectionClass.inc
  13. 4
      plugins/QtFormBuilder.php
  14. 6
      plugins/Refworks.inc
  15. 6
      plugins/ShowStreamsInFieldSets.inc
  16. 2
      plugins/fedora_imageapi.module
  17. 2
      plugins/qt_viewer.inc

10
CollectionClass.inc

@ -226,7 +226,7 @@ class CollectionClass {
* @return ContentModel
*/
function getContentModels($collection_pid, $showError = TRUE) {
module_load_include('inc', 'Fedora_Repository', 'ContentModel');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$collection_stream = $this->getCollectionPolicyStream($collection_pid);
try {
$xml = new SimpleXMLElement($collection_stream);
@ -253,7 +253,7 @@ class CollectionClass {
* $dsid is the datastream id of the content model.
*/
function getNextPid($pid, $dsid) {
module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
$pidNameSpace = $this->getPidNameSpace($pid, $dsid);
$pname = substr($pidNameSpace, 0, strpos($pidNameSpace, ":"));
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
@ -371,7 +371,7 @@ class CollectionClass {
$parametersArray["$name"] = $value;
}
}
// module_load_include( $phpFile, 'Fedora_Repository', ' ');
// module_load_include( $phpFile, 'fedora_repository', ' ');
require_once(drupal_get_path('module', 'fedora_repository') . '/' . $phpFile);
$thisClass = new $phpClass ();
$returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext);
@ -448,7 +448,7 @@ class CollectionClass {
$phpClass = strip_tags($ingest_form->form_builder_method->class_name->asXML());
$phpMethod = strip_tags($ingest_form->form_builder_method->method_name->asXML());
$dsid = strip_tags($ingest_form['dsid']);
// module_load_include('php', 'Fedora_Repository', $phpFile);
// module_load_include('php', 'fedora_repository', $phpFile);
require_once(drupal_get_path('module', $drupal_module) . '/' . $phpFile);
$thisClass = new $phpClass ();
@ -592,7 +592,7 @@ class CollectionClass {
* @return string
*/
function getIngestInterface() {
module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
$collectionPolicyExists = $this->collectionObject->getMimeType($this->pid, CollectionPolicy::getDefaultDSID());
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) {
if (!empty($collectionPolicyExists)) {

2
CollectionPolicy.inc

@ -392,7 +392,7 @@ class CollectionPolicy extends XMLDatastream {
function getContentModels() {
$ret = FALSE;
if ($this->validate()) {
module_load_include('inc', 'Fedora_Repository', 'ContentModel');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$ret = array();
$content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model');
for ($i = 0; $i < $content_models->length; $i++) {

4
ObjectHelper.inc

@ -598,7 +598,7 @@ class ObjectHelper {
try {
$sxml = new SimpleXMLElement($content_models);
} catch (exception $e) {
watchdog(t("Fedora_Repository"), "Could not find a parent object for %s", $pid, NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Could not find a parent object for %s", $pid, NULL, WATCHDOG_ERROR);
return $pids;
}
@ -692,7 +692,7 @@ class ObjectHelper {
//show the collections datastreams
if ($results->length > 0 || $isCollection == TRUE) {
// if(strlen($objectList)>22||$contentModel=='Collection'||$contentModel=='Community')//length of empty dom still equals 22 because of <table/> etc
module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
$collectionPolicyExists = $this->getMimeType($pid, CollectionPolicy::getDefaultDSID());
if (user_access(ObjectHelper::$INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) {
if (!empty($collectionPolicyExists)) {

10
SearchClass.inc

@ -36,7 +36,7 @@ class SearchClass {
try {
$implementation = new $solrClass();
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), "Error getting solr search results class: !message", array('!message' => $e->getMessage()), NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Error getting solr search results class: !message", array('!message' => $e->getMessage()), NULL, WATCHDOG_ERROR);
return 'Error getting solr search results class. Check watchdog for more info.';
}
return $implementation->$solrFunction($query, $startPage, $fq, $dismax);
@ -253,7 +253,7 @@ class SearchClass {
$objectHelper = new ObjectHelper();
$resultData = do_curl($searchString, 1);
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
$output .= $this->applySpecifiedXSLT($resultData, $path . '/xsl/browseIndexToResultPage.xslt', $displayName);
//$output .= '<br />'.$alpha_out;
@ -367,7 +367,7 @@ class SearchClass {
* @param <type> $query the query that was executed. May want to pass this on.
*/
function applyLuceneXSLT($resultData, $startPage = 1, $xslt_file = '/xsl/results.xsl', $query=NULL) {
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
$test = $xslt_file;
$isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE);
if (!isRestricted && $xslt_file == NULL) {
@ -425,7 +425,7 @@ class SearchClass {
* @return type
*/
function applyXSLT($resultData, $orderBy = 0) {
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
$proc = NULL;
if (!$resultData) {
//drupal_set_message(t('No Results!'));
@ -590,7 +590,7 @@ class SearchClass {
*/
function get_search_terms_array($path = NULL, $file = NULL) {
if (!isset($path)) {
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
}
$xmlDoc = new DomDocument();
if (!isset($file)) {

6
SecurityClass.inc

@ -71,7 +71,7 @@ class SecurityClass {
try {
$xml = new SimpleXMLElement($policyStream);
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), "No roles found in security policy, could not parse policy stream.", NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "No roles found in security policy, could not parse policy stream.", NULL, WATCHDOG_ERROR);
//we may not want to send this to the screen.
drupal_set_message(t('No roles found in security policy, could not parse policy stream: !message', array('!message' => check_plain($e->getMessage()))), 'error');
return NULL;
@ -108,9 +108,9 @@ class SecurityClass {
function createPersonalPolicy($user) {
$doc = new DOMDocument();
try {
$doc->load(drupal_get_path('module', 'Fedora_Repository') . '/policies/noObjectEditPolicy.xml');
$doc->load(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml');
} catch (exception $e) {
watchdog(t("Fedora_Repository"), "Problem loading policy file.", NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Problem loading policy file.", NULL, WATCHDOG_ERROR);
}
$conditions = $doc->getElementsByTagName('Condition');
foreach ($conditions as $condition) {

2
XMLDatastream.inc

@ -227,7 +227,7 @@ abstract class XMLDatastream {
* @return boolean $success
*/
public function saveToFedora() {
module_load_include('inc', 'Fedora_Repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if ($this->validate()) {
$item = new Fedora_Item($this->pid);
$item->modify_datastream_by_value($this->dumpXml(), $this->dsid, $this->name, 'application/xml');

14
fedora_repository.module

@ -634,7 +634,7 @@ function fedora_repository_replace_stream($pid, $dsId, $dsLabel = '', $collectio
* @return type
*/
function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) {
module_load_include('inc', 'Fedora_Repository', 'formClass');
module_load_include('inc', 'fedora_repository', 'formClass');
$replaceDataStreamForm = new formClass();
return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state);
}
@ -659,7 +659,7 @@ function fedora_repository_replace_stream_form_validate($form, &$form_state) {
}
$doc = new DOMDocument();
module_load_include('inc', 'Fedora_Repository', 'MimeClass');
module_load_include('inc', 'fedora_repository', 'MimeClass');
$mime = new MimeClass();
if ($mime->getType($file->filepath) == 'text/xml' && !$doc->load($file->filepath)) {
form_set_error('file', 'Invalid XML format.');
@ -689,7 +689,7 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
$dsLabel = substr($dsLabel, 0, $indexOfDot);
$dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.;
}
module_load_include('inc', 'Fedora_Repository', 'MimeClass');
module_load_include('inc', 'fedora_repository', 'MimeClass');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$file_basename = basename($file->filepath);
@ -2110,19 +2110,19 @@ function theme_add_to_basket_link($pid, $type = 'object') {
$save = "export_big.png";
$saved = "exported_big.png";
// $path = drupal_get_path('module', 'Fedora_Repository').'/images/'.$save ;
// $path = drupal_get_path('module', 'fedora_repository').'/images/'.$save ;
/*
var_dump($path);
var_dump(theme('image',drupal_get_path('module', 'Fedora_Repository').'/images/'.$save));
var_dump(theme('image',drupal_get_path('module', 'fedora_repository').'/images/'.$save));
die();
*/
if (!_is_added_to_basket($pid)) {
return l(
theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), "fedora/repository/addToBasket/" . $path, array('html' => TRUE)
theme('image', drupal_get_path('module', 'fedora_repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), "fedora/repository/addToBasket/" . $path, array('html' => TRUE)
);
}
return theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $saved, t("In basket"), t("This @object is already in your basket", array('@object' => $object)));
return theme('image', drupal_get_path('module', 'fedora_repository') . '/images/' . $saved, t("In basket"), t("This @object is already in your basket", array('@object' => $object)));
}
/**

2
plugins/DarwinCore.inc

@ -247,7 +247,7 @@ class DarwinCore {
* @return type
*/
public function asHTML() {
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'CollectionClass');

2
plugins/FlvFormBuilder.inc

@ -58,7 +58,7 @@ class FlvFormBuilder extends FormBuilder {
$ds1v->appendChild($ds1content);
$rootElement->appendChild($ds1);
$createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/flashThumb.jpg';
$createdFile = drupal_get_path('module', 'fedora_repository') . '/images/flashThumb.jpg';
$fileUrl = $base_url . '/' . drupal_urlencode($createdFile); //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile;
$ds1 = $dom->createElement("foxml:datastream");
$ds1->setAttribute("ID", "TN");

8
plugins/FormBuilder.inc

@ -95,21 +95,21 @@ class FormBuilder {
try {
$xml = new SimpleXMLElement($policyStreamDoc);
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), "Problem getting security policy.", NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Problem getting security policy.", NULL, WATCHDOG_ERROR);
drupal_set_message(t('Problem getting security policy: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
$policyElement = $dom->createDocumentFragment();
if (!$policyElement) {
drupal_set_message(t('Error parsing security policy stream.'));
watchdog(t("Fedora_Repository"), "Error parsing security policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE);
watchdog(t("fedora_repository"), "Error parsing security policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE);
return FALSE;
}
$dom->importNode($policyElement, TRUE);
$value = $policyElement->appendXML($policyStreamDoc);
if (!$value) {
drupal_set_message(t('Error creating security policy stream.'));
watchdog(t("Fedora_Repository"), "Error creating security policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE);
watchdog(t("fedora_repository"), "Error creating security policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE);
return FALSE;
}
@ -183,7 +183,7 @@ class FormBuilder {
file_delete($form_values['ingest-file-location']);
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}

2
plugins/ModsFormBuilder.inc

@ -317,7 +317,7 @@ class ModsFormBuilder extends FormBuilder {
file_delete($form_values['ingest-file-location']);
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}

8
plugins/PersonalCollectionClass.inc

@ -71,11 +71,11 @@ class PersonalCollectionClass {
* @return type
*/
function createCollectionPolicyStream($user, $dom, $rootElement) {
$collectionTemplate = file_get_contents(drupal_get_path('module', 'Fedora_Repository') . '/collection_policies/PERSONAL-COLLECTION-POLICY.xml');
$collectionTemplate = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PERSONAL-COLLECTION-POLICY.xml');
try {
$xml = new SimpleXMLElement($collectionTemplate);
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), "Problem creating personal collection policy, could not parse collection policy stream.", NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Problem creating personal collection policy, could not parse collection policy stream.", NULL, WATCHDOG_ERROR);
drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
@ -83,7 +83,7 @@ class PersonalCollectionClass {
if (!$policyElement) {
drupal_set_message(t('Error parsing policy stream.'));
watchdog(t("Fedora_Repository"), "Error parsing policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE);
watchdog(t("fedora_repository"), "Error parsing policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE);
return FALSE;
}
$dom->importNode($policyElement, TRUE);
@ -91,7 +91,7 @@ class PersonalCollectionClass {
$value = $policyElement->appendXML($collectionTemplate);
if (!$value) {
drupal_set_message(t('Error creating collection policy stream.'));
watchdog(t("Fedora_Repository"), "Error creating collection policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE);
watchdog(t("fedora_repository"), "Error creating collection policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE);
return FALSE;
}

4
plugins/QtFormBuilder.php

@ -18,7 +18,7 @@ class QtFormBuilder extends FormBuilder {
* Constructor
*/
function QtFormBuilder() {
module_load_include('php', 'Fedora_Repository', 'plugins/FormBuilder');
module_load_include('php', 'fedora_repository', 'plugins/FormBuilder');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
@ -57,7 +57,7 @@ class QtFormBuilder extends FormBuilder {
$rootElement->appendChild($ds1);
if (empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_files']['TN'])) {
$createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/qtThumb.jpg';
$createdFile = drupal_get_path('module', 'fedora_repository') . '/images/qtThumb.jpg';
$fileUrl = $base_url . '/' . drupal_urlencode($createdFile); //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile;
$ds1 = $dom->createElement("foxml:datastream");
$ds1->setAttribute("ID", "TN");

6
plugins/Refworks.inc

@ -290,13 +290,13 @@ class Refworks {
if ($client == NULL) {
drupal_set_message(t('Error getting SOAP client.'), 'error');
watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: @e", array('@e' => $e), NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), "Error getting SOAP client: @e", array('@e' => $e), NULL, WATCHDOG_ERROR);
return;
}
$object = $client->__soapCall('ingest', array(
$params
));
watchdog(t("FEDORA_REPOSITORY"), "Successfully added repository item " . $pid . " - ". $item_title, NULL, WATCHDOG_INFO);
watchdog(t("fedora_repository"), "Successfully added repository item " . $pid . " - ". $item_title, NULL, WATCHDOG_INFO);
$deleteFiles = $form_values['delete_file']; //remove files from drupal file system
if ($deleteFiles > 0) {
@ -305,7 +305,7 @@ class Refworks {
} catch (exception $e) {
$errors++;
$errorMessage = 'yes';
watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it @e", array('!it' => $item_title, '@e' => $e)), NULL, WATCHDOG_ERROR);
watchdog(t("fedora_repository"), t("Error during ingest !it @e", array('!it' => $item_title, '@e' => $e)), NULL, WATCHDOG_ERROR);
}
$success++;
}

6
plugins/ShowStreamsInFieldSets.inc

@ -28,10 +28,10 @@ class ShowStreamsInFieldSets {
*/
function showFlv() {
//FLV is the datastream id
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
$fullPath = url($path);
$content = "";
$pathTojs = drupal_get_path('module', 'Fedora_Repository') . '/js/swfobject.js';
$pathTojs = drupal_get_path('module', 'fedora_repository') . '/js/swfobject.js';
drupal_add_js("$pathTojs");
$div_id = "player' . $this->pid . 'FLV";
$content .= <<<EOH
@ -231,7 +231,7 @@ EOM
* @return type
*/
function showRomeo($collapsed = FALSE) {
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collectionHelper = new CollectionClass();
$xmlstr = $collectionHelper->getStream($this->pid, "ROMEO", 0);

2
plugins/fedora_imageapi.module

@ -22,7 +22,7 @@ function fedora_imageapi_menu() {
* @param string $params
*/
function fedora_repository_image_manip($pid = '', $dsid = '', $op = '', $params = '') {
module_load_include('inc', 'Fedora_Repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('module', 'imageapi');
$obj = new ObjectHelper();
$mimetype = $obj->getMimeType($pid, $dsid);

2
plugins/qt_viewer.inc

@ -126,7 +126,7 @@ class ShowQtStreamsInFieldSets {
return '';
}
$path = drupal_get_path('module', 'Fedora_Repository');
$path = drupal_get_path('module', 'fedora_repository');
drupal_add_js("$path/js/AC_Quicktime.js");

Loading…
Cancel
Save