lp1959010 toward Staff View tab
authorJason Etheridge <jason@EquinoxOLI.org>
Mon, 3 Oct 2022 04:12:02 +0000 (00:12 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 28 Mar 2023 14:46:17 +0000 (10:46 -0400)
* make our Staff View tab with the new BibStaffView widget
* seed our BibStaffView with BibSummary
* first attempt at changing some identifiers with our seed code
* experimenting with layout and stripping courses functionality
* simplifying the layout for now and adding display fields
* moar data
* layout tweaks and propagate metabib attributes for Formats and Editions
* don't cross the streams with metabib related
* field names for the record and metabib variants of the catalog_summary call.  This would otherwise break some links in search results involving bibs with metarecords.
* hyperlinks for the formats and editions in the catalog staff view
* fix catalog_summary vs catalog_summary.staff bug
* searchOrg depth was being passed where a boolean was expected
* This seems like a failure of TypeScript to detect.. type.  What was going on here?
* layout and css tweaking
* fixing toc and relocating it and some other fields to column 1
* label fix

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Signed-off-by: Mary Llewellyn <mllewell@biblio.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
Open-ILS/src/eg2/src/app/staff/common.module.ts
Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts [new file with mode: 0644]
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index a4dd0b0..954906c 100644 (file)
@@ -37,6 +37,9 @@ export class BibRecordSummary {
     id: number; // == record.id() for convenience
     metabibId: number; // If present, this is a metabib summary
     metabibRecords: number[]; // all constituent bib records
+    staffViewMetabibId: number; // to supplement a record summary
+    staffViewMetabibRecords: number[]; // to supplement a record summary
+    staffViewMetabibAttributes: any; // to supplement a record summary
     orgId: number;
     orgDepth: number;
     record: IdlObject;
@@ -128,6 +131,9 @@ export class BibRecordService {
         .pipe(map(bibSummary => {
             const summary = new BibRecordSummary(bibSummary.record, orgId);
             summary.net = this.net; // inject
+            summary.staffViewMetabibId = Number(bibSummary.staff_view_metabib_id);
+            summary.staffViewMetabibRecords = bibSummary.staff_view_metabib_records;
+            summary.staffViewMetabibAttributes = bibSummary.staff_view_metabib_attributes;
             summary.display = bibSummary.display;
             summary.attributes = bibSummary.attributes;
             summary.holdCount = bibSummary.hold_count;
index f0428fa..c4384a0 100644 (file)
     </div>
     <ul ngbNav #recordTabs="ngbNav" [(activeId)]="recordTab"
       (navChange)="beforeNavChange($event)" [keyboard]="true" [roles]="false" role="tablist" class="nav-tabs">
+      <li role="presentation" [ngbNavItem]="'staff_view'">
+        <a i18n ngbNavLink role="tab">Staff View</a>
+        <ng-template ngbNavContent>
+          <eg-bib-staff-view [bibSummary]="summaryForDisplay()">
+          </eg-bib-staff-view>
+        </ng-template>
+      </li>
       <li role="presentation" [ngbNavItem]="'item_table'">
         <a i18n ngbNavLink role="tab">Item Table</a>
         <ng-template ngbNavContent>
     <div [ngbNavOutlet]="recordTabs" class="mt-2"></div>
   </div>
 </div>
-
-
index 619a5a0..294842a 100644 (file)
@@ -9,6 +9,7 @@ import {CatalogService} from '@eg/share/catalog/catalog.service';
 import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
 import {StaffCatalogService} from '../catalog.service';
 import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
+import {BibStaffViewComponent} from '@eg/staff/share/bib-staff-view/bib-staff-view.component';
 import {StoreService} from '@eg/core/store.service';
 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
 import {MarcEditorComponent} from '@eg/staff/share/marc-edit/editor.component';
@@ -154,7 +155,7 @@ export class RecordComponent implements OnInit {
         this.bib.getBibSummary(
             this.recordId,
             this.searchContext.searchOrg.id(),
-            this.searchContext.searchOrg.ou_type().depth()).toPromise()
+            this.searchContext.isStaff).toPromise()
         .then(summary => {
             this.summary =
                 this.staffCat.currentDetailRecordSummary = summary;
index 1381be0..d463853 100644 (file)
@@ -12,6 +12,7 @@ import {OpChangeComponent} from '@eg/staff/share/op-change/op-change.component';
 import {TitleComponent} from '@eg/share/title/title.component';
 import {BucketDialogComponent} from '@eg/staff/share/buckets/bucket-dialog.component';
 import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
+import {BibStaffViewComponent} from '@eg/staff/share/bib-staff-view/bib-staff-view.component';
 import {EgHelpPopoverComponent} from '@eg/share/eg-help-popover/eg-help-popover.component';
 import {DatetimeValidatorDirective} from '@eg/share/validators/datetime_validator.directive';
 import {MultiSelectComponent} from '@eg/share/multi-select/multi-select.component';
@@ -36,6 +37,7 @@ import {OfflineService} from '@eg/staff/share/offline.service';
     OpChangeComponent,
     BucketDialogComponent,
     BibSummaryComponent,
+    BibStaffViewComponent,
     EgHelpPopoverComponent,
     DatetimeValidatorDirective,
     MultiSelectComponent,
@@ -61,6 +63,7 @@ import {OfflineService} from '@eg/staff/share/offline.service';
     OpChangeComponent,
     BucketDialogComponent,
     BibSummaryComponent,
+    BibStaffViewComponent,
     EgHelpPopoverComponent,
     DatetimeValidatorDirective,
     MultiSelectComponent,
diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css
new file mode 100644 (file)
index 0000000..668b919
--- /dev/null
@@ -0,0 +1,7 @@
+.eg-bib-staff-view {
+    padding-top: 1rem;
+}
+
+.eg-bib-staff-view .list-group-item {
+    padding: .25rem .25rem 0;
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html
new file mode 100644 (file)
index 0000000..c42a68d
--- /dev/null
@@ -0,0 +1,348 @@
+<div class='eg-bib-staff-view card tight-card w-100' *ngIf="summary">
+    <div class="row"><!-- "table" -->
+
+        <!-- 1st column -->
+        <div class="col-md-4">
+
+            <!-- Col 1, Title Row -->
+            <div class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Title:</div>
+                <div class="col-sm-6">
+                    <a *ngIf="summary.display.title" href="/eg2/staff/catalog/search?query={{summary.display.title}}&fieldClass=title&joinOp=&matchOp=contains&dateOp=is">
+                        {{summary.display.title}}
+                    </a>
+                </div>
+            </div><!-- end of Col 1, Title Row -->
+
+            <!-- Col 1, Series Title Row -->
+            <div *ngIf="summary.display.series_title" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Series Title:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _series of summary.display.series_title" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_series}}&fieldClass=series&joinOp=&matchOp=contains&dateOp=is">
+                                {{_series}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end Col 1, Series Title Row-->
+
+            <!-- Col 1, Author Row -->
+            <div class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Author:</div>
+                <div class="col-sm-6">
+                    <a *ngIf="summary.display.author" href="/eg2/staff/catalog/search?query={{summary.display.author}}&fieldClass=author&joinOp=&matchOp=contains&dateOp=is">
+                        {{summary.display.author}}
+                    </a>
+                </div>
+            </div><!-- end Col 1, Author Row -->
+
+            <!-- Col 1, Creator Row -->
+            <div *ngIf="summary.display.creators" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Creator:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _creator of summary.display.creators" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_creator}}&fieldClass=author&joinOp=&matchOp=contains&dateOp=is">
+                                {{_creator}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Creator Row -->
+
+            <!-- Col 1, Performer Row -->
+            <div *ngIf="summary.display.performers" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Performer:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _performer of summary.display.performers" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_performer}}&fieldClass=author&joinOp=&matchOp=contains&dateOp=is">
+                                {{_performer}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Performer Row -->
+
+            <!-- Col 1, Edition Row -->
+            <div *ngIf="summary.display.edition" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Edition:</div>
+                <div class="col-sm-6">
+                    {{summary.display.edition}}
+                </div>
+            </div><!-- end of Col 1, Edition Row -->
+
+            <!-- Col 1, Publisher Row -->
+            <div *ngIf="summary.display.publisher" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Publisher:</div>
+                <div class="col-sm-6">
+                    {{summary.display.publisher}}
+                </div>
+            </div><!-- end of Col 1, Publisher Row -->
+
+            <!-- Col 1, Production Credit Row -->
+            <div *ngIf="summary.display.production_credits" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Production Credit:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _credit of summary.display.production_credits" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_credit}}&fieldClass=author&joinOp=&matchOp=contains&dateOp=is">
+                                {{_credit}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Production Credit Row -->
+
+            <!-- Col 1, Type of Resource Row -->
+            <div *ngIf="summary.display.type_of_resource" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Type of Resource:</div>
+                <div class="col-sm-6">
+                    {{summary.display.type_of_resource}}
+                </div>
+            </div><!-- end of Col 1, Type of Resource Row -->
+
+            <!-- Col 1, Physical Description Row -->
+            <div *ngIf="summary.display.physical_description" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Physical Description:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _desc of summary.display.physical_description" class="list-group-item">
+                            {{_desc}}
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Physical Description Row -->
+
+            <!-- Col 1, General Note Row -->
+            <div *ngIf="summary.display.general_note" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>General Note:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _note of summary.display.general_note" class="list-group-item">
+                            {{_note}}
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, General Note Row -->
+
+            <!-- Col 1, Bibliography Row -->
+            <div *ngIf="summary.display.bibliography" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Bibliography:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _bibliography of summary.display.bibliography" class="list-group-item">
+                            {{_bibliography}}
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Bibliography Row -->
+
+            <!-- Col 1, TOC Row -->
+            <div *ngIf="summary.display.toc" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Table of Contents:</div>
+                <div class="col-sm-6">
+                    {{summary.display.toc}}
+                </div>
+            </div><!-- end of Col 1, TOC Row -->
+
+            <!-- Col 1, Thesis Row -->
+            <div *ngIf="summary.display.thesis" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Thesis:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _thesis of summary.display.thesis" class="list-group-item">
+                            {{_thesis}}
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Thesis Row -->
+
+        </div><!-- 1st column -->
+
+        <div class="col-md-4"><!-- 2nd column -->
+
+            <!-- Col 2, ISBN Row -->
+            <div *ngIf="summary.display.isbn" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>ISBN:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _isbn of summary.display.isbn" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?identQuery={{_isbn}}&identQueryType=identifier%7Cisbn">
+                                {{_isbn}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 2, ISBN Row -->
+
+            <!-- Col 1, ISSN Row -->
+            <div *ngIf="summary.display.issn" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>ISSN:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _issn of summary.display.issn" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?identQuery={{_issn}}&identQueryType=identifier%7Cissn">
+                                {{_issn}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, ISSN Row -->
+
+            <!-- Col 1, UPC Row -->
+            <div *ngIf="summary.display.upc" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>UPC:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _upc of summary.display.upc" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?identQuery={{_upc}}&identQueryType=identifier%7Cupc">
+                                {{_upc}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, UPC Row -->
+
+            <!-- Col 1, Hold and Copy Counts Row -->
+            <div class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Hold and Copy Counts:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li class="list-group-item"><span i18n>{{summary.holdCount}} hold requests</span></li>
+                        <li class="list-group-item">
+                            <span i18n *ngIf=" summary.isHoldable">Record is holdable.</span>
+                            <span i18n *ngIf="!summary.isHoldable">Record is not holdable.</span>
+                        </li>
+                        <li *ngFor="let _count of summary.holdingsSummary" class="list-group-item">
+                            <span i18n>{{_count.available}} of {{_count.count}} copies available at {{orgName(_count.org_unit)}}.</span>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Hold and Copy Counts Row -->
+
+            <!-- Col 1, Formats and Editions Row -->
+            <div class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Formats and Editions:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <ng-container *ngIf="summary.staffViewMetabibAttributes.icon_format">
+                            <li *ngFor="let _x of summary.staffViewMetabibAttributes.icon_format | keyvalue" class="list-group-item">
+                                <a href="/eg2/staff/catalog/search?query=from_metarecord({{summary.staffViewMetabibId}}) icon_format({{_x.key}})">
+                                    {{_x.value.label}}
+                                </a>
+                                    {{_x.value.count}}
+                            </li>
+                        </ng-container>
+                        <ng-container *ngIf="summary.staffViewMetabibAttributes.item_lang">
+                            <li *ngFor="let _x of summary.staffViewMetabibAttributes.item_lang | keyvalue" class="list-group-item">
+                                <a href="/eg2/staff/catalog/search?query=from_metarecord({{summary.staffViewMetabibId}}) item_lang({{_x.key}})">
+                                    {{_x.value.label}}
+                                </a>
+                                    {{_x.value.count}}
+                            </li>
+                        </ng-container>
+                    </ul>
+                </div>
+            </div><!-- end of Col 1, Formats and Editions Row -->
+
+        </div><!-- 2nd column -->
+
+        <div class="col-md-4"><!-- 3rd column -->
+
+            <!-- Col 3, Abstract Row -->
+            <div *ngIf="summary.display.abstract" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Abstract:</div>
+                <div class="col-sm-6">
+                    {{summary.display.abstract}}
+                </div>
+            </div><!-- end of Col 3, Abstract Row -->
+
+            <!-- Col 3, Subject Row -->
+            <div *ngIf="summary.display.subject" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Subject:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _subj of summary.display.subject" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_subj}}&fieldClass=subject&joinOp=&matchOp=contains&dateOp=is">
+                                {{_subj}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Subject Row -->
+
+            <!-- Col 3, Subject Name Row -->
+            <div *ngIf="summary.display.subject_name" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Subject Name:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _subj of summary.display.subject_name" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_subj}}&fieldClass=subject&joinOp=&matchOp=contains&dateOp=is">
+                                {{_subj}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Subject Name Row -->
+
+            <!-- Col 3, Subject Topic Row -->
+            <div *ngIf="summary.display.subject_topic" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Subject Topic:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _subj of summary.display.subject_topic" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_subj}}&fieldClass=subject&joinOp=&matchOp=contains&dateOp=is">
+                                {{_subj}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Subject Topic Row -->
+
+            <!-- Col 3, Subject Geographic Row -->
+            <div *ngIf="summary.display.subject_geographic" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Subject Geographic:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _subj of summary.display.subject_geographic" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_subj}}&fieldClass=subject&joinOp=&matchOp=contains&dateOp=is">
+                                {{_subj}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Subject Geographic Row -->
+
+            <!-- Col 3, Subject Temporal Row -->
+            <div *ngIf="summary.display.subject_temporal" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Subject Temporal:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _subj of summary.display.subject_temporal" class="list-group-item">
+                            <a href="/eg2/staff/catalog/search?query={{_subj}}&fieldClass=subject&joinOp=&matchOp=contains&dateOp=is">
+                                {{_subj}}
+                            </a>
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Subject Temporal Row -->
+
+            <!-- Col 3, Genre Row -->
+            <div *ngIf="summary.display.genre" class="row">
+                <div class="col-sm-6 font-weight-bold" i18n>Genre:</div>
+                <div class="col-sm-6">
+                    <ul>
+                        <li *ngFor="let _genre of summary.display.genre" class="list-group-item">
+                            {{_genre}}
+                        </li>
+                    </ul>
+                </div>
+            </div><!-- end of Col 3, Genre Row -->
+
+        </div><!-- 3rd column -->
+
+    </div><!-- "table" -->
+</div>
diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts
new file mode 100644 (file)
index 0000000..2165705
--- /dev/null
@@ -0,0 +1,89 @@
+import {Component, OnInit, Input} from '@angular/core';
+import {OrgService} from '@eg/core/org.service';
+import {BibRecordService, BibRecordSummary
+    } from '@eg/share/catalog/bib-record.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+
+@Component({
+  selector: 'eg-bib-staff-view',
+  templateUrl: 'bib-staff-view.component.html',
+  styleUrls: ['bib-staff-view.component.css']
+})
+export class BibStaffViewComponent implements OnInit {
+
+    initDone = false;
+
+    // True / false if the display is vertically expanded
+    private _exp: boolean;
+    set expand(e: boolean) {
+        this._exp = e;
+        if (this.initDone) {
+            this.saveExpandState();
+        }
+    }
+    get expand(): boolean { return this._exp; }
+
+    // If provided, the record will be fetched by the component.
+    @Input() recordId: number;
+
+    // Otherwise, we'll use the provided bib summary object.
+    summary: BibRecordSummary;
+    @Input() set bibSummary(s: any) {
+        this.summary = s;
+        if (this.initDone && this.summary) {
+            this.summary.getBibCallNumber();
+        }
+    }
+
+    constructor(
+        private bib: BibRecordService,
+        private org: OrgService,
+        private store: ServerStoreService,
+        private cat: CatalogService
+    ) {}
+
+    ngOnInit() {
+
+        this.store.getItem('eg.cat.record.staff-view.collapse')
+        .then(value => this.expand = !value)
+        .then(_ => this.cat.fetchCcvms())
+        .then(_ => {
+            if (this.summary) {
+                return this.summary.getBibCallNumber();
+            } else {
+                if (this.recordId) {
+                    return this.loadSummary();
+                }
+            }
+        }).then(_ => this.initDone = true);
+    }
+
+    saveExpandState() {
+        this.store.setItem('eg.cat.record.staff-view.collapse', !this.expand);
+    }
+
+    loadSummary(): Promise<any> {
+        return this.bib.getBibSummary(
+            this.recordId,
+            this.org.root().id(),
+            true // isStaff
+        ).toPromise()
+        .then(summary => {
+            this.summary = summary;
+            return summary.getBibCallNumber();
+        });
+    }
+
+    orgName(orgId: number): string {
+        if (orgId) {
+            return this.org.get(orgId).shortname();
+        }
+    }
+
+    iconFormatLabel(code: string): string {
+        return this.cat.iconFormatLabel(code);
+    }
+}
+
+
index f7a0c8b..cfe1f68 100644 (file)
@@ -3079,8 +3079,15 @@ __PACKAGE__->register_method(
             desc => q/
                 Stream of record summary objects including id, record,
                 hold_count, copy_counts, display (metabib display
-                fields), attributes (metabib record attrs), plus
-                metabib_id and metabib_records for the metabib variant.
+                fields), and attributes (metabib record attrs).  The
+                metabib variant of the call gets metabib_id and
+                metabib_records, and the regular record version also
+                gets some metabib information, but returns them as
+                staff_view_metabib_id, staff_view_metabib_records, and
+                staff_view_metabib_attributes.  This is to mitigate the
+                need for code changes elsewhere where assumptions are
+                made when certain fields are returned.
+                
             /
         }
     }
@@ -3142,6 +3149,46 @@ sub catalog_record_summary {
             get_one_metarecord_summary($self, $e, $org_id, $rec_id) :
             get_one_record_summary($self, $e, $org_id, $rec_id);
 
+        # Let's get Formats & Editions data FIXME: consider peer bibs?
+        unless ($is_meta) {
+            my $meta_search = $e->search_metabib_metarecord_source_map({source => $rec_id});
+            if ($meta_search) {
+                $response->{staff_view_metabib_id} = $meta_search->[0]->metarecord;
+                my $maps = $e->search_metabib_metarecord_source_map({metarecord => $response->{staff_view_metabib_id}});
+                my @metabib_records = map { $_->source } @$maps;
+                $response->{staff_view_metabib_records} = \@metabib_records;
+
+                my $attributes = $U->get_bre_attrs(\@metabib_records);
+                # we get "243":{
+                #       "srce":{
+                #         "code":" ",
+                #         "label":"National bibliographic agency"
+                #       }, ...}
+                my $metabib_attr = {};
+
+                foreach my $bib_id ( keys %{ $attributes } ) {
+                    foreach my $ctype ( keys %{ $attributes->{$bib_id} } ) {
+                        # we want {
+                        #   "srce":{ " ": { "label": "National bibliographic agency", "count" : 1 } },
+                        #       ...
+                        #   }
+                        my $current_code = $attributes->{$bib_id}->{$ctype}->{code};
+                        my $code_label = $attributes->{$bib_id}->{$ctype}->{label};
+                        $metabib_attr->{$ctype} = {} unless $metabib_attr->{$ctype};
+                        if (! $metabib_attr->{$ctype}->{ $current_code }) {
+                            $metabib_attr->{$ctype}->{ $current_code } = {
+                                "label" => $code_label,
+                                "count" => 1
+                            }
+                        } else {
+                            $metabib_attr->{$ctype}->{ $current_code }->{count}++;
+                        }
+                    }
+                }
+                $response->{staff_view_metabib_attributes} = $metabib_attr;
+            }
+        }
+
         ($response->{copy_counts}) = $copy_method->run($org_id, $rec_id);
 
         $response->{first_call_number} = get_first_call_number(