Project

General

Profile

« Previous | Next » 

Revision 62012

new fields in repo ui: fulltextdownload and consenttermsofuse

View differences:

modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepositoriesGoogleMapEntryPointController.java
1
package eu.dnetlib.functionality.modular.ui.repositories;
2

  
3
import javax.servlet.http.HttpServletRequest;
4
import javax.servlet.http.HttpServletResponse;
5

  
6
import org.springframework.ui.ModelMap;
7

  
8
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
9

  
10
@Deprecated
11
public class RepositoriesGoogleMapEntryPointController extends ModuleEntryPoint {
12

  
13
	@Override
14
	protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {}
15

  
16
}
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/functionality/modular/ui/repositories/xslt/repoDetails.xslt
1
<?xml version="1.0"?>
2

  
3
<xsl:stylesheet version="1.0"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5

  
6
	<xsl:output omit-xml-declaration="yes" method="html" />
7

  
8
	<xsl:template match="/">
9
		<div>
10
			<div class="well">
11
				<fieldset>
12
					<legend><h4>General</h4></legend>
13
					<table class="table table-bordered table-striped">
14
						<tbody>
15
							<tr>
16
								<td width="25%">Name</td>
17
								<td><xsl:value-of select=".//OFFICIAL_NAME" /></td>
18
							</tr><tr>
19
								<td width="25%">Typology</td>
20
								<td><xsl:value-of select=".//DATASOURCE_TYPE" /></td>
21
							</tr><tr>
22
								<td width="25%">Level of compliance</td>
23
								<td><xsl:value-of select=".//DATASOURCE_COMPLIANCE_DEGREE" /></td>
24
							</tr><tr>
25
								<td width="25%">Country</td>
26
								<td><xsl:value-of select=".//COUNTRY" /></td>
27
							</tr><tr>
28
								<td width="25%">Institution</td>
29
								<td><a href="{.//REPOSITORY_WEBPAGE}"><xsl:value-of select=".//REPOSITORY_INSTITUTION" /></a></td>
30
							</tr><tr>
31
								<td width="25%">Contact email</td>
32
								<td><a href="mailto:{.//ADMIN_INFO}"><xsl:value-of select=".//ADMIN_INFO" /></a></td>
33
							</tr>
34
						</tbody>
35
					</table>
36
				</fieldset>
37
			</div>
38
			<div class="well">
39
				<fieldset>
40
					<legend><h4>Status</h4></legend>
41
					<table class="table table-bordered table-striped">
42
						<tbody>
43
							<tr>
44
								<td width="25%">Size</td>
45
								<td><xsl:value-of select=".//NUMBER_OF_OBJECTS" /></td>
46
							</tr><tr>
47
								<td width="25%">Last update</td>
48
								<td><xsl:value-of select=".//LAST_UPDATE" /></td>
49
							</tr><tr>
50
								<td width="25%">Registered By</td>
51
								<td><xsl:value-of select=".//REGISTERED_BY" /></td>
52
							</tr>
53
						</tbody>
54
					</table>
55
				</fieldset>
56
			</div>
57
			<div class="well">
58
				<fieldset>
59
					<legend><h4>Configuration parameters</h4></legend>
60
					<table class="table table-bordered table-striped">
61
						<tbody>
62
							<xsl:for-each select=".//EXTRA_FIELDS/FIELD">
63
								<tr>
64
									<td width="25%"><xsl:value-of select="./key" /></td>
65
									<td><xsl:value-of select="./value" /></td>
66
								</tr>
67
							</xsl:for-each>
68
						</tbody>
69
					</table>
70
				</fieldset>
71
			</div>
72
			<xsl:for-each select="//INTERFACE">
73
				<div class="well">
74
					<fieldset>
75
						<legend><h4>Interface: <xsl:value-of select="./@typology" /></h4></legend>
76
						<table class="table table-bordered table-striped">
77
							<tbody>
78
								<xsl:for-each select="@*|.//*[string-length(normalize-space(text())) &gt; 0]|.//*[name() != 'INTERFACE_EXTRA_FIELD']/@*">
