# HG changeset patch # User casties # Date 1147809392 -7200 # Node ID f77f6cb40c4ff3d45200c6dfa4688de1500b23a7 # Parent 3ff9da4b7c87cd2dc1fef9a7b5fa95967fd0f5b2 now with access-conditions tag diff -r 3ff9da4b7c87 -r f77f6cb40c4f makemeta-lib.pl --- a/makemeta-lib.pl Tue May 16 20:58:21 2006 +0200 +++ b/makemeta-lib.pl Tue May 16 21:56:32 2006 +0200 @@ -10,7 +10,7 @@ $|=1; # program version -my $version = "0.2.3 (16.5.2006 ROC)"; +my $version = "0.2.4 (16.5.2006 ROC)"; my $help = "use: makemeta-lib [options] file.xml options: @@ -20,6 +20,7 @@ -cw-mode mode for copying einstein_cw archive documents -digifiles-mode mode for copying files from digifiles -map-file=mapfile.xml digilib mapping file (for digifiles mode) + -access=free adds free access tag (use access=mpiwg for restricted access) "; logger("INFO", "makemeta-lib $version"); @@ -153,6 +154,9 @@ my $mapping_doc; my $mapping_root; +# access type +my $access_type = (exists $$args{'access'}) ? $$args{'access'} : ""; + # index.meta namespace (not really implemented!) my $namespace = ""; @@ -276,7 +280,7 @@ my $online_base = '/mpiwg/online/permanent'; my $src_dir = find_online_dir($input_node, $online_base, 'pageimg'); my $dest_id = sstrip($input_node->findvalue("fm:$online_id_field")); - if (! $dest_id) { + if ((! $dest_id)||(! $src_dir)) { logger('ERROR', "no ID field for online permanent entry"); $errcnt++; return; @@ -455,7 +459,16 @@ # derived-from if ($derived_from) { create_text_path('derived-from/archive-path', $derived_from, $index_root, $namespace); - } + } + # access + if ($access_type) { + if ($access_type eq "free") { + create_element_path('access-conditions/access@type=free', $index_root, $namespace); + } else { + my $acc_tag = create_element_path('access-conditions/access@type=institution', $index_root, $namespace); + create_text_path('name', $access_type, $acc_tag, $namespace); + } + } # convert bib entries my $cnt = convert_bib($input_node, $index_root, $index_doc);