Browse Source

Merge pull request #71 from ajstanley/6.x

6.x
pull/73/merge
Ben Woodhead 13 years ago
parent
commit
762801e988
  1. 2
      CollectionClass.inc
  2. 13
      api/fedora_utils.inc

2
CollectionClass.inc

@ -68,7 +68,7 @@ class CollectionClass {
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
if (!isset($limit)) { if (!isset($limit)) {
$limit = 1000; $limit = 10000;
} }
if (!isset($offset)) { if (!isset($offset)) {
$offset = 0; $offset = 0;

13
api/fedora_utils.inc

@ -236,6 +236,8 @@ function fix_dsid($dsid) {
function get_collections_as_option_array() { function get_collections_as_option_array() {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE);
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
$query = 'select $object $title from <#ri> $query = 'select $object $title from <#ri>
where ($object <dc:title> $title where ($object <dc:title> $title
and $object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel> and $object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel>
@ -247,13 +249,22 @@ function get_collections_as_option_array() {
$list = explode("\n", $content); $list = explode("\n", $content);
array_shift($list); array_shift($list);
$list = preg_replace('/info:fedora\//', '', $list); $list = preg_replace('/info:fedora\//', '', $list);
foreach ($namespaces as $namespace) {
$trimmed_names[] = trim($namespace);
}
$options = array(); $options = array();
foreach ($list as $item) { //removes blanks foreach ($list as $item) { //removes blanks
if ($item) { if ($item) {
$parts = explode(',', $item); $parts = explode(',', $item);
$options[$parts[0]] = $parts[1]; $namespace = explode(':', $parts[0]);
$namespace = trim($namespace[0]);
$bool = in_array($namespace, $trimmed_names);
if (!$restricted || in_array($namespace, $trimmed_names)) {
$options[$parts[0]] = $parts[1];
}
} }
} }
unset($options['islandora:ContentModelCollection']); unset($options['islandora:ContentModelCollection']);
return $options; return $options;
} }

Loading…
Cancel
Save