79
									<tr>
80
										<td width="25%">
81
											<xsl:choose>
82
												<xsl:when test="name() = 'INTERFACE_EXTRA_FIELD'">
83
													<xsl:value-of select="@name" />
84
												</xsl:when>
85
												<xsl:otherwise>
86
													<xsl:value-of select="local-name(.)" />		
87
												</xsl:otherwise>
88
											</xsl:choose>
89
										</td>
90
										<td><xsl:value-of select="." /></td>
91
									</tr>
92
								</xsl:for-each>
93
							</tbody>
94
						</table>
95
					</fieldset>
96
				</div>
97
			</xsl:for-each>
98
		</div>
99
	</xsl:template>
100

  
101
</xsl:stylesheet> 
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/reposMap.st
1
$common/master(
2
header={
3
	$ui/repos/header()$
4
	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=en"></script>
5
	<script type="text/javascript" src="../resources/js/reposMap.js"></script>
6
},
7
onLoad={},
8
body={
9
	<div ng-app="reposMapUI" ng-controller="reposMapCtrl">
10
		<div class="row">
11
			<div id="map_canvas_container" class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="height: 400px;">
12
				<div id="map_canvas" style="height: 100%; border: 1px solid #336699"></div> 
13
			</div>
14
			$ui/repos/repoDetails()$
15
		</div>
16
	</div>
17
}
18
)$
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/web/resources/js/reposMap.js
1
var module = angular.module('reposMapUI', []);
2

  
3
function reposMapCtrl($scope, $http, $sce, $location) {
4
	
5
	common_init($scope, $http, $sce, $location);
6
	
7
	$scope.mapHeight = "400px";
8
	
9
	$scope.updateReposMap = function() {
10
		$scope.showSpinner();
11
		$http.get('listRepositories.map')
12
        .success(
13
            function(data) {
14
            	$scope.redrawReposMap(data);
15
            	$scope.hideSpinner();
16
            }
17
        ).error(
18
            function() {
19
            	$scope.showError('Something really bad must have happened to our fellow hamster..');
20
            	$scope.hideSpinner();
21
            }
22
        );
23
	}	
24

  
25
	$scope.redrawReposMap = function(entries) {
26
		
27
		$scope.resizeMainElement(document.getElementById('map_canvas_container'));
28
		
29
		var map = new google.maps.Map(document.getElementById("map_canvas"), {
30
			zoom: 4,
31
			center: new google.maps.LatLng(44, 6),
32
			disableDefaultUI: true,
33
		    zoomControl: true,
34
			mapTypeId: google.maps.MapTypeId.ROADMAP
35
		});
36
		
37
		angular.forEach(entries, function(repo) {
38
	
39
			var marker = new google.maps.Marker({
40
				map: map,
41
				position: new google.maps.LatLng(repo.lat, repo.lng),
42
				animation: google.maps.Animation.DROP,
43
				title: repo.name
44
			});
45
			
46
			google.maps.event.addListener(marker, 'click', function() {
47
				$scope.showDetails(repo.id, repo.name);
48
			});
49
		});
50
	}
51
	
52
	$scope.updateReposMap();
53
}
54

  
55
window.onresize = function() {
56
	var elem = document.getElementById('map_canvas_container');
57
    angular.element(elem).scope().resizeMainElement(elem);
58
};
59

  
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoInternalController.java
1 1
package eu.dnetlib.functionality.modular.ui.repositories;
2 2

  
3 3
import java.io.IOException;
4
import java.io.StringReader;
5 4
import java.util.Date;
6 5
import java.util.List;
7 6
import java.util.Map;
......
56 55
import eu.dnetlib.functionality.modular.ui.error.ErrorMessage;
57 56
import eu.dnetlib.functionality.modular.ui.repositories.objects.RepoInterfaceEntry;
58 57
import eu.dnetlib.functionality.modular.ui.workflows.objects.sections.WorkflowSectionGrouper;
59
import eu.dnetlib.miscutils.functional.xml.ApplyXslt;
60 58
import eu.dnetlib.msro.workflows.sarasvati.loader.WorkflowExecutor;
61 59
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
62 60

  
......
136 134
	}
