Ignore:
Timestamp:
2011-02-22T21:36:00+13:00 (13 years ago)
Author:
ak19
Message:

First part of changes for getting OpenOffice conversion to work on a remote WINDOWS Greenstone (Linux was working already).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/open-office/trunk/src/perllib/plugins/OpenOfficeConverter.pm

    r23668 r23731  
    6262    }
    6363    else {
    64         # test to see if soffice in in path
    65         my $cmd = "soffice -headless 2>&1";
    66 
    67 
    68         if ($ENV{'GSDLOS'} =~ m/^windows$/) {
     64        # test to see if soffice is in path     
     65        my $cmd = "soffice -headless 2>&1"; # for linux and mac
     66
     67        if ($ENV{'GSDLOS'} =~ m/^windows$/) {       
     68        if(!defined $ENV{'SOFFICE_HOST'}) {
     69            $ENV{'SOFFICE_HOST'} = "localhost";
     70        }
     71        if(!defined $ENV{'SOFFICE_PORT'}) {
     72            $ENV{'SOFFICE_PORT'} = "8200";
     73        }
     74        # important to have this set when the Greenstone server
     75        # and open office is on a remote windows machine
     76        if(!defined $ENV{'SOFFICE_HOME'}) {
     77            $ENV{'SOFFICE_HOME'} = &util::filename_cat($ENV{'ProgramFiles'},"OpenOffice.org 3");
     78        }
    6979        my $ooffice_dir_guess =
    70             &util::filename_cat($ENV{'ProgramFiles'},"OpenOffice.org 3",
    71                     "program");
     80            &util::filename_cat($ENV{'SOFFICE_HOME'},"program");
    7281        if (-d  $ooffice_dir_guess) {
    7382            &util::envvar_append("PATH",$ooffice_dir_guess);
    7483        }
     84
     85        # for windows, when working on a remote system, want to be able to start OO if
     86        # not already running. We'll use the uno socket method to do so. Else client-gli
     87        # tends to hang, waiting for the prompt to return after OO has been started up
     88        # (which doesn't happen, so need to Ctrl-C GLI and run it again for it to work).
     89        $cmd = "start \"soffice process\" soffice \"-accept=socket,host=$ENV{'SOFFICE_HOST'},port=$ENV{'SOFFICE_PORT'};urp;StarOffice.ServiceManager\" -headless 2>&1";
    7590        $cmd .= " >nul";
     91        #print STDERR "***** Tried to start-up OpenOffice with:\n$cmd\n";
    7692        }
    7793        else {
     
    198214    my $jodjar = &util::filename_cat($gextoo_home,"lib","java","jodconverter.jar");
    199215
     216    # debugging: print out all the env vars, when import's verbosity is high
     217    #foreach my $key (sort(keys %ENV)) {
     218    #   print $outhandle "$key = $ENV{$key}\n";
     219    #}
     220
     221#    *If* SOFFICE_HOME\program was not added to the PATH, *another* way is to insert:
     222#    -Doffice.home=C:\\PROGRA~1\\OPENOF~1.ORG
     223#    into the command to launch jodconverter so that, when using the remote GS server
     224#    on Windows, jodconverter can find the openoffice installation:
     225#    my $office_short_path = Win32::GetShortPathName($ENV{'SOFFICE_HOME'});
     226#    my $convert_cmd = "java -Doffice.home=\"".$office_short_path."\" -jar \"$jodjar\"";
     227
    200228    my $convert_cmd = "java -jar \"$jodjar\"";
    201229    $convert_cmd .= " \"$source_file_full_path\" \"$target_file_path\"";
Note: See TracChangeset for help on using the changeset viewer.