Browse Source

Merge branch 'ISLANDORA-214' of github.com:Islandora/islandora into ISLANDORA-214

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
6a749570e1
  1. 90
      content_models/COLLECTIONCM.xml
  2. 143
      fedora_repository.module
  3. 6
      formClass.inc
  4. 0
      plugins/islandora_newspaper/Newspaper.inc
  5. 7
      plugins/islandora_newspaper/islandora_newspaper.info
  6. 41
      plugins/islandora_newspaper/islandora_newspaper.module
  7. 0
      plugins/islandora_newspaper/newspapers_guardian.xml
  8. 0
      plugins/islandora_newspaper/newspapers_issueCModel.xml
  9. 0
      plugins/islandora_newspaper/newspapers_pageCModel.xml
  10. 0
      plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml
  11. 0
      plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml

90
content_models/COLLECTIONCM.xml

@ -1 +1,89 @@
<?xml version="1.0" encoding="utf-8"?> <content_model xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Collection" xsi:schemaLocation="http://www.islandora.ca http://localhost/islandoracm.xsd"> <mimetypes> <type>text/xml</type> <type>text/plain</type> <type>application/xml</type> </mimetypes> <ingest_rules/> <ingest_form dsid="QDC" page="2"> <form_builder_method module="" file="plugins/CollectionFormBuilder.inc" class="CollectionFormBuilder" method="buildQDCForm" handler="handleQDCForm"/> <form_elements> <element label="Title/Caption/Object Name" name="dc:title" type="textfield" required="true"> <description>The name given to the resource</description> </element> <element label="Creator/Photographer/Author" name="dc:creator" type="textfield"> <description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description> </element> <element label="Subject" name="dc:subject" type="select"> <description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description> <authoritative_list> <item>none</item> <item>Multi Media</item> <item>image</item> <item>meeting</item> <item>presentation</item> <item>sound</item> <item>text</item> </authoritative_list> </element> <element label="Description" name="dc:description" type="textarea" required="true"> <description>Examples include an abstract, table of contents, or free-text account of the content of the resource.</description> </element> <element label="Publisher" name="dc:publisher" type="textfield"> <description>An entity, (including persons, organizations, or services), responsible for making the resource available.</description> </element> <element label="Contributor" name="dc:contributor" type="textfield"> <description>An entity responsible for contributing to the content of the resource such as a person, organization or service.</description> </element> <element label="Date" name="dc:date" type="textfield"> <description>Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23)</description> </element> <element label="Resource Type" name="dc:type" type="select"> <description>Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary.</description> <authoritative_list> <item>none</item> <item>collection</item> <item>dataset</item> <item>event</item> <item>image</item> <item>interactive resource</item> <item>model</item> <item>party</item> <item>physical object</item> <item>place</item> <item>service</item> <item>software</item> <item>sound</item> <item>text</item> </authoritative_list> </element> <element label="Source" name="dc:source" type="textfield"> <description>A reference to a resource from which the present resource is derived.</description> </element> <element label="Identifier" name="dc:identifier" type="textfield"> <description>A unique reference to the resource; In this instance, the accession number or collection number.</description> </element> <element label="Language" name="dc:language" type="select"> <description>The language of the intellectual content of the resource.</description> <authoritative_list> <item field="eng">English</item> <item field="fre">French</item> </authoritative_list> </element> <element label="Relation" name="dc:relation" type="textfield"> <description>Reference to a related resource.</description> </element> <element label="Rights Management" name="dc:rights" type="textarea"> <description>Information about intellectual property rights, copyright, and various property rights.</description> </element> </form_elements> </ingest_form> </content_model>
<content_model xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Collection" version="2" xsi:schemaLocation="http://www.islandora.ca http://localhost/islandoracm.xsd">
<mimetypes>
<type>text/xml</type>
<type>text/plain</type>
<type>application/xml</type>
</mimetypes>
<ingest_rules></ingest_rules>
<datastreams>
<datastream dsid="DC">
<display_method class="CollectionClass" file="CollectionClass.inc" method="showFieldSets" module=""></display_method>
</datastream>
<datastream dsid="TN"></datastream>
<datastream dsid="COLLECTION_POLICY"></datastream>
</datastreams>
<ingest_form dsid="QDC" page="2">
<form_builder_method class="CollectionFormBuilder" file="plugins/CollectionFormBuilder.inc" handler="handleQDCForm" method="buildQDCForm" module=""></form_builder_method>
<form_elements>
<element label="Title/Caption/Object Name" name="dc:title" required="true" type="textfield">
<description>The name given to the resource</description>
</element>
<element label="Creator/Photographer/Author" name="dc:creator" type="textfield">
<description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description>
</element>
<element label="Subject" name="dc:subject" type="select">
<description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description>
<authoritative_list>
<item>none</item>
<item>Multi Media</item>
<item>image</item>
<item>meeting</item>
<item>presentation</item>
<item>sound</item>
<item>text</item>
</authoritative_list>
</element>
<element label="Description" name="dc:description" required="true" type="textarea">
<description>Examples include an abstract, table of contents, or free-text account of the content of the resource.</description>
</element>
<element label="Publisher" name="dc:publisher" type="textfield">
<description>An entity, (including persons, organizations, or services), responsible for making the resource available.</description>
</element>
<element label="Contributor" name="dc:contributor" type="textfield">
<description>An entity responsible for contributing to the content of the resource such as a person, organization or service.</description>
</element>
<element label="Date" name="dc:date" type="textfield">
<description>Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23)</description>
</element>
<element label="Resource Type" name="dc:type" type="select">
<description>Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary.</description>
<authoritative_list>
<item>none</item>
<item>collection</item>
<item>dataset</item>
<item>event</item>
<item>image</item>
<item>interactive resource</item>
<item>model</item>
<item>party</item>
<item>physical object</item>
<item>place</item>
<item>service</item>
<item>software</item>
<item>sound</item>
<item>text</item>
</authoritative_list>
</element>
<element label="Source" name="dc:source" type="textfield">
<description>A reference to a resource from which the present resource is derived.</description>
</element>
<element label="Identifier" name="dc:identifier" type="textfield">
<description>A unique reference to the resource; In this instance, the accession number or collection number.</description>
</element>
<element label="Language" name="dc:language" type="select">
<description>The language of the intellectual content of the resource.</description>
<authoritative_list>
<item field="eng">English</item>
<item field="fre">French</item>
</authoritative_list>
</element>
<element label="Relation" name="dc:relation" type="textfield">
<description>Reference to a related resource.</description>
</element>
<element label="Rights Management" name="dc:rights" type="textarea">
<description>Information about intellectual property rights, copyright, and various property rights.</description>
</element>
</form_elements>
</ingest_form>
</content_model>

