Browse Source

Added doc tags

pull/4/head
Ben Woodhead 14 years ago
parent
commit
2784a19a16
  1. 24
      plugins/CollectionFormBuilder.inc
  2. 26
      plugins/CreateCollection.inc
  3. 37
      plugins/DarwinCore.inc
  4. 24
      plugins/DemoFormBuilder.inc
  5. 20
      plugins/DocumentConverter.inc
  6. 27
      plugins/Exiftool.inc
  7. 25
      plugins/Ffmpeg.inc
  8. 55
      plugins/Flv.inc
  9. 18
      plugins/FlvFormBuilder.inc
  10. 79
      plugins/FormBuilder.inc
  11. 65
      plugins/ImageManipulation.inc
  12. 155
      plugins/ModsFormBuilder.inc
  13. 64
      plugins/PersonalCollectionClass.inc
  14. 35
      plugins/QtFormBuilder.php
  15. 65
      plugins/Refworks.inc
  16. 22
      plugins/ShowDemoStreamsInFieldSets.inc
  17. 69
      plugins/ShowStreamsInFieldSets.inc
  18. 21
      plugins/fedoraObject.inc
  19. 55
      plugins/herbarium.inc
  20. 21
      plugins/map_viewer.inc
  21. 48
      plugins/qt_viewer.inc
  22. 20
      plugins/slide_viewer.inc
  23. 28
      plugins/tagging_form.inc

24
plugins/CollectionFormBuilder.inc

@ -1,20 +1,35 @@
<?php
// $Id$
/**
* @file
* Collection Form Builder
*/
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/*
* Created on 19-Feb-08
*
*
/**
* implements methods from content model ingest form xml
* builds a dc metadata form
*/
class CollectionFormBuilder extends FormBuilder {
/**
* Constructor
*/
function CollectionFormBuilder() {
module_load_include('inc', 'CollectionFormBuilder', '');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/**
* Create Fedora Datastream
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
global $base_url;
@ -42,4 +57,5 @@ class CollectionFormBuilder extends FormBuilder {
$ds1v->appendChild($ds1content);
$rootElement->appendChild($ds1);
}
}

26
plugins/CreateCollection.inc

@ -1,22 +1,34 @@
<?php
// $Id$
/*
*
*
* This Class implements the methods defined in the STANDARD_IMAGE content model
/**
* @file
* Create Collection Class
*/
/**
* This Class implements the methods defined in the STANDARD_IMAGE content model
*/
class CreateCollection {
function CreateCollection() {
/**
* Constructor
*/
function CreateCollection() {
}
/**
* ingest collection policy ???
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function ingestCollectionPolicy($parameterArray = NULL, $dsid, $file, $file_ext = NULL) {
return TRUE; //nothing needed here as we are not transforming any files
}
}

37
plugins/DarwinCore.inc

@ -2,8 +2,20 @@
// $Id$
/**
* @file
* Darwin Core class
*/
/**
* Darwin Core ???
*/
class DarwinCore {
/**
* Constructor
* @param type $item
*/
function __construct($item = NULL) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if (!empty($item)) {
@ -17,6 +29,11 @@ class DarwinCore {
}
}
/**
* Build Drupal Form
* @param type $form
* @return int
*/
public function buildDrupalForm($form = array()) {
$dwc_xml = $this->darwinCoreXML;
@ -173,6 +190,11 @@ class DarwinCore {
return $form;
}
/**
* Handle Form ??
* @global type $user
* @param type $form_values
*/
public function handleForm($form_values) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
global $user;
@ -208,10 +230,18 @@ class DarwinCore {
$this->darwinCoreXML = $dwc->saveXML();
}
/**
* asXML ??
* @return type
*/
public function asXML() {
return $this->darwinCoreXML;
}
/**
* asHTML ??
* @return type
*/
public function asHTML() {
$path = drupal_get_path('module', 'Fedora_Repository');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
@ -226,8 +256,7 @@ class DarwinCore {
try {
$proc = new XsltProcessor();
}
catch (Exception $e) {
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
return " ";
}
@ -256,9 +285,7 @@ class DarwinCore {
'MachineObservation' => 'MachineObservation',
'NomenclaturalChecklist' => 'NomenclaturalChecklist',
),
);
public $dwcFields = array(
'dc:type',
'dc:language',
@ -283,8 +310,6 @@ class DarwinCore {
'dwc:eventDate',
'dwc:eventTime',
);
public $darwinCoreXML = '
<SimpleDarwinRecordSet xmlns="http://rs.tdwg.org/dwc/xsd/simpledarwincore/" xmlns:dc="http://purl.org/dc/terms/" xmlns:dwc="http://rs.tdwg.org/dwc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd">
<SimpleDarwinRecord>

24
plugins/DemoFormBuilder.inc

@ -1,21 +1,34 @@
<?php
// $Id$
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/*
* Created on 19-Feb-08
*
/**
* @file
*
*/
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/**
* implements methods from content model ingest form xml
* builds a dc metadata form
*/
class DemoFormBuilder extends FormBuilder {
/**
* Constructor
*/
function DemoFormBuilder() {
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
//Override this so we can specify the datastream id of FULL_SIZE should make this easier
/**
* Override this so we can specify the datastream id of FULL_SIZE should make this easier
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
global $base_url;
@ -73,5 +86,6 @@ class DemoFormBuilder extends FormBuilder {
}
}
}
}

20
plugins/DocumentConverter.inc

@ -3,20 +3,35 @@
// $Id$
/**
*
* @file
* Document Converter Class
*/
/**
* This class implements document (doc, odt, pdf, etc.) conversion for a generic
* multi-format document collection.
*/
class DocumentConverter {
private $converter_service_url = "http://localhost:8080/converter/service";
/**
* Constructor
* @param type $converter_url
*/
public function __construct($converter_url = NULL) {
if (!empty($converter_url))
$this->converter_service_url = $converter_url;
}
/**
* Convert ???
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $output_ext
* @return string
*/
function convert($parameterArray = NULL, $dsid, $file, $output_ext) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
@ -69,6 +84,7 @@ class DocumentConverter {
return FALSE;
}
}
}
/*

27
plugins/Exiftool.inc

@ -1,17 +1,24 @@
<?php
// $Id$
/*
*
*
* This Class implements the methods defined in the STANDARD_IMAGE content model
/**
* @file
* Exiftool
*/
/**
* This Class implements the methods defined in the STANDARD_IMAGE content model
*/
class Exiftool {
private $pid = NULL;
private $item = NULL;
/**
* Constructor
* @param type $pid
*/
function __construct($pid) {
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$this->pid = $pid;
@ -19,6 +26,14 @@ class Exiftool {
$this->item = new Fedora_Item($this->pid);
}
/**
* extract metadata ??
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function extractMetadata($parameterArray, $dsid, $file, $file_ext) {
$system = getenv('System');
$file_suffix = '_' . $dsid . '.xml';
@ -30,6 +45,10 @@ class Exiftool {
return TRUE;
}
/**
* display metadata ???
* @return type
*/
function displayMetadata() {
$output = '';
$exif = $this->item->get_datastream_dissemination('EXIF');

25
plugins/Ffmpeg.inc

@ -1,16 +1,34 @@
<?php
// $Id$
/*
*
/**
* @file
* Ffmpeg wrapper class
*/
/**
* FFMpeg wrapper class for generating movie thumbnails
*
* This Class implements the methods defined in the STANDARD_QT content model
*/
class Ffmpeg {
/**
* Default constructor
*/
function Ffmpeg() {
}
/**
* Extract a thumbnail from the movie
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function extract_thumbnail($parameterArray, $dsid, $file, $file_ext) {
$defaults = array('ss' => '00:00:10', 's' => null);
$params = array_merge($defaults, $parameterArray);
@ -32,4 +50,5 @@ class Ffmpeg {
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix;
return TRUE;
}
}

55
plugins/Flv.inc

@ -1,18 +1,31 @@
<?php
// $Id$
/*
* Created on 19-Feb-08
*
*
/**
* @file
* Form Builder class
*/
/**
* implements method from content model ingest form xml
*/
class FormBuilder {
/**
* Constructor
*/
function FormBuilder() {
module_load_include('inc', 'Flv', '');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/**
* Create QDC Stream ???
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createQDCStream($form_values, &$dom, &$rootElement) {
$datastream = $dom->createElement("foxml:datastream");
$datastream->setAttribute("ID", "QDC");
@ -52,8 +65,7 @@ class FormBuilder {
$previousElement = $dom->createElement($key, $value);
$oai->appendChild($previousElement);
}
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
continue;
}
@ -62,6 +74,11 @@ class FormBuilder {
}
}
/**
* Handle QDC Form ???
* @param type $form_values
* @return type
*/
function handleQDCForm($form_values) {
$dom = new DomDocument("1.0", "UTF-8");
$dom->formatOutput = TRUE;
@ -102,13 +119,18 @@ class FormBuilder {
}
unlink($form_values['fullpath']);
}
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
return;
}
}
/**
* Create Fedora DataStream
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
$mimetype = new MimeClass();
@ -161,6 +183,9 @@ class FormBuilder {
/**
* creates the RELS-EXT for the foxml
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createRelationShips($form_values, &$dom, &$rootElement) {
$drdf = $dom->createElement("foxml:datastream");
@ -190,11 +215,13 @@ class FormBuilder {
$rdf->appendChild($rdfdesc);
$rdfdesc->appendChild($member);
$rootElement->appendChild($drdf);
}
/**
* creates the standard foxml properties
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createStandardFedoraStuff($form_values, &$dom, &$rootElement) {
/* foxml object properties section */
@ -222,7 +249,13 @@ class FormBuilder {
$rootElement->appendChild($objproperties);
}
/**
* Build QDC Form
* @param type $form
* @param type $ingest_form_definition
* @param type $form_values
* @return type
*/
function buildQDCForm(&$form, $ingest_form_definition, &$form_values) {
$form['indicator2'] = array(
'#type' => 'fieldset',
@ -253,7 +286,6 @@ class FormBuilder {
'#type' => $type,
'#options' => $options,
);
}
else {
$form['indicator2']["$name"] = array(
@ -269,3 +301,4 @@ class FormBuilder {
}
}

18
plugins/FlvFormBuilder.inc

@ -1,20 +1,33 @@
<?php
// $Id$
/**
* @file
* FLVFormBuilder
*/
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/*
/**
* implements methods from content model ingest form xml
* builds a dc metadata form
*/
class FlvFormBuilder extends FormBuilder {
/**
* Constructor
*/
function FlvFormBuilder() {
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/*
/**
* method overrides method in FormBuilder. We changed the dsid from OBJ to FLV and added the TN datastream
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
@ -60,5 +73,6 @@ class FlvFormBuilder extends FormBuilder {
$ds1v->appendChild($ds1content);
$rootElement->appendChild($ds1);
}
}

79
plugins/FormBuilder.inc

@ -2,19 +2,31 @@
// $Id$
/*
* Created on 19-Feb-08
*
*
/**
* @file
* FormBuilder class
*/
/**
* implements methods from content model ingest form xml
* builds a dc metadata form
*/
class FormBuilder {
/**
* Constructor
*/
function FormBuilder() {
module_load_include('inc', 'FormBuilder', '');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/**
* Create QDC Stream ??
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createQDCStream($form_values, &$dom, &$rootElement) {
$datastream = $dom->createElement("foxml:datastream");
$datastream->setAttribute("ID", "DC");
@ -55,18 +67,22 @@ class FormBuilder {
$previousElement = $dom->createElement($key, $value);
$oai->appendChild($previousElement);
}
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
continue;
}
}
$rootElement->appendChild($datastream);
}
}
//create the security Policy
/**
* Create the security policy
* @param type $collectionPid
* @param type $dom
* @param type $rootElement
* @return type
*/
function createPolicy($collectionPid, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$objectHelper = new ObjectHelper();
@ -78,8 +94,7 @@ class FormBuilder {
}
try {
$xml = new SimpleXMLElement($policyStreamDoc);
}
catch (Exception $e) {
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR);
drupal_set_message(t('Problem getting security policy: !e', array('!e' => $e->getMessage())), 'error');
return FALSE;
@ -114,7 +129,11 @@ class FormBuilder {
return TRUE;
}
/**
* Handle QDC Form ??
* @param type $form_values
* @return type
*/
function handleQDCForm($form_values) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
@ -162,14 +181,20 @@ class FormBuilder {
}
}
file_delete($form_values['ingest-file-location']);
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
watchdog(t("Fedora_Repository"), t("Error ingesting object: !e", array('!e' => $e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}
/**
* Create Fedora Data stream
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
global $base_url;
@ -208,11 +233,8 @@ class FormBuilder {
}
if (!empty($_SESSION['fedora_ingest_files'])) {
foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
if (!empty($file)) {
$found = strstr($createdFile, $file);
if ($found !== FALSE) {
@ -250,9 +272,11 @@ class FormBuilder {
}
}
/**
* Creates the RELS-EXT for the foxml
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createRelationShips($form_values, &$dom, &$rootElement) {
$drdf = $dom->createElement("foxml:datastream");
@ -293,9 +317,11 @@ class FormBuilder {
$rootElement->appendChild($drdf);
}
/**
* Creates the standard foxml properties
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createStandardFedoraStuff($form_values, &$dom, &$rootElement) {
// Foxml object properties section
@ -315,7 +341,13 @@ class FormBuilder {
$rootElement->appendChild($objproperties);
}
/**
* Build QDC Form
* @param type $form
* @param type $elements
* @param type $form_values
* @return string
*/
function buildQDCForm(&$form, $elements, &$form_values) {
$form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time.
$form['indicator2'] = array(
@ -327,7 +359,8 @@ class FormBuilder {
if ($element['type'] == 'markup') {
$el = array('#value' => $element['description']);
} else {
}
else {
$el = array(
'#title' => $element['label'],
'#required' => ($element['required'] ? 1 : 0),
@ -347,9 +380,11 @@ class FormBuilder {
foreach ($element['parameters'] as $key => $val) {
if ($key == '#autocomplete_path') {
$autocomplete_path = $val;
} elseif ($key == '#autocomplete_omit_collection') {
}
elseif ($key == '#autocomplete_omit_collection') {
$autocomplete_omit_collection = TRUE;
} else {
}
else {
$el[$key] = $val;
}
}

65
plugins/ImageManipulation.inc

@ -2,18 +2,31 @@
// $Id$
/*
*
*
* This Class implements the methods defined in the STANDARD_IMAGE content model
/**
* @file
* Image Manipulation class
*/
/**
* This Class implements the methods defined in the STANDARD_IMAGE content model
*/
class ImageManipulation {
/**
* Constructor
*/
function ImageManipulation() {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
}
/**
* Create a preview ??
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return string
*/
function createPreview($parameterArray, $dsid, $file, $file_ext) {
$system = getenv('System');
$file_suffix = '_' . $dsid . '.' . $file_ext;
@ -21,7 +34,8 @@ class ImageManipulation {
if (!isset($parameterArray['height'])) {
$height = $width;
} else {
}
else {
$height = $parameterArray['height'];
}
@ -49,6 +63,14 @@ class ImageManipulation {
}
}
/**
* Create PNG
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return string
*/
function createPNG($parameterArray = NULL, $dsid, $file, $file_ext) {
$file_suffix = '_' . $dsid . '.' . $file_ext;
$returnValue = TRUE;
@ -69,6 +91,14 @@ class ImageManipulation {
}
}
/**
* Create JPEG 2000
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function createJP2($parameterArray = NULL, $dsid, $file, $file_ext) {
$file_suffix = "_$dsid.$file_ext";
$return_value = TRUE;
@ -115,7 +145,14 @@ class ImageManipulation {
}
}
//use imagemapi to manipulate images instead of going directly to imagemagick or whatever
/**
* use imagemapi to manipulate images instead of going directly to imagemagick or whatever
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function manipulateImage($parameterArray = NULL, $dsid, $file, $file_ext) {
$height = $parameterArray['height'];
$width = $parameterArray['width'];
@ -151,6 +188,14 @@ class ImageManipulation {
}
}
/**
* Create Thumbnail from PDF
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return boolean
*/
function createThumbnailFromPDF($parameterArray, $dsid, $file, $file_ext) {
$height = $parameterArray['height'];
$width = $parameterArray['width'];
@ -185,6 +230,14 @@ class ImageManipulation {
}
}
/**
* Create Thumbnail
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return boolean
*/
function createThumbnail($parameterArray, $dsid, $file, $file_ext) {
// var_dump($parameterArray);exit(0);
$file_suffix = '_' . $dsid . '.' . $file_ext;

155
plugins/ModsFormBuilder.inc

@ -2,18 +2,29 @@
// $Id$
/**
* @file
* ModsFormBuilder class
*/
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/**
* ModsFormBuilder class ???
*/
class ModsFormBuilder extends FormBuilder {
static $MODS_NS = 'http://www.loc.gov/mods/v3';
protected $cm;
protected $item;
protected $pid;
function __construct($pid=null)
{
/**
* Constructor
* @param type $pid
*/
function __construct($pid=null) {
parent::__construct();
if ($pid !== null)
{
if ($pid !== null) {
module_load_include('inc', 'fedora_repository', 'ContentModel');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
@ -23,8 +34,13 @@ class ModsFormBuilder extends FormBuilder {
}
}
function handleEditMetadataForm(&$form_id, &$form_values, &$soap_client)
{
/**
* Handle Edit Metadata Form ???
* @param &$form_id
* @param &$form_values
* @param &$soap_client
*/
function handleEditMetadataForm(&$form_id, &$form_values, &$soap_client) {
$dom = new DomDocument("1.0", "UTF-8");
$dom->formatOutput = TRUE;
$mods = $this->modsFromForm($form_values, $dom);
@ -36,8 +52,11 @@ class ModsFormBuilder extends FormBuilder {
drupal_goto('/fedora/repository/' . $this->pid);
}
function buildEditMetadataForm()
{
/**
* Build Edit Metadata Form
* @return array
*/
function buildEditMetadataForm() {
$form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time.
$form['indicator2'] = array(
'#type' => 'fieldset',
@ -92,25 +111,24 @@ class ModsFormBuilder extends FormBuilder {
// echo $nodeList->item(0)->nodeValue.' ';
// echo '<br/>';
if (is_string($nodeList))
{
if (is_string($nodeList)) {
$el['#default_value'] = $nodeList;
} else if ($nodeList->length > 1)
{
}
else if ($nodeList->length > 1) {
$el['#default_value'] = array();
foreach ($nodeList as $node)
{
foreach ($nodeList as $node) {
$el['#default_value'][] = $node->nodeValue;
}
} else if ($nodeList->length > 0)
{
}
else if ($nodeList->length > 0) {
if ($el['#type'] == 'list') {
$values = array();
for ($i = 0; $i < $nodeList->length; $i++) {
$values[] = $nodeList->item($i)->nodeValue;
}
$el['#default_value'] = join('; ', $values);
} else {
}
else {
$el['#default_value'] = $nodeList->item(0)->nodeValue;
}
}
@ -120,11 +138,9 @@ class ModsFormBuilder extends FormBuilder {
if ($key != '#sticky') {
$el[$key] = $val;
}
}
if ($element['type'] == 'people')
{
if ($element['type'] == 'people') {
$names = $xpath->evaluate('/mods:mods/mods:name');
$people = array();
@ -134,20 +150,23 @@ class ModsFormBuilder extends FormBuilder {
$role = $mname->getElementsByTagName('roleTerm')->item(0)->nodeValue;
$nameParts = $mname->getElementsByTagName('namePart');
foreach ($nameParts as $namePart)
{
foreach ($nameParts as $namePart) {
switch ($namePart->getAttribute('type')) {
case 'given': $given = $namePart->nodeValue; break;
case 'family': $family = $namePart->nodeValue; break;
case 'termsOfAddress': $title = $namePart->nodeValue; break;
case 'date': $date = $namePart->nodeValue; break;
default: $name = $namePart->nodeValue; break;
case 'given': $given = $namePart->nodeValue;
break;
case 'family': $family = $namePart->nodeValue;
break;
case 'termsOfAddress': $title = $namePart->nodeValue;
break;
case 'date': $date = $namePart->nodeValue;
break;
default: $name = $namePart->nodeValue;
break;
}
}
$person = array('role' => $role);
switch ($type)
{
switch ($type) {
case 'personal':
if (isset($given) && isset($family) && !isset($name)) {
$name = (isset($title) ? $title . ' ' : '') . $family . ', ' . $family;
@ -172,20 +191,23 @@ class ModsFormBuilder extends FormBuilder {
$type = $mname->getAttribute('type');
$nameParts = $mname->getElementsByTagName('namePart');
foreach ($nameParts as $namePart)
{
foreach ($nameParts as $namePart) {
switch ($namePart->getAttribute('type')) {
case 'given': $given = $namePart->nodeValue; break;
case 'family': $family = $namePart->nodeValue; break;
case 'termsOfAddress': $title = $namePart->nodeValue; break;
case 'date': $date = $namePart->nodeValue; break;
default: $name = $namePart->nodeValue; break;
case 'given': $given = $namePart->nodeValue;
break;
case 'family': $family = $namePart->nodeValue;
break;
case 'termsOfAddress': $title = $namePart->nodeValue;
break;
case 'date': $date = $namePart->nodeValue;
break;
default: $name = $namePart->nodeValue;
break;
}
}
$person = array('subject' => 1);
switch ($type)
{
switch ($type) {
case 'personal':
if (isset($given) && isset($family) && !isset($name)) {
$name = (isset($title) ? $title . ' ' : '') . $family . ', ' . $family;
@ -205,7 +227,6 @@ class ModsFormBuilder extends FormBuilder {
}
$el['#default_value'] = $people;
}
@ -225,12 +246,15 @@ class ModsFormBuilder extends FormBuilder {
);
return $form;
}
}
}
/**
* Handle Mods Form
* @param &$form_values
* @param &$form_state
*/
function handleModsForm(&$form_values, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
@ -291,15 +315,19 @@ class ModsFormBuilder extends FormBuilder {
}
}
file_delete($form_values['ingest-file-location']);
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
watchdog(t("Fedora_Repository"), t("Error ingesting object: !e", array('!e' => $e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}
/**
* Create Collection Policy ??
* @param $form_values
* @param &$dom
* @param &$rootElement
*/
function createCollectionPolicy($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$model = new fedora_item($form_values['content_model_pid']);
@ -329,6 +357,12 @@ class ModsFormBuilder extends FormBuilder {
}
}
/**
* Create Workflow Stream ??
* @param $form_values
* @param &$dom
* @param &$rootElement
*/
function createWorkflowStream($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$model = new fedora_item($form_values['content_model_pid']);
@ -358,6 +392,12 @@ class ModsFormBuilder extends FormBuilder {
}
}
/**
* Create mods Stream ??
* @param $form_values
* @param &$dom
* @param &$rootElement
*/
function createModsStream($form_values, &$dom, &$rootElement) {
$datastream = $dom->createElement("foxml:datastream");
@ -378,9 +418,13 @@ class ModsFormBuilder extends FormBuilder {
$rootElement->appendChild($datastream);
}
function modsFromForm(&$form_values,&$dom)
{
/**
* Mods From From ?????
* @param type $form_values
* @param type $dom
* @return type
*/
function modsFromForm(&$form_values, &$dom) {
///begin writing MODS
$mods = $dom->createElement("mods:mods");
@ -489,7 +533,8 @@ class ModsFormBuilder extends FormBuilder {
}
$originInfo->appendChild($date);
$addOriginInfo = TRUE;
} else {
}
else {
if (isset($form_values['mods_createdDate'])) {
$date = $dom->createElement('mods:createdDate', htmlspecialchars(trim($form_values['mods_createdDate'])));
$originInfo->appendChild($date);
@ -513,7 +558,6 @@ class ModsFormBuilder extends FormBuilder {
$originInfo->appendChild($date);
$addOriginInfo = TRUE;
}
}
if (isset($form_values['mods_pubinfo_journalFreq']) && trim($form_values['mods_pubinfo_journalFreq']) != '') {
@ -550,11 +594,9 @@ class ModsFormBuilder extends FormBuilder {
}
if (isset($form_values['mods_language']) && trim($form_values['mods_language']) != '')
{
if (isset($form_values['mods_language']) && trim($form_values['mods_language']) != '') {
$languageList = explode(';', htmlspecialchars($form_values['mods_language']));
foreach ($languageList as $lang)
{
foreach ($languageList as $lang) {
$language = $dom->createElement('mods:language');
$langTerm = $dom->createElement('mods:languageTerm', htmlspecialchars($lang));
$langTerm->setAttribute('type', 'text');
@ -637,6 +679,7 @@ class ModsFormBuilder extends FormBuilder {
$modifications = trim($form_values['mods_cc']['cc']['cc_modifications']);
$jurisdiction = trim($form_values['mods_cc']['cc']['cc_jurisdiction']);
// Include islandora form elements only if needed ??
module_load_include('inc', 'islandora_form_elements', 'includes/creative_commons.inc');
if (!isset(CreativeCommons::$cc_jurisdiction_vals[$jurisdiction]))
@ -648,8 +691,6 @@ class ModsFormBuilder extends FormBuilder {
$accessCondition = $dom->createElement('mods:accessCondition', htmlspecialchars($license));
$accessCondition->setAttribute('type', 'Creative Commons License');
$mods->appendChild($accessCondition);
}
if (isset($form_values['mods_rights']) && trim($form_values['mods_rights']) != '') {
@ -706,11 +747,11 @@ class ModsFormBuilder extends FormBuilder {
if (isset($val['subject'])) {
$subject->appendChild($name);
$hasSubject = TRUE;
} else {
}
else {
$mods->appendChild($name);
}
}
}
}

64
plugins/PersonalCollectionClass.inc

@ -1,11 +1,31 @@
<?php
// $Id$
/**
* @file
* PersonalCollectionClass class
*/
/**
* Personal Collection Class
*/
class PersonalCollectionClass {
/**
* Constructor
*/
function PersonalCollectionClass() {
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/**
* Create collection
* @param type $theUser
* @param type $pid
* @param type $soapClient
* @return type
*/
function createCollection($theUser, $pid, $soapClient) {
$dom = new DomDocument("1.0", "UTF-8");
$dom->formatOutput = TRUE;
@ -36,21 +56,25 @@ class PersonalCollectionClass {
$object = $soapClient->__soapCall('ingest', array(
$params
));
}
catch (exception $e) {
} catch (exception $e) {
drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => $e->getMessage())), 'error');
return FALSE;
}
return TRUE;
}
/**
* Create Collection Policy Stream ??
* @param type $user
* @param type $dom
* @param type $rootElement
* @return type
*/
function createCollectionPolicyStream($user, $dom, $rootElement) {
$collectionTemplate = file_get_contents(drupal_get_path('module', 'Fedora_Repository') . '/collection_policies/PERSONAL-COLLECTION-POLICY.xml');
try {
$xml = new SimpleXMLElement($collectionTemplate);
}
catch (Exception $e) {
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("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' => $e->getMessage())), 'error');
return FALSE;
@ -88,6 +112,13 @@ class PersonalCollectionClass {
return TRUE;
}
/**
* Create Policy Stream ??
* @param type $user
* @param type $dom
* @param type $rootElement
* @return type
*/
function createPolicyStream($user, $dom, $rootElement) {
module_load_include('inc', 'fedora_repository', 'SecurityClass');
@ -114,8 +145,14 @@ class PersonalCollectionClass {
return $this->createChildPolicyStream($dom, $rootElement, $policyStream->cloneNode(TRUE));
}
//right now this is the same as the policy stream for this object, may change
//objects in this collection will reference this datastream as their own POLICY stream
/**
* right now this is the same as the policy stream for this object, may change
* objects in this collection will reference this datastream as their own POLICY stream ???
* @param type $dom
* @param type $rootElement
* @param type $policyStream
* @return type
*/
function createChildPolicyStream($dom, $rootElement, $policyStream) {
$ds1 = $dom->createElement("foxml:datastream");
@ -135,6 +172,12 @@ class PersonalCollectionClass {
return TRUE;
}
/**
* Create standard fedora stuff ??????????????????
* @param type $user
* @param type $dom
* @param type $rootElement
*/
function createStandardFedoraStuff($user, & $dom, & $rootElement) {
/* foxml object properties section */
$objproperties = $dom->createElement("foxml:objectProperties");
@ -161,6 +204,13 @@ class PersonalCollectionClass {
$rootElement->appendChild($objproperties);
}
/**
* Create DC Stream ???
* @global type $user
* @param type $theUser
* @param type $dom
* @param type $rootElement
*/
function createDCStream($theUser, & $dom, & $rootElement) {
global $user;
$datastream = $dom->createElement("foxml:datastream");

35
plugins/QtFormBuilder.php

@ -1,21 +1,33 @@
<?php
// $Id$
/**
* @file
* QTFormBuilder class
*/
module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder');
/*
*
*
*
* implements methods from content model ingest form xml
/**
* Implements methods from content model ingest form xml
* builds a dc metadata form
*/
class QtFormBuilder extends FormBuilder {
/**
* Constructor
*/
function QtFormBuilder() {
module_load_include('php', 'Fedora_Repository', 'plugins/FormBuilder');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
/*
/**
* method overrides method in FormBuilder. We changed the dsid from OBJ to OBJ and added the TN datastream
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement) {
module_load_include('inc', 'fedora_repository', 'MimeClass');
@ -65,8 +77,6 @@ if(empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_fi
if (!empty($_SESSION['fedora_ingest_files'])) {
foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
$createdFile = strstr($createdFile, $file);
$dformat = $mimetype->getType($createdFile);
@ -91,12 +101,7 @@ if(empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_fi
$rootElement->appendChild($ds1);
}
}
}
}
?>

65
plugins/Refworks.inc

@ -1,6 +1,11 @@
<?php
// $Id$
/**
* @file
* Refworks class
*/
/*
* Created on 26-Feb-08
*
@ -9,17 +14,31 @@
*/
module_load_include('inc', 'fedora_repository', 'SecurityClass');
/**
* Refworks class ???
*/
class Refworks {
private $romeoUrlString = "";
private $referenceList;
private $securityHelper;
private $collectionPolicyStream;
private $issn = '';
/**
* Constructor
*/
function Refworks() {
$this->romeoUrlString = "http://www.sherpa.ac.uk/romeo/api24.php?issn=";
}
/**
* Build Form ??
* @param type $form
* @param type $ingest_form_definition
* @param type $form_values
* @return type
*/
function buildForm(&$form, $ingest_form_definition, &$form_values) {
$form['indicator2'] = array(
'#type' => 'fieldset',
@ -68,8 +87,7 @@ class Refworks {
//$xml=simplexml_load_string(trim(file_get_contents($file),NULL,TRUE));
//$dom = dom_import_simplexml($xml);//test to see if it behaves better
//$xml = new SimpleXMLElement(trim(file_get_contents($file)));
}
catch (Exception $e) {
} catch (Exception $e) {
drupal_set_message(t('Error processing Refworks file: ') . $e->getMessage());
return FALSE;
}
@ -81,7 +99,13 @@ class Refworks {
return $this->referenceList;
}
//create A DC stream with ID of DC
/**
* Create a DC stream with ID of DC ???
* @param type $dom
* @param type $rootElement
* @param type $reference
* @return type
*/
function createQDCStream(&$dom, &$rootElement, $reference) {
$datastream = $dom->createElement("foxml:datastream");
$datastream->setAttribute("ID", "DC");
@ -196,6 +220,11 @@ class Refworks {
return $datastream;
}
/**
* Handle Form ??
* @param type $form_values
* @return type
*/
function handleForm(&$form_values) {
$errorMessage = NULL;
module_load_include('inc', 'fedora_repository', 'CollectionClass');
@ -278,8 +307,7 @@ class Refworks {
if ($deleteFiles > 0) {
unlink($form_values['fullpath']);
}
}
catch (exception $e) {
} 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);
@ -290,12 +318,15 @@ class Refworks {
drupal_set_message(t('Error ingesting one or more records! Check Drupal watchdog logs for more info'), 'error');
}
$endTime = time();
drupal_set_message(t('Successfull ingest of %success records. %errors records failed. Ingest took %seconds seconds',
array('%success' => $success-$errors, '%errors' => $errors, '%seconds' => $endTime-$startTime)) , 'info');
drupal_set_message(t('Successfull ingest of %success records. %errors records failed. Ingest took %seconds seconds', array('%success' => $success - $errors, '%errors' => $errors, '%seconds' => $endTime - $startTime)), 'info');
}
/**
* Creates the RELS-EXT for the foxml
* @param type $form_values
* @param type $dom
* @param type $rootElement
* @param type $pid
*/
function createRelationShips($form_values, &$dom, &$rootElement, $pid = NULL) {
$drdf = $dom->createElement("foxml:datastream");
@ -326,9 +357,13 @@ class Refworks {
$rdfdesc->appendChild($member);
$rdfdesc->appendChild($model);
$rootElement->appendChild($drdf);
}
/**
* Create Romeo Datastream
* @param type $dom
* @param type $rootElement
*/
function createRomeoDataStream(&$dom, &$rootElement) {
$ds1 = $dom->createElement("foxml:datastream");
$ds1->setAttribute("ID", "ROMEO");
@ -348,6 +383,14 @@ class Refworks {
$rootElement->appendChild($ds1);
}
/**
* Create Fedora Datastream
* @global type $base_url
* @param type $form_values
* @param type $dom
* @param type $rootElement
* @param type $reference
*/
function createFedoraDataStreams($form_values, &$dom, &$rootElement, $reference) {
global $base_url;
module_load_include('inc', 'fedora_repository', 'MimeClass');
@ -374,6 +417,10 @@ class Refworks {
/**
* Creates the standard foxml properties
* @param type $form_values
* @param type $dom
* @param type $rootElement
* @param type $reference
*/
function createStandardFedoraStuff($form_values, &$dom, &$rootElement, $reference) {
// Foxml object properties section
@ -397,7 +444,6 @@ class Refworks {
$rootElement->appendChild($objproperties);
}
/**
* Read the list of Users from the U1 field and Roles from the U2 field and add elements
* to the security policy record for this item, then add the record as the security policy datastream.
@ -446,4 +492,5 @@ class Refworks {
$rootElement->appendChild($ds1);
$ds1content->appendChild($dom->importNode(dom_import_simplexml($custom_policy_sxe), TRUE));
}
}

22
plugins/ShowDemoStreamsInFieldSets.inc

@ -1,18 +1,32 @@
<?php
// $Id$
/*
* Created on 17-Apr-08
*
*
/**
* @file
* ShowDemoStreamsInFieldSets class
*/
/**
* Show Demo Streams in Field Sets ???
*/
class ShowDemoStreamsInFieldSets {
private $pid = NULL;
/**
* Constructor
* @param type $pid
*/
function ShowDemoStreamsInFieldSets($pid) {
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$this->pid = $pid;
}
/**
* Show Medium Size ??
* @global type $base_url
* @return type
*/
function showMediumSize() {
global $base_url;
$collection_fieldset = array(

69
plugins/ShowStreamsInFieldSets.inc

@ -1,15 +1,31 @@
<?php
// $Id$
/*
* Created on 17-Apr-08
/**
* @file
* ShowStreamsInFieldSets class
*/
/**
* Show Streams In Field Sets ??
*/
class ShowStreamsInFieldSets {
private $pid = NULL;
/**
* Constructor
* @param type $pid
*/
function ShowStreamsInFieldSets($pid) {
$this->pid = $pid;
}
/**
* Show the FLV ??
* @return type
*/
function showFlv() {
//FLV is the datastream id
$path = drupal_get_path('module', 'Fedora_Repository');
@ -30,6 +46,11 @@ class ShowStreamsInFieldSets {
return theme('fieldset', $collection_fieldset);
}
/**
* Show the TN ??
* @global type $base_url
* @return type
*/
function showTN() {
global $base_url;
$collection_fieldset = array(
@ -41,8 +62,11 @@ class ShowStreamsInFieldSets {
return theme('fieldset', $collection_fieldset);
}
// Same as showTN but artinventory stores the image in a dsid of IMAGE instead of OBJ
/**
* Same as showTN but artinventory stores the image in a dsid of IMAGE instead of OBJ
* @global type $base_url
* @return type
*/
function showArtInventoryTN() {
global $base_url;
$collection_fieldset = array(
@ -54,6 +78,10 @@ class ShowStreamsInFieldSets {
/**
* Embed Google Docs' PDF viewer into the page.
* @global type $base_url
* @global type $base_path
* @global type $user
* @return type
*/
function showPDFPreview() {
global $base_url;
@ -109,7 +137,10 @@ class ShowStreamsInFieldSets {
return $tabset;
}
/**
* Show QDC ??
* @return type
*/
function showQdc() {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$objectHelper = new ObjectHelper();
@ -123,6 +154,11 @@ class ShowStreamsInFieldSets {
return theme('fieldset', $collection_fieldset);
}
/**
* Show Object Link ??
* @global type $base_url
* @return type
*/
function showOBJLink() {
global $base_url;
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
@ -131,8 +167,10 @@ class ShowStreamsInFieldSets {
return "<a href='" . $base_url . "/fedora/repository/" . $this->pid . "/OBJ/" . $streams['OBJ']['label'] . "'>" . $streams['OBJ']['label'] . "</a>";
}
/**
* Show REF works ??
* @return type
*/
function showRefworks() {
$path = drupal_get_path('module', 'fedora_repository');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
@ -144,8 +182,7 @@ class ShowStreamsInFieldSets {
}
try {
$proc = new XsltProcessor();
}
catch (Exception $e) {
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
return " ";
}
@ -165,6 +202,11 @@ class ShowStreamsInFieldSets {
return theme('fieldset', $collection_fieldset);
}
/**
* Show JP2000
* @param type $collapsed
* @return type
*/
function showJP2($collapsed = FALSE) {
$viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer';
$html = '<iframe src="' . $viewer_url . '" frameborder="0" style="width: 100%; height: 400px;">Errors: unable to load viewer</iframe>';
@ -177,6 +219,11 @@ class ShowStreamsInFieldSets {
return theme('fieldset', $fieldset);
}
/**
* Show Romeo ??
* @param type $collapsed
* @return type
*/
function showRomeo($collapsed = FALSE) {
$path = drupal_get_path('module', 'Fedora_Repository');
module_load_include('inc', 'fedora_repository', 'CollectionClass');
@ -189,8 +236,7 @@ class ShowStreamsInFieldSets {
try {
$proc = new XsltProcessor();
}
catch (Exception $e) {
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
return;
}
@ -210,4 +256,5 @@ class ShowStreamsInFieldSets {
);
return theme('fieldset', $collection_fieldset);
}
}

21
plugins/fedoraObject.inc

@ -1,6 +1,21 @@
<?php
// $Id$
/**
* @file
* FedoraObject class
*/
/**
* Fedora Object class ??
*/
class FedoraObject {
/**
* Constructor
* @param type $pid
*/
function __construct($pid = '') {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if (!empty($pid)) {
@ -10,6 +25,11 @@ class FedoraObject {
}
}
/**
* Show Field Sets
* @global type $user
* @return type
*/
public function showFieldSets() {
global $user;
$objectHelper = new ObjectHelper();
@ -49,4 +69,5 @@ class FedoraObject {
return $tabset;
}
}

55
plugins/herbarium.inc

@ -2,7 +2,16 @@
// $Id$
/**
* @file
* Herbarium class
*/
/**
* Herbarium ???
*/
class Herbarium {
function __construct($pid = '') {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if (!empty($pid)) {
@ -11,6 +20,12 @@ class Herbarium {
}
}
/**
* Build a drupal form ??
* @param type $form
* @param type $form_state
* @return type
*/
public function buildDrupalForm($form = array(), $form_state = array()) {
// We don't need to add anything beyond the standard Darwin Core form so just pass this through
// If we wanted to we could add other fields.
@ -20,6 +35,11 @@ class Herbarium {
return $dwc->buildDrupalForm($form);
}
/**
* Build edit metadata form
* @param type $form
* @return type
*/
public function buildEditMetadataForm($form = array()) {
$form['submit'] = array(
'#type' => 'submit',
@ -38,6 +58,13 @@ class Herbarium {
return $this->buildDrupalForm($form);
}
/**
* handle edit metadata form ??
* @global type $user
* @param type $form_id
* @param type $form_values
* @return type
*/
public function handleEditMetadataForm($form_id, $form_values) {
/*
* Process the metadata form
@ -51,11 +78,15 @@ class Herbarium {
$dwc = new DarwinCore($this->item);
$dwc->handleForm($form_values);
$this->item->purge_datastream('DARWIN_CORE');
$this->item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE',
'Darwin Core Metadata', 'text/xml', 'X');
$this->item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE', 'Darwin Core Metadata', 'text/xml', 'X');
return TRUE;
}
/**
* Handle Ingest Form
* @global type $user
* @param type $form_values
*/
public function handleIngestForm($form_values) {
/*
* process the metadata form
@ -73,17 +104,14 @@ class Herbarium {
. $form_values['dwc:collectionCode'] . ':'
. $form_values['dwc:catalogNumber'];
$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $label,
$user->name);
$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $label, $user->name);
$new_item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE',
'Darwin Core Metadata', 'text/xml', 'X');
$new_item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE', 'Darwin Core Metadata', 'text/xml', 'X');
$file = $form_values['ingest-file-location'];
if (!empty($file)) {
$dformat = $mimetype->getType($file);
$new_item->add_datastream_from_file($file, 'FULL_SIZE',
"$label-full-size", $dformat, 'M');
$new_item->add_datastream_from_file($file, 'FULL_SIZE', "$label-full-size", $dformat, 'M');
}
$new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI);
@ -93,13 +121,17 @@ class Herbarium {
foreach ($_SESSION['fedora_ingest_files'] as $dsid => $created_file) {
$created_file_format = $mimetype->getType($created_file);
$created_filename = strstr($created_file, $file);
$new_item->add_datastream_from_file($created_file, $dsid,
$created_filename, $created_file_format, 'M');
$new_item->add_datastream_from_file($created_file, $dsid, $created_filename, $created_file_format, 'M');
}
}
}
/**
* Show Field Sets
* @global type $base_url
* @global type $user
* @return string
*/
public function showFieldSets() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore');
@ -168,4 +200,5 @@ class Herbarium {
}
return $tabset;
}
}

21
plugins/map_viewer.inc

@ -1,13 +1,33 @@
<?php
// $Id$
/**
* @file
* ShowMapStreamsInFieldSets class
*/
/**
* Show Map Streams in Field Sets Class ??
*/
class ShowMapStreamsInFieldSets {
private $pid = NULL;
/**
* Constructor
* @param type $pid
*/
function ShowMapStreamsInFieldSets($pid) {
$this->pid = $pid;
}
/**
* Show JPEG
* @global type $base_url
* @global type $user
* @return type
*/
function showJPG() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
@ -51,4 +71,5 @@ class ShowMapStreamsInFieldSets {
// Render the tabset.
return tabs_render($tabset);
}
}

48
plugins/qt_viewer.inc

@ -1,17 +1,41 @@
<?php
// $Id$
/**
* @file
* ShowQTStreamsInFieldSets class
*/
/**
* Show QT Stream in Field Sets
*/
class ShowQtStreamsInFieldSets {
private $pid = NULL;
/**
* Constructor
* @param type $pid
*/
function ShowQtStreamsInFieldSets($pid) {
$this->pid = $pid;
}
/**
* Returna a new Fedora Object with the QT movie ???
* @return fedora_item
*/
function fedoraObject() {
return new fedora_item($this->pid);
}
/**
* Tecnical metadata ??
* @param type $defaults
* @param type $dsid
* @return type
*/
function technicalMetadata($defaults = array(), $dsid = 'OBJ_EXIFTOOL') {
$data = $defaults;
@ -26,7 +50,8 @@ class ShowQtStreamsInFieldSets {
if (strpos($mime, 'audio/') !== false) {
$data['width'] = 300;
$data['height'] = 0;
} else {
}
else {
$size = reset($doc->xpath('//Composite:ImageSize/text()'));
list($width, $height) = explode('x', $size);
$data['width'] = $width;
@ -41,6 +66,11 @@ class ShowQtStreamsInFieldSets {
return $data;
}
/**
* Get Poster Frame Datastream Information ??
* @param type $dsid
* @return type
*/
function getPosterFrameDatastreamInfo($dsid = 'FULL_SIZE') {
$p = ObjectHelper::getDatastreamInfo($this->pid, $dsid);
if (empty($p) || $p == ' ' || $p === false) {
@ -49,6 +79,12 @@ class ShowQtStreamsInFieldSets {
return $p;
}
/**
* Get Media Datastream Information ??
* @param type $dsid
* @param type $alt
* @return type
*/
function getMediaDatastreamInfo($dsid = 'OBJ', $alt = array('')) {
$p = ObjectHelper::getDatastreamInfo($this->pid, $dsid);
if (empty($p) || $p == ' ' || $p === false) {
@ -62,10 +98,19 @@ class ShowQtStreamsInFieldSets {
return $p;
}
/**
* Is download enabled. It always returns false. ???
* @return FALSE
*/
function enableDownload() {
return false;
}
/**
* Show the QT ???
* @global type $base_url
* @return type
*/
function showQt() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
@ -135,4 +180,5 @@ EOD;
'#value' => $content);
return theme('fieldset', $collection_fieldset);
}
}

20
plugins/slide_viewer.inc

@ -1,15 +1,34 @@
<?php
// $Id$
/**
* @file
* ShowSlideStreamsInFieldSets class
*/
/**
* ShowSlideStreamInFieldSets ??????
*/
class ShowSlideStreamsInFieldSets {
private $pid = NULL;
/**
* Contructor
* @param type $pid
*/
function ShowSlideStreamsInFieldSets($pid) {
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$this->pid = $pid;
}
/**
* Show JPEG
* @global type $base_url
* @global type $user
* @return type
*/
function showJPG() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
@ -44,4 +63,5 @@ class ShowSlideStreamsInFieldSets {
return $tabset;
}
}

28
plugins/tagging_form.inc

@ -1,11 +1,21 @@
<?php
// $Id$
/**
* @file
* Tagging Form???
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Show subject tags ???
* @param type $pid
* @return string
*/
function _show_subject_tags($pid) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/dublin_core');
@ -22,6 +32,13 @@ function _show_subject_tags($pid) {
return $output;
}
/**
* Fedora repository image tagging form ????
* @global type $base_url
* @param type $form_state
* @param type $pid
* @return type
*/
function fedora_repository_image_tagging_form($form_state, $pid) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/dublin_core');
@ -88,6 +105,11 @@ function fedora_repository_image_tagging_form($form_state, $pid) {
return $form;
}
/**
* Hook image button process ???
* @param type $form
* @return string
*/
function hook_imagebutton_process($form) {
$form['op_x'] = array(
'#name' => $form['#name'] . '_x',
@ -98,6 +120,12 @@ function hook_imagebutton_process($form) {
return $form;
}
/**
* Fedora repository image tagging from submit ???
* @global type $user
* @param type $form
* @param type $form_state
*/
function fedora_repository_image_tagging_form_submit($form, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/tagging');

Loading…
Cancel
Save