diff --git a/content_models/COLLECTIONCM.xml b/content_models/COLLECTIONCM.xml index 85ed18d1..9dae85ef 100644 --- a/content_models/COLLECTIONCM.xml +++ b/content_models/COLLECTIONCM.xml @@ -1 +1,89 @@ - text/xml text/plain application/xml The name given to the resource An entity primarily responsible for making the content of the resource such as a person, organization or service. An entity primarily responsible for making the content of the resource such as a person, organization or service. none Multi Media image meeting presentation sound text Examples include an abstract, table of contents, or free-text account of the content of the resource. An entity, (including persons, organizations, or services), responsible for making the resource available. An entity responsible for contributing to the content of the resource such as a person, organization or service. Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. none collection dataset event image interactive resource model party physical object place service software sound text A reference to a resource from which the present resource is derived. A unique reference to the resource; In this instance, the accession number or collection number. The language of the intellectual content of the resource. English French Reference to a related resource. Information about intellectual property rights, copyright, and various property rights. \ No newline at end of file + + + + text/xml + text/plain + application/xml + + + + + + + + + + + + + + The name given to the resource + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + none + Multi Media + image + meeting + presentation + sound + text + + + + Examples include an abstract, table of contents, or free-text account of the content of the resource. + + + An entity, (including persons, organizations, or services), responsible for making the resource available. + + + An entity responsible for contributing to the content of the resource such as a person, organization or service. + + + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + + + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + + none + collection + dataset + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the present resource is derived. + + + A unique reference to the resource; In this instance, the accession number or collection number. + + + The language of the intellectual content of the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property rights, copyright, and various property rights. + + + + diff --git a/fedora_repository.module b/fedora_repository.module index 6a2cfc72..e01f6e48 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1131,6 +1131,11 @@ function fedora_repository_theme() { 'element' => NULL ), ), + 'fedora_repository_solution_packs_list' => array( + 'arguments' => array( + 'solution_packs' => NULL, + ), + ), ); } @@ -1731,3 +1736,141 @@ function fedora_repository_display_schema($file) { 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.,: + * + * $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: + * 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; +} \ No newline at end of file diff --git a/formClass.inc b/formClass.inc index fed6d2aa..a0fed3e6 100644 --- a/formClass.inc +++ b/formClass.inc @@ -42,9 +42,9 @@ class formClass { ); $items['admin/settings/fedora_repository/demoobjects'] = array( - 'title' => t('Install demos'), - 'description' => t('Install example content models and collections to get started using Islandora and Fedora.'), - 'page callback' => 'fedora_repository_install_demos_page', + 'title' => t('Solution Packs'), + 'description' => t('Install content models and collections required by installed solution packs.'), + 'page callback' => 'fedora_repository_solution_packs_page', 'access arguments' => array('add fedora datastreams'), 'type' => MENU_LOCAL_TASK, ); diff --git a/plugins/Newspaper.inc b/plugins/islandora_newspaper/Newspaper.inc similarity index 100% rename from plugins/Newspaper.inc rename to plugins/islandora_newspaper/Newspaper.inc diff --git a/plugins/islandora_newspaper/islandora_newspaper.info b/plugins/islandora_newspaper/islandora_newspaper.info new file mode 100644 index 00000000..bbc884a2 --- /dev/null +++ b/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 diff --git a/plugins/islandora_newspaper/islandora_newspaper.module b/plugins/islandora_newspaper/islandora_newspaper.module new file mode 100644 index 00000000..9a3a567a --- /dev/null +++ b/plugins/islandora_newspaper/islandora_newspaper.module @@ -0,0 +1,41 @@ + 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, + ), + ), + ); +} \ No newline at end of file diff --git a/plugins/newspaper/newspapers_guardian.xml b/plugins/islandora_newspaper/newspapers_guardian.xml similarity index 100% rename from plugins/newspaper/newspapers_guardian.xml rename to plugins/islandora_newspaper/newspapers_guardian.xml diff --git a/plugins/newspaper/newspapers_issueCModel.xml b/plugins/islandora_newspaper/newspapers_issueCModel.xml similarity index 100% rename from plugins/newspaper/newspapers_issueCModel.xml rename to plugins/islandora_newspaper/newspapers_issueCModel.xml diff --git a/plugins/newspaper/newspapers_pageCModel.xml b/plugins/islandora_newspaper/newspapers_pageCModel.xml similarity index 100% rename from plugins/newspaper/newspapers_pageCModel.xml rename to plugins/islandora_newspaper/newspapers_pageCModel.xml diff --git a/plugins/newspaper/newspapers_viewerSdep-issueCModel.xml b/plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml similarity index 100% rename from plugins/newspaper/newspapers_viewerSdep-issueCModel.xml rename to plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml diff --git a/plugins/newspaper/newspapers_viewerSdep-pageCModel.xml b/plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml similarity index 100% rename from plugins/newspaper/newspapers_viewerSdep-pageCModel.xml rename to plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml