From f23c40102ca97bccbef5ca4fa3a40a4ebd6500d9 Mon Sep 17 00:00:00 2001 From: Jens Kupferschmidt <kupferschmidt@rz.uni-leipzig.de> Date: Tue, 13 Aug 2024 12:36:22 +0200 Subject: [PATCH] add biocol93 for link to parent object --- src/main/datamodel/def/biocol.xml | 3 + .../import_editor_form_biocol-common.xed | 40 +++++- .../dptbase-biocol/messages_de.properties | 4 + .../dptbase-biocol/messages_en.properties | 4 + .../config/dptbase-biocol/mycore.properties | 7 + .../xsl/indexpage-biocol-subselect.xsl | 132 ++++++++++++++++++ 6 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/xsl/indexpage-biocol-subselect.xsl diff --git a/src/main/datamodel/def/biocol.xml b/src/main/datamodel/def/biocol.xml index 81b9967..56553d3 100644 --- a/src/main/datamodel/def/biocol.xml +++ b/src/main/datamodel/def/biocol.xml @@ -243,6 +243,9 @@ <element name="biocol89" type="text" minOccurs="0" maxOccurs="10" notinherit="true" heritable="false" /> <!-- ============================================================================================== --> + + <!-- link to parent --> + <element name="biocol93" type="link" minOccurs="0" maxOccurs="1" style="small" notinherit="ignore" heritable="ignore" /> <!-- rights holder - Rechteinhaber --> <element name="biocol94" type="text" minOccurs="1" maxOccurs="1" notinherit="true" heritable="false" /> diff --git a/src/main/resources/META-INF/resources/editor/import_editor_form_biocol-common.xed b/src/main/resources/META-INF/resources/editor/import_editor_form_biocol-common.xed index ff2c4d6..0aaea00 100644 --- a/src/main/resources/META-INF/resources/editor/import_editor_form_biocol-common.xed +++ b/src/main/resources/META-INF/resources/editor/import_editor_form_biocol-common.xed @@ -1945,7 +1945,7 @@ </p> <xed:display-validation-message /> <xed:validate matches="^[0-9]+([.][0-9]+)?" display="local"> - <xed:output i18n="module.papyri.editor.schrift.st12.cond" /> + <xed:output i18n="module.dptbase.biocol.biocol87.cond" /> </xed:validate> </xed:repeat> </xed:bind> @@ -2001,6 +2001,44 @@ </tr> </xed:template> + <!-- biocol93 link to parent --> + <xed:template id="biocol93-ltr"> + <tr> + <td class="dpt_editor_name-ltr"> + <label for="biocol93"> + <xed:output i18n="module.dptbase.biocol.biocol93.view" /> + </label> + </td> + <td class="dpt_editor_value-ltr"> + <xed:repeat xpath="def.biocol93[@class='MCRMetaLinkID']" min="1" max="1"> + <xed:bind xpath="@notinherit" default="true" /> + <xed:bind xpath="@heritable" default="false" /> + <xed:bind xpath="biocol93"> + <xed:bind xpath="@inherited" default="0" /> + <xed:bind xpath="@xlink:type" default="locator" /> + <p> + <button type="submit" + style="padding-top:0px; width:100%; color:var(--white); background: var(--karneol)" + class="dpt_editor_subselect_button" xed:target="subselect" + xed:href="/indexpage?searchclass=biocol-subselect"> + <xed:output i18n="module.dptbase.biocol.biocol93.choose" /> + </button> + <xed:controls>remove</xed:controls> + </p> + <xed:if test="@xlink:title"> + <p> + <xed:output value="@xlink:title" /> + ( + <xed:output value="@xlink:href" /> + ) + </p> + </xed:if> + </xed:bind> + </xed:repeat> + </td> + </tr> + </xed:template> + <!-- biocol94 rights holder --> <xed:template id="biocol94req-ltr"> <tr> diff --git a/src/main/resources/config/dptbase-biocol/messages_de.properties b/src/main/resources/config/dptbase-biocol/messages_de.properties index aee52e1..c791946 100644 --- a/src/main/resources/config/dptbase-biocol/messages_de.properties +++ b/src/main/resources/config/dptbase-biocol/messages_de.properties @@ -96,12 +96,16 @@ module.dptbase.biocol.biocol83.view = Fach module.dptbase.biocol.biocol84.view = Etiketttyp module.dptbase.biocol.biocol85.view = Exemplare module.dptbase.biocol.biocol86.view = Pr\u00E4parator +module.dptbase.biocol.biocol87.cond = Es fehlt die Eingabe eines ganzzahligen Wertes. Die Gr\u00F6\u00DFenordnung wird per Ma\u00DFeinheit angegeben. module.dptbase.biocol.biocol87.dimension = Dimension module.dptbase.biocol.biocol87.measurement = Ma\u00DFeinheit module.dptbase.biocol.biocol87.value = Wert module.dptbase.biocol.biocol87.view = Objektma\u00DFe module.dptbase.biocol.biocol88.view = Entstehungszeit module.dptbase.biocol.biocol89.view = Entstehungsort +module.dptbase.biocol.biocol93.choose = Link zum BioCol-Objekt ausw\u00E4hlen +module.dptbase.biocol.biocol93.subordinate = untergeordnetes Objekt +module.dptbase.biocol.biocol93.view = \u00FCbergeordneter Datensatz module.dptbase.biocol.biocol94.cond = Die Angabe des Inhabers der Rechte am Objekt ist ein Pflichtfeld! module.dptbase.biocol.biocol94.view = Rechteinhaber module.dptbase.biocol.biocol95.cond = Die Angabe des Bearbeiters ist ein Pflichtfeld! diff --git a/src/main/resources/config/dptbase-biocol/messages_en.properties b/src/main/resources/config/dptbase-biocol/messages_en.properties index b1b4582..11dd0b7 100644 --- a/src/main/resources/config/dptbase-biocol/messages_en.properties +++ b/src/main/resources/config/dptbase-biocol/messages_en.properties @@ -97,12 +97,16 @@ module.dptbase.biocol.biocol83.view = Shelf module.dptbase.biocol.biocol84.view = Label type module.dptbase.biocol.biocol85.view = Copies module.dptbase.biocol.biocol86.view = Taxidermist +module.dptbase.biocol.biocol87.cond = The input of an integer value is missing. The order of magnitude is specified using a unit of measurement. module.dptbase.biocol.biocol87.dimension = Dimension module.dptbase.biocol.biocol87.measurement = Measurement module.dptbase.biocol.biocol87.value = Value module.dptbase.biocol.biocol87.view = Object measurement module.dptbase.biocol.biocol88.view = Time of origin module.dptbase.biocol.biocol89.view = Place of origin +module.dptbase.biocol.biocol93.choose = Select a link to the BioCol object +module.dptbase.biocol.biocol93.subordinate = subordinate object +module.dptbase.biocol.biocol93.view = parent dataset module.dptbase.biocol.biocol94.cond = The indication of the owner of the rights to the object is a mandatory field! module.dptbase.biocol.biocol94.view = Rights holder module.dptbase.biocol.biocol95.cond = The name of the editor is a mandatory field! diff --git a/src/main/resources/config/dptbase-biocol/mycore.properties b/src/main/resources/config/dptbase-biocol/mycore.properties index c48ae23..31cf7fd 100644 --- a/src/main/resources/config/dptbase-biocol/mycore.properties +++ b/src/main/resources/config/dptbase-biocol/mycore.properties @@ -40,6 +40,13 @@ MCR.IndexBrowser.biocol.Searchfield=biocol.biocol01 MCR.IndexBrowser.biocol.ExtraOutputFields=id,biocol.biocol01 + MCR.IndexBrowser.biocol-subselect.Table=biocol + MCR.IndexBrowser.biocol-subselect.Style=biocol + MCR.IndexBrowser.biocol-subselect.MaxPerPage=50 + MCR.IndexBrowser.biocol-subselect.FieldsToSort=biocol.biocol01sort + MCR.IndexBrowser.biocol-subselect.Searchfield=biocol.biocol01 + MCR.IndexBrowser.biocol-subselect.ExtraOutputFields=id,biocol.biocol01 + # biocol mail config MCR.URIResolver.xslIncludes.eventHandlerMailer=%MCR.URIResolver.xslIncludes.eventHandlerMailer%,e-mail-events-biocol.xsl diff --git a/src/main/resources/xsl/indexpage-biocol-subselect.xsl b/src/main/resources/xsl/indexpage-biocol-subselect.xsl new file mode 100644 index 0000000..d2bcb62 --- /dev/null +++ b/src/main/resources/xsl/indexpage-biocol-subselect.xsl @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation" xmlns:xalan="http://xml.apache.org/xalan" + xmlns:encoder="xalan://java.net.URLEncoder"> + + <xsl:variable name="PageTitle" select="i18n:translate('module.colul.vetanatomy.collection.indexpage')" /> + <xsl:variable name="PageTitleAll" select="'module.colul.vetanatomy.collection.indexpage'" /> + <xsl:variable name="PageHeadline" select="'module.colul.vetanatomy.collection.indexpage'" /> + <xsl:variable name="titlepath" select="'XXX'" /> + + <xsl:include href="indexpage-common.xsl" /> + + <xsl:variable name="editorValue"> + <xsl:variable name="pValue"> + <xsl:call-template name="UrlGetParam"> + <xsl:with-param name="url" select="$RequestURL" /> + <xsl:with-param name="par" select="'editorValue'" /> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($pValue) > 1"> + <xsl:value-of select="$pValue" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'@xlink:href'" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="editorValueTitle"> + <xsl:variable name="pValue"> + <xsl:call-template name="UrlGetParam"> + <xsl:with-param name="url" select="$RequestURL" /> + <xsl:with-param name="par" select="'editorValueTitle'" /> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($pValue) > 1"> + <xsl:value-of select="$pValue" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'@editor.output'" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:template match="indexpage"> + <div class="dpt_frame-ltr"> + <div class="search-mask"> + <h1 class="text-center"> + <xsl:value-of select="i18n:translate('module.colul.vetanatomy.collection.indexpage')" /> + </h1> + <xsl:call-template name="index.search" /> + <xsl:apply-templates select="results" /> + </div> + </div> + </xsl:template> + + <!-- ========== value ========== --> + + <xsl:template match="value" priority="1"> + <xsl:variable name="doc" select="document(concat('mcrobject:',id))" /> + <xsl:variable name="identifier"> + <xsl:choose> + <xsl:when test="$doc/mycoreobject/metadata/def.biocol01" > + <xsl:value-of select="$doc/mycoreobject/metadata/def.biocol01/biocol01/text()" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="id" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="toolTip"> + <xsl:value-of select="col[@name='id']" /> + </xsl:variable> + <xsl:variable name="title"> + <xsl:value-of select="$doc/mycoreobject/metadata/def.biocol09/biocol09/text()" /> + </xsl:variable> + <li class="dpt_index_results_value"> + <a title="{$toolTip}"> + <xsl:attribute name="href"> + <xsl:value-of select="concat($ServletsBaseURL,'XEditor?_xed_submit_return=')" /> + <xsl:value-of select="concat('&_xed_session=',encoder:encode($xedSession,'UTF-8'))" /> + <xsl:value-of select="concat('&@xlink:title=',encoder:encode($identifier,'UTF-8'))" /> + <xsl:value-of select="concat('&@xlink:href=',encoder:encode(col[@name='id'],'UTF-8'))" /> + </xsl:attribute> + <xsl:value-of select="concat($identifier, ' - ', $title)" /> + </a> + </li> + </xsl:template> + + <!-- ========== range ========== --> + + <xsl:template match="range" priority="0"> + <xsl:variable name="url"> + <xsl:value-of + select="concat($WebApplicationBaseURL,'indexpage',$HttpSession,'?searchclass=',$IndexID,'&fromTo=', from/@pos,'-', to/@pos, '&_xed_subselect_session=',$xedSession, '&_xed_submit_return=')" /> + <xsl:if test="string-length($search) > 0"> + <xsl:value-of select="concat('&search=',$search)" /> + </xsl:if> + </xsl:variable> + <xsl:variable name="fromdoc" select="document(concat('mcrobject:',from/@id))" /> + <xsl:variable name="from"> + <xsl:choose> + <xsl:when test="$fromdoc/mycoreobject/metadata/def.biocol01" > + <xsl:value-of select="$fromdoc/mycoreobject/metadata/def.biocol01/biocol01/text()" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="from/@id" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="todoc" select="document(concat('mcrobject:',to/@id))" /> + <xsl:variable name="to"> + <xsl:choose> + <xsl:when test="$todoc/mycoreobject/metadata/def.biocol01" > + <xsl:value-of select="$todoc/mycoreobject/metadata/def.biocol01/biocol01/text()" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="to/@id" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <li class="dpt_index_results_range"> + <a href="{$url}"> + <xsl:value-of select="concat($from,' - ',$to)" /> + </a> + </li> + </xsl:template> + +</xsl:stylesheet> -- GitLab