...
Code Block |
---|
title | dlibra-webapp/WEB-INF/components/resources/WEBAPP_en.xml |
---|
|
<entry key="CHContext.SeeAlso">See also</entry> |
Chcemy wyszukiwać podobne obiekty bazując na słowach kluczowych. Aby to zrealizować, musimy zmienić kod HTML strony z opisem publikacji w ten sposób, aby umożliwić dostęp do nich. W tym celu musimy zmodyfikować makro dispNode.
Do pliku dlibra-webapp/WEB-INF/components/templates/custom_library.vm
dodajmy następującą treść (treść tego makra można znaleźć w pliku custom_library.vm
, który znajduje się w archiwum dlibra-webapp/WEB-INF/lib/dcore-web-components-x.x.x.jar
):
Code Block |
---|
language | xml |
---|
title | dlibra-webapp/WEB-INF/components/templates/custom_library.vm |
---|
linenumbers | true |
---|
|
#macro ( dispNode $node $info)
<span class="attributeJustify">
#if($documentMetadata.getAttributeValues($info.Id, $metadataLanguage, $valueLangType).size() > 0)
<a href="${homepageUrl}${servletName}/indexsearch?attId=${info.id}" class="attributeInfo">
#set($t = "#printParentsLabels($node 0)")
#if($printAttParents)
${t.trim()}:
#else
${node.Info.Label}:
#end
</a>
<ul>
<li class="attributeValuesListElement">
<span class="attribute" style="margin:0;">
#foreach($value in $documentMetadata.getAttributeValues($info.Id, $metadataLanguage, $valueLangType))
#if($velocityCount > 1); #end
#if($value.toString().startsWith('http://'))
#set($urlName = ${res.getProperty("element_metadata.link")})
#set($urlValue = $value)
#if($value.toString().indexOf(" ") > 0)
#set($urlValue = $value.toString().substring(0,$value.toString().indexOf(" ")))
#set($urlName = $value.toString().substring($value.toString().indexOf(" "), $value.toString().length()))
#end
<a href="${urlValue}" target="_blank">$urlName</a>
<a href="${urlValue}" target="_blank">
<img alt=" " src="${homepageUrl}/style/common/img/popicon.gif"/></a>
#elseif($value.toString().startsWith('oai:'))
#if(${conf.get("use.fbc")})
<a href="${conf.get("fbc.url")}/id/${value}">${value}</a>
#else
<a href="${homepageUrl}${servletName}/docmetadata?id=${value}">${value}</a>
#end
#elseif(!$info.getRoleId().toString().equals("description"))
#set ( $strValue = $value.toString() )
<script type="text/javascript"><!--
function submit${info.Id}_${velocityCount}() {
submitQuery(${info.Id},'\'${escapeUtil.escapeForJS($strValue)}\'');
}
//--> </script>
<a href="javascript:submit${info.Id}_${velocityCount}()">${escapeUtil.escapeHtml("${value}")}</a>
## perform slice of long data but considering only "description" attributes
#else
#set ( $strValue = $value.toString() )
<script type="text/javascript"><!--
function submit${info.Id}_${velocityCount}() {
return '\'${escapeUtil.escapeForJS($strValue)}\'';
}
//--> </script>
<a href="javascript:submit${info.Id}_${velocityCount}()" id="attr_anch_${info.Id}_${velocityCount}">${escapeUtil.escapeHtml("${value}")}</a>
#end
#end
</span>
</li>
</ul>
#end
</span>
#end
|
a następnie zastąpmy linię:
Code Block |
---|
<span class="attribute" style="margin:0;"> |
na:
Code Block |
---|
<span class="attribute" style="margin:0;" id="${info.RDFName}"> |