-import {Component, Input} from '@angular/core';
+import {Component, Input, Renderer2} from '@angular/core';
import {DomSanitizer} from '@angular/platform-browser';
const OPAC_BASE_URL = '/eg/opac/record';
if (id && (id + '').match(/^\d+$/)) {
this._recordId = id;
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(
- `${OPAC_BASE_URL}/${id}`);
+ `${OPAC_BASE_URL}/${id}?readonly=1`);
} else {
this._recordId = null;
this.url = null;
return this._recordId;
}
- constructor(private sanitizer: DomSanitizer) {}
+ constructor(
+ private sanitizer: DomSanitizer,
+ private renderer: Renderer2) {}
+
+ handleLoad() {
+ const iframe = this.renderer.selectRootElement('#opac-iframe');
+
+ // 50 extra px adds enough space to avoid the scrollbar altogether
+ const height = 50 + iframe.contentWindow.document.body.offsetHeight;
+
+ iframe.style.height = `${height}px`;
+ }
}
<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/simple.js[% ctx.cache_key %]"></script>
[% INCLUDE "opac/i18n_strings.tt2" %]
-[% IF ctx.want_jquery %]
+[% IF ctx.want_jquery || ctx.readonly %]
<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/common/build/js/jquery.min.js[% ctx.cache_key %]"></script>
[% END; # ctx.want_jquery %]
+[% IF ctx.readonly %]
+<script type="text/javascript">
+ $(document).ready(function() {
+ $('a').removeAttr('href');
+ $('a').click(function(event) { event.preventDefault(); });
+ $('button').prop('disabled', true);
+ $('button').click(function(event) { event.preventDefault(); });
+ $('input').prop('disabled', true);
+ $('input').click(function(event) { event.preventDefault(); });
+ $('select').prop('disabled', true);
+ $('select').click(function(event) { event.preventDefault(); });
+ $('textarea').prop('disabled', true);
+ $('textarea').click(function(event) { event.preventDefault(); });
+ });
+</script>
+[% END %]
+
<!-- DOB validation for Patron Registration in OPAC -->
<script type="text/javascript">
function dobValidate(input) {