diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index 017f84eb3..9583b2862 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -86,6 +86,7 @@ import javax.xml.bind.Unmarshaller; import java.io.*; import java.math.BigInteger; import java.nio.file.Files; +import java.time.Instant; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -1654,11 +1655,15 @@ public class DataManagementPlanManager { dataBuilder.append(" \"description\": \"").append((dmp.getDescription() != null && !dmp.getDescription().isEmpty() ? dmp.getDescription() : "

")).append("\",\n"); dataBuilder.append(" \"version\": \"").append(dmp.getVersion()).append("\",\n"); dataBuilder.append(" \"access_right\": \""); - if (dmp.isPublic()) { - dataBuilder.append("open\",\n"); - dataBuilder.append(" \"related_identifiers\": [{\n"); - dataBuilder.append(" \t\t\"identifier\": \"").append((this.environment.getProperty("dmp.domain") + "/external/zenodo/" + id.toString())).append("\",\n"); - dataBuilder.append(" \t\t\"relation\": \"isIdenticalTo\"}],\n"); + if (((Boolean)extraProperties.get("visible"))) { + Instant publicationDate = Instant.parse(extraProperties.get("publicDate").toString()); + if (publicationDate.isBefore(Instant.now())) { + dataBuilder.append("open\",\n"); + } else { + dataBuilder.append("embargoed\",\n"); + dataBuilder.append(" \"embargo_date\": \"" + publicationDate + "\",\n"); + } + if (extraProperties.get("license") != null) { dataBuilder.append(" \"license\": \"").append(((Map)extraProperties.get("license")).get("pid")).append("\",\n"); } @@ -1666,6 +1671,11 @@ public class DataManagementPlanManager { dataBuilder.append("restricted\",\n"); dataBuilder.append(" \"access_conditions\": \"\",\n"); } + if (dmp.isPublic()) { + dataBuilder.append(" \"related_identifiers\": [{\n"); + dataBuilder.append(" \t\t\"identifier\": \"").append((this.environment.getProperty("dmp.domain") + "/external/zenodo/" + id.toString())).append("\",\n"); + dataBuilder.append(" \t\t\"relation\": \"isIdenticalTo\"}],\n"); + } dataBuilder.append(" \"contributors\": ["); int i = 0; for(UserDMP userDMP: dmp.getUsers()) { diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts index ea0a76547..89d32c5ce 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts @@ -5,10 +5,14 @@ import { BackendErrorValidator } from '@common/forms/validation/custom-validator export class ExtraPropertiesFormModel { public language: string; public license: string; + public visible: boolean; + public publicDate: Date; fromModel(item: any): ExtraPropertiesFormModel { this.language = item.language; this.license = item.license; + this.visible = item.visible; + this.publicDate = item.publicDate; return this; } @@ -17,7 +21,9 @@ export class ExtraPropertiesFormModel { const formGroup = new FormBuilder().group({ language: [{ value: this.language, disabled: disabled }, context.getValidation('language').validators], - license: [{ value: this.license, disabled: disabled }, context.getValidation('license').validators] + license: [{ value: this.license, disabled: disabled }, context.getValidation('license').validators], + visible: [{ value: this.visible, disabled: disabled }, context.getValidation('visible').validators], + publicDate: [{ value: this.publicDate, disabled: disabled }, context.getValidation('publicDate').validators] }); return formGroup; } @@ -26,6 +32,8 @@ export class ExtraPropertiesFormModel { const baseContext: ValidationContext = new ValidationContext(); baseContext.validation.push({ key: 'language', validators: [] }); baseContext.validation.push({ key: 'license', validators: [] }); + baseContext.validation.push({ key: 'visible', validators: [] }); + baseContext.validation.push({ key: 'publicDate', validators: [] }); return baseContext; } diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html index bda087a2e..ce433d868 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html @@ -85,7 +85,7 @@ - + {{formGroup.get('extraProperties').get('language').getError('backendError').message}} @@ -94,6 +94,36 @@ +
+ + + + + {{vis.name | translate}} + + + + {{formGroup.get('extraProperties').get('visible').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +
+
+ + + + + + + {{formGroup.get('extraProperties').get('visible').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +
diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts index 0f699a41e..0dee0573f 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts @@ -27,6 +27,11 @@ import { LanguageInfoService } from '@app/core/services/culture/language-info-se import { LanguageInfo } from '@app/core/model/language-info'; import { LicenseCriteria } from '@app/core/query/license/license-criteria'; +interface Visible { + value: boolean; + name: string; +} + @Component({ selector: 'app-general-tab', templateUrl: './general-tab.component.html', @@ -77,6 +82,11 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { selectedDmpProfileDefinition: DmpProfileDefinition; + visibles: Visible[] = [ + { value: true, name: 'DMP-EDITOR.VISIBILITY.PUBLIC' }, + { value: false, name: 'DMP-EDITOR.VISIBILITY.RESTRICTED' } + ] + constructor( private dmpProfileService: DmpProfileService, private externalSourcesService: ExternalSourcesService, @@ -100,6 +110,9 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { if (!this.isUserOwner && !this.isClone) { this.formGroup.disable(); } + if (isNullOrUndefined(this.formGroup.get('extraProperties').get('publicDate').value)) { + this.formGroup.get('extraProperties').get('publicDate').patchValue(new Date()); + } } registerFormEventsForDmpProfile(definitionProperties?: DmpProfileDefinition): void { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index bdc196915..9c5ff334a 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -708,7 +708,10 @@ "STATUS": "DMP Status", "EXTERNAL-SOURCE-HINT": "List of values provided by external source(s)", "COLLABORATORS": "Collaborators", - "LANGUAGE": "Language" + "LANGUAGE": "Language", + "LICENSE": "License", + "VISIBILITY": "Visibility", + "PUBLICATION": "Publication Date" }, "ACTIONS": { "GO-TO-GRANT": "Go To DMP Grant", @@ -730,6 +733,10 @@ "TITLE": "Available Dataset Templates", "TEXT": "Dataset Profiles selected: ", "OK": "OK" + }, + "VISIBILITY": { + "PUBLIC": "Public", + "RESTRICTED": "Restricted" } }, "DMP-PROFILE-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index 2e1d8c0f1..e8909e32f 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -89,6 +89,7 @@ "ABOUT": "Acerca de", "PRIVACY": "Política de privacidad", "TERMS": "Términos de servicio", + "COOKIES-POLICY": "Cookies Policy", "PLANS": "Mis PGDs", "EXPLORE-PLANS": "PGDs Publicados", "QUICK-WIZARD": "(Asistente) Nuevo PGD", @@ -707,7 +708,10 @@ "STATUS": "Estado del PGD", "EXTERNAL-SOURCE-HINT": "Lista de valores proporcioador por fuente(s) externa(s)", "COLLABORATORS": "Collaborators", - "LANGUAGE": "Language" + "LANGUAGE": "Language", + "LICENSE": "License", + "VISIBILITY": "Visibility", + "PUBLICATION": "Publication Date" }, "ACTIONS": { "GO-TO-GRANT": "Ir a las subvención del PGD", @@ -729,6 +733,10 @@ "TITLE": "Plantilla del Dataset disponible", "TEXT": "Perfil del Dataset seleccionado: ", "OK": "OK" + }, + "VISIBILITY": { + "PUBLIC": "Public", + "RESTRICTED": "Restricted" } }, "DMP-PROFILE-LISTING": { @@ -1042,6 +1050,7 @@ "GUIDE": "User Guide", "GLOSSARY": "Glosario", "TERMS-OF-SERVICE": "Términos del servicio", + "COOKIES-POLICY": "Cookies Policy", "PRIVACY-POLICY": "Política de privacidad" }, "GLOSSARY": { @@ -1067,6 +1076,9 @@ "TITLE": "-Términos del servicio-", "MAIN-CONTENT": "" }, + "COOKIES-POLICY": { + "TITLE": "Cookies Policy" + }, "CONTACT": { "SUPPORT": { "TITLE": "Contacte con el soporte técnico", diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index 80c841ff7..f2925cbef 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -89,6 +89,7 @@ "ABOUT": "Σχετικά", "PRIVACY": "Πολιτική Απορρήτου και Προστασίας Προσωπικών Δεδομένων", "TERMS": "Όροι χρήσης", + "COOKIES-POLICY": "Cookies Policy", "PLANS": "Τα Σχέδια Διαχείρισης Δεδομένων Μου", "EXPLORE-PLANS": "Δημοσιευμένα Σχέδια Διαχείρισης Δεδομένων", "QUICK-WIZARD": "Νέο Σχέδιο Διαχείρισης Δεδομένων (Wizard)", @@ -707,7 +708,10 @@ "STATUS": "Κατάσταση Σχεδίου Διαχείρισης Δεδομένων", "EXTERNAL-SOURCE-HINT": "Κατάλογος των τιμών που παρέχονται από εξωτερικές πηγές", "COLLABORATORS": "Συνεργάτες", - "LANGUAGE": "Language" + "LANGUAGE": "Language", + "LICENSE": "License", + "VISIBILITY": "Visibility", + "PUBLICATION": "Publication Date" }, "ACTIONS": { "GO-TO-GRANT": "Μεταβείτε στην Επιχορήγηση Σχεδίου Διαχείρισης Δεδομένων", @@ -729,6 +733,10 @@ "TITLE": "Διαθέσιμα Templates Συνόλου Δεδομένων", "TEXT": "Επιλογή Χαρακτηριστικών Συνόλου Δεδομένων:", "OK": "OK" + }, + "VISIBILITY": { + "PUBLIC": "Public", + "RESTRICTED": "Restricted" } }, "DMP-PROFILE-LISTING": { @@ -1042,6 +1050,7 @@ "GUIDE": "Οδηγός Χρήστη", "GLOSSARY": "Γλωσσάριο", "TERMS-OF-SERVICE": "Όροι Χρήσης", + "COOKIES-POLICY": "Cookies Policy", "PRIVACY-POLICY": "Πολιτική Απορρήτου" }, "GLOSSARY": { @@ -1067,6 +1076,9 @@ "TITLE": "-Όροι Χρήσης-", "MAIN-CONTENT": "" }, + "COOKIES-POLICY": { + "TITLE": "Cookies Policy" + }, "CONTACT": { "SUPPORT": { "TITLE": "Επικοινωνία",