137 135

  
138 136
	@RequestMapping(value = "/ui/getRepoDetails.do")
139
	public void getRepoDetails(final HttpServletResponse response, @RequestParam(value = "id", required = true) final String id) throws Exception {
140
		String profile;
141
		try {
142
			profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(id);
143
		} catch (final ISLookUpDocumentNotFoundException e) {
144
			profile = serviceLocator.getService(ISLookUpService.class)
145
				.getResourceProfileByQuery("collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')/*[.//DATASOURCE_ORIGINAL_ID='"
146
					+ id + "']");
147
		}
148

  
149
		final ApplyXslt xslt =
150
			new ApplyXslt(IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/functionality/modular/ui/repositories/xslt/repoDetails.xslt")));
151

  
152
		IOUtils.copy(new StringReader(xslt.evaluate(profile)), response.getOutputStream());
137
	public @ResponseBody Datasource<?, ?> getRepoDetails(final HttpServletResponse response, @RequestParam(value = "id", required = true) final String id)
138
		throws Exception {
139
		return dsManager.getDs(id);
153 140
	}
154 141

  
155 142
	@RequestMapping("/ui/repoMetaWf.new")
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoUIUtils.java
9 9

  
10 10
import org.antlr.stringtemplate.StringTemplate;
11 11
import org.apache.commons.io.IOUtils;
12
import org.apache.commons.lang3.BooleanUtils;
12 13
import org.apache.commons.lang3.StringUtils;
13 14
import org.apache.commons.logging.Log;
14 15
import org.apache.commons.logging.LogFactory;
......
78 79
		ifc.setEmail(ds.getContactemail());
79 80
		ifc.setActive(api.getActive());
80 81
		ifc.setProtocol(api.getProtocol());
82
		ifc.setConsentTermsOfUseLabel(BooleanUtils.toString(ds.getConsentTermsOfUse(), "YES", "NO", "UNKNOWN"));
83
		ifc.setFulltextDownloadLabel(BooleanUtils.toString(ds.getFullTextDownload(), "YES", "NO", "UNKNOWN"));
81 84

  
82 85
		final Set<String> toVerifyParams = getParameterNamesForProtocol(ifc.getProtocol());
83 86
		ifc.getAccessParams().add(new SimpleParamEntry("baseUrl", api.getBaseurl()));
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/objects/RepoInterfaceEntry.java
21 21
	private boolean active = false;
22 22
	private String metadataIdentifierPath = "";
23 23
	private boolean complianceOverrided = false;
24
	private String consentTermsOfUseLabel;
25
	private String fulltextDownloadLabel;
24 26

  
25 27
	private List<SimpleParamEntry> accessParams = new ArrayList<>();
26 28

  
......
156 158
		this.complianceOverrided = complianceOverrided;
157 159
	}
158 160

  
161
	public String getConsentTermsOfUseLabel() {
162
		return consentTermsOfUseLabel;
163
	}
164

  
165
	public void setConsentTermsOfUseLabel(final String consentTermsOfUseLabel) {
166
		this.consentTermsOfUseLabel = consentTermsOfUseLabel;
167
	}
168

  
169
	public String getFulltextDownloadLabel() {
170
		return fulltextDownloadLabel;
171
	}
172

  
173
	public void setFulltextDownloadLabel(final String fulltextDownloadLabel) {
174
		this.fulltextDownloadLabel = fulltextDownloadLabel;
175
	}
176

  
159 177
}
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoApi.st
28 28
		
29 29
		<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;">
30 30
	  		<span class="input-group-addon" style="width: 150px;"><b>Datasource details</b></span>
31
			<span class="form-control"><b>contact email:</b> <a href="mailto:{{currentRepoApi.email}}" ng-show="currentRepoApi.email">{{currentRepoApi.email}}</a></span>
