Ignore:
Timestamp:
2013-01-08T14:13:09+13:00 (11 years ago)
Author:
davidb
Message:

The html to expeditee feature will now obtain a matching assocfilepath for each frame and write this value out to the frame as a piece of text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/perllib/ExpediteeFrameIO.pm

    r26511 r26596  
    217217{
    218218    my $self = shift @_;
    219     my ($x, $y, $text, $w, $attr) = @_;
    220 
    221     my %attr_copy = %$attr; # make a private copy of 'attr'
    222 
    223     $self->setTextDefaultAttributes(\%attr_copy);
    224     my $items = $self->{'items'};
    225 
    226     $attr_copy{'P'} = "$x $y";
    227     $attr_copy{'T'} = $text;
    228     $attr_copy{'w'} = "-$w" if (defined $w);
    229 
    230     return $self->_addItem("T",\%attr_copy);
     219    my ($x,$y,$text,$w,$attr) = @_;
     220   
     221    my %attr_copy = %$attr; #make a private copy of 'attr'
     222   
     223    $self->setTextDefaultAttributes(\%attr_copy);
     224    my $items = $self->{'items'};
     225   
     226    $attr_copy{'P'} = "$x $y";
     227    $attr_copy{'T'} = $text;
     228    $attr_copy{'w'} = "-$w" if (defined $w);
     229   
     230    return $self->_addItem("T",\%attr_copy);
    231231}
    232232
     
    422422}
    423423
    424 sub saveFrame
    425 {
    426     my $self = shift @_;
    427     my ($file) = @_;
     424sub saveZeroFrame
     425{
     426    my $self = shift @_;
     427    my $file = "0.exp";
    428428
    429429    my $filename = &util::filename_cat($self->{'output_dir'},$file);
    430430
    431431    my $status = undef;
     432
     433    my $username = $self->{'username'};
     434    my $fdate = getFormattedDate();
    432435
    433436    if (open(FOUT,">$filename")) {
    434437    binmode(FOUT,":utf8");
     438   
     439    print FOUT <<EOT;
     440   
     441V 1
     442p 4
     443U $username
     444D $fdate
     445M $username
     446d $fdate
     447Z
     448
     449Z
     450
     451Z
     452
     453Z
     454   
     455EOT
     456
     457    close(FOUT);
     458    $status = 1;
     459    }
     460    else {
     461    print STDERR "ExpediteeFrameIO::saveZeroFrame() Failed to open $filename for output\n";
     462    $status = 0;
     463    }
     464
     465    return $status;
     466}
     467
     468sub writeAssocFilePath
     469{
     470    my $self = shift @_;
     471    my ($assoc) = @_;
     472   
     473    my $x = 318;
     474    my $y = 123;
     475    my $text = "\@assocfilepath: $assoc";
     476   
     477    my $attr = {};
     478   
     479    #add data: gsdl.Metadata: assocfilepath to this piece of text.
     480    $attr->{'D'} = "gsdl.Metadata: assocfilepath";
     481   
     482    $self->addText($x,$y,$text,undef,$attr);
     483}
     484
     485sub saveFrame
     486{
     487    my $self = shift @_;
     488    my ($file,$assoc) = @_;
     489
     490    if ($file eq "1.exp") {
     491        $self->saveZeroFrame();
     492    }
     493
     494    my $filename = &util::filename_cat($self->{'output_dir'},$file);
     495
     496    my $status = undef;
     497
     498    if (open(FOUT,">$filename")) {
     499    binmode(FOUT,":utf8");
     500   
     501
     502    $self->writeAssocFilePath($assoc);                      #write assocfilepath out to frame.
     503   
    435504    $self->writeHeaderSection();
    436505    $self->writeItemsSection();
     
    438507    $self->writeConstraintsSection();
    439508    $self->writeStatisticsSection();
    440 
     509   
     510   
     511   
    441512    close(FOUT);
    442513    $status = 1;
     
    486557        $img_url =~ s/^http:\/\/(.*?)\/greenstone3(.*?)\///;
    487558        if ($img_url =~ m/^interfaces\//) {
    488         $img_url = "images/$img_url";
     559        $img_url = "greenstone3-svn/web/$img_url";
    489560        }
    490561        elsif ($img_url =~ m/^sites\//) {
    491         $img_url =~ s/^sites\/(.*?)\//images\//;
     562#       if ($img_url =~ m/^sites\//) {
     563#       $img_url =~ s/^sites\/(.*?)\//images\//;
     564            $img_url = "greenstone3-svn/web/$img_url";
    492565        }
    493566
     
    546619    #writes frameset name concatenated with last frame number in the set to the frame.inf file.
    547620        my $getFramesetName = $self->{'output_dir'};
    548     print FNOUT "$getFramesetName$last_frame_number\n";
    549 
     621       
    550622   
    551623    close(FNOUT);
Note: See TracChangeset for help on using the changeset viewer.