Skip to content

Commit

Permalink
Merge branch 'gn-42-antcat' of github.com:OpenWork-NZ/core-geonetwork…
Browse files Browse the repository at this point in the history
… into gn-42-antcat
  • Loading branch information
ByronCinNZ committed Jun 18, 2024
2 parents fea589d + 8a0c990 commit 9345e63
Show file tree
Hide file tree
Showing 384 changed files with 185,988 additions and 12 deletions.
22 changes: 22 additions & 0 deletions core/src/main/java/org/fao/geonet/kernel/KeywordBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class KeywordBean {
private String keywordUrl;
private IsoLanguagesMapper isoLanguageMapper;
private String defaultLang;
private String kwdClass;

public KeywordBean(IsoLanguagesMapper isoLangMapper) {
this.isoLanguageMapper = isoLangMapper;
Expand Down Expand Up @@ -115,6 +116,10 @@ public static Element getComplexIso19139Elt(List<KeywordBean> kbList) {

Element type = null;
Element thesaurusName = null;
Element keywordClass = null;
Element MD_KeywordClass = null;
Element conceptIdentifier = null;


for (KeywordBean kb : kbList) {
Element keyword = new Element("keyword", Namespaces.GMD);
Expand All @@ -131,6 +136,9 @@ public static Element getComplexIso19139Elt(List<KeywordBean> kbList) {
type = KeywordBean.createKeywordTypeElt(kb);
if (thesaurusName == null)
thesaurusName = KeywordBean.createThesaurusNameElt(kb);
if (keywordClass == null)
keywordClass = KeywordBean.createKeywordClassElt(kb);

}

// Add elements to the root MD_Keywords element.
Expand Down Expand Up @@ -216,6 +224,20 @@ private static Element createThesaurusNameElt(KeywordBean kb) {
return thesaurusName;
}

/**
* Creates keyword class element. BC 2-26-21
*/
private static Element createKeywordClassElt(KeywordBean kb) {
Element keywordClass = new Element("keywordClass", Namespaces.MRI);
Element mdKeywordClass = new Element("MD_KeywordClass", Namespaces.MRI);
Element cs = new Element("CharacterString", Namespaces.GCO);
Element conceptIdentifier = new Element("conceptIdentifier", Namespaces.MRI);
Element URI = new Element("URI", Namespaces.MCC);
System.out.println("keywordClass" );
keywordClass.addContent((Content) cs.clone());
return keywordClass;
}

public KeywordBean setThesaurusInfo(Thesaurus thesaurus) {
this.thesaurusKey = thesaurus.getKey();
this.thesaurusDate = thesaurus.getDate();
Expand Down
131 changes: 131 additions & 0 deletions icsm/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: [email protected]
*/

(function() {

goog.provide('gn_search_default_config');

var module = angular.module('gn_search_default_config', []);

module.value('gnTplResultlistLinksbtn',
'../../catalog/views/default/directives/partials/linksbtn.html');

module
.run([
'gnSearchSettings',
'gnViewerSettings',
'gnOwsContextService',
'gnMap',
'gnMapsManager',
'gnDefaultGazetteer',
function(searchSettings, viewerSettings, gnOwsContextService,
gnMap, gnMapsManager, gnDefaultGazetteer) {

if(viewerSettings.mapConfig.viewerMapLayers) {
console.warn('[geonetwork] Use of "mapConfig.viewerMapLayers" is deprecated. ' +
'Please configure layer per map type.')
}

// Keep one layer in the background
// while the context is not yet loaded.
viewerSettings.bgLayers = [
gnMap.createLayerForType('osm')
];
viewerSettings.servicesUrl =
viewerSettings.mapConfig.listOfServices || {};

// WMS settings
// If 3D mode is activated, single tile WMS mode is
// not supported by olcesium, so force tiling.
if (viewerSettings.mapConfig.is3DModeAllowed) {
viewerSettings.singleTileWMS = false;
// Configure Cesium to use a proxy. This is required when
// WMS does not have CORS headers. BTW, proxy will slow
// down rendering.
viewerSettings.cesiumProxy = true;
} else {
viewerSettings.singleTileWMS = true;
}

var bboxStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1)',
width: 2
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.3)'
})
});
searchSettings.olStyles = {
drawBbox: bboxStyle,
mdExtent: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'orange',
width: 2
})
}),
mdExtentHighlight: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'orange',
width: 3
}),
fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.3)'
})
})

};

gnMapsManager.initProjections(viewerSettings.mapConfig.switcherProjectionList);
var searchMap = gnMapsManager.createMap(gnMapsManager.SEARCH_MAP);
var viewerMap = gnMapsManager.createMap(gnMapsManager.VIEWER_MAP);

// To configure a gazetteer provider
viewerSettings.gazetteerProvider = gnDefaultGazetteer;

// Map protocols used to load layers/services in the map viewer
searchSettings.mapProtocols = {
layers: [
'OGC:WMS',
'OGC:WMTS',
'OGC:WMS-1.1.1-http-get-map',
'OGC:WMS-1.3.0-http-get-map',
'OGC:WFS',
'ESRI:REST'
],
services: [
'OGC:WMS-1.3.0-http-get-capabilities',
'OGC:WMS-1.1.1-http-get-capabilities',
'OGC:WMTS-1.0.0-http-get-capabilities',
'OGC:WFS-1.0.0-http-get-capabilities'
]
};

// Set custom config in gnSearchSettings
angular.extend(searchSettings, {
viewerMap: viewerMap,
searchMap: searchMap
});

}]);
})();
203 changes: 203 additions & 0 deletions icsm/directives/directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: [email protected]
*/

(function() {

goog.provide('gn_search_default_directive');

var module = angular.module('gn_search_default_directive', []);

module.directive('gnInfoList', ['gnMdView',
function(gnMdView) {
return {
restrict: 'A',
replace: true,
templateUrl: '../../catalog/views/default/directives/' +
'partials/infolist.html',
link: function linkFn(scope, element, attr) {
scope.showMore = function(isDisplay) {
var div = $('#gn-info-list' + this.md.getUuid());
$(div.children()[isDisplay ? 0 : 1]).addClass('hidden');
$(div.children()[isDisplay ? 1 : 0]).removeClass('hidden');
};
scope.go = function(uuid) {
gnMdView(index, md, records);
gnMdView.setLocationUuid(uuid);
};
}
};
}
]);

module.directive('gnAttributeTableRenderer', ['gnMdView',
function(gnMdView) {
return {
restrict: 'A',
replace: true,
templateUrl: '../../catalog/views/default/directives/' +
'partials/attributetable.html',
scope: {
attributeTable: '=gnAttributeTableRenderer'
},
link: function linkFn(scope, element, attrs) {
if (angular.isDefined(scope.attributeTable) &&
!angular.isArray(scope.attributeTable)) {
scope.attributeTable = [scope.attributeTable];
}
scope.showCodeColumn = false;
angular.forEach(scope.attributeTable, function(elem) {
if(elem.code > '') {
scope.showCodeColumn = true;
}
});
}
};
}
]);

module.directive('gnLinksBtn', [ 'gnTplResultlistLinksbtn',
function(gnTplResultlistLinksbtn) {
return {
restrict: 'E',
replace: true,
scope: true,
templateUrl: gnTplResultlistLinksbtn
};
}
]);

module.directive('gnMdActionsMenu', ['gnMetadataActions',
'$http', 'gnConfig', 'gnConfigService', 'gnGlobalSettings',
function(gnMetadataActions, $http, gnConfig, gnConfigService, gnGlobalSettings) {
return {
restrict: 'A',
replace: true,
templateUrl: '../../catalog/views/default/directives/' +
'partials/mdactionmenu.html',
link: function linkFn(scope, element, attrs) {
scope.mdService = gnMetadataActions;
scope.md = scope.$eval(attrs.gnMdActionsMenu);
scope.formatterList = gnGlobalSettings.gnCfg.mods.search.downloadFormatter;

scope.tasks = [];
scope.hasVisibletasks = false;

gnConfigService.load().then(function(c) {
scope.isMdWorkflowEnable = gnConfig['metadata.workflow.enable'];
});

function loadTasks() {
return $http.get('../api/status/task', {cache: true}).
success(function(data) {
scope.tasks = data;
scope.getVisibleTasks();
});
};

scope.getVisibleTasks = function() {
$.each(scope.tasks, function(i,t) {
scope.hasVisibletasks = scope.taskConfiguration[t.name] &&
scope.taskConfiguration[t.name].isVisible &&
scope.taskConfiguration[t.name].isVisible();
});
}

scope.taskConfiguration = {
doiCreationTask: {
isVisible: function(md) {
return gnConfig['system.publication.doi.doienabled'];
},
isApplicable: function(md) {
// TODO: Would be good to return why a task is not applicable as tooltip
// TODO: Add has DOI already
return md && md.isPublished()
&& md.isTemplate === 'n'
&& md.isHarvested === 'n';
}
}
};

loadTasks();

scope.$watch(attrs.gnMdActionsMenu, function(a) {
scope.md = a;
});

scope.getScope = function() {
return scope;
}
}
};
}
]);

module.directive('gnPeriodChooser', [
function() {
return {
restrict: 'A',
replace: true,
templateUrl: '../../catalog/views/default/directives/' +
'partials/periodchooser.html',
scope: {
label: '@gnPeriodChooser',
dateFrom: '=',
dateTo: '='
},
link: function linkFn(scope, element, attr) {
var today = moment();
scope.format = 'YYYY-MM-DD';
scope.options = ['today', 'yesterday', 'thisWeek', 'thisMonth',
'last3Months', 'last6Months', 'thisYear'];
scope.setPeriod = function(option) {
if (option === 'today') {
var date = today.format(scope.format);
scope.dateFrom = date;
} else if (option === 'yesterday') {
var date = today.clone().subtract(1, 'day')
.format(scope.format);
scope.dateFrom = date;
scope.dateTo = today.format(scope.format);
return;
} else if (option === 'thisWeek') {
scope.dateFrom = today.clone().startOf('week')
.format(scope.format);
} else if (option === 'thisMonth') {
scope.dateFrom = today.clone().startOf('month')
.format(scope.format);
} else if (option === 'last3Months') {
scope.dateFrom = today.clone().startOf('month').
subtract(3, 'month').format(scope.format);
} else if (option === 'last6Months') {
scope.dateFrom = today.clone().startOf('month').
subtract(6, 'month').format(scope.format);
} else if (option === 'thisYear') {
scope.dateFrom = today.clone().startOf('year')
.format(scope.format);
}
scope.dateTo = today.clone().add(1, 'day').format(scope.format);
};
}
};
}
]);
})();
Loading

0 comments on commit 9345e63

Please sign in to comment.