Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/viscoll #217

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
17,388 changes: 0 additions & 17,388 deletions package-lock.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ import { TextTextComponent } from './view-modes/text-text/text-text.component';
import { TextVersionsComponent } from './view-modes/text-versions/text-versions.component';
import { ThemesService } from './services/themes.service';
import { TitleStmtComponent } from './components/title-stmt/title-stmt.component';
import { VceditorComponent } from './components/vceditor/vceditor.component';
import { VerseComponent } from './components/verse/verse.component';
import { VersesGroupComponent } from './components/verses-group/verses-group.component';
import { VersionPanelComponent } from './panels/version-panel/version-panel.component';
Expand Down Expand Up @@ -275,6 +276,7 @@ const DynamicComponents = [
TextTextComponent,
TextVersionsComponent,
VersionPanelComponent,
VceditorComponent,
WitnessPanelComponent,
XmlBeautifyPipe,
...DynamicComponents,
Expand Down
16 changes: 16 additions & 0 deletions src/app/components/vceditor/vceditor.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<span *ngFor="let quire of quires">
<img src={{quire.quireImg}}/>
<span *ngFor="let leaf of quire.memberleaves">
<span *ngIf="leaf.memberrecto.sidedata.params.image.url; else norectoimg"><img src={{leaf.memberrecto.sidedata.params.image.url}}/></span>
<ng-template #norectoimg><img class="blanksideimg" src="https://cdn.rawgit.com/leoba/VisColl/master/data/support/images/x.jpg"/></ng-template>
<span *ngIf="leaf.memberverso.sidedata.params.image.url; else noversoimg"><img src={{leaf.memberverso.sidedata.params.image.url}}/></span>
<ng-template #noversoimg><img class="blanksideimg" src="https://cdn.rawgit.com/leoba/VisColl/master/data/support/images/x.jpg"/></ng-template>
</span><br/>
<span *ngIf="quire.terms[0]">Termini fascicolo: <span *ngFor="let qterm of quire.terms">{{qterm.params.title}}</span><br/></span>
<span *ngFor="let leaf of quire.memberleaves">
<span *ngIf="leaf.terms[0]">Termini foglia {{leaf.leafdata.params.folio_number}}: <span *ngFor="let lterm of leaf.terms">{{lterm.params.title}}</span><br/></span>
<span *ngIf="leaf.memberrecto.terms[0]">Termini recto: <span *ngFor="let rterm of leaf.memberrecto.terms">{{rterm.params.title}}</span><br/></span>
<span *ngIf="leaf.memberverso.terms[0]">Termini verso: <span *ngFor="let vterm of leaf.memberverso.terms">{{vterm.params.title}}</span><br/></span>
</span>
<hr/>
</span>
3 changes: 3 additions & 0 deletions src/app/components/vceditor/vceditor.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.blanksideimg {
max-height: 30%;
}
257 changes: 257 additions & 0 deletions src/app/components/vceditor/vceditor.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
import { Component, Output, EventEmitter } from '@angular/core';
import { OnInit } from '@angular/core';

import { HttpClient } from '@angular/common/http';

@Component({
selector: 'app-vceditor',
templateUrl: './vceditor.component.html',
styleUrls: ['./vceditor.component.scss']
})

export class VceditorComponent implements OnInit {
sampleTerm:Term = {
"params": {
"title": "Omelia I",
"taxonomy": "Texts",
"description": "",
"show": true
},
"objects": {
"Group": [],
"Leaf": [
1,
2,
3,
4,
5,
6,
7,
8,
9
],
"Recto": [
2,
4,
6,
10
],
"Verso": [
3
]
}};

sampleSide:Vceside = {sidedata: {"params": {
"page_number": "",
"texture": "",
"image": {
"manifestID": "",
"label": "",
"url": ""
},
"script_direction": "None"
},
"parentOrder": 1},
terms: []};

sampleLeaf:Vceleaf = {leafdata: {
"params": {
"folio_number": "1",
"material": "None",
"type": "Original",
"attached_above": "None",
"attached_below": "None",
"stub": "No",
"nestLevel": 1
},
"conjoined_leaf_order": 10,
"parentOrder": 1,
"rectoOrder": 1,
"versoOrder": 1},
memberrecto: this.sampleSide,
memberverso: this.sampleSide,
terms: []};

sampleQuire:Vcequire = {quiredata: {
"params": {
"type": "Quire",
"title": "Default",
"nestLevel": 1
},
"tacketed": [],
"sewing": [],
"parentOrder": null,
"memberOrders": [
"Leaf_1",
"Leaf_2",
"Leaf_3",
"Leaf_4",
"Leaf_5",
"Leaf_6",
"Leaf_7",
"Leaf_8",
"Leaf_9",
"Leaf_10"
]
},
memberleaves: [this.sampleLeaf],
quireImg:"",
terms: []};


leaves : Array<Vceleaf> = [];
quires : Array<Vcequire> = [];
rectos : Array<Vceside> = [];
versos: Array<Vceside> = [];
terms: Array<Term> = [];
Data: any;

constructor(
private http: HttpClient
) {

}

takeData() {
let observable = this.http.get('./assets/data/visColl.json');
observable.subscribe({next: (data:any)=> {
this.Data=data;
this.assignmentcycle();
}});
}

assignmentcycle() {

for (let rectocounter in this.Data.Rectos) {
let side=JSON.parse(JSON.stringify(this.sampleSide)); //without double encoding, this would modify sampleSide
side.sidedata=JSON.parse(JSON.stringify(this.Data.Rectos[rectocounter]));
this.rectos.push(side);
}

for (let versocounter in this.Data.Versos) {
let side=JSON.parse(JSON.stringify(this.sampleSide));
side.sidedata=JSON.parse(JSON.stringify(this.Data.Versos[versocounter]));
this.versos.push(side);
}

for (let leafcounter in this.Data.Leafs) {
let leaf=JSON.parse(JSON.stringify(this.sampleLeaf));
leaf.leafdata=JSON.parse(JSON.stringify(this.Data.Leafs[leafcounter]));
leaf.memberrecto=this.rectos.find(recto => (recto.sidedata.parentOrder == Number(leafcounter))); //find for the first matching element; filter would return an array
leaf.memberverso=this.versos.find(verso => (verso.sidedata.parentOrder == Number(leafcounter)));
this.leaves.push(leaf);
}

for (let groupcounter in this.Data.Groups) {
let group=JSON.parse(JSON.stringify(this.sampleQuire));
group.quiredata=JSON.parse(JSON.stringify(this.Data.Groups[groupcounter]));
group.memberleaves=this.leaves.filter(leaf => (leaf.leafdata.parentOrder == Number(groupcounter)));
group.quireImg="./assets/data/SVG/"+this.Data.project.shelfmark.replace(/\s/g, "")+"-"+groupcounter.toString()+".svg";
this.quires.push(group);
}

for (let termcounter in this.Data.Terms) {
let term=JSON.parse(JSON.stringify(this.sampleTerm));
term=this.Data.Terms[termcounter];
this.terms.push(term);

for (let quirenumber in term.objects.Group) {
this.quires[Number(term.objects.Group[quirenumber])-1].terms.push(term);
};

for (let leafnumber in term.objects.Leaf) {
this.leaves[Number(term.objects.Leaf[leafnumber])-1].terms.push(term);
};

for (let rectonumber in term.objects.Recto) {
this.rectos[Number(term.objects.Recto[rectonumber])-1].terms.push(term);
};

for (let versonumber in term.objects.Verso) {
this.versos[Number(term.objects.Verso[versonumber])-1].terms.push(term);
};
}
}

@Output() vceditorEvent = new EventEmitter();
ngOnInit () {
this.takeData();
}
}

export class Vceside {
sidedata:SidedataType;
terms:Array<Term>;
}

export class Vcequire {
quiredata:QuiredataType;
memberleaves:Array<Vceleaf>;
quireImg:string;
terms:Array<Term>;
}
export class Vceleaf {
leafdata:LeafdataType;
memberrecto:Vceside;
memberverso:Vceside;
terms:Array<Term>;
}
export class Term {
params: TermParamsType;
objects: TermObjectsType;
}
export interface QuiredataType {
params: QuiredataParamsType;
tacketed: Array<string>;
sewing: Array<string>;
parentOrder: number;
memberOrders:Array<string>;
}
export interface QuiredataParamsType {
type: string;
title: string;
nestLevel: number;
}
export interface LeafdataType {
params: LeafdataParamsType;
conjoined_leaf_order: number;
parentOrder: number;
rectoOrder: number;
versoOrder: number
}
export interface LeafdataParamsType{
folio_number: number|string;
material: string|boolean;
type: string;
attached_above: string|boolean;
attached_below: string|boolean;
stub: string|boolean;
nestLevel: number;
}
export interface SidedataType {
params: SidedataParamsType;
parentOrder: number;
}
export interface SidedataParamsType{
page_number: string;
texture: string;
image: ImageType;
script_direction: string;
}
export interface ImageType{
manifestID: string;
label: string;
url: string;
}
export interface TermParamsType {
title: string;
taxonomy: string;
description: string;
show: boolean;
}
export interface TermObjectsType {
Group: Array<number>;
Leaf: Array<number>;
Recto: Array<number>;
Verso: Array<number>;
}
5 changes: 2 additions & 3 deletions src/app/nav-bar/nav-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
</ng-container>

<div *ngIf="viscollPanelOpened$ | async" class="viscoll-panel">
<!-- TODO: Add Viscoll -->
Viscoll coming soon...
</div>
<app-vceditor></app-vceditor>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading