Browse Source

Merge branch 'master' of github.com:Islandora/islandora

pull/105/head
root 14 years ago
parent
commit
6b3665cc75
  1. 12
      ObjectHelper.inc
  2. 18
      api/fedora_item.inc
  3. 48
      ilives/book.inc
  4. 8
      ilives/fedora_ilives.module
  5. 409
      ilives/xsl/MODS3-22simpleDC.xsl
  6. 32
      plugins/ModsFormBuilder.inc
  7. 36
      plugins/nmlt/scorm.inc
  8. 112
      workflow_client/islandora_workflow_client.module

12
ObjectHelper.inc

@ -34,11 +34,12 @@ class ObjectHelper {
/** /**
* Grabs a stream from fedora sets the mimetype and returns it. $dsID is the * Grabs a stream from fedora sets the mimetype and returns it. $dsID is the
* datastream id. * datastream id. If $forceSoap is set, the function will always buffer the datastream from fedora. Otherwise, it will
* try and use a redirect if possible.
* @param $pid String * @param $pid String
* @param $dsID String * @param $dsID String
*/ */
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL) { function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = FALSE) {
global $user; global $user;
module_load_include('inc','fedora_repository','ContentModel'); module_load_include('inc','fedora_repository','ContentModel');
if ($pid == NULL || $dsID == NULL) { if ($pid == NULL || $dsID == NULL) {
@ -163,7 +164,12 @@ class ObjectHelper {
header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"');
} }
curl_exec($ch);
if ( (isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) {
curl_exec($ch);
} else {
header('Location: '.$url);
}
} }
curl_close($ch); curl_close($ch);
} else { } else {

18
api/fedora_item.inc

@ -622,6 +622,23 @@ class Fedora_Item {
return self::soap_call('modifyObject', $params, $quiet); return self::soap_call('modifyObject', $params, $quiet);
} }
function modify_datastream_by_reference($external_url, $dsid, $label, $mime_type, $force = FALSE, $logMessage = 'Modified by Islandora API',$quiet=FALSE) {
$params = array(
'pid' => $this->pid,
'dsID' => $dsid,
'altIDs' => NULL,
'dsLabel' => $label,
'MIMEType' => $mime_type,
'formatURI' => NULL,
'dsLocation' => $external_url,
'checksumType' => 'DISABLED',
'checksum' => 'none',
'logMessage' => $logMessage,
'force' => $force
);
return self::soap_call('modifyDatastreamByReference', $params, $quiet);
}
function modify_datastream_by_value($content, $dsid, $label, $mime_type, $force = FALSE, $logMessage = 'Modified by Islandora API',$quiet=FALSE) { function modify_datastream_by_value($content, $dsid, $label, $mime_type, $force = FALSE, $logMessage = 'Modified by Islandora API',$quiet=FALSE) {
$params = array( $params = array(
'pid' => $this->pid, 'pid' => $this->pid,
@ -654,6 +671,7 @@ class Fedora_Item {
case 'getNextPID': case 'getNextPID':
case 'getRelationships': case 'getRelationships':
case 'modifyDatastreamByValue': case 'modifyDatastreamByValue':
case 'modifyDatastreamByReference':
case 'purgeDatastream': case 'purgeDatastream':
case 'purgeObject': case 'purgeObject':
case 'modifyObject': case 'modifyObject':

48
ilives/book.inc

@ -21,6 +21,15 @@ class IslandoraBook {
// Set #cache to true to create the $form_state cache // Set #cache to true to create the $form_state cache
$form['#cache'] = TRUE; $form['#cache'] = TRUE;
// Give the user an option to enter a custom PID
$form['custom_pid'] = array(
'#type' => 'textfield',
'#title' => 'Custom PID',
'#description' => 'If you want to manually specify the PID for the new object, enter it here. '.
'Leave it blank for an automatically-generated PID.',
);
// Prompt the user to enter a record ID to be looked up in Evergreen. // Prompt the user to enter a record ID to be looked up in Evergreen.
$form['unapi_url'] = array( $form['unapi_url'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@ -90,7 +99,7 @@ class IslandoraBook {
return TRUE; return TRUE;
} }
public function handleIngestForm($form_values, $form, &$form_state) { public function handleIngestForm($form_values) {
/* /*
* process the metadata form * process the metadata form
* Create fedora object * Create fedora object
@ -115,16 +124,27 @@ class IslandoraBook {
global $user; global $user;
$mimetype = new MimeClass(); $mimetype = new MimeClass();
$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $title,
$new_item = Fedora_Item::ingest_new_item(!empty($form_values['custom_pid']) ? $form_values['custom_pid'] : $form_values['pid'], 'A', $title,
$user->name); $user->name);
$new_item->add_datastream_from_string($form_values['mods']['mods_record'], 'MODS', $new_item->add_datastream_from_string($form_values['mods']['mods_record'], 'MODS',
'MODS Metadata', 'text/xml', 'X'); 'MODS Metadata', 'text/xml', 'X');
$dc = transform_mods_to_dc($form_values['mods']['mods_record']);
if ($dc) {
// Add the PID to a dc:identifier field.
$dc_doc = simplexml_load_string($dc);
$dc_item = $dc_doc->xpath('/srw_dc:dcCollection/srw_dc:dc[1]');
foreach($dc_item as $node) {
$node->addChild('identifier', $new_item->pid, 'http://purl.org/dc/elements/1.1/');
}
$new_item->modify_datastream_by_value($dc_doc->saveXML(), 'DC', 'Dublin Core XML Metadata', 'text/xml');
}
$new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI); $new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI);
$new_item->add_relationship(!empty($form_values['relationship']) ? $form_values['relationship'] : 'isMemberOfCollection', $form_values['collection_pid']); $new_item->add_relationship(!empty($form_values['relationship']) ? $form_values['relationship'] : 'isMemberOfCollection', $form_values['collection_pid']);
} }
public function buildAddPagesForm($form = array()) { public function buildAddPagesForm($form = array()) {
} }
@ -248,3 +268,25 @@ function ilives_add_single_page_object($book_pid, $page_file, $page_num = 1, $pa
$page_item->add_relationship('isMemberOf', $book_pid); $page_item->add_relationship('isMemberOf', $book_pid);
$page_item->add_datastream_from_file($page_file, 'TIFF', 'Archival TIFF', 'image/tiff', 'M'); $page_item->add_datastream_from_file($page_file, 'TIFF', 'Archival TIFF', 'image/tiff', 'M');
} }
function transform_mods_to_dc($mods) {
$xp = new XsltProcessor();
// create a DOM document and load the XSL stylesheet
$xsl = new DomDocument;
$xsl->load(drupal_get_path('module', 'fedora_ilives').'/xsl/MODS3-22simpleDC.xsl');
// import the XSL styelsheet into the XSLT process
$xp->importStylesheet($xsl);
// create a DOM document and load the XML datat
$xml_doc = new DomDocument;
$xml_doc->loadXML($mods);
// transform the XML into HTML using the XSL file
if ($dc = $xp->transformToXML($xml_doc)) {
return $dc;
}
else {
return FALSE;
}
}

8
ilives/fedora_ilives.module

@ -203,9 +203,11 @@ function fedora_ilives_create_book_view($pid, $query = NULL) {
$simpleDCxml = simplexml_load_string($dc_xml); $simpleDCxml = simplexml_load_string($dc_xml);
$types = $simpleDCxml->xpath('//dc:type'); $types = $simpleDCxml->xpath('//dc:type');
$ingested = 'false'; $ingested = 'false';
foreach ($types as $type) { if (!empty($types)) {
if ($type == 'ingested') { foreach ($types as $type) {
$ingested = 'true'; if ($type == 'ingested') {
$ingested = 'true';
}
} }
} }

409
ilives/xsl/MODS3-22simpleDC.xsl

@ -0,0 +1,409 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mods="http://www.loc.gov/mods/v3" exclude-result-prefixes="mods"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:srw_dc="info:srw/schema/1/dc-schema"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
This stylesheet transforms MODS version 3.2 records and collections of records to simple Dublin Core (DC) records,
based on the Library of Congress' MODS to simple DC mapping <http://www.loc.gov/standards/mods/mods-dcsimple.html>
The stylesheet will transform a collection of MODS 3.2 records into simple Dublin Core (DC)
as expressed by the SRU DC schema <http://www.loc.gov/standards/sru/dc-schema.xsd>
The stylesheet will transform a single MODS 3.2 record into simple Dublin Core (DC)
as expressed by the OAI DC schema <http://www.openarchives.org/OAI/2.0/oai_dc.xsd>
Because MODS is more granular than DC, transforming a given MODS element or subelement to a DC element frequently results in less precise tagging,
and local customizations of the stylesheet may be necessary to achieve desired results.
This stylesheet makes the following decisions in its interpretation of the MODS to simple DC mapping:
When the roleTerm value associated with a name is creator, then name maps to dc:creator
When there is no roleTerm value associated with name, or the roleTerm value associated with name is a value other than creator, then name maps to dc:contributor
Start and end dates are presented as span dates in dc:date and in dc:coverage
When the first subelement in a subject wrapper is topic, subject subelements are strung together in dc:subject with hyphens separating them
Some subject subelements, i.e., geographic, temporal, hierarchicalGeographic, and cartographics, are also parsed into dc:coverage
The subject subelement geographicCode is dropped in the transform
Revision 1.1 2007-05-18 <tmee@loc.gov>
Added modsCollection conversion to DC SRU
Updated introductory documentation
Version 1.0 2007-05-04 Tracy Meehleib <tmee@loc.gov>
-->
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="//mods:modsCollection">
<srw_dc:dcCollection xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/dc-schema.xsd">
<xsl:apply-templates/>
<xsl:for-each select="mods:modsCollection/mods:mods">
<srw_dc:dc xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/dc-schema.xsd">
<xsl:apply-templates/>
</srw_dc:dc>
</xsl:for-each>
</srw_dc:dcCollection>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="mods:mods">
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<xsl:apply-templates/>
</oai_dc:dc>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:titleInfo">
<dc:title>
<xsl:value-of select="mods:nonSort"/>
<xsl:if test="mods:nonSort">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="mods:title"/>
<xsl:if test="mods:subTitle">
<xsl:text>: </xsl:text>
<xsl:value-of select="mods:subTitle"/>
</xsl:if>
<xsl:if test="mods:partNumber">
<xsl:text>. </xsl:text>
<xsl:value-of select="mods:partNumber"/>
</xsl:if>
<xsl:if test="mods:partName">
<xsl:text>. </xsl:text>
<xsl:value-of select="mods:partName"/>
</xsl:if>
</dc:title>
</xsl:template>
<xsl:template match="mods:name">
<xsl:choose>
<xsl:when
test="mods:role/mods:roleTerm[@type='text']='creator' or mods:role/mods:roleTerm[@type='code']='cre' ">
<dc:creator>
<xsl:call-template name="name"/>
</dc:creator>
</xsl:when>
<xsl:otherwise>
<dc:contributor>
<xsl:call-template name="name"/>
</dc:contributor>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:classification">
<dc:subject>
<xsl:value-of select="."/>
</dc:subject>
</xsl:template>
<xsl:template match="mods:subject[mods:topic | mods:name | mods:occupation | mods:geographic | mods:hierarchicalGeographic | mods:cartographics | mods:temporal] ">
<dc:subject>
<xsl:for-each select="mods:topic">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
<xsl:for-each select="mods:occupation">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
<xsl:for-each select="mods:name">
<xsl:call-template name="name"/>
</xsl:for-each>
</dc:subject>
<xsl:for-each select="mods:titleInfo/mods:title">
<dc:subject>
<xsl:value-of select="mods:titleInfo/mods:title"/>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="mods:geographic">
<dc:coverage>
<xsl:value-of select="."/>
</dc:coverage>
</xsl:for-each>
<xsl:for-each select="mods:hierarchicalGeographic">
<dc:coverage>
<xsl:for-each
select="mods:continent|mods:country|mods:provence|mods:region|mods:state|mods:territory|mods:county|mods:city|mods:island|mods:area">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
</dc:coverage>
</xsl:for-each>
<xsl:for-each select="mods:cartographics/*">
<dc:coverage>
<xsl:value-of select="."/>
</dc:coverage>
</xsl:for-each>
<xsl:if test="mods:temporal">
<dc:coverage>
<xsl:for-each select="mods:temporal">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">-</xsl:if>
</xsl:for-each>
</dc:coverage>
</xsl:if>
<xsl:if test="*[1][local-name()='topic'] and *[local-name()!='topic']">
<dc:subject>
<xsl:for-each select="*[local-name()!='cartographics' and local-name()!='geographicCode' and local-name()!='hierarchicalGeographic'] ">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
</dc:subject>
</xsl:if>
</xsl:template>
<xsl:template match="mods:abstract | mods:tableOfContents | mods:note">
<dc:description>
<xsl:value-of select="."/>
</dc:description>
</xsl:template>
<xsl:template match="mods:originInfo">
<xsl:apply-templates select="*[@point='start']"/>
<xsl:for-each
select="mods:dateIssued[@point!='start' and @point!='end'] |mods:dateCreated[@point!='start' and @point!='end'] | mods:dateCaptured[@point!='start' and @point!='end'] | mods:dateOther[@point!='start' and @point!='end']">
<dc:date>
<xsl:value-of select="."/>
</dc:date>
</xsl:for-each>
<xsl:for-each select="mods:publisher">
<dc:publisher>
<xsl:value-of select="."/>
</dc:publisher>
</xsl:for-each>
</xsl:template>
<xsl:template match="mods:dateIssued | mods:dateCreated | mods:dateCaptured">
<dc:date>
<xsl:choose>
<xsl:when test="@point='start'">
<xsl:value-of select="."/>
<xsl:text> - </xsl:text>
</xsl:when>
<xsl:when test="@point='end'">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</dc:date>
</xsl:template>
<xsl:template match="mods:genre">
<xsl:choose>
<xsl:when test="@authority='dct'">
<dc:type>
<xsl:value-of select="."/>
</dc:type>
<xsl:for-each select="mods:typeOfResource">
<dc:type>
<xsl:value-of select="."/>
</dc:type>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<dc:type>
<xsl:value-of select="."/>
</dc:type>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:typeOfResource">
<xsl:if test="@collection='yes'">
<dc:type>Collection</dc:type>
</xsl:if>
<xsl:if test=". ='software' and ../mods:genre='database'">
<dc:type>DataSet</dc:type>
</xsl:if>
<xsl:if test=".='software' and ../mods:genre='online system or service'">
<dc:type>Service</dc:type>
</xsl:if>
<xsl:if test=".='software'">
<dc:type>Software</dc:type>
</xsl:if>
<xsl:if test=".='cartographic material'">
<dc:type>Image</dc:type>
</xsl:if>
<xsl:if test=".='multimedia'">
<dc:type>InteractiveResource</dc:type>
</xsl:if>
<xsl:if test=".='moving image'">
<dc:type>MovingImage</dc:type>
</xsl:if>
<xsl:if test=".='three-dimensional object'">
<dc:type>PhysicalObject</dc:type>
</xsl:if>
<xsl:if test="starts-with(.,'sound recording')">
<dc:type>Sound</dc:type>
</xsl:if>
<xsl:if test=".='still image'">
<dc:type>StillImage</dc:type>
</xsl:if>
<xsl:if test=". ='text'">
<dc:type>Text</dc:type>
</xsl:if>
<xsl:if test=".='notated music'">
<dc:type>Text</dc:type>
</xsl:if>
</xsl:template>
<xsl:template match="mods:physicalDescription">
<xsl:if test="mods:extent">
<dc:format>
<xsl:value-of select="mods:extent"/>
</dc:format>
</xsl:if>
<xsl:if test="mods:form">
<dc:format>
<xsl:value-of select="mods:form"/>
</dc:format>
</xsl:if>
<xsl:if test="mods:internetMediaType">
<dc:format>
<xsl:value-of select="mods:internetMediaType"/>
</dc:format>
</xsl:if>
</xsl:template>
<xsl:template match="mods:mimeType">
<dc:format>
<xsl:value-of select="."/>
</dc:format>
</xsl:template>
<xsl:template match="mods:identifier">
<xsl:variable name="type" select="translate(@type,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<xsl:choose>
<xsl:when test="contains ('isbn issn uri doi lccn uri', $type)">
<dc:identifier>
<xsl:value-of select="$type"/>: <xsl:value-of select="."/>
</dc:identifier>
</xsl:when>
<xsl:otherwise>
<dc:identifier>
<xsl:value-of select="."/>
</dc:identifier>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:location">
<dc:identifier>
<xsl:for-each select="mods:url">
<xsl:value-of select="."/>
</xsl:for-each>
</dc:identifier>
</xsl:template>
<xsl:template match="mods:language">
<dc:language>
<xsl:value-of select="normalize-space(.)"/>
</dc:language>
</xsl:template>
<xsl:template match="mods:relatedItem[mods:titleInfo | mods:name | mods:identifier | mods:location]">
<xsl:choose>
<xsl:when test="@type='original'">
<dc:source>
<xsl:for-each
select="mods:titleInfo/mods:title | mods:identifier | mods:location/mods:url">
<xsl:if test="normalize-space(.)!= ''">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:if>
</xsl:for-each>
</dc:source>
</xsl:when>
<xsl:when test="@type='series'"/>
<xsl:otherwise>
<dc:relation>
<xsl:for-each
select="mods:titleInfo/mods:title | mods:identifier | mods:location/mods:url">
<xsl:if test="normalize-space(.)!= ''">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:if>
</xsl:for-each>
</dc:relation>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:accessCondition">
<dc:rights>
<xsl:value-of select="."/>
</dc:rights>
</xsl:template>
<xsl:template name="name">
<xsl:variable name="name">
<xsl:for-each select="mods:namePart[not(@type)]">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:value-of select="mods:namePart[@type='family']"/>
<xsl:if test="mods:namePart[@type='given']">
<xsl:text>, </xsl:text>
<xsl:value-of select="mods:namePart[@type='given']"/>
</xsl:if>
<xsl:if test="mods:namePart[@type='date']">
<xsl:text>, </xsl:text>
<xsl:value-of select="mods:namePart[@type='date']"/>
<xsl:text/>
</xsl:if>
<xsl:if test="mods:displayForm">
<xsl:text> (</xsl:text>
<xsl:value-of select="mods:displayForm"/>
<xsl:text>) </xsl:text>
</xsl:if>
<xsl:for-each select="mods:role[mods:roleTerm[@type='text']!='creator']">
<xsl:text> (</xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>) </xsl:text>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="normalize-space($name)"/>
</xsl:template>
<xsl:template match="mods:dateIssued[@point='start'] | mods:dateCreated[@point='start'] | mods:dateCaptured[@point='start'] | mods:dateOther[@point='start'] ">
<xsl:variable name="dateName" select="local-name()"/>
<dc:date>
<xsl:value-of select="."/>-<xsl:value-of select="../*[local-name()=$dateName][@point='end']"/>
</dc:date>
</xsl:template>
<xsl:template match="mods:temporal[@point='start'] ">
<xsl:value-of select="."/>-<xsl:value-of select="../mods:temporal[@point='end']"/>
</xsl:template>
<xsl:template match="mods:temporal[@point!='start' and @point!='end'] ">
<xsl:value-of select="."/>
</xsl:template>
<!-- suppress all else:-->
<xsl:template match="*"/>
</xsl:stylesheet>

32
plugins/ModsFormBuilder.inc

@ -385,6 +385,25 @@ class ModsFormBuilder extends FormBuilder {
$mods->appendChild($titleinfo); $mods->appendChild($titleinfo);
} }
if (isset($form_values['mods_alternative_titles']) && trim($form_values['mods_alternative_titles']) != '') {
$titles=preg_split('/\s+\;\s+/',trim($form_values['mods_alternative_titles']));
foreach ($titles as $t) {
$titleinfo = $dom->createElement('mods:titleInfo');
$titleinfo->setAttribute('alternative') ;
$title = $dom->createElement('mods:title',$t);
$titleInfo->appendChild($title);
$mods->appendChild($title);
}
}
if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') {
$titleinfo = $dom->createElement('mods:titleInfo');
$titleinfo->setAttribute('alternative') ;
$title = $dom->createElement('mods:title',trim($form_values['mods_alternative_title']));
$titleInfo->appendChild($title);
$mods->appendChild($title);
}
if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') { if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') {
$abstract = $dom->createElement('mods:abstract', htmlspecialchars(trim($form_values['mods_description']))); $abstract = $dom->createElement('mods:abstract', htmlspecialchars(trim($form_values['mods_description'])));
$mods->appendChild($abstract); $mods->appendChild($abstract);
@ -477,6 +496,12 @@ class ModsFormBuilder extends FormBuilder {
$note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_note']))); $note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_note'])));
$mods->appendChild($note); $mods->appendChild($note);
} }
if (isset($form_values['mods_caption']) && trim($form_values['mods_caption']) != '') {
$note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_caption'])));
$note->setAttribute('type','caption');
$mods->appendChild($note);
}
if (isset($form_values['mods_format']) && trim($form_values['mods_format']) != '') { if (isset($form_values['mods_format']) && trim($form_values['mods_format']) != '') {
$typeOfResource = $dom->createElement('mods:typeOfResource', htmlspecialchars($form_values['mods_format'])); $typeOfResource = $dom->createElement('mods:typeOfResource', htmlspecialchars($form_values['mods_format']));
@ -524,6 +549,13 @@ class ModsFormBuilder extends FormBuilder {
$city = $dom->createElement('mods:city', htmlspecialchars($form_values['mods_city'])); $city = $dom->createElement('mods:city', htmlspecialchars($form_values['mods_city']));
$geographic->appendChild($city); $geographic->appendChild($city);
} }
if (isset($form_values['mods_area']) && trim($form_values['mods_area']) != '') {
$state = $dom->createElement('mods:area', htmlspecialchars($form_values['mods_area']));
$geographic->appendChild($state);
}
$subject->appendChild($geographic); $subject->appendChild($geographic);
} }

36
plugins/nmlt/scorm.inc

@ -99,26 +99,28 @@ class SCORMObject {
//$result = db_query("SELECT * FROM {content_node_field} nf INNER JOIN {content_node_field_instance} ni ON nf.field_name = ni.field_name WHERE nf.type='field_fedora_pid_reference'"); //$result = db_query("SELECT * FROM {content_node_field} nf INNER JOIN {content_node_field_instance} ni ON nf.field_name = ni.field_name WHERE nf.type='field_fedora_pid_reference'");
fedora_pidfield_redirect_to_node($this); fedora_pidfield_redirect_to_node($this);
module_load_include('module', 'SCORM', 'SCORM'); $tabset['my_tabset']['first_tab'] = array(
$dest_array = explode('/', urldecode(drupal_get_destination()));
$nid = $dest_array[count($dest_array) - 1];
$node = node_load($nid);
$tabset = array();
$tabset['my_tabset'] = array(
'#type' => 'tabset',
);
$tabset['my_tabset']['first_tab'] = array(
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => t('Description'), '#title' => t('Description'),
); );
$tabset['my_tabset']['second_tab'] = array( if (module_load_include('module', 'SCORM', 'SCORM')) {
'#type' => 'tabpage', $dest_array = explode('/', urldecode(drupal_get_destination()));
'#title' => t('Results'), $nid = $dest_array[count($dest_array) - 1];
'#content' => scorm_show_results($node), $node = node_load($nid);
);
$tabset = array();
$tabset['my_tabset'] = array(
'#type' => 'tabset',
);
$tabset['my_tabset']['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Results'),
'#content' => scorm_show_results($node),
);
}
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$obj = new ObjectHelper(); $obj = new ObjectHelper();
$tabset['my_tabset']['first_tab']['tabset'] = array( $tabset['my_tabset']['first_tab']['tabset'] = array(

112
workflow_client/islandora_workflow_client.module

@ -16,44 +16,66 @@ function islandora_workflow_client_menu()
function islandora_workflow_client_search_submit($form,&$form_state) function islandora_workflow_client_search_submit($form,&$form_state)
{ {
if (trim($form['collection_pid']['#value']) !== '') $url ='admin/settings/workflow_client/'.$form['process_name']['#value'];
{ if (trim($form['process_id']['#value']) !== '') {
drupal_goto('admin/settings/workflow_client/'.$form['process_name']['#value'].'/'.$form['collection_pid']['#value']); $url.='/'.$form['process_id']['#value'];
} else } else {
{ $url .= '/-/';
drupal_goto('admin/settings/workflow_client/'.$form['process_name']['#value']);
} }
if (trim($form['collection_pid']['#value']) !== '') {
$url.='/'.$form['collection_pid']['#value'];
} else {
$url .= '/-/';
}
drupal_goto($url);
} }
function islandora_workflow_client_search() function islandora_workflow_client_search(&$form_state,$terms=null,$process_id=null,$collection=null)
{ {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$form = array(); $form = array();
$form['process_name'] = array( $form['process_name'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#required'=> TRUE,
'#title' => t('Search by Process Name'), '#title' => t('Search by Process Name'),
'#default_value' => ($terms!=null?$terms:''),
'#description' => t('Returns a list of objects that match the process name(s) entered. Separate multiple names by spaces.'), '#description' => t('Returns a list of objects that match the process name(s) entered. Separate multiple names by spaces.'),
); );
$form['process_id'] = array(
'#type' => 'textfield',
'#title' => t('Search by Process ID'),
'#default_value' => ($process_id!=null?$process_id:''),
'#description' => t('Returns only objects that match the also match the process id entered. '),
);
$form['collection_pid'] = array( $form['collection_pid'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Search by Collection PID'), '#title' => t('Search by Collection PID'),
'#default_value' => ($collection!=null?$collection:''),
'#description' => t('Returns only objects that match the also match the collection pid(s) entered. Separate multiple PIDs by spaces.'), '#description' => t('Returns only objects that match the also match the collection pid(s) entered. Separate multiple PIDs by spaces.'),
); );
$form['submit'] = array('#type' => 'submit', '#value' => t('Search')); $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
return $form; return $form;
} }
function islandora_workflow_client_manage($terms = null, $collection = null, $queue= null, $queueProcess = null) function islandora_workflow_client_manage($terms = null, $process_id= null, $collection = null, $queue= null, $queueProcess = null)
{ {
if ($collection == 'none') if ($collection == 'none' || $collection == '-') {
{
$collection = null; $collection = null;
} }
if ($process_id == 'none' || $process_id == '-') {
$process_id = null;
}
$output = ''; $output = '';
if (trim($terms) != '') if (trim($terms) != '')
@ -143,49 +165,57 @@ function islandora_workflow_client_manage($terms = null, $collection = null, $qu
$errCount = 0; $errCount = 0;
$waitCount =0; $waitCount =0;
$completeCount = 0; $completeCount = 0;
$display = false;
foreach ($pids as $pid) foreach ($pids as $pid)
{ {
if ( isset($workflows[$pid]) && $workflows[$pid] !== false ) if ( isset($workflows[$pid]) && $workflows[$pid] !== false )
{ {
$display = true;
$procs = $workflows[$pid]->getProcesses(); $procs = $workflows[$pid]->getProcesses();
$updated = FALSE; $updated = FALSE;
foreach ($procs as $id=>$n) foreach ($procs as $id=>$n)
{ {
if ($process_id == null || $id == $process_id)
if ($name == $n) {
{ if ($name == $n)
$proc=$workflows[$pid]->getProcess($id); {
if (($queue == 'queue'|| ($queue =='errorQueue' && $proc['state'] == 'error')) && $queueProcess == $n) $proc=$workflows[$pid]->getProcess($id);
{ if (($queue == 'queue'|| ($queue =='errorQueue' && $proc['state'] == 'error')) && $queueProcess == $n)
$workflows[$pid]->setState($id,'waiting'); {
$updated=TRUE; $workflows[$pid]->setState($id,'waiting');
} $updated=TRUE;
}
switch ($proc['state'])
{ switch ($proc['state'])
case 'completed': {
$completeCount++; case 'completed':
break; $completeCount++;
case 'waiting': break;
$waitCount++; case 'waiting':
break; $waitCount++;
case 'error': break;
$errCount++; case 'error':
$errors[]=$proc; $errCount++;
break; $errors[]=$proc;
break;
}
} }
} }
} if ($updated)
if ($updated) {
{ $workflows[$pid]->saveToFedora();
$workflows[$pid]->saveToFedora(); }
} }
} }
} }
$rows[]= array($name, $waitCount,$completeCount,$errCount,l('Add All to Queue','admin/settings/workflow_client/'.$terms.'/'.(trim($collection)==''?'none':$collection).'/queue/'.$name).'<br/>'.l('Add Errors to Queue','admin/settings/workflow_client/'.$terms.'/'.(trim($collection)==''?'none':$collection).'/errorQueue/'.$name)); if ($display) {
$rows[]= array($name, $waitCount,$completeCount,$errCount,
l('Add All to Queue','admin/settings/workflow_client/'.$terms.'/'.(trim($process_id)==''?'none':$process_id).'/'.(trim($collection)==''?'none':$collection).'/queue/'.$name).'<br/>'.
l('Add Errors to Queue','admin/settings/workflow_client/'.$terms.'/'.(trim($process_id)==''?'none':$process_id).'/'.(trim($collection)==''?'none':$collection).'/errorQueue/'.$name));
}
} }
if ($queue == 'queue' || $queue == 'errorQueue') if ($queue == 'queue' || $queue == 'errorQueue')
@ -193,7 +223,7 @@ function islandora_workflow_client_manage($terms = null, $collection = null, $qu
drupal_goto('admin/settings/workflow_client/'.$terms.(trim($collection)==''?'/'.$collection:'')); drupal_goto('admin/settings/workflow_client/'.$terms.(trim($collection)==''?'/'.$collection:''));
} }
$output.='<h3>Search for "'.$terms.'" '.(trim($collection)!=''?'in collection(s) "'.$collection.'" ':'').'returned Processes:</h3>'; $output.='<h3>Search for '.($process_id!=null?'process id '.$process_id.' with terms ':'').' "'.$terms.'" '.(trim($collection)!=''?'in collection(s) "'.$collection.'" ':'').'returned Processes:</h3>';
$output.=theme('table',$headers,$rows); $output.=theme('table',$headers,$rows);
if (count ($errors) > 0) if (count ($errors) > 0)
@ -223,7 +253,7 @@ function islandora_workflow_client_manage($terms = null, $collection = null, $qu
} }
} }
$output .= drupal_get_form('islandora_workflow_client_search'); $output .= drupal_get_form('islandora_workflow_client_search',$form,NULL, $terms, $process_id, $collection);
return $output; return $output;
} }
@ -239,7 +269,7 @@ function islandora_workflow_client_cron()
$queue='/queue/fedora.apim.update'; $queue='/queue/fedora.apim.update';
$con->subscribe($queue); $con->subscribe($queue);
$messagesToSend=array(); $messagesToSend=array();
for ($i=0;$i<50;$i++) { for ($i=0;$i<500;$i++) {
$msg = $con->readFrame(); $msg = $con->readFrame();
if ($msg != null) { if ($msg != null) {

Loading…
Cancel
Save