32
			<span class="form-control"><b>software typology:</b> {{currentRepoApi.repoType}}</span>
31
			<div class="form-control"><b>contact email:</b> <a href="mailto:{{currentRepoApi.email}}" ng-show="currentRepoApi.email">{{currentRepoApi.email}}</a></div>
32
			<div class="form-control"><b>software typology:</b> {{currentRepoApi.repoType}}</div>
33
			<div class="form-control"><b>Consent terms of use:</b> <span class="label" ng-class="{
34
				'label-default': currentRepoApi.consentTermsOfUseLabel != 'YES' && currentRepoApi.consentTermsOfUseLabel != 'NO', 
35
				'label-success': currentRepoApi.consentTermsOfUseLabel == 'YES', 
36
				'label-danger' : currentRepoApi.consentTermsOfUseLabel == 'NO' 
37
			}">{{currentRepoApi.consentTermsOfUseLabel}}</span></div>
38
			<div class="form-control"><b>Fulltext download:</b> <span class="label" ng-class="{
39
				'label-default': currentRepoApi.fulltextDownloadLabel != 'YES' && currentRepoApi.fulltextDownloadLabel != 'NO', 
40
				'label-success': currentRepoApi.fulltextDownloadLabel == 'YES', 
41
				'label-danger' : currentRepoApi.fulltextDownloadLabel == 'NO' 
42
			}">{{currentRepoApi.fulltextDownloadLabel}}</span></div>
33 43
		</div>
34 44
		
35 45
		<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;" ng-show="validatorDetailsAddress || validatorBlacklistAddress">
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoDetails.st
6 6
				<h4 class="modal-title">{{currentRepoName}}</h4>
7 7
			</div>
8 8
			<div class="modal-body">
9
				<div ng-bind-html="currentRepoHTML"></div>
9
				<pre>{{currentRepo | json}}</pre>
10 10
			</div>
11 11
			<div class="modal-footer">
