Loading plugins-available/default/ead_basket/ead_basket.xqm +17 −32 Changes for plugins-available/default/ead_basket/ead_basket.xqm: 17 added lines, 32 removed lines. Original line number Diff line number Diff line module namespace max.plugin.ead_basket = "pddn/max/plugin/ead_basket"; 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.plugin.ead_basket:PLUGIN_ID := "ead_basket"; declare variable $max.plugin.ead_basket:CIRCE_ENDPOINT_PARAMETER := "CIRCE_ENDPOINT"; declare variable $max.plugin.ead_basket:CIRCE_SECRET_PARAMETER := "CIRCE_SECRET"; declare variable $max.plugin.ead_basket:CIRCE_APP_UUID_PARAMETER := "CIRCE_APP_UUID"; declare function max.plugin.ead_basket:getResourceFilePath($projectId, $path){ let $edition_path := max.util:maxHome() || "editions/" || $projectId || "/" || $path Loading @@ -21,31 +15,15 @@ declare function max.plugin.ead_basket:getResourceFilePath($projectId, $path){ else max.util:maxHome() || $path }; declare function max.plugin.ead_basket:circeclient($projectId){ let $endpoint := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_ENDPOINT_PARAMETER) let $appuuid := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_APP_UUID_PARAMETER) let $secret := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_SECRET_PARAMETER) return CirceClient:new($endpoint, $secret, $appuuid) }; declare function max.plugin.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> let $target := doc(concat($dbPath, '/', $xmlDocName))//*[@xml:id = $nodeId or @*:id = $nodeId][1] let $content := xslt:transform($target, max.plugin.ead_basket:getResourceFilePath($projectId, "ui/xsl/item_porte-documents-print.html.xsl")) return $content }; declare Loading @@ -53,11 +31,18 @@ declare %rest:query-param("items", "{$items}") %rest:path("/{$projectId}/ead/basket.pdf") function max.plugin.ead_basket:basketpdf($projectId, $items){ let $client := max.plugin.ead_basket:circeclient($projectId) let $helper := Helpers:new($client) let $content := <html> <head><title>Contenu du porte-documents</title></head> <body>{max.plugin.ead_basket:basketItemsForPDF($projectId, $items)}</body></html> let $content := <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"/> <title>Contenu du porte-documents</title> </head> <body> {max.plugin.ead_basket:basketItemsForPDF($projectId, $items)} </body> </html> let $pdf := max.util:xml2pdf($content, max.util:maxHome()||"ui/xsl/xhtml2fo.xsl") return (<rest:response> Loading @@ -65,7 +50,7 @@ function max.plugin.ead_basket:basketpdf($projectId, $items){ <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, convert:integers-to-base64(Helpers:html2pdf($helper, fn:serialize($content)))) $pdf) }; declare Loading ui/js/ead.js +2 −19 Changes for ui/js/ead.js: 2 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -97,21 +97,11 @@ function initBasketCheckbox(project_id, doc_name, cid) { } async function initEADPage() { //let elem = document.querySelector('input[name="currentEADItem"]') let textElement = document.getElementById('text') if(textElement){ // let parts = elem.value.split("/"); // if(parts.length === 3){ // if(parts[2] != "") { //let project_id = parts[0]; //let doc_name = parts[1]; //let page_id = parts[2]; highlightTreeNode("details_" + fragmentId);//side_toc plugin's function initBasketCheckbox(projectId, route, fragmentId); // } // } } if(projectId) { // should be declared globally in page initPorteDocumentsPage(projectId); } Loading Loading @@ -157,16 +147,9 @@ async function initPorteDocumentsPage(project_id) { let pdf_buttons = document.getElementsByClassName("btnMakePDF"); for (var i = 0, len = pdf_buttons.length; i < len; i++) { pdf_buttons[i].addEventListener("click", function () { window.open(baseURI + project_id + "/ead/basket.pdf?items=" + basket.items().concat(","), '_blank'); console.log(basket.items().concat(",")); window.open(baseURI + project_id + "/ead/basket.pdf?items=" + (basket.items().join()), '_blank'); }); } } } No newline at end of file //window.addEventListener("DOMContentLoaded", (event) => { // console.log("222") // initEADPage(); // }); ui/xsl/item_porte-documents-print.html.xsl +21 Changes for ui/xsl/item_porte-documents-print.html.xsl: 21 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" xmlns:xhtml="http://www.w3.org/1999/xhtml" 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"> <xhtml:h1> <xsl:value-of select="//ead:c/ead:did/ead:unittitle/ead:title/text()"/> </xhtml:h1> </xsl:template> </xsl:stylesheet> ui/xsl/xhtml2fo.xsl +1829 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
plugins-available/default/ead_basket/ead_basket.xqm +17 −32 Changes for plugins-available/default/ead_basket/ead_basket.xqm: 17 added lines, 32 removed lines. Original line number Diff line number Diff line module namespace max.plugin.ead_basket = "pddn/max/plugin/ead_basket"; 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.plugin.ead_basket:PLUGIN_ID := "ead_basket"; declare variable $max.plugin.ead_basket:CIRCE_ENDPOINT_PARAMETER := "CIRCE_ENDPOINT"; declare variable $max.plugin.ead_basket:CIRCE_SECRET_PARAMETER := "CIRCE_SECRET"; declare variable $max.plugin.ead_basket:CIRCE_APP_UUID_PARAMETER := "CIRCE_APP_UUID"; declare function max.plugin.ead_basket:getResourceFilePath($projectId, $path){ let $edition_path := max.util:maxHome() || "editions/" || $projectId || "/" || $path Loading @@ -21,31 +15,15 @@ declare function max.plugin.ead_basket:getResourceFilePath($projectId, $path){ else max.util:maxHome() || $path }; declare function max.plugin.ead_basket:circeclient($projectId){ let $endpoint := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_ENDPOINT_PARAMETER) let $appuuid := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_APP_UUID_PARAMETER) let $secret := max.config:getPluginParameterValue( $projectId, $max.plugin.ead_basket:PLUGIN_ID, $max.plugin.ead_basket:CIRCE_SECRET_PARAMETER) return CirceClient:new($endpoint, $secret, $appuuid) }; declare function max.plugin.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> let $target := doc(concat($dbPath, '/', $xmlDocName))//*[@xml:id = $nodeId or @*:id = $nodeId][1] let $content := xslt:transform($target, max.plugin.ead_basket:getResourceFilePath($projectId, "ui/xsl/item_porte-documents-print.html.xsl")) return $content }; declare Loading @@ -53,11 +31,18 @@ declare %rest:query-param("items", "{$items}") %rest:path("/{$projectId}/ead/basket.pdf") function max.plugin.ead_basket:basketpdf($projectId, $items){ let $client := max.plugin.ead_basket:circeclient($projectId) let $helper := Helpers:new($client) let $content := <html> <head><title>Contenu du porte-documents</title></head> <body>{max.plugin.ead_basket:basketItemsForPDF($projectId, $items)}</body></html> let $content := <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"/> <title>Contenu du porte-documents</title> </head> <body> {max.plugin.ead_basket:basketItemsForPDF($projectId, $items)} </body> </html> let $pdf := max.util:xml2pdf($content, max.util:maxHome()||"ui/xsl/xhtml2fo.xsl") return (<rest:response> Loading @@ -65,7 +50,7 @@ function max.plugin.ead_basket:basketpdf($projectId, $items){ <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, convert:integers-to-base64(Helpers:html2pdf($helper, fn:serialize($content)))) $pdf) }; declare Loading
ui/js/ead.js +2 −19 Changes for ui/js/ead.js: 2 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -97,21 +97,11 @@ function initBasketCheckbox(project_id, doc_name, cid) { } async function initEADPage() { //let elem = document.querySelector('input[name="currentEADItem"]') let textElement = document.getElementById('text') if(textElement){ // let parts = elem.value.split("/"); // if(parts.length === 3){ // if(parts[2] != "") { //let project_id = parts[0]; //let doc_name = parts[1]; //let page_id = parts[2]; highlightTreeNode("details_" + fragmentId);//side_toc plugin's function initBasketCheckbox(projectId, route, fragmentId); // } // } } if(projectId) { // should be declared globally in page initPorteDocumentsPage(projectId); } Loading Loading @@ -157,16 +147,9 @@ async function initPorteDocumentsPage(project_id) { let pdf_buttons = document.getElementsByClassName("btnMakePDF"); for (var i = 0, len = pdf_buttons.length; i < len; i++) { pdf_buttons[i].addEventListener("click", function () { window.open(baseURI + project_id + "/ead/basket.pdf?items=" + basket.items().concat(","), '_blank'); console.log(basket.items().concat(",")); window.open(baseURI + project_id + "/ead/basket.pdf?items=" + (basket.items().join()), '_blank'); }); } } } No newline at end of file //window.addEventListener("DOMContentLoaded", (event) => { // console.log("222") // initEADPage(); // });
ui/xsl/item_porte-documents-print.html.xsl +21 Changes for ui/xsl/item_porte-documents-print.html.xsl: 21 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" xmlns:xhtml="http://www.w3.org/1999/xhtml" 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"> <xhtml:h1> <xsl:value-of select="//ead:c/ead:did/ead:unittitle/ead:title/text()"/> </xhtml:h1> </xsl:template> </xsl:stylesheet>