diff --git a/app/Http/Controllers/Oai/RequestController.php b/app/Http/Controllers/Oai/RequestController.php index ade0e08..b30de8f 100644 --- a/app/Http/Controllers/Oai/RequestController.php +++ b/app/Http/Controllers/Oai/RequestController.php @@ -609,7 +609,9 @@ class RequestController extends Controller */ private function addLandingPageAttribute(\DOMNode $document, $dataid) { - $url = route('frontend.dataset.show', $dataid); + // $url = route('frontend.dataset.show', $dataid); + $base_domain = config('tethys.base_domain'); + $url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid; $owner = $document->ownerDocument; $attr = $owner->createAttribute('landingpage'); diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php index 32a2e09..22a1976 100644 --- a/app/Http/Controllers/Publish/EditorController.php +++ b/app/Http/Controllers/Publish/EditorController.php @@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\View; use \Exception; use Illuminate\Support\Facades\Config; +use Illuminate\Support\Facades\Log; use App\Models\DatasetIdentifier; use App\Models\Oai\OaiModelError; @@ -62,7 +63,7 @@ class EditorController extends Controller $this->doiClient = $DoiClient; //$this->middleware('auth'); - $this->xml = new \DomDocument(); + $this->xml = new \DomDocument('1.0', 'UTF-8'); $this->proc = new \XSLTProcessor(); } @@ -701,6 +702,7 @@ class EditorController extends Controller $cache = ($dataset->xmlCache) ? $dataset->xmlCache : new \App\Models\XmlCache(); $xmlModel->setXmlCache($cache); $domNode = $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0); + $this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id); $node = $this->xml->importNode($domNode, true); $this->addSpecInformation($node, 'data-type:' . $dataset->type); @@ -742,6 +744,24 @@ class EditorController extends Controller } } + /** + * Add the landingpage attribute to Rdr_Dataset XML output. + * + * @param \DOMNode $document Rdr_Dataset XML serialisation + * @param string $docid Id of the dataset + * @return void + */ + private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid) + { + $base_domain = config('tethys.base_domain'); + $url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid; + + $owner = $document->ownerDocument; + $attr = $owner->createAttribute('landingpage'); + $attr->appendChild($owner->createTextNode($url)); + $document->appendChild($attr); + } + /** * Load an xslt stylesheet. * @@ -749,7 +769,7 @@ class EditorController extends Controller */ private function loadStyleSheet($stylesheet) { - $this->xslt = new \DomDocument; + $this->xslt = new \DomDocument('1.0', 'UTF-8'); $this->xslt->load($stylesheet); $this->proc->importStyleSheet($this->xslt); if (isset($_SERVER['HTTP_HOST'])) { diff --git a/public/prefixes/doi_datacite.xslt b/public/prefixes/doi_datacite.xslt index ef40815..7546768 100644 --- a/public/prefixes/doi_datacite.xslt +++ b/public/prefixes/doi_datacite.xslt @@ -350,13 +350,20 @@ - GBA - - - + + + GBA + + + + + + + +