Skip to content

Commit

Permalink
Merge pull request #54 from TAMULib/dspace-7_x-sprint4-staging
Browse files Browse the repository at this point in the history
DSpace 7 Upgrade Sprint 4
  • Loading branch information
wwelling authored Jan 24, 2024
2 parents 1dc0858 + 605c284 commit 81058a5
Show file tree
Hide file tree
Showing 19 changed files with 648 additions and 53 deletions.
1 change: 1 addition & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
config.*.yml
!config.example.yml
!config.tamu.yml
47 changes: 47 additions & 0 deletions config/config.tamu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
rest:
ssl: true
host: api-dev.library.tamu.edu
port: 443
nameSpace: /dspace7

mediaViewer:
image: true
video: false

themes:
- name: capstone
extends: tamu
# handle: '1969.1/94971'
uuid: '330feb1a-a3b8-4ba1-91cd-adb9369b6fb3'
- name: esl
extends: tamu
# handle: '1969.1/1656'
uuid: '7243d893-6c7e-44fc-aa74-ecfbf7dc771c'
- name: periodicals
extends: tamu
# regex: '1969.1\/94990|1969.1\/6062'
regex: '0e87eb5c-ce4a-4e74-9d33-fcbfb5066209|4d390df8-2edf-4633-bfde-5b2df685c459'
- name: image-gallery
extends: tamu
# regex: '1969.1\/91004|1969.1\/590|1969.1\/97046|1969.1\/86434|1969.1\/128952|1969.1\/148733|1969.1\/155981|1969.1\/188336|1969.1\/155981|1969.1\/188335|1969.1\/194556|1969.1\/195994'
regex: 'befb7166-392b-445b-b907-1f4363bb6dfb|ed211f67-86ad-41ff-9696-fe0e7e17e1cb|d61f515b-8153-4718-9b9d-1ce679c955a0|c431e202-fc5b-46c8-b188-00901e1e215a|7c2ac72f-fd7a-4f27-b701-eb6e0539a876|beea4d64-0ff6-4e58-9f7b-489e1d6c6f75|282ec515-7b66-4492-b4d0-ae66d76f516b|6d433be8-7a28-4dc7-a245-f8dfbb7a513c|282ec515-7b66-4492-b4d0-ae66d76f516b|a3923d8b-249c-4b7d-8459-0c83953f7d8f|7c61a02c-2176-4c5a-9dd8-919353159e91|a4116d8b-8135-4449-a1b0-3378d5c7ecad'
- name: tamu
headTags:
- tagName: link
attributes:
rel: icon
href: assets/tamu/images/favicons/favicon.ico
sizes: any
- tagName: link
attributes:
rel: icon
href: assets/tamu/images/favicons/favicon.svg
type: image/svg+xml
- tagName: link
attributes:
rel: apple-touch-icon
href: assets/tamu/images/favicons/apple-touch-icon.png
- tagName: link
attributes:
rel: manifest
href: assets/tamu/images/favicons/manifest.webmanifest
44 changes: 1 addition & 43 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,4 @@ rest:
ssl: true
host: demo.dspace.org
port: 443
nameSpace: /server

mediaViewer:
image: true
video: false

themes:
- name: capstone
extends: tamu
# handle: '1969.1/94971'
uuid: '330feb1a-a3b8-4ba1-91cd-adb9369b6fb3'
- name: esl
extends: tamu
# handle: '1969.1/1656'
uuid: '7243d893-6c7e-44fc-aa74-ecfbf7dc771c'
- name: periodicals
extends: tamu
# regex: '1969.1\/94990|1969.1\/6062'
regex: '0e87eb5c-ce4a-4e74-9d33-fcbfb5066209|4d390df8-2edf-4633-bfde-5b2df685c459'
- name: image-gallery
extends: tamu
# regex: '1969.1\/91004|1969.1\/590|1969.1\/97046|1969.1\/86434|1969.1\/128952|1969.1\/148733|1969.1\/155981|1969.1\/188336|1969.1\/155981|1969.1\/188335|1969.1\/194556|1969.1\/195994'
regex: 'befb7166-392b-445b-b907-1f4363bb6dfb|ed211f67-86ad-41ff-9696-fe0e7e17e1cb|d61f515b-8153-4718-9b9d-1ce679c955a0|c431e202-fc5b-46c8-b188-00901e1e215a|7c2ac72f-fd7a-4f27-b701-eb6e0539a876|beea4d64-0ff6-4e58-9f7b-489e1d6c6f75|282ec515-7b66-4492-b4d0-ae66d76f516b|6d433be8-7a28-4dc7-a245-f8dfbb7a513c|282ec515-7b66-4492-b4d0-ae66d76f516b|a3923d8b-249c-4b7d-8459-0c83953f7d8f|7c61a02c-2176-4c5a-9dd8-919353159e91|a4116d8b-8135-4449-a1b0-3378d5c7ecad'
- name: tamu
headTags:
- tagName: link
attributes:
rel: icon
href: assets/tamu/images/favicons/favicon.ico
sizes: any
- tagName: link
attributes:
rel: icon
href: assets/tamu/images/favicons/favicon.svg
type: image/svg+xml
- tagName: link
attributes:
rel: apple-touch-icon
href: assets/tamu/images/favicons/apple-touch-icon.png
- tagName: link
attributes:
rel: manifest
href: assets/tamu/images/favicons/manifest.webmanifest
nameSpace: /server
9 changes: 9 additions & 0 deletions src/app/core/shared/collection.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class Collection extends DSpaceObject implements ChildHALResource, Handle
@deserialize
_links: {
license: HALLink;
// TAMU Customization - available licenses HALLink for this collection
licenses: HALLink;
harvester: HALLink;
mappedItems: HALLink;
itemtemplate: HALLink;
Expand All @@ -54,6 +56,13 @@ export class Collection extends DSpaceObject implements ChildHALResource, Handle
@link(LICENSE)
license?: Observable<RemoteData<License>>;

/**
* TAMU Customization - The available licenses for this Collection
* Will be undefined unless the licenses {@link HALLink} has been resolved.
*/
@link(LICENSE)
licenses?: Observable<RemoteData<PaginatedList<License>>>;

/**
* The logo for this Collection
* Will be undefined unless the logo {@link HALLink} has been resolved.
Expand Down
7 changes: 7 additions & 0 deletions src/app/core/shared/license.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ export class License extends DSpaceObject {
*/
@autoserialize
text: string;

/**
* TAMU Customization - The radio label for the license
*/
@autoserialize
label?: string;

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WorkspaceitemSectionUploadFileObject } from './workspaceitem-section-upload-file.model';

