Commit 717ab074 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'ag/ead_pdf' into 'dev'

plugin pour l'ead sur le même modèle que tei_pdf

See merge request pdn-certic/MaX!46
parents 4a617fe4 ed5ce855
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ function max.plugin.ead_basket:basketpdf($projectId, $items){
            </body>
        </html>

    let $pdf := max.util:xml2pdf($content, max.util:maxHome()||"ui/xsl/xhtml2fo.xsl")
    let $pdf := max.util:xml2pdf($content, max.util:maxHome()||"ui/xsl/xhtml2fo.xsl",$projectId)

    return
        (<rest:response>
+1 −0
Original line number Diff line number Diff line
Plugin pour générer des pdf pour un projet en EAD
+31 −0
Original line number Diff line number Diff line
(: For conditions of distribution and use, see the accompanying legal.txt file. :)

module namespace max.plugins.ead2pdf = 'pddn/max/plugins/ead2pdf.xqm';

import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm';
import module namespace max.api = 'pddn/max/max_api' at '../../rxq/max_api.xqm';
import module namespace max.util = 'pddn/max/util' at '../../rxq/util.xqm';


declare
%rest:GET
%rest:produces("application/pdf")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/ead/{$id}.pdf")
function max.plugins.ead2pdf:fragmentToPDF($project, $routeDoc, $id){
    let $dbPath := max.config:getProjectDBPath($project)
     let $eadHeader := doc($dbPath || '/' || $routeDoc)//*:eadheader/node()
    let $content:=
        <ead xmlns="urn:isbn:1-931666-22-9">
            <eadheader>{$eadHeader}</eadheader>
            <archdesc>{max.api:getXMLByID($dbPath, $id)}</archdesc>
        </ead>
    (: return $content :)
    let $pdf := max.util:xml2pdf($content, max.util:getProjectFoXsl($project), $project)
    return
        (<rest:response>
            <http:response status="200">
                <http:header name="content-type" value="application/pdf"/>
            </http:response>
        </rest:response>,
        $pdf)
};
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
.ead2pdf {
    margin-left:0px;
    position:absolute;
    top:-1px;
}

section.browse > div > div[id*="wrap"] {
    margin-top: 20px;
    padding-top:0px;
}
 No newline at end of file
+9 −0
Original line number Diff line number Diff line

declare variable $id external;

<div class="ead2pdf">
    <a role="button" title="Export pdf" target="_blank" href="./ead/{$id}.pdf">
        &#8682;
    </a>
</div>
Loading