	[% META title="Results &raquo; Data Import Preview" %]
    
<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = file %]
    [% # PROCESS dumper.tt dump = errs %]

    [% IF errs %]
        <div class="warning">WARNING: datafile failed integrity check:</div>
        <div class="error indent">[% errs %]</div>
    [% ELSE %]
        <div class="info">INFO: [% msg %]</div>
    [% END %]
    
    <h2>Datafile [% file %] contents:</h2>
    
    <p style="border: solid 1px #000; padding: 10px 20px; width: 800px" class="indent">
        [% data.join('<br />') %]
    </p>
    
    [% controller = file.match('PB_CMP') ? 'outreach' : 'result' %]
    
    [% IF controller == 'outreach'; # provide link to flow data file:
        data_file = flow_plot('PB_CMP.pdf'); # callback to controller
        IF data_file; link = data_file.join('/'); # link %]
            <div class="indent">
              [ <a class="image" href="/files/[% c.cfg('settings').item('_centre')
                %]/[% link %]" target="_blank" title="[% file %]">flow data file</a> ]
            </div>
    [% END; END %]
    
    <form action="[% app_url %]/[% controller %]/import_datafile/[% request_id %]"
            method="post" name="import" id="import">
        <input type="hidden" name="datafile" value="[% file %]">
        <p class="indent">
            [% site.html.back_button %]
            <input type="submit" class="button" value="Import">
        </p>
    </form> 
<!-- END [% template.name %] -->
