- Timestamp:
- 2008-05-29T13:29:54+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/branches/customizingGreenstone3/web/WEB-INF/cgi/gliserver4gs3.pl
r14602 r15787 118 118 while (1) { } 119 119 } 120 elsif ($cmd eq "file-exists") { 121 &file_exists($gsdl_cgi); 122 } 120 123 else { 121 124 $gsdl_cgi->generate_error("Unrecognised command: '$cmd'"); … … 542 545 } 543 546 547 # Method that will check if the given file exists 548 # No error message: all messages generated are OK messages 549 # This method will simply state whether the file exists or does not exist. 550 sub file_exists 551 { 552 my ($gsdl_cgi, $username, $timestamp) = @_; 553 554 my ($gsdl_cgi) = @_; 555 556 my $collection = $gsdl_cgi->clean_param("c"); 557 if ((!defined $collection) || ($collection =~ m/^\s*$/)) { 558 $gsdl_cgi->generate_error("No collection specified."); 559 } 560 my $file = $gsdl_cgi->clean_param("file"); 561 if ((!defined $file) || ($file =~ m/^\s*$/)) { 562 $gsdl_cgi->generate_error("No file specified."); 563 } 564 $file =~ s/\|/&util::get_dirsep()/eg; # Convert the '|' characters into whatever is right for this OS 565 566 # Not necessary: checking whether the user is authenticated to query existance of the file 567 #&authenticate_user($gsdl_cgi, $username, $collection); 568 569 my $gsdlhome = $ENV{'GSDLHOME'}; 570 my $collection_directory = &util::filename_cat($gsdlhome, "collect", $collection); 571 $gsdl_cgi->checked_chdir($collection_directory); 572 573 # Check that the collection file exists 574 if (-e $file) { 575 $gsdl_cgi->generate_ok_message("File $file exists."); 576 } else { 577 $gsdl_cgi->generate_ok_message("File $file does not exist."); 578 } 579 } 544 580 545 581 sub download_collection_file … … 862 898 &lock_collection($gsdl_cgi, $username, $collection, $site) unless ($script eq "mkcol.pl"); 863 899 864 # Last argument is the collection name, except for explode_metadata_database.pl 900 # Last argument is the collection name, except for explode_metadata_database.pl and 901 # replace_srcdoc_with_html (where there's a "file" option followed by the filename. These two preceed the collection name) 865 902 my $perl_args = $collection; 866 if ($script eq "explode_metadata_database.pl" ) {867 # Last argument is the file to be exploded 903 if ($script eq "explode_metadata_database.pl" || $script eq "replace_srcdoc_with_html.pl") { 904 # Last argument is the file to be exploded or it is the file to be replaced with its html version 868 905 my $file = $gsdl_cgi->clean_param("file"); 869 906 if ((!defined $file) || ($file =~ m/^\s*$/)) { … … 871 908 } 872 909 $gsdl_cgi->delete("file"); 910 $file =~ s/ /\\ /g; # escape all spaces in filename with a backslash, i.e. "\ ". 873 911 $perl_args = $file; 874 912 }
Note:
See TracChangeset
for help on using the changeset viewer.