Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public class Settings {
public static final String SYSTEM_HARVESTING_MAIL_TEMPLATE_ERROR = "system/harvesting/mail/templateError";
public static final String SYSTEM_HARVESTING_MAIL_TEMPLATE = "system/harvesting/mail/template";
public static final String SYSTEM_METADATACREATE_GENERATE_UUID = "system/metadatacreate/generateUuid";
public static final String SYSTEM_METADATACREATE_PUBLISH_FOR_GROUP_EDITORS = "system/metadatacreate/publishForGroupEditors";
public static final String SYSTEM_METADATACREATE_COPY_ATTACHMENTS = "system/metadatacreate/copyAttachments";
public static final String SYSTEM_METADATACREATE_SKIP_METADATA_CREATION_PAGE = "system/metadatacreate/skipMetadataCreationPage";
public static final String SYSTEM_THREADEDINDEXING_MAXTHREADS = "system/threadedindexing/maxthreads";
public static final String SYSTEM_RESOURCE_PREFIX = "metadata/resourceIdentifierPrefix";
public static final String SYSTEM_INSPIRE_REMOTE_VALIDATION_URL = "system/inspire/remotevalidation/url";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
* @param {string} metadataUuid , the uuid of the metadata to create
* (when metadata uuid is set to manual)
* @param {boolean} hasCategoryOfSource copy categories from source
* @param {boolean} hasAttachmentsOfSource copy attachments from source
* @return {HttpPromise} Future object
*/
copy: function (
Expand All @@ -128,7 +129,8 @@
isTemplate,
isChild,
metadataUuid,
hasCategoryOfSource
hasCategoryOfSource,
hasAttachmentsOfSource
) {
// new md type determination
var mdType;
Expand Down Expand Up @@ -157,7 +159,8 @@
group: groupId,
allowEditGroupMembers: withFullPrivileges ? "true" : "false",
targetUuid: metadataUuid || "",
hasCategoryOfSource: hasCategoryOfSource ? "true" : "false"
hasCategoryOfSource: hasCategoryOfSource ? "true" : "false",
hasAttachmentsOfSource: hasAttachmentsOfSource ? "true" : "false"
});
return $http.put("../api/records/duplicate?" + url, {
headers: {
Expand Down Expand Up @@ -203,6 +206,7 @@
* @param {string} metadataUuid , the uuid of the metadata to create
* (when metadata uuid is set to manual)
* @param {boolean} hasCategoryOfSource copy categories from source
* @param {boolean} hasAttachmentsOfSource copy attachments from source
* @return {HttpPromise} Future object
*/
create: function (
Expand All @@ -213,7 +217,8 @@
isChild,
tab,
metadataUuid,
hasCategoryOfSource
hasCategoryOfSource,
hasAttachmentsOfSource
) {
return this.copy(
id,
Expand All @@ -222,7 +227,8 @@
isTemplate,
isChild,
metadataUuid,
hasCategoryOfSource
hasCategoryOfSource,
hasAttachmentsOfSource
).then(function (response) {
var path = "/metadata/" + response.data;
if (tab) {
Expand Down
29 changes: 21 additions & 8 deletions web-ui/src/main/resources/catalog/js/edit/NewMetadataController.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
$scope.generateUuid = gnConfig["system.metadatacreate.generateUuid"];
$scope.ownerGroup = gnConfig["system.metadatacreate.preferredGroup"];
$scope.preferredTemplate = gnConfig["system.metadatacreate.preferredTemplate"];
$scope.defaultPublishForGroupEditorsSetting =
gnConfig["system.metadatacreate.publishForGroupEditors"];
$scope.defaultCopyAttachmentsOfSourceSetting =
gnConfig["system.metadatacreate.copyAttachments"];
$scope.skipMetadataCreationPageSetting =
gnConfig["system.metadatacreate.skipMetadataCreationPage"];
$scope.publishForGroupEditors = $scope.defaultPublishForGroupEditorsSetting;
$scope.copyAttachmentsOfSource = $scope.defaultCopyAttachmentsOfSourceSetting;
});

// A map of icon to use for each types
Expand All @@ -88,7 +96,6 @@

var defaultType = "dataset";
var unknownType = "unknownType";
var fullPrivileges = true;

$scope.getTypeIcon = function (type) {
return icons[type] || "fa-square-o";
Expand All @@ -99,11 +106,12 @@
gnMetadataManager.create(
$routeParams.id,
$routeParams.group,
fullPrivileges,
$scope.defaultPublishForGroupEditorsSetting,
$routeParams.template,
false,
$routeParams.tab,
true
true,
$scope.defaultCopyAttachmentsOfSourceSetting
);
} else {
// Metadata creation could be on a template
Expand Down Expand Up @@ -211,9 +219,13 @@
if (
$scope.mdList.length === 1 &&
$scope.groups.length === 1 &&
$scope.generateUuid === true
$scope.generateUuid === true &&
$scope.skipMetadataCreationPageSetting === true
) {
$scope.createNewMetadata(false);
$scope.createNewMetadata(
$scope.defaultPublishForGroupEditorsSetting,
$scope.defaultCopyAttachmentsOfSourceSetting
);
}
unregisterFn();
unregisterMdListFn();
Expand Down Expand Up @@ -284,7 +296,7 @@
gnUtilityService.goBack("/board");
};

$scope.createNewMetadata = function (isPublic) {
$scope.createNewMetadata = function (isPublic, hasAttachmentsOfSource) {
var metadataUuid = "";

// If no auto-generated metadata identifier, get the value
Expand All @@ -311,12 +323,13 @@
.create(
$scope.activeTpl.id,
$scope.ownerGroup,
isPublic || false,
isPublic,
$scope.isTemplate,
$routeParams.childOf ? true : false,
undefined,
metadataUuid,
true
true,
hasAttachmentsOfSource
)
.catch(function (response) {
var data = response.data;
Expand Down
6 changes: 6 additions & 0 deletions web-ui/src/main/resources/catalog/locales/en-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,12 @@
"system/metadatacreate" : "Metadata create",
"system/metadatacreate/generateUuid" : "Generate UUID",
"system/metadatacreate/generateUuid-help" : "GeoNetwork assigns a random metadata UUID to the metadata created by a user (default). To assign the metadata UUID manually disable this option and fill the metadata UUID prefix.",
"system/metadatacreate/publishForGroupEditors" : "Publish for group editors",
"system/metadatacreate/publishForGroupEditors-help" : "When enabled new metadata records are published for group editors. You can override this behavior on the metadata creation page.",
"system/metadatacreate/copyAttachments" : "Copy attachments",
"system/metadatacreate/copyAttachments-help" : "When enabled, attachments from the source template or record are copied into the new metadata record. You can override this behavior on the metadata creation page.",
"system/metadatacreate/skipMetadataCreationPage" : "Skip metadata creation page",
"system/metadatacreate/skipMetadataCreationPage-help" : "When enabled, if only one group and one template are available, metadata is created with default options and the creation page is skipped.",
"system/metadatacreate/preferredGroup": "Preferred metadata group owner",
"system/metadatacreate/preferredGroup-help" : "Select the default group owner selected in the metadata creation page.",
"system/metadatacreate/preferredTemplate": "Preferred metadata template",
Expand Down
4 changes: 3 additions & 1 deletion web-ui/src/main/resources/catalog/locales/en-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@
"createCopyOf": "Create copy",
"createMetadata": "Create",
"createMetadataError": "Create metadata error",
"createMetadataForGroup": "Create and publish for group editors",
"createMetadataForGroup": "Publish for group editors",
"createMetadataForGroup-help": "The record will be editable by all members of the group",
"copyAttachmentsOfSource": "Copy attachments",
"copyAttachmentsOfSource-help": "Copy all attachments from the source record to the new record",
"createMetadataUniformResourceName": "Metadata Uniform Resource Name",
"createNewMetadata": "Add a new record",
"createSmall": "Create small",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h1>{{resourceTitle | translate}}</h1>
<button
type="button"
class="btn btn-success"
data-gn-click-and-spin="createNewMetadata()"
data-gn-click-and-spin="createNewMetadata(publishForGroupEditors, copyAttachmentsOfSource)"
data-ng-disabled="(!activeTpl || !ownerGroup || ((!generateUuid) && (!isMdIdentifierFilled())))"
>
<i class="fa fa-plus"></i>
Expand All @@ -165,15 +165,17 @@ <h1>{{resourceTitle | translate}}</h1>
<span class="caret"></span>&nbsp;
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a
title="{{'createMetadataForGroup-help' | translate}}"
data-gn-click-and-spin="createNewMetadata(true)"
href=""
data-translate=""
>
createMetadataForGroup</a
>
<li role="menuitem">
<label title="{{'createMetadataForGroup-help' | translate}}">
<input type="checkbox" data-ng-model="publishForGroupEditors" />
{{'createMetadataForGroup' | translate}}
</label>
</li>
<li role="menuitem">
<label title="{{'copyAttachmentsOfSource-help' | translate}}">
<input type="checkbox" data-ng-model="copyAttachmentsOfSource" />
{{'copyAttachmentsOfSource' | translate}}
</label>
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ <h1>{{resourceTitle | translate}}</h1>
<button
type="button"
class="btn btn-primary"
data-gn-click-and-spin="createNewMetadata()"
data-gn-click-and-spin="createNewMetadata(publishForGroupEditors, copyAttachmentsOfSource)"
data-ng-class="{'disabled': (!activeTpl || !ownerGroup || ((!generateUuid) && (!isMdIdentifierFilled())) )}"
>
<i class="fa fa-plus"></i>
Expand All @@ -166,15 +166,17 @@ <h1>{{resourceTitle | translate}}</h1>
<span class="caret"></span>&nbsp;
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a
title="{{'createMetadataForGroup-help' | translate}}"
data-gn-click-and-spin="createNewMetadata(true)"
href=""
data-translate=""
>
createMetadataForGroup</a
>
<li role="menuitem">
<label title="{{'createMetadataForGroup-help' | translate}}">
<input type="checkbox" data-ng-model="publishForGroupEditors" />
{{'createMetadataForGroup' | translate}}
</label>
</li>
<li role="menuitem">
<label title="{{'copyAttachmentsOfSource-help' | translate}}">
<input type="checkbox" data-ng-model="copyAttachmentsOfSource" />
{{'copyAttachmentsOfSource' | translate}}
</label>
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metada
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadata/validation/removeSchemaLocation', 'false', 2, 9170, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/history/enabled', 'false', 2, 9171, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/generateUuid', 'true', 2, 9100, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/publishForGroupEditors', 'false', 2, 9101, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/copyAttachments', 'true', 2, 9102, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/skipMetadataCreationPage', 'false', 2, 9103, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/preferredGroup', '', 1, 9105, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/preferredTemplate', '', 0, 9106, 'n');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
UPDATE Settings SET value='4.4.10' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/publishForGroupEditors', 'false', 2, 9101, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/copyAttachments', 'true', 2, 9102, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/skipMetadataCreationPage', 'false', 2, 9103, 'n');
Loading