Browse Source

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

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
e2cecea05c
  1. 15
      CollectionPolicy.inc
  2. 10
      ContentModel.inc
  3. 16
      ObjectHelper.inc
  4. 2
      XMLDatastream.inc
  5. 2
      content_modeller/islandora_content_modeller.module
  6. 108
      content_models/islandora_largeimages.xml
  7. 2
      fedora_repository.module
  8. 24
      formClass.inc
  9. 21
      form_elements/includes/people.inc
  10. 3
      form_elements/islandora_form_elements.module
  11. 3
      plugins/Exiftool.inc
  12. 5
      plugins/FormBuilder.inc
  13. 4
      plugins/ModsFormBuilder.inc
  14. 66
      workflow_client/plugins/exif.inc
  15. 20
      workflow_client/plugins/solr_index.inc

15
CollectionPolicy.inc

@ -181,6 +181,21 @@ class CollectionPolicy extends XMLDatastream {
return $ret; return $ret;
} }
/**
* Constructor
* NOTE: Use the static constructor methods whenever possible.
*
* @param string $xmlStr
* @param string $pid
* @param string $dsid
* @return XMLDatastream $cm
*/
public function __construct($xmlStr, $pid = NULL, $dsid = NULL) {
parent::__construct($xmlStr,$pid,$dsid);
$this->name= 'Collection Policy';
}
/** /**
* Attempts to convert from the old XML schema to the new by * Attempts to convert from the old XML schema to the new by
* traversing the XML DOM and building a new DOM. When done * traversing the XML DOM and building a new DOM. When done

10
ContentModel.inc

@ -224,7 +224,7 @@ class ContentModel extends XMLDatastream {
parent::__construct($xmlStr, $pid, $dsid); parent::__construct($xmlStr, $pid, $dsid);
$this->pid_namespace = $pid_namespace; $this->pid_namespace = $pid_namespace;
$this->name = $name; $this->name = ($name == NULL)?'Islandora Content Model':$name;
} }
/** /**
@ -1372,9 +1372,10 @@ class ContentModel extends XMLDatastream {
* Executes the form handler from the <form_builder_method> element of <ingest_form>. * Executes the form handler from the <form_builder_method> element of <ingest_form>.
* *
* @param &$formData * @param &$formData
* @param &$form_state
* @return boolean $success * @return boolean $success
*/ */
public function execFormHandler(&$data) { public function execFormHandler(&$data,&$form_state) {
$ret = FALSE; $ret = FALSE;
if ($this->validate()) { if ($this->validate()) {
$method =$this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); $method =$this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0);
@ -1396,7 +1397,7 @@ class ContentModel extends XMLDatastream {
self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.'; self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.';
} }
else { else {
$class->$methodName($data); $class->$methodName($data,$form_state);
$ret = TRUE; $ret = TRUE;
} }
} }
@ -1855,11 +1856,10 @@ class ContentModel extends XMLDatastream {
$methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0);
$methods = $methodsEl->getElementsByTagName('ingest_method'); $methods = $methodsEl->getElementsByTagName('ingest_method');
for ($i=0; !$found && $i < $methods->length; $i++) { for ($i=0; !$found && $i < $methods->length; $i++) {
if ($methods->item($i)->getAttribute('module') == $module && $methods->item($i)->getAttribute('file') == $file && $methods->item($i)->getAttribute('class') == $class && $methods->item($i)->getAttribute('method') == $method) { if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'fedora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) {
$found = $methods->item($i); $found = $methods->item($i);
} }
} }
if ($found !== FALSE) { if ($found !== FALSE) {
$methodEl = $found; $methodEl = $found;
$paramsEl = $found->getElementsByTagName('parameters'); $paramsEl = $found->getElementsByTagName('parameters');

16
ObjectHelper.inc

@ -54,13 +54,14 @@ class ObjectHelper {
return ' '; return ' ';
} }
if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error'); drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error');
drupal_access_denied(); drupal_access_denied();
return ' '; return ' ';
} }
if (variable_get('fedora_object_restrict_datastreams', TRUE) == TRUE ) {
if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { if (($cm = ContentModel::loadFromObject($pid)) == FALSE) {
drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error');
drupal_access_denied(); drupal_access_denied();
@ -68,12 +69,12 @@ class ObjectHelper {
} }
$cmDatastreams = $cm->listDatastreams(); $cmDatastreams = $cm->listDatastreams();
if ( !((isset($user) && in_array('administrator',$user->roles)) || in_array($dsID,$cmDatastreams))) { if ( !((isset($user) && in_array('administrator',$user->roles)) || in_array($dsID,$cmDatastreams))) {
drupal_set_message(t("You do not have access to the specified datastream."), 'error'); drupal_set_message(t("You do not have access to the specified datastream."), 'error');
drupal_access_denied(); drupal_access_denied();
return ' '; return ' ';
} }
}
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$item = new Fedora_Item($pid); $item = new Fedora_Item($pid);
@ -405,10 +406,11 @@ class ObjectHelper {
* *
*/ */
function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) { function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) {
global $fedoraUser, $fedoraPass, $base_url; global $fedoraUser, $fedoraPass, $base_url, $user;
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
$dataStreamBody = ''; $dataStreamBody = '';
@ -427,10 +429,17 @@ class ObjectHelper {
$hasTNStream = FALSE; $hasTNStream = FALSE;
$dataStreamBody = "<br /><table>\n"; $dataStreamBody = "<br /><table>\n";
$cmDatastreams = array();
if (variable_get('fedora_object_restrict_datastreams', TRUE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) {
$cmDatastreams = $cm->listDatastreams();
}
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); $dataStreamBody .= $this->get_parent_objects_asHTML($object_pid);
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>'; $dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>';
foreach ($object as $datastream) { foreach ($object as $datastream) {
foreach ($datastream as $datastreamValue) { foreach ($datastream as $datastreamValue) {
if (variable_get('fedora_object_restrict_datastreams', TRUE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) {
if ($datastreamValue->ID == 'OBJ') { if ($datastreamValue->ID == 'OBJ') {
$hasOBJStream = '1'; $hasOBJStream = '1';
$mainStreamLabel = $datastreamValue->label; $mainStreamLabel = $datastreamValue->label;
@ -443,6 +452,7 @@ class ObjectHelper {
$dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n"; $dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n";
} }
} }
}
$dataStreamBody .= "</table>\n"; $dataStreamBody .= "</table>\n";
//if they have access let them add a datastream //if they have access let them add a datastream
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) {

2
XMLDatastream.inc

@ -223,7 +223,7 @@ printerWindow.document.write(text);
module_load_include('inc', 'Fedora_Repository', 'api/fedora_item'); module_load_include('inc', 'Fedora_Repository', 'api/fedora_item');
if ($this->validate()) { if ($this->validate()) {
$item = new Fedora_Item($this->pid); $item = new Fedora_Item($this->pid);
$item->modify_datastream_by_value($this->dumpXml(), $this->dsid, $this->name, NULL); $item->modify_datastream_by_value($this->dumpXml(), $this->dsid, $this->name, 'application/xml');
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

2
content_modeller/islandora_content_modeller.module

@ -2686,6 +2686,7 @@ function icm_model_add_ingestFormElement(&$form_state,$params=null)
'copyright'=>t('Creative-Commons Copyright Chooser'), 'copyright'=>t('Creative-Commons Copyright Chooser'),
'hidden'=>t('Hidden'), 'hidden'=>t('Hidden'),
'file'=>t('File Upload (browse)'), 'file'=>t('File Upload (browse)'),
'markup'=>t('HTML Markup (no field)'),
), ),
'#description'=> t('The type of form element to display.') '#description'=> t('The type of form element to display.')
); );
@ -2851,6 +2852,7 @@ function icm_model_edit_ingestFormElement(&$form_state,$params=null)
'copyright'=>t('Creative-Commons Copyright Chooser'), 'copyright'=>t('Creative-Commons Copyright Chooser'),
'hidden'=>t('Hidden'), 'hidden'=>t('Hidden'),
'file'=>t('File Upload (browse)'), 'file'=>t('File Upload (browse)'),
'markup'=>t('HTML Markup (no field)'),
), ),
'#description'=> t('The type of form element to display. <br/><b>Warning:</b> Changing the type from "Select" or "Radio" to anything else will cause any authoritative list to be permanently removed.') '#description'=> t('The type of form element to display. <br/><b>Warning:</b> Changing the type from "Select" or "Radio" to anything else will cause any authoritative list to be permanently removed.')
); );

108
content_models/islandora_largeimages.xml

@ -1,26 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="islandora:largeimages" <foxml:digitalObject PID="islandora:largeimages" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties> <foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/> <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Large Image Collection"/> <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Large Image Collection"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/> <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2010-01-26T21:29:20.416Z"/> <foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2010-01-26T21:29:20.416Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2010-03-11T21:01:44.921Z"/> <foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2010-12-10T17:32:17.345Z"/>
</foxml:objectProperties> </foxml:objectProperties>
<foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false"> <foxml:datastream CONTROL_GROUP="X" ID="AUDIT" STATE="A" VERSIONABLE="false">
<foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for this object" CREATED="2010-01-26T21:29:20.416Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit"> <foxml:datastreamVersion CREATED="2010-01-26T21:29:20.416Z"
FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit" ID="AUDIT.0" LABEL="Audit Trail for this object" MIMETYPE="text/xml">
<foxml:xmlContent> <foxml:xmlContent>
<audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#"> <audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
<audit:record ID="AUDREC1"> <audit:record ID="AUDREC1">
<audit:process type="Fedora API-M"/> <audit:process type="Fedora API-M"/>
<audit:action>ingest</audit:action> <audit:action>ingest</audit:action>
<audit:componentID></audit:componentID> <audit:componentID/>
<audit:responsibility>fedoraAdmin</audit:responsibility> <audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:29:20.416Z</audit:date> <audit:date>2010-01-26T21:29:20.416Z</audit:date>
<audit:justification>Created with Admin GUI &quot;New Object&quot; command</audit:justification> <audit:justification>Created with Admin GUI "New Object" command</audit:justification>
</audit:record> </audit:record>
<audit:record ID="AUDREC2"> <audit:record ID="AUDREC2">
<audit:process type="Fedora API-M"/> <audit:process type="Fedora API-M"/>
@ -36,7 +35,7 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
<audit:componentID>RELS-EXT</audit:componentID> <audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility> <audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:33:14.125Z</audit:date> <audit:date>2010-01-26T21:33:14.125Z</audit:date>
<audit:justification></audit:justification> <audit:justification/>
</audit:record> </audit:record>
<audit:record ID="AUDREC4"> <audit:record ID="AUDREC4">
<audit:process type="Fedora API-M"/> <audit:process type="Fedora API-M"/>
@ -44,7 +43,7 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
<audit:componentID>COLLECTION_POLICY</audit:componentID> <audit:componentID>COLLECTION_POLICY</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility> <audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-03-04T12:50:05.983Z</audit:date> <audit:date>2010-03-04T12:50:05.983Z</audit:date>
<audit:justification></audit:justification> <audit:justification/>
</audit:record> </audit:record>
<audit:record ID="AUDREC5"> <audit:record ID="AUDREC5">
<audit:process type="Fedora API-M"/> <audit:process type="Fedora API-M"/>
@ -52,24 +51,52 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
<audit:componentID>COLLECTION_POLICY</audit:componentID> <audit:componentID>COLLECTION_POLICY</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility> <audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-03-11T21:01:44.921Z</audit:date> <audit:date>2010-03-11T21:01:44.921Z</audit:date>
<audit:justification></audit:justification> <audit:justification/>
</audit:record>
<audit:record ID="AUDREC6">
<audit:process type="Fedora API-M"/>
<audit:action>ingest</audit:action>
<audit:componentID/>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-10T17:29:47.073Z</audit:date>
<audit:justification>Fedora Object Ingested</audit:justification>
</audit:record>
<audit:record ID="AUDREC7">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>TN</audit:componentID>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-10T17:29:47.200Z</audit:date>
<audit:justification>Ingested object TN</audit:justification>
</audit:record>
<audit:record ID="AUDREC8">
<audit:process type="Fedora API-M"/>
<audit:action>modifyDatastreamByValue</audit:action>
<audit:componentID>COLLECTION_POLICY</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-12-10T17:32:17.345Z</audit:date>
<audit:justification/>
</audit:record> </audit:record>
</audit:auditTrail> </audit:auditTrail>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
</foxml:datastream> </foxml:datastream>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> <foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2010-01-26T21:29:20.416Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="396"> <foxml:datastreamVersion CREATED="2010-01-26T21:29:20.416Z" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml" SIZE="396">
<foxml:xmlContent> <foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> <oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Large Image Collection</dc:title> <dc:title>Large Image Collection</dc:title>
<dc:identifier>islandora:largeimages</dc:identifier> <dc:identifier>islandora:largeimages</dc:identifier>
</oai_dc:dc> </oai_dc:dc>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
</foxml:datastream> </foxml:datastream>
<foxml:datastream ID="COLLECTION_POLICY" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> <foxml:datastream CONTROL_GROUP="X" ID="COLLECTION_POLICY" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion ID="COLLECTION_POLICY.0" LABEL="Collection Policy.xml" CREATED="2010-01-26T21:30:55.607Z" MIMETYPE="text/xml" SIZE="1558"> <foxml:datastreamVersion CREATED="2010-01-26T21:30:55.607Z" ID="COLLECTION_POLICY.0" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1558">
<foxml:xmlContent> <foxml:xmlContent>
<collection_policy> <collection_policy>
<contentmodels> <contentmodels>
@ -79,7 +106,6 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
<dsid>ISLANDORACM</dsid> <dsid>ISLANDORACM</dsid>
</contentmodel> </contentmodel>
</contentmodels> </contentmodels>
<relationship>isMemberOfCollection</relationship> <relationship>isMemberOfCollection</relationship>
<search_terms> <search_terms>
<default>dc.description</default> <default>dc.description</default>
@ -139,7 +165,8 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
</collection_policy> </collection_policy>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
<foxml:datastreamVersion ID="COLLECTION_POLICY.1" LABEL="Collection Policy.xml" CREATED="2010-03-04T12:50:05.983Z" MIMETYPE="text/xml" SIZE="1739"> <foxml:datastreamVersion CREATED="2010-03-04T12:50:05.983Z" ID="COLLECTION_POLICY.1" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1739">
<foxml:xmlContent> <foxml:xmlContent>
<collection_policy> <collection_policy>
<contentmodels> <contentmodels>
@ -213,7 +240,8 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
</collection_policy> </collection_policy>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
<foxml:datastreamVersion ID="COLLECTION_POLICY.2" LABEL="Collection Policy.xml" CREATED="2010-03-11T21:01:44.921Z" MIMETYPE="text/xml" SIZE="1915"> <foxml:datastreamVersion CREATED="2010-03-11T21:01:44.921Z" ID="COLLECTION_POLICY.2" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1555">
<foxml:xmlContent> <foxml:xmlContent>
<collection_policy> <collection_policy>
<contentmodels> <contentmodels>
@ -282,17 +310,49 @@ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/
</collection_policy> </collection_policy>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-12-10T17:32:17.345Z" ID="COLLECTION_POLICY.3" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1152">
<foxml:xmlContent>
<collection_policy name="" xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
<content_model dsid="ISLANDORACM" name="SLIDE_CMODEL" namespace="islandora:slide" pid="islandora:slideCModel"/>
</content_models>
<search_terms>
<term field="dc.title">dc.title</term>
<term field="dc.creator">dc.creator</term>
<term default="true" field="dc.description">dc.description</term>
<term field="dc.date">dc.date</term>
<term field="dc.identifier">dc.identifier</term>
<term field="dc.language">dc.language</term>
<term field="dc.publisher">dc.publisher</term>
<term field="dc.rights">dc.rights</term>
<term field="dc.subject">dc.subject</term>
<term field="dc.relation">dc.relation</term>
<term field="dcterms.temporal">dcterms.temporal</term>
<term field="dcterms.spatial">dcterms.spatial</term>
<term field="fgs.DS.first.text">Full Text</term>
</search_terms>
<relationship>isMemberOfCollection</relationship>
</collection_policy>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream> </foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> <foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="RDF Statements about this object" CREATED="2010-01-26T21:33:14.125Z" MIMETYPE="application/rdf+xml" FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" SIZE="439"> <foxml:datastreamVersion CREATED="2010-01-26T21:33:14.125Z" FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0"
ID="RELS-EXT.0" LABEL="RDF Statements about this object" MIMETYPE="application/rdf+xml" SIZE="441">
<foxml:xmlContent> <foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:largeimages"> <rdf:Description rdf:about="info:fedora/islandora:largeimages">
<isMemberOfCollection xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/islandora:demos"></isMemberOfCollection> <isMemberOfCollection rdf:resource="info:fedora/islandora:demos" xmlns="info:fedora/fedora-system:def/relations-external#"/>
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/islandora:collectionCModel"></hasModel> <hasModel rdf:resource="info:fedora/islandora:collectionCModel" xmlns="info:fedora/fedora-system:def/model#"/>
</rdf:Description> </rdf:Description>
</rdf:RDF> </rdf:RDF>
</foxml:xmlContent> </foxml:xmlContent>
</foxml:datastreamVersion> </foxml:datastreamVersion>
</foxml:datastream> </foxml:datastream>
<foxml:datastream CONTROL_GROUP="M" ID="TN" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2010-12-10T17:29:47.200Z" ID="TN.0" LABEL="Thumbnail.png" MIMETYPE="image/png">
<foxml:contentLocation REF="http://localhost:8080/fedora/get/islandora:largeimages/TN/2010-12-10T17:29:47.200Z" TYPE="INTERNAL_ID"/>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject> </foxml:digitalObject>

2
fedora_repository.module

@ -144,7 +144,7 @@ function fedora_repository_ingest_form_submit($form, &$form_state) {
$form_state['values']['content_model_pid'] = $contentModelPid; $form_state['values']['content_model_pid'] = $contentModelPid;
$form_state['values']['relationship'] = $relationship; $form_state['values']['relationship'] = $relationship;
$err = (!$cm->execFormHandler($form_state['values'])); $err = (!$cm->execFormHandler($form_state['values'],$form_state));
$_SESSION['fedora_ingest_files'] = ''; //empty this variable $_SESSION['fedora_ingest_files'] = ''; //empty this variable

24
formClass.inc

@ -77,8 +77,14 @@ class formClass {
'access arguments' => array('view fedora collection'), 'access arguments' => array('view fedora collection'),
// 'access' => TRUE // 'access' => TRUE
); );
$repository_title = variable_get('fedora_repository_title','Digital repository');
if (trim($repository_title)!= '') {
$respository_title=t($repository_title);
} else {
$repository_title= NULL;
}
$items['fedora/repository'] = array( $items['fedora/repository'] = array(
// 'title' => t('Digital repository'), 'title' => $repository_title,
'page callback' => 'repository_page', 'page callback' => 'repository_page',
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
// 'page arguments'=>array(1), // 'page arguments'=>array(1),
@ -361,6 +367,14 @@ class formClass {
); );
*/ */
$form['fedora_repository_title'] = array(
'#type' => 'textfield',
'#title' => t('Fedora Repository Title'),
'#default_value'=> variable_get('fedora_repository_title', 'Digital Repository'),
'#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'),
);
$form['fedora_object_display_title'] = array( $form['fedora_object_display_title'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Display Object Title Behaviour'), '#title' => t('Display Object Title Behaviour'),
@ -370,6 +384,7 @@ class formClass {
); );
$form['fedora_object_display_description'] = array( $form['fedora_object_display_description'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Display Object Description Behaviour'), '#title' => t('Display Object Description Behaviour'),
@ -378,6 +393,13 @@ class formClass {
'#description' => t('Determines when to display the default object (or collection) description fieldset when viewing an object/collection page.'), '#description' => t('Determines when to display the default object (or collection) description fieldset when viewing an object/collection page.'),
); );
$form['fedora_object_restrict_datastreams'] = array(
'#type' => 'checkbox',
'#title' => t('Restrict Access to Fedora Object Datastreams'),
'#default_value'=> variable_get('fedora_object_restrict_datastreams', TRUE),
'#description' => t('When enabled, restricts access to fedora object datastreams that are not listed in the Islandora Content Model for the object (unless the user is an administrator).'),
);
$form['fedora_collection_display_list'] = array( $form['fedora_collection_display_list'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Display Collection List Behaviour'), '#title' => t('Display Collection List Behaviour'),

21
form_elements/includes/people.inc

@ -40,12 +40,15 @@ function _ife_find_people_element($form, &$keys = array()) {
} }
function ife_people_ahah() { function ife_people_ahah() {
if (!isset($_POST['form_build_id'])) if (!isset($_POST['form_build_id']))
return; return;
$form_state = array('storage' => NULL, 'submitted' => FALSE); $form_state = array('storage' => NULL, 'submitted' => FALSE);
$form_build_id = $_POST['form_build_id']; $form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state); $form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters']; $args = $form['#parameters'];
$form_id = array_shift($args); $form_id = array_shift($args);
$form['#post'] = $_POST; $form['#post'] = $_POST;
@ -58,9 +61,10 @@ function ife_people_ahah() {
drupal_process_form($form_id, $form, $form_state); drupal_process_form($form_id, $form, $form_state);
// ob_start(); echo '<pre>'; echo $_POST['form_build_id']."\n"; var_dump($form_state); echo '</pre>'; $dump = ob_get_contents(); ob_end_clean();
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
$qt_form = _ife_find_people_element($form); $qt_form = _ife_find_people_element($form);
// ob_start(); echo '<pre>'; echo $form_state['clicked_button']['#parents'][2]; var_dump($form_state['storage']['people']); echo'</pre>'; $dump = ob_get_contents(); ob_end_clean();
unset($qt_form['#prefix'], $qt_form['#suffix']); // Prevent duplicate wrappers. unset($qt_form['#prefix'], $qt_form['#suffix']); // Prevent duplicate wrappers.
$javascript = drupal_add_js(NULL, NULL, 'header'); $javascript = drupal_add_js(NULL, NULL, 'header');
@ -105,7 +109,7 @@ function ife_remove_person_submit($form, &$form_state) {
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
$form_state['rebuild'] = TRUE; //$form_state['rebuild'] = TRUE;
} }
@ -117,6 +121,7 @@ function ife_add_person_submit($form, &$form_state) {
$keys = array(); $keys = array();
$qt_form = _ife_find_people_element($form, $keys); $qt_form = _ife_find_people_element($form, $keys);
$peopleVals = &$form_state['values']; $peopleVals = &$form_state['values'];
while (count($keys) > 0) { while (count($keys) > 0) {
$key = array_pop($keys); $key = array_pop($keys);
if (isset($peopleVals[$key])) { if (isset($peopleVals[$key])) {
@ -129,12 +134,16 @@ function ife_add_person_submit($form, &$form_state) {
foreach ($peopleVals['people'] as $val) { foreach ($peopleVals['people'] as $val) {
$people[] = $val; $people[] = $val;
} }
//only add new person if we are not adding from repository.
if (!isset($form_state['post']['add_from_repository']) || trim($form_state['post']['add_from_repository']) == '') {
$people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => ''); $people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => '');
}
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
$form_state['rebuild'] = TRUE; // $form_state['rebuild'] = TRUE;
} }
@ -147,12 +156,14 @@ function ife_add_org_submit($form, &$form_state) {
$keys = array(); $keys = array();
$qt_form = _ife_find_people_element($form, $keys); $qt_form = _ife_find_people_element($form, $keys);
$peopleVals = &$form_state['values']; $peopleVals = &$form_state['values'];
while (count($keys) > 0) { while (count($keys) > 0) {
$key = array_pop($keys); $key = array_pop($keys);
if (isset($peopleVals[$key])) { if (isset($peopleVals[$key])) {
$peopleVals = &$peopleVals[$key]; $peopleVals = &$peopleVals[$key];
} }
} }
if (!is_array($peopleVals['people'])) if (!is_array($peopleVals['people']))
$peopleVals['people'] = array(); $peopleVals['people'] = array();
@ -164,7 +175,7 @@ function ife_add_org_submit($form, &$form_state) {
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
$form_state['rebuild'] = TRUE; //$form_state['rebuild'] = TRUE;
} }
@ -194,7 +205,7 @@ function ife_add_conf_submit($form, &$form_state) {
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
$form_state['rebuild'] = TRUE; //$form_state['rebuild'] = TRUE;
} }

3
form_elements/islandora_form_elements.module

@ -141,7 +141,6 @@ function ife_people_process($element,$edit,&$form_state)
'#theme' => 'people_items', '#theme' => 'people_items',
); );
if (isset($form_state['post'][$element['#name']]['add_from_repository']) && trim($form_state['post'][$element['#name']]['add_from_repository']) != '') { if (isset($form_state['post'][$element['#name']]['add_from_repository']) && trim($form_state['post'][$element['#name']]['add_from_repository']) != '') {
$people= array(); $people= array();
@ -156,7 +155,7 @@ function ife_people_process($element,$edit,&$form_state)
$json = json_decode($form_state['post'][$element['#name']]['add_from_repository']); $json = json_decode($form_state['post'][$element['#name']]['add_from_repository']);
$person=array(); $person=array();
// ob_start(); echo '<pre>'; var_dump($json); echo '</pre>'; drupal_set_message(ob_get_contents()); ob_end_clean();
switch ($json->type) switch ($json->type)
{ {

3
plugins/Exiftool.inc

@ -32,6 +32,8 @@ class Exiftool {
function displayMetadata() { function displayMetadata() {
$output=''; $output='';
$exif = $this->item->get_datastream_dissemination('EXIF');
if (trim($exif) != '') {
$exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF'));
if ($exifDom != NULL) { if ($exifDom != NULL) {
$description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description'); $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description');
@ -58,6 +60,7 @@ class Exiftool {
$output = theme('fieldset', $fieldset); $output = theme('fieldset', $fieldset);
} }
} }
}
return $output; return $output;
} }

5
plugins/FormBuilder.inc

@ -312,12 +312,17 @@ class FormBuilder {
); );
foreach ($elements as $element) { foreach ($elements as $element) {
if ($element['type'] == 'markup') {
$el = array('#value'=> $element['description']);
} else {
$el = array( $el = array(
'#title' => $element['label'], '#title' => $element['label'],
'#required' => ($element['required'] ? 1 : 0), '#required' => ($element['required'] ? 1 : 0),
'#description' => $element['description'], '#description' => $element['description'],
'#type' => $element['type'] '#type' => $element['type']
); );
}
$name = explode('][', $element['name']); $name = explode('][', $element['name']);
$elLocation = &$form['indicator2']; $elLocation = &$form['indicator2'];

4
plugins/ModsFormBuilder.inc

@ -231,10 +231,12 @@ class ModsFormBuilder extends FormBuilder {
} }
function handleModsForm($form_values) { function handleModsForm(&$form_values,&$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
$form_state['storage']['people']=NULL; //clears out old entities for the next run of the formbuilder.
$dom = new DomDocument("1.0", "UTF-8"); $dom = new DomDocument("1.0", "UTF-8");
$dom->formatOutput = TRUE; $dom->formatOutput = TRUE;
$pid=$form_values['pid']; $pid=$form_values['pid'];

66
workflow_client/plugins/exif.inc

@ -0,0 +1,66 @@
<?php
// $Id$
module_load_include('inc', 'islandora_workflow_client', 'process');
class exif extends Process {
protected function process($pid, $parameters) {
$required_params = array('dsid');
$missing_params = array();
foreach ($required_params as $param)
if (!isset($parameters[$param]))
$missing_params[]=$param;
if (count($missing_params) > 0) {
$this->setMessage(t('Missing parameter(s) "%params" for exif process on "%pid"', array('%params' => join(',', $missing_params), '%pid' => $pid)));
return FALSE;
}
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$item = new fedora_item($pid);
$dslist = $item->get_datastreams_list_as_array();
if (!isset($dslist[$parameters['dsid']])) {
$this->setMessage(t('Datastream "%dsid" could not be found for exif process on "%pid"', array('%dsid' => $parameters['dsid'], '%pid' => $pid)));
return FALSE;
}
$ds = $dslist[$parameters['dsid']];
$file = '/tmp/'. $ds['label'];
$dest_ds = isset($parameters['dest_ds']) ? $parameters['dest_ds'] : 'EXIF';
$objectHelper = new ObjectHelper();
$objectHelper->makeObject($pid, $parameters['dsid'], FALSE, NULL, $file);
if (!file_exists($file)) {
$this->setMessage('couldnt get datastream '. $parameters['dsid'] .' as '. $file);
return FALSE;
}
$system = getenv('System');
$returnValue=TRUE;
$output=array();
$command = '/usr/local/exif/exiftool -X '. $file;
exec($command, $output, $returnValue);
if ($returnValue == '0') {
if (isset($dslist[$dest_ds])) {
$item->purge_datastream($dest_ds);
}
$ret = $item->add_datastream_from_string(join("\n",$output), $dest_ds, 'EXIF_Technical_Metadata.xml' , 'text/xml', 'X','Added by workflow process EXIF.');
@unlink($file);
@unlink($file . $file_suffix);
if (!$ret) {
$this->setMessage(t('Unable to add datastream "%dsid" to "%pid".', array('%dsid' => $dest_ds, '%pid' => $pid)));
return FALSE;
}
return TRUE;
}
}
}

20
workflow_client/plugins/solr_index.inc

@ -27,6 +27,8 @@ class solr_index extends Process {
} }
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$xsltDom = NULL; $xsltDom = NULL;
if (isset($parameters['xslt'])) { if (isset($parameters['xslt'])) {
list($template_pid, $template_dsid) = explode('/', $parameters['xslt']); list($template_pid, $template_dsid) = explode('/', $parameters['xslt']);
@ -44,6 +46,11 @@ class solr_index extends Process {
$xsltDom->load(drupal_get_path('module', 'islandora_workflow_client') .'/xsl/'. trim($parameters['xslt_file'])); $xsltDom->load(drupal_get_path('module', 'islandora_workflow_client') .'/xsl/'. trim($parameters['xslt_file']));
} }
if ($xsdlDom === FALSE) {
$this->setMessage(t('Unable to load xslt.'));
return FALSE;
}
$item = new fedora_item($pid); $item = new fedora_item($pid);
$dslist = $item->get_datastreams_list_as_array(); $dslist = $item->get_datastreams_list_as_array();
if (!isset($dslist[$parameters['dsid']])) { if (!isset($dslist[$parameters['dsid']])) {
@ -59,9 +66,12 @@ class solr_index extends Process {
$proc = new XSLTProcessor(); $proc = new XSLTProcessor();
$proc->importStylesheet($xsltDom); $proc->importStylesheet($xsltDom);
$solrDoc = $proc->transformToXML($dom); $solrDom = $proc->transformToDOC($dom);
$solrDom = DOMDocument::loadXML($solrDoc); if ($solrDoc === FALSE) {
$this->setMessage(t('Document transform failed.'));
return FALSE;
}
$doc = $solrDom->getElementsByTagName('doc'); $doc = $solrDom->getElementsByTagName('doc');
if ($doc->length > 0) { if ($doc->length > 0) {
$doc=$doc->item(0); $doc=$doc->item(0);
@ -73,6 +83,12 @@ class solr_index extends Process {
$doc->appendChild($field); $doc->appendChild($field);
} }
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) {
$field=$solrDom->createElement('field', $cm->pid);
$field->setAttribute('name', 'cmodel_t');
$doc->appendChild($field);
}
if (isset($dslist['DC'])) if (isset($dslist['DC']))
{ {
$dc = $item->get_datastream('DC'); $dc = $item->get_datastream('DC');

Loading…
Cancel
Save