/**
* An interface to represent submission's license section data.
Expand All @@ -17,4 +18,14 @@ export interface WorkspaceitemSectionLicenseObject {
* A boolean representing if license has been granted
*/
granted: boolean;

/**
* TAMU Customization - A string representing which license has been selected
*/
selected?: string;

/**
* TAMU Customization - A list of license files [[WorkspaceitemSectionUploadFileObject]]
*/
files?: WorkspaceitemSectionUploadFileObject[];
}
6 changes: 6 additions & 0 deletions src/app/shared/testing/theme-service.stub.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class ThemeServiceStub {

getThemeName = jasmine.createSpy('getThemeName');
getThemeConfigFor = jasmine.createSpy('getThemeConfigFor');

}
7 changes: 7 additions & 0 deletions src/app/shared/upload/uploader/uploader-options.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export class UploaderOptions {
*/
maxFileNumber: number;

/**
* TAMU Customization - Additional parameters to inform which step made upload request
*/
additionalParameter?: {
[key: string]: any;
};

/**
* The request method to use for the file upload request
*/
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/upload/uploader/uploader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ export class UploaderComponent {
autoUpload: this.uploadFilesOptions.autoUpload,
method: this.uploadFilesOptions.method,
queueLimit: this.uploadFilesOptions.maxFileNumber,
// TAMU Customization - include additional parameter map to provide section id
additionalParameter: this.uploadFilesOptions.additionalParameter,
});

