Skip to content

Commit

Permalink
Merge pull request #3393 from dzhw/moellerth/issue3216-public-view-fix
Browse files Browse the repository at this point in the history
Embargo warning #3216: public view fix
  • Loading branch information
tilovillwock authored Dec 5, 2024
2 parents 0bf2445 + 8e2b15e commit c6009b2
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,29 @@ angular.module('metadatamanagementApp')
labels: getDialogLabels()
};

AttachmentDialogService
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

ctrl.moveAttachmentUp = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ angular.module('metadatamanagementApp').controller('AttachmentDialogController',
if ($scope.attachmentForm.$valid) {
// before saving, remove empty author array entries; we assume that entry is null if 'firstName'
// is null because it is one of the mandatory fields
if (ctrl.attachmentMetadata.type.en === "Questionnaire" || ctrl.attachmentMetadata.type.en === "Variable Questionnaire") {
if (ctrl.attachmentMetadata.type != null && (ctrl.attachmentMetadata.type.en === "Questionnaire" || ctrl.attachmentMetadata.type.en === "Variable Questionnaire")) {
ctrl.attachmentMetadata.citationDetails.authors = ctrl.attachmentMetadata.citationDetails.authors.filter(
author => author.firstName && author.firstName.trim() !== "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ angular.module('metadatamanagementApp').factory('CommonDialogsService', ['$mdDia
return $mdDialog.show(confirmDialog);
};

var showConfirmAddAttachmentPreReleaseDialog = function(titleKey, titleParams, contentKey,
contentParams, targetEvent) {
var confirmDialog = $mdDialog.confirm({
onComplete: focusCancelButton
}).title($translate.instant(titleKey, titleParams)).textContent(
$translate.instant(contentKey, contentParams))
.ok($translate.instant('global.common-dialogs.confirm-edit-pre-released-project.attachment-yes'))
.cancel($translate.instant('global.common-dialogs.confirm-edit-pre-released-project.attachment-no'))
.targetEvent(targetEvent);
return $mdDialog.show(confirmDialog);
};

/**
* Shows an info dialog with title and content and only one action
* button to close the dialog.
Expand All @@ -128,6 +140,7 @@ angular.module('metadatamanagementApp').factory('CommonDialogsService', ['$mdDia
showConfirmFilenameChangedDialog: showConfirmFilenameChangedDialog,
showConfirmDeletionDialog: showConfirmDeletionDialog,
showConfirmEditPreReleaseDialog: showConfirmEditPreReleaseDialog,
showConfirmAddAttachmentPreReleaseDialog: showConfirmAddAttachmentPreReleaseDialog,
showInfoDialog: showInfoDialog
};
}]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ angular.module('metadatamanagementApp').config([
'title': 'Änderungen freigeben?',
'content': 'Dieses Projekt ist aktuell vorläufig freigegeben. Jede gespeicherte Änderung ist unmittelbar öffentlich einsehbar. Bitte bestätigen Sie, dass Sie die Änderung speichern möchten.',
'yes': 'Änderungen freigeben',
'no': 'Bearbeitung fortsetzen'
'no': 'Bearbeitung fortsetzen',
'attachment-title': 'Materialien freigeben?',
'attachment-content': 'Dieses Projekt ist aktuell vorläufig freigegeben. Hinzugefügte Anhänge sind unmittelbar öffentlich einsehbar. Möchten Sie fortfahren?',
'attachment-yes': 'Ja',
'attachment-no': 'Abbrechen'
},
'confirm-edit-embargo-date': {
'title': 'Embargodatum ändern?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ angular.module('metadatamanagementApp').config([
'title': 'Publish changes?',
'content': 'This project is currently preliminarly released. Every saved change is immediately visible to the public. Please confirm that you want to save the changes.',
'yes': 'Publish changes',
'no': 'Continue editing'
'no': 'Continue editing',
'attachment-title': 'Publish documents?',
'attachment-content': 'This project is currently preliminarly released. Added documents are immediatly visible to the public. Do you want to continue?',
'attachment-yes': 'Yes',
'attachment-no': 'Cancel'
},
'confirm-edit-embargo-date': {
'title': 'Change embargo date?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ angular.module('metadatamanagementApp')
'ChoosePreviousVersionService',
'ConceptVersionsResource',
'$mdDialog',
'CurrentProjectService',
function(entity, PageMetadataService, $timeout,
$state, BreadcrumbService, Principal, SimpleMessageToastService,
ConceptResource, ConceptSearchService, $scope, $q,
ElasticSearchAdminService, ElsstSearchService, $transitions,
CommonDialogsService, LanguageService, ConceptAttachmentUploadService,
ConceptAttachmentResource, AttachmentDialogService,
ConceptAttachmentVersionsResource, ChoosePreviousVersionService,
ConceptVersionsResource, $mdDialog) {
ConceptVersionsResource, $mdDialog, CurrentProjectService) {

var ctrl = this;

Expand Down Expand Up @@ -363,11 +364,29 @@ angular.module('metadatamanagementApp')
labels: getDialogLabels()
};

AttachmentDialogService
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

ctrl.moveAttachmentUp = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ angular.module('metadatamanagementApp')
if (!Principal.isAuthenticated()) {
MessageBus.set('onDataPackageChange',
{
masterId: result.masterId
masterId: result.masterId,
projectId: result.dataAcquisitionProjectId
});
MessageBus.set('onDetailViewLoaded', {type: 'dataPackage'});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,29 @@ angular.module('metadatamanagementApp')
labels: getDialogLabels()
};

AttachmentDialogService
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

ctrl.moveAttachmentUp = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,29 @@ angular.module('metadatamanagementApp')
labels: getDialogLabels()
};

AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

ctrl.moveAttachmentUp = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ angular.module('metadatamanagementApp')
if (!Principal.isAuthenticated()) {
MessageBus.set('onDataPackageChange',
{
masterId: result.dataPackage.masterId
masterId: result.dataPackage.masterId,
projectId: result.dataAcquisitionProjectId
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ angular.module('metadatamanagementApp')
if (!Principal.isAuthenticated()) {
MessageBus.set('onDataPackageChange',
{
masterId: result.dataPackage.masterId
masterId: result.dataPackage.masterId,
projectId: result.dataAcquisitionProjectId
});
}
PageMetadataService.setPageTitle('instrument-management.' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,29 @@ angular.module('metadatamanagementApp')
exclude: ['title']
};

AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<md-card class="fdz-data-package" ng-if="$ctrl.analysisPackage && $ctrl.analysisPackageIdVersion.masterId && $ctrl.lang && $ctrl.releases">
<md-card class="fdz-data-package" ng-if="$ctrl.analysisPackage && $ctrl.analysisPackageIdVersion.masterId && $ctrl.lang && $ctrl.releases && $ctrl.project">
<md-card-header>
<md-card-header-text>
<a ui-sref="analysisPackageDetail({id: $ctrl.analysisPackageIdVersion.masterId.replace('$', ''), version: $ctrl.analysisPackageIdVersion.version})" class="title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@

function loadDataPackage(id, version) {
$rootScope.$broadcast('start-ignoring-404');
// sometimes on init there is no project id, because it is loaded later on
if (id === undefined) {
console.debug("No project ID provided to search by.")
return;
}
$ctrl.noFinalRelease = false;
var excludes = ['nested*','variables','questions',
'surveys','instruments', 'relatedPublications',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<md-card class="fdz-data-package" ng-if="$ctrl.dataPackage && $ctrl.dataPackageIdVersion.masterId && $ctrl.lang && $ctrl.accessWays && $ctrl.releases">
<md-card class="fdz-data-package" ng-if="$ctrl.dataPackage && $ctrl.dataPackageIdVersion.masterId && $ctrl.lang && $ctrl.accessWays && $ctrl.releases && $ctrl.project">
<md-card-header>
<md-card-header-text>
<a ui-sref="dataPackageDetail({id: $ctrl.dataPackageIdVersion.masterId.replace('$', ''), version: $ctrl.dataPackageIdVersion.version})" class="title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ angular.module('metadatamanagementApp')
if (!Principal.isAuthenticated()) {
MessageBus.set('onDataPackageChange',
{
masterId: survey.dataPackage.masterId
masterId: survey.dataPackage.masterId,
projectId: survey.dataAcquisitionProjectId
});
}
BreadcrumbService.updateToolbarHeader({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,29 @@ angular.module('metadatamanagementApp')
labels: getDialogLabels()
};

AttachmentDialogService
if (CurrentProjectService.getCurrentProject().release.isPreRelease) {
CommonDialogsService.showConfirmAddAttachmentPreReleaseDialog(
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-title',
{},
'global.common-dialogs' +
'.confirm-edit-pre-released-project.attachment-content',
{},
null
).then(function success() {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
});
} else {
AttachmentDialogService
.showDialog(dialogConfig, event)
.then(function() {
ctrl.loadAttachments(true);
});
}
};

ctrl.moveAttachmentUp = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ angular.module('metadatamanagementApp')
if (!Principal.isAuthenticated()) {
MessageBus.set('onDataPackageChange',
{
masterId: result.dataPackage.masterId
masterId: result.dataPackage.masterId,
projectId: result.dataAcquisitionProjectId
});
}
if (result.repeatedMeasurementIdentifier) {
Expand Down

0 comments on commit c6009b2

Please sign in to comment.