Project

General

Profile

« Previous | Next » 

Revision 28316

emf document xslt

View differences:

modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/IndexClient.java
131 131
	}
132 132
	
133 133
	
134
	public String getDocument(final String id) throws IndexServiceException, ResultSetException {
134
	public String getDocument(final String field, final String id) throws IndexServiceException, ResultSetException {
135 135
		
136
		final String query = "objidentifier exact \"" + id.trim() + "\"";
136
		final String query = field + " exact \"" + id.trim() + "\"";
137 137
		
138 138
		final W3CEndpointReference epr = indexLocator.getService().lookup(query, mdFormat, layout, interpretation);
139 139
		
modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/LightUiInternalController.java
32 32
		return indexClient.search(query, page);
33 33
	}
34 34
	
35
	@RequestMapping("/ui/lightui_get")
36
	public @ResponseBody String getDocument(@RequestParam(value="id", required=true) final String id) throws Exception {
37
		return indexClient.getDocument(id);
35
	@RequestMapping("/ui/lightui_findone")
36
	public @ResponseBody String getDocument(@RequestParam(value="field", required=true) final String field, @RequestParam(value="id", required=true) final String id) throws Exception {
37
		return indexClient.getDocument(field, id);
38 38
	}
39 39
}
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/emf_2_document.xslt
7 7
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
8 8

  
9 9
	<xsl:template match="/">
10
		<div>
11
			<strong><xsl:value-of select="//*[local-name() = 'title']" /></strong>
10
		<table class="table">
11
			<tr>
12
				<td>
13
					<xsl:variable name="type" select="//*[local-name()='entityType']" /> 
14
					<xsl:choose>
15
						<xsl:when test="$type = 'Artifact'">
16
							<img src="../resources/img/eagle/artifact.png" width="80" height="80" />
17
						</xsl:when>
18
						<xsl:when test="$type = 'Documental manifestation'">
19
							<img src="../resources/img/eagle/doc.png" width="80" height="80" />
20
						</xsl:when>
21
						<xsl:when test="$type = 'Visual representation'">
22
							<img src="../resources/img/eagle/pic.png" width="80" height="80" />
23
						</xsl:when>
24
					</xsl:choose>
25
				</td>
26
				<td>
27
					<xsl:if test="//*[local-name()='title']">
28
						<b>Title: </b>
29
						<xsl:value-of select="//*[local-name()='title']" />
30
						<br />
31
					</xsl:if>
12 32
			
13
			<table class="table">
14
				<tr>
15
					<th>AAAAA</th>
16
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
17
				</tr>
18
				<tr>
19
					<th>AAAAA</th>
20
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
21
				</tr>
22
				<tr>
23
					<th>AAAAA</th>
24
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
25
				</tr>
26
				<tr>
27
					<th>AAAAA</th>
28
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
29
				</tr>
30
				<tr>
31
					<th>AAAAA</th>
32
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
33
				</tr>
34
				<tr>
35
					<th>AAAAA</th>
36
					<td>bbbbbbbbbbbbbbbbbbbbb</td>
37
				</tr>
38
			</table>
39
		</div>
33
					<xsl:if test="//*[local-name()='description']">
34
						<b>Description: </b>
35
						<xsl:value-of select="//*[local-name()='description']" />
36
						<br />
37
					</xsl:if>
38
			
39
					<xsl:if test="//*[local-name()='providerName']">
40
						<b>Provided by: </b>
41
						<xsl:value-of select="//*[local-name()='providerName']" />
42
						<br />
43
					</xsl:if>
44
			
45
					<xsl:if test="//*[local-name()='dateEdited']">
46
						<b>Last edit: </b>
47
						<xsl:value-of select="//*[local-name()='dateEdited']" />
48
						<br />
49
					</xsl:if>
50
			
51
					<xsl:if test="//*[local-name()='metadataEditor']">
52
						<b>Metadata edited by: </b>
53
						<xsl:value-of select="//*[local-name()='metadataEditor']" />
54
						<br />
55
					</xsl:if>
56
			
57
					<xsl:if test="//*[local-name()='dateOfCollection']">
58
						<b>Collected on: </b>
59
						<xsl:value-of select="//*[local-name()='dateOfCollection']" />
60
						<br />
61
					</xsl:if>
62
				</td>
63
			</tr>
64
		</table>
65
			
66
		<br/>
67
		<fieldset>
68
			<legend>Connected entities</legend>
69
			<xsl:if test="//*[local-name()='transcriptionId']">
70
				<xsl:variable name="linkrel" select="//*[local-name()='transcriptionId']" />
71
				<a href="#/doc/dnetresourceidentifier/{$linkrel}"><img src="../resources/img/eagle/doc.png" width="80" height="80" /><xsl:value-of select="$linkrel" /></a>
72
				<br/>
73
			</xsl:if>
74
			
75
			<xsl:for-each select="//*[local-name()='hasVisualRepresentation']">
76
				<xsl:variable name="linkrel" select="." />
77
				<a href="#/doc/dnetresourceidentifier/{$linkrel}"><img src="../resources/img/eagle/pic.png" width="80" height="80" /><xsl:value-of select="$linkrel" /></a>
78
				<br/>
79
			</xsl:for-each>
80
			
81
			<xsl:if test="//*[local-name()='isTranscriptionOf']">
82
				<xsl:variable name="linkrel" select="//*[local-name()='isTranscriptionOf']/artifactId" />
83
				<a href="#/doc/dnetresourceidentifier/{$linkrel}"><img src="../resources/img/eagle/artifact.png" width="80" height="80" /><xsl:value-of select="$linkrel" /></a>
84
			</xsl:if>
85
			
86
			<xsl:if test="//*[local-name()='isRepresentationOf']">
87
				<xsl:variable name="linkrel" select="//*[local-name()='isRepresentationOf']" />
88
				<a href="#/doc/dnetresourceidentifier/{$linkrel}"><img src="../resources/img/eagle/artifact.png" width="80" height="80" /><xsl:value-of select="$linkrel" /></a>
89
			</xsl:if>
90
		</fieldset>
91
			
92
		<xsl:variable name="url" select="//*[local-name()='url']" />
93
		<xsl:if test="$url">
94
			<br/>
95
				<img src="{$url}" width="20%" />
96
			<br/>
97
		</xsl:if>
98
	
99
		<br/>
100
		<xsl:for-each select="//*[local-name()='eagleObject']">
101
			<fieldset>
102
				<legend>Record XML</legend>
103
				<xsl:call-template name="xmlItem">
104
					<xsl:with-param name="indent" select="string('')" />
105
				</xsl:call-template>
106
			</fieldset>
107
		</xsl:for-each>
40 108
	</xsl:template>
41 109
	
110
	<xsl:template name="xmlItem">
111
		<xsl:param name="indent" />
112

  
113
		<xsl:variable name="tag" select="local-name()" />
114

  
115
		<xsl:variable name="newindent">
116
			<xsl:value-of select="$indent" />
117
			&#160;&#160;&#160;&#160;
118
		</xsl:variable>
119

  
120
		<xsl:variable name="attribs">
121
			<xsl:for-each select="@*">
122
				<xsl:value-of select="concat(' ', local-name(), '=&quot;', ., '&quot;')" />
123
			</xsl:for-each>
124
		</xsl:variable>
125
		<xsl:value-of select="$indent" />
126

  
127
		<b>
128
			<xsl:value-of select="concat('&lt;',$tag)" />
129
		</b>
130
		<i>
131
			<xsl:value-of select="$attribs" />
132
		</i>
133
		<b>&gt;</b>
134

  
135
		<xsl:value-of select="text()" />
136

  
137
		<xsl:choose>
138
			<xsl:when test="count(child::*) &gt; 0">
139
				<br />
140
				<xsl:for-each select="child::*">
141
					<xsl:call-template name="xmlItem">
142
						<xsl:with-param name="indent" select="$newindent" />
143
					</xsl:call-template>
144
					<br />
145
				</xsl:for-each>
146
				<xsl:value-of select="$indent" />
147
			</xsl:when>
148
			<xsl:otherwise>
149

  
150
			</xsl:otherwise>
151
		</xsl:choose>
152

  
153
		<b>
154
			<xsl:value-of select="concat('&lt;/',$tag,'&gt;')" />
155
		</b>
156

  
157
	</xsl:template>
158
	
42 159
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/emf_2_row.xslt
36 36
							<a href="{$url}"><xsl:value-of select="$url" /></a><br />
37 37
						</xsl:if>
38 38
						<br />
39
						<button class="btn btn-primary btn-sm" ng-click="getDocument('{$id}')">show record</button>
39
						<button class="btn btn-primary btn-sm" ng-click="getDocument('objidentifier', '{$id}')">show record</button>
40 40
					</td>
41 41
				</tr>
42 42
			</table>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_lightui_controllers.js
101 101
			$scope.search(1);
102 102
		}
