changeset 29:f77f6cb40c4f

now with access-conditions tag
author casties
date Tue, 16 May 2006 21:56:32 +0200
parents 3ff9da4b7c87
children 398ef4b8f072
files makemeta-lib.pl
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);