diff --git a/.github/workflows/nightly-e2e-tests.yml b/.github/workflows/nightly-e2e-tests.yml index 0eb17a5d4d..847ffaf3ad 100644 --- a/.github/workflows/nightly-e2e-tests.yml +++ b/.github/workflows/nightly-e2e-tests.yml @@ -1,7 +1,7 @@ name: Nightly E2E Tests on: schedule: - - cron: "0 0 * * *" + - cron: "0 2 * * *" workflow_dispatch: jobs: chrome-public-user: @@ -38,23 +38,6 @@ jobs: env: SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - ie11-public-user: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v1 - with: - ref: development - - name: Setup Python 3.8.0 - uses: actions/setup-python@v2 - with: - python-version: '3.8.0' - - name: Install robotframework dependencies - run: ./src/test/robotframework/setup.sh - - name: Nightly Internet Explorer Tests (Public User) - run: robot -P ./src/test/robotframework/libs -d target/test/robotframework/logs/ie11 -v USE_SAUCELABS:TRUE -v BROWSER:ie --include publicuserNOTfirefoxonlyNOTchromeonlyNOTnoslowpokeNOTlocalonly ./src/test/robotframework - env: - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} edge-public-user: runs-on: ubuntu-18.04 steps: @@ -94,7 +77,6 @@ jobs: needs: - chrome-public-user - firefox-public-user - - ie11-public-user - edge-public-user - safari-public-user steps: @@ -117,7 +99,6 @@ jobs: needs: - chrome-public-user - firefox-public-user - - ie11-public-user - edge-public-user - safari-public-user steps: @@ -135,35 +116,11 @@ jobs: env: SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - ie11-dataprovider: - runs-on: ubuntu-18.04 - needs: - - chrome-public-user - - firefox-public-user - - ie11-public-user - - edge-public-user - - safari-public-user - steps: - - uses: actions/checkout@v1 - with: - ref: development - - name: Setup Python 3.8.0 - uses: actions/setup-python@v2 - with: - python-version: '3.8.0' - - name: Install robotframework dependencies - run: ./src/test/robotframework/setup.sh - - name: Nightly Internet Explorer Tests (Dataprovider) - run: robot -P ./src/test/robotframework/libs -d target/test/robotframework/logs/ie11 -v USE_SAUCELABS:TRUE -v BROWSER:ie --include dataproviderNOTfirefoxonlyNOTchromeonlyNOTnoslowpokeNOTlocalonly ./src/test/robotframework - env: - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} edge-dataprovider: runs-on: ubuntu-18.04 needs: - chrome-public-user - firefox-public-user - - ie11-public-user - edge-public-user - safari-public-user steps: @@ -186,7 +143,6 @@ jobs: needs: - chrome-public-user - firefox-public-user - - ie11-public-user - edge-public-user - safari-public-user steps: @@ -209,7 +165,6 @@ jobs: needs: - chrome-dataprovider - firefox-dataprovider - - ie11-dataprovider - edge-dataprovider - safari-dataprovider steps: @@ -232,7 +187,6 @@ jobs: needs: - chrome-dataprovider - firefox-dataprovider - - ie11-dataprovider - edge-dataprovider - safari-dataprovider steps: @@ -250,35 +204,11 @@ jobs: env: SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - ie11-publisher: - runs-on: ubuntu-18.04 - needs: - - chrome-dataprovider - - firefox-dataprovider - - ie11-dataprovider - - edge-dataprovider - - safari-dataprovider - steps: - - uses: actions/checkout@v1 - with: - ref: development - - name: Setup Python 3.8.0 - uses: actions/setup-python@v2 - with: - python-version: '3.8.0' - - name: Install robotframework dependencies - run: ./src/test/robotframework/setup.sh - - name: Nightly Internet Explorer Tests (Publisher) - run: robot -P ./src/test/robotframework/libs -d target/test/robotframework/logs/ie11 -v USE_SAUCELABS:TRUE -v BROWSER:ie --include publisherNOTfirefoxonlyNOTchromeonlyNOTnoslowpokeNOTlocalonly ./src/test/robotframework - env: - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} edge-publisher: runs-on: ubuntu-18.04 needs: - chrome-dataprovider - firefox-dataprovider - - ie11-dataprovider - edge-dataprovider - safari-dataprovider steps: @@ -301,7 +231,6 @@ jobs: # needs: # - chrome-publisher # - firefox-publisher - # - ie11-publisher # - edge-publisher # steps: # - uses: actions/checkout@v1 @@ -323,17 +252,14 @@ jobs: needs: - chrome-public-user - firefox-public-user - - ie11-public-user - edge-public-user - safari-public-user - chrome-dataprovider - firefox-dataprovider - - ie11-dataprovider - edge-dataprovider - safari-dataprovider - chrome-publisher - firefox-publisher - - ie11-publisher - edge-publisher # - safari-publisher if: always() diff --git a/package-lock.json b/package-lock.json index b83c16dc04..41abed2664 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Metadatamanagement", - "version": "1.0.116-SNAPSHOT", + "version": "1.0.117", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -840,6 +840,11 @@ "@uirouter/core": "6.0.7" } }, + "angular-uuid": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/angular-uuid/-/angular-uuid-0.0.4.tgz", + "integrity": "sha1-h6hgyh02rjiffsYP0ENm7cDjWE0=" + }, "angulartics": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/angulartics/-/angulartics-1.6.0.tgz", @@ -1833,14 +1838,21 @@ } }, "clientjs": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clientjs/-/clientjs-0.2.0.tgz", - "integrity": "sha512-kuPP8d/kAeEDYu2vr7zek2y3zCrwmhjGy1K66oLgnnhxSPpsASD9HsIau8RdC3ANQNjDQjbnl9cYPi6NX6SBvw==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/clientjs/-/clientjs-0.2.1.tgz", + "integrity": "sha512-HN7yzgq8xMDjkNpSnpH3foMxaX5q9CUMcLAIsNwNnbJnuEhR8CDRxm22mEo+uQdiOUkCl5ZjdoN9lGBbL4jutQ==", "requires": { "globalthis": "^1.0.2", "inherits": "^2.0.4", "murmurhash-js": "^1.0.0", - "ua-parser-js": "^0.7.28" + "ua-parser-js": "^0.7.30" + }, + "dependencies": { + "ua-parser-js": { + "version": "0.7.31", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz", + "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==" + } } }, "clipboard": { @@ -12132,7 +12144,8 @@ "ua-parser-js": { "version": "0.7.28", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz", - "integrity": "sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==" + "integrity": "sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==", + "dev": true }, "uglify-es": { "version": "3.3.9", diff --git a/package.json b/package.json index 9a861797fd..fc32cd652b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Metadatamanagement", - "version": "1.0.116-SNAPSHOT", + "version": "1.0.117", "description": "Data Search for Higher Education Research and Science Studies", "private": true, "dependencies": { @@ -29,13 +29,14 @@ "angular-translate-storage-cookie": "2.19.0", "angular-ui-bootstrap": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.tar.gz", "angular-ui-router": "1.0.29", + "angular-uuid": "^0.0.4", "angulartics-piwik": "^1.0.6", "blob-polyfill": "https://github.com/bjornstar/blob-polyfill/archive/1.0.20150320.tar.gz", "bootstrap-sass": "3.4.1", "bowser": "https://github.com/lancedikson/bowser/archive/1.9.4.tar.gz", "cheet.js": "0.3.3", "citation-js": "0.5.1", - "clientjs": "0.2.0", + "clientjs": "0.2.1", "elasticsearch-browser": "https://github.com/elastic/bower-elasticsearch-js/archive/v16.7.1.tar.gz", "es5-shim": "4.6.2", "es6-shim": "0.35.6", diff --git a/pom.xml b/pom.xml index 4675d8d804..a35543f66a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.5.6 + 2.5.7 eu.dzhw.fdz metadatamanagement - 1.0.116-SNAPSHOT + 1.0.117 war metadatamanagement @@ -24,9 +24,10 @@ - 7.14.0 + 7.15.2 0.8.6 15 + 2.16.0 2.12.0 yyyyMMddHHmmss ${java.version} @@ -175,7 +176,7 @@ org.javers javers-spring-boot-starter-mongo - 6.5.0 + 6.5.1 org.jsoup @@ -190,17 +191,12 @@ org.springdoc springdoc-openapi-ui - 1.5.12 + 1.6.0 org.springframework.boot spring-boot-configuration-processor - - org.springframework.boot - spring-boot-devtools - true - org.springframework.boot spring-boot-loader-tools @@ -297,7 +293,7 @@ org.springframework.security.oauth.boot spring-security-oauth2-autoconfigure - 2.5.5 + 2.5.6 org.zalando diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AbstractAnalysisDataPackage.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AbstractAnalysisDataPackage.java index 89fdaffb83..67886bf618 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AbstractAnalysisDataPackage.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AbstractAnalysisDataPackage.java @@ -18,7 +18,8 @@ @NoArgsConstructor @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({@Type(value = DataPackage.class, name = "dataPackage"), - @Type(value = ExternalDataPackage.class, name = "externalData")}) + @Type(value = ExternalDataPackage.class, name = "externalDataPackage"), + @Type(value = CustomDataPackage.class, name = "customDataPackage")}) public abstract class AbstractAnalysisDataPackage implements Serializable { private static final long serialVersionUID = -2179924716031946800L; diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AnalysisPackage.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AnalysisPackage.java index 99abbc3825..d93b8cc55f 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AnalysisPackage.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/analysispackagemanagement/domain/AnalysisPackage.java @@ -154,10 +154,10 @@ public class AnalysisPackage extends AbstractShadowableRdcDomainObject */ @Valid private List<@I18nStringSize(max = StringLengths.MEDIUM, - message = "analysis-package-management.error.analysis-package.institution.i18n-string-size") + message = "analysis-package-management.error.analysis-package.institution.i18n-string-size") @I18nStringEntireNotEmpty( - message = "analysis-package-management.error.analysis-package.institution" - + ".i18n-string-entire-not-empty") I18nString> institutions; + message = "analysis-package-management.error.analysis-package.institution" + + ".i18n-string-entire-not-empty") I18nString> institutions; /** * The names of the sponsors which have sponsored the study or project from which this analysis @@ -170,8 +170,8 @@ public class AnalysisPackage extends AbstractShadowableRdcDomainObject private List<@I18nStringSize(max = StringLengths.MEDIUM, message = "analysis-package-management.error.analysis-package.sponsor.i18n-string-size") @I18nStringEntireNotEmpty( - message = "analysis-package-management.error.sponsor.institution" - + ".i18n-string-entire-not-empty") I18nString> sponsors; + message = "analysis-package-management.error.sponsor.institution" + + ".i18n-string-entire-not-empty") I18nString> sponsors; /** * The license of this analysis package. Markdown is supported. @@ -204,8 +204,7 @@ public class AnalysisPackage extends AbstractShadowableRdcDomainObject * At least one {@link Script} must be specified. */ @Valid - @Size(min = 1, - message = "analysis-package-management.error.analysis-package." + "scripts.at-leat-one") + @NotEmpty(message = "analysis-package-management.error.analysis-package.scripts.at-leat-one") private List + @@ -337,8 +338,7 @@ - + @@ -371,6 +371,16 @@ + + + + + + + + + + @@ -575,6 +585,7 @@ + @@ -624,6 +635,7 @@ + @@ -631,16 +643,21 @@ + + - + + + + @@ -655,6 +672,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.component.js b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.component.js new file mode 100644 index 0000000000..b019aacc15 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.component.js @@ -0,0 +1,18 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'customDataPackageController', + templateUrl: 'scripts/analysispackagemanagement/' + + 'components/customdatapackage/custom.html.tmpl', + bindings: { + currentForm: '<', + package: '=', + index: '<' + } + }; + + angular + .module('metadatamanagementApp') + .component('customDataPackageComponent', Component); +})(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.controller.js b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.controller.js new file mode 100644 index 0000000000..04dfe69ab5 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom-data-package.controller.js @@ -0,0 +1,39 @@ +(function() { + 'use strict'; + + function Controller( + LanguageService + ) { + var $ctrl = this; + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.availabilityType = [ + { + de: 'verfügbar', + en: 'accessible' + }, + { + de: 'nicht verfügbar', + en: 'not accessible' + } + ]; + $ctrl.accessWay = ['Download', 'Onsite', 'Remote-Desktop']; + $ctrl.checkAccessWay = function() { + if ($ctrl.package.availabilityType[$ctrl.currentLanguage] === $ctrl + .availabilityType[1][$ctrl.currentLanguage]) { + $ctrl.package.accessWay = ''; + return false; + } + return true; + }; + $ctrl.$onInit = function() { + $ctrl.package.accessWay = $ctrl.package.accessWay || ''; + }; + } + + angular + .module('metadatamanagementApp') + .controller('customDataPackageController', Controller); + } + +) +(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom.html.tmpl new file mode 100644 index 0000000000..20b2be1a36 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/customdatapackage/custom.html.tmpl @@ -0,0 +1,117 @@ +
+ +
+
+ +
+
+ +
+
+ + + + + + {{ item[$ctrl.currentLanguage] }} + + + +
+ {{'analysis-package-management.edit.hints.custom-data-package.availability-type.choose' | translate}} +
+
+
+ {{'analysis-package-management.error.custom-data-package.availability-type.i18n-not-null' | translate}} +
+
+
+ + + + + + + {{ item }} + + + +
+ {{'analysis-package-management.edit.hints.custom-data-package.access-way.choose' | translate}} +
+
+
+ {{'analysis-package-management.error.custom-data-package.access-way.i18n-not-null' | translate}} +
+
+
+
+ + + + diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.component.js b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.component.js new file mode 100644 index 0000000000..05917a5d04 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.component.js @@ -0,0 +1,18 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'dataPackageController', + templateUrl: 'scripts/analysispackagemanagement/' + + 'components/datapackage/data.html.tmpl', + bindings: { + index: '<', + currentForm: '<', + package: '=' + } + }; + + angular + .module('metadatamanagementApp') + .component('fdzDataPackageComponent', Component); +})(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.controller.js b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.controller.js new file mode 100644 index 0000000000..3a47a72822 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data-package.controller.js @@ -0,0 +1,132 @@ +/* global _ */ +(function() { + 'use strict'; + + function Controller( + $rootScope, + SearchDao, + LanguageService, + CurrentDataPackageService, + DataPackageSearchService, + DataAcquisitionProjectReleasesResource, + ProjectReleaseService, + DataPackageAccessWaysResource + ) { + var $ctrl = this; + var initialize = false; + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.currentDataPackage = ''; + $ctrl.currentAccessWay = ''; + $ctrl.currentVersion = {}; + $ctrl.dataPackages = []; + $ctrl.accessWays = []; + $ctrl.releases = []; + $ctrl.searchText = ''; + + function loadDataPackage(id, version) { + $rootScope.$broadcast('start-ignoring-404'); + var excludes = ['nested*', 'variables', 'questions', + 'surveys', 'instruments', 'relatedPublications', + 'concepts']; + DataPackageSearchService.findShadowByIdAndVersion(id, version, excludes) + .promise.then(function(data) { + CurrentDataPackageService.setCurrentDataPackage(data); + if (data) { + if (!$ctrl.currentDataPackage || initialize === true) { + $ctrl.currentDataPackage = data; + $ctrl.currentVersion.version = $ctrl.package.version; + $ctrl.currentAccessWay = $ctrl.package.accessWay; + } + loadVersion(data.dataAcquisitionProjectId, id); + } + }).finally(function() { + $rootScope.$broadcast('stop-ignoring-404'); + }); + } + + function loadVersion(dataAcquisitionProjectId, id) { + DataAcquisitionProjectReleasesResource.get( + { + id: ProjectReleaseService.stripVersionSuffix( + dataAcquisitionProjectId + ) + }) + .$promise + .then( + function(releases) { + $ctrl.releases = releases; + if ($ctrl.releases.length === 1) { + $ctrl.currentVersion = $ctrl.releases[0]; + $ctrl.package.version = $ctrl.currentVersion.version; + } + loadAccessWays(id); + }); + } + + function loadAccessWays(id) { + DataPackageAccessWaysResource.get({id: id}) + .$promise + .then(function(data) { + $ctrl.accessWays = data; + if ($ctrl.accessWays.length === 1) { + $ctrl.currentAccessWay = $ctrl.accessWays[0]; + $ctrl.package.accessWay = $ctrl.currentAccessWay; + } + initialize = false; + }); + } + + $ctrl.search = function(query) { + return SearchDao.search( + query, 1, null, null, + 'data_packages', 50, null, + null, null, null, true + ).then(function(data) { + var result = []; + _.forEach(data.hits.hits, function(item) { + result.push(item._source); + }); + return result; + }); + }; + + $ctrl.selectedItem = function(item) { + if (item) { + $ctrl.package.dataPackageMasterId = item.masterId; + if (!initialize) { + $ctrl.currentVersion.version = ''; + $ctrl.currentAccessWay = ''; + } + loadDataPackage(item.masterId, item.release.version); + } + }; + + $ctrl.changeVersion = function() { + $ctrl.package.version = $ctrl.currentVersion.version; + $ctrl.currentAccessWay = ''; + loadAccessWays($ctrl.package.dataPackageMasterId); + }; + + $ctrl.changeAccessWay = function() { + $ctrl.package.accessWay = $ctrl.currentAccessWay; + }; + + $ctrl.$onInit = function() { + $ctrl.package = $ctrl.package || {}; + if ($ctrl.package.dataPackageMasterId && $ctrl.package.version) { + initialize = true; + loadDataPackage( + $ctrl.package.dataPackageMasterId, + $ctrl.package.version + ); + } + }; + } + + angular + .module('metadatamanagementApp') + .controller('dataPackageController', Controller); + } + +) +(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data.html.tmpl new file mode 100644 index 0000000000..59475cc9a5 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/datapackage/data.html.tmpl @@ -0,0 +1,103 @@ +
+ + + {{item.title[$ctrl.currentLanguage]}} + + + {{'analysis-package-management.error.analyzed-data-package.data-package-master-id.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.analyzed-data-package.data-package' | translate}} +
+
+
+ {{'analysis-package-management.error.analyzed-data-package.data-package-master-id.not-empty' | translate}} +
+
+ {{'analysis-package-management.error.analyzed-data-package.data-package-master-id.not-valid' | translate}} +
+
+
+
+
+ + + + + + {{item.version}} + + + +
+ {{'analysis-package-management.edit.hints.analyzed-data-package.version' | translate}} +
+
+
+ {{'analysis-package-management.error.analyzed-data-package.version.not-empty' | translate}} +
+
+
+ + + + + + {{item | displayAccessWay}} + + + +
+ {{'analysis-package-management.edit.hints.analyzed-data-package.access-way.choose' | translate}} +
+
+
+ {{'analysis-package-management.error.analyzed-data-package.access-way.not-empty' | translate}} +
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.component.js b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.component.js new file mode 100644 index 0000000000..7aa3c0daa2 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.component.js @@ -0,0 +1,18 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'externalDataPackageController', + templateUrl: 'scripts/analysispackagemanagement/' + + 'components/externaldatapackage/external.html.tmpl', + bindings: { + currentForm: '<', + package: '=', + index: '<' + } + }; + + angular + .module('metadatamanagementApp') + .component('externalDataPackageComponent', Component); +})(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.controller.js b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.controller.js new file mode 100644 index 0000000000..fdd26fbfd6 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external-data-package.controller.js @@ -0,0 +1,37 @@ +(function() { + 'use strict'; + + function Controller( + LanguageService + ) { + var $ctrl = this; + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.availabilityType = [ + { + // type: 'OPEN_ACCESS', + de: 'Open Access', + en: 'open-access' + }, + { + // type: 'RESTRICTED_ACCESS', + de: 'beschränkter Zugang', + en: 'restricted access' + }, + { + // type: 'NOT_ACCESSIBLE', + de: 'nicht zugänglich', + en: 'not accessible' + } + ]; + $ctrl.$onInit = function() { + $ctrl.package.availabilityType = $ctrl.package.availabilityType || {}; + }; + } + + angular + .module('metadatamanagementApp') + .controller('externalDataPackageController', Controller); + } + +) +(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external.html.tmpl new file mode 100644 index 0000000000..c49b31e910 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/externaldatapackage/external.html.tmpl @@ -0,0 +1,128 @@ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + + +
+ {{ 'analysis-package-management.edit.hints.external-data-package.data-source-url' | translate}} +
+
+
+ {{'analysis-package-management.error.external-data-package.data-source-url.url-size' | translate}} +
+
+ {{'analysis-package-management.error.external-data-package.data-source-url.invalid-url' | translate}} +
+
+
+ + + + + + {{ item[$ctrl.currentLanguage] }} + + + +
+ {{'analysis-package-management.edit.hints.external-data-package.availability-type.choose' | translate}} +
+
+ {{'analysis-package-management.edit.hints.external-data-package.availability-type.open' | translate}} +
+
+ {{'analysis-package-management.edit.hints.external-data-package.availability-type.restricted' | translate}} +
+
+ {{'analysis-package-management.edit.hints.external-data-package.availability-type.none' | translate}} +
+
+
+ {{'analysis-package-management.error.external-data-package.availability-type.i18n-not-null' | translate}} +
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.component.js b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.component.js new file mode 100644 index 0000000000..09dbed9345 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.component.js @@ -0,0 +1,17 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'listDataPackageController', + templateUrl: 'scripts/analysispackagemanagement/' + + 'components/listdatapackage/list-data-package.html.tmpl', + bindings: { + currentForm: '<', + packages: '=' + } + }; + + angular + .module('metadatamanagementApp') + .component('listDataPackageComponent', Component); +})(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.controller.js b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.controller.js new file mode 100644 index 0000000000..0fd982ec3a --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.controller.js @@ -0,0 +1,70 @@ +/* global document */ +(function() { + 'use strict'; + + function Controller( + LanguageService + ) { + var $ctrl = this; + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.currentPackageIndex = null; + $ctrl.currentFocusElement = null; + $ctrl.focus = false; + $ctrl.packageElement = document.getElementById('packages'); + $ctrl.dataPackageList = { + dataPackage: { + type: 'dataPackage', + en: 'FDZ-DZHW Datapackage', + de: 'FDZ-DZHW Datenpaket' + }, + externalDataPackage: { + type: 'externalDataPackage', + en: 'External Data Package', + de: 'Externes Datenpaket' + }, + customDataPackage: { + type: 'customDataPackage', + en: 'Custom Data Package', + de: 'Benutzerdefiniertes Datenpaket' + } + }; + + $ctrl.$onInit = function() { + $ctrl.packages = $ctrl.packages || []; + }; + + $ctrl.addPackage = function() { + $ctrl.packages = $ctrl.packages || []; + $ctrl.packages.push({ + type: '' + }); + }; + + $ctrl.deletePackage = function(index) { + $ctrl.packages.splice(index, 1); + $ctrl.currentForm.$setDirty(); + }; + + $ctrl.move = function(dir, index) { + $ctrl.currentPackageIndex = index; + var move = { + up: -1, + down: +1 + }; + $ctrl.packages + .splice(index + parseInt(move[dir]), 0, + $ctrl.packages.splice(index, 1)[0]); + index = index + parseInt( + move[dir] + ); + $ctrl.currentForm.$setDirty(); + }; + } + + angular + .module('metadatamanagementApp') + .controller('listDataPackageController', Controller); + } + +) +(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.html.tmpl new file mode 100644 index 0000000000..bc5426bc95 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/listdatapackage/list-data-package.html.tmpl @@ -0,0 +1,121 @@ + + + +

+ {{ 'analysis-package-management.detail.label.analysis-data' | translate}}

+
+
+ + +
+
+
+ + + {{'analysis-package-management.edit.delete-script-tooltip' | translate}} + + delete_forever + + + + {{'analysis-package-management.edit.move-analysis-data-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-analysis-data-down-tooltip' | translate}} + + keyboard_arrow_down + +
+
+
+ + + + + + {{ item[$ctrl.currentLanguage] }} + + + +
+ {{'analysis-package-management.edit.hints.data-package' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.analysis-data-packages.package-type.i18n-not-null' | + translate}} +
+
+
+
+ + + +
+
+ +
+ +
+ + + + {{'analysis-package-management.edit.add-analysis-data-tooltip' | translate}} + + add + + +
diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.component.js b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.component.js new file mode 100644 index 0000000000..3a99ba9885 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.component.js @@ -0,0 +1,21 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'editScriptSectionController', + templateUrl: 'scripts/analysispackagemanagement/' + + 'components/scriptsection/edit-script-section.html.tmpl', + bindings: { + createMode: '<', + currentForm: '<', + packageId: '<', + masterId: '<', + projectId: '<', + scripts: '=' + } + }; + + angular + .module('metadatamanagementApp') + .component('editScriptSectionComponent', Component); +})(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.controller.js b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.controller.js new file mode 100644 index 0000000000..d8e764019f --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.controller.js @@ -0,0 +1,327 @@ +/* globals _, document */ +(function() { + 'use strict'; + + function Controller( + $scope, + uuid, + isoLanguages, + LanguageService, + CommonDialogsService, + $mdDialog, + SimpleMessageToastService, + ScriptSoftwarePackagesResource, + ScriptAttachmentUploadService, + ScriptAttachmentResource + ) { + var $ctrl = this; + var isInitialisingSelectedLanguage = false; + var isInitialisingSelectedSoftwarePackage = false; + var softwarePackages = []; + + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.selectedFile = ''; + $ctrl.scriptAttachmentMetadata = []; + $ctrl.currentScriptIndex = null; + $ctrl.currentFocusElement = null; + $ctrl.focus = false; + $ctrl.scriptElement = document.getElementById('scripts'); + + var isoLanguagesArray = Object.keys(isoLanguages) + .map(function(key) { + return { + code: key, + 'displayLanguage': isoLanguages[key] + }; + }); + + var initSelectedLanguages = function() { + isInitialisingSelectedLanguage = true; + _.forEach($ctrl.scripts, function(value, index) { + _.filter(isoLanguagesArray, + function(isoLanguage) { + if (isoLanguage.code === value.usedLanguage) { + $ctrl['languageSearchText_' + index] = isoLanguage + .displayLanguage[$ctrl.currentLanguage]; + $ctrl['selectedLanguage_' + index] = isoLanguage.code; + } + }); + }); + }; + + var getScriptAttachmentMetadata = function() { + _.forEach($ctrl.scripts, function(value, index) { + _.filter($ctrl.scriptAttachments, function(item) { + if (item.scriptUuid === value.uuid) { + $ctrl.scripts[index].scriptAttachmentMetadata = item; + } + }); + }); + }; + + var getSoftwarePackages = function() { + ScriptSoftwarePackagesResource.get() + .$promise.then(function(softwarePackage) { + angular.copy(softwarePackage, softwarePackages); + }); + }; + + var initSelectedSoftwarePackages = function() { + _.forEach($ctrl.scripts, function(value, index) { + $ctrl['selectedSoftwarePackage_' + index] = value.softwarePackage; + }); + }; + + $scope.$on('LoadScriptEvent', function(event) { // jshint ignore:line + // $ctrl.scripts = options.scripts; + $ctrl.$onInit(); + }); + + $ctrl.$onInit = function() { + if ($ctrl.scripts && $ctrl.scripts.length === 0) { + $ctrl.scripts = [{ + uuid: uuid.v4(), + title: { + de: '', + en: '' + }, + softwarePackage: '', + softwarePackageVersion: '', + usedLanguage: '', + language: '', + scriptAttachmentMetadata: { + fileName: '' + } + }]; + } + $ctrl.attachments = $ctrl.attachments || []; + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + $ctrl.loadScriptAttachments(); + initSelectedLanguages(); + getSoftwarePackages(); + initSelectedSoftwarePackages(); + }; + + $ctrl.deleteScript = function(index, uuid) { + if ($ctrl.scriptAttachments && $ctrl.scriptAttachments.length > 0) { + var scriptAttachment = _.filter($ctrl.scriptAttachments, + function(attachment) { + if (attachment.scriptUuid === uuid) { + var metadata = { + analysisPackageId: $ctrl.packageId, + dataAcquisitionProjectId: $ctrl.projectId, + masterId: $ctrl.masterId, + scriptUuid: $ctrl.scripts[index].uuid, + fileName: attachment.name + }; + return metadata; + } + }); + if (scriptAttachment.length > 0) { + $ctrl.deleteScriptAttachment( + scriptAttachment[0], 0, false + ); + // $ctrl.loadScriptAttachments(); + } + } + + $ctrl.scripts.splice(index, 1); + // Remove content from md-autocomplete components + $ctrl['languageSearchText_' + index] = ''; + $ctrl['selectedLanguage_' + index] = null; + $ctrl['softwarePackageSearchText_' + index] = ''; + $ctrl['selectedSoftwarePackage_' + index] = null; + $ctrl.currentForm.$setDirty(); + $ctrl.$onInit(); + }; + + $ctrl.addScript = function() { + $ctrl.scripts.push({ + uuid: uuid.v4(), + title: { + de: '', + en: '' + }, + softwarePackage: '', + softwarePackageVersion: '', + usedLanguage: '', + scriptAttachmentMetadata: { + fileName: '' + } + }); + }; + + $ctrl.moveScript = function(dir, index) { + var move = { + up: -1, + down: +1 + }; + $ctrl.scripts + .splice(index + parseInt(move[dir]), 0, + $ctrl.scripts.splice(index, 1)[0]); + index = index + parseInt( + move[dir] + ); + $ctrl.$onInit(); + }; + + $ctrl.searchLanguages = function(searchText) { + if (!searchText || searchText === '') { + return isoLanguagesArray; + } + var lowerCasedSearchText = searchText.toLowerCase(); + return _.filter(isoLanguagesArray, function(isoLanguage) { + return isoLanguage.displayLanguage[$ctrl.currentLanguage] + .toLowerCase().indexOf(lowerCasedSearchText) > -1; + }); + }; + + $ctrl.selectedLanguageChanged = function(index, code) { + $ctrl.scripts[index].usedLanguage = code; + // if ($ctrl.scripts[index].language) { + // $ctrl.scripts[index] + // .usedLanguage = $ctrl.scripts[index].language + // .code; + // } else { + // $ctrl.scripts[index].usedLanguage = ''; + // } + + if (!isInitialisingSelectedLanguage) { + $ctrl.currentForm.$setDirty(); + } + isInitialisingSelectedLanguage = false; + }; + + $ctrl.searchSoftwarePackages = function(searchText) { + if (!searchText || searchText === '') { + return softwarePackages; + } + var lowerCasedSearchText = searchText.toLowerCase(); + return _.filter(softwarePackages, function(softwarePackage) { + return softwarePackage + .toLowerCase().indexOf(lowerCasedSearchText) > -1; + }); + }; + + $ctrl.selectedSoftwarePackageChanged = function(index) { + if ($ctrl['selectedSoftwarePackage_' + index]) { + $ctrl.scripts[index].softwarePackage = + $ctrl['selectedSoftwarePackage_' + index]; + } else { + delete $ctrl.scripts[index].softwarePackage; + } + if (!isInitialisingSelectedLanguage) { + $ctrl.currentForm.$setDirty(); + } + isInitialisingSelectedSoftwarePackage = false; + }; + + $ctrl.loadScriptAttachments = function() { + ScriptAttachmentResource.findByAnalysisPackageId({ + analysisPackageId: $ctrl.packageId + }).$promise.then( + function(attachments) { + if (attachments.length > 0) { + $ctrl.scriptAttachments = attachments; + getScriptAttachmentMetadata(); + } + }); + }; + $ctrl.addScriptAttachmentButton = function(index) { + angular.element( + document + .querySelector('input[name="filename_' + index + '"]')) + .click(); + }; + $ctrl.addScriptAttachment = function(file, index) { + $ctrl.currentScriptIndex = index; + var scriptAttachmentUpload = function(file) { + var metadata = _.extend({}, { + analysisPackageId: $ctrl.packageId, + dataAcquisitionProjectId: $ctrl.projectId, + scriptUuid: $ctrl.scripts[index].uuid, + fileName: file.name + }); + $ctrl.scripts[index].scriptAttachmentMetadata = metadata; + return ScriptAttachmentUploadService + .uploadScriptAttachment(file, metadata); + }; + $ctrl.selectedFile = file; + + $ctrl.currentForm['filename_' + index].$setDirty(); + $ctrl.currentForm['filename_' + index] + .$setValidity('valid', true); + $ctrl.currentForm['filename_' + index] + .$setValidity('unique', true); + + scriptAttachmentUpload($ctrl.selectedFile) + .then($ctrl.onSavedSuccessfully) + .catch($ctrl.onUploadFailed); + }; + + $ctrl.onSavedSuccessfully = function() { + $mdDialog.hide($ctrl.scriptAttachmentMetadata); + SimpleMessageToastService.openSimpleMessageToast( + 'attachment.attachment-saved-toast', + { + filename: $ctrl.selectedFile.name + }); + $ctrl.loadScriptAttachments(); + }; + + $ctrl.onUploadFailed = function(response) { + if (response.invalidFile) { + SimpleMessageToastService.openAlertMessageToast( + 'attachment.error.file-not-found', + { + filename: $ctrl.selectedFile.name + }); + $ctrl.currentForm['filename_' + $ctrl.currentScriptIndex] + .$setValidity('valid', false); + } + if (response.errors && response.errors.length > 0) { + SimpleMessageToastService.openAlertMessageToast( + response.errors[0].message, + { + filename: $ctrl.selectedFile.name + }); + delete $ctrl.scripts[$ctrl.currentScriptIndex] + .scriptAttachmentMetadata; + $ctrl.currentForm['filename_' + $ctrl.currentScriptIndex] + .$setValidity('valid', true); + } + }; + + $ctrl.deleteScriptAttachment = function(attachment, index, dialog) { + if (dialog) { + CommonDialogsService + .showConfirmFileDeletionDialog(attachment.fileName) + .then(function() { + attachment.$delete().then(function() { + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.detail.' + + 'script-attachment-metadata.attachment-deleted-toast', { + filename: attachment.fileName + } + ); + $ctrl.scriptAttachments.splice(index, 1); + delete $ctrl.scripts[index].scriptAttachmentMetadata; + $ctrl.loadScriptAttachments(); + }); + }); + } else { + attachment.$delete(); + $ctrl.scriptAttachments.splice(index, 1); + delete $ctrl.scripts[index].scriptAttachmentMetadata; + $ctrl.loadScriptAttachments(); + } + }; + } + + angular + .module('metadatamanagementApp') + .controller('editScriptSectionController', Controller); + } + +) +(); diff --git a/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.html.tmpl new file mode 100644 index 0000000000..0b21492666 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/components/scriptsection/edit-script-section.html.tmpl @@ -0,0 +1,304 @@ + + + +

+ {{ 'analysis-package-management.detail.label.scripts' | translate}}

+
+
+ + +
+
+
+ + + {{'analysis-package-management.edit.delete-script-tooltip' | translate}} + + delete_forever + + + + {{'analysis-package-management.edit.move-script-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-script-down-tooltip' | translate}} + + keyboard_arrow_down + +
+
+
+ + + + +
+ {{'analysis-package-management.edit.hints.script.title.de' | translate}} +
+
+
+ {{'analysis-package-management.error.script.title.i18n-string-entire-not-empty' | + translate}} +
+
+ {{'analysis-package-management.error.script.title.i18n-string-size' | translate}} +
+
+
+ + + +
+ {{'analysis-package-management.edit.hints.script.title.en' | translate}} +
+
+
+ {{'analysis-package-management.error.script.title.i18n-string-entire-not-empty' | + translate}} +
+
+ {{'analysis-package-management.error.script.title.i18n-string-size' | translate}} +
+
+
+
+
+ + + {{item.displayLanguage[$ctrl.currentLanguage]}} + + + {{'analysis-package-management.error.script.used-language.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.script.used-language' | translate}} +
+
+
+ {{'analysis-package-management.error.script.used-language.not-null' | translate}} +
+
+ {{'analysis-package-management.error.script.used-language.not-valid' | translate}} +
+
+
+ + + {{item}} + + + {{'analysis-package-management.error.script.software-package.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.script.software-package' | translate}} +
+
+
+ {{'analysis-package-management.error.script.software-package.not-null' | translate}} +
+
+ {{'analysis-package-management.error.script.software-package.not-valid' | translate}} +
+
+
+
+
+ + + +
+ {{'analysis-package-management.edit.hints.script.software-package-version' | translate}} +
+
+
+ {{'analysis-package-management.error.script.software-package-version.string-entire-not-empty' | + translate}} +
+
+ {{'analysis-package-management.error.script.software-package-version.string-size' | translate}} +
+
+
+
+

{{'analysis-package-management.detail.label.save-file' | translate}}

+ + + + +
+ {{ 'analysis-package-management.edit.hints.script-attachment-metadata.filename' | translate}} +
+
+
+ {{'analysis-package-management.error.script-attachment-metadata.filename.not-unique' | translate}} +
+
+ {{'analysis-package-management.error.script-attachment-metadata.filename.not-valid' | translate}} +
+
+ {{'analysis-package-management.error.script-attachment-metadata.filename.pattern' | translate}} +
+
+
+
+ + + {{'analysis-package-management.detail.script-attachment-metadata.add-attachment-tooltip' | translate + }} + + add + + + + {{'analysis-package-management.detail.script-attachment-metadata.delete-attachment-tooltip' | translate + }} + + delete_forever + +
+
+
+
+
+ +
+
+ + + + {{'analysis-package-management.edit.add-script-tooltip' | translate}} + + add + + +
diff --git a/src/main/webapp/scripts/analysispackagemanagement/configuration/analysis-package.js b/src/main/webapp/scripts/analysispackagemanagement/configuration/analysis-package.js new file mode 100644 index 0000000000..ceb70a1f3d --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/configuration/analysis-package.js @@ -0,0 +1,163 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .config(function($stateProvider, $urlRouterProvider) { + var loadShadowCopy = function(AnalysisPackageSearchService, + SimpleMessageToastService, id, version, excludes) { + var loadLatestShadowCopyFallback = function() { + return AnalysisPackageSearchService.findShadowByIdAndVersion(id, null, + excludes).promise.then(function(result) { + if (result) { + return result; + } else { + SimpleMessageToastService.openAlertMessageToast( + 'analysis-package-management.detail.not-found', {id: id}, 5000); + return null; + } + }); + }; + + return AnalysisPackageSearchService.findShadowByIdAndVersion(id, version, + excludes).promise.then(function(result) { + if (result) { + return result; + } else { + return loadLatestShadowCopyFallback(); + } + }); + }; + + $urlRouterProvider.when('/de/analysis-packages/', '/de/error'); + $urlRouterProvider.when('/en/analysis-packages/', '/en/error'); + var stateName = 'analysisPackageDetail'; + var analysisPackageDetailConfig = { + parent: 'site', + url: '/analysis-packages/{id}?{access-way}' + + '{derived-variables-identifier}{page}{query}' + + '{repeated-measurement-identifier}{size}{type}{version}', + reloadOnSearch: false, + data: { + authorities: [] + }, + params: { + 'search-result-index': null + }, + views: { + 'content@': { + templateUrl: 'scripts/analysispackagemanagement/views/' + + 'analysis-package-detail.html.tmpl', + controller: 'AnalysisPackageDetailController', + controllerAs: 'ctrl' + } + }, + resolve: { + entity: ['$q', '$stateParams', 'AnalysisPackageSearchService', + 'Principal', 'SimpleMessageToastService', 'LocationSimplifier', + '$state', + function($q, $stateParams, AnalysisPackageSearchService, + Principal, SimpleMessageToastService, + LocationSimplifier, $state) { + return LocationSimplifier.removeDollarSign($state, $stateParams, + stateName).then(function() { + var excludedAttributes = ['nested*', 'variables','questions', + 'instruments', 'dataSets', 'relatedPublications', + 'concepts']; + var id = LocationSimplifier.ensureDollarSign($stateParams.id); + if (Principal.loginName() && !$stateParams.version) { + return AnalysisPackageSearchService.findOneById(id, null, + excludedAttributes); + } else { + var deferred = $q.defer(); + loadShadowCopy(AnalysisPackageSearchService, + SimpleMessageToastService, id, + $stateParams.version, excludedAttributes) + .then(deferred.resolve, deferred.reject); + return deferred; + } + }).catch($q.defer); + } + ] + } + }; + + $stateProvider + .state(stateName, analysisPackageDetailConfig); + + // var legacyStudyDetailConfig = angular.copy(analysisPackageDetailConfig); + // legacyStudyDetailConfig.url = '/studies/{id}?{access-way}' + + // '{derived-variables-identifier}' + + // '{page}{query}{repeated-measurement-identifier}{size}{type}{version}'; + // + // $stateProvider + // .state('legacyStudyDetail', legacyStudyDetailConfig); + + $stateProvider + .state('analysisPackageEdit', { + parent: 'site', + url: '/analysis-packages/{id}/edit', + data: { + authorities: ['ROLE_PUBLISHER', 'ROLE_DATA_PROVIDER'] + }, + views: { + 'content@': { + templateUrl: 'scripts/analysispackagemanagement/views/' + + 'analysis-package-edit-or-create.html.tmpl', + controller: 'AnalysisPackageEditOrCreateController', + controllerAs: 'ctrl' + } + }, + onEnter: function($rootScope, $timeout) { + $timeout(function() { + $rootScope.$broadcast('domain-object-editing-started'); + }, 500); + }, + onExit: function($rootScope, $timeout) { + $timeout(function() { + $rootScope.$broadcast('domain-object-editing-stopped'); + }, 500); + }, + resolve: { + entity: ['$stateParams', 'AnalysisPackageResource', + function($stateParams, AnalysisPackageResource) { + return AnalysisPackageResource.get({ + id: $stateParams.id + }); + } + ] + } + }); + + $stateProvider + .state('analysisPackageCreate', { + parent: 'site', + url: '/analysis-packages/new', + data: { + authorities: ['ROLE_PUBLISHER', 'ROLE_DATA_PROVIDER'] + }, + views: { + 'content@': { + templateUrl: 'scripts/analysispackagemanagement/views/' + + 'analysis-package-edit-or-create.html.tmpl', + controller: 'AnalysisPackageEditOrCreateController', + controllerAs: 'ctrl' + } + }, + onEnter: function($rootScope, $timeout) { + $rootScope.$broadcast('start-ignoring-404'); + $timeout(function() { + $rootScope.$broadcast('domain-object-editing-started'); + }, 500); + }, + onExit: function($rootScope, $timeout) { + $rootScope.$broadcast('stop-ignoring-404'); + $timeout(function() { + $rootScope.$broadcast('domain-object-editing-stopped'); + }, 500); + }, + resolve: { + entity: function() { + return null; + } + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-de.js b/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-de.js index ee384e41a6..d41bd142ad 100644 --- a/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-de.js +++ b/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-de.js @@ -7,16 +7,443 @@ angular.module('metadatamanagementApp').config( 'analysis-package-management': { 'detail': { 'label': { - 'analysisPackage': 'Analysepaket', - 'analysisPackages': 'Analysepakete', - 'authors': 'Autor:innen', - 'doi': 'DOI', - 'title': 'Titel', + 'analyzed-data-package': { + 'data-package': 'FDZ-DZHW Datenpaket', + 'access-way': 'Zugangsweg', + 'available-access-ways': 'Verfügbare Zugangswege', + 'version': 'Version', + 'available-versions': 'Verfügbare Versionen', + 'available-data-packages': 'Verfügbare Datenpakete' + }, + 'external-data-package': { + 'available-availability-type': 'Verfügbarer Zugangsstatus', + 'availability-type': 'Zugangsstatus', + 'description': 'Datenpaketbeschreibung', + 'annotations': 'Anmerkungen', + 'data-source': 'Datenquelle', + 'data-source-url': 'Link zur Datenquelle' + }, + 'custom-data-package': { + 'available-availability-type': 'Verfügbarer Zugangsstatus', + 'availability-type': 'Zugangsstatus', + 'description': 'Datenpaketbeschreibung', + 'annotations': 'Anmerkungen', + 'data-source': 'Datenquelle', + 'dataSources': 'Datenquellen', + 'data-source-url': 'Link zur Datenquelle', + 'access-way': 'Zugangsweg', + 'available-access-ways': 'Verfügbare Zugangswege' + }, 'attachments': { 'title': 'Titel', 'description': 'Beschreibung', 'language': 'Dokumentensprache', 'file': 'Datei' + }, + 'additional-links': 'Weiterführende Links', + 'analysisPackage': 'Analysepaket', + 'analysisPackages': 'Analysepakete', + 'analysis-data': 'Analysedaten', + 'type-of-data': 'Art der Daten', + 'annotations': 'Anmerkungen', + 'authors': 'Autor:innen', + 'data-curators': 'Datenkuratierung', + 'description': 'Analysepaketbeschreibung', + 'doi': 'DOI', + 'institution': 'Institution', + 'institutions': 'Institution(en)', + 'license': 'Lizenz', + 'scripts': 'Skripte', + 'sponsors': 'Gefördert von', + 'version': 'Version', + 'published-at': 'veröffentlicht am', + 'published': 'Veröffentlicht am', + 'generate-analysis-package-overview-tooltip': 'Klicken, um eine Übersicht über dieses Analysepaket als PDF zu erstellen.', + 'overview-generation-started-toast': 'Die Analysepaketübersicht wird jetzt erzeugt. Sie werden per E-Mail benachrichtigt, sobald der Vorgang abgeschlossen ist.', + 'tags': 'Schlagwörter', + 'title': 'Titel', + 'file': 'Datei', + 'save-file': 'Das Analysepaket muss erst gespeichert werden, bevor Skript Dateien hinzugefügt werden können.' + }, + 'script-attachment-metadata': { + 'attachment-deleted-toast': 'Datei "{{ filename }}" wurde gelöscht!', + 'delete-attachment-tooltip': 'Klicken, um die Datei aus diesem Skript zu löschen!', + 'add-attachment-tooltip': 'Klicken, um einen neue Datei zu diesem Skript hinzuzufügen.' + }, + 'scripts': { + 'table-title': 'Skripte zu diesem Analysepaket', + 'title': 'Titel', + 'software-package': 'Softwarepaket', + 'language': 'Skriptsprache', + 'version': 'Version des Softwarepakets', + 'file': 'Datei' + }, + 'attachments': { + 'table-title': 'Materialien zu diesem Analysepaket', + 'delete-attachment-tooltip': 'Klicken, um die Datei "{{ filename }}" zu löschen!', + 'edit-attachment-tooltip': 'Klicken, um die Datei "{{ filename }}" zu bearbeiten.', + 'select-attachment-tooltip': 'Klicken, um Datei "{{ filename }}" zum Verschieben auszuwählen.', + 'move-attachment-up-tooltip': 'Klicken, um die ausgewählte Datei nach oben zu verschieben.', + 'move-attachment-down-tooltip': 'Klicken, um die ausgewählte Datei nach unten zu verschieben.', + 'save-attachment-order-tooltip': 'Klicken, um die geänderte Reihenfolge der Dateien zu speichern.', + 'add-attachment-tooltip': 'Klicken, um einen neue Datei zu diesem Analysepaket hinzuzufügen.', + 'change-file-tooltip': 'Klicken, um eine Datei auszuwählen.', + 'open-choose-previous-version-tooltip': 'Klicken, um eine ältere Version der Metadaten wiederherzustellen.', + 'current-version-restored-toast': 'Die aktuelle Version der Metadaten von Datei "{{ filename }}" wurde wiederhergestellt.', + 'previous-version-restored-toast': 'Die ältere Version der Metadaten von Datei "{{ filename }}" kann jetzt gespeichert werden.', + 'language-not-found': 'Keine gültige Sprache gefunden!', + 'save-analysis-package-before-adding-attachment': 'Das Analysepaket muss erst gespeichert werden, bevor Materialien hinzugefügt werden können.', + 'create-title': 'Neue Datei zu Analysepaket "{{ analysisPackageId }}" hinzufügen', + 'edit-title': 'Datei "{{ filename }}" von Analysepaket "{{ analysisPackageId }}" bearbeiten', + 'attachment-deleted-toast': 'Datei "{{ filename }}" wurde gelöscht!', + 'attachment-order-saved-toast': 'Die geänderte Reihenfolge der Dateien wurde gespeichert.', + 'hints': { + 'filename': 'Wählen Sie eine Datei aus, die Sie des Analysepakets hinzufügen wollen.' + } + }, + 'doi-tooltip': 'Klicken, um die DOI in einem neuen Tab zu öffnen.', + 'link-tooltip': 'Klicken, um den Link in einem neuen Tab zu öffnen.', + 'tag-tooltip': 'Klicken, um Analysepakete mit diesem Tag zu suchen.', + 'not-found': 'Die id {{id}} referenziert auf eine unbekanntes Analysepaket.', + 'not-found-references': 'Die id {{id}} hat keine Referenzen auf Analysepakete.', + 'not-yet-released': 'Aktuell nicht freigegeben', + 'not-released-toast': 'Das Analysepaket "{{ id }}" wird aktuell bearbeitet und ist daher nicht für alle Benutzer:innen freigegeben!', + 'beta-release-no-doi': 'Dieses Analysepaket hat noch keine DOI.', + 'publications-for-data-package': 'Publikationen zu diesem Analysepaket', + 'page-description': '{{ description }}', + 'title': 'Analysepaket (Skripte): {{ title }}' + }, + 'edit': { + 'add-analysis-data-tooltip': 'Klicken, um weitere Analysedaten zu diesem Analysepaket hinzuzufügen.', + 'move-analysis-data-up-tooltip': 'Klicken, um die ausgewählten Analyse Daten nach oben zu verschieben.', + 'move-analysis-data-down-tooltip': 'Klicken, um die ausgewählten Analyse Daten nach unten zu verschieben.', + 'all-analysis-packages-deleted-toast': 'Das Analysepaket des Datenaufbereitungsprojekts "{{id}}" wurde gelöscht.', + 'open-choose-previous-version-tooltip': 'Klicken, um eine ältere Version dieses Analysepakets wieder herzustellen.', + 'save-tooltip': 'Klicken, um das Analysepaket zu speichern.', + 'move-sponsor-up-tooltip': 'Klicken, um die ausgewählte Geldgeber:in nach oben zu verschieben.', + 'move-sponsor-down-tooltip': 'Klicken, um die ausgewählte Geldgeber:in nach unten zu verschieben.', + 'add-sponsor-tooltip': 'Klicken, um eine weitere Geldgeber:in diesem Analysepaket hinzuzufügen.', + 'delete-sponsor-tooltip': 'Klicken, um die Geldgeber:in aus diesem Analysepaket zu entfernen.', + 'move-script-up-tooltip': 'Klicken, um das ausgewählte Skript nach oben zu verschieben.', + 'move-script-down-tooltip': 'Klicken, um das ausgewählte Skript nach unten zu verschieben.', + 'add-script-tooltip': 'Klicken, um ein weiteres Skript diesem Analysepaket hinzuzufügen.', + 'delete-script-tooltip': 'Klicken, um dieses Skript aus diesem Analysepaket zu entfernen.', + 'move-institution-up-tooltip': 'Klicken, um die ausgewählte Institution nach oben zu verschieben.', + 'move-institution-down-tooltip': 'Klicken, um die ausgewählte Institution nach unten zu verschieben.', + 'add-institution-tooltip': 'Klicken, um eine weitere Institution diesem Analysepaket hinzuzufügen.', + 'add-link-tooltip': 'Klicken, um einen weiteren Link diesem Analysepaket hinzuzufügen.', + 'move-link-up-tooltip': 'Klicken, um den ausgewählten Link nach oben zu verschieben.', + 'move-link-down-tooltip': 'Klicken, um den ausgewählten Link nach unten zu verschieben.', + 'delete-link-tooltip': 'Klicken, um den ausgewählten Link aus diesem Analysepaket zu entfernen.', + 'delete-data-source-tooltip': 'Klicken, um die ausgewählten Datenquelle aus diesem Analysepaket zu entfernen.', + 'add-url-tooltip': 'Klicken, um eine weitere Datenquelle diesem benutzerdefinierten Datenpaket hinzuzufügen.', + 'add-data-source-tooltip': 'Klicken, um eine weitere Datenquelle diesem benutzerdefinierten Datenpaket hinzuzufügen.', + 'move-url-up-tooltip': 'Klicken, um die ausgewählte Datenquelle nach oben zu verschieben.', + 'move-url-down-tooltip': 'Klicken, um die ausgewählte Datenquelle nach unten zu verschieben.', + 'move-data-source-up-tooltip': 'Klicken, um die ausgewählte Datenquelle nach oben zu verschieben.', + 'move-data-source-down-tooltip': 'Klicken, um die ausgewählte Datenquelle nach unten zu verschieben.', + 'delete-url-tooltip': 'Klicken, um die Institution aus diesem benutzerdefinierten Datenpaket zu entfernen.', + 'delete-institution-tooltip': 'Klicken, um die Institution aus diesem Analysepaket zu entfernen.', + 'add-package-author-tooltip': 'Klicken, um eine neue Autor:in diesem Analysepaket hinzuzufügen.', + 'delete-package-author-tooltip': 'Klicken, um die Autor:in aus diesem Analysepaket zu löschen.', + 'move-package-author-up-tooltip': 'Klicken, um die ausgewählte Autor:in nach oben zu verschieben.', + 'move-package-author-down-tooltip': 'Klicken, um die ausgewählte Autor:in nach unten zu verschieben.', + 'add-curator-tooltip': 'Klicken, um eine neue Datenkurator:in diesem Analysepaket hinzuzufügen.', + 'delete-curator-tooltip': 'Klicken, um die ausgewählte Datenkurator:in aus diesem Analysepaket zu löschen.', + 'move-curator-up-tooltip': 'Klicken, um die ausgewählte Datenkurator:in nach oben zu verschieben.', + 'move-curator-down-tooltip': 'Klicken, um die ausgewählte Datenkurator:in nach unten zu verschieben.', + 'choose-unreleased-project-toast': 'Analysepakete dürfen nur bearbeitet werden, wenn das Projekt aktuell nicht freigegeben ist!', + 'not-authorized-toast': 'Sie sind nicht berechtigt Analysepakete zu bearbeiten oder anzulegen!', + 'error-on-save-toast': 'Ein Fehler trat beim Speichern von Analysepaket {{analysisPackageId}} auf!', + 'analysis-package-has-validation-errors-toast': 'Das Analysepaket wurde nicht gespeichert, weil es noch ungültige Felder gibt!', + 'success-on-save-toast': 'Analysepaket {{analysisPackageId}} wurde erfolgreich gespeichert', + 'previous-version-restored-toast': 'Die ältere Version von Analysepaket {{ analysisPackageId }} kann jetzt gespeichert werden.', + 'current-version-restored-toast': 'Die aktuelle Version von Analysepaket {{ analysisPackageId }} wurde wiederhergestellt.', + 'choose-previous-version': { + 'next-page-tooltip': 'Klicken, um ältere Versionen anzuzeigen.', + 'previous-page-tooltip': 'Klicken, um aktuellere Versionen anzuzeigen.', + 'title': 'Ältere Version des Analysepakets {{ analysisPackageId }} wiederherstellen', + 'text': 'Wählen Sie eine ältere Analysepaketversion aus, die wiederhergestellt werden soll:', + 'cancel-tooltip': 'Klicken, um ohne eine ältere Analysepaketversion auszuwählen zurückzukehren.', + 'no-versions-found': 'Es wurden keine älteren Versionen von Analysepaket {{ analysisPackageId }} gefunden.', + 'data-package-deleted': 'Das Analysepaket wurde gelöscht!' + }, + 'label': { + 'create-analysis-package': 'Analysepaket anlegen:', + 'edit-analysis-package': 'Analysepaket bearbeiten:', + 'first-name': 'Vorname', + 'middle-name': 'Zweiter Vorname', + 'last-name': 'Nachname', + 'tags': 'Tags (Schlagwörter) zum Analysepaket', + 'publication-year': 'Jahr der Veröffentlichung', + 'institution': 'Institution', + 'sponsor': 'Geldgeber:in', + 'version': 'Version', + 'script': { + 'used-language': 'Skriptsprache', + 'software-package': 'Softwarepaket', + 'software-package-version': 'Version des Softwarepakets' + }, + 'location': 'Ort', + 'additional-links': { + 'url': 'URL', + 'display-text': 'Anzeigetext' + } + }, + 'hints': { + 'data-package': 'Bitte wählen Sie die Herkunftsart der Analysedaten aus.', + 'additional-links': { + 'url': 'Bitte tragen Sie die URL wie in dem folgenden Beispiel ein: https://www.dzhw.eu', + 'display-text': { + 'de': 'Optional: Geben Sie einen Text auf Deutsch an, der zur Anzeige des Links verwendet werden soll.', + 'en': 'Optional: Geben Sie einen Text auf Englisch an, der zur Anzeige des Links verwendet werden soll.' + } + }, + 'authors': { + 'first-name': 'Geben Sie den Vornamen der Autor:in ein.', + 'middle-name': 'Geben Sie, falls vorhanden, den zweiten Vornamen der Autor:in ein.', + 'last-name': 'Geben Sie den Nachnamen der Autor:in ein.' + }, + 'annotations': { + 'de': 'Geben Sie zusätzliche Anmerkungen zum Analysepaket auf Deutsch ein.', + 'en': 'Geben Sie zusätzliche Anmerkungen zum Analysepaket auf Englisch ein.' + }, + 'curators': { + 'first-name': 'Geben Sie den Vornamen der Person ein, die an der Datenaufbereitung beteiligt ist.', + 'middle-name': 'Geben Sie, falls vorhanden, den zweiten Vornamen der Person ein.', + 'last-name': 'Geben Sie den Nachnamen der Person ein, die an der Datenaufbereitung beteiligt ist.' + }, + 'description': { + 'de': 'Geben Sie eine Beschreibung des Analysepakets auf Deutsch ein.', + 'en': 'Geben Sie eine Beschreibung des Analysepakets auf Englisch ein.' + }, + 'institution': { + 'de': 'Geben Sie den deutschen Namen der Institution ein, die an dem Analysepaket beteiligt war.', + 'en': 'Geben Sie den englischen Namen der Institution ein, die an dem Analysepaket beteiligt war.' + }, + 'license': 'Wenn kein Vertrag unterzeichnet wird, benötigen wir eine Lizenz wie cc-by-sa', + 'script': { + 'title': { + 'de': 'Geben Sie den Titel des Skripts auf Deutsch ein.', + 'en': 'Geben Sie den Titel des Skripts auf Englisch ein.' + }, + 'used-language': 'Bitte geben Sie die Sprache an, die Sie für die Kommentare im Skript verwendet haben.', + 'software-package': 'Bitte wählen Sie das Softwarepaket aus, für das dieses Skript geschrieben wurde.', + 'software-package-version': 'Version des Softwarepakets' + + }, + 'script-attachment-metadata': { + 'filename': 'Wählen Sie eine Datei aus, die Sie dem Skript hinzufügen wollen.' + }, + 'sponsor': { + 'de': 'Geben Sie den deutschen Namen der Geldgeber:in für dieses Analysepaket ein.', + 'en': 'Geben Sie den englischen Namen der Geldgeber:in für dieses Analysepaket ein.' + }, + 'title': { + 'de': 'Geben Sie den Titel des Analysepakets auf Deutsch ein.', + 'en': 'Geben Sie den Titel des Analysepakets auf Englisch ein.' + }, + 'external-data-package': { + 'title': { + 'de': 'Geben Sie den Titel des externen Datenpakets auf Deutsch ein.', + 'en': 'Geben Sie den Titel des externen Datenpakets auf Englisch ein.' + }, + 'description': { + 'de': 'Geben Sie eine Beschreibung des externen Datenpakets auf Deutsch ein.', + 'en': 'Geben Sie eine Beschreibung des externen Datenpakets auf Englisch ein.' + }, + 'annotations': { + 'de': 'Geben Sie zusätzliche Anmerkungen zum externen Datenpaket auf Deutsch ein.', + 'en': 'Geben Sie zusätzliche Anmerkungen zum externen Datenpaket auf Englisch ein.' + }, + 'data-source': { + 'de': 'Hier muss die Datenquelle angegeben werden, in der die Daten gespeichert werden (z.B. Name der Institution/des Repositoriums; private Speicherung).', + 'en': 'Hier muss die Datenquelle angegeben werden, in der die Daten gespeichert werden (z.B. Name der Institution/des Repositoriums; private Speicherung).' + }, + 'data-source-url': 'Bitte tragen Sie die URL wie in dem folgenden Beispiel ein: https://www.dzhw.eu', + 'availability-type': { + 'choose': 'Bitte wählen Sie einen Zugangsstatus.', + 'open': 'Keine oder nur geringfügige Zugangsbeschränkungen (z.B. Zustimmung zu einfachen Nutzungsbedingungen).', + 'restricted': 'Irgendeine höhergradige Form des beschränkten Zugangs (Registierung muss vor dem Datenzugang erfolgen; Ein Antragsprozess muss vor dem Datenzugang durchlaufen werden; sehr restriktive Nutzungsbedingungen).', + 'none': 'nicht zugänglich.' + } + }, + 'custom-data-package': { + 'access-way': { + 'choose': 'Bitte wählen Sie ein Zugangsweg.' + }, + 'title': { + 'de': 'Geben Sie den Titel des benutzerdefinierten Datenpakets auf Deutsch ein.', + 'en': 'Geben Sie den Titel des benutzerdefinierten Datenpakets auf Englisch ein.' + }, + 'description': { + 'de': 'Geben Sie eine Beschreibung des benutzerdefinierten Datenpakets auf Deutsch ein.', + 'en': 'Geben Sie eine Beschreibung des benutzerdefinierten Datenpakets auf Englisch ein.' + }, + 'annotations': { + 'de': 'Geben Sie zusätzliche Anmerkungen zum benutzerdefinierten Datenpaket auf Deutsch ein.', + 'en': 'Geben Sie zusätzliche Anmerkungen zum benutzerdefinierten Datenpaket auf Englisch ein.' + }, + 'data-source': { + 'de': 'Die Datenquelle muss hier näher auf Deutsch beschrieben werden.', + 'en': 'Die Datenquelle muss hier näher auf Englisch beschrieben werden.' + }, + 'data-source-url': 'Geben Sie den Link zur Datenquelle ein.', + 'availability-type': { + 'choose': 'Bitte wählen Sie einen Zugangsstatus.', + 'open': 'Keine oder nur geringfügige Zugangsbeschränkungen (z.B. Zustimmung zu einfachen Nutzungsbedingungen).', + 'restricted': 'Irgendeine höhergradige Form des beschränkten Zugangs (Registierung muss vor dem Datenzugang erfolgen; Ein Antragsprozess muss vor dem Datenzugang durchlaufen werden; sehr restriktive Nutzungsbedingungen).', + 'none': 'nicht zugänglich.', + 'accessible': 'Lorem ipsum...', + 'not-accessible': 'Lorem ipsum...' + } + }, + 'analyzed-data-package': { + 'data-package': 'Geben Sie den Titel des FDZ-DZHW Datenpakets ein.', + 'version': 'Bitte wählen Sie eine Version.', + 'access-way': { + 'choose': 'Bitte wählen Sie einen Zugangsweg.' + } + } + } + }, + 'error': { + 'script': { + 'title': { + 'not-null': 'Der Titel eines Skripts darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge des Titels eines Skripts ist 2048 Zeichen.', + 'i18n-string-entire-not-empty': 'Der Titel eines Skripts muss in allen Sprachen vorhanden sein.' + }, + 'used-language': { + 'not-found': 'Keine gültige Skriptsprache gefunden!', + 'not-null': 'Die Sprache des Skripts darf nicht leer sein.', + 'not-valid': 'Bitte wählen Sie eine vorgeschlagene Sprache aus.' + }, + 'software-package': { + 'not-found': 'Kein gültiges Softwarepaket gefunden.', + 'not-null': 'Das Softwarepaket darf nicht leer sein.', + 'not-valid': 'Bitte wählen Sie ein vorgeschlagenes Softwarepaket aus.' + }, + 'software-package-version': { + 'string-size': 'Die Maximallänge der Version des Softwarepakets ist 32 Zeichen.', + 'string-entire-not-empty': 'Die Version des Softwarepakets muss vorhanden sein.' + } + }, + 'script-attachment-metadata': { + 'script-uuid': { + 'not-unique': 'Eine Datei mit dieser Skript Uuid existiert bereits,', + '.not-exists': 'Diese Skript Uuid extistiert nicht.' + }, + 'filename': { + 'not-empty': 'Es muss eine Datei ausgewählt sein', + 'not-unique': 'Eine Datei mit diesem Namen existiert bereits', + 'not-valid': 'Dieser Dateiname ist ungültig', + 'pattern': 'Es dürfen für die FDZ-ID nur alphanumerische Zeichen, deutsche Umlaute, ß, Minus und der Unterstrich verwendet werden.' + }, + 'file-not-found': 'Die Datei {{ filename }} wurde nicht gefunden und wurde daher nicht gespeichert!' + }, + 'analysis-package': { + 'title': { + 'not-null': 'Der Titel eines Analysepaket darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge des Titels eines Analysepaket ist 2048 Zeichen.', + 'i18n-string-entire-not-empty': 'Der Titel eines Analysepaket muss in allen Sprachen vorhanden sein.' + }, + 'annotations': { + 'i18n-string-size': 'Die Maximallänge der Anmerkungen ist 2048 Zeichen.' + }, + 'description': { + 'not-null': 'Die Beschreibung eines Analysepakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Beschreibung eines Analysepakets ist 2048 Zeichen.', + 'i18n-string-not-empty': 'Die Beschreibung eines Analysepakets muss in beiden Sprachen vorhanden sein.' + }, + 'institution': { + 'not-null': 'Die Institution eines Analysepakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Institution eines Analysepakets ist 512 Zeichen.', + 'i18n-string-entire-not-empty': 'Die Institution eines Analysepakets muss in beiden Sprachen vorhanden sein.' + }, + 'license': { + 'string-size': 'Die Maximallänge der Lizenz ist 1048576 Zeichen.' + }, + 'sponsor': { + 'not-null': 'Die Geldgeber:in eines Analysepakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Geldgeber:in eines Analysepakets ist 512 Zeichen.', + 'i18n-string-entire-not-empty': 'Die Geldgeber:in eines Analysepakets muss in beiden Sprachen vorhanden sein.' + }, + 'additional-links': { + 'invalid-url': 'Die angegebene URL ist ungültig', + 'url-size': 'Die Maximallänge der URL ist 2000 Zeichen.', + 'url-not-empty': 'Die URL darf nicht leer sein.', + 'display-text-size': 'Die Maximallänge des Anzeigetextes ist 512 Zeichen.' + }, + 'analysis-data-packages': { + 'package-type': { + 'i18n-not-null': 'Der Typ eines Datenpaket darf nicht leer sein!' + } + } + }, + 'external-data-package': { + 'title': { + 'not-null': 'Der Titel eines externen Datenpakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge des Titels eines externen Datenpakets ist 2048 Zeichen.', + 'i18n-string-entire-not-empty': 'Der Titel eines externen Datenpakets muss in allen Sprachen vorhanden sein.' + }, + 'annotations': { + 'i18n-string-size': 'Die Maximallänge der Anmerkungen ist 2048 Zeichen.' + }, + 'description': { + 'not-null': 'Die Beschreibung eines externen Datenpakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Beschreibung eines externen Datenpakets ist 2048 Zeichen.', + 'i18n-string-not-empty': 'Die Beschreibung eines externen Datenpakets muss in beiden Sprachen vorhanden sein.' + }, + 'data-source': { + 'i18n-string-not-empty': 'Die Datenquelle eines externen Datenpakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Datenquelle eines externen Datenpakets ist 512 Zeichen.', + 'i18n-string-entire-not-empty': 'Die Anmerkung eines Datenquelle muss in beiden Sprachen vorhanden sein.' + }, + 'data-source-url': { + 'invalid-url': 'Die angegebene URL ist ungültig', + 'url-size': 'Die Maximallänge der URL ist 2000 Zeichen.', + 'url-not-empty': 'Die URL darf nicht leer sein.' + }, + 'availability-type': { + 'i18n-not-null': 'Der Zugangsstatus eines externen Datenpakets darf nicht leer sein!' + } + }, + 'custom-data-package': { + 'title': { + 'not-null': 'Der Titel eines benutzerdefinierten Datenpaket darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge des Titels eines benutzerdefinierten Datenpaket ist 2048 Zeichen.', + 'i18n-string-entire-not-empty': 'Der Titel eines benutzerdefinierten Datenpaket muss in allen Sprachen vorhanden sein.' + }, + 'annotations': { + 'i18n-string-size': 'Die Maximallänge der Anmerkungen ist 2048 Zeichen.' + }, + 'description': { + 'not-null': 'Die Beschreibung eines benutzerdefinierten Datenpakets darf nicht leer sein!', + 'i18n-string-size': 'Die Maximallänge der Beschreibung eines benutzerdefinierten Datenpakets ist 2048 Zeichen.', + 'i18n-string-not-empty': 'Die Beschreibung eines benutzerdefinierten Datenpakets muss in beiden Sprachen vorhanden sein.' + }, + 'availability-type': { + 'i18n-not-null': 'Der Zugangsstatus eines benutzerdefinierten Datenpaket darf nicht leer sein!' + }, + 'access-way': { + 'i18n-not-null': 'Der Zugangsweg eines Datenpaket darf nicht leer sein!' + }, + 'data-source': { + 'i18n-not-null': 'Die Datenquelle eines benutzerdefinierten Datenpaket darf nicht leer sein!' + } + }, + 'analyzed-data-package': { + 'data-package-master-id': { + 'not-empty': 'Es muss ein FDZ-DZHW Datenpaket ausgewählt sein.', + 'not-found': 'Kein gültiges FDZ-DZHW Datenpaket gefunden.', + 'not-valid': 'Please select one of the provided FDZ-DZHW Datenpakete.' + }, + 'version': { + 'not-empty': 'Die Version eines Datenpaket darf nicht leer sein!' + }, + 'access-way': { + 'not-empty': 'Der Zugangsweg eines Datenpaket darf nicht leer sein!' } } } diff --git a/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-en.js b/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-en.js index 7c213e621b..2e16ea6abb 100644 --- a/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-en.js +++ b/src/main/webapp/scripts/analysispackagemanagement/configuration/translations-en.js @@ -7,16 +7,440 @@ angular.module('metadatamanagementApp').config( 'analysis-package-management': { 'detail': { 'label': { - 'analysisPackage': 'Analysis Package', - 'analysisPackages': 'Analysis Packages', - 'authors': 'Authors', - 'doi': 'DOI', - 'title': 'Title', + 'analyzed-data-package': { + 'data-package': 'FDZ-DZHW Datapackage', + 'access-way': 'Access way', + 'available-access-ways': 'Available Access Ways', + 'version': 'Version', + 'available-versions': 'Available Versions', + 'available-data-packages': 'Available Data Packages' + }, + 'external-data-package': { + 'available-availability-type': 'Available Availability Type', + 'availability-type': 'Availability Type', + 'description': 'Data Package Description', + 'annotations': 'Annotations', + 'data-source': 'Data Source', + 'data-source-url': 'Link of data source' + }, + 'custom-data-package': { + 'available-availability-type': 'Available Availability Type', + 'availability-type': 'Availability Type', + 'description': 'Data Package Description', + 'annotations': 'Annotations', + 'data-source': 'Data Source', + 'dataSources': 'Data Sources', + 'data-source-url': 'Link of data source', + 'access-way': 'Access Way', + 'available-access-ways': 'Available Access Ways' + }, 'attachments': { 'title': 'Title', 'description': 'Description', 'language': 'Document Language', 'file': 'File' + }, + 'additional-links': 'Additional Links', + 'analysisPackage': 'Analysis Package', + 'analysisPackages': 'Analysis Packages', + 'analysis-data': 'Analysis Data', + 'type-of-data': 'Type of Data', + 'annotations': 'Annotations', + 'authors': 'Authors', + 'data-curators': 'Data Curation', + 'description': 'Analysis Package Description', + 'doi': 'DOI', + 'institution': 'Institution', + 'institutions': 'Institution(s)', + 'license': 'License', + 'scripts': 'Scripts', + 'sponsors': 'Sponsored by', + 'version': 'Version', + 'published-at': 'published at', + 'published': 'Published at', + 'generate-analysis-package-overview-tooltip': 'Click to generate an overview of this analysis package as a PDF.', + 'overview-generation-started-toast': 'The analysis package overview is now being generated. You will be notified by e-mail as soon as the process is completed.', + 'tags': 'Tags', + 'title': 'Title', + 'file': 'File', + 'save-file': 'The analysis package has to be saved to enable attaching script files.' + }, + 'script-attachment-metadata': { + 'attachment-deleted-toast': 'Document "{{ filename }}" has been deleted!', + 'delete-attachment-tooltip': 'Click to delete this document from this script!', + 'add-attachment-tooltip': 'Click to add a new document to this script.' + }, + 'scripts': { + 'table-title': 'Scripts related to this Analysis Package', + 'title': 'Title', + 'software-package': 'Software Package', + 'language': 'Script Language', + 'version': 'Version of Software Package', + 'file': 'File' + }, + 'attachments': { + 'table-title': 'Documents related to this Analysis Package', + 'delete-attachment-tooltip': 'Click to delete document "{{ filename }}"!', + 'edit-attachment-tooltip': 'Click to edit the metadata for document "{{ filename }}".', + 'select-attachment-tooltip': 'Click to select document "{{ filename }}" for moving it up or down.', + 'move-attachment-down-tooltip': 'Click to move the selected document down.', + 'move-attachment-up-tooltip': 'Click to move the selected document up.', + 'save-attachment-order-tooltip': 'Click to save the modified order of the documents.', + 'add-attachment-tooltip': 'Click to add a new document to this analysis package.', + 'create-title': 'Add new Document to Analysis Package "{{ analysisPackageId }}"', + 'edit-title': 'Modify Document "{{ filename }}" of Analysis Package "{{ analysisPackageId }}"', + 'attachment-deleted-toast': 'Document "{{ filename }}" has been deleted!', + 'attachment-order-saved-toast': 'The modified order of the documents has been saved.', + 'change-file-tooltip': 'Click to choose a file.', + 'open-choose-previous-version-tooltip': 'Click to restore a previous version of the metadata.', + 'current-version-restored-toast': 'Current version of the metadata for document "{{ filename }}" has been restored.', + 'previous-version-restored-toast': 'Previous version of the metadata for document "{{ filename }}" can be saved now.', + 'language-not-found': 'No valid language found!', + 'save-analysis-package-before-adding-attachment': 'The analysis package has to be saved to enable attaching documents.', + 'hints': { + 'filename': 'Choose a file which you want to attach to the analysis package.' + } + }, + 'doi-tooltip': 'Click to open the DOI in a new tab', + 'link-tooltip': 'Click to open the link in a new tab.', + 'tag-tooltip': 'Click to search for analysis packages with this tag', + 'not-found': 'The {{id}} references to an unknown Analysis Package.', + 'not-found-references': 'The id {{id}} has no References to Analysis Packages.', + 'not-yet-released': 'Currently not released', + 'not-released-toast': 'Analysis Package "{{ id }}" is being worked on. Therefore it is not visible to all users at the moment!', + 'beta-release-no-doi': 'This analysis package has no DOI yet.', + 'publications-for-analysis-package': 'Publications related to this Analysis Package', + 'page-description': '{{ description }}', + 'title': 'Analysis Package (Scripts): {{ title }}' + }, + 'edit': { + 'add-analysis-data-tooltip': 'Click to add analysis data to this analysis package.', + 'move-analysis-data-up-tooltip': 'Click to move the selected analysis data up.', + 'move-analysis-data-down-tooltip': 'Click to move the selected analysis data down.', + 'all-analysis-packages-deleted-toast': 'The analysis package of Data Acquisition Project "{{id}}" has been deleted.', + 'open-choose-previous-version-tooltip': 'Click for restoring a previous version of this analysis package.', + 'save-tooltip': 'Click to save this analysis package.', + 'add-package-author-tooltip': 'Click to add a new author to this analysis package.', + 'move-sponsor-up-tooltip': 'Click to move the selected sponsor up.', + 'move-sponsor-down-tooltip': 'Click to move the selected sponsor down.', + 'add-sponsor-tooltip': 'Click to add another sponsor to this analysis package.', + 'delete-sponsor-tooltip': 'Click to remove the sponsor from this analysis package.', + 'move-script-up-tooltip': 'Click to move the selected script up.', + 'move-script-down-tooltip': 'Click to move the selected script down.', + 'add-script-tooltip': 'Click to add another script to this analysis package.', + 'delete-script-tooltip': 'Click to remove the script from this analysis package.', + 'move-institution-up-tooltip': 'Click to move the selected institution up.', + 'move-institution-down-tooltip': 'Click to move the selected institution down.', + 'add-institution-tooltip': 'Click to add another institution to this analysis package.', + 'add-link-tooltip': 'Click to add another link to this analysis package.', + 'move-link-up-tooltip': 'Click to move the selected link up.', + 'move-link-down-tooltip': 'Click to move the selected link down.', + 'delete-link-tooltip': 'Click to remove the link from this analysis package.', + 'delete-data-source-tooltip': 'Click to remove the data source from this analysis package.', + 'add-url-tooltip': 'Click to add another url to this custom data package.', + 'add-data-source-tooltip': 'Click to add another data source to this custom data package.', + 'move-url-up-tooltip': 'Click to move the selected url up.', + 'move-data-source-up-tooltip': 'Click to move the selected data source up.', + 'move-url-down-tooltip': 'Click to move the selected url down.', + 'move-data-source-down-tooltip': 'Click to move the selected data source down.', + 'delete-url-tooltip': 'Click to remove the url from this custom data package.', + 'delete-institution-tooltip': 'Click to remove the institution from this analysis package.', + 'delete-package-author-tooltip': 'Click to remove the author from this analysis package.', + 'move-package-author-up-tooltip': 'Click to move the selected author up.', + 'move-package-author-down-tooltip': 'Click to move the selected author down.', + 'add-curator-tooltip': 'Click to add a new data curator to this analysis package.', + 'delete-curator-tooltip': 'Click to remove the data curator from this analysis package.', + 'move-curator-up-tooltip': 'Click to move the selected data curator up.', + 'move-curator-down-tooltip': 'Click to move the selected data curator down.', + 'choose-unreleased-project-toast': 'Analysis Packages may be edited if and only if the project is currently not released!', + 'not-authorized-toast': 'You are not authorized to create or edit analysis packages!', + 'error-on-save-toast': 'An error occurred during saving of Analysis Package {{analysisPackageId}}!', + 'analysis-package-has-validation-errors-toast': 'The Analysis Package has not been saved because there are invalid fields!', + 'success-on-save-toast': 'Analysis Package {{analysisPackageId}} has been saved successfully.', + 'previous-version-restored-toast': 'Previous version of Analysis Package {{ analysisPackageId }} can be saved now.', + 'current-version-restored-toast': 'Current version of Analysis Package {{ analysisPackageId }} has been restored.', + 'choose-previous-version': { + 'title': 'Restore Previous Version of Analysis Package {{ analysisPackageId }}', + 'text': 'Choose a previous version of this analysis package which shall be restored:', + 'cancel-tooltip': 'Click to return without choosing a previous analysis package version.', + 'no-versions-found': 'There are no previous versions of analysis package {{ analysisPackageId }}.', + 'data-package-deleted': 'The analysis package has been deleted!' + }, + 'label': { + 'create-analysis-package': 'Create Analysis Package:', + 'edit-analysis-package': 'Edit Analysis Package:', + 'first-name': 'First Name', + 'middle-name': 'Middle Name', + 'last-name': 'Last Name', + 'tags': 'Tags (Keywords) for the Analysis Package', + 'publication-year': 'Year of Publication', + 'institution': 'Institution', + 'sponsor': 'Sponsor', + 'version': 'Version', + 'script': { + 'used-language': 'Script Language', + 'software-package': 'Software Package', + 'software-package-version': 'Version of Software Package' + }, + 'location': 'Location', + 'additional-links': { + 'url': 'URL', + 'display-text': 'Display Text' + } + }, + 'hints': { + 'data-package': 'Please select the origin type of the analysis data.', + 'additional-links': { + 'url': 'Please enter the URL as in the following example: https://www.dzhw.eu', + 'display-text': { + 'de': 'Optional: Specify a text in German to be used to display the link.', + 'en': 'Optional: Specify a text in English to be used to display the link.' + } + }, + 'authors': { + 'first-name': 'Enter the first name of this author.', + 'middle-name': 'If available enter the middle-name of this author.', + 'last-name': 'Enter the last name of this author.' + }, + 'annotations': { + 'de': 'Enter additional annotations for this analysis package in German.', + 'en': 'Enter additional annotations for this analysis package in English.' + }, + 'curators': { + 'first-name': 'Enter the first name of the person involved in data preparation.', + 'middle-name': 'If available enter the middle-name of this person.', + 'last-name': 'Enter the last name of the person involved in data preparation.' + }, + 'description': { + 'de': 'Enter a description of this analysis package in German.', + 'en': 'Enter a description of this analysis package in English.' + }, + 'institution': { + 'de': 'Please enter the German name of the institution which participated in the analysis package.', + 'en': 'Please enter the English name of the institution which participated in the analysis package.' + }, + 'license': 'If no contract is signed we will need a license like cc-by-sa', + 'script': { + 'title': { + 'de': 'Please enter the title of this script in German.', + 'en': 'Please enter the title of this script in English.' + }, + 'used-language': 'Please indicate the language you used for the comments in the script.', + 'software-package': 'Please choose the software package the script is written for.', + 'software-package-version': 'Version of Software Package' + }, + 'script-attachment-metadata': { + 'filename': 'Choose a file which you want to attach to the script.' + }, + 'sponsor': { + 'de': 'Enter the German name of the sponsor of this analysis package.', + 'en': 'Enter the English name of the sponsor of this analysis package.' + }, + 'title': { + 'de': 'Please enter the title of this analysis package in German.', + 'en': 'Please enter the title of this analysis package in English.' + }, + 'external-data-package': { + 'title': { + 'de': 'Please enter the title of this external data package in German.', + 'en': 'Please enter the title of this external data package in English.' + }, + 'description': { + 'de': 'Enter a description of this external data package in German.', + 'en': 'Enter a description of this external data package in English.' + }, + 'annotations': { + 'de': 'Enter additional annotations for this external data package in German.', + 'en': 'Enter additional annotations for this external data package in English.' + }, + 'data-source': { + 'de': 'The data source where the data is stored must be specified here (e.g. name of the institution/repository, private data storage).', + 'en': 'The data source where the data is stored must be specified here (e.g. name of the institution/repository, private data storage).' + }, + 'data-source-url': 'Please enter the URL as in the following example: https://www.dzhw.eu', + 'availability-type': { + 'choose': 'Please choose an availability type.', + 'open': 'No or minor restrictions for access (e.g. acceptance of simple terms of use).', + 'restricted': 'Some kind of major restriction for access (e.g. registration before access is granted; application processes has to be passed before access is granted; very restrictive terms of use).', + 'none': 'Not accessible.' + } + }, + 'custom-data-package': { + 'access-way': { + 'choose': 'Please choose an access way type.' + }, + 'title': { + 'de': 'Please enter the title of this custom data package in German.', + 'en': 'Please enter the title of this custom data package in English.' + }, + 'description': { + 'de': 'Enter a description of this custom data package in German.', + 'en': 'Enter a description of this custom data package in English.' + }, + 'annotations': { + 'de': 'Enter additional annotations for this custom data package in German.', + 'en': 'Enter additional annotations for this custom data package in English.' + }, + 'data-source': { + 'de': 'The data source must be described in more detail here in German.', + 'en': 'The data source must be described in more detail here in English.' + }, + 'data-source-url': 'Enter the data source url.', + 'availability-type': { + 'choose': 'Please choose an availability type.', + 'open': 'No or minor restrictions for access (e.g. acceptance of simple terms of use).', + 'restricted': 'Some kind of major restriction for access (e.g. registration before access is granted; application processes has to be passed before access is granted; very restrictive terms of use).', + 'none': 'Not accessible.', + 'accessible': 'Lorem ipsum...', + 'not-accessible': 'Lorem ipsum...' + } + }, + 'analyzed-data-package': { + 'data-package': 'Please enter the title of the FDZ-DZHW Datapackage.', + 'version': 'Please choose a version.', + 'access-way': { + 'choose': 'Please choose an access way.' + } + } + } + }, + 'error': { + 'script': { + 'title': { + 'not-null': 'The title of the script must not be empty!', + 'i18n-string-size': 'The max length of the script title is 2048.', + 'i18n-string-entire-not-empty': 'The title of the script must not be empty for all languages.' + }, + 'used-language': { + 'not-found': 'No valid language found.', + 'not-null': 'The script language must not be empty.', + 'not-valid': 'Please select one of the provided languages.' + }, + 'software-package': { + 'not-found': 'No valid software package found.', + 'not-null': 'The software package must not be empty.', + 'not-valid': 'Please select one of the provided software package.' + }, + 'software-package-version': { + 'string-size': 'The max length of the software package version is 32.', + 'string-entire-not-empty': 'The software package version must not be empty.' + } + }, + 'script-attachment-metadata': { + 'script-uuid': { + 'not-unique': 'A file with this script uuid already exists.', + '.not-exists': 'This script uuid does not exist.' + }, + 'filename': { + 'not-empty': 'A file must be selected.', + 'not-unique': 'A file with this name already exists.', + 'not-valid': 'This file name is invalid', + 'pattern': 'Use only alphanumeric signs, German umlauts, ß and space, underscore and minus for the RDC-ID.' + }, + 'file-not-found': 'The File {{ filename }} was not found and has not been saved.' + }, + 'analysis-package': { + 'title': { + 'not-null': 'The title of the analysis package must not be empty!', + 'i18n-string-size': 'The max length of the analysis package title is 2048.', + 'i18n-string-entire-not-empty': 'The title of the analysis package must not be empty for all languages.' + }, + 'annotations': { + 'i18n-string-size': 'The max length of the annotations is 2048 signs.' + }, + 'description': { + 'not-null': 'The description of the analysis package must not be empty!', + 'i18n-string-size': 'The max length of the analysis package description is 2048.', + 'i18n-string-not-empty': 'The description of the analysis package must not be empty for all languages.' + }, + 'institution': { + 'not-null': 'The institution of the analysis package must not be empty!', + 'i18n-string-size': 'The max length of the institution is 512.', + 'i18n-string-entire-not-empty': 'The institution of the analysis package must not be empty for both languages.' + }, + 'license': { + 'string-size': 'The max length of the license is 1048576 signs.' + }, + 'sponsor': { + 'not-null': 'The sponsor of the analysis package must not be empty!', + 'i18n-string-size': 'The max length of the sponsor of the analysis package is 512.', + 'i18n-string-entire-not-empty': 'The sponsor of the analysis package must not be empty for both languages.' + }, + 'additional-links': { + 'invalid-url': 'The provided URL is not valid.', + 'url-size': 'The max length for URLs is 2000 chracters.', + 'url-not-empty': 'The URL must not be empty.', + 'display-text-size': 'The max length for display text is 512 chracters.' + }, + 'analysis-data-packages': { + 'package-type': { + 'i18n-not-null': 'The type of the data package must not be empty!' + } + } + }, + 'external-data-package': { + 'title': { + 'not-null': 'The title of the external data package must not be empty!', + 'i18n-string-size': 'The max length of the external data package title is 2048.', + 'i18n-string-entire-not-empty': 'The title of the external data package must not be empty for all languages.' + }, + 'annotations': { + 'i18n-string-size': 'The max length of the annotations is 2048 signs.' + }, + 'description': { + 'not-null': 'The description of the external data package must not be empty!', + 'i18n-string-size': 'The max length of the external data package description is 2048.', + 'i18n-string-not-empty': 'The description of the external data package must not be empty for all languages.' + }, + 'data-source': { + 'i18n-string-not-empty': 'The data source of the external data package must not be empty!', + 'i18n-string-size': 'The max length of the external data package data source is 512.', + 'i18n-string-entire-not-empty': 'The data source of the external data package must not be empty for all languages.' + }, + 'data-source-url': { + 'invalid-url': 'The provided URL is not valid.', + 'url-size': 'The max length for URLs is 2000 chracters.', + 'url-not-empty': 'The URL must not be empty.' + }, + 'availability-type': { + 'i18n-not-null': 'The availability type of the external data package must not be empty!' + } + }, + 'custom-data-package': { + 'title': { + 'not-null': 'The title of the custom data package must not be empty!', + 'i18n-string-size': 'The max length of the custom data package title is 2048.', + 'i18n-string-entire-not-empty': 'The title of the custom data package must not be empty for all languages.' + }, + 'annotations': { + 'i18n-string-size': 'The max length of the annotations is 2048 signs.' + }, + 'description': { + 'not-null': 'The description of the custom data package must not be empty!', + 'i18n-string-size': 'The max length of the custom data package description is 2048.', + 'i18n-string-not-empty': 'The description of the custom data package must not be empty for all languages.' + }, + 'availability-type': { + 'i18n-not-null': 'The availability type of the custom data package must not be empty!' + }, + 'access-way': { + 'i18n-not-null': 'The access way of the data package must not be empty!' + }, + 'data-source': { + 'i18n-not-null': 'The data source of the custom data package must not be empty!' + } + }, + 'analyzed-data-package': { + 'data-package-master-id': { + 'not-empty': 'An FDZ-DZHW Datapackage must be selected.', + 'not-found': 'No valid FDZ-DZHW Datapackage found.', + 'not-valid': 'Please select one of the provided FDZ-DZHW Datapackages.' + }, + 'version': { + 'not-empty': 'The version of the data package must not be empty!' + }, + 'access-way': { + 'not-empty': 'The access way of the data package must not be empty!' } } } diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackage.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackage.resource.js new file mode 100644 index 0000000000..8c55262d7d --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackage.resource.js @@ -0,0 +1,25 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageResource', + function($resource, CleanJSObjectService) { + return $resource('/api/analysis-packages/:id', { + id: '@id' + }, { + 'get': { + method: 'GET' + }, + 'save': { + method: 'PUT', + transformRequest: function(analysisPackage) { + var copy = angular.copy(analysisPackage); + CleanJSObjectService.deleteEmptyStrings(copy); + CleanJSObjectService.removeEmptyJsonObjects(copy); + return angular.toJson(copy); + } + }, + 'delete': { + method: 'DELETE' + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAccessWays.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAccessWays.resource.js new file mode 100644 index 0000000000..73d3f28fcd --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAccessWays.resource.js @@ -0,0 +1,13 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageAccessWaysResource', function($resource) { + return $resource('/api/analysis-packages/:id/access-ways', { + id: '@id' + }, { + 'get': { + method: 'GET', + isArray: true + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachment.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachment.resource.js new file mode 100644 index 0000000000..cfc85c28fd --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachment.resource.js @@ -0,0 +1,48 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageAttachmentResource', function($resource, + CleanJSObjectService) { + return $resource( + '/api/analysis-packages/:analysisPackageId/attachments/:fileName', { + analysisPackageId: '@analysisPackageId', + fileName: '@fileName' + }, { + 'findByAnalysisPackageId': { + method: 'GET', + isArray: true + }, + 'save': { + method: 'PUT', + params: { + analysisPackageId: '@analysisPackageId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + }, + transformRequest: function(attachment) { + var copy = angular.copy(attachment); + CleanJSObjectService.deleteEmptyStrings(copy); + CleanJSObjectService.removeEmptyJsonObjects(copy); + return angular.toJson(copy); + } + }, + 'delete': { + method: 'DELETE', + params: { + analysisPackageId: '@analysisPackageId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + } + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachmentVersions.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachmentVersions.resource.js new file mode 100644 index 0000000000..6ef6f8556c --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageAttachmentVersions.resource.js @@ -0,0 +1,16 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageAttachmentVersionsResource', function($resource) { + return $resource( + '/api/analysis-packages/:analysisPackageId/' + + 'attachments/:filename/versions', { + dataPackageId: '@analysisPackageId', + filename: '@filename' + }, { + 'get': { + method: 'GET', + isArray: true + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageOverview.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageOverview.resource.js new file mode 100644 index 0000000000..ebd5b75ba6 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageOverview.resource.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageOverviewResource', function($resource) { + return $resource( + 'api/analysis-packages/:analysisPackageId/overview/generate/:version', { + dataPackageId: '@analysisPackageId', + version: '@version' + }, { + 'startGeneration': { + method: 'POST', + params: {languages: '@languages'} + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageVersions.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageVersions.resource.js new file mode 100644 index 0000000000..c88594e8b9 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/analysisPackageVersions.resource.js @@ -0,0 +1,13 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageVersionsResource', function($resource) { + return $resource('/api/analysis-packages/:id/versions', { + id: '@id' + }, { + 'get': { + method: 'GET', + isArray: true + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllAnalysisPackages.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllAnalysisPackages.resource.js new file mode 100644 index 0000000000..781bd9fb89 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllAnalysisPackages.resource.js @@ -0,0 +1,13 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('DeleteAllAnalysisPackagesResource', function($resource) { + return $resource('/api/data-acquisition-projects/:id/' + + 'analysis-packages', { + id: '@id' + }, { + 'deleteAll': { + method: 'DELETE' + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllScriptAttachments.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllScriptAttachments.resource.js new file mode 100644 index 0000000000..adfef461ff --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/deleteAllScriptAttachments.resource.js @@ -0,0 +1,14 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('DeleteAllScriptAttachmentsResource', function($resource) { + return $resource( + '/api/analysis-packages/:analysisPackageId' + + '/scripts/attachments/', { + analysisPackageId: '@id' + }, { + 'deleteAll': { + method: 'DELETE' + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/scriptAttachment.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/scriptAttachment.resource.js new file mode 100644 index 0000000000..0586b06436 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/scriptAttachment.resource.js @@ -0,0 +1,52 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('ScriptAttachmentResource', function($resource, + CleanJSObjectService) { + return $resource( + '/api/analysis-packages/:analysisPackageId' + + '/scripts/:scriptUuid/attachments/:fileName', { + analysisPackageId: '@analysisPackageId', + fileName: '@fileName', + scriptUuid: '@scriptUuid' + }, { + 'findByAnalysisPackageId': { + method: 'GET', + isArray: true + }, + 'save': { + method: 'PUT', + params: { + analysisPackageId: '@analysisPackageId', + scriptUuid: '@scriptUuid', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + }, + transformRequest: function(attachment) { + var copy = angular.copy(attachment); + CleanJSObjectService.deleteEmptyStrings(copy); + CleanJSObjectService.removeEmptyJsonObjects(copy); + return angular.toJson(copy); + } + }, + 'delete': { + method: 'DELETE', + params: { + analysisPackageId: '@analysisPackageId', + scriptUuid: '@scriptUuid', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + } + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/resources/scriptSoftwarePackages.resource.js b/src/main/webapp/scripts/analysispackagemanagement/resources/scriptSoftwarePackages.resource.js new file mode 100644 index 0000000000..180af0cbca --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/resources/scriptSoftwarePackages.resource.js @@ -0,0 +1,10 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('ScriptSoftwarePackagesResource', function($resource) { + return $resource('/api/analysis-packages/scripts/software-packages', null, { + 'get': { + isArray: true + } + }); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageAttachmentUpload.service.js b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageAttachmentUpload.service.js new file mode 100644 index 0000000000..3ca73b1bed --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageAttachmentUpload.service.js @@ -0,0 +1,34 @@ +'use strict'; +angular.module('metadatamanagementApp').service( + 'AnalysisPackageAttachmentUploadService', + function(Upload, $q, $http) { + var uploadAttachment = function(attachment, metadata) { + var deferred = $q.defer(); + if (!Upload.isFile(attachment) || attachment.size <= 0) { + deferred.reject({invalidFile: true}); + return deferred.promise; + } + Upload.upload({ + url: '/api/analysis-packages/attachments', + data: { + analysisPackageAttachmentMetadata: Upload.jsonBlob(metadata), + file: attachment + } + }).success(function() { + deferred.resolve(); + }).error(function(error) { + deferred.reject(error); + }); + return deferred.promise; + }; + + var deleteAllAttachments = function(analysisPackageId) { + return $http.delete('/api/analysis-packages/' + + encodeURIComponent(analysisPackageId) + + '/attachments'); + }; + return { + uploadAttachment: uploadAttachment, + deleteAllAttachments: deleteAllAttachments + }; + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageIdBuilder.service.js b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageIdBuilder.service.js new file mode 100644 index 0000000000..acc9e171bc --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageIdBuilder.service.js @@ -0,0 +1,19 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .service('AnalysisPackageIdBuilderService', + function() { + var buildAnalysisPackageId = function(dataAcquisitionProjectId, version) { + if (version && version !== '') { + return 'ana-' + dataAcquisitionProjectId + '$-' + version; + } else { + return 'ana-' + dataAcquisitionProjectId + '$'; + } + }; + + return { + buildAnalysisPackageId: buildAnalysisPackageId + }; + }); + +// TODO: Create a generic PackageIdBuilder diff --git a/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageSearch.service.js b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageSearch.service.js new file mode 100644 index 0000000000..c2a8b3ee6f --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/services/analysisPackageSearch.service.js @@ -0,0 +1,530 @@ +/* global _ */ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('AnalysisPackageSearchService', + function($q, ElasticSearchClient, CleanJSObjectService, SearchHelperService, + GenericFilterOptionsSearchService, LanguageService, + AnalysisPackageIdBuilderService) { + var createQueryObject = function(type) { + type = type || 'analysis_packages'; + return { + index: type + }; + }; + + var createTermFilters = function(filter, dataAcquisitionProjectId, type) { + type = type || 'analysis_packages'; + var termFilter; + if (!CleanJSObjectService.isNullOrEmpty(filter) || + !CleanJSObjectService.isNullOrEmpty(dataAcquisitionProjectId)) { + termFilter = []; + } + if (!CleanJSObjectService.isNullOrEmpty(dataAcquisitionProjectId) && + !_.includes(['related_publications', 'concepts'], type)) { + var projectFilter = { + term: { + dataAcquisitionProjectId: dataAcquisitionProjectId + } + }; + termFilter.push(projectFilter); + } + if (!CleanJSObjectService.isNullOrEmpty(dataAcquisitionProjectId) && + type === 'related_publications') { + var analysisPackageId = AnalysisPackageIdBuilderService + .buildAnalysisPackageId( + dataAcquisitionProjectId); + var analysisPackageFilter = { + term: { + 'analysisPackages.id': analysisPackageId + } + }; + termFilter.push(analysisPackageFilter); + } + if (!CleanJSObjectService.isNullOrEmpty(filter)) { + termFilter = _.concat(termFilter, + SearchHelperService.createTermFilters(type, filter)); + } + return termFilter; + }; + + var findOneById = function(id, attributes, excludes) { + var deferred = $q.defer(); + var query = createQueryObject(); + query.id = id; + if (attributes) { + query._source = attributes; + } + if (excludes) { + query._source_excludes = excludes.join(','); + } + ElasticSearchClient.getSource(query, function(error, response) { + if (error) { + deferred.reject(error); + } else { + deferred.resolve(response); + } + }); + return deferred; + }; + + var findShadowByIdAndVersion = function(id, version, excludes) { + var query = {}; + _.extend(query, createQueryObject(), + SearchHelperService.createShadowByIdAndVersionQuery(id, version)); + if (excludes) { + query.body._source = { + 'excludes': excludes + }; + } + var deferred = $q.defer(); + ElasticSearchClient.search(query).then(function(result) { + if (result.hits.hits.length === 1) { + deferred.resolve(result.hits.hits[0]._source); + } else { + return deferred.resolve(null); + } + }, deferred.reject); + return deferred; + }; + + var findAnalysisPackageTitles = function(searchText, filter, type, + queryterm, + dataAcquisitionProjectId) { + var language = LanguageService.getCurrentInstantly(); + var query = createQueryObject(type); + query.size = 0; + query.body = {}; + var termFilters = createTermFilters(filter, dataAcquisitionProjectId, + type); + var prefix = (type === 'analysis_packages' || !type) ? '' + : 'nestedAnalysisPackage.'; + if (type === 'related_publications' || type === 'concepts') { + prefix = 'nestedAnalysisPackages.'; + } + var aggregation = { + 'aggs': { + 'title': { + 'filter': { + 'bool': { + 'must': [{ + 'match': {} + }] + } + }, + 'aggs': { + 'id': { + 'terms': { + 'field': prefix + 'id', + 'size': 100 + }, + 'aggs': { + 'masterId': { + 'terms': { + 'field': prefix + 'masterId', + 'size': 100 + } + }, + 'titleDe': { + 'terms': { + 'field': prefix + 'title.de', + 'size': 100 + }, + 'aggs': { + 'titleEn': { + 'terms': { + 'field': prefix + 'title.en', + 'size': 100 + } + } + } + } + } + } + } + } + } + }; + var nestedAggregation = { + 'aggs': { + 'analysisPackages': { + 'nested': { + 'path': prefix.replace('.', '') + } + } + } + }; + + aggregation.aggs.title.filter.bool.must[0] + .match[prefix + 'completeTitle.' + language] = { + 'query': searchText || '', + 'operator': 'AND', + 'minimum_should_match': '100%', + 'zero_terms_query': 'ALL' + }; + + SearchHelperService.addNestedShadowCopyFilter( + aggregation.aggs.title.filter.bool, prefix, type); + + if (prefix !== '') { + nestedAggregation.aggs.dataPackages.aggs = + aggregation.aggs; + query.body.aggs = nestedAggregation.aggs; + } else { + query.body.aggs = aggregation.aggs; + } + + if (termFilters) { + query.body.query = query.body.query || {}; + query.body.query.bool = query.body.query.bool || {}; + query.body.query.bool.filter = termFilters; + } + + SearchHelperService.addQuery(query, queryterm); + SearchHelperService.addFilter(query); + if (!_.includes(['related_publications', 'concepts'], type)) { + SearchHelperService.addShadowCopyFilter(query, filter); + } + return ElasticSearchClient.search(query).then(function(result) { + var titles = []; + var titleElement = {}; + var buckets = []; + if (prefix !== '') { + buckets = result.aggregations.analysisPackages.title.id.buckets; + } else { + buckets = result.aggregations.title.id.buckets; + } + buckets.forEach(function(bucket) { + titleElement = { + title: { + de: bucket.titleDe.buckets[0].key, + en: bucket.titleDe.buckets[0].titleEn.buckets[0].key + }, + id: bucket.key, + masterId: bucket.masterId.buckets[0].key, + count: bucket.doc_count + }; + titles.push(titleElement); + }); + return titles; + }); + }; + + var findSponsors = function(searchText, filter, language, + ignoreAuthorization, excludedSponsors) { + ignoreAuthorization = ignoreAuthorization || false; + language = language || LanguageService.getCurrentInstantly(); + var query = createQueryObject(); + var termFilters = createTermFilters(filter); + query.size = 0; + query.body = { + 'aggs': { + 'sponsors': { + 'nested': { + 'path': 'nestedSponsors' + }, + 'aggs': { + 'filtered': { + 'filter': { + 'bool': { + 'must': [{ + 'match': {} + }] + } + }, + 'aggs': { + 'sponsorDe': { + 'terms': { + 'field': 'nestedSponsors.de', + 'size': 100 + }, + 'aggs': { + 'sponsorEn': { + 'terms': { + 'field': 'nestedSponsors.en', + 'size': 100 + } + } + } + } + } + } + } + } + } + }; + + query.body.query = { + 'bool': { + 'filter': { + 'term': { + 'shadow': false + } + } + } + }; + + query.body.aggs.sponsors.aggs.filtered.filter.bool.must[0].match + ['nestedSponsors.' + language + '.ngrams'] = { + 'query': searchText || '', + 'operator': 'AND', + 'minimum_should_match': '100%', + 'zero_terms_query': 'ALL' + }; + + if (excludedSponsors && excludedSponsors.length > 0) { + query.body.aggs.sponsors.aggs.filtered.filter.bool.must_not = []; + excludedSponsors.forEach(function(sponsor) { + if (sponsor) { + query.body.aggs.sponsors.aggs.filtered.filter.bool.must_not + .push({ + 'term': { + 'nestedSponsors.de': sponsor.de + } + }); + } + }); + } + + if (termFilters) { + query.body.query.bool.filter = termFilters; + } + + if (!ignoreAuthorization) { + SearchHelperService.addFilter(query); + } + + return ElasticSearchClient.search(query).then(function(result) { + var sponsors = []; + var sponsorElement = {}; + result.aggregations.sponsors.filtered.sponsorDe.buckets.forEach( + function(bucket) { + sponsorElement = { + 'de': bucket.key, + 'en': bucket.sponsorEn.buckets[0].key + }; + sponsorElement.count = bucket.doc_count; + sponsors.push(sponsorElement); + }); + return sponsors; + }); + }; + + var findInstitutions = function(searchText, filter, language, + ignoreAuthorization, + excludedInstitutions) { + ignoreAuthorization = ignoreAuthorization || false; + language = language || LanguageService.getCurrentInstantly(); + var query = createQueryObject(); + var termFilters = createTermFilters(filter); + query.size = 0; + query.body = { + 'aggs': { + 'institutions': { + 'nested': { + 'path': 'nestedInstitutions' + }, + 'aggs': { + 'filtered': { + 'filter': { + 'bool': { + 'must': [{ + 'match': {} + }] + } + }, + 'aggs': { + 'institutionDe': { + 'terms': { + 'field': 'nestedInstitutions.de', + 'size': 100 + }, + 'aggs': { + 'institutionEn': { + 'terms': { + 'field': 'nestedInstitutions.en', + 'size': 100 + } + } + } + } + } + } + } + } + } + }; + + query.body.query = { + 'bool': { + 'filter': { + 'term': { + 'shadow': false + } + } + } + }; + + query.body.aggs.institutions.aggs.filtered.filter.bool.must[0].match + ['nestedInstitutions.' + language + '.ngrams'] = { + 'query': searchText || '', + 'operator': 'AND', + 'minimum_should_match': '100%', + 'zero_terms_query': 'ALL' + }; + + if (excludedInstitutions && excludedInstitutions.length > 0) { + query.body.aggs.institutions.aggs.filtered.filter.bool.must_not = []; + excludedInstitutions.forEach(function(institution) { + if (institution) { + query.body.aggs.institutions.aggs.filtered.filter.bool.must_not + .push({ + 'term': { + 'nestedInstitutions.de': institution.de + } + }); + } + }); + } + + if (termFilters) { + query.body.query.bool.filter = termFilters; + } + + if (!ignoreAuthorization) { + SearchHelperService.addFilter(query); + } + + return ElasticSearchClient.search(query).then(function(result) { + var institutions = []; + var institutionElement = {}; + result.aggregations.institutions.filtered.institutionDe.buckets + .forEach( + function(bucket) { + institutionElement = { + 'de': bucket.key, + 'en': bucket.institutionEn.buckets[0].key + }; + institutionElement.count = bucket.doc_count; + institutions.push(institutionElement); + }); + return institutions; + }); + }; + + var buildSearchConfig = function(searchText, filter, type, queryTerm, + dataAcquisitionProjectId, + filterAttribute) { + + return { + searchText: searchText, + type: type, + filter: filter, + dataAcquisitionProjectId: dataAcquisitionProjectId, + filterAttribute: filterAttribute, + queryTerm: queryTerm, + prefix: type === 'analysis_packages' ? '' : 'analysisPackage' + }; + }; + + var findInstitutionFilterOptions = function(searchText, filter, type, + queryTerm, + dataAcquisitionProjectId) { + + var searchConfig = buildSearchConfig( + searchText, + filter, + type, + queryTerm, + dataAcquisitionProjectId, + 'institutions' + ); + + return GenericFilterOptionsSearchService + .findFilterOptions(searchConfig); + }; + + var findSponsorFilterOptions = function(searchText, filter, type, + queryTerm, + dataAcquisitionProjectId) { + + var searchConfig = buildSearchConfig( + searchText, + filter, + type, + queryTerm, + dataAcquisitionProjectId, + 'sponsors' + ); + + return GenericFilterOptionsSearchService + .findFilterOptions(searchConfig); + }; + + var findTags = function(searchText, language, filter, + ignoreAuthorization) { + ignoreAuthorization = ignoreAuthorization || false; + language = language || LanguageService.getCurrentInstantly(); + var query = createQueryObject(); + var termFilters = createTermFilters(filter); + query.size = 0; + query.body = { + 'aggs': { + 'tags': { + 'terms': { + 'field': 'tags.' + language, + 'size': 100 + } + } + } + }; + + query.body.query = { + 'bool': { + 'must': [{ + 'match': {} + }], + 'filter': { + 'term': { + 'shadow': false + } + } + } + }; + + query.body.query.bool.must[0].match + ['tags.' + language + '.ngrams'] = { + 'query': searchText, + 'operator': 'AND', + 'minimum_should_match': '100%', + 'zero_terms_query': 'ALL' + }; + + if (termFilters) { + query.body.query.bool.filter = termFilters; + } + + if (!ignoreAuthorization) { + SearchHelperService.addFilter(query); + } + + return ElasticSearchClient.search(query).then(function(result) { + var tags = []; + result.aggregations.tags.buckets.forEach(function(bucket) { + tags.push(bucket.key); + }); + return tags; + }); + }; + + return { + findOneById: findOneById, + findShadowByIdAndVersion: findShadowByIdAndVersion, + findSponsors: findSponsors, + findInstitutions: findInstitutions, + findAnalysisPackageTitles: findAnalysisPackageTitles, + findInstitutionFilterOptions: findInstitutionFilterOptions, + findSponsorFilterOptions: findSponsorFilterOptions, + findTags: findTags + }; + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/services/currentAnalysisPackage.service.js b/src/main/webapp/scripts/analysispackagemanagement/services/currentAnalysisPackage.service.js new file mode 100644 index 0000000000..6e7e753df7 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/services/currentAnalysisPackage.service.js @@ -0,0 +1,25 @@ +'use strict'; + +angular.module('metadatamanagementApp').service('CurrentAnalysisPackageService', + function($rootScope) { + + // the currently chosen analysis package (only public users) + var currentAnalysisPackage; + + var setCurrentAnalysisPackage = function(analysisPackage) { + if (!angular.equals(currentAnalysisPackage, analysisPackage)) { + currentAnalysisPackage = analysisPackage; + $rootScope.$broadcast('current-analysis-package-changed', + currentAnalysisPackage); + } + }; + + var getCurrentAnalysisPackage = function() { + return currentAnalysisPackage; + }; + + return { + setCurrentAnalysisPackage: setCurrentAnalysisPackage, + getCurrentAnalysisPackage: getCurrentAnalysisPackage + }; + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/services/scriptAttachmentUpload.service.js b/src/main/webapp/scripts/analysispackagemanagement/services/scriptAttachmentUpload.service.js new file mode 100644 index 0000000000..e6b84d79d3 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/services/scriptAttachmentUpload.service.js @@ -0,0 +1,41 @@ +'use strict'; +angular.module('metadatamanagementApp').service( + 'ScriptAttachmentUploadService', + function(Upload, $q, $http) { + var uploadScriptAttachment = function(file, metadata) { + var deferred = $q.defer(); + if (!Upload.isFile(file) || file.size <= 0) { + deferred.reject({invalidFile: true}); + return deferred.promise; + } + Upload.upload({ + url: '/api/analysis-packages/' + metadata.analysisPackageId + + '/scripts/attachments', + data: { + file: file, + scriptAttachmentMetadata: Upload.jsonBlob(metadata) + } + }).success(function() { + deferred.resolve(); + }).error(function(error) { + deferred.reject(error); + }); + return deferred.promise; + }; + + var deleteAttachment = function( + analysisPackageId, + scriptUuid, + fileName + ) { + return $http.delete('/api/analysis-packages/' + + encodeURIComponent(analysisPackageId) + '/scripts/' + + encodeURIComponent(scriptUuid) + + '/attachments' + + encodeURIComponent(fileName)); + }; + return { + uploadScriptAttachment: uploadScriptAttachment, + deleteScriptAttachment: deleteAttachment + }; + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/attachments.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/attachments.html.tmpl new file mode 100644 index 0000000000..bbf8654723 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/attachments.html.tmpl @@ -0,0 +1,46 @@ + + + +

{{'analysis-package-management.detail.attachments.table-title' | translate}}

+
+ + keyboard_arrow_up + keyboard_arrow_down + +
+
+ + + + + + + + + + + + + + + + + + +
{{'data-package-management.detail.label.attachments.title' | + translate }} + {{'data-package-management.detail.label.attachments.description' | + translate }} + {{'data-package-management.detail.label.attachments.language' | translate }} + {{'data-package-management.detail.label.attachments.file' | translate }} +
{{row.title}} {{row.language | displayIsoLanguage: $ctrl.lang}}{{row.fileName}} + + {{'global.tooltips.files.download' | translate: {filename: row.fileName} }} + + +
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/common-details.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/common-details.html.tmpl new file mode 100644 index 0000000000..1ad1633e97 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/common-details.html.tmpl @@ -0,0 +1,94 @@ + + + +

{{'global.cards.details' | translate }}

+
+ + keyboard_arrow_up + keyboard_arrow_down + +
+
+ + + +
{{'analysis-package-management.detail.label.authors' | translate }}:
+
{{author.lastName}}, {{author.firstName}}{{author.middleName !== undefined?' '+author.middleName:''}} ORCID logo{{!$last?'; ':''}}
+
+ +
{{'analysis-package-management.detail.label.institutions' | translate }}:
+ {{institution[$ctrl.lang]}}{{!$last?'; ':''}} +
+ +
{{'analysis-package-management.detail.label.sponsors' | translate }}:
+ {{sponsor[$ctrl.lang]}}{{!$last?'; ':''}} +
+ +
{{'analysis-package-management.detail.label.projectContributors' | translate }}:
+
{{person.lastName}}, {{person.firstName}}{{person.middleName !== undefined?' '+person.middleName:''}} ORCID logo{{!$last?'; ':''}}
+
+ +
{{'analysis-package-management.detail.label.dataLanguages' | translate }}:
+ {{(language | displayIsoLanguage: $ctrl.lang)}}{{$index + 1 !== $ctrl.options.analysisPackage.dataLanguages.length ? ', ': ''}} + +
+ +
{{'analysis-package-management.detail.label.data-curators' | translate }}:
+
{{person.lastName}}, {{person.firstName}}{{person.middleName !== undefined?' '+person.middleName:''}} ORCID logo{{!$last?'; ':''}}
+
+ +
{{'analysis-package-management.detail.label.doi' | translate }}:
+ + {{$ctrl.options.analysisPackage.doi}} + + {{'analysis-package-management.detail.doi-tooltip' | translate}} + + +
+ +
{{'analysis-package-management.detail.label.version' | translate }}:
+ {{$ctrl.options.analysisPackage.release?$ctrl.options.analysisPackage.release.version + ' (' + ('analysis-package-management.detail.label.published-at' | translate) + ' ' + ($ctrl.options.analysisPackage.release.firstDate + 'Z' | date:'mediumDate') + ')': ('analysis-package-management.detail.not-yet-released' | translate)}} +
+ +
{{'analysis-package-management.detail.label.annotations' | translate }}:
+

+
+ +
{{'analysis-package-management.detail.label.additional-links' | translate }}:
+ +
+
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/description.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/description.html.tmpl new file mode 100644 index 0000000000..6b782ed3ba --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/description.html.tmpl @@ -0,0 +1,18 @@ + + + +

{{'analysis-package-management.detail.label.description' | translate}}

+
+ + keyboard_arrow_up + keyboard_arrow_down + +
+
+ +

+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/license.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/license.html.tmpl new file mode 100644 index 0000000000..4c02713bf1 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/license.html.tmpl @@ -0,0 +1,18 @@ + + + +

{{'analysis-package-management.detail.label.license' | translate}}

+
+ + keyboard_arrow_up + keyboard_arrow_down + +
+
+ +

+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/packages.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/packages.html.tmpl new file mode 100644 index 0000000000..ecf443b43e --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/packages.html.tmpl @@ -0,0 +1,97 @@ + + + +

+ {{'analysis-package-management.detail.label.analysis-data' | translate + }}

+
+ + + keyboard_arrow_up + + + keyboard_arrow_down + + +
+
+ + + +
{{ 'analysis-package-management.detail.label.type-of-data' | translate}}:
+ {{$ctrl.options.dataPackageList[item.type][$ctrl.lang]}} +
+ +
{{'analysis-package-management.detail.label.analyzed-data-package.data-package' | translate}}:
+ + + {{item.dataPackageTitle[$ctrl.lang]}} +
+ +
{{ 'analysis-package-management.detail.label.analyzed-data-package.version' | translate}}:
+ {{item.version}} +
+ +
{{ 'analysis-package-management.detail.label.analyzed-data-package.access-way' | translate}}:
+ {{item.accessWay | displayAccessWay}} +
+ +
{{ 'analysis-package-management.detail.label.title' | translate}}:
+ {{item.title[$ctrl.lang]}} +
+ +
{{'analysis-package-management.detail.label.external-data-package.description' | translate }}:
+

+
+ +
{{'analysis-package-management.detail.label.external-data-package.annotations' | translate }}:
+

+
+ +
{{'analysis-package-management.detail.label.external-data-package.data-source' | translate }}:
+

{{item.dataSource[$ctrl.lang]}}

+ {{item.dataSource[$ctrl.lang]}} +
+ +
{{ 'analysis-package-management.detail.label.external-data-package.availability-type' | translate}}:
+ {{item.availabilityType[$ctrl.lang]}} +
+ + +
{{'analysis-package-management.detail.label.custom-data-package.dataSources' | translate }}:
+ +
+ +
{{ 'analysis-package-management.detail.label.custom-data-package.access-way' | translate}}:
+ {{item.accessWay}} +
+ +
{{ 'analysis-package-management.detail.label.custom-data-package.availability-type' | translate}}:
+ {{item.availabilityType[$ctrl.lang]}} +
+ + +
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/templates/scripts.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/templates/scripts.html.tmpl new file mode 100644 index 0000000000..2ec37d62c6 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/templates/scripts.html.tmpl @@ -0,0 +1,42 @@ + + + +

{{'analysis-package-management.detail.scripts.table-title' | translate}}

+
+ + keyboard_arrow_up + keyboard_arrow_down + +
+
+ + + + + + + + + + + + + + + + + + + + +
{{'analysis-package-management.detail.scripts.title' | translate }}{{'analysis-package-management.detail.scripts.language' | translate }}{{'analysis-package-management.detail.scripts.software-package' | translate }}{{'analysis-package-management.detail.scripts.version' | translate }}{{'analysis-package-management.detail.scripts.file' | translate }}
{{row.title[$ctrl.lang]}} {{row.usedLanguage | displayIsoLanguage: $ctrl.lang}}{{row.softwarePackage}}{{row.softwarePackageVersion}}{{row.attachment.fileName}} + + {{'global.tooltips.files.download' | translate: {filename: row.attachment.fileName} }} + + +
+
+
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.controller.js b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.controller.js new file mode 100644 index 0000000000..4a40a2c140 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.controller.js @@ -0,0 +1,214 @@ +/* globals _ */ +'use strict'; + +angular.module('metadatamanagementApp') + .controller('AnalysisPackageDetailController', + function(entity, + MessageBus, + PageMetadataService, + LanguageService, DataPackageSearchService, + $state, $location, + BreadcrumbService, Principal, SimpleMessageToastService, + SearchResultNavigatorService, + $stateParams, + AnalysisPackageAttachmentResource, + $rootScope, DataAcquisitionProjectResource, + ProjectUpdateAccessService, $scope, ScriptAttachmentResource, + $timeout, $document, + OutdatedVersionNotifier, AnalysisPackageSearchService, $log, + blockUI, $mdSidenav, ContainsOnlyQualitativeDataChecker) { + blockUI.start(); + SearchResultNavigatorService + .setSearchIndex($stateParams['search-result-index']); + SearchResultNavigatorService.registerCurrentSearchResult(); + + var getScriptAttachmentMetadata = function() { + _.forEach(ctrl.analysisPackage.scripts, function(value, index) { + _.filter(ctrl.scriptAttachments, function(item) { + if (item.scriptUuid === value.uuid) { + ctrl.analysisPackage.scripts[index].attachment = item; + } + }); + }); + }; + + var getTags = function(analysisPackage) { + if (analysisPackage.tags) { + var language = LanguageService.getCurrentInstantly(); + return analysisPackage.tags[language]; + } else { + return []; + } + }; + var ctrl = this; + var activeProject; + var bowser = $rootScope.bowser; + + ctrl.dataPackageList = { + dataPackage: { + en: 'FDZ-DZHW Datapackage', + de: 'FDZ-DZHW Datenpaket' + }, + externalData: { + en: 'External Data Package', + de: 'Externes Datenpaket' + }, + customDataPackage: { + en: 'Custom Data Package', + de: 'Benutzerdefiniertes Datenpaket' + } + }; + ctrl.dataPackage = null; + ctrl.scriptAttachments = []; + ctrl.isAuthenticated = Principal.isAuthenticated; + ctrl.hasAuthority = Principal.hasAuthority; + ctrl.projectIsCurrentlyReleased = true; + ctrl.searchResultIndex = SearchResultNavigatorService.getSearchIndex(); + ctrl.counts = { + publicationsCount: 0 + }; + ctrl.enableJsonView = Principal + .hasAnyAuthority(['ROLE_PUBLISHER', 'ROLE_ADMIN']); + + ctrl.loadAttachments = function() { + AnalysisPackageAttachmentResource.findByAnalysisPackageId({ + analysisPackageId: ctrl.analysisPackage.id + }).$promise.then( + function(attachments) { + ctrl.attachments = attachments; + }); + }; + + ctrl.loadDataPackages = function(packages) { + var excludes = ['nested*', 'variables', 'questions', + 'surveys', 'instruments', 'relatedPublications', + 'concepts']; + + _.forEach(packages, function(item, index) { + if (item.type === 'dataPackage') { + DataPackageSearchService + .findOneById(item.dataPackageMasterId, ['title'], excludes) + .promise + .then(function(data) { + packages[index].dataPackageTitle = data.title; + }); + } + }); + }; + + ctrl.isBetaRelease = function(analysisPackage) { + if (analysisPackage.release) { + return bowser.compareVersions(['1.0.0', analysisPackage + .release.version]) === 1; + } + return false; + }; + + ctrl.loadScriptAttachments = function() { + ScriptAttachmentResource.findByAnalysisPackageId({ + analysisPackageId: ctrl.analysisPackage.id + }).$promise.then( + function(attachments) { + if (attachments.length > 0) { + ctrl.scriptAttachments = attachments; + getScriptAttachmentMetadata(); + } + }); + }; + $scope.$on('deletion-completed', function() { + //wait for 2 seconds until refresh + //in order to wait for elasticsearch reindex + $timeout($state.reload, 2000); + }); + + entity.promise.then(function(result) { + var fetchFn = AnalysisPackageSearchService.findShadowByIdAndVersion + .bind(null, result.masterId, null, ['nested*', + 'relatedPublications']); + OutdatedVersionNotifier.checkVersionAndNotify(result, fetchFn); + + if (Principal + .hasAnyAuthority(['ROLE_PUBLISHER', 'ROLE_DATA_PROVIDER'])) { + DataAcquisitionProjectResource.get({ + id: result.dataAcquisitionProjectId + }).$promise.then(function(project) { + ctrl.projectIsCurrentlyReleased = (project.release != null); + ctrl.assigneeGroup = project.assigneeGroup; + activeProject = project; + }); + } + ctrl.onlyQualitativeData = ContainsOnlyQualitativeDataChecker + .check(result); + + if (!Principal.isAuthenticated()) { + MessageBus.set('onAnalysisPackageChange', + { + masterId: result.masterId, + version: result.release.version + }); + MessageBus.set('onDetailViewLoaded', {type: 'analysisPackage'}); + } + + PageMetadataService.setPageTitle( + 'analysis-package-management.detail.title', { + title: result.title[LanguageService.getCurrentInstantly()] + }); + PageMetadataService.setPageDescription( + 'analysis-package-management.detail.page-description', { + description: result.description[ + LanguageService.getCurrentInstantly() + ] + }); + PageMetadataService.setDublinCoreMetadataForAP(result); + PageMetadataService.setSchemaOrgMetadataForAP(result); + BreadcrumbService.updateToolbarHeader({ + 'stateName': $state.current.name, + 'id': result.id, + 'analysisPackageIsPresent': true, + 'projectId': result.dataAcquisitionProjectId + }); + if (result.release || Principal + .hasAnyAuthority(['ROLE_PUBLISHER', 'ROLE_DATA_PROVIDER'])) { + ctrl.analysisPackage = result; + ctrl.loadDataPackages(result.analysisDataPackages); + ctrl.loadAttachments(); + ctrl.loadScriptAttachments(); + + $timeout(function() { + if ($location.search().query || + $location.search()['repeated-measurement-identifier'] || + $location.search()['derived-variables-identifier']) { + ctrl.scroll(); + } + }, 1000); + } else { + SimpleMessageToastService.openAlertMessageToast( + 'analysis-package-management.detail.not-released-toast', + {id: result.id} + ); + } + + ctrl.analysisPackageTags = getTags(result); + + }, $log.error) + .finally(blockUI.stop); + + ctrl.scroll = function() { + var element = $document[0].getElementById('related-objects'); + if ($rootScope.bowser.msie) { + element.scrollIntoView(true); + } else { + element.scrollIntoView({behavior: 'smooth', inline: 'nearest'}); + } + }; + ctrl.analysisPackageEdit = function() { + if (ProjectUpdateAccessService + .isUpdateAllowed(activeProject, 'analysisPackages', true)) { + $state.go('analysisPackageEdit', {id: ctrl.analysisPackage.id}); + } + }; + + ctrl.toggleSidenav = function() { + $mdSidenav('SideNavBar').toggle(); + }; + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.html.tmpl new file mode 100644 index 0000000000..0ef6ad6d28 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-detail.html.tmpl @@ -0,0 +1,103 @@ +
+ + + + +
+ + + + {{'search-management.buttons.edit-analysis-package-tooltip' | translate}} + + mode_edit + + + + {{'shopping-cart.buttons.choose-analysis-package-options' | translate}} + + add_shopping_cart + +
+
diff --git a/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.controller.js b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.controller.js new file mode 100644 index 0000000000..58338c4bac --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.controller.js @@ -0,0 +1,779 @@ +/* global _, $, document */ + +'use strict'; + +angular.module('metadatamanagementApp') + .controller('AnalysisPackageEditOrCreateController', + function(entity, PageMetadataService, $document, $timeout, + $state, BreadcrumbService, Principal, SimpleMessageToastService, + CurrentProjectService, AnalysisPackageIdBuilderService, + AnalysisPackageResource, + $scope, ElasticSearchAdminService, $transitions, + CommonDialogsService, LanguageService, + AnalysisPackageSearchService, AnalysisPackageAttachmentResource, + $q, DataAcquisitionProjectResource, + ProjectUpdateAccessService, + AttachmentDialogService, AnalysisPackageAttachmentUploadService, + AnalysisPackageAttachmentVersionsResource, + ChoosePreviousVersionService, AnalysisPackageVersionsResource) { + + var ctrl = this; + ctrl.currentInstitutions = []; + ctrl.currentSponsors = []; + + var getDialogLabels = function() { + return { + createTitle: { + key: 'analysis-package-management.detail.attachments.create-title', + params: { + analysisPackageId: ctrl.analysisPackage.id + } + }, + editTitle: { + key: 'analysis-package-management.detail.attachments.edit-title', + params: { + analysisPackageId: ctrl.analysisPackage.id + } + }, + hints: { + file: { + key: 'analysis-package-management.detail' + + '.attachments.hints.filename' + } + } + }; + }; + + ctrl.translationKeysAuthors = { + title: 'analysis-package-management.detail.label.authors', + tooltips: { + delete: 'analysis-package-management.' + + 'edit.delete-package-author-tooltip', + add: 'analysis-package-management.edit.add-package-author-tooltip', + moveUp: 'analysis-package-management.' + + 'edit.move-package-author-up-tooltip', + moveDown: 'analysis-package-management.' + + 'edit.move-package-author-down-tooltip' + }, + hints: { + firstName: 'analysis-package-management.edit.hints.' + + 'authors.first-name', + middleName: 'analysis-package-management.edit.hints.' + + 'authors.middle-name', + lastName: 'analysis-package-management.edit.hints.' + + 'authors.last-name' + } + }; + + ctrl.translationKeysDataCurators = { + title: 'analysis-package-management.detail.label.data-curators', + tooltips: { + delete: 'analysis-package-management.edit.delete-curator-tooltip', + add: 'analysis-package-management.edit.add-curator-tooltip', + moveUp: 'analysis-package-management.edit.move-curator-up-tooltip', + moveDown: 'analysis-package-management.edit.move-curator-down-tooltip' + }, + hints: { + firstName: 'analysis-package-management.edit.hints' + + '.curators.first-name', + middleName: 'analysis-package-management.edit.hints' + + '.curators.middle-name', + lastName: 'analysis-package-management.edit.hints.curators.last-name' + } + }; + + ctrl.findTags = AnalysisPackageSearchService.findTags; + + var updateToolbarHeaderAndPageTitle = function() { + if (ctrl.createMode) { + PageMetadataService.setPageTitle( + 'analysis-package-management.edit.create-page-title', { + analysisPackageId: ctrl.analysisPackage.id + }); + } else { + PageMetadataService.setPageTitle( + 'analysis-package-management.edit.edit-page-title', { + analysisPackageId: ctrl.analysisPackage.id + }); + } + BreadcrumbService.updateToolbarHeader({ + 'stateName': $state.current.name, + 'id': ctrl.analysisPackage.id, + 'analysisPackageId': ctrl.analysisPackage.id, + 'analysisPackageIsPresent': !ctrl.createMode, + 'projectId': ctrl.analysisPackage.dataAcquisitionProjectId, + 'enableLastItem': true + }); + }; + + var redirectToSearchView = function() { + $timeout(function() { + $state.go('search', { + lang: LanguageService.getCurrentInstantly(), + type: 'analysis_packages' + }); + }, 1000); + }; + + var handleReleasedProject = function() { + SimpleMessageToastService.openAlertMessageToast( + 'analysis-package-management.edit.choose-unreleased-project-toast'); + redirectToSearchView(); + }; + + var initEditMode = function(analysisPackage) { + ctrl.createMode = false; + DataAcquisitionProjectResource.get({ + id: analysisPackage.dataAcquisitionProjectId + }).$promise.then(function(project) { + if (project.release != null) { + handleReleasedProject(); + } else if (!ProjectUpdateAccessService + .isUpdateAllowed(project, 'analysisPackages', true)) { + redirectToSearchView(); + } else { + CurrentProjectService.setCurrentProject(project); + ctrl.analysisPackage = analysisPackage; + ctrl.currentSponsors = angular.copy( + ctrl.analysisPackage.sponsors); + ctrl.currentInstitutions = angular.copy( + ctrl.analysisPackage.institutions); + ctrl.loadAttachments(); + updateToolbarHeaderAndPageTitle(); + $scope.registerConfirmOnDirtyHook(); + } + }); + }; + + var init = function() { + if (Principal + .hasAnyAuthority(['ROLE_PUBLISHER', 'ROLE_DATA_PROVIDER'])) { + if (entity) { + entity.$promise.then(function(analysisPackage) { + initEditMode(analysisPackage); + }); + } else { + if (CurrentProjectService.getCurrentProject() && + !CurrentProjectService.getCurrentProject().release) { + if (!ProjectUpdateAccessService + .isUpdateAllowed(CurrentProjectService.getCurrentProject(), + 'analysisPackages', true)) { + redirectToSearchView(); + } else { + AnalysisPackageResource.get({ + id: AnalysisPackageIdBuilderService.buildAnalysisPackageId( + CurrentProjectService.getCurrentProject().id) + }).$promise.then(function(analysisPackage) { + initEditMode(analysisPackage); + }).catch(function() { + ctrl.createMode = true; + ctrl.analysisPackage = new AnalysisPackageResource({ + id: AnalysisPackageIdBuilderService.buildAnalysisPackageId( + CurrentProjectService.getCurrentProject().id), + dataAcquisitionProjectId: CurrentProjectService + .getCurrentProject() + .id, + authors: [{ + firstName: '', + lastName: '' + }], + dataCurators: [{ + firstName: '', + lastName: '' + }], + institutions: [], + sponsors: [], + scripts: [], + analysisDataPackages: [] + }); + updateToolbarHeaderAndPageTitle(); + $scope.registerConfirmOnDirtyHook(); + }); + } + } else { + handleReleasedProject(); + } + } + } else { + SimpleMessageToastService.openAlertMessageToast( + 'data-package-management.edit.not-authorized-toast'); + } + }; + + ctrl.surveyDesigns = [{ + de: 'Panel', + en: 'Panel' + }, { + de: 'Querschnitt', + en: 'Cross-Section' + }]; + + ctrl.deleteInstitution = function(index) { + ctrl.analysisPackage.institutions.splice(index, 1); + ctrl.currentInstitutions.splice(index, 1); + if (ctrl.analysisPackage.institutions.length === 0) { + ctrl.currentInstitutions = []; + $scope.analysisPackageForm.$setUntouched(); + } + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.addInstitution = function() { + if (!ctrl.analysisPackage.institutions) { + ctrl.analysisPackage.institutions = []; + } + if (!ctrl.currentInstitutions) { + ctrl.currentInstitutions = []; + } + ctrl.currentInstitutions.push(null); + // console.table(ctrl.currentInstitutions); + $timeout(function() { + $document.find('input[name="institutionDe_' + + (ctrl.analysisPackage.institutions.length - 1) + '"]') + .focus(); + }, 200); + }; + + ctrl.setCurrentInstitution = function(index, event) { + ctrl.currentInstitutionInputName = event.target.name; + ctrl.currentInstitutionIndex = index; + }; + + var timeoutActive = null; + + ctrl.deleteCurrentInstitution = function(event) { + if (timeoutActive) { + $timeout.cancel(timeoutActive); + } + timeoutActive = $timeout(function() { + timeoutActive = false; + if (document.activeElement && + (document.activeElement.tagName === 'BODY' || + $(document.activeElement).parents('#move-institution-container') + .length)) { + return; + } + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-institution-up-button' || + event.relatedTarget.id === 'move-institution-down-button')) { + return; + } + delete ctrl.currentInstitutionIndex; + timeoutActive = null; + }); + }; + + ctrl.moveCurrentInstitutionUp = function() { + var a = ctrl.analysisPackage + .institutions[ctrl.currentInstitutionIndex - 1]; + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex - 1] = + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex]; + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex] = a; + a = ctrl.currentInstitutions[ctrl.currentInstitutionIndex - 1]; + ctrl.currentInstitutions[ctrl.currentInstitutionIndex - 1] = + ctrl.currentInstitutions[ctrl.currentInstitutionIndex]; + ctrl.currentInstitutions[ctrl.currentInstitutionIndex] = a; + ctrl.currentInstitutionInputName = ctrl.currentInstitutionInputName + .replace('_' + ctrl.currentInstitutionIndex, + '_' + (ctrl.currentInstitutionIndex - 1)); + $document.find('input[name="' + ctrl.currentInstitutionInputName + '"]') + .focus(); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.moveCurrentInstitutionDown = function() { + var a = ctrl.analysisPackage + .institutions[ctrl.currentInstitutionIndex + 1]; + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex + 1] = + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex]; + ctrl.analysisPackage.institutions[ctrl.currentInstitutionIndex] = a; + a = ctrl.currentInstitutions[ctrl.currentInstitutionIndex + 1]; + ctrl.currentInstitutions[ctrl.currentInstitutionIndex + 1] = + ctrl.currentInstitutions[ctrl.currentInstitutionIndex]; + ctrl.currentInstitutions[ctrl.currentInstitutionIndex] = a; + ctrl.currentInstitutionInputName = ctrl.currentInstitutionInputName + .replace('_' + ctrl.currentInstitutionIndex, + '_' + (ctrl.currentInstitutionIndex + 1)); + $document.find('input[name="' + ctrl.currentInstitutionInputName + '"]') + .focus(); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.deleteSponsor = function(index) { + ctrl.analysisPackage.sponsors.splice(index, 1); + ctrl.currentSponsors.splice(index, 1); + if (ctrl.analysisPackage.sponsors.length === 0) { + ctrl.currentSponsors = []; + $scope.analysisPackageForm.$setUntouched(); + } + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.addSponsor = function() { + if (!ctrl.analysisPackage.sponsors) { + ctrl.analysisPackage.sponsors = []; + } + if (!ctrl.currentSponsors) { + ctrl.currentSponsors = []; + } + ctrl.currentSponsors.push(null); + $timeout(function() { + $document.find('input[name="sponsorDe_' + + (ctrl.analysisPackage.sponsors.length - 1) + '"]') + .focus(); + }, 200); + }; + + ctrl.setCurrentSponsor = function(index, event) { + ctrl.currentSponsorInputName = event.target.name; + ctrl.currentSponsorIndex = index; + }; + + ctrl.deleteCurrentSponsor = function(event) { + if (timeoutActive) { + $timeout.cancel(timeoutActive); + } + timeoutActive = $timeout(function() { + timeoutActive = false; + if (document.activeElement && + (document.activeElement.tagName === 'BODY' || + $(document.activeElement).parents('#move-sponsor-container') + .length)) { + return; + } + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-sponsor-up-button' || + event.relatedTarget.id === 'move-sponsor-down-button')) { + return; + } + delete ctrl.currentSponsorIndex; + timeoutActive = null; + }); + }; + + ctrl.moveCurrentSponsorUp = function() { + var a = ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex - 1]; + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex - 1] = + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex]; + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex] = a; + a = ctrl.currentSponsors[ctrl.currentSponsorIndex - 1]; + ctrl.currentSponsors[ctrl.currentSponsorIndex - 1] = + ctrl.currentSponsors[ctrl.currentSponsorIndex]; + ctrl.currentSponsors[ctrl.currentSponsorIndex] = a; + ctrl.currentSponsorInputName = ctrl.currentSponsorInputName + .replace('_' + ctrl.currentSponsorIndex, + '_' + (ctrl.currentSponsorIndex - 1)); + $document.find('input[name="' + ctrl.currentSponsorInputName + '"]') + .focus(); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.moveCurrentSponsorDown = function() { + var a = ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex + 1]; + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex + 1] = + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex]; + ctrl.analysisPackage.sponsors[ctrl.currentSponsorIndex] = a; + a = ctrl.currentSponsors[ctrl.currentSponsorIndex + 1]; + ctrl.currentSponsors[ctrl.currentSponsorIndex + 1] = + ctrl.currentSponsors[ctrl.currentSponsorIndex]; + ctrl.currentSponsors[ctrl.currentSponsorIndex] = a; + ctrl.currentSponsorInputName = ctrl.currentSponsorInputName + .replace('_' + ctrl.currentSponsorIndex, + '_' + (ctrl.currentSponsorIndex + 1)); + $document.find('input[name="' + ctrl.currentSponsorInputName + '"]') + .focus(); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.deleteLink = function(index) { + ctrl.analysisPackage.additionalLinks.splice(index, 1); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.addLink = function() { + if (!ctrl.analysisPackage.additionalLinks) { + ctrl.analysisPackage.additionalLinks = []; + } + ctrl.analysisPackage.additionalLinks.push({ + url: '', + displayText: { + de: '', + en: '' + } + }); + $timeout(function() { + $document.find('input[name="linkUrl_' + + (ctrl.analysisPackage.additionalLinks.length - 1) + '"]') + .focus(); + }, 200); + }; + + ctrl.setCurrentLink = function(index, event) { + ctrl.currentLinkInputName = event.target.name; + ctrl.currentLinkIndex = index; + }; + + ctrl.deleteCurrentLink = function(event) { + if (document.activeElement && + $(document.activeElement).parents('#move-link-container') + .length) { + return; + } + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-link-up-button' || + event.relatedTarget.id === 'move-link-down-button')) { + return; + } + delete ctrl.currentLinkIndex; + }; + + ctrl.moveCurrentLinkUp = function() { + var a = ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex - 1]; + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex - 1] = + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex]; + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex] = a; + ctrl.currentLinkInputName = ctrl.currentLinkInputName + .replace('_' + ctrl.currentLinkIndex, + '_' + (ctrl.currentLinkIndex - 1)); + $document.find('input[name="' + ctrl.currentLinkInputName + '"]') + .focus(); + $scope.analysisPackage.$setDirty(); + }; + + ctrl.moveCurrentLinkDown = function() { + var a = ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex + 1]; + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex + 1] = + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex]; + ctrl.analysisPackage.additionalLinks[ctrl.currentLinkIndex] = a; + ctrl.currentLinkInputName = ctrl.currentLinkInputName + .replace('_' + ctrl.currentLinkIndex, + '_' + (ctrl.currentLinkIndex + 1)); + $document.find('input[name="' + ctrl.currentLinkInputName + '"]') + .focus(); + $scope.analysisPackageForm.$setDirty(); + }; + + ctrl.saveAnalysisPackage = function() { + if ($scope.analysisPackageForm.$valid) { + if (angular.isUndefined(ctrl.analysisPackage.masterId)) { + ctrl.analysisPackage.masterId = ctrl.analysisPackage.id; + } + ctrl.analysisPackage.$save() + .then(ctrl.updateElasticSearchIndex) + .then(ctrl.onSavedSuccessfully) + .catch(function() { + SimpleMessageToastService.openAlertMessageToast( + 'analysis-package-management.edit.error-on-save-toast', { + analysisPackageId: ctrl.analysisPackage.id + }); + }); + } else { + // ensure that all validation errors are visible + angular.forEach($scope.analysisPackageForm.$error, function(field) { + angular.forEach(field, function(errorField) { + if (errorField.$setTouched) { + errorField.$setTouched(); + } else if (errorField.$setDirty) { + errorField.$setDirty(); + } + }); + }); + SimpleMessageToastService.openAlertMessageToast( + 'analysis-package-management.edit.' + + 'analysis-package-has-validation-errors-toast', + null); + } + }; + + ctrl.updateElasticSearchIndex = function() { + return ElasticSearchAdminService + .processUpdateQueue('analysis_packages'); + }; + + ctrl.onSavedSuccessfully = function() { + $scope.analysisPackageForm.$setPristine(); + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.edit.success-on-save-toast', { + analysisPackageId: ctrl.analysisPackage.id + }); + if (ctrl.createMode) { + $state.go('analysisPackageEdit', { + id: ctrl.analysisPackage.id + }); + } + }; + + ctrl.openRestorePreviousVersionDialog = function(event) { + var getVersions = function(id, limit, skip) { + return AnalysisPackageVersionsResource.get({ + id: id, + limit: limit, + skip: skip + }).$promise; + }; + + var dialogConfig = { + domainId: ctrl.analysisPackage.id, + getPreviousVersionsCallback: getVersions, + labels: { + title: { + key: 'analysis-package-management.edit.' + + 'choose-previous-version.title', + params: { + analysisPackageId: ctrl.analysisPackage.id + } + }, + text: { + key: 'analysis-package-management.edit.' + + 'choose-previous-version.text' + }, + cancelTooltip: { + key: 'analysis-package-management.edit.choose-previous-version.' + + 'cancel-tooltip' + }, + noVersionsFound: { + key: 'analysis-package-management.edit.choose-previous-version.' + + 'no-versions-found', + params: { + analysisPackageId: ctrl.analysisPackage.id + } + }, + deleted: { + key: 'analysis-package-management.edit.' + + 'choose-previous-version.analysis-package-deleted' + } + } + }; + + ChoosePreviousVersionService.showDialog(dialogConfig, event) + .then(function(wrapper) { + ctrl.analysisPackage = new AnalysisPackageResource(wrapper + .selection); + if (!ctrl.analysisPackage.authors) { + ctrl.analysisPackage.authors = [{ + firstName: '', + lastName: '' + }]; + } + if (!ctrl.analysisPackage.analysisCurators) { + ctrl.analysisPackage.analysisCurators = [{ + firstName: '', + lastName: '' + }]; + } + if (ctrl.analysisPackage.institutions && + ctrl.analysisPackage.institutions.length > 0) { + ctrl.currentInstitutions = angular.copy( + ctrl.analysisPackage.institutions); + } else { + ctrl.currentInstitutions = []; + } + if (ctrl.analysisPackage.sponsors && + ctrl.analysisPackage.sponsors.length > 0) { + ctrl.currentSponsors = angular.copy( + ctrl.analysisPackage.sponsors); + } else { + ctrl.currentSponsors = []; + } + + $timeout(function() { + $scope.$broadcast('LoadScriptEvent'); + }, 1000); + + if (wrapper.isCurrentVersion) { + $scope.analysisPackageForm.$setPristine(); + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.edit.' + + 'current-version-restored-toast', { + analysisPackageId: ctrl.analysisPackage.id + }); + } else { + $scope.analysisPackageForm.$setDirty(); + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.edit.' + + 'previous-version-restored-toast', { + analysisPackageId: ctrl.analysisPackage.id + }); + } + }); + }; + + $scope.registerConfirmOnDirtyHook = function() { + var unregisterTransitionHook = $transitions.onBefore({}, function() { + if ($scope.analysisPackageForm.$dirty || + ctrl.attachmentOrderIsDirty) { + return CommonDialogsService.showConfirmOnDirtyDialog(); + } + }); + + $scope.$on('$destroy', unregisterTransitionHook); + }; + + $scope.searchSponsors = function(searchText, language) { + //Search Call to Elasticsearch + return AnalysisPackageSearchService.findSponsors(searchText, {}, + language, true, ctrl.currentSponsors) + .then(function(sponsors) { + return sponsors; + }); + }; + + $scope.searchInstitutions = function(searchText, language) { + //Search Call to Elasticsearch + return AnalysisPackageSearchService.findInstitutions( + searchText, {}, language, true, + ctrl.currentInstitutions) + .then(function(institutions) { + return institutions; + }); + }; + + ctrl.loadAttachments = function(selectLastAttachment) { + AnalysisPackageAttachmentResource.findByAnalysisPackageId({ + analysisPackageId: ctrl.analysisPackage.id + }).$promise.then( + function(attachments) { + if (attachments.length > 0) { + ctrl.attachments = attachments; + if (selectLastAttachment) { + ctrl.currentAttachmentIndex = attachments.length - 1; + } + } + }); + }; + + ctrl.deleteAttachment = function(attachment, index) { + CommonDialogsService.showConfirmFileDeletionDialog(attachment.fileName) + .then(function() { + attachment.$delete().then(function() { + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.detail.' + + 'attachments.attachment-deleted-toast', { + filename: attachment.fileName + } + ); + ctrl.attachments.splice(index, 1); + delete ctrl.currentAttachmentIndex; + }); + }); + }; + + ctrl.editAttachment = function(attachment, event) { + + var upload = function(file, newAttachmentMetadata) { + var metadata = _.extend(attachment, newAttachmentMetadata); + return AnalysisPackageAttachmentUploadService.uploadAttachment(file, + metadata); + }; + + var labels = getDialogLabels(); + labels.editTitle.params.filename = attachment.fileName; + + var getAttachmentVersions = function(id, filename, limit, skip) { + return AnalysisPackageAttachmentVersionsResource.get({ + analysisPackageId: id, + filename: filename, + limit: limit, + skip: skip + }).$promise; + }; + + var createAnalysisPackageAttachmentResource = + function(attachmentWrapper) { + return new AnalysisPackageAttachmentResource( + attachmentWrapper.dataPackageAttachment); + }; + + var dialogConfig = { + attachmentMetadata: attachment, + uploadCallback: upload, + attachmentDomainIdAttribute: 'analysisPackageId', + getAttachmentVersionsCallback: getAttachmentVersions, + createAttachmentResource: createAnalysisPackageAttachmentResource, + analysisPackageTitle: ctrl.analysisPackage.title, + labels: labels + }; + + AttachmentDialogService.showDialog(dialogConfig, event) + .then(ctrl.loadAttachments); + }; + + ctrl.getNextIndexInAnalysisPackage = function() { + if (!ctrl.attachments || ctrl.attachments.length === 0) { + return 0; + } + return _.maxBy(ctrl.attachments, function(attachment) { + return attachment.indexInAnalysisPackage; + }).indexInAnalysisPackage + 1; + }; + + ctrl.addAttachment = function(event) { + var upload = function(file, attachmentMetadata) { + var metadata = _.extend({}, attachmentMetadata, { + analysisPackageId: ctrl.analysisPackage.id, + dataAcquisitionProjectId: + ctrl.analysisPackage.dataAcquisitionProjectId, + indexInAnalysisPackage: ctrl.getNextIndexInAnalysisPackage() + }); + return AnalysisPackageAttachmentUploadService.uploadAttachment( + file, metadata); + }; + + var dialogConfig = { + attachmentMetadata: null, + // attachmentTypes: attachmentTypes, + uploadCallback: upload, + analysisPackageTitle: ctrl.analysisPackage.title, + labels: getDialogLabels() + }; + + AttachmentDialogService + .showDialog(dialogConfig, event) + .then(function() { + ctrl.loadAttachments(true); + }); + }; + + ctrl.moveAttachmentUp = function() { + var a = ctrl.attachments[ctrl.currentAttachmentIndex - 1]; + ctrl.attachments[ctrl.currentAttachmentIndex - 1] = + ctrl.attachments[ctrl.currentAttachmentIndex]; + ctrl.attachments[ctrl.currentAttachmentIndex] = a; + ctrl.currentAttachmentIndex--; + ctrl.attachmentOrderIsDirty = true; + }; + + ctrl.moveAttachmentDown = function() { + var a = ctrl.attachments[ctrl.currentAttachmentIndex + 1]; + ctrl.attachments[ctrl.currentAttachmentIndex + 1] = + ctrl.attachments[ctrl.currentAttachmentIndex]; + ctrl.attachments[ctrl.currentAttachmentIndex] = a; + ctrl.currentAttachmentIndex++; + ctrl.attachmentOrderIsDirty = true; + }; + + ctrl.saveAttachmentOrder = function() { + var promises = []; + ctrl.attachments.forEach(function(attachment, index) { + attachment.indexInAnalysisPackage = index; + promises.push(attachment.$save()); + }); + $q.all(promises).then(function() { + SimpleMessageToastService.openSimpleMessageToast( + 'analysis-package-management.detail.attachments.' + + 'attachment-order-saved-toast', + {}); + ctrl.attachmentOrderIsDirty = false; + }); + }; + + ctrl.selectAttachment = function(index) { + if (Principal + .hasAnyAuthority(['ROLE_PUBLISHER', + 'ROLE_DATA_PROVIDER'])) { + ctrl.currentAttachmentIndex = index; + } + }; + + init(); + }); diff --git a/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.html.tmpl b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.html.tmpl new file mode 100644 index 0000000000..10c4363b34 --- /dev/null +++ b/src/main/webapp/scripts/analysispackagemanagement/views/analysis-package-edit-or-create.html.tmpl @@ -0,0 +1,565 @@ +
+
+
+
+

+ {{'analysis-package-management.edit.label.create-analysis-package' | translate}} + {{ctrl.analysisPackage.id}} +

+

+ {{'analysis-package-management.edit.label.edit-analysis-package' | translate}} + {{ctrl.analysisPackage.id}} +

+
+ + + +

{{'global.cards.details' | translate }}

+
+
+ + + +
+ + + +
+ {{'analysis-package-management.edit.hints.annotations.de' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.annotations.i18n-string-size' | translate}} +
+
+
+ + + +
+ {{'analysis-package-management.edit.hints.annotations.en' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.annotations.i18n-string-size' | translate}} +
+
+
+
+
+
+ + + + + + +

+ {{'analysis-package-management.detail.label.institutions' | translate + }}

+
+
+ + +
+
+ + + {{'analysis-package-management.edit.delete-institution-tooltip' | translate}} + + delete_forever + +
+ + + {{item.de}} + + + {{'search-management.filter.institution-filter.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.institution.de' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.institution.i18n-string-entire-not-empty' | translate}} +
+
+ {{'analysis-package-management.error.analysis-package.institution.i18n-string-size' | translate}} +
+
+
+ + + {{item.en}} + + + {{'search-management.filter.institution-filter.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.institution.en' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.institution.i18n-string-entire-not-empty' | translate}} +
+
+ {{'analysis-package-management.error.analysis-package.institution.i18n-string-size' | translate}} +
+
+
+
+
+ + + + {{'analysis-package-management.edit.add-institution-tooltip' | translate}} + + add + + + + {{'analysis-package-management.edit.move-institution-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-institution-down-tooltip' | translate}} + + keyboard_arrow_down + + +
+ + + +

+ {{'analysis-package-management.detail.label.sponsors' | translate}}

+
+
+ + +
+
+ + + {{'analysis-package-management.edit.delete-sponsor-tooltip' | translate}} + + delete_forever + +
+ + + {{item.de}} + + + {{'search-management.filter.sponsor-filter.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.sponsor.de' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.sponsor.i18n-string-entire-not-empty' | translate}} +
+
+ {{'analysis-package-management.error.analysis-package.sponsor.i18n-string-size' | translate}} +
+
+
+ + + {{item.en}} + + + {{'search-management.filter.sponsor-filter.not-found' | translate}} + +
+ {{'analysis-package-management.edit.hints.sponsor.en' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.sponsor.i18n-string-entire-not-empty' | translate}} +
+
+ {{'analysis-package-management.error.analysis-package.sponsor.i18n-string-size' | translate}} +
+
+
+
+
+ + + + {{'analysis-package-management.edit.add-sponsor-tooltip' | translate}} + + add + + + + {{'analysis-package-management.edit.move-sponsor-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-sponsor-down-tooltip' | translate}} + + keyboard_arrow_down + + +
+ + + + + + +

+ {{'analysis-package-management.edit.label.tags' | translate}}

+
+
+ + + + +
+ + +
+
+
+ + + +

+ {{'analysis-package-management.detail.attachments.table-title' | translate}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ {{'analysis-package-management.detail.label.attachments.description' | translate}} + + {{'analysis-package-management.detail.label.attachments.description' | translate}} + + + {{'analysis-package-management.detail.label.attachments.title' | translate}} + + {{'analysis-package-management.detail.label.attachments.title' | translate}} + + + {{'analysis-package-management.detail.label.attachments.language' | translate}} + + {{'analysis-package-management.detail.label.attachments.language' | translate}} + + + {{'analysis-package-management.detail.label.attachments.file' | translate}} + + {{'analysis-package-management.detail.label.attachments.file' | translate}} + +
+ + + + {{'analysis-package-management.detail.attachments.select-attachment-tooltip' | translate:translationParams}} + + + + + + + {{'analysis-package-management.detail.attachments.edit-attachment-tooltip' | translate:translationParams}} + + mode_edit + + + + + {{'analysis-package-management.detail.attachments.delete-attachment-tooltip' | translate:translationParams}} + + delete_forever + + {{row.title}} {{row.language | displayIsoLanguage: currentLanguage}} {{row.fileName}} + + {{'global.tooltips.files.download' | translate: {filename: row.fileName} + }} + +   +
+ + + {{'analysis-package-management.detail.attachments.save-analysis-package-before-adding-attachment' | translate}} + + + + + {{'analysis-package-management.detail.attachments.add-attachment-tooltip' | translate}} + + add + + + + {{'analysis-package-management.detail.attachments.move-attachment-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.detail.attachments.move-attachment-down-tooltip' | translate}} + + keyboard_arrow_down + + + + {{'analysis-package-management.detail.attachments.save-attachment-order-tooltip' | translate}} + + save + + +
+
+
+
+ + + {{'analysis-package-management.edit.open-choose-previous-version-tooltip' | translate}} + + history + + + + {{'analysis-package-management.edit.save-tooltip' | translate}} + + save + +
diff --git a/src/main/webapp/scripts/app.constants.js b/src/main/webapp/scripts/app.constants.js index bc8600e55b..fc70e44c1d 100644 --- a/src/main/webapp/scripts/app.constants.js +++ b/src/main/webapp/scripts/app.constants.js @@ -6,7 +6,7 @@ angular.module('metadatamanagementApp') .constant('ENV', 'local') -.constant('VERSION', '1.0.116-SNAPSHOT') +.constant('VERSION', '1.0.117') .constant('ElasticSearchProperties', {apiVersion:'7.x',logLevel:'error',pageSize:10}) diff --git a/src/main/webapp/scripts/app.js b/src/main/webapp/scripts/app.js index 805ef6e002..098d8daad9 100644 --- a/src/main/webapp/scripts/app.js +++ b/src/main/webapp/scripts/app.js @@ -13,7 +13,7 @@ try { 'ngFileUpload', 'ngMaterial', 'blockUI', 'LocalStorageModule', 'jkAngularCarousel', 'angularMoment', 'ngAnimate', 'vcRecaptcha', - 'ngMessages', 'ngFileSaver', 'ngShortcut', + 'ngMessages', 'ngFileSaver', 'ngShortcut', 'angular-uuid', 'jsonFormatter', 'fdzPaginatorModule', 'ngTextTruncate', 'ng-showdown', 'swxSessionStorage', 'angulartics', 'angulartics.piwik' ]) @@ -251,6 +251,7 @@ try { blockUIConfig.requestFilter = function(config) { // If the request contains '/api/search' ... if (config.url.indexOf('_search') !== -1 || + config.url.indexOf('_msearch') !== -1 || (config.url.indexOf('/api/data-acquisition-projects/') !== -1 && config.method === 'GET' && config.url.indexOf('/shadows') === -1 && diff --git a/src/main/webapp/scripts/common/breadcrumbs/breadcrumb.service.js b/src/main/webapp/scripts/common/breadcrumbs/breadcrumb.service.js index efb6dc5d63..24afe64db9 100644 --- a/src/main/webapp/scripts/common/breadcrumbs/breadcrumb.service.js +++ b/src/main/webapp/scripts/common/breadcrumbs/breadcrumb.service.js @@ -94,6 +94,24 @@ angular.module('metadatamanagementApp').factory('BreadcrumbService', 'iconType': 'svg', 'icon': 'assets/images/icons/data-package.svg' }, + 'analysisPackageCreate': { + 'type': 'analysis-package-management.detail.label.analysisPackage', + 'translateString': 'global.tooltips.toolbarHeader.analysis-package', + 'iconType': 'svg', + 'icon': 'assets/images/icons/data-package.svg' + }, + 'analysisPackageEdit': { + 'type': 'analysis-package-management.detail.label.analysisPackage', + 'translateString': 'global.tooltips.toolbarHeader.analysis-package', + 'iconType': 'svg', + 'icon': 'assets/images/icons/data-package.svg' + }, + 'analysisPackageDetail': { + 'type': 'analysis-package-management.detail.label.analysisPackage', + 'translateString': 'global.tooltips.toolbarHeader.analysis-package', + 'iconType': 'svg', + 'icon': 'assets/images/icons/data-package.svg' + }, 'surveyDetail': { 'type': 'survey-management.detail.label.survey', 'types': 'survey-management.detail.label.surveys', @@ -212,6 +230,39 @@ angular.module('metadatamanagementApp').factory('BreadcrumbService', } return dataPackageItem; }; + var createRelatedAnalysisPackageItem = function(item) { + var analysisPackageItem = { + 'type': translationStringsMap.analysisPackageDetail.type, + 'iconType': translationStringsMap.analysisPackageDetail.iconType, + 'icon': translationStringsMap.analysisPackageDetail.icon + }; + if (item.analysisPackageIsPresent) { + var stateParams = { + id: stripVersionSuffixAndDollar(item.analysisPackageId) + }; + if (item.version) { + stateParams.version = item.version; + } + analysisPackageItem.state = 'analysisPackageDetail(' + + JSON.stringify(stateParams) + ')'; + if (isAuthenticated()) { + analysisPackageItem.tooltip = translationStringsMap + .analysisPackageDetail.translateString; + } else { + analysisPackageItem.tooltip = translationStringsMap + .analysisPackageDetail.translateString; + analysisPackageItem.type = translationStringsMap + .analysisPackageDetail.type; + } + analysisPackageItem.projectId = stripVersionSuffixAndDollar( + item.projectId + ); + analysisPackageItem.enableLastItem = item.enableLastItem; + } else { + analysisPackageItem.notFound = '?'; + } + return analysisPackageItem; + }; var createRelatedInstrumentItem = function(item, type) { var instrumentItem = { 'type': translationStringsMap.instrumentDetail.type, @@ -351,6 +402,7 @@ angular.module('metadatamanagementApp').factory('BreadcrumbService', var publicationItem = {}; var surveyItem = {}; var dataPackageItem = createRelatedDataPackageItem(item); + var analysisPackageItem = createRelatedAnalysisPackageItem(item); switch (item.stateName) { case 'dataPackageDetail': $rootScope.toolbarHeaderItems.push(searchItem.get(), dataPackageItem); @@ -361,6 +413,18 @@ angular.module('metadatamanagementApp').factory('BreadcrumbService', case 'dataPackageCreate': $rootScope.toolbarHeaderItems.push(searchItem.get(), dataPackageItem); break; + case 'analysisPackageDetail': + $rootScope.toolbarHeaderItems + .push(searchItem.get(), analysisPackageItem); + break; + case 'analysisPackageEdit': + $rootScope.toolbarHeaderItems + .push(searchItem.get(), analysisPackageItem); + break; + case 'analysisPackageCreate': + $rootScope.toolbarHeaderItems + .push(searchItem.get(), analysisPackageItem); + break; case 'questionDetail': questionItem = { 'state': 'questionDetail', diff --git a/src/main/webapp/scripts/common/datasource/data-source.component.js b/src/main/webapp/scripts/common/datasource/data-source.component.js new file mode 100644 index 0000000000..cdaa4d4e9c --- /dev/null +++ b/src/main/webapp/scripts/common/datasource/data-source.component.js @@ -0,0 +1,23 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'dataSourceController', + bindings: { + index: '<', + name: '@', + currentForm: '<', + translationKeyPackage: '@', + translationKeyName: '@', + maxLength: '<', + content: '=' + }, + templateUrl: ['$attrs', function($attrs) { + return $attrs.templateUrl; + }] + }; + + angular + .module('metadatamanagementApp') + .component('datasourceComponent', Component); +})(); diff --git a/src/main/webapp/scripts/common/datasource/data-source.controller.js b/src/main/webapp/scripts/common/datasource/data-source.controller.js new file mode 100644 index 0000000000..edc913f080 --- /dev/null +++ b/src/main/webapp/scripts/common/datasource/data-source.controller.js @@ -0,0 +1,92 @@ +/* global $, document */ + +(function() { + 'use strict'; + + function Controller( + $timeout, + $document, + LanguageService + ) { + var $ctrl = this; + + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + + $ctrl.$onInit = function() { + $ctrl.content = $ctrl.content || []; + }; + + $ctrl.deleteLink = function(index) { + $ctrl.content.splice(index, 1); + $ctrl.currentForm.$setDirty(); + }; + + $ctrl.addLink = function() { + if (!$ctrl.content) { + $ctrl.content = []; + } + $ctrl.content.push({ + url: '', + name: { + de: '', + en: '' + } + }); + $timeout(function() { + $document.find('input[name="' + $ctrl.name + 'DisplayTextDe' + + $ctrl.index + '_' + ($ctrl.content.length - 1) + '"]') + .focus(); + }, 200); + }; + + $ctrl.setCurrentLink = function(index, event) { + $ctrl.currentLinkInputName = event.target.name; + $ctrl.currentLinkIndex = index; + }; + + $ctrl.deleteCurrentLink = function(index, event) { + if (document.activeElement && + $(document.activeElement).parents('#dataSource-' + index) + .length) { + return; + } + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-link-up-button' || + event.relatedTarget.id === 'move-link-down-button')) { + return; + } + delete $ctrl.currentLinkIndex; + }; + + $ctrl.moveCurrentLinkUp = function() { + var a = $ctrl.content[$ctrl.currentLinkIndex - 1]; + $ctrl.content[$ctrl.currentLinkIndex - 1] = + $ctrl.content[$ctrl.currentLinkIndex]; + $ctrl.content[$ctrl.currentLinkIndex] = a; + $ctrl.currentLinkInputName = $ctrl.currentLinkInputName + .replace('_' + $ctrl.currentLinkIndex, + '_' + ($ctrl.currentLinkIndex - 1)); + $document.find('input[name="' + $ctrl.currentLinkInputName + '"]') + .focus(); + $ctrl.currentForm.$setDirty(); + }; + + $ctrl.moveCurrentLinkDown = function() { + var a = $ctrl.content[$ctrl.currentLinkIndex + 1]; + $ctrl.content[$ctrl.currentLinkIndex + 1] = + $ctrl.content[$ctrl.currentLinkIndex]; + $ctrl.content[$ctrl.currentLinkIndex] = a; + $ctrl.currentLinkInputName = $ctrl.currentLinkInputName + .replace('_' + $ctrl.currentLinkIndex, + '_' + ($ctrl.currentLinkIndex + 1)); + $document.find('input[name="' + $ctrl.currentLinkInputName + '"]') + .focus(); + $ctrl.currentForm.$setDirty(); + }; + + } + + angular + .module('metadatamanagementApp') + .controller('dataSourceController', Controller); +})(); diff --git a/src/main/webapp/scripts/common/datasource/datasource.html.tmpl b/src/main/webapp/scripts/common/datasource/datasource.html.tmpl new file mode 100644 index 0000000000..a6acf353b4 --- /dev/null +++ b/src/main/webapp/scripts/common/datasource/datasource.html.tmpl @@ -0,0 +1,133 @@ + + + +

{{ 'analysis-package-management.detail.label.custom-data-package.dataSources' | translate }}

+
+
+ + +
+
+ + + {{'analysis-package-management.edit.delete-data-source-tooltip' | translate}} + + delete_forever + +
+ + + +
+ {{ 'analysis-package-management.edit.hints.custom-data-package.data-source.de' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
+
+ {{'analysis-package-management.error.custom-data-package.data-source.i18n-not-null' | translate}} +
+
+
+ + + +
+ {{ 'analysis-package-management.edit.hints.custom-data-package.data-source.en' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
+
+ {{'analysis-package-management.error.custom-data-package.data-source.i18n-not-null' | translate}} +
+
+
+ + + +
+ {{ 'analysis-package-management.edit.hints.additional-links.url' | translate}} +
+
+
+ {{'analysis-package-management.error.analysis-package.additional-links.url-size' | translate}} +
+
+ {{'analysis-package-management.error.analysis-package.additional-links.invalid-url' | translate}} +
+
+
+
+
+ + + + + {{'analysis-package-management.edit.add-data-source-tooltip' | translate}} + + add + + + + {{'analysis-package-management.edit.move-data-source-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-data-source-down-tooltip' | translate}} + + keyboard_arrow_down + + +
diff --git a/src/main/webapp/scripts/common/details/related-objects.controller.js b/src/main/webapp/scripts/common/details/related-objects.controller.js index f0a09fd550..fc3db20bc1 100644 --- a/src/main/webapp/scripts/common/details/related-objects.controller.js +++ b/src/main/webapp/scripts/common/details/related-objects.controller.js @@ -40,6 +40,18 @@ group: 'dataPackages', sortOptions: ['relevance', 'alphabetically', 'survey-period', 'first-release-date', 'last-release-date'] + }, { + title: 'search-management.tabs.analysis_packages', + inputLabel: 'search-management.input-label.analysis-packages', + elasticSearchType: 'analysis_packages', + count: null, + uploadFunction: null, + disabled: false, + visibleForPublicUser: true, + noResultsText: 'search-management.no-results-text.analysis-packages', + group: 'analysisPackages', + sortOptions: ['relevance', 'alphabetically', 'first-release-date', + 'last-release-date'] }, { title: 'search-management.tabs.surveys', inputLabel: 'search-management.input-label.surveys', @@ -153,6 +165,7 @@ function getCurrentObjectFilter() { var objMapper = { 'data-packages': 'data-package', + 'analysis-packages': 'analysis-package', 'studies': 'data-package', 'surveys': 'survey', 'instruments': 'instrument', @@ -211,7 +224,8 @@ delete locationSearch['sort-by']; } _.assign(locationSearch, _.omit($ctrl.searchParams.filter, - 'data-package', 'survey', 'concept', 'data-set', 'instrument', + 'data-package', 'analysis-package', 'survey', + 'concept', 'data-set', 'instrument', 'question', 'related-publication', 'variable')); locationChanged = !angular.equals($location.search(), locationSearch); diff --git a/src/main/webapp/scripts/common/details/related-objects.html.tmpl b/src/main/webapp/scripts/common/details/related-objects.html.tmpl index ab5d3d272b..e4bd75a870 100644 --- a/src/main/webapp/scripts/common/details/related-objects.html.tmpl +++ b/src/main/webapp/scripts/common/details/related-objects.html.tmpl @@ -76,6 +76,14 @@ bowser="bowser" set-params="$ctrl.setCurrentSearchParams()" search-result-index="$ctrl.computeSearchResultIndex($index)"> + - -
+ +
- - - {{ $ctrl.translationKeys.tooltips.delete | translate}} - - delete_forever - - + + + {{ $ctrl.translationKeys.tooltips.delete | translate}} + + delete_forever + +
+
-
-
- +
+
@@ -91,7 +92,7 @@
- + diff --git a/src/main/webapp/scripts/common/sidenav/sidenav.controller.js b/src/main/webapp/scripts/common/sidenav/sidenav.controller.js index ce732d71fc..c4d3a9de4a 100644 --- a/src/main/webapp/scripts/common/sidenav/sidenav.controller.js +++ b/src/main/webapp/scripts/common/sidenav/sidenav.controller.js @@ -3,7 +3,7 @@ angular.module('metadatamanagementApp').controller('SidenavController', function($scope, $rootScope, Principal, $mdSidenav, $document, $timeout, - LanguageService, Auth, $state, + LanguageService, Auth, $state, MessageBus, WelcomeDialogService) { $scope.isAuthenticated = Principal.isAuthenticated; @@ -13,6 +13,8 @@ angular.module('metadatamanagementApp').controller('SidenavController', $scope.isAccountMenuOpen = false; $scope.logoutButtonDisabled = false; $scope.sidebarContent = $rootScope.sidebarContent; + $scope.detailViewLoaded = MessageBus; + $scope.detailViewType = ''; $scope.show = false; $scope.$on('domain-object-editing-started', function() { @@ -23,11 +25,11 @@ angular.module('metadatamanagementApp').controller('SidenavController', $scope.logoutButtonDisabled = false; }); - $rootScope.$on('onDataPackageLoaded', - function(event, args) { // jshint ignore:line - $scope.dataPackage = args.dataPackage; - $scope.accessWays = args.accessWays; - }); + // $rootScope.$on('onDataPackageLoaded', + // function(event, args) { // jshint ignore:line + // $scope.dataPackage = args.dataPackage; + // $scope.accessWays = args.accessWays; + // }); //Functions for toggling buttons. $scope.toggleAccountMenu = function() { @@ -104,4 +106,14 @@ angular.module('metadatamanagementApp').controller('SidenavController', $scope.close(); } }); + + $scope.$watch(function() { + return $scope.detailViewLoaded; + }, + function() { + var data = $scope.detailViewLoaded.get('onDetailViewLoaded', true); + if (data) { + $scope.detailViewType = data.type; + } + }, true); }); diff --git a/src/main/webapp/scripts/common/sidenav/sidenav.html.tmpl b/src/main/webapp/scripts/common/sidenav/sidenav.html.tmpl index d3385d7052..a4eaa45850 100644 --- a/src/main/webapp/scripts/common/sidenav/sidenav.html.tmpl +++ b/src/main/webapp/scripts/common/sidenav/sidenav.html.tmpl @@ -11,8 +11,10 @@ ng-if="sidebarContent.filter" options="dataPackageFilter" template-url="scripts/searchmanagement/components/searchfilter.html.tmpl"> + + ng-if="sidebarContent.configurator && detailViewType === 'dataPackage'">
  • diff --git a/src/main/webapp/scripts/common/text/text-bilingual.html.tmpl b/src/main/webapp/scripts/common/text/text-bilingual.html.tmpl new file mode 100644 index 0000000000..7809f109a2 --- /dev/null +++ b/src/main/webapp/scripts/common/text/text-bilingual.html.tmpl @@ -0,0 +1,70 @@ + + + +
    + {{$ctrl.translationKeyManagement + '.edit.hints.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.de' | translate}} +
    +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | translate}} +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | translate}} +
    +
    +
    + + + +
    + {{$ctrl.translationKeyManagement + '.edit.hints.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.en' | translate}} +
    +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | translate}} +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/common/text/text-single-line-bilingual.html.tmpl b/src/main/webapp/scripts/common/text/text-single-line-bilingual.html.tmpl new file mode 100644 index 0000000000..675e82d8d7 --- /dev/null +++ b/src/main/webapp/scripts/common/text/text-single-line-bilingual.html.tmpl @@ -0,0 +1,68 @@ + + + +
    + {{$ctrl.translationKeyManagement + '.edit.hints.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.de' | translate}} +
    +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | translate}} +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | translate}} +
    +
    +
    + + + +
    + {{$ctrl.translationKeyManagement + '.edit.hints.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.en' | translate}} +
    +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | translate}} +
    +
    + {{$ctrl.translationKeyManagement + '.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/common/text/text.component.js b/src/main/webapp/scripts/common/text/text.component.js new file mode 100644 index 0000000000..34e86bd3aa --- /dev/null +++ b/src/main/webapp/scripts/common/text/text.component.js @@ -0,0 +1,35 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'textController', + bindings: { + index: '<', + name: '@', + bilingual: '<', + singleLine: '<', + notNull: '<', + currentForm: '<', + translationKeyManagement: '@', + translationKeyPackage: '@', + translationKeyName: '@', + maxLength: '<', + content: '=' + }, + templateUrl: ['$attrs' ,function($attrs) { + var tmpl = { + false: 'scripts/common/text/text.html.tmpl', + true: 'scripts/common/text/text-bilingual.html.tmpl' + }; + if ($attrs.singleLine) { + return 'scripts/common/text/text-single-line-bilingual.html.tmpl'; + } else { + return tmpl[$attrs.bilingual]; + } + }] + }; + + angular + .module('metadatamanagementApp') + .component('textComponent', Component); +})(); diff --git a/src/main/webapp/scripts/common/text/text.controller.js b/src/main/webapp/scripts/common/text/text.controller.js new file mode 100644 index 0000000000..dd512aa6f3 --- /dev/null +++ b/src/main/webapp/scripts/common/text/text.controller.js @@ -0,0 +1,25 @@ +(function() { + 'use strict'; + + function Controller() { + var $ctrl = this; + $ctrl.controlName = ''; + + $ctrl.upperCase = function(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + }; + + $ctrl.$onInit = function() { + if ($ctrl.name) { + $ctrl.controlName = $ctrl.name + $ctrl + .upperCase($ctrl.translationKeyName); + } else { + $ctrl.controlName = $ctrl.translationKeyName; + } + }; + } + + angular + .module('metadatamanagementApp') + .controller('textController', Controller); +})(); diff --git a/src/main/webapp/scripts/common/text/text.html.tmpl b/src/main/webapp/scripts/common/text/text.html.tmpl new file mode 100644 index 0000000000..ae48d20409 --- /dev/null +++ b/src/main/webapp/scripts/common/text/text.html.tmpl @@ -0,0 +1,36 @@ + + + +
    + {{$ctrl.translationKeyPackage + '-management.edit.hints.' + $ctrl.name + '.' + $ctrl.translationKeyName | translate}} +
    +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.name + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | + translate}} +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.name + '.' + $ctrl.translationKeyName + '.i18n-string-size' | + translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/common/textsection/edit-text-section.bilingual.html.tmpl b/src/main/webapp/scripts/common/textsection/edit-text-section.bilingual.html.tmpl new file mode 100644 index 0000000000..7533206890 --- /dev/null +++ b/src/main/webapp/scripts/common/textsection/edit-text-section.bilingual.html.tmpl @@ -0,0 +1,91 @@ + + + +

    + {{ $ctrl.translationKeyPackage + '-management.detail.label.' + $ctrl.translationKeyName | translate}} +

    +
    +
    + + +
    + + + +
    + {{$ctrl.translationKeyPackage + '-management.edit.hints.' + $ctrl.translationKeyName + '.de' | translate}} +
    +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | + translate}} +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | + translate}} +
    +
    +
    + + + +
    + {{$ctrl.translationKeyPackage + '-management.edit.hints.' + $ctrl.translationKeyName + '.en' | translate}} +
    +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-not-empty' | + translate}} +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.i18n-string-size' | + translate}} +
    +
    +
    +
    + + +
    +
    diff --git a/src/main/webapp/scripts/common/textsection/edit-text-section.component.js b/src/main/webapp/scripts/common/textsection/edit-text-section.component.js new file mode 100644 index 0000000000..4595b87b56 --- /dev/null +++ b/src/main/webapp/scripts/common/textsection/edit-text-section.component.js @@ -0,0 +1,49 @@ +// editTestSection Component +// +// Component bindings: +// bilingual boolean Switch between monolingual and bilingual +// template +// notNull boolean Adds fdzRequired and error +// validation +// currentForm form +// translationKeyPackage string eg. analysis-package +// translationKeyName string eg. license +// maxLength integer +// content model eg. ctrl.analysisPackage.example = '' +// or for bilingual: +// ctrl.analysisPackage.example = { +// de: '', +// en: '' +// } +// +// content must be declared in the parent +// controller + +(function() { + 'use strict'; + + var Component = { + controller: 'editTextSectionController', + bindings: { + bilingual: '<', + notNull: '<', + currentForm: '<', + translationKeyPackage: '@', + translationKeyName: '@', + maxLength: '<', + content: '=' + }, + templateUrl: ['$attrs' ,function($attrs) { + var tmpl = { + false: 'scripts/common/textsection/edit-text-section.html.tmpl', + true: 'scripts/common/textsection/edit-text-section' + + '.bilingual.html.tmpl' + }; + return tmpl[$attrs.bilingual]; + }] + }; + + angular + .module('metadatamanagementApp') + .component('editTextSectionComponent', Component); +})(); diff --git a/src/main/webapp/scripts/common/textsection/edit-text-section.controller.js b/src/main/webapp/scripts/common/textsection/edit-text-section.controller.js new file mode 100644 index 0000000000..d2704890f6 --- /dev/null +++ b/src/main/webapp/scripts/common/textsection/edit-text-section.controller.js @@ -0,0 +1,9 @@ +(function() { + 'use strict'; + + function Controller() {} + + angular + .module('metadatamanagementApp') + .controller('editTextSectionController', Controller); +})(); diff --git a/src/main/webapp/scripts/common/textsection/edit-text-section.html.tmpl b/src/main/webapp/scripts/common/textsection/edit-text-section.html.tmpl new file mode 100644 index 0000000000..ca3820f6bb --- /dev/null +++ b/src/main/webapp/scripts/common/textsection/edit-text-section.html.tmpl @@ -0,0 +1,51 @@ + + + +

    + {{ $ctrl.translationKeyPackage + '-management.detail.label.' + $ctrl.translationKeyName | translate}} +

    +
    +
    + + +
    + + + +
    + {{$ctrl.translationKeyPackage + '-management.edit.hints.' + $ctrl.translationKeyName | translate}} +
    +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.string-size' | + translate}} +
    +
    + {{$ctrl.translationKeyPackage + '-management.error.' + $ctrl.translationKeyPackage + '.' + $ctrl.translationKeyName + '.string-not-empty' | + translate}} +
    +
    +
    +
    +
    diff --git a/src/main/webapp/scripts/common/title/title-with-index.html.tmpl b/src/main/webapp/scripts/common/title/title-with-index.html.tmpl new file mode 100644 index 0000000000..67b19d3de3 --- /dev/null +++ b/src/main/webapp/scripts/common/title/title-with-index.html.tmpl @@ -0,0 +1,52 @@ + + + +
    + {{'analysis-package-management.edit.hints.' + $ctrl.translationKeyPackage +'.title.de' | translate}} +
    +
    +
    + {{'analysis-package-management.error.' + $ctrl.translationKeyPackage +'.title.i18n-string-entire-not-empty' | + translate}} +
    +
    + {{'analysis-package-management.error.' + $ctrl.translationKeyPackage + '.title.i18n-string-size' | translate}} +
    +
    +
    + + + +
    + {{'analysis-package-management.edit.hints.' + $ctrl.translationKeyPackage +'.title.en' | translate}} +
    +
    +
    + {{'analysis-package-management.error.' + $ctrl.translationKeyPackage +'.title.i18n-string-entire-not-empty' | + translate}} +
    +
    + {{'analysis-package-management.error.' + $ctrl.translationKeyPackage +'.title.i18n-string-size' | translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/common/title/title.component.js b/src/main/webapp/scripts/common/title/title.component.js new file mode 100644 index 0000000000..ca716748ba --- /dev/null +++ b/src/main/webapp/scripts/common/title/title.component.js @@ -0,0 +1,50 @@ +// title Component +// +// Component bindings: +// index boolean Used for naming and switch between templates +// template +// name string Used for naming the form controls: +// currentForm form +// translationKeyPackage string eg. analysis-package +// translationKeyName string eg. license +// maxLength integer +// content model eg. ctrl.analysisPackage.example = '' +// or for bilingual: +// ctrl.analysisPackage.example = { +// de: '', +// en: '' +// } +// +// content must be declared in the parent +// controller + +(function() { + 'use strict'; + + var Component = { + controller: 'titleController', + bindings: { + index: '<', + name: '@', + currentForm: '<', + translationKeyPackage: '@', + translationKeyName: '@', + maxLength: '<', + content: '=' + }, + templateUrl: ['$attrs', function($attrs) { + var tmpl = { + false: 'scripts/common/title/title.html.tmpl', + true: 'scripts/common/title/title-with-index.html.tmpl' + }; + if ($attrs.index) { + return tmpl.true; + } + return tmpl.false; + }] + }; + + angular + .module('metadatamanagementApp') + .component('titleComponent', Component); +})(); diff --git a/src/main/webapp/scripts/common/title/title.controller.js b/src/main/webapp/scripts/common/title/title.controller.js new file mode 100644 index 0000000000..dcd2d50412 --- /dev/null +++ b/src/main/webapp/scripts/common/title/title.controller.js @@ -0,0 +1,9 @@ +(function() { + 'use strict'; + + function Controller() {} + + angular + .module('metadatamanagementApp') + .controller('titleController', Controller); +})(); diff --git a/src/main/webapp/scripts/common/title/title.html.tmpl b/src/main/webapp/scripts/common/title/title.html.tmpl new file mode 100644 index 0000000000..ac2d3e248f --- /dev/null +++ b/src/main/webapp/scripts/common/title/title.html.tmpl @@ -0,0 +1,37 @@ + + + +
    + {{'analysis-package-management.edit.hints.title.de' | translate}} +
    +
    +
    {{'analysis-package-management.error.analysis-package.title.i18n-string-entire-not-empty' | + translate}} +
    +
    {{'analysis-package-management.error.analysis-package.title.i18n-string-size' | translate}} +
    +
    +
    + + + +
    + {{'analysis-package-management.edit.hints.title.en' | translate}} +
    +
    +
    {{'analysis-package-management.error.analysis-package.title.i18n-string-entire-not-empty' | + translate}} +
    +
    {{'analysis-package-management.error.analysis-package.title.i18n-string-size' | translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/common/url/additional-links.html.tmpl b/src/main/webapp/scripts/common/url/additional-links.html.tmpl new file mode 100644 index 0000000000..eaa6ed1187 --- /dev/null +++ b/src/main/webapp/scripts/common/url/additional-links.html.tmpl @@ -0,0 +1,124 @@ + + + +

    + {{'analysis-package-management.detail.label.additional-links' | translate + }}

    +
    +
    + + +
    +
    + + + {{'analysis-package-management.edit.delete-link-tooltip' | translate}} + + delete_forever + +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.url' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-not-empty' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-size' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.invalid-url' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.de' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.en' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    +
    +
    + + + + {{'analysis-package-management.edit.add-link-tooltip' | translate}} + + add + + + + {{'analysis-package-management.edit.move-link-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-link-down-tooltip' | translate}} + + keyboard_arrow_down + + +
    diff --git a/src/main/webapp/scripts/common/url/url-with-index.html.tmpl b/src/main/webapp/scripts/common/url/url-with-index.html.tmpl new file mode 100644 index 0000000000..2d266d6030 --- /dev/null +++ b/src/main/webapp/scripts/common/url/url-with-index.html.tmpl @@ -0,0 +1,128 @@ + + + +

    {{ 'analysis-package-management.detail.label.custom-data-package.dataSources' | translate }}

    +
    +
    + + +
    + + + {{'analysis-package-management.edit.delete-link-tooltip' | translate}} + + delete_forever + + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.url' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-not-empty' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-size' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.invalid-url' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.de' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.en' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    +
    +
    + + + + + {{'analysis-package-management.edit.add-url-tooltip' | translate}} + + add + + + + {{'analysis-package-management.edit.move-url-up-tooltip' | translate}} + + keyboard_arrow_up + + + + {{'analysis-package-management.edit.move-url-down-tooltip' | translate}} + + keyboard_arrow_down + + +
    diff --git a/src/main/webapp/scripts/common/url/url.component.js b/src/main/webapp/scripts/common/url/url.component.js new file mode 100644 index 0000000000..e681b1063b --- /dev/null +++ b/src/main/webapp/scripts/common/url/url.component.js @@ -0,0 +1,23 @@ +(function() { + 'use strict'; + + var Component = { + controller: 'urlController', + bindings: { + index: '<', + name: '@', + currentForm: '<', + translationKeyPackage: '@', + translationKeyName: '@', + maxLength: '<', + content: '=' + }, + templateUrl: ['$attrs', function($attrs) { + return $attrs.templateUrl; + }] + }; + + angular + .module('metadatamanagementApp') + .component('urlComponent', Component); +})(); diff --git a/src/main/webapp/scripts/common/url/url.controller.js b/src/main/webapp/scripts/common/url/url.controller.js new file mode 100644 index 0000000000..07ea0ed30f --- /dev/null +++ b/src/main/webapp/scripts/common/url/url.controller.js @@ -0,0 +1,96 @@ +/* global $, document */ + +(function() { + 'use strict'; + + function Controller( + $timeout, + $document, + LanguageService + ) { + var $ctrl = this; + + $ctrl.currentLanguage = LanguageService.getCurrentInstantly(); + + $ctrl.$onInit = function() { + $ctrl.content = $ctrl.content || []; + }; + + $ctrl.deleteLink = function(index) { + $ctrl.content.splice(index, 1); + $ctrl.currentForm.$setDirty(); + }; + + $ctrl.addLink = function() { + if (!$ctrl.content) { + $ctrl.content = []; + } + $ctrl.content.push({ + url: '', + displayText: { + de: '', + en: '' + } + }); + $timeout(function() { + $document.find('input[name="' + $ctrl.name + 'Url' + $ctrl.index + '_' + + ($ctrl.content.length - 1) + '"]') + .focus(); + }, 200); + }; + + $ctrl.setCurrentLink = function(index, event) { + $ctrl.currentLinkInputName = event.target.name; + $ctrl.currentLinkIndex = index; + }; + + $ctrl.deleteCurrentLink = function(index, event) { + var name = '-'; + if ($ctrl.name) { + name = $ctrl.name + '-'; + } + if (document.activeElement && + $(document.activeElement).parents('#url' + name + index) + .length) { + return; + } + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-link-up-button' || + event.relatedTarget.id === 'move-link-down-button')) { + return; + } + delete $ctrl.currentLinkIndex; + }; + + $ctrl.moveCurrentLinkUp = function() { + var a = $ctrl.content[$ctrl.currentLinkIndex - 1]; + $ctrl.content[$ctrl.currentLinkIndex - 1] = + $ctrl.content[$ctrl.currentLinkIndex]; + $ctrl.content[$ctrl.currentLinkIndex] = a; + $ctrl.currentLinkInputName = $ctrl.currentLinkInputName + .replace('_' + $ctrl.currentLinkIndex, + '_' + ($ctrl.currentLinkIndex - 1)); + $document.find('input[name="' + $ctrl.currentLinkInputName + '"]') + .focus(); + $ctrl.currentForm.$setDirty(); + }; + + $ctrl.moveCurrentLinkDown = function() { + var a = $ctrl.content[$ctrl.currentLinkIndex + 1]; + $ctrl.content[$ctrl.currentLinkIndex + 1] = + $ctrl.content[$ctrl.currentLinkIndex]; + $ctrl.content[$ctrl.currentLinkIndex] = a; + $ctrl.currentLinkInputName = $ctrl.currentLinkInputName + .replace('_' + $ctrl.currentLinkIndex, + '_' + ($ctrl.currentLinkIndex + 1)); + $document.find('input[name="' + $ctrl.currentLinkInputName + '"]') + .focus(); + $ctrl.currentForm.$setDirty(); + }; + + } + + angular + .module('metadatamanagementApp') + .controller('urlController', Controller); +})(); diff --git a/src/main/webapp/scripts/common/url/url.html.tmpl b/src/main/webapp/scripts/common/url/url.html.tmpl new file mode 100644 index 0000000000..85bf948b82 --- /dev/null +++ b/src/main/webapp/scripts/common/url/url.html.tmpl @@ -0,0 +1,64 @@ + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.url' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-not-empty' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.url-size' | translate}} +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.invalid-url' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.de' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    + + + +
    + {{ 'analysis-package-management.edit.hints.additional-links.display-text.en' | translate}} +
    +
    +
    + {{'analysis-package-management.error.analysis-package.additional-links.display-text-size' | translate}} +
    +
    +
    diff --git a/src/main/webapp/scripts/conceptmanagement/resources/conceptAttachment.resource.js b/src/main/webapp/scripts/conceptmanagement/resources/conceptAttachment.resource.js index 66f5f59ec4..03361a098f 100644 --- a/src/main/webapp/scripts/conceptmanagement/resources/conceptAttachment.resource.js +++ b/src/main/webapp/scripts/conceptmanagement/resources/conceptAttachment.resource.js @@ -13,12 +13,35 @@ angular.module('metadatamanagementApp') }, 'save': { method: 'PUT', + params: { + conceptId: '@conceptId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + }, transformRequest: function(attachment) { var copy = angular.copy(attachment); CleanJSObjectService.deleteEmptyStrings(copy); CleanJSObjectService.removeEmptyJsonObjects(copy); return angular.toJson(copy); } + }, + 'delete': { + method: 'DELETE', + params: { + conceptId: '@conceptId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + } } }); }); diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-de.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-de.js index 569d815650..dec9483a30 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-de.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-de.js @@ -81,7 +81,9 @@ angular.module('metadatamanagementApp').config( 'unauthorized': 'Publisher dürfen nur durch andere Publisher gesetzt werden.' }, 'requirements': { - 'unauthorized': 'Pflichtfelder dürfen nur durch Publishers dieses Projekts geändert werden.' + 'unauthorized': 'Pflichtfelder dürfen nur durch Publishers dieses Projekts geändert werden.', + 'publications-required-for-analysis-packages': 'Eine Publikation wird für ein Analysepaket benötigt.', + 'either-data-packages-or-analysis-packages-required': 'Es wird entweder ein Datenpaket oder Analysepaket benötigt.' } }, 'release': { @@ -94,6 +96,8 @@ angular.module('metadatamanagementApp').config( }, 'post-validation': { 'project-has-no-dataPackage': 'Das Projekt mit der FDZ-ID {{ id }} enthält kein Datenpaket.', + 'project-has-no-analysisPackage': 'Das Projekt mit der FDZ-ID {{ id }} enthält kein Analysepaket.', + 'project-must-have-exactly-one-publication': 'Das Projekt mit der FDZ-ID {{ id }} muss genau eine Publikation enthalten.', 'requirements-not-met': 'Es gibt noch Metadaten die nicht von den Publishern als "fertig" markiert wurden.', 'project-has-no-survey': 'Das Projekt mit der FDZ-ID {{ id }} muss mindestens eine Erhebung enthalten.', 'project-has-no-data-set': 'Das Projekt mit der FDZ-ID {{ id }} muss mindestens einen Datensatz enthalten.' @@ -169,7 +173,8 @@ angular.module('metadatamanagementApp').config( 'variables': 'Variablen', 'publications': 'Publikationen', 'concepts': 'Konzepte', - 'setting-info': 'Die folgenden Metadaten müssen bereitgestellt werden, bevor dieses Projekt für alle Benutzer:innen freigegeben werden kann:' + 'setting-info': 'Die folgenden Metadaten müssen bereitgestellt werden, bevor dieses Projekt für alle Benutzer:innen freigegeben werden kann:', + 'analysisPackages': 'Analysepaket' }, 'config': { 'assigned-group': 'Zugewiesene Benutzer:innengruppe', @@ -221,6 +226,7 @@ angular.module('metadatamanagementApp').config( 'release-version': 'Aktuelle Version', 'assigned-group': 'Zugewiesene Gruppe', 'data-package-status': 'Datenpaket', + 'analysis-package-status': 'Analyse Paket', 'surveys-status': 'Erhebungen', 'instruments-status': 'Instrumente', 'data-sets-status': 'Datensätze', diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-en.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-en.js index 1e54bb9c3f..f216f2b129 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-en.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/configuration/translations-en.js @@ -81,7 +81,9 @@ angular.module('metadatamanagementApp').config( 'unauthorized': 'Publisher can only be assigned by other publishers.' }, 'requirements': { - 'unauthorized': 'Only publishers of this project are allowed to change mandatory fields.' + 'unauthorized': 'Only publishers of this project are allowed to change mandatory fields.', + 'publications-required-for-analysis-packages': 'Publication is needed for an analysis package.', + 'either-data-packages-or-analysis-packages-required': 'Either a data package or analysis package is required.' } }, 'release': { @@ -94,6 +96,8 @@ angular.module('metadatamanagementApp').config( }, 'post-validation': { 'project-has-no-dataPackage': 'The Project with the RDC-ID {{ id }} has no data package.', + 'project-has-no-analysisPackage': 'The Project with the RDC-ID {{ id }} has no analysis package.', + 'project-must-have-exactly-one-publication': 'The Project with the RDC-ID {{ id }} must contain exactly one publication.', 'requirements-not-met': 'There are still metadata that have not been marked as "ready" by the publishers.', 'project-has-no-survey': 'The Project with the RDC-ID {{ id }} must contain at least one survey.', 'project-has-no-data-set': 'The Project with the RDC-ID {{ id }} must contain at least one data set.' @@ -170,7 +174,8 @@ angular.module('metadatamanagementApp').config( 'variables': 'Variables', 'publications': 'Publications', 'concepts': 'Concepts', - 'setting-info': 'The following Metadata must be provided, before this project can be released to all public users:' + 'setting-info': 'The following Metadata must be provided, before this project can be released to all public users:', + 'analysisPackages': 'Analysis Package' }, 'config': { 'assigned-group': 'Assigned User Group', @@ -222,6 +227,7 @@ angular.module('metadatamanagementApp').config( 'release-version': 'Current Version', 'assigned-group': 'Assigned Group', 'data-package-status': 'Data Package', + 'analysis-package-status': 'Analysis Package', 'surveys-status': 'Surveys', 'instruments-status': 'Instruments', 'data-sets-status': 'Data Sets', diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.directive.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.directive.js index 43ef148716..b251b9e931 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.directive.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.directive.js @@ -6,7 +6,7 @@ angular.module('metadatamanagementApp') .directive('metadataTypeStateCard', function($state, ProjectStatusScoringService, ProjectUpdateAccessService, VariableUploadService, QuestionUploadService, DeleteMetadataService, - SimpleMessageToastService) { + SimpleMessageToastService, AnalysisPackageIdBuilderService) { return { restrict: 'E', templateUrl: 'scripts/dataacquisitionprojectmanagement/directives/' + @@ -28,6 +28,8 @@ angular.module('metadatamanagementApp') this.project = $scope.project; this.dataPackageId = DataPackageIdBuilderService .buildDataPackageId(this.project.id); + this.analysisPackageId = AnalysisPackageIdBuilderService + .buildAnalysisPackageId(this.project.id); this.isAssignedDataProvider = ProjectUpdateAccessService.isAssignedToProject.bind(null, @@ -46,6 +48,17 @@ angular.module('metadatamanagementApp') 'delete-all-data-packages-tooltip'; this.limit = 1; break; + case 'analysisPackages': + this.createState = 'analysisPackageCreate'; + this.searchState = 'analysis_packages'; + this.tooltip = 'search-management.buttons.' + + 'create-analysis-package-tooltip'; + this.editTooltip = 'search-management.buttons.' + + 'edit-analysis-package-tooltip'; + this.deleteTooltip = 'search-management.buttons.' + + 'delete-all-analysis-packages-tooltip'; + this.limit = 1; + break; case 'surveys': this.createState = 'surveyCreate'; this.searchState = this.type; diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.html.tmpl b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.html.tmpl index 89c3e22e19..064913c272 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.html.tmpl +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/metadata-type-state-card.html.tmpl @@ -38,7 +38,7 @@ {{'data-acquisition-project-management.project-cockpit.config.delete' | translate}} {{ctrl.deleteTooltip | translate}} - + {{'data-acquisition-project-management.project-cockpit.config.edit' | translate}} {{ctrl.editTooltip | translate}} @@ -50,12 +50,18 @@ {{'data-acquisition-project-management.project-cockpit.config.upload' | translate}} {{ctrl.getTooltip(ctrl.type) | translate}} - + {{'related-publication-management.report-publications.button.text' | translate}} {{'related-publication-management.report-publications.button.tooltip' | translate }} + + {{'related-publication-management.report-publications.button.text' | translate}} + + {{'related-publication-management.report-publications.button.analysis-package.tooltip' | translate }} + +
diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.directive.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.directive.js index f247fe9e61..2649cc8fe1 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.directive.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.directive.js @@ -18,6 +18,7 @@ angular.module('metadatamanagementApp') }, /* jshint -W098 */ link: function($scope, elem, attrs, ctrl) { + var req = ctrl.project.configuration.requirements; var isNotAssignedPublisher = function() { var loginName = Principal.loginName(); @@ -36,6 +37,24 @@ angular.module('metadatamanagementApp') ctrl.isUserPublisher = function() { return Principal.hasAuthority('ROLE_PUBLISHER'); }; + + ctrl.isAnalysisPackageChecked = function() { + req.analysisPackagesRequired = true; + req.dataPackagesRequired = false; + req.surveysRequired = false; + req.instrumentsRequired = false; + req.questionsRequired = false; + req.dataSetsRequired = false; + req.variablesRequired = false; + req.publicationsRequired = true; + req.conceptsRequired = false; + }; + + ctrl.isDataPackageChecked = function() { + req.analysisPackagesRequired = false; + req.dataPackagesRequired = true; + req.publicationsRequired = false; + }; } }; }); diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.html.tmpl b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.html.tmpl index 4cb0a82161..78fad58998 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.html.tmpl +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-config.html.tmpl @@ -22,65 +22,74 @@

{{'data-acquisition-project-management.project-cockpit.requirements.setting-info' | translate}}

-
- + + - - + + {{'data-acquisition-project-management.project-cockpit.requirements.dataPackages' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.surveys' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.instruments' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.questions' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.dataSets' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.variables' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.publications' | translate}} - - + + {{'data-acquisition-project-management.project-cockpit.requirements.concepts' | translate}} + + + + + {{'data-acquisition-project-management.project-cockpit.requirements.analysisPackages' | translate}} + + + + diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.directive.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.directive.js index 1f4a3e5bd9..56df06fe0f 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.directive.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.directive.js @@ -134,7 +134,8 @@ angular.module('metadatamanagementApp') SearchDao.search('', 1, projectId, {}, undefined, 0, undefined) .then(function(data) { ['variables', 'questions', 'data_sets', 'surveys', 'instruments', - 'data_packages', 'related_publications', 'concepts'].forEach( + 'data_packages', 'analysis_packages', 'related_publications', + 'concepts'].forEach( function(type) { var bucket = _.find(data.aggregations.countByType.buckets, {key: type}); diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.html.tmpl b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.html.tmpl index 1d13a6ae24..30bf624a6d 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.html.tmpl +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/directives/project-cockpit-status.html.tmpl @@ -35,7 +35,8 @@
- + +
diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/services/projectUpdateAccessService.js b/src/main/webapp/scripts/dataacquisitionprojectmanagement/services/projectUpdateAccessService.js index feea8a85f1..4026820ddf 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/services/projectUpdateAccessService.js +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/services/projectUpdateAccessService.js @@ -35,6 +35,7 @@ angular.module('metadatamanagementApp').service( if (type) { type = type === 'data_sets' ? 'dataSets' : type; type = type === 'data_packages' ? 'dataPackages' : type; + type = type === 'analysis_packages' ? 'analysisPackages' : type; return _.get(project, 'configuration.requirements.' + type + 'Required'); } else { @@ -46,6 +47,8 @@ angular.module('metadatamanagementApp').service( switch (type) { case 'data_packages': return 'dataPackagesState'; + case 'analysis_packages': + return 'analysisPackagesState'; case 'surveys': return 'surveysState'; case 'instruments': @@ -119,9 +122,11 @@ angular.module('metadatamanagementApp').service( return $2 + '_' + $3.toLowerCase();}); } - if (!_.includes(['data_packages', 'surveys', 'instruments', - 'data_sets', 'questions', 'variables', 'publications', 'concepts', - undefined, null], type)) { + if (!_.includes(['data_packages', 'analysis_packages', + 'surveys', 'instruments', + 'data_sets', 'questions', + 'variables', 'publications', + 'concepts', undefined, null], type)) { return false; } @@ -131,7 +136,6 @@ angular.module('metadatamanagementApp').service( var test = project || CurrentProjectService.getCurrentProject(); var isValid = true; - var projectSelected = isProjectSelected.bind(null, test); projectSelected.canContinue = false; projectSelected.errorKey = errorList.projectSelected; @@ -185,7 +189,6 @@ angular.module('metadatamanagementApp').service( break; } } - if (notify) { var notification = []; validations.forEach(function(validation) { diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/project-overview.html.tmpl b/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/project-overview.html.tmpl index c11d8a1d24..ae1b9080dc 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/project-overview.html.tmpl +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/project-overview.html.tmpl @@ -18,6 +18,9 @@ {{'data-acquisition-project-management.project-overview.table.data-package-status' | translate}}  + + {{'data-acquisition-project-management.project-overview.table.analysis-package-status' | translate}}  + {{'data-acquisition-project-management.project-overview.table.surveys-status' | translate}}  @@ -63,6 +66,9 @@ + + + diff --git a/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/release-project-dialog.html.tmpl b/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/release-project-dialog.html.tmpl index 92cc9b7b4d..6b6396e766 100644 --- a/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/release-project-dialog.html.tmpl +++ b/src/main/webapp/scripts/dataacquisitionprojectmanagement/views/release-project-dialog.html.tmpl @@ -42,7 +42,7 @@
- + {{'data-acquisition-project-management.release.pin-to-start-page' | translate }} diff --git a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js index 5de1bd1ad5..6cbcc2f092 100644 --- a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js +++ b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js @@ -194,7 +194,7 @@ angular.module('metadatamanagementApp').config( 'not-null': 'Das Veröffentlichungsjahr darf nicht leer sein!', 'invalid-number': 'Das Jahr muss eine gültige Zahl sein!', 'min': 'Das früheste Jahr ist 1990!', - 'max': 'Das späteste Jahr ist nächstes Jahr!', + 'max': 'Das späteste Jahr ist nächstes Jahr!' }, 'location': { 'not-empty': 'Der Ort darf nicht leer sein!', @@ -229,7 +229,7 @@ angular.module('metadatamanagementApp').config( 'location': 'Ort', 'additional-links': { 'url': 'URL', - 'display-text': 'Anzeigetext', + 'display-text': 'Anzeigetext' } }, 'open-choose-previous-version-tooltip': 'Klicken, um eine ältere Version dieses Datenpakets wieder herzustellen.', @@ -347,7 +347,7 @@ angular.module('metadatamanagementApp').config( 'size': 'Die Version darf nicht länger als 32 Zeichen sein.' }, 'languages': { - 'not-empty': 'Sie müssen mindestens eine Sprache auswählen!', + 'not-empty': 'Sie müssen mindestens eine Sprache auswählen!' } }, 'hints': { diff --git a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js index d554dd29f7..0cbf47062a 100644 --- a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js +++ b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js @@ -172,7 +172,7 @@ angular.module('metadatamanagementApp').config( 'valid-survey-design': 'The allowed values for the survey design of the data package are: Cross-Section, Panel.' }, 'project-contributors': { - 'not-empty': 'The list of project contributors of a data package needs min. one element and must not be empty!', + 'not-empty': 'The list of project contributors of a data package needs min. one element and must not be empty!' }, 'annotations': { 'i18n-string-size': 'The max length of the annotations is 2048 signs.' @@ -194,7 +194,7 @@ angular.module('metadatamanagementApp').config( 'not-null': 'The year of publication must not be empty!', 'invalid-number': 'The year must be a valid number!', 'min': 'The earliest year is 1990!', - 'max': 'The latest year is next year!', + 'max': 'The latest year is next year!' }, 'location': { 'not-empty': 'The location must not be empty!', @@ -229,7 +229,7 @@ angular.module('metadatamanagementApp').config( 'location': 'Location', 'additional-links': { 'url': 'URL', - 'display-text': 'Display Text', + 'display-text': 'Display Text' } }, 'open-choose-previous-version-tooltip': 'Click for restoring a previous version of this data package.', diff --git a/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageAttachment.resource.js b/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageAttachment.resource.js index 719fae568f..c79806773d 100644 --- a/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageAttachment.resource.js +++ b/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageAttachment.resource.js @@ -2,10 +2,10 @@ /* Data Package Attachment Resource */ angular.module('metadatamanagementApp') -.factory('DataPackageAttachmentResource', function($resource, - CleanJSObjectService) { - return $resource( - '/api/data-packages/:dataPackageId/attachments/:fileName', { + .factory('DataPackageAttachmentResource', function($resource, + CleanJSObjectService) { + return $resource( + '/api/data-packages/:dataPackageId/attachments/:fileName', { dataPackageId: '@dataPackageId', fileName: '@fileName' }, { @@ -15,12 +15,35 @@ angular.module('metadatamanagementApp') }, 'save': { method: 'PUT', + params: { + analysisPackageId: '@dataPackageId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + }, transformRequest: function(attachment) { var copy = angular.copy(attachment); CleanJSObjectService.deleteEmptyStrings(copy); CleanJSObjectService.removeEmptyJsonObjects(copy); return angular.toJson(copy); } + }, + 'delete': { + method: 'DELETE', + params: { + analysisPackageId: '@analysisPackageId', + fileName: function(data) { + var value = ''; + if (data.fileName.charAt(0) === '.') { + value = '\\'; + } + return value + data.fileName; + } + } } }); - }); + }); diff --git a/src/main/webapp/scripts/datapackagemanagement/services/dataPackageSearch.service.js b/src/main/webapp/scripts/datapackagemanagement/services/dataPackageSearch.service.js index dec04b3976..2329b43c50 100644 --- a/src/main/webapp/scripts/datapackagemanagement/services/dataPackageSearch.service.js +++ b/src/main/webapp/scripts/datapackagemanagement/services/dataPackageSearch.service.js @@ -526,7 +526,8 @@ angular.module('metadatamanagementApp').factory('DataPackageSearchService', dataAcquisitionProjectId: dataAcquisitionProjectId, filterAttribute: filterAttribute, queryTerm: queryTerm, - prefix: type === 'data_packages' ? '' : 'dataPackage' + prefix: (type === 'data_packages' || type === 'analysis_packages') ? + '' : 'dataPackage' }; }; diff --git a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js index 0fec5b12b1..e1ce69766d 100644 --- a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js +++ b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js @@ -101,6 +101,7 @@ angular.module('metadatamanagementApp') masterId: result.masterId, version: result.release.version }); + MessageBus.set('onDetailViewLoaded', {type: 'dataPackage'}); } PageMetadataService.setPageTitle( diff --git a/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.controller.js b/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.controller.js index 94d3a222aa..66fab004a4 100644 --- a/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.controller.js +++ b/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.controller.js @@ -241,7 +241,6 @@ angular.module('metadatamanagementApp') }; var timeoutActive = null; - ctrl.deleteCurrentInstitution = function(event) { if (timeoutActive) { $timeout.cancel(timeoutActive); @@ -250,18 +249,19 @@ angular.module('metadatamanagementApp') timeoutActive = false; // msie workaround: inputs unfocus on button mousedown if (document.activeElement && + (document.activeElement.tagName === 'BODY' || $(document.activeElement).parents('#move-institution-container') - .length) { + .length)) { return; } if (event.relatedTarget && ( - event.relatedTarget.id === 'move-institution-up-button' || - event.relatedTarget.id === 'move-institution-down-button')) { + event.relatedTarget.id === 'move-institution-up-button' || + event.relatedTarget.id === 'move-institution-down-button')) { return; } delete ctrl.currentInstitutionIndex; timeoutActive = null; - }, 500); + }); }; ctrl.moveCurrentInstitutionUp = function() { @@ -326,18 +326,19 @@ angular.module('metadatamanagementApp') timeoutActive = false; // msie workaround: inputs unfocus on button mousedown if (document.activeElement && + (document.activeElement.tagName === 'BODY' || $(document.activeElement).parents('#move-sponsor-container') - .length) { + .length)) { return; } if (event.relatedTarget && ( - event.relatedTarget.id === 'move-sponsor-up-button' || - event.relatedTarget.id === 'move-sponsor-down-button')) { + event.relatedTarget.id === 'move-sponsor-up-button' || + event.relatedTarget.id === 'move-sponsor-down-button')) { return; } delete ctrl.currentSponsorIndex; timeoutActive = null; - }, 500); + }); }; ctrl.moveCurrentSponsorUp = function() { @@ -402,26 +403,18 @@ angular.module('metadatamanagementApp') ctrl.currentLinkIndex = index; }; - ctrl.deleteCurrentLink = function(event) { - if (timeoutActive) { - $timeout.cancel(timeoutActive); + ctrl.deleteCurrentLink = function(index, event) { + if (document.activeElement && + $(document.activeElement).parents('#link-' + index) + .length) { + return; } - timeoutActive = $timeout(function() { - timeoutActive = false; - // msie workaround: inputs unfocus on button mousedown - if (document.activeElement && - $(document.activeElement).parents('#move-link-container') - .length) { - return; - } - if (event.relatedTarget && ( - event.relatedTarget.id === 'move-link-up-button' || - event.relatedTarget.id === 'move-link-down-button')) { - return; - } - delete ctrl.currentLinkIndex; - timeoutActive = null; - }, 500); + if (event.relatedTarget && ( + event.relatedTarget.id === 'move-link-up-button' || + event.relatedTarget.id === 'move-link-down-button')) { + return; + } + delete ctrl.currentLinkIndex; }; ctrl.moveCurrentLinkUp = function() { diff --git a/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.html.tmpl b/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.html.tmpl index 1da099fa64..90cad07291 100644 --- a/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.html.tmpl +++ b/src/main/webapp/scripts/datapackagemanagement/views/data-package-edit-or-create.html.tmpl @@ -191,17 +191,19 @@ - +
- - - {{'data-package-management.edit.delete-institution-tooltip' | translate}} - - delete_forever - +
+ + + {{'data-package-management.edit.delete-institution-tooltip' | translate}} + + delete_forever + +
- + @@ -317,17 +319,19 @@ - +
- - - {{'data-package-management.edit.delete-sponsor-tooltip' | translate}} - - delete_forever - +
+ + + {{'data-package-management.edit.delete-sponsor-tooltip' | translate}} + + delete_forever + +
- + @@ -508,22 +512,23 @@ - -