Browse Source

Merge remote branch 'upstream/master'

pull/105/head
Alan Stanley 14 years ago
parent
commit
bd14f1b817
  1. 4
      ObjectHelper.inc
  2. 8
      api/fedora_collection.inc
  3. 273
      content_models/islandora_largeimages.xml
  4. 2
      fedora_repository.module
  5. 2
      formClass.inc
  6. 12
      form_elements/includes/autocomplete.inc
  7. 11
      form_elements/includes/people.inc
  8. 2
      form_elements/islandora_form_elements.module
  9. 8
      form_elements/js/people_ahah.js
  10. 16
      plugins/ModsFormBuilder.inc

4
ObjectHelper.inc

@ -430,7 +430,7 @@ class ObjectHelper {
$dataStreamBody = "<br /><table>\n";
$cmDatastreams = array();
if (variable_get('fedora_object_restrict_datastreams', TRUE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) {
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) {
$cmDatastreams = $cm->listDatastreams();
}
@ -439,7 +439,7 @@ class ObjectHelper {
foreach ($object as $datastream) {
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 (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) {
if ($datastreamValue->ID == 'OBJ') {
$hasOBJStream = '1';
$mainStreamLabel = $datastreamValue->label;

8
api/fedora_collection.inc

@ -65,7 +65,7 @@ function export_collection($collection_pid, $relationship = 'isMemberOfCollectio
* @param <type> $query
* @param <type> $query_format R
*/
function get_related_items_as_xml($collection_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL) {
function get_related_items_as_xml($collection_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$collection_item = new Fedora_Item($collection_pid);
@ -104,7 +104,7 @@ function get_related_items_as_xml($collection_pid, $relationship = array('isMemb
$query_string .= ')
minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>
order by $title';
order by '.$orderby;
$query_string = htmlentities(urlencode($query_string));
@ -117,8 +117,8 @@ function get_related_items_as_xml($collection_pid, $relationship = array('isMemb
return $content;
}
function get_related_items_as_array($collection_pid, $relationship = 'isMemberOfCollection', $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL) {
$content = get_related_items_as_xml($collection_pid, $relationship, $limit, $offset, $active_objects_only, $cmodel);
function get_related_items_as_array($collection_pid, $relationship = 'isMemberOfCollection', $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') {
$content = get_related_items_as_xml($collection_pid, $relationship, $limit, $offset, $active_objects_only, $cmodel, $orderby);
if (empty($content)) {
return array();
}

273
content_models/islandora_largeimages.xml

@ -3,13 +3,13 @@
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: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 Images Collection"/>
<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/view#lastModifiedDate" VALUE="2010-12-10T17:32:17.345Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2010-12-20T16:02:16.800Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2010-12-20T16:09:32.544Z"/>
</foxml:objectProperties>
<foxml:datastream CONTROL_GROUP="X" ID="AUDIT" STATE="A" VERSIONABLE="false">
<foxml:datastreamVersion CREATED="2010-01-26T21:29:20.416Z"
<foxml:datastreamVersion CREATED="2010-12-20T16:02:16.800Z"
FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit" ID="AUDIT.0" LABEL="Audit Trail for this object" MIMETYPE="text/xml">
<foxml:xmlContent>
<audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
@ -17,48 +17,48 @@
<audit:process type="Fedora API-M"/>
<audit:action>ingest</audit:action>
<audit:componentID/>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:29:20.416Z</audit:date>
<audit:justification>Created with Admin GUI "New Object" command</audit:justification>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-20T16:02:16.800Z</audit:date>
<audit:justification>Fedora Object Ingested</audit:justification>
</audit:record>
<audit:record ID="AUDREC2">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>COLLECTION_POLICY</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:30:55.607Z</audit:date>
<audit:justification>DatastreamsPane generated this logMessage.</audit:justification>
<audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-20T16:02:17.020Z</audit:date>
<audit:justification>Ingested object RELS-EXT</audit:justification>
</audit:record>
<audit:record ID="AUDREC3">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:action>modifyDatastreamByValue</audit:action>
<audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:33:14.125Z</audit:date>
<audit:justification/>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-20T16:02:17.091Z</audit:date>
<audit:justification>Modified by Islandora API</audit:justification>
</audit:record>
<audit:record ID="AUDREC4">
<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-03-04T12:50:05.983Z</audit:date>
<audit:justification/>
<audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-20T16:02:17.142Z</audit:date>
<audit:justification>Modified by Islandora API</audit:justification>
</audit:record>
<audit:record ID="AUDREC5">
<audit:process type="Fedora API-M"/>
<audit:action>modifyDatastreamByValue</audit:action>
<audit:action>addDatastream</audit:action>
<audit:componentID>COLLECTION_POLICY</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-03-11T21:01:44.921Z</audit:date>
<audit:justification/>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2010-12-20T16:02:17.213Z</audit:date>
<audit:justification>Ingested object COLLECTION_POLICY</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:date>2010-12-20T16:08:27.075Z</audit:date>
<audit:justification>Fedora Object Ingested</audit:justification>
</audit:record>
<audit:record ID="AUDREC7">
@ -66,15 +66,23 @@
<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:date>2010-12-20T16:08:27.131Z</audit:date>
<audit:justification>Ingested object TN</audit:justification>
</audit:record>
<audit:record ID="AUDREC8">
<audit:process type="Fedora API-M"/>
<audit:action>purgeDatastream</audit:action>
<audit:componentID>TN</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-12-20T16:09:24.726Z</audit:date>
<audit:justification>DatastreamPane generated this logMessage. . . . Purged datastream (ID=TN), versions ranging from 2010-12-20T12:08:27.131Z to 2010-12-20T12:08:27.131Z. This resulted in the permanent removal of 1 datastream version(s) (2010-12-20T12:08:27.131Z) and all associated audit records.</audit:justification>
</audit:record>
<audit:record ID="AUDREC9">
<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:date>2010-12-20T16:09:32.544Z</audit:date>
<audit:justification/>
</audit:record>
</audit:auditTrail>
@ -82,172 +90,68 @@
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
<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:datastreamVersion CREATED="2010-12-20T16:02:16.800Z" 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="397">
<foxml:xmlContent>
<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 Images Collection</dc:title>
<dc:identifier>islandora:largeimages</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="COLLECTION_POLICY" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2010-01-26T21:30:55.607Z" ID="COLLECTION_POLICY.0" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1558">
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2010-12-20T16:02:17.020Z" ID="RELS-EXT.0"
LABEL="Fedora object-to-object relationship metadata" MIMETYPE="text/xml" SIZE="178">
<foxml:xmlContent>
<collection_policy>
<contentmodels>
<contentmodel name="SLIDE_CMODEL">
<pid_namespace>islandora:slide</pid_namespace>
<pid>islandora:slideCModel</pid>
<dsid>ISLANDORACM</dsid>
</contentmodel>
</contentmodels>
<relationship>isMemberOfCollection</relationship>
<search_terms>
<default>dc.description</default>
<term>
<field>dc.title</field>
<value>dc.title</value>
</term>
<term>
<field>dc.creator</field>
<value>dc.creator</value>
</term>
<term>
<field>dc.description</field>
<value>dc.description</value>
</term>
<term>
<field>dc.date</field>
<value>dc.date</value>
</term>
<term>
<field>dc.identifier</field>
<value>dc.identifier</value>
</term>
<term>
<field>dc.language</field>
<value>dc.language</value>
</term>
<term>
<field>dc.publisher</field>
<value>dc.publisher</value>
</term>
<term>
<field>dc.rights</field>
<value>dc.rights</value>
</term>
<term>
<field>dc.subject</field>
<value>dc.subject</value>
</term>
<term>
<field>dc.relation</field>
<value>dc.relation</value>
</term>
<term>
<field>dcterms.temporal</field>
<value>dcterms.temporal</value>
</term>
<term>
<field>dcterms.spatial</field>
<value>dcterms.spatial</value>
</term>
<term>
<field>fgs.DS.first.text</field>
<value>Full Text</value>
</term>
</search_terms>
</collection_policy>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:largeimages"/>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-12-20T16:02:17.091Z" ID="RELS-EXT.1"
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="text/xml" SIZE="361">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:largeimages">
<fedora-model:hasModel rdf:resource="info:fedora/islandora:collectionCModel" xmlns:fedora-model="info:fedora/fedora-system:def/model#"/>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-12-20T16:02:17.142Z" ID="RELS-EXT.2"
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="text/xml" SIZE="520">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:largeimages">
<fedora-model:hasModel rdf:resource="info:fedora/islandora:collectionCModel" xmlns:fedora-model="info:fedora/fedora-system:def/model#"/>
<isMemberOfCollection rdf:resource="info:fedora/islandora:demos" xmlns="info:fedora/fedora-system:def/relations-external#"/>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-03-04T12:50:05.983Z" ID="COLLECTION_POLICY.1" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1739">
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="COLLECTION_POLICY" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2010-12-20T16:02:17.213Z" ID="COLLECTION_POLICY.0" LABEL="Large Images Collection"
MIMETYPE="text/xml" SIZE="2533">
<foxml:xmlContent>
<collection_policy>
<collection_policy name="Large Images Collection">
<contentmodels>
<contentmodel name="SLIDE_CMODEL">
<pid_namespace>islandora:slide</pid_namespace>
<pid>islandora:slideCModel</pid>
<dsid>ISLANDORACM</dsid>
</contentmodel>
<contentmodel name="HERBARIUM_CMODEL">
<pid_namespace>islandora:herb</pid_namespace>
<pid>islandora:herbCModel</pid>
<contentmodel name="MAP_CMODEL">
<pid_namespace>islandora:map</pid_namespace>
<pid>islandora:mapCModel</pid>
<dsid>ISLANDORACM</dsid>
</contentmodel>
</contentmodels>
<relationship>isMemberOfCollection</relationship>
<search_terms>
<default>dc.description</default>
<term>
<field>dc.title</field>
<value>dc.title</value>
</term>
<term>
<field>dc.creator</field>
<value>dc.creator</value>
</term>
<term>
<field>dc.description</field>
<value>dc.description</value>
</term>
<term>
<field>dc.date</field>
<value>dc.date</value>
</term>
<term>
<field>dc.identifier</field>
<value>dc.identifier</value>
</term>
<term>
<field>dc.language</field>
<value>dc.language</value>
</term>
<term>
<field>dc.publisher</field>
<value>dc.publisher</value>
</term>
<term>
<field>dc.rights</field>
<value>dc.rights</value>
</term>
<term>
<field>dc.subject</field>
<value>dc.subject</value>
</term>
<term>
<field>dc.relation</field>
<value>dc.relation</value>
</term>
<term>
<field>dcterms.temporal</field>
<value>dcterms.temporal</value>
</term>
<term>
<field>dcterms.spatial</field>
<value>dcterms.spatial</value>
</term>
<term>
<field>fgs.DS.first.text</field>
<value>Full Text</value>
</term>
</search_terms>
</collection_policy>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-03-11T21:01:44.921Z" ID="COLLECTION_POLICY.2" LABEL="Collection Policy.xml"
MIMETYPE="text/xml" SIZE="1555">
<foxml:xmlContent>
<collection_policy>
<contentmodels>
<contentmodel name="SLIDE_CMODEL">
<pid_namespace>islandora:slide</pid_namespace>
<pid>islandora:slideCModel</pid>
<contentmodel name="HERB_CMODEL">
<pid_namespace>islandora:herb</pid_namespace>
<pid>islandora:herbCModel</pid>
<dsid>ISLANDORACM</dsid>
</contentmodel>
</contentmodels>
@ -310,12 +214,15 @@
</collection_policy>
</foxml:xmlContent>
</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:datastreamVersion CREATED="2010-12-20T16:09:32.544Z" ID="COLLECTION_POLICY.1" LABEL="Large Images Collection"
MIMETYPE="text/xml" SIZE="1428">
<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">
<collection_policy name="Large Images Collection" 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_model dsid="ISLANDORACM" name="MAP_CMODEL" namespace="islandora:map" pid="islandora:mapCModel"/>
<content_model dsid="ISLANDORACM" name="HERB_CMODEL" namespace="islandora:herb" pid="islandora:herbCModel"/>
</content_models>
<search_terms>
<term field="dc.title">dc.title</term>
@ -337,22 +244,4 @@
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
<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>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:largeimages">
<isMemberOfCollection rdf:resource="info:fedora/islandora:demos" xmlns="info:fedora/fedora-system:def/relations-external#"/>
<hasModel rdf:resource="info:fedora/islandora:collectionCModel" xmlns="info:fedora/fedora-system:def/model#"/>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</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>

2
fedora_repository.module

@ -1410,7 +1410,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
try {
$item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml');
$tn = $item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M');
drupal_set_message("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:largeImages\">islandora:largeImages</a>.", 'message');
drupal_set_message("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:largeimages\">islandora:largeimages</a>.", 'message');
} catch (exception $e) {
$error .= " - Problem ingesting islandora:largeimages collection";
}

2
formClass.inc

@ -396,7 +396,7 @@ class formClass {
$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),
'#default_value'=> variable_get('fedora_object_restrict_datastreams', FALSE),
'#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).'),
);

12
form_elements/includes/autocomplete.inc

@ -3,7 +3,7 @@
// $Id$
function ife_autocomplete_person($string) {
$string=strtolower($string);
$string=trim(strtolower($string));
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('php', 'islandora_solr_search', 'Solr/Service');
@ -12,9 +12,11 @@ function ife_autocomplete_person($string) {
$appName = variable_get('islandora_solr_search_block_app_name','solr');
$requestHandler = variable_get("islandora_solr_search_block_request_handler",t("standard"));
$query = 'name_personal_t:'.$string.'* OR name_organization_t:'.$string.'* OR name_conference_t:'.$string.'*';
$solr = new Apache_Solr_Service($host, $port, '/'.$appName.'/');
$string=$solr->escape($string);
$query = 'name_personal_t:'.$string.'* OR name_organization_t:'.$string.'* OR name_conference_t:'.$string.'*';
$additionalParams = array(
'facet' => 'false',
'qt' => $requestHandler,
@ -129,7 +131,7 @@ function ife_autocomplete_gacs($collection, $string='') {
$collection = FALSE;
}
$string=ucwords($string);
$string=ucwords(trim($string));
$dom = DOMDocument::load ( $moduleRoot .'/xml/gacs.xml' );
$rootEl = $dom->getElementsByTagName('codelist');
@ -159,7 +161,7 @@ function ife_autocomplete_language($collection, $string='') {
$collection = FALSE;
}
$string=ucwords($string);
$string=ucwords(trim($string));
$dom = DOMDocument::load ( $moduleRoot .'/xml/languages.xml' );
$rootEl = $dom->getElementsByTagName('codelist');
@ -197,7 +199,7 @@ function ife_autocomplete($field, $collection, $string='') {
'fl' => $field
);
$query = $field .':'. $solr->escape(strtolower($string)) .'*';
$query = $field .':'. $solr->escape(strtolower(trim($string))) .'*';
if ($collection != FALSE) {
$query .= ' AND related_item_identifier_t:'. $solr->escape($collection);

11
form_elements/includes/people.inc

@ -41,7 +41,6 @@ function _ife_find_people_element($form, &$keys = array()) {
function ife_people_ahah() {
if (!isset($_POST['form_build_id']))
return;
@ -58,7 +57,6 @@ function ife_people_ahah() {
$_POST = _dummy_post_info($form, $_POST);
$form_state['post'] = $_POST;
$form['#post'] = $_POST;
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();
@ -109,7 +107,7 @@ function ife_remove_person_submit($form, &$form_state) {
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people;
//$form_state['rebuild'] = TRUE;
$form_state['rebuild'] = TRUE;
}
@ -136,14 +134,14 @@ function ife_add_person_submit($form, &$form_state) {
}
//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']) == '') {
$elName = isset($qt_form['entity0']['#parents'][0])?$qt_form['entity0']['#parents'][0]:null;
if ($elName == null || !isset($form_state['clicked_button']['#post'][$elName]['add_from_repository']) || trim($form_state['clicked_button']['#post'][$elName]['add_from_repository']) == '') {
$people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => '');
}
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people;
// $form_state['rebuild'] = TRUE;
$form_state['rebuild'] = TRUE;
}
@ -200,6 +198,7 @@ function ife_add_conf_submit($form, &$form_state) {
foreach ($peopleVals['people'] as $val) {
$people[] = $val;
}
$people[] = array('role' => '', 'conference' => '', 'subject' => '');
unset($form_state['submit_handlers']);

2
form_elements/islandora_form_elements.module

@ -154,6 +154,7 @@ function ife_people_process($element,$edit,&$form_state)
$json = json_decode($form_state['post'][$element['#name']]['add_from_repository']);
$form_state['post'][$element['#name']]['add_from_repository'] = ''; // clear so that if the form is processed multiple times, it does not add twice.
$person=array();
@ -182,7 +183,6 @@ function ife_people_process($element,$edit,&$form_state)
$form_state['storage']['people']=$people;
} else if (!isset($form_state['storage']['people']) || empty($form_state['storage']['people']))
{
if ( (!isset($form_state['clicked_button']) || count($form_state['clicked_button']) == 0) && isset($element['#default_value']) && is_array($element['#default_value']) ) {

8
form_elements/js/people_ahah.js

@ -3,12 +3,14 @@
if (Drupal.jsEnabled) {
$(document).ready(function() {
if (Drupal.ahah != undefined) {
$('#edit-mods-people-add-from-repository').change(function () {
$('#edit-mods-people-add-from-repository').blur(function () {
if ($('#edit-mods-people-add-from-repository').val() != '') {
$('#edit-mods-people-add-person').mousedown();
}
});
if (Drupal.ahah != undefined) {
/**
* Override of Drupal.ahah.prototype.success. The only difference is that we
* allow for new Drupal.settings.

16
plugins/ModsFormBuilder.inc

@ -69,9 +69,9 @@ class ModsFormBuilder extends FormBuilder {
);
$includeEl = true;
$name = explode('][', $element['name']);
$elname = explode('][', $element['name']);
$elLocation = &$form['indicator2'];
while (isset($elLocation[$name[0]]) && ($partial = array_shift($name)) != NULL) {
while (isset($elLocation[$name[0]]) && ($partial = array_shift($elname)) != NULL) {
$elLocation = &$elLocation[$partial];
}
@ -214,7 +214,7 @@ class ModsFormBuilder extends FormBuilder {
}
if ($includeEl) {
$elLocation[join('][', $name)] = $el;
$elLocation[join('][', $elname)] = $el;
}
}
@ -661,7 +661,7 @@ class ModsFormBuilder extends FormBuilder {
if (isset($form_values['mods_people']) && isset($form_values['mods_people']['people']) && is_array($form_values['mods_people']['people']) ) {
foreach ($form_values['mods_people']['people'] as $key => $val) {
$name = $dom->createElement('mods:name');
$appendName=FALSE;
if (isset($val['role'])) {
$role = $dom->createElement('mods:role');
$roleTerm = $dom->createElement('mods:roleTerm', htmlspecialchars(trim($val['role'])));
@ -676,6 +676,7 @@ class ModsFormBuilder extends FormBuilder {
if (trim($val['organization']) != '') {
$namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['organization'])));
$name->appendChild($namePart);
$appendName=TRUE;
}
}
elseif (isset($val['conference'])) {
@ -683,6 +684,7 @@ class ModsFormBuilder extends FormBuilder {
if (trim($val['conference']) != '') {
$namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['conference'])));
$name->appendChild($namePart);
$appendName=TRUE;
}
}
else {
@ -690,6 +692,7 @@ class ModsFormBuilder extends FormBuilder {
if (trim($val['name']) != '') {
$namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['name'])));
$name->appendChild($namePart);
$appendName=TRUE;
}
}
@ -699,13 +702,14 @@ class ModsFormBuilder extends FormBuilder {
$name->appendChild($namePart);
}
if ($appendName) {
if (isset($val['subject'])) {
$subject->appendChild($name);
$hasSubject=TRUE;
} else
{
} else {
$mods->appendChild($name);
}
}
}
}

Loading…
Cancel
Save