Browse Source

Merge remote branch 'upstream/master'

pull/105/head
Zachary Howarth 14 years ago
parent
commit
80ee1465d4
  1. 18
      api/fedora_item.inc
  2. 204
      form_elements/islandora_form_elements.module
  3. 40
      ilives/book.inc
  4. 2
      ilives/fedora_ilives.module
  5. 409
      ilives/xsl/MODS3-22simpleDC.xsl
  6. 10
      plugins/ImageManipulation.inc
  7. 14
      plugins/nmlt/scorm.inc
  8. 2
      workflow_client/plugins/image_resize.inc

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':

204
form_elements/islandora_form_elements.module

@ -25,6 +25,12 @@ function islandora_form_elements_elements() {
'#process' => array('ife_sticky_textarea_process'), '#process' => array('ife_sticky_textarea_process'),
); );
$type['select'] = array(
'#input'=> TRUE,
'#sticky ' => FALSE,
'#process' => array('ife_sticky_select_process'),
);
$type['list'] = array( $type['list'] = array(
'#input'=>TRUE, '#input'=>TRUE,
'#element_validate' => array('ife_list_validate'), '#element_validate' => array('ife_list_validate'),
@ -57,19 +63,19 @@ function islandora_form_elements_elements() {
$type['person'] = array( $type['person'] = array(
'#input' => TRUE, '#input' => TRUE,
'#process' => array('ife_person_process'), '#process' => array('ife_person_process'),
'#default_value' => array('fname'=>'', 'lname' => '', 'title' => '', 'role' => ''), '#default_value' => array('name'=>'', 'date'=>'', 'subject'=>'', 'role' => ''),
); );
$type['organization'] = array( $type['organization'] = array(
'#input' => TRUE, '#input' => TRUE,
'#process' => array('ife_org_process'), '#process' => array('ife_org_process'),
'#default_value' => array( 'organization' => '', 'conference' => ''), '#default_value' => array( 'organization' => '', 'date'=>'', 'subject'=>'', 'role' => ''),
); );
$type['conference'] = array( $type['conference'] = array(
'#input' => TRUE, '#input' => TRUE,
'#process' => array('ife_conf_process'), '#process' => array('ife_conf_process'),
'#default_value' => array( 'conference' => ''), '#default_value' => array( 'conference' => '', 'date'=>'', 'subject'=>'', 'role' => ''),
); );
$type['people'] = array( $type['people'] = array(
@ -79,6 +85,7 @@ function islandora_form_elements_elements() {
$type['datepicker'] = array( $type['datepicker'] = array(
'#input' => TRUE, '#input' => TRUE,
'#process' => array('ife_datepicker_process'),
); );
return $type; return $type;
@ -140,7 +147,7 @@ function ife_people_process($element,$edit,&$form_state)
$people= array(); $people= array();
if (isset($form_state['storage']['people']) && !empty($form_state['storage']['people'])) { if (isset($form_state['storage']['people']) && !empty($form_state['storage']['people'])) {
foreach ($form_state['storage']['people'] as $ent) { foreach ($form_state['storage']['people'] as $ent) {
if ( trim($ent['fname']) != '' || trim($ent['lname']) != '' || trim($ent['organization']) != '' || trim($ent['title']) != '' || trim($ent['conference']) != '' || trim($ent['role']) != '' || trim($ent['date']) != '') { if ( trim($ent['name']) != '' || trim($ent['organization']) != '' || trim($ent['conference']) != '' || trim($ent['role']) != '' || trim($ent['date']) != '') {
$people[]=$ent; $people[]=$ent;
} }
} }
@ -154,20 +161,21 @@ function ife_people_process($element,$edit,&$form_state)
switch ($json->type) switch ($json->type)
{ {
case 'personal': case 'personal':
$person['fname']=$json->given; $person['name']=$json->name;
$person['lname']=$json->family;
$person['title']=$json->title;
$person['role']=$json->role; $person['role']=$json->role;
$person['subject']=$json->subject;
$person['date']=$json->date; $person['date']=$json->date;
break; break;
case 'organization': case 'organization':
$person['organization'] = $json->name; $person['organization'] = $json->name;
$person['role'] = $json->role; $person['role'] = $json->role;
$person['subject']=$json->subject;
break; break;
case 'conference': case 'conference':
$person['conference'] = $json->name; $person['conference'] = $json->name;
$person['role'] = $json->role; $person['role'] = $json->role;
$person['date'] = $json->date; $person['date'] = $json->date;
$person['subject']=$json->subject;
break; break;
} }
@ -185,7 +193,7 @@ function ife_people_process($element,$edit,&$form_state)
} }
} else { } else {
$form_state['storage']['people']=array( array('fname'=>'','lname'=>'', 'title'=>'', 'role'=>'', 'date'=>'')); $form_state['storage']['people']=array( array('name'=>'', 'role'=>'', 'date'=>'', 'subject' => ''));
} }
} }
@ -273,30 +281,18 @@ function ife_person_process($element)
if (!isset($element['#value'])) if (!isset($element['#value']))
{ {
$element['#value'] = array('fname'=>'', 'lname' => ''); $element['#value'] = array('name'=>'');
} }
$element['fname'] = array( $element['name'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title'=> t('Given Name(s)'), '#title'=> t('Name(s)'),
'#size' => 30, '#size' => 30,
'#value' => $element['#value']['fname'], '#value' => $element['#value']['name'],
'#description' => t('Please enter last name first, followed by a comma and first name.'),
); );
$element['lname'] = array(
'#type' => 'textfield',
'#title' => t('Family Name(s)'),
'#size' => 30,
'#value' => $element['#value']['lname'],
);
$element['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#size' => 30,
'#value' => $element['#value']['title'],
);
$element['date'] = array( $element['date'] = array(
'#type' => 'datepicker', '#type' => 'datepicker',
@ -314,6 +310,14 @@ function ife_person_process($element)
'#autocomplete_path' => 'autocomplete_marcrelator/', '#autocomplete_path' => 'autocomplete_marcrelator/',
); );
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this person will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['remove'] = array( $element['remove'] = array(
'#type' => 'submit', '#type' => 'submit',
@ -339,7 +343,7 @@ function ife_org_process($element)
if (!isset($element['#value'])) if (!isset($element['#value']))
{ {
$element['#value'] = array('fname'=>'', 'lname' => ''); $element['#value'] = array('name'=>'');
} }
@ -352,6 +356,14 @@ function ife_org_process($element)
'#autocomplete_path' => 'autocomplete_marcrelator/', '#autocomplete_path' => 'autocomplete_marcrelator/',
); );
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this organization will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['organization'] = array( $element['organization'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Organization'), '#title' => t('Organization'),
@ -384,7 +396,7 @@ function ife_conf_process($element)
if (!isset($element['#value'])) if (!isset($element['#value']))
{ {
$element['#value'] = array('fname'=>'', 'lname' => ''); $element['#value'] = array('name'=>'');
} }
@ -396,6 +408,13 @@ function ife_conf_process($element)
'#autocomplete_path' => 'autocomplete_marcrelator/', '#autocomplete_path' => 'autocomplete_marcrelator/',
); );
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this conference will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['conference'] = array( $element['conference'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@ -454,6 +473,30 @@ function ife_sticky_textfield_process($element,$edit,&$form_state)
return $element; return $element;
} }
/**
* Our process callback to expand the control.
*/
function ife_datepicker_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/** /**
@ -481,6 +524,32 @@ function ife_sticky_textarea_process($element,$edit,&$form_state)
return $element; return $element;
} }
/**
* Our process callback to expand the control.
*/
function ife_sticky_select_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$element['#type'] = 'sticky_select';
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/** /**
* Our process callback to expand the control. * Our process callback to expand the control.
*/ */
@ -488,6 +557,27 @@ function ife_copyright_process($element,$edit,&$form_state) {
module_load_include('inc','islandora_form_elements','includes/creative_commons'); module_load_include('inc','islandora_form_elements','includes/creative_commons');
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
if ($element['#sticky']) {
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
}
$element['#tree'] = TRUE; $element['#tree'] = TRUE;
if (isset($element['#value']) && !is_array($element['#value'])) { if (isset($element['#value']) && !is_array($element['#value'])) {
@ -500,7 +590,7 @@ function ife_copyright_process($element,$edit,&$form_state) {
$element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => ''); $element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => '');
} }
$element['cc'] = array('#type' => 'fieldset', '#title'=>$element['#title'], '#description' => '<div class="cc_preview">preview</div>' , '#collapsible' => TRUE); $element['cc'] = array('#type' => 'fieldset', '#title'=>$element['#title'], '#description' => $sticky.'<div class="cc_preview">preview</div>' , '#collapsible' => TRUE);
$element['cc']['cc_enable'] = array( $element['cc']['cc_enable'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
@ -579,9 +669,15 @@ function islandora_form_elements_theme() {
'sticky_textfield' => array( 'sticky_textfield' => array(
'arguments' => array('element'), 'arguments' => array('element'),
), ),
'sticky_textarea' => array( 'sticky_textarea' => array(
'arguments' => array('element'), 'arguments' => array('element'),
), ),
'sticky_select' => array(
'arguments' => array('element'),
),
'filechooser' => array( 'filechooser' => array(
'arguments' => array('element'), 'arguments' => array('element'),
'file' => 'includes/filechooser.inc' 'file' => 'includes/filechooser.inc'
@ -672,11 +768,13 @@ function theme_list($element)
$output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>'; $output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>';
} }
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$output .= (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/> Sticky?':'') . '</div>'; $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
return theme('form_element', $element, $output ) . $extra; return theme('form_element', $element, $output . $sticky ) . $extra;
} }
@ -696,6 +794,7 @@ function theme_list($element)
function theme_sticky_textarea($element) { function theme_sticky_textarea($element) {
$class = array('form-textarea'); $class = array('form-textarea');
// Add teaser behavior (must come before resizable) // Add teaser behavior (must come before resizable)
if (!empty($element['#teaser'])) { if (!empty($element['#teaser'])) {
drupal_add_js('misc/teaser.js'); drupal_add_js('misc/teaser.js');
@ -711,8 +810,10 @@ function theme_sticky_textarea($element) {
$class[] = 'resizable'; $class[] = 'resizable';
} }
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/> Sticky?':''); $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
_form_set_class($element, $class); _form_set_class($element, $class);
@ -720,6 +821,33 @@ function theme_sticky_textarea($element) {
} }
/**
* Format a sticky select.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, description, rows, cols, required, attributes
* @return
* A themed HTML string representing the textarea.
*
* @ingroup themeable
*/
function theme_sticky_select($element) {
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
$select = '';
$size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
_form_set_class($element, array('form-select'));
$multiple = $element['#multiple'];
return theme('form_element', $element, '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>'.$sticky);
}
/** /**
* Theme function to format the output. * Theme function to format the output.
* *
@ -759,11 +887,14 @@ function theme_datepicker($element) {
$output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>'; $output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>';
} }
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$output .= (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/> Sticky?':'') . '</div>'; $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
return theme('form_element', $element, $output ) . $extra;
return theme('form_element', $element, $output.$sticky ) . $extra;
} }
@ -803,11 +934,14 @@ function theme_sticky_textfield($element) {
$output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>'; $output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>';
} }
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$output .= (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/> Sticky?':'') . '</div>'; $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'<input class="sticky" type="checkbox" name="'.$stickyName.'"'.(isset($element['#sticky_on']) && $element['#sticky_on']==TRUE?' checked="checked"':'').'/><br/>':'');
return theme('form_element', $element, $output ) . $extra; return theme('form_element', $element, $output . $sticky) . $extra;
} }

40
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,12 +124,17 @@ 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) {
$new_item->modify_datastream_by_value($dc, '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']);
} }
@ -248,3 +262,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;
}
}

2
ilives/fedora_ilives.module

@ -203,11 +203,13 @@ 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';
if (!empty($types)) {
foreach ($types as $type) { foreach ($types as $type) {
if ($type == 'ingested') { if ($type == 'ingested') {
$ingested = 'true'; $ingested = 'true';
} }
} }
}
if (!isset($pid)) { if (!isset($pid)) {
drupal_set_message(t('Error getting book view, no identifier specified.')); drupal_set_message(t('Error getting book view, no identifier specified.'));

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>

10
plugins/ImageManipulation.inc

@ -17,8 +17,14 @@ class ImageManipulation {
function createPreview($parameterArray, $dsid, $file, $file_ext) { function createPreview($parameterArray, $dsid, $file, $file_ext) {
$system = getenv('System'); $system = getenv('System');
$file_suffix = '_' . $dsid . '.' . $file_ext; $file_suffix = '_' . $dsid . '.' . $file_ext;
$height = $parameterArray['height'];
$width = $parameterArray['width']; $width = $parameterArray['width'];
if (!isset($parameterArray['height'])) {
$height = $width;
} else {
$height = $parameterArray['height'];
}
$returnValue = TRUE; $returnValue = TRUE;
$output = array(); $output = array();
@ -29,7 +35,7 @@ class ImageManipulation {
} }
if (!file_exists($destFile)) { if (!file_exists($destFile)) {
exec('convert -resize ' . $width . ' -quality 85 "' . $file . '"[0] -strip "' .$destFile . '" 2>&1 &', $output, $returnValue); exec('convert -resize ' . $width . 'x'.$height.' -quality 85 "' . $file . '"[0] -strip "' .$destFile . '" 2>&1 &', $output, $returnValue);
} }
else else
$returnValue = '0'; $returnValue = '0';

14
plugins/nmlt/scorm.inc

@ -99,7 +99,11 @@ 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(
'#type' => 'tabpage',
'#title' => t('Description'),
);
if (module_load_include('module', 'SCORM', 'SCORM')) {
$dest_array = explode('/', urldecode(drupal_get_destination())); $dest_array = explode('/', urldecode(drupal_get_destination()));
$nid = $dest_array[count($dest_array) - 1]; $nid = $dest_array[count($dest_array) - 1];
$node = node_load($nid); $node = node_load($nid);
@ -109,16 +113,14 @@ class SCORMObject {
$tabset['my_tabset'] = array( $tabset['my_tabset'] = array(
'#type' => 'tabset', '#type' => 'tabset',
); );
$tabset['my_tabset']['first_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
);
$tabset['my_tabset']['second_tab'] = array( $tabset['my_tabset']['second_tab'] = array(
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => t('Results'), '#title' => t('Results'),
'#content' => scorm_show_results($node), '#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(

2
workflow_client/plugins/image_resize.inc

@ -39,7 +39,7 @@ class image_resize extends Process {
$returnValue = TRUE; $returnValue = TRUE;
$output = array(); $output = array();
$command = 'convert -resize '. $parameters['width'] .' -quality 85 '. $file . '[0] -strip '. $file . $file_suffix .' 2>&1 &'; $command = 'convert -resize '. $parameters['width'].(isset($parameters['height'])?'x'.$parameters['height']:'') .' -quality 85 '. $file . '[0] -strip '. $file . $file_suffix .' 2>&1 &';
exec($command, $output, $returnValue); exec($command, $output, $returnValue);
if (!file_exists($file . $file_suffix)) { if (!file_exists($file . $file_suffix)) {

Loading…
Cancel
Save