if (isUndefined(this.enableDragOverDocument)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { SubmissionService } from '../../submission.service';
import { SectionsService } from '../sections.service';
import { SubmissionServiceStub } from '../../../shared/testing/submission-service.stub';
import { SectionsServiceStub } from '../../../shared/testing/sections-service.stub';
import { ThemeService } from '../../../shared/theme-support/theme.service';
import { ThemeServiceStub } from '../../../shared/testing/theme-service.stub';
import { SectionDataObject } from '../models/section-data.model';
import { mockSubmissionCollectionId, mockSubmissionId } from '../../../shared/mocks/submission.mock';

Expand Down Expand Up @@ -51,6 +53,7 @@ describe('SubmissionSectionContainerComponent test suite', () => {

const submissionServiceStub: SubmissionServiceStub = new SubmissionServiceStub();
const sectionsServiceStub: SectionsServiceStub = new SectionsServiceStub();
const themeServiceStub: ThemeServiceStub = new ThemeServiceStub();

const submissionId = mockSubmissionId;
const collectionId = mockSubmissionCollectionId;
Expand All @@ -60,6 +63,8 @@ describe('SubmissionSectionContainerComponent test suite', () => {
sectionsServiceStub.getSectionState.and.returnValue(observableOf(sectionState));
sectionsServiceStub.getShownSectionErrors.and.returnValue(observableOf([]));
submissionServiceStub.getActiveSectionId.and.returnValue(observableOf('traditionalpageone'));
themeServiceStub.getThemeName.and.returnValue('dspace');
themeServiceStub.getThemeConfigFor.and.returnValue({ name: 'dspace' });
}

// waitForAsync beforeEach
Expand All @@ -78,6 +83,7 @@ describe('SubmissionSectionContainerComponent test suite', () => {
providers: [
{ provide: SectionsService, useValue: sectionsServiceStub },
{ provide: SubmissionService, useValue: submissionServiceStub },
{ provide: ThemeService, useValue: themeServiceStub },
SubmissionSectionContainerComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component, Injector, Input, OnInit, ViewChild } from '@angular/core';

import { SectionsDirective } from '../sections.directive';
import { ThemeService } from 'src/app/shared/theme-support/theme.service';
import { AlertType } from '../../../shared/alert/alert-type';
import { SectionDataObject } from '../models/section-data.model';
import { rendersSectionType } from '../sections-decorator';
import { AlertType } from '../../../shared/alert/alert-type';
import { SectionsDirective } from '../sections.directive';

/**
* This component represents a section that contains the submission license form.
Expand Down Expand Up @@ -50,12 +51,17 @@ export class SubmissionSectionContainerComponent implements OnInit {
*/
@ViewChild('sectionRef') sectionRef: SectionsDirective;

// TAMU Customization - theme service to get active theme
private themeService: ThemeService;

/**
* Initialize instance variables
*
* @param {Injector} injector
*/
constructor(private injector: Injector) {
// TAMU Customization - inject theme service
this.themeService = injector.get(ThemeService);
}

/**
Expand Down Expand Up @@ -88,6 +94,15 @@ export class SubmissionSectionContainerComponent implements OnInit {
* Find the correct component based on the section's type
*/
getSectionContent(): string {
return rendersSectionType(this.sectionData.sectionType);
// TAMU Customization - provide injected active theme to get themed section to render
let theme = this.themeService.getThemeName();
let themeConfig = this.themeService.getThemeConfigFor(theme);
// get theme "root class"
while (!!themeConfig.extends) {
themeConfig = this.themeService.getThemeConfigFor(theme);
}

return rendersSectionType(this.sectionData.sectionType, themeConfig.name);
// return rendersSectionType(this.sectionData.sectionType);
}
}
19 changes: 15 additions & 4 deletions src/app/submission/sections/sections-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
import { SectionsType } from './sections-type';

const submissionSectionsMap = new Map();
export function renderSectionFor(sectionType: SectionsType) {
// TAMU Customization - map sections by theme
export function renderSectionFor(sectionType: SectionsType, theme: string = 'dspace') {
return function decorator(objectElement: any) {
if (!objectElement) {
return;
}
submissionSectionsMap.set(sectionType, objectElement);
let themedMap = submissionSectionsMap.get(theme);
if (themedMap === undefined) {
themedMap = new Map();
submissionSectionsMap.set(theme, themedMap);
}
themedMap.set(sectionType, objectElement);
};
}

export function rendersSectionType(sectionType: SectionsType) {
return submissionSectionsMap.get(sectionType);
// TAMU Customization - get sections mapped by theme
export function rendersSectionType(sectionType: SectionsType, theme: string = 'dspace') {
let themedMap = submissionSectionsMap.get(theme);
if (themedMap === undefined || !themedMap.has(sectionType)) {
themedMap = submissionSectionsMap.get('dspace');
}
return themedMap.get(sectionType);
}
34 changes: 33 additions & 1 deletion src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4524,7 +4524,7 @@

"submission.sections.accesses.form.until-placeholder": "Until",

"submission.sections.license.granted-label": "I confirm the license above",
"submission.sections.license.granted-label": "I accept the terms of this license.",

"submission.sections.license.required": "You must accept the license",

Expand Down Expand Up @@ -5253,4 +5253,36 @@
"communityList.expandAll": "Expand All",

"communityList.collapseAll": "Collapse All",

"submission.sections.proxy-license.header": "Granting a License",

"submission.sections.proxy-license.last-step-label": "There is one last step:",

"submission.sections.proxy-license.last-step": "In order for OAKTrust to reproduce, translate and distribute your submission worldwide, you must agree to the following terms.",

"submission.sections.proxy-license.instructions": "Please select the license that best matches your situation, grant the license by selecting 'I accept the terms of this license.'; and then click '+Deposit'.",

"submission.sections.proxy-license.label": "Distribution license: ",

"submission.sections.proxy-license.permission-upload-label": "Proxy Submission License: ",

"submission.sections.proxy-license.permission-upload-instructions": "If you have a separate permission document from the copyright owner authorizing the release of this item, please attach it here.",

"submission.sections.proxy-license.permission-upload-successful": "Proxy license permission upload successful",

"submission.sections.proxy-license.permission-upload-failed": "Proxy license permission upload failed",

"submission.sections.proxy-license.permission-upload-drop-message": "Drop permission document to attach to the item",

"submission.sections.proxy-license.upload-label": "Proxy Submission License: ",

"submission.sections.proxy-license.upload-drop-message": "Drop permission document to attach to the item",

"submission.sections.proxy-license.upload-instructions": "If you have a separate permission document from the copyright owner authorizing the release of this item, please attach it here.",

"submission.sections.proxy-license.upload-successful": "Proxy license upload successful",

"submission.sections.proxy-license.upload-failed": "Proxy license upload failed",

"submission.sections.proxy-license.remove-successful": "Proxy license remove successful",
}
Loading

0 comments on commit 81058a5

Please sign in to comment.