Loading plugins-available/default/circe/.ignore Empty file added. plugins-available/default/ead_toc/ead_toc.xq +1 −1 Changes for plugins-available/default/ead_toc/ead_toc.xq: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,4 +7,4 @@ declare variable $project external; declare variable $doc external; declare variable $id external; max.ead_toc:buildEADDocumentTOC($project, $doc) No newline at end of file max.ead_toc:buildEADDocumentTOC($project, $doc, $id) rxq/ead/ead_basket.xqm +129 Changes for rxq/ead/ead_basket.xqm: 129 added lines, 0 removed lines. Original line number Diff line number Diff line module namespace max.ead_basket = "pddn/max/ead/ead_basket.xqm"; declare namespace CirceClient = "fr.unicaen.certic.circe.CirceClient"; declare namespace Helpers = "fr.unicaen.certic.circe.Helpers"; import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm'; import module namespace max.util = 'pddn/max/util' at '../../rxq/util.xqm'; import module namespace rest = "http://exquery.org/ns/restxq"; import module namespace max.html = 'pddn/max/html' at '../../rxq/html.xqm'; declare variable $max.ead_basket:PLUGIN_ID := "ead"; declare variable $max.ead_basket:CIRCE_ENDPOINT_PARAMETER := "CIRCE_ENDPOINT"; declare variable $max.ead_basket:CIRCE_SECRET_PARAMETER := "CIRCE_SECRET"; declare variable $max.ead_basket:CIRCE_APP_UUID_PARAMETER := "CIRCE_APP_UUID"; declare function max.ead_basket:getResourceFilePath($projectId, $path){ let $edition_path := max.util:maxHome() || "editions/" || $projectId || "/" || $path return if(file:exists($edition_path)) then $edition_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) let $appuuid := string($plugin//parameter[@key = $max.ead_basket:CIRCE_APP_UUID_PARAMETER]/@value) let $secret := string($plugin//parameter[@key = $max.ead_basket:CIRCE_SECRET_PARAMETER]/@value) 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, ",") for $item in $items_list let $xmlDocName := fn:substring-before($item, "|") let $nodeId := fn:substring-after($item, "|") let $target := doc(concat($dbPath, '/', $xmlDocName))//*[@xml:id = $nodeId or @id = $nodeId] (: todo: make xslt transfo here :) return <h1>{$nodeId}</h1> }; declare %rest:GET %rest:query-param("items", "{$items}") %rest:path("/{$projectId}/ead/basket.pdf") function max.ead_basket:basketpdf($projectId, $items){ let $client := max.ead_basket:circeclient($projectId) let $helper := Helpers:new($client) let $content := <html> <head><title>Contenu du porte-documents</title></head> <body>{max.ead_basket:basketItemsForPDF($projectId, $items)}</body></html> return (<rest:response> <http:response status="200"> <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, convert:integers-to-base64(Helpers:html2pdf($helper, fn:serialize($content)))) }; declare %rest:GET %output:method("html") %rest:path("/{$projectId}/ead/accueil.html") function max.ead_basket:accueil($projectId){ let $documents := <ul> { for $doc in collection($projectId) return <li> <a href="/{$projectId}/ead/{tokenize(base-uri($doc), '/')[last()]}/parcourir/accueil.html"> {$doc/*:ead/*:eadheader/*:filedesc/*:titlestmt/*:titleproper//text()} – {$doc/*:ead/*:eadheader/*:filedesc/*:titlestmt/*:author//text()} </a> </li> } </ul> 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}/porte-documents.html") function max.ead_basket:basket($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, "ui/xsl/item_porte-documents.xsl") return xslt:transform($target[1], $xsl, map { "project" : $projectId, "docName" : $xmlDocName, "nodeId" : $nodeId})/*[1] }; declare %rest:path("/{$projectId}/ead/fetch_basket_data.html") %output:method("html") %rest:POST("{$itemsList}") function max.ead_basket:basketData($projectId, $itemsList){ for $item in $itemsList/json/_ return max.ead_basket:itemPorteDocuments($projectId, $item) }; rxq/ead/ead_toc.xqm +4 −2 Changes for rxq/ead/ead_toc.xqm: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ module namespace max.ead_toc = "pddn/max/ead/ead_toc.xqm"; import module namespace max.config = 'pddn/max/config' at '../config.xqm'; declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath){ max.ead_toc:buildEADDocumentTOC($projectId, $docPath, "") }; declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath, $nodeId){ let $dbPath := concat(max.config:getProjectDBPath($projectId), "/", $docPath) let $target := doc($dbPath) Loading @@ -12,14 +15,13 @@ declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath){ return <details id="details_{$c/@id}"> <summary> <a href="/{$projectId}/{$docPath}/{$c/@id}"> {$c/@id} {$c/*:did/*:unittitle[1]//text()} </a> </summary> {max.ead_toc:getComponentChildren($c, $projectId, $docPath)} </details> } <input type="hidden" name="currentEADItem" value="{$projectId}/{$docPath}/{$nodeId}"></input> </nav> }; Loading rxq/html.xqm +1 −1 Changes for rxq/html.xqm: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ as element(script)* src="{$publicjs}"></script> let $envJS := if (max.config:getXMLFormat($projectId) = $max.cons:EAD) then <script type="text/javascript" src="{max.config:getBaseURI() || $projectId || '/core/ui/js/dist/ead_treeview.min.js'}"/> then () (: TODO include Sortable.js and ead.js :) else () return ($envJS, $projectJS, $pluginsJS) Loading Loading
plugins-available/default/ead_toc/ead_toc.xq +1 −1 Changes for plugins-available/default/ead_toc/ead_toc.xq: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,4 +7,4 @@ declare variable $project external; declare variable $doc external; declare variable $id external; max.ead_toc:buildEADDocumentTOC($project, $doc) No newline at end of file max.ead_toc:buildEADDocumentTOC($project, $doc, $id)
rxq/ead/ead_basket.xqm +129 Changes for rxq/ead/ead_basket.xqm: 129 added lines, 0 removed lines. Original line number Diff line number Diff line module namespace max.ead_basket = "pddn/max/ead/ead_basket.xqm"; declare namespace CirceClient = "fr.unicaen.certic.circe.CirceClient"; declare namespace Helpers = "fr.unicaen.certic.circe.Helpers"; import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm'; import module namespace max.util = 'pddn/max/util' at '../../rxq/util.xqm'; import module namespace rest = "http://exquery.org/ns/restxq"; import module namespace max.html = 'pddn/max/html' at '../../rxq/html.xqm'; declare variable $max.ead_basket:PLUGIN_ID := "ead"; declare variable $max.ead_basket:CIRCE_ENDPOINT_PARAMETER := "CIRCE_ENDPOINT"; declare variable $max.ead_basket:CIRCE_SECRET_PARAMETER := "CIRCE_SECRET"; declare variable $max.ead_basket:CIRCE_APP_UUID_PARAMETER := "CIRCE_APP_UUID"; declare function max.ead_basket:getResourceFilePath($projectId, $path){ let $edition_path := max.util:maxHome() || "editions/" || $projectId || "/" || $path return if(file:exists($edition_path)) then $edition_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) let $appuuid := string($plugin//parameter[@key = $max.ead_basket:CIRCE_APP_UUID_PARAMETER]/@value) let $secret := string($plugin//parameter[@key = $max.ead_basket:CIRCE_SECRET_PARAMETER]/@value) 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, ",") for $item in $items_list let $xmlDocName := fn:substring-before($item, "|") let $nodeId := fn:substring-after($item, "|") let $target := doc(concat($dbPath, '/', $xmlDocName))//*[@xml:id = $nodeId or @id = $nodeId] (: todo: make xslt transfo here :) return <h1>{$nodeId}</h1> }; declare %rest:GET %rest:query-param("items", "{$items}") %rest:path("/{$projectId}/ead/basket.pdf") function max.ead_basket:basketpdf($projectId, $items){ let $client := max.ead_basket:circeclient($projectId) let $helper := Helpers:new($client) let $content := <html> <head><title>Contenu du porte-documents</title></head> <body>{max.ead_basket:basketItemsForPDF($projectId, $items)}</body></html> return (<rest:response> <http:response status="200"> <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, convert:integers-to-base64(Helpers:html2pdf($helper, fn:serialize($content)))) }; declare %rest:GET %output:method("html") %rest:path("/{$projectId}/ead/accueil.html") function max.ead_basket:accueil($projectId){ let $documents := <ul> { for $doc in collection($projectId) return <li> <a href="/{$projectId}/ead/{tokenize(base-uri($doc), '/')[last()]}/parcourir/accueil.html"> {$doc/*:ead/*:eadheader/*:filedesc/*:titlestmt/*:titleproper//text()} – {$doc/*:ead/*:eadheader/*:filedesc/*:titlestmt/*:author//text()} </a> </li> } </ul> 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}/porte-documents.html") function max.ead_basket:basket($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, "ui/xsl/item_porte-documents.xsl") return xslt:transform($target[1], $xsl, map { "project" : $projectId, "docName" : $xmlDocName, "nodeId" : $nodeId})/*[1] }; declare %rest:path("/{$projectId}/ead/fetch_basket_data.html") %output:method("html") %rest:POST("{$itemsList}") function max.ead_basket:basketData($projectId, $itemsList){ for $item in $itemsList/json/_ return max.ead_basket:itemPorteDocuments($projectId, $item) };
rxq/ead/ead_toc.xqm +4 −2 Changes for rxq/ead/ead_toc.xqm: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ module namespace max.ead_toc = "pddn/max/ead/ead_toc.xqm"; import module namespace max.config = 'pddn/max/config' at '../config.xqm'; declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath){ max.ead_toc:buildEADDocumentTOC($projectId, $docPath, "") }; declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath, $nodeId){ let $dbPath := concat(max.config:getProjectDBPath($projectId), "/", $docPath) let $target := doc($dbPath) Loading @@ -12,14 +15,13 @@ declare function max.ead_toc:buildEADDocumentTOC($projectId, $docPath){ return <details id="details_{$c/@id}"> <summary> <a href="/{$projectId}/{$docPath}/{$c/@id}"> {$c/@id} {$c/*:did/*:unittitle[1]//text()} </a> </summary> {max.ead_toc:getComponentChildren($c, $projectId, $docPath)} </details> } <input type="hidden" name="currentEADItem" value="{$projectId}/{$docPath}/{$nodeId}"></input> </nav> }; Loading
rxq/html.xqm +1 −1 Changes for rxq/html.xqm: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ as element(script)* src="{$publicjs}"></script> let $envJS := if (max.config:getXMLFormat($projectId) = $max.cons:EAD) then <script type="text/javascript" src="{max.config:getBaseURI() || $projectId || '/core/ui/js/dist/ead_treeview.min.js'}"/> then () (: TODO include Sortable.js and ead.js :) else () return ($envJS, $projectJS, $pluginsJS) Loading