103 103
		
104
		$scope.getDocument = function(id) {
105
			$scope.go('/doc/' + encodeURI(id)); 
104
		$scope.getDocument = function(field, id) {
105
			$scope.go('/doc/' + encodeURI(field) + '/' + encodeURI(id)); 
106 106
		} 
107 107
		
108 108
		$scope.browse();
......
120 120
		$scope.showSpinner();
121 121
		
122 122
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
123
		$http.post('lightui_get', $.param({
124
			'id' : $routeParams.id,
123
		$http.post('lightui_findone', $.param({
124
			'field' : $routeParams.field,
125
			'id'    : $routeParams.id
125 126
		})).success(function(data) {
126 127
		    $scope.hideSpinner();
127 128
		    $scope.documentHTML = data;
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_lightui.js
4 4
	'$routeProvider',
5 5
	function($routeProvider) {
6 6
		$routeProvider
7
           		.when('/form',                 { templateUrl: '../resources/html/lightUiForm.html',    controller: 'lightUiFormCtrl' })
7
           		.when('/form',           { templateUrl: '../resources/html/lightUiForm.html',    controller: 'lightUiFormCtrl' })
8 8
           		.when('/results/:query', { templateUrl: '../resources/html/lightUiResults.html', controller: 'lightUiResultsCtrl'   })
9
           		.when('/doc/:id',              { templateUrl: '../resources/html/lightUiDoc.html',     controller: 'lightUiDocCtrl'    })
9
           		.when('/doc/:field/:id', { templateUrl: '../resources/html/lightUiDoc.html',     controller: 'lightUiDocCtrl'    })
10 10
           		.otherwise({ redirectTo: '/form' });
11 11
	}
12 12
]);

Also available in: Unified diff