Changeset 900
- Timestamp:
- 2000-02-03T10:06:40+13:00 (24 years ago)
- Location:
- trunk/gsdl/perllib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/mgbuildproc.pm
r810 r900 34 34 use docproc; 35 35 use util; 36 37 36 38 37 BEGIN { … … 187 186 sub assoc_files { 188 187 my $self = shift (@_); 189 my ($doc_obj) = @_; 188 my ($doc_obj, $archivedir) = @_; 189 my ($afile); 190 190 191 foreach $assoc_file (@{$doc_obj->get_assoc_files()}) { 192 $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]); 191 foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) { 192 # if assoc file contains directory structure of 193 # its own use it, otherwise use HASH... directory 194 if ($assoc_file->[1] =~ /[\/\\]/) { 195 $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]); 196 } else { 197 $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]); 198 } 193 199 &util::hard_link ($assoc_file->[0], $afile); 194 200 } … … 201 207 # $handle = "main::STDOUT"; 202 208 203 $self->assoc_files ($doc_obj);204 205 209 my $doctype = $doc_obj->get_doc_type(); 206 210 207 211 # only output this document if it is one to be indexed 208 212 return if ($doctype ne "indexed_doc"); 213 214 my ($archivedir) = $filename =~ /^(.*?)(?:\/|\\)[^\/\\]*$/; 215 $archivedir = "" unless defined $archivedir; 216 $archivedir =~ s/\\/\//g; 217 $archivedir =~ s/^\/+//; 218 $archivedir =~ s/\/+$//; 219 220 $self->assoc_files ($doc_obj, $archivedir); 209 221 210 222 # this is another document … … 239 251 # output all the section metadata 240 252 my $metadata = $doc_obj->get_all_metadata ($section); 241 foreach $pair (@$metadata) {253 foreach my $pair (@$metadata) { 242 254 my ($field, $value) = (@$pair); 243 255 … … 266 278 # output archivedir if at top level 267 279 if ($section eq $doc_obj->get_top_section()) { 268 my ($archivedir) = $filename =~ /^(.*?)(?:\/|\\)[^\/\\]*$/;269 $archivedir = "" unless defined $archivedir;270 $archivedir =~ s/\\/\//g;271 $archivedir =~ s/^\/+//;272 $archivedir =~ s/\/+$//;273 280 print $handle "<archivedir>$archivedir\n"; 274 281 } … … 285 292 print $handle "<contains>"; 286 293 my $firstchild = 1; 287 foreach $child (@$children) {294 foreach my $child (@$children) { 288 295 print $handle ";" unless $firstchild; 289 296 $firstchild = 0; … … 348 355 349 356 # see if this document belongs to this subcollection 350 foreach $indexexp (@{$self->{'indexexparr'}}) {357 foreach my $indexexp (@{$self->{'indexexparr'}}) { 351 358 $indexed_doc = 0; 352 359 my ($field, $exp, $options) = split /\//, $indexexp; … … 397 404 if ($indexed_doc) { 398 405 $self->{'num_bytes'} += $doc_obj->get_text_length ($section); 399 foreach $field (split (/,/, $fields)) {406 foreach my $field (split (/,/, $fields)) { 400 407 # only deal with this field if it doesn't start with top or 401 408 # this is the first section -
trunk/gsdl/perllib/plugins/GMLPlug.pm
r863 r900 171 171 # add the associated files 172 172 $assoc_files = $doc_obj->get_metadata($doc_obj->get_top_section(), "gsdlassocfile"); 173 my ($assoc_file_info );173 my ($assoc_file_info, $afile); 174 174 foreach $assoc_file_info (@$assoc_files) { 175 175 my ($assoc_file, $mime_type, $dir) = split (":", $assoc_file_info); 176 $dir = "" unless defined $dir; 176 if (defined $dir && $dir =~ /\w/) { 177 $afile = &util::filename_cat($dir, $assoc_file); 178 } else { 179 $afile = $assoc_file; 180 } 177 181 $doc_obj->associate_file(&util::filename_cat($parent_dir, $assoc_file), 178 &util::filename_cat($dir, $assoc_file), $mime_type);182 $afile, $mime_type); 179 183 } 180 184 $doc_obj->delete_metadata($doc_obj->get_top_section(), "gsdlassocfile"); -
trunk/gsdl/perllib/plugins/HBPlug.pm
r796 r900 141 141 # fix up the image links 142 142 $section =~ s/<img[^>]*?src=\"?([^\">]+)\"?[^>]*>/ 143 <center><img src=\"_httpcoll ection_\/archives\/_thisOID_\/$1\"><\/center><br>/ig;143 <center><img src=\"_httpcollimg_\/_thisOID_\/$1\"><\/center><br>/ig; 144 144 $section =~ s/<<I>>\s*([^\.]+\.(png|jpg|gif))/ 145 <center><img src=\"_httpcoll ection_\/archives\/_thisOID_\/$1\"><\/center><br>/ig;145 <center><img src=\"_httpcollimg_\/_thisOID_\/$1\"><\/center><br>/ig; 146 146 147 147 return $section; -
trunk/gsdl/perllib/plugins/HTMLPlug.pm
r897 r900 71 71 print STDERR " -w3mir Set if w3mir was used to generate input file structure.\n"; 72 72 print STDERR " w3mir \n"; 73 print STDERR " -rename_assoc_files Renames files associated with documents (e.g. images). Also\n"; 74 print STDERR " creates much shallower directory structure (useful when creating\n"; 75 print STDERR " collections to go on cd-rom).\n\n"; 73 76 } 74 77 … … 84 87 q^no_metadata^, \$self->{'no_metadata'}, 85 88 q^metadata_fields/.*/Title^, \$self->{'metadata_fields'}, 86 q^w3mir^, \$self->{'w3mir'})) { 89 q^w3mir^, \$self->{'w3mir'}, 90 q^rename_assoc_files^, \$self->{'rename_assoc_files'})) { 87 91 &print_usage(); 88 92 die "\n"; … … 243 247 $filename = &util::filename_cat ($base_dir, $filename); 244 248 my ($ext) = $filename =~ /(\.[^\.]*)$/; 245 if (defined $self->{'aux_files'}->{$href}) { 246 $newname = $self->{'aux_files'}->{$href}->{'dir_num'} . "/" . 247 $self->{'aux_files'}->{$href}->{'file_num'} . $ext; 249 if ($self->{'rename_assoc_files'}) { 250 if (defined $self->{'aux_files'}->{$href}) { 251 $newname = $self->{'aux_files'}->{$href}->{'dir_num'} . "/" . 252 $self->{'aux_files'}->{$href}->{'file_num'} . $ext; 253 } else { 254 $newname = $self->{'dir_num'} . "/" . $self->{'file_num'} . $ext; 255 $self->inc_filecount (); 256 } 257 $doc_obj->associate_file($filename, $newname, undef, $section); 258 return "_httpcollimg_/$newname"; 259 248 260 } else { 249 $newname = $self->{'dir_num'} . "/" . $self->{'file_num'} . $ext; 250 $self->inc_filecount (); 251 } 252 $doc_obj->associate_file($filename, $newname, undef, $section); 253 return "_httpcollimg_/$newname"; 261 ($newname) = $filename =~ /([^\/\\]*)$/; 262 $doc_obj->associate_file($filename, $newname, undef, $section); 263 return "_httpcollimg_/_thisOID_/$newname"; 264 } 254 265 } 255 266
Note:
See TracChangeset
for help on using the changeset viewer.