From 69ea0f31e2bf101a8d54c62407e0f037d35321c1 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 23 Feb 2021 14:57:55 +0100 Subject: [PATCH] Custom template for compilation --- .../rdf/tbox/filegraph/text_structures.owl | 2 +- webapp/src/main/webapp/js/toc.js | 18 + .../templates/freemarker/compilation.ftl | 353 ++++++++++++++++++ .../webapp/templates/freemarker/text-lib.ftl | 38 ++ 4 files changed, 410 insertions(+), 1 deletion(-) create mode 100644 webapp/src/main/webapp/js/toc.js create mode 100644 webapp/src/main/webapp/templates/freemarker/compilation.ftl create mode 100644 webapp/src/main/webapp/templates/freemarker/text-lib.ftl diff --git a/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl b/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl index b9e9fa5d..56294bb3 100644 --- a/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl +++ b/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl @@ -128,7 +128,7 @@ - elenphAritcle.ftl + compilation.ftl Compilation edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.CompilationGenerator diff --git a/webapp/src/main/webapp/js/toc.js b/webapp/src/main/webapp/js/toc.js new file mode 100644 index 00000000..3d46e7c7 --- /dev/null +++ b/webapp/src/main/webapp/js/toc.js @@ -0,0 +1,18 @@ +{ + let content = document.getElementById("wrapper-content"); + let toc = document.getElementById("TOC"); + createTOC(content, toc); + + function createTOC(content, toc){ + if (toc === null){ + alert("no TOC element found"); + return; + } + if (content === null){ + alert("no content element found"); + return; + } + + } + +} diff --git a/webapp/src/main/webapp/templates/freemarker/compilation.ftl b/webapp/src/main/webapp/templates/freemarker/compilation.ftl new file mode 100644 index 00000000..0bd10b6d --- /dev/null +++ b/webapp/src/main/webapp/templates/freemarker/compilation.ftl @@ -0,0 +1,353 @@ +<#-- $This file is distributed under the terms of the license in LICENSE$ --> + +<#-- Individual profile page template for foaf:Person individuals --> + +<#include "individual-setup.ftl"> +${scripts.add('')} +${scripts.add('')} +${scripts.add('')} +<#import "individual-qrCodeGenerator.ftl" as qr> +<#import "lib-vivo-properties.ftl" as vp> +<#include "text-lib.ftl"> + +<#--Number of labels present--> +<#if !labelCount??> + <#assign labelCount = 0 > + +<#--Number of available locales--> +<#if !localesCount??> + <#assign localesCount = 1> + +<#--Number of distinct languages represented, with no language tag counting as a language, across labels--> +<#if !languageCount??> + <#assign languageCount = 1> + +<#assign qrCodeIcon = "qr-code-icon.png"> +<#assign visRequestingTemplate = "foaf-person-2column"> +<#--add the VIVO-ORCID interface --> +<#include "individual-orcidInterface.ftl"> +
+
+ <#include "individual-adminPanel.ftl"> +
+ <#if relatedSubject??> +

${relatedSubject.relatingPredicateDomainPublic} ${i18n().for} ${relatedSubject.name}

+

← ${i18n().return_to(relatedSubject.name)}

+ <#else> +

style="float:left;border-right:1px solid #A6B1B0;"> + <#-- Label --> + <@p.label individual editable labelCount localesCount/> + <@p.deleteIndividualLink individual /> +

+ <#-- Display preferredTitle if it exists; otherwise mostSpecificTypes --> + <#assign title = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Title")!> + <#if title?has_content> <#-- true when the property is in the list, even if not populated (when editing) --> + <#if (title.statements?size < 1) > + <@p.addLinkWithLabel title editable /> + <#elseif editable> +

${title.name?capitalize!}

+ <@p.verboseDisplay title /> + + <#list title.statements as statement> + <#if !editable > +
${statement.preferredTitle}
+ <#else> + ${statement.preferredTitle} + <@p.editingLinks "${title.localName}" "${title.name}" statement editable title.rangeUri /> + + + + <#-- If preferredTitle is unpopulated, display mostSpecificTypes --> + <#if ! (title.statements)?has_content> + <@p.mostSpecificTypesPerson individual editable/> + + + style="top:5px"> + <#include "individual-iconControls.ftl"> + + <#if editable && profilePageTypesEnabled > + <#include "individual-profilePageTypes.ftl"> + +
+ + <#include "individual-positions.ftl"> + + + <#if !editable> +

+ + <#include "individual-overview.ftl"> + + + <#include "individual-researchAreas.ftl"> + + + <#include "individual-geographicFocus.ftl"> + + <#include "individual-openSocial.ftl"> +
+
+ +<#assign nameForOtherGroup = "${i18n().other}"> +<#if !editable> + <#-- We don't want to see the first name and last name unless we might edit them. --> + <#assign skipThis = propertyGroups.pullProperty("http://xmlns.com/foaf/0.1/firstName")!> + <#assign skipThis = propertyGroups.pullProperty("http://xmlns.com/foaf/0.1/lastName")!> + +
+ +
+
+<#assign firstPub = propertyGroups.pullProperty("https://litvinovg.pro/text_structures#firstPublication")!> + <#if firstPub.statements?has_content && firstPub.type == "data"> +
+
Первая публикация статьи +
+ <@p.dataPropertyList firstPub editable /> +
+ + +<#if authors??> + <#list authors as author> +
+ <#if author.authorFamily??>${author.authorFamily} <#if author.authorGivenName??>${author.authorGivenName} + <#if author.orgName??> +
${author.orgName} + + <#if author.orgAddress??> +
+ Адрес организации: <#if author.orgPostalCode??>${author.orgPostalCode}, ${author.orgAddress}  + + +
+ + + +<@showRubrics /> + +
+ <#list paths as order> + <#-- ${order.path} --> + <#list excerpts as excerptProperties> + <#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt> + <#assign excerptText = excerptProperties.htmlContent > + <#assign excerptTextName = excerptProperties.htmlLabel > + <#assign worksCounter = excerptProperties.worksCounter > + <#assign bibliographyCounter = excerptProperties.bibliographyCounter > + + +
+ <#if excerptText?? && excerptTextName?? && excerptTextName?has_content && excerptText?has_content> + + + +
<#-- articleExcerpt --> + + + <#if works?? && works?has_content> +
+ + +
+ + + <#if bibliography?? && bibliography?has_content> +
+ + +
+ +
+ +<#if authors??> + <#list authors as author> +
+ <#if author.authorFamily??>${author.authorFamily} <#if author.authorInitials??>${author.authorInitials} +
+ + + + + <#-- <@dumpAll /> --> + + <#assign selectedTemplate = "individual--foaf-person-2column.ftl" > + +<#if profilePageTypesEnabled > + <#assign profilePageType = profileType > + + <#-- targetedView takes precedence over the profilePageType. --> + + <#if targetedView?has_content> + <#if targetedView != "standardView"> + <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" > + + <#elseif profilePageType == "quickView" > + <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" > + + +<#-- <#include "individual-property-group-tabs.ftl"> --> + +<#if profilePageTypesEnabled && (targetedView?has_content || user.loggedIn) > + + + ${i18n().quick_view_icon} + + + + + + +<#if !editable> + + + +<#assign rdfUrl = individual.rdfUrl> + +<#if rdfUrl??> + + + + +${stylesheets.add('', + '', + '', + '', + '')} + +${headScripts.add('', + '', + '', + '')} + +${scripts.add('', + '', + '', + '', + '', + '', + '', + '', + '')} + + diff --git a/webapp/src/main/webapp/templates/freemarker/text-lib.ftl b/webapp/src/main/webapp/templates/freemarker/text-lib.ftl new file mode 100644 index 00000000..f88a661d --- /dev/null +++ b/webapp/src/main/webapp/templates/freemarker/text-lib.ftl @@ -0,0 +1,38 @@ + +<#macro showRubrics> + <#assign currentRubrics = propertyGroups.pullProperty("https://iph.ras.ru/relationships#belongsTo")!> + <#if currentRubrics?? && currentRubrics?has_content> +
Относится к рубрикам: <@p.addLink currentRubrics editable /> <@p.verboseDisplay currentRubrics />
+ <#if rubrics?? && rubrics?has_content> + <#list rubrics as rubric> +
  • + ${rubric.rubricName} +
  • + + +
    + + + +<#macro showIssue> + <#assign issue = propertyGroups.pullProperty("https://litvinovg.pro/text_structures#issue")!> + <#if issue.statements?has_content && issue.type == "data"> +
    +
    Входит в выпуск
    + <@p.dataPropertyList issue editable /> +
    + + + +<#macro showYear> + <#assign year = propertyGroups.pullProperty("https://litvinovg.pro/text_structures#year")!> + <#if year.statements?has_content && year.type == "data"> +
    +
    Год
    + <@p.dataPropertyList year editable /> +
    + + +<#macro showWorks works > + + \ No newline at end of file