diff --git a/resources/i18n/en.json b/resources/i18n/en.json
index c7cb9a5ba7..e75441c477 100644
--- a/resources/i18n/en.json
+++ b/resources/i18n/en.json
@@ -13,6 +13,12 @@
"head": "Recent Submissions"
}
}
+ },
+ "item-mapper": {
+ "head": "Item Mapper - Map Items from Other Collections",
+ "collection": "Collection: \"{{name}}\"",
+ "description": "This is the item mapper tool that allows collection administrators to map items from other collections into this collection. You can search for items from other collections and map them, or browse the list of currently mapped items.",
+ "return": "Return"
}
},
"community": {
@@ -43,6 +49,13 @@
"simple": "Simple item page",
"full": "Full item page"
}
+ },
+ "select": {
+ "table": {
+ "collection": "Collection",
+ "author": "Author",
+ "title": "Title"
+ }
}
},
"nav": {
diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
new file mode 100644
index 0000000000..078eabd1c7
--- /dev/null
+++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
@@ -0,0 +1,45 @@
+
+
+
+
{{'collection.item-mapper.head' | translate}}
+
+
{{'collection.item-mapper.description' | translate}}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.scss b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.scss
new file mode 100644
index 0000000000..4414c21645
--- /dev/null
+++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.scss
@@ -0,0 +1,5 @@
+@import '../../../styles/variables.scss';
+
+.tab:hover {
+ cursor: pointer;
+}
diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts
new file mode 100644
index 0000000000..4456d3138e
--- /dev/null
+++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts
@@ -0,0 +1,69 @@
+import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { fadeIn, fadeInOut } from '../../shared/animations/fade';
+import { CollectionDataService } from '../../core/data/collection-data.service';
+import { ActivatedRoute, PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router';
+import { RemoteData } from '../../core/data/remote-data';
+import { Observable } from 'rxjs/Observable';
+import { Collection } from '../../core/shared/collection.model';
+import { SearchConfigurationService } from '../../+search-page/search-service/search-configuration.service';
+import { PaginatedSearchOptions } from '../../+search-page/paginated-search-options.model';
+import { PaginatedList } from '../../core/data/paginated-list';
+import { Item } from '../../core/shared/item.model';
+import { combineLatest, flatMap, map, tap } from 'rxjs/operators';
+import { getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/operators';
+import { SearchService } from '../../+search-page/search-service/search.service';
+import { DSpaceObject } from '../../core/shared/dspace-object.model';
+import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
+
+@Component({
+ selector: 'ds-collection-item-mapper',
+ styleUrls: ['./collection-item-mapper.component.scss'],
+ templateUrl: './collection-item-mapper.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ animations: [
+ fadeIn,
+ fadeInOut
+ ]
+})
+export class CollectionItemMapperComponent implements OnInit {
+
+ collectionRD$: Observable>;
+ searchOptions$: Observable;
+ collectionItemsRD$: Observable>>;
+ mappingItemsRD$: Observable>>;
+
+ activeTab = 0;
+
+ constructor(private collectionDataService: CollectionDataService,
+ private route: ActivatedRoute,
+ private router: Router,
+ private searchConfigService: SearchConfigurationService,
+ private searchService: SearchService) {
+ }
+
+ ngOnInit(): void {
+ this.collectionRD$ = this.route.data.map((data) => data.collection);
+ this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
+ this.collectionItemsRD$ = this.collectionRD$.pipe(
+ getSucceededRemoteData(),
+ combineLatest(this.searchOptions$),
+ flatMap(([collectionRD, options]) => {
+ return this.searchService.search(Object.assign(options, {
+ scope: collectionRD.payload.id
+ }));
+ }),
+ toDSpaceObjectListRD()
+ );
+ this.mappingItemsRD$ = this.searchOptions$.pipe(
+ flatMap((options: PaginatedSearchOptions) => this.searchService.search(options)),
+ toDSpaceObjectListRD()
+ );
+ }
+
+ getCurrentUrl(): string {
+ const urlTree = this.router.parseUrl(this.router.url);
+ const g: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
+ return '/' + g.toString();
+ }
+
+}
diff --git a/src/app/+collection-page/collection-page-routing.module.ts b/src/app/+collection-page/collection-page-routing.module.ts
index ca56bca2cd..c85d102437 100644
--- a/src/app/+collection-page/collection-page-routing.module.ts
+++ b/src/app/+collection-page/collection-page-routing.module.ts
@@ -3,6 +3,7 @@ import { RouterModule } from '@angular/router';
import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageResolver } from './collection-page.resolver';
+import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component';
@NgModule({
imports: [
@@ -14,6 +15,14 @@ import { CollectionPageResolver } from './collection-page.resolver';
resolve: {
collection: CollectionPageResolver
}
+ },
+ {
+ path: ':id/mapper',
+ component: CollectionItemMapperComponent,
+ pathMatch: 'full',
+ resolve: {
+ collection: CollectionPageResolver
+ }
}
])
],
diff --git a/src/app/+collection-page/collection-page.module.ts b/src/app/+collection-page/collection-page.module.ts
index 85462e67a3..79efea46c0 100644
--- a/src/app/+collection-page/collection-page.module.ts
+++ b/src/app/+collection-page/collection-page.module.ts
@@ -6,6 +6,7 @@ import { SharedModule } from '../shared/shared.module';
import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageRoutingModule } from './collection-page-routing.module';
import { SearchPageModule } from '../+search-page/search-page.module';
+import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component';
@NgModule({
imports: [
@@ -16,6 +17,7 @@ import { SearchPageModule } from '../+search-page/search-page.module';
],
declarations: [
CollectionPageComponent,
+ CollectionItemMapperComponent
]
})
export class CollectionPageModule {
diff --git a/src/app/shared/item-select/item-select.component.html b/src/app/shared/item-select/item-select.component.html
new file mode 100644
index 0000000000..c2d02b4529
--- /dev/null
+++ b/src/app/shared/item-select/item-select.component.html
@@ -0,0 +1,20 @@
+
diff --git a/src/app/shared/item-select/item-select.component.scss b/src/app/shared/item-select/item-select.component.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/shared/item-select/item-select.component.spec.ts b/src/app/shared/item-select/item-select.component.spec.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/shared/item-select/item-select.component.ts b/src/app/shared/item-select/item-select.component.ts
new file mode 100644
index 0000000000..7159d94962
--- /dev/null
+++ b/src/app/shared/item-select/item-select.component.ts
@@ -0,0 +1,28 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { ItemDataService } from '../../core/data/item-data.service';
+import { PaginatedList } from '../../core/data/paginated-list';
+import { RemoteData } from '../../core/data/remote-data';
+import { Observable } from 'rxjs/Observable';
+import { Item } from '../../core/shared/item.model';
+
+@Component({
+ selector: 'ds-item-select',
+ styleUrls: ['./item-select.component.scss'],
+ templateUrl: './item-select.component.html'
+})
+
+export class ItemSelectComponent implements OnInit {
+
+ @Input()
+ items$: Observable>>;
+
+ checked: boolean[] = [];
+
+ constructor(private itemDataService: ItemDataService) {
+ }
+
+ ngOnInit(): void {
+ this.items$ = this.itemDataService.findAll({});
+ }
+
+}
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index b6122dc70a..c5c6cad09b 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -83,6 +83,7 @@ import { InputSuggestionsComponent } from './input-suggestions/input-suggestions
import { CapitalizePipe } from './utils/capitalize.pipe';
import { MomentModule } from 'angular2-moment';
import { ObjectKeysPipe } from './utils/object-keys-pipe';
+import { ItemSelectComponent } from './item-select/item-select.component';
const MODULES = [
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
@@ -156,7 +157,8 @@ const COMPONENTS = [
TruncatableComponent,
TruncatablePartComponent,
BrowseByComponent,
- InputSuggestionsComponent
+ InputSuggestionsComponent,
+ ItemSelectComponent
];
const ENTRY_COMPONENTS = [