<?
  $openUrl = $this->openUrl($this->driver, 'record');
  $openUrlActive = $openUrl->isActive();
  // Account for replace_other_urls setting
  $urls =  $this->record($this->driver)->getLinkDetails($openUrlActive);
  $title = $this->driver->getMainTitle(); 
  if (strpos($title,':') !== false) {
      $title = trim(strstr($title,':', true));
  } 

//  $title = $this->driver->getMainTitle() ;
?>
<? if (!empty($urls) || $openUrlActive): ?>
  <? foreach ($urls as $current): ?>
    <? if (strncmp($current['url'],"https://bibb-dspace.bibb.de/", strlen("https://bibb-dspace.bibb.de/")) == 0) : ?>
	<? continue; ?>
    <?endif ; ?>
    
    <? if (strncmp($current['url'],"www.bibb.de", strlen("www.bibb.de")) == 0) : ?>
	<? $current['url'] = "https://" .$current['url']; ?>
    <? endif; ?>

    <? if (strncmp($current['url'],"http://dispatch.opac.d-nb.de/", strlen("http://dispatch.opac.d-nb.de/")) == 0) : ?>
        <? $current['url'] = "https://zdb-katalog.de/list.xhtml?t=" .urlencode("\"" .$title ."\"")  ."&key=tit" ; ?>
        <? $current['desc'] = "\"" .$title ."\" in der ZDB"; ?>
    <? endif; ?>

    <? if (strncmp($current['url'],"urn:nbn:de:", strlen("urn:nbn:de:")) == 0) : ?>
	<? $current['url'] = "http://nbn-resolving.org/process-urn-form?identifier=" .urlencode($current['url']) ."&verb=full" ; ?>
	<? $current['desc'] = "DNB contents"; ?> 
    <? endif; ?>
    <? if (($start = strpos($current['url'], "(")) !== false) : ?>
	<? $current['desc'] = substr($current['url'],$start+1, strrpos($current['url'],")") - $start -1) ; ?>
	<? $current['url']  = trim(substr($current['url'],0, $start)); ?>
    <? endif; ?>
    <? if (($start = strpos($current['url'], "[")) !== false) : ?>
        <? $current['desc'] = substr($current['url'],$start+1, strrpos($current['url'],"]") - $start -1) ; ?>
        <? $current['url']  = trim(substr($current['url'],0, $start)); ?>
    <? endif; ?>
    
    <a href="<?=$this->escapeHtmlAttr($this->proxyUrl($current['url']))?>"><?=$this->escapeHtml($current['desc'])?></a><br/>

  <? endforeach; ?>
  <? if ($openUrlActive): ?>
    <?=$openUrl->renderTemplate()?><br/>
  <? endif; ?>
<? endif; ?>
