Commit 13d70bfb authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

item porte document

parent 315b81ac
Loading
Loading
Loading
Loading
+18 −10
Changes for rxq/ead/ead_basket.xqm: 18 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ declare function max.ead_basket:getResourceFilePath($projectId, $path){
        else max.util:maxHome() || $path
};


declare function max.ead_basket:circeclient($projectId){
    let $plugin := max.config:getPluginByName($projectId, $max.ead_basket:PLUGIN_ID)
    let $endpoint := string($plugin//parameter[@key = $max.ead_basket:CIRCE_ENDPOINT_PARAMETER]/@value)
@@ -30,7 +29,6 @@ declare function max.ead_basket:circeclient($projectId){
    return CirceClient:new($endpoint, $secret, $appuuid)
};


declare function max.ead_basket:basketItemsForPDF($projectId, $items){
    let $dbPath := max.config:getProjectDBPath($projectId)
    let $items_list := fn:tokenize($items, ",")
@@ -84,25 +82,35 @@ function max.ead_basket:accueil($projectId){
    return max.html:renderTemplate(doc(max.ead_basket:getResourceFilePath($projectId, "/plugins/ead/accueil.html")), map {"projectId" : $projectId, "documentsList" : $documents})
};


declare
%rest:GET
%output:method("html")
%rest:path("/{$projectId}/ead/porte-documents.html")
%rest:path("/{$projectId}/porte-documents.html")
function max.ead_basket:basket($projectId){
    max.html:renderTemplate(doc(max.ead_basket:getResourceFilePath($projectId, "/plugins/ead/porte-documents.html")),
            map {
            "projectId" : $projectId
            })
    max.html:render($projectId, "porte document", <section class="porte-documents">
        <h2>Porte-documents</h2>
        <p>
            Votre porte-documents regroupe tous les documents que vous avez mis de côté pendant votre visite.
            Vous pouvez retirer des documents, les ordonner (glissé/déposé), puis faire une sortie PDF.
        </p>
        <p>
            <button class="btnMakePDF">Faire une sortie PDF</button>
        </p>
        <ul id="porte-document-contenu">
        </ul>
        <p>
            <button class="btnClearBasket">Vider le porte-documents</button>
        </p>
    </section>
    )
};


declare function max.ead_basket:itemPorteDocuments($projectId, $item){
    let $dbPath := max.config:getProjectDBPath($projectId)
    let $xmlDocName := fn:substring-before($item, "|")
    let $nodeId := fn:substring-after($item, "|")
    let $target := doc(concat($dbPath, '/', $xmlDocName))//*[@xml:id = $nodeId or @id = $nodeId]
    let $xsl := max.ead_basket:getResourceFilePath($projectId, "/plugins/ead/item_porte-documents.xsl")
    let $xsl := max.ead_basket:getResourceFilePath($projectId, "ui/xsl/item_porte-documents.xsl")
    return xslt:transform($target[1],
            $xsl,
            map {
+30
Changes for ui/xsl/item_porte-documents.xsl: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ead="urn:isbn:1-931666-22-9"
                exclude-result-prefixes="ead xsl">
    <xsl:output method="xml" encoding="utf-8"/>
    <xsl:param name="baseuri"/>
    <xsl:param name="project"/>
    <xsl:param name="docName"/>
    <xsl:param name="nodeId"/>
    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="//ead:c">
        <li>
            <xsl:attribute name="data-node_id">
                <xsl:value-of select="concat($docName,'|',$nodeId)"/>
            </xsl:attribute>
            <button class="btnRemoveBasketItem">Retirer</button>
            <a>
                <xsl:attribute name="href">
                    <xsl:value-of
                            select="concat($baseuri, '/', $project, '/ead/', $docName, '/parcourir/', $nodeId, '.html')"/>
                </xsl:attribute>
                <xsl:value-of select="//ead:c/ead:did/ead:unittitle/ead:title/text()"/>
            </a>
        </li>
    </xsl:template>
</xsl:stylesheet>