View | Details | Raw Unified | Return to bug 6679
Collapse All | Expand All

(-)a/C4/ImportExportFramework.pm (-24 / +25 lines)
Lines 515-521 sub _createTmpDir Link Here
515
        mkdir $tempdir;
515
        mkdir $tempdir;
516
    };
516
    };
517
    if ($@) {
517
    if ($@) {
518
        return undef;
518
        return;
519
    } else {
519
    } else {
520
        return $tempdir;
520
        return $tempdir;
521
    }
521
    }
Lines 547-573 sub createODS Link Here
547
        $tempdir = _createTmpDir($tmp);
547
        $tempdir = _createTmpDir($tmp);
548
    }
548
    }
549
    if ($tempdir) {
549
    if ($tempdir) {
550
        my $fh;
550
        # populate tempdir directory with the ods elements
551
        # populate tempdir directory with the ods elements
551
        eval {
552
        eval {
552
            if (open(OUT, "> $tempdir/content.xml")) {
553
            if (open($fh, '>',  "$tempdir/content.xml")) {
553
                print OUT $strContent;
554
                print {$fh} $strContent;
554
                close(OUT);
555
                close($fh);
555
            }
556
            }
556
            if (open(OUT, "> $tempdir/mimetype")) {
557
            if (open($fh, '>', "$tempdir/mimetype")) {
557
                print OUT 'application/vnd.oasis.opendocument.spreadsheet';
558
                print {$fh} 'application/vnd.oasis.opendocument.spreadsheet';
558
                close(OUT);
559
                close($fh);
559
            }
560
            }
560
            if (open(OUT, "> $tempdir/meta.xml")) {
561
            if (open($fh, '>', "$tempdir/meta.xml")) {
561
                print OUT _getMeta($lang);
562
                print {$fh} _getMeta($lang);
562
                close(OUT);
563
                close($fh);
563
            }
564
            }
564
            if (open(OUT, "> $tempdir/styles.xml")) {
565
            if (open($fh, '>', "$tempdir/styles.xml")) {
565
                print OUT ODS_STYLES_STR;
566
                print {$fh} ODS_STYLES_STR;
566
                close(OUT);
567
                close($fh);
567
            }
568
            }
568
            if (open(OUT, "> $tempdir/settings.xml")) {
569
            if (open($fh, '>', "$tempdir/settings.xml")) {
569
                print OUT ODS_SETTINGS_STR;
570
                print {$fh} ODS_SETTINGS_STR;
570
                close(OUT);
571
                close($fh);
571
            }
572
            }
572
            mkdir($tempdir.'/META-INF/');
573
            mkdir($tempdir.'/META-INF/');
573
            mkdir($tempdir.'/Configurations2/');
574
            mkdir($tempdir.'/Configurations2/');
Lines 579-587 sub createODS Link Here
579
            mkdir($tempdir.'/Configurations2/menubar/');
580
            mkdir($tempdir.'/Configurations2/menubar/');
580
            mkdir($tempdir.'/Configurations2/progressbar/');
581
            mkdir($tempdir.'/Configurations2/progressbar/');
581
            mkdir($tempdir.'/Configurations2/toolbar/');
582
            mkdir($tempdir.'/Configurations2/toolbar/');
582
            if (open(OUT, "> $tempdir/META-INF/manifest.xml")) {
583
583
                print OUT ODS_MANIFEST_STR;
584
            if (open($fh, '>', "$tempdir/META-INF/manifest.xml")) {
584
                close(OUT);
585
                print {$fh} ODS_MANIFEST_STR;
586
                close($fh);
585
            }
587
            }
586
        };
588
        };
587
        if ($@) {
589
        if ($@) {
Lines 604-616 sub createODS Link Here
604
            my $ok = 0;
606
            my $ok = 0;
605
            # read ods file and return as a string
607
            # read ods file and return as a string
606
            if (-f "$tempdir/new.ods") {
608
            if (-f "$tempdir/new.ods") {
607
                if (open (MYFILE, "$tempdir/new.ods")) {
609
                if (open ($fh, '<', "$tempdir/new.ods")) {
608
                    binmode MYFILE;
610
                    binmode $fh;
609
                    my $buffer;
611
                    my $buffer;
610
                    while (read (MYFILE, $buffer, 65536)) {
612
                    while (read ($fh, $buffer, 65536)) {
611
                        $$strODSRef .= $buffer;
613
                        $$strODSRef .= $buffer;
612
                    }
614
                    }
613
                    close(MYFILE);
615
                    close($fh);
614
                    $ok = 1;
616
                    $ok = 1;
615
                }
617
                }
616
            }
618
            }
617
- 

Return to bug 6679