Changeset 5949


Ignore:
Timestamp:
01/06/10 02:33:08 (2 years ago)
Author:
GeorgeClark
Message:

Item2592: Normalize topic names for Title and Header/Footer topics. Handle empty / missing image files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GenPDFAddOn/lib/Foswiki/Contrib/GenPDF.pm

    r5722 r5949  
    247247    # Get a topic name without any whitespace 
    248248    $topic =~ s|\s||g; 
     249 
     250    ($webName, $topic) = Foswiki::Func::normalizeWebTopicName($webName, $topic); 
     251 
    249252    if ( $prefs{'hftopic'} ) { 
    250253        $text = Foswiki::Func::readTopicText( $webName, $topic ); 
     
    305308    my $topic = $prefs{'titletopic'}; 
    306309 
     310    ($webName, $topic) = Foswiki::Func::normalizeWebTopicName($webName, $topic); 
     311 
     312 
     313    _writeDebug("building title topic  $topic" ) if $prefs{'debug'};    # DEBUG 
     314 
     315 
    307316    # Get a topic name without any whitespace 
    308317    $topic =~ s|\s||g; 
     
    312321        my $doc = $prefs{'titledoc'}; 
    313322        if ($doc) { 
     323            _writeDebug("building title topic from an attachment  $webName, $topic, $doc" ) if $prefs{'debug'};    # DEBUG 
    314324            $text = Foswiki::Func::readAttachment( $webName, $topic, $doc ); 
    315325            if ($text) { 
     
    329339        } 
    330340        else { 
     341            _writeDebug("building title topic from a topic  $webName, $topic" ) if $prefs{'debug'};    # DEBUG 
    331342            $text .= Foswiki::Func::readTopicText( $webName, $topic ); 
     343            if ( $text =~ /^http.*\/.*\/oops\/.*oopsaccessview$/ ) { 
     344                _writeDebug("Access exception reading   $webName, $topic" );    # DEBUG 
     345                } 
     346                          
    332347        } 
    333348    } 
     
    503518              Foswiki::Func::readAttachment( $imgInfo->{web}, $imgInfo->{topic}, 
    504519                $imgInfo->{file} ); 
    505             binmode $tempfh; 
    506             print $tempfh $data;    # copy the attachment to the temporary file 
    507             close $tempfh; 
     520            if ($data) { 
     521                binmode $tempfh; 
     522                print $tempfh $data;    # copy the attachment to the temporary file 
     523                close $tempfh; 
     524            } 
    508525        } 
    509526        catch Foswiki::AccessControlException with { 
Note: See TracChangeset for help on using the changeset viewer.