12 12
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
modules/dnet-modular-repositories-ui/branches/eosc_services/src/main/resources/eu/dnetlib/web/resources/js/reposCommon.js
1 1
function common_init($scope, $http, $sce, $location) {
2 2
	$scope.currentRepoId = '';
3 3
	$scope.currentRepoName = '';
4
	$scope.currentRepoHTML = '';
4
	$scope.currentRepo = '';
5 5
	
6 6
	$scope.go = function(path) {
7 7
		$location.path(path); 
......
33 33
            function(data) {
34 34
            	$scope.currentRepoId = id;
35 35
            	$scope.currentRepoName = name;
36
            	$scope.currentRepoHTML = $sce.trustAsHtml(data);
36
            	$scope.currentRepo = data;
37 37
            	$scope.hideSpinner();
38 38
            	$('#repoDetailsModal').modal('show');
39 39
            }
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/java/eu/dnetlib/enabling/datasources/DatasourceFunctions.java
89 89
		ds.setRegisteredby(castObject(map.get("registeredby"), String.class));
90 90
		ds.setSubjects(castObject(map.get("subjects"), String.class));
91 91
		ds.setManaged(castObject(map.get("managed"), Boolean.class));
92
		ds.setConsentTermsOfUse(castObject(map.get("consenttermsofuse"), Boolean.class));
93
		ds.setConsentTermsOfUseDate(castObject(map.get("consenttermsofusedate"), Date.class));
94
		ds.setFullTextDownload(castObject(map.get("fulltextdownload"), Boolean.class));
95

  
92 96
		return ds;
93 97
	}
94 98

  
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/resources/eu/dnetlib/enabling/datasources/applicationContext-dnet-openaire-datasource-manager.xml
33 33
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
34 34
					p:id="active" p:label="API activation"
35 35
					p:sql="select a.active as term, count(*) as count from dsm_api a group by a.active order by count desc" />
36
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
37
					p:id="consenttermsofuse" p:label="Consent terms of use"
38
					p:sql="select d.consenttermsofuse as term, count(*) as count from dsm_api a left outer join dsm_services d on (a.service = d.id) group by d.consenttermsofuse order by count desc" />
39
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
40
					p:id="fulltextdownload" p:label="Fulltext download"
41
					p:sql="select d.fulltextdownload as term, count(*) as count from dsm_api a left outer join dsm_services d on (a.service = d.id) group by d.fulltextdownload order by count desc" />
36 42
			</list>
37 43
		</property>
38 44
	</bean>
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/resources/eu/dnetlib/enabling/datasources/queries/getDatasource.sql
34 34
	ds.lissn                     AS "lissn",
35 35
	ds.registeredby              AS "registeredby",
36 36
	ds.subjects                  AS "subjects",
37
	ds.managed                   AS "managed"
37
	ds.managed                   AS "managed",
38
	ds.consenttermsofuse         AS "consenttermsofuse",
39
	ds.consenttermsofusedate     AS "consenttermsofusedate",
40
	ds.fulltextdownload          AS "fulltextdownload"
38 41
FROM
39 42
	dsm_services ds
40 43
WHERE
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/resources/eu/dnetlib/enabling/datasources/queries/getDatasourceByPrefix.sql
34 34
	ds.lissn                     AS "lissn",
35 35
	ds.registeredby              AS "registeredby",
36 36
	ds.subjects                  AS "subjects",
37
	ds.managed                   AS "managed"
37
	ds.managed                   AS "managed",
38
	ds.consenttermsofuse         AS "consenttermsofuse",
39
	ds.consenttermsofusedate     AS "consenttermsofusedate",
40
	ds.fulltextdownload          AS "fulltextdownload"
38 41
FROM
39 42
	dsm_services ds
40 43
WHERE
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/resources/eu/dnetlib/enabling/datasources/queries/searchApisNormal.sql
12 12
	ds.namespaceprefix                                                       AS "prefix",
13 13
	ds.websiteurl                                                            AS "websiteUrl",
14 14
	coalesce((array_agg(o.country))[1], '-')                                 AS "country",
15
    (array_agg(o.legalname))[1]                                              AS "organization"
15
    (array_agg(o.legalname))[1]                                              AS "organization",
16
    ds.consenttermsofuse                                                     AS "consenttermsofuse",
17
    ds.fulltextdownload                                                      AS "fulltextdownload"
16 18
FROM dsm_api a
17 19
	LEFT OUTER JOIN dsm_services ds ON (a.service = ds.id)
18 20
	LEFT OUTER JOIN dsm_service_organization dsorg ON (ds.id = dsorg.service)
......
41 43
	ds.officialname,
42 44
	ds.englishname,
43 45
	ds.namespaceprefix,
44
	ds.websiteurl
45

  
46

  
46
	ds.websiteurl,
47
    ds.consenttermsofuse,
48
    ds.fulltextdownload
modules/dnet-openaire-datasource-manager/branches/eosc_services/src/main/resources/eu/dnetlib/enabling/datasources/queries/searchApisUsingField.sql
13 13
	ds.namespaceprefix                                                       AS "prefix",
14 14
	ds.websiteurl                                                            AS "websiteUrl",
15 15
	coalesce((array_agg(o.country))[1], '-')                                 AS "country",
16
    (array_agg(o.legalname))[1]                                              AS "organization"
16
    (array_agg(o.legalname))[1]                                              AS "organization",
17
    ds.consenttermsofuse                                                     AS "consenttermsofuse",
18
    ds.fulltextdownload                                                      AS "fulltextdownload"
17 19
FROM dsm_api a
18 20
	LEFT OUTER JOIN dsm_services ds ON (a.service = ds.id)
19 21
	LEFT OUTER JOIN dsm_service_organization dsorg ON (ds.id = dsorg.service)
......
33 35
	ds.officialname,
34 36
	ds.englishname,
35 37
	ds.namespaceprefix,
36
	ds.websiteurl
38
	ds.websiteurl,
39
	ds.consenttermsofuse,
40
    ds.fulltextdownload
37 41
) AS t WHERE

Also available in: Unified diff