Skip to content

Commit

Permalink
Merge pull request #485 from OPUS4/pubmedurl484
Browse files Browse the repository at this point in the history
#485 Pubmed base url configurable
  • Loading branch information
j3nsch authored Jan 3, 2022
2 parents 2f7114a + 0c06da0 commit 5481024
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions application/configs/application.ini
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ googleScholar.openInNewWindow = 0
; Twitter Settings
twitter.openInNewWindow = 0

; PubMed Settings
pubmed.baseUrl = https://pubmed.ncbi.nlm.nih.gov/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; SWORD related configuration settings ;
Expand Down
2 changes: 1 addition & 1 deletion modules/export/views/scripts/publist/default.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@
<xsl:if test="@Type='pubmed'">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:text>http://www.ncbi.nlm.nih.gov/pubmed/</xsl:text>
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'baseUrl', 'pubmed')"/>
<xsl:value-of select="@Value" />
</xsl:attribute>
<xsl:text>PMID</xsl:text>
Expand Down
4 changes: 2 additions & 2 deletions modules/frontdoor/views/scripts/index/templates/metadata.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@
<td>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:text>http://www.ncbi.nlm.nih.gov/pubmed?term=</xsl:text>
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'baseUrl', 'pubmed')"/>
<xsl:value-of select="@Value" />
</xsl:attribute>
<xsl:text>http://www.ncbi.nlm.nih.gov/pubmed?term=</xsl:text>
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'baseUrl', 'pubmed')"/>
<xsl:value-of select="@Value" />
</xsl:element>
</td>
Expand Down
9 changes: 9 additions & 0 deletions tests/modules/export/controllers/IndexControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,4 +1014,13 @@ private function removeAccessOnModuleExportForGuest()
{
return $this->removeModuleAccess('export', 'guest');
}

public function testPublistPubmedRendering()
{
$this->dispatch('/export/index/publist/role/publists/number/coll_visible');

$this->assertResponseCode(200);

$this->markTestIncomplete('Setup collection for publist including document with pubmed-id');
}
}
14 changes: 14 additions & 0 deletions tests/modules/frontdoor/controllers/IndexControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1545,4 +1545,18 @@ public function testDuplicateDocIdParameter()
$this->assertXpathContentContains('//h2[@class="titlemain"]', 'KOBV');
$this->assertNotXpathContentContains('//h2[@class="titlemain"]', 'Sonderzeichen');
}

public function testPubmedRendering()
{
$this->dispatch('/frontdoor/index/index/docId/146');

$path = 'table.result-data.frontdoordata th.name';

$config = $this->getConfig();

$pubmedUrl = $config->pubmed->baseUrl . '123';

$this->assertQueryContentContains('table.result-data.frontdoordata td', $pubmedUrl);
$this->assertXpath("//table/tr/td/a[@href=\"$pubmedUrl\"]");
}
}

0 comments on commit 5481024

Please sign in to comment.