Skip to content

Commit 8ca41ba

Browse files
Davide Negrettivins01-4science
authored andcommitted
Merged in DSC-1309-maintenance (pull request DSpace#1330)
DSC-1309 maintenance Approved-by: Andrea Barbasso
2 parents 616823c + 8f51fb6 commit 8ca41ba

6 files changed

Lines changed: 144 additions & 118 deletions

File tree

src/app/item-page/mirador-viewer/mirador-viewer.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export class MiradorViewerComponent implements OnInit {
8787
if (this.notMobile) {
8888
viewerPath += '&notMobile=true';
8989
}
90+
if (environment.mirador.enableDownloadPlugin) {
91+
viewerPath += '&enableDownloadPlugin=true';
92+
}
9093

9194
// TODO: Should the query term be trusted here?
9295
return this.sanitizer.bypassSecurityTrustResourceUrl(viewerPath);

src/config/app-config.interface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { FollowAuthorityMetadata } from './search-follow-metadata.interface';
3131
import { AdvancedAttachmentRenderingConfig } from './advanced-attachment-rendering.config';
3232
import { AttachmentRenderingConfig } from './attachment-rendering.config';
3333
import { SearchResultConfig } from './search-result-config.interface';
34+
import { MiradorConfig } from './mirador-config.interfaces';
3435

3536
interface AppConfig extends Config {
3637
ui: UIServerConfig;
@@ -68,6 +69,7 @@ interface AppConfig extends Config {
6869
attachmentRendering: AttachmentRenderingConfig;
6970
advancedAttachmentRendering: AdvancedAttachmentRenderingConfig;
7071
searchResult: SearchResultConfig;
72+
mirador: MiradorConfig;
7173
}
7274

7375
/**

src/config/default-app-config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
} from './advanced-attachment-rendering.config';
3535
import { AttachmentRenderingConfig } from './attachment-rendering.config';
3636
import { SearchResultConfig } from './search-result-config.interface';
37+
import { MiradorConfig } from './mirador-config.interfaces';
3738

3839
export class DefaultAppConfig implements AppConfig {
3940
production = false;
@@ -750,4 +751,8 @@ export class DefaultAppConfig implements AppConfig {
750751
additionalMetadataFields: [],
751752
authorMetadata: ['dc.contributor.author', 'dc.creator', 'dc.contributor.*'],
752753
};
754+
755+
mirador: MiradorConfig = {
756+
enableDownloadPlugin: true,
757+
};
753758
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Config } from './config.interface';
2+
3+
export interface MiradorConfig extends Config {
4+
enableDownloadPlugin: boolean;
5+
}

src/environments/environment.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,8 @@ export const environment: BuildConfig = {
568568
],
569569
authorMetadata: ['dc.contributor.author', 'dc.contributor.editor', 'dc.contributor.contributor', 'dc.creator'],
570570
},
571+
572+
mirador: {
573+
enableDownloadPlugin: true,
574+
},
571575
};

src/mirador-viewer/config.default.js

Lines changed: 125 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ const searchOption = params.get('searchable');
2424
const query = params.get('query');
2525
const multi = params.get('multi');
2626
const notMobile = params.get('notMobile');
27+
const isDownloadPluginEnabled = (params.get('enableDownloadPlugin') === 'true');
2728

2829
let windowSettings = {};
29-
let sidbarPanel = 'info';
30+
let sideBarPanel = 'info';
3031
let defaultView = 'single';
3132
let multipleItems = false;
3233
let thumbNavigation = 'off';
34+
let downloadPluginSettings = {
35+
restrictDownloadOnSizeDefinition: false
36+
};
3337

3438
windowSettings.manifestId = manifest;
3539

3640
(() => {
3741
if (searchOption) {
3842
defaultView = 'book';
39-
sidbarPanel = 'search';
43+
sideBarPanel = 'search';
4044
multipleItems = true;
4145
if (notMobile) {
4246
thumbNavigation = 'far-right';
@@ -45,7 +49,7 @@ windowSettings.manifestId = manifest;
4549
windowSettings.defaultSearchQuery = query;
4650
}
4751
} else {
48-
if(multi) {
52+
if (multi) {
4953
multipleItems = multi;
5054
if (notMobile) {
5155
thumbNavigation = 'far-right';
@@ -54,127 +58,130 @@ windowSettings.manifestId = manifest;
5458
}
5559
})();
5660

57-
(Mirador.viewer(
58-
{
59-
id: 'mirador',
60-
mainMenuSettings: {
61-
show: true
62-
},
63-
thumbnailNavigation: {
64-
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be be displayed. Other possible values are "far-bottom" or "far-right"
65-
displaySettings: true, // Display the settings for this in WindowTopMenu
66-
height: 120, // height of entire ThumbnailNavigation area when position is "far-bottom"
67-
width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
68-
},
69-
themes: {
70-
light: {
71-
palette: {
72-
type: 'light',
73-
primary: {
74-
main: '#266883',
75-
},
76-
secondary: {
77-
main: '#b03727',
78-
},
79-
shades: { // Shades that can be used to offset color areas of the Workspace / Window
80-
dark: '#eeeeee',
81-
main: '#ffffff',
82-
light: '#ffffff',
83-
},
84-
highlights: {
85-
primary: '#ffff00',
86-
secondary: '#00BFFF',
87-
},
88-
search: {
89-
default: { fillStyle: '#00BFFF', globalAlpha: 0.3 },
90-
hovered: { fillStyle: '#00FFFF', globalAlpha: 0.3 },
91-
selected: { fillStyle: '#ff0900', globalAlpha: 0.3 },
92-
},
93-
},
61+
let miradorConfiguration = {
62+
id: 'mirador',
63+
mainMenuSettings: {
64+
show: true
65+
},
66+
thumbnailNavigation: {
67+
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be be displayed. Other possible values are "far-bottom" or "far-right"
68+
displaySettings: true, // Display the settings for this in WindowTopMenu
69+
height: 120, // height of entire ThumbnailNavigation area when position is "far-bottom"
70+
width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
71+
},
72+
themes: {
73+
light: {
74+
palette: {
75+
type: 'light',
76+
primary: {
77+
main: '#266883',
9478
},
95-
dark: {
96-
palette: {
97-
type: 'dark',
98-
primary: {
99-
main: '#2790b0',
100-
},
101-
secondary: {
102-
main: '#eeeeee',
103-
},
104-
highlights: {
105-
primary: '#ffff00',
106-
secondary: '#00BFFF',
107-
},
108-
},
79+
secondary: {
80+
main: '#b03727',
10981
},
110-
},
111-
selectedTheme: 'light',
112-
data: [manifest],
113-
windows: [
114-
windowSettings
115-
],
116-
miradorSharePlugin: {
117-
dragAndDropInfoLink: 'https://iiif.io',
118-
embedOption: {
119-
enabled: true,
120-
embedUrlReplacePattern: [
121-
/.*/,
122-
embedURL
123-
],
124-
syncIframeDimensions: {
125-
height: {param: 'maxheight'},
126-
},
82+
shades: { // Shades that can be used to offset color areas of the Workspace / Window
83+
dark: '#eeeeee',
84+
main: '#ffffff',
85+
light: '#ffffff',
12786
},
128-
shareLink: {
129-
enabled: true,
130-
manifestIdReplacePattern: [
131-
/\/iiif\/manifest/,
132-
'',
133-
],
87+
highlights: {
88+
primary: '#ffff00',
89+
secondary: '#00BFFF',
90+
},
91+
search: {
92+
default: { fillStyle: '#00BFFF', globalAlpha: 0.3 },
93+
hovered: { fillStyle: '#00FFFF', globalAlpha: 0.3 },
94+
selected: { fillStyle: '#ff0900', globalAlpha: 0.3 },
13495
},
13596
},
136-
miradorDownloadPlugin: {
137-
restrictDownloadOnSizeDefinition: false
138-
},
139-
window: {
140-
allowClose: false,
141-
// sideBarOpenByDefault: false,
142-
allowFullscreen: true,
143-
allowMaximize: false,
144-
defaultView: defaultView,
145-
sideBarOpen: notMobile,
146-
allowTopMenuButton: true,
147-
defaultSidebarPanelWidth: 230,
148-
switchCanvasOnSearch: true,
149-
views: [
150-
{ key: 'single', behaviors: ['individuals'] },
151-
{ key: 'book', behaviors: ['paged'] },
152-
{ key: 'scroll', behaviors: ['continuous'] },
153-
{ key: 'gallery' },
154-
],
155-
panels: {
156-
info: true,
157-
attribution: false,
158-
canvas: true,
159-
search: searchOption,
160-
layers: false,
97+
},
98+
dark: {
99+
palette: {
100+
type: 'dark',
101+
primary: {
102+
main: '#2790b0',
103+
},
104+
secondary: {
105+
main: '#eeeeee',
106+
},
107+
highlights: {
108+
primary: '#ffff00',
109+
secondary: '#00BFFF',
161110
},
162-
sideBarPanel: sidbarPanel
163111
},
164-
workspace: {
165-
allowNewWindows: false,
166-
showZoomControls: true,
167-
type: 'mosaic'
112+
},
113+
},
114+
selectedTheme: 'light',
115+
data: [manifest],
116+
windows: [
117+
windowSettings
118+
],
119+
miradorSharePlugin: {
120+
dragAndDropInfoLink: 'https://iiif.io',
121+
embedOption: {
122+
enabled: true,
123+
embedUrlReplacePattern: [
124+
/.*/,
125+
embedURL
126+
],
127+
syncIframeDimensions: {
128+
height: {param: 'maxheight'},
168129
},
169-
workspaceControlPanel: {
170-
enabled: false
171-
}
172130
},
173-
[
174-
miradorShareDialogPlugin,
175-
miradorSharePlugin,
176-
miradorDownloadDialog,
177-
miradorDownloadPlugin
178-
]
179-
)
180-
)(manifest);
131+
shareLink: {
132+
enabled: true,
133+
manifestIdReplacePattern: [
134+
/\/iiif\/manifest/,
135+
'',
136+
],
137+
},
138+
},
139+
window: {
140+
allowClose: false,
141+
// sideBarOpenByDefault: false,
142+
allowFullscreen: true,
143+
allowMaximize: false,
144+
defaultView: defaultView,
145+
sideBarOpen: notMobile,
146+
allowTopMenuButton: true,
147+
defaultSidebarPanelWidth: 230,
148+
switchCanvasOnSearch: true,
149+
views: [
150+
{ key: 'single', behaviors: ['individuals'] },
151+
{ key: 'book', behaviors: ['paged'] },
152+
{ key: 'scroll', behaviors: ['continuous'] },
153+
{ key: 'gallery' },
154+
],
155+
panels: {
156+
info: true,
157+
attribution: false,
158+
canvas: true,
159+
search: searchOption,
160+
layers: false,
161+
},
162+
sideBarPanel: sideBarPanel
163+
},
164+
workspace: {
165+
allowNewWindows: false,
166+
showZoomControls: true,
167+
type: 'mosaic'
168+
},
169+
workspaceControlPanel: {
170+
enabled: false
171+
}
172+
};
173+
174+
let miradorPlugins = [
175+
miradorShareDialogPlugin,
176+
miradorSharePlugin,
177+
miradorDownloadDialog,
178+
];
179+
180+
(() => {
181+
if (isDownloadPluginEnabled) {
182+
miradorPlugins = [...miradorPlugins, miradorDownloadPlugin];
183+
miradorConfiguration.miradorDownloadPlugin = downloadPluginSettings;
184+
}
185+
})();
186+
187+
Mirador.viewer(miradorConfiguration, miradorPlugins);

0 commit comments

Comments
 (0)