143
fedora_repository.module

@ -1131,6 +1131,11 @@ function fedora_repository_theme() {
'element' => NULL 'element' => NULL
), ),
), ),
'fedora_repository_solution_packs_list' => array(
'arguments' => array(
'solution_packs' => NULL,
),
),
); );
} }
@ -1731,3 +1736,141 @@ function fedora_repository_display_schema($file) {
return; return;
} }
/**
* Invokes a hook to any dependent modules asking them if their installations require
* any fedora objects to be present. Modules implementing this hook should return an array
* of arrays of the form:
*
* array( 'pid', 'path-to-foxml-file', 'dsid', 'path-to-datastream-file', int dsversion)
*
* where the last three options are optional. A module can either point to a simple
* foxml file to install, or can specify a datastreamstream to check for, with a
* path to load the datastream from if it isn't there. Optionally a version number
* can be included, to enable updating of content model or collection policy streams
* that may have been updated. THis is a simple whole number that should be incremented
* when changed. This value appears in as an attribute of the topmost element of the stream,
* e.g.,:
*
* <?xml version="1.0" encoding="utf-8"?> <content_model name="Collection" version="2" ...
*
* Datastreams which don't have this element are assumed to be at version 0.
*/
function fedora_repository_solution_packs_page() {
$enabled_solution_packs = module_invoke_all('required_fedora_objects');
$output = '';
foreach ($enabled_solution_packs as $solution_pack_name => $objects) {
$output .= drupal_get_form('fedora_repository_solution_pack_form', $solution_pack_name, $objects);
}
return $output;
}
/**
* Check for installed objects and add a 'Update' or 'Install' button if some objects are missing.
* @param array $solution_pack
*/
function fedora_repository_solution_pack_form($form, $solution_pack_name, $objects = array()) {
// Check each object to see if it is in the repository.
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$form = array();
$form['solution_pack'] = array(
'#type' => 'fieldset',
'#title' => $solution_pack_name,
);
$needs_update = FALSE;
$needs_install = FALSE;
$form['solution_pack']['objects'] = array(
'#type' => 'fieldset',
'#title' => "Objects",
// '#tree' => TRUE,
'#weight' => 10,
'#attributes' => array('class' => 'collapsed'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
foreach($objects as $object) {
if (isset($object['pid'])) {
$pid = $object['pid'];
$item = new Fedora_Item($pid);
if (!$item->exists()) {
$needs_install = TRUE;
$object['install'] = TRUE;
}
elseif (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) {
// Check if the datastream is versioned and needs updating.
$installed_version = fedora_repository_get_islandora_datastream_version($item, $object['dsid']);
$available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $object['datastream_file']);
if ($available_version > $installed_version) {
$needs_update = TRUE;
$object['update'] = TRUE;
}
}
$form['solution_pack']['objects'][$object['pid']] = array(
'#title' => $object['pid'],
'#value' => $object['pid'],
'#type' => 'item',
);
}
}
$form['install'] = array(
'#name' => 'install',
'#value' => t('Install'),
'#disabled' => !$needs_install,
'#type' => 'button',
'#action' => 'install',
);
$form['update'] = array(
'#name' => 'update',
'#value' => t('Update'),
'#disabled' => !$needs_update,
'#type' => 'button',
'#action' => 'update',
);
return $form;
}
/**
* Content model, collection view and collection policy datastreams may now optionally define a version
* number in their top-level XML element as an attribute, as in:
* <content_model name="Collection" version="2" ...
*
* @param Fedora_Item $item
* @param string $dsid
* @param string $datastream_file
* @return int, or NULL if no version attribute was found.
*/
function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) {
$return = NULL;
if (isset($item)) {
$doc = simplexml_load_string($item->get_datastream_dissemination($dsid));
} elseif (isset($datastream_file)) {
$doc = simplexml_load_file($datastream_file);
}
if (!empty($doc)) {
$attrs = $doc->attributes();
foreach($attrs as $name => $value) {
if ($name == 'version') {
$return = (int) $value;
break;
}
}
}
return $return;
}
function theme_fedora_repository_solution_packs_list($solution_packs) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$output = '';
$header = array();
$rows = array();
drupal_add_css(drupal_get_path('module', 'update') .'/update.css');
return $output;
}

6
formClass.inc

@ -42,9 +42,9 @@ class formClass {
); );
$items['admin/settings/fedora_repository/demoobjects'] = array( $items['admin/settings/fedora_repository/demoobjects'] = array(
'title' => t('Install demos'), 'title' => t('Solution Packs'),
'description' => t('Install example content models and collections to get started using Islandora and Fedora.'), 'description' => t('Install content models and collections required by installed solution packs.'),
'page callback' => 'fedora_repository_install_demos_page', 'page callback' => 'fedora_repository_solution_packs_page',
'access arguments' => array('add fedora datastreams'), 'access arguments' => array('add fedora datastreams'),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
); );

0
plugins/Newspaper.inc → plugins/islandora_newspaper/Newspaper.inc

7
plugins/islandora_newspaper/islandora_newspaper.info

@ -0,0 +1,7 @@
; $Id$
name = Islandora Newspaper
description = Content models and support code for Newspapers
package = Fedora Repository
dependencies[] = fedora_repository
version = 6.1dev
core = 6.x

41
plugins/islandora_newspaper/islandora_newspaper.module

@ -0,0 +1,41 @@
<?php
/**
* Implementation of hook_requried_fedora_objects()
*/
function islandora_newspaper_required_fedora_objects() {
// array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required)
$module_path = drupal_get_path('module', 'islandora_newspaper');
return array(
'Islandora Newspapers' => array(
array(
'foxml_file' => "$module_path/newspapers_issueCModel.xml",
'pid' => 'newspapers:issueCModel',
'dsid' => NULL,
'datastream_file' => NULL,
'dsversion' => NULL,
),
array(
'foxml_file' => "$module_path/newspapers_pageCModel.xml",
'pid' => 'newspapers:pageCModel',
'dsid' => NULL,
'datastream_file' => NULL,
'dsversion' => NULL,
),
array(
'foxml_file' => "$module_path/newspapers_viewerSdep-issueCModel.xml",
'pid' => 'newspapers:viewerSdep-issueCModel',
'dsid' => NULL,
'datastream_file' => NULL,
'dsversion' => NULL,
),
array(
'foxml_file' => "$module_path/newspapers_viewerSdep-pageCModel.xml",
'pid' => 'newspapers:viewerSdep-pageCModel',
'dsid' => NULL,
'datastream_file' => NULL,
'dsversion' => NULL,
),
),
);
}

0
plugins/newspaper/newspapers_guardian.xml → plugins/islandora_newspaper/newspapers_guardian.xml

0
plugins/newspaper/newspapers_issueCModel.xml → plugins/islandora_newspaper/newspapers_issueCModel.xml

0
plugins/newspaper/newspapers_pageCModel.xml → plugins/islandora_newspaper/newspapers_pageCModel.xml

0
plugins/newspaper/newspapers_viewerSdep-issueCModel.xml → plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml

0
plugins/newspaper/newspapers_viewerSdep-pageCModel.xml → plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml

Loading…
Cancel
Save