[open-ils-commits] [GIT] Evergreen ILS branch master updated. 1d03f161727570e936ed8980c310c85869927153

Evergreen Git git at git.evergreen-ils.org
Tue Oct 29 15:23:19 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  1d03f161727570e936ed8980c310c85869927153 (commit)
       via  1fae8ec807e88cee21e18e8ec74b606e5bcdab91 (commit)
       via  fc990504b20269b189d3674fde521c4b06a70b9e (commit)
       via  6dfd3980475b7b4472a0fa2dc972534c87620e6c (commit)
      from  63f7c2448017a2c50ba95ed25bc0e5c89671d060 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1d03f161727570e936ed8980c310c85869927153
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Oct 29 14:25:42 2019 -0400

    LP1849137 Patron View hide OPAC header
    
    Hide the TPAC header (nav links, My Account, etc.) when displaying the
    embedded read-only record detail view in the staff catalog Patron View
    tab.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/templates/opac/parts/topnav.tt2 b/Open-ILS/src/templates/opac/parts/topnav.tt2
index f8dd9edc8b..f6390b71ab 100644
--- a/Open-ILS/src/templates/opac/parts/topnav.tt2
+++ b/Open-ILS/src/templates/opac/parts/topnav.tt2
@@ -1,7 +1,7 @@
 [%- IF ctx.maintenance_message -%]
 <div id="maintenance_message">[% ctx.maintenance_message %]</div>
 [%- END -%]
-[% IF !ctx.is_staff %]
+[% IF !ctx.is_staff && !ctx.readonly %]
 <div id="header-wrap">
 <div id="header">
     <div class="float-left">

commit 1fae8ec807e88cee21e18e8ec74b606e5bcdab91
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Oct 29 13:54:26 2019 -0400

    LP1849137 Catalog Patron View loading icon
    
    Display the usual loading circle icon while the embedded patron view
    iframe is loading.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
index 8a67300789..adbaeec39e 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
@@ -1,4 +1,8 @@
 
+<div *ngIf="!loaded" class="m-3 p-3 d-flex justify-content-center">
+  <div><img src="/images/progressbar_green.gif"/></div>
+</div>
+
 <ng-container *ngIf="url">
   <iframe id='opac-iframe' class="w-100" (load)="handleLoad()" [src]="url">
   </iframe> 
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
index 4a5bd036fa..98eadf38da 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
@@ -10,6 +10,7 @@ const OPAC_BASE_URL = '/eg/opac/record';
 export class OpacViewComponent {
 
     url; // SafeResourceUrlImpl
+    loaded: boolean;
 
     _recordId: number;
     @Input() set recordId(id: number) {
@@ -40,6 +41,7 @@ export class OpacViewComponent {
         const height = 50 + iframe.contentWindow.document.body.offsetHeight;
 
         iframe.style.height = `${height}px`;
+        this.loaded = true;
     }
 }
 

commit fc990504b20269b189d3674fde521c4b06a70b9e
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Oct 29 12:00:25 2019 -0400

    LP1849137 Catalog Patron View embedding improvements
    
    Adds a readonly record detail view to the OPAC.  This is used by the
    Angular catalog Patron View tab to present a version of the OPAC where
    all links, buttons, and inputs are disabled.
    
    Dynamically style the height of the embedded iframe to prevent nested
    scroll bars in the Patron View.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
index 119b888579..8a67300789 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
@@ -1,5 +1,6 @@
 
 <ng-container *ngIf="url">
-  <iframe class="w-100" height="450px" [src]="url"></iframe> 
+  <iframe id='opac-iframe' class="w-100" (load)="handleLoad()" [src]="url">
+  </iframe> 
 </ng-container>
 
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
index 22eee58728..4a5bd036fa 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
@@ -1,4 +1,4 @@
-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';
@@ -18,7 +18,7 @@ export class OpacViewComponent {
         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;
@@ -29,6 +29,17 @@ export class OpacViewComponent {
         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`;
+    }
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index c071c2452b..bc3972bac8 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -18,6 +18,7 @@ sub load_record {
     my %kwargs = @_;
     my $ctx = $self->ctx;
     $ctx->{page} = 'record';  
+    $ctx->{readonly} = $self->cgi->param('readonly');
 
     $self->timelog("load_record() began");
 
diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2
index 74a9bd49cf..28b043d4ef 100644
--- a/Open-ILS/src/templates/opac/parts/js.tt2
+++ b/Open-ILS/src/templates/opac/parts/js.tt2
@@ -2,10 +2,27 @@
 <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) {

commit 6dfd3980475b7b4472a0fa2dc972534c87620e6c
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Oct 21 10:41:15 2019 -0400

    LP1849137 Staff catalog Patron View tab
    
    Adds a tab to the Angular staff catalog record detail page which
    displays an embedded display of the patron OPAC view of the record
    detail page.  This replaces the View In Catalog button.
    
    The iframe is not linked or tied into the parent Angular app in any way.
    It's just an iframe with a source.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Garry Collum <gcollum at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
index d56168908a..810b9507fd 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
@@ -11,6 +11,7 @@ import {SearchFormComponent} from './search-form.component';
 import {ResultsComponent} from './result/results.component';
 import {RecordComponent} from './record/record.component';
 import {CopiesComponent} from './record/copies.component';
+import {OpacViewComponent} from './record/opac.component';
 import {ResultPaginationComponent} from './result/pagination.component';
 import {ResultFacetsComponent} from './result/facets.component';
 import {ResultRecordComponent} from './result/record.component';
@@ -52,6 +53,7 @@ import {MarcEditModule} from '@eg/staff/share/marc-edit/marc-edit.module';
     HoldingsMaintenanceComponent,
     SearchTemplatesComponent,
     CnBrowseComponent,
+    OpacViewComponent,
     CnBrowseResultsComponent
   ],
   imports: [
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html
index 62008a47df..9a64f73fad 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html
@@ -15,10 +15,6 @@
 
 <div class="row ml-0 mr-0">
 
-  <a target="_blank" href="/eg/opac/record/{{recId}}">
-    <button class="btn btn-outline-primary ml-1" i18n>View in Catalog</button>
-  </a>
-
   <a routerLink="/staff/catalog/hold/T" [queryParams]="{target: recId}">
     <button class="btn btn-outline-primary ml-1" i18n>Place Hold</button>
   </a>
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
new file mode 100644
index 0000000000..119b888579
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
@@ -0,0 +1,5 @@
+
+<ng-container *ngIf="url">
+  <iframe class="w-100" height="450px" [src]="url"></iframe> 
+</ng-container>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
new file mode 100644
index 0000000000..22eee58728
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts
@@ -0,0 +1,34 @@
+import {Component, Input} from '@angular/core';
+import {DomSanitizer} from '@angular/platform-browser';
+
+const OPAC_BASE_URL = '/eg/opac/record';
+
+ at Component({
+  selector: 'eg-opac-record-detail',
+  templateUrl: 'opac.component.html'
+})
+export class OpacViewComponent {
+
+    url; // SafeResourceUrlImpl
+
+    _recordId: number;
+    @Input() set recordId(id: number) {
+
+        // Verify record ID is numeric only
+        if (id && (id + '').match(/^\d+$/)) {
+            this._recordId = id;
+            this.url = this.sanitizer.bypassSecurityTrustResourceUrl(
+                `${OPAC_BASE_URL}/${id}`);
+        } else {
+            this._recordId = null;
+            this.url = null;
+        }
+    }
+
+    get recordId(): number {
+        return this._recordId;
+    }
+
+    constructor(private sanitizer: DomSanitizer) {}
+}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
index 9b9fe3cbab..98a270b6d2 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
@@ -74,6 +74,12 @@
           </eg-catalog-record-conjoined>
         </ng-template>
       </ngb-tab>
+      <ngb-tab title="Patron View" i18n-title id="opac">
+        <ng-template ngbTabContent>
+          <eg-opac-record-detail [recordId]="recordId">
+          </eg-opac-record-detail>
+        </ng-template>
+      </ngb-tab>
     </ngb-tabset>
   </div>
 </div>

-----------------------------------------------------------------------

Summary of changes:
 .../eg2/src/app/staff/catalog/catalog.module.ts    |  2 +
 .../staff/catalog/record/actions.component.html    |  4 --
 .../app/staff/catalog/record/opac.component.html   | 10 +++++
 .../src/app/staff/catalog/record/opac.component.ts | 47 ++++++++++++++++++++++
 .../app/staff/catalog/record/record.component.html |  6 +++
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm |  1 +
 Open-ILS/src/templates/opac/parts/js.tt2           | 19 ++++++++-
 Open-ILS/src/templates/opac/parts/topnav.tt2       |  2 +-
 8 files changed, 85 insertions(+), 6 deletions(-)
 create mode 100644 Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.html
 create mode 100644 Open-ILS/src/eg2/src/app/staff/catalog/record/opac.component.ts


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list