Project

General

Profile

1
<?xml version="1.0"?>
2

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

    
5
	<xsl:output omit-xml-declaration="yes" method="html" encoding="UTF-8" standalone="no" />
6

    
7
	<xsl:param name="profileId" />
8
	<xsl:param name="ifaceId" />
9
	<xsl:param name="protocol" />
10
	<xsl:param name="baseUrl" />
11
	<xsl:param name="compliance" />
12
	<xsl:param name="overrideCompliance" />
13
	<xsl:param name="typology" />
14
	<xsl:param name="prefix" />
15

    
16
	<xsl:template match="/">
17
		<div class="row" style="margin-bottom:20px;">
18
			<div class="col-xs-12 col-md-offset-2 col-md-8" style="border: 1px solid #dddddd; border-radius: 4px; padding: 20px">
19
				<xsl:apply-templates select="//CONFIGURATION" />
20
			</div>
21
		</div>
22
	</xsl:template>
23

    
24
	<xsl:template match="CONFIGURATION">
25

    
26
		<xsl:variable name="country" select="normalize-space(./COUNTRY)" />
27

    
28
		<form class="form-horizontal">
29
			<wf-form-row-static name="Datasource name" value="{./OFFICIAL_NAME}" />
30
			<xsl:choose>
31
				<xsl:when test="$typology = ./DATASOURCE_TYPE">
32
					<wf-form-row-static name="Typology" value="{$typology}" />
33
				</xsl:when>
34
				<xsl:otherwise>
35
					<wf-form-row-static name="Typology" value="{./DATASOURCE_TYPE} (datasource), {$typology} (API)" style="color: #dd9900" />
36
				</xsl:otherwise>
37
			</xsl:choose>
38
			<wf-form-row-static name="Institution" value="{./REPOSITORY_INSTITUTION}" url="{./REPOSITORY_WEBPAGE}" />
39
			<wf-form-row-static name="Contact email" value="{./ADMIN_INFO}" url="{./ADMIN_INFO}" />
40
			<xsl:choose>
41
				<xsl:when test="string-length($country) = 2">
42
					<wf-form-row-static name="Country" value="{$country}" img="/img/flags/{$country}.gif" />
43
				</xsl:when>
44
				<xsl:otherwise>
45
					<wf-form-row-static name="Country" value="-" />
46
				</xsl:otherwise>
47
			</xsl:choose>
48
			<wf-form-row-static name="Software typology" value="{./TYPOLOGY}" />
49
		
50
			<hr />
51

    
52
			<div class="form-group" ng-init="newCompatibilityLevel='{$overrideCompliance}'" ng-class="{{'has-warning': newCompatibilityLevel}}">
53
				<label class="col-sm-3 control-label">Level of compliance</label>
54
				<div class="col-sm-9">
55
					<select class="form-control" ng-model="newCompatibilityLevel" ng-change="updateCompatibilityLevel('{$profileId}', '{$ifaceId}', newCompatibilityLevel)">
56
						<xsl:for-each select="//extra_info/compatibilityLevels/level">
57
							<option value="{.}">
58
								<xsl:value-of select="concat(., ' (override)')" />
59
							</option>
60
						</xsl:for-each>
61
						<option disabled="disabled" style="border-top: 1px solid lightgrey; margin-top: 10px;" value="-"></option>
62
						<option value="">
63
							<xsl:value-of select="concat($compliance, ' (by validator)')" />
64
						</option>
65
					</select>
66
				</div>
67
			</div>
68
				
69
			<hr />
70

    
71
			<wf-form-row-static name="API id" value="{$ifaceId}" />
72
			<wf-form-row-static name="Datasource id" value="{./DATASOURCE_ORIGINAL_ID}" />
73
			<wf-form-row-static name="Datasource prefix" value="{$prefix}" />
74
			<wf-form-row-static name="Profile Id" value="{$profileId}" url="is#/profile/{$profileId}" />
75
			
76
			<xsl:if test="//extra_info/extraFields/field[@name = 'last_collection_date'] and //extra_info/extraFields/field[@name = 'last_collection_mdId'] and //extra_info/extraFields/field[@name = 'last_collection_total']">
77
				<hr />
78
				<wf-form-row-store-link name="Last collection" 
79
					date="{//extra_info/extraFields/field[@name = 'last_collection_date']}" 
80
					total="{//extra_info/extraFields/field[@name = 'last_collection_total']}" 
81
					url="../inspector/mdstore.do?id={//extra_info/extraFields/field[@name = 'last_collection_mdId']}" />
82
			</xsl:if>
83
		
84
			<xsl:if test="//extra_info/extraFields/field[@name = 'last_aggregation_date'] and //extra_info/extraFields/field[@name = 'last_aggregation_mdId'] and //extra_info/extraFields/field[@name = 'last_aggregation_total']">
85
				<hr />
86
				<wf-form-row-store-link name="Last aggregation" 
87
					date="{//extra_info/extraFields/field[@name = 'last_aggregation_date']}" 
88
					total="{//extra_info/extraFields/field[@name = 'last_aggregation_total']}" 
89
					url="../inspector/mdstore.do?id={//extra_info/extraFields/field[@name = 'last_aggregation_mdId']}" />
90
			</xsl:if>
91
			
92
			<xsl:if test="//extra_info/extraFields/field[@name = 'last_download_date'] and //extra_info/extraFields/field[@name = 'last_download_objId'] and //extra_info/extraFields/field[@name = 'last_download_total']">
93
				<hr />
94
				<wf-form-row-store-link name="Last download" 
95
					date="{//extra_info/extraFields/field[@name = 'last_download_date']}" 
96
					total="{//extra_info/extraFields/field[@name = 'last_download_total']}" 
97
					url="objectstoreInspector.do#/inspect.do/{//extra_info/extraFields/field[@name = 'last_download_objId']}" />
98
			</xsl:if>
99
			
100
			<hr />
101

    
102
			<div class="form-group">
103
				<label class="col-sm-3 control-label">Access Protocol</label>
104
				<div class="col-sm-9">
105
					<p class="form-control-static">
106
						<table class="table table-condensed table-striped">
107
							<tr>
108
								<th colspan="2">Protocol</th>
109
								<td class="col-xs-9">
110
									<xsl:value-of select="$protocol" />
111
									<xsl:if test="$protocol = 'oai' or $protocol = 'OAI'">
112
										<a href="oaiExplorer?oaiBaseUrl={$baseUrl}" class="btn btn-xs btn-primary pull-right">verify</a>
113
									</xsl:if>
114
								</td>
115
							</tr>
116
							<tr>
117
								<th colspan="2">Base URL</th>
118
								<td>
119
									<a href="{$baseUrl}">
120
										<xsl:value-of select="$baseUrl" />
121
									</a>
122
								</td>
123
							</tr>
124

    
125
							<xsl:variable name="countParams" select="count(//extra_info/parameters/param)" />
126
							<xsl:for-each select="//extra_info/parameters/param">
127
								<tr>
128
									<xsl:if test="position() = 1">
129
										<th rowspan="{$countParams}" class="col-xs-2">Parameters</th>
130
									</xsl:if>
131
									<td class="col-xs-2">
132
										<i>
133
											<xsl:value-of select="@name" />
134
										</i>
135
									</td>
136
									<td class="col-xs-8">
137
										<xsl:value-of select="." />
138
									</td>
139
								</tr>
140
							</xsl:for-each>
141
						</table>
142

    
143
					</p>
144
				</div>
145
			</div>
146
			<div class="form-group">
147
				<div class="col-sm-offset-3 col-sm-9">
148
					<button type="button" class="btn btn-sm btn-primary" ng-click="editAccessParams()">configure</button>
149
				</div>
150
			</div>
151
	
152
			<hr />
153
	
154
			<div class="form-group">
155
				<label class="col-sm-3 control-label">API Extra fields</label>
156
				<div class="col-sm-9">
157
					<p class="form-control-static">
158
						<table class="table table-condensed table-striped">
159
							<xsl:for-each select="//extra_info/extraFields/field[not(starts-with(@name, 'last_collection_') or starts-with(@name, 'last_aggregation_') or starts-with(@name, 'last_download_'))]">
160
								<tr>
161
									<th class="col-xs-4">
162
										<xsl:value-of select="@name" />
163
									</th>
164
									<td class="col-xs-8">
165
										<xsl:value-of select="." />
166
									</td>
167
								</tr>
168
							</xsl:for-each>
169
						</table>
170
					</p>
171
				</div>
172
			</div>
173
		
174
			<hr />
175

    
176
			<div class="form-group">
177
				<label class="col-sm-3 control-label">Related workflows</label>
178
				<div class="col-sm-9">
179
					<p class="form-control-static">
180
						<xsl:choose>
181
							<xsl:when test="count(//workflows/workflow) = 0">
182
								No workflows							
183
							</xsl:when>
184
							<xsl:otherwise>
185
								<xsl:for-each select="//workflows/workflow">
186
									<a href="workflows.do#/wf/{@id}"><xsl:value-of select="@name" /></a>
187
									<xsl:if test="@destroy">
188
										<button class="btn btn-sm btn-primary pull-right" ng-click="destroyRepoWorkflow('{@id}')">delete</button>
189
									</xsl:if>
190
									<br />
191
									<xsl:if test="@description">
192
										<span class="small text-muted">
193
											<xsl:value-of select="@description"/><br />
194
										</span>
195
									</xsl:if>
196
									<hr />
197
								</xsl:for-each>
198
							</xsl:otherwise>
199
						</xsl:choose>
200
					</p>
201
				</div>
202
			</div>
203
			
204
			<div class="form-group">
205
				<div class="col-sm-offset-3 col-sm-9">
206
					<xsl:variable name="definitiveCompliance">
207
						<xsl:choose>
208
							<xsl:when test="$overrideCompliance">
209
								<xsl:value-of select="$overrideCompliance" />
210
							</xsl:when>
211
							<xsl:otherwise>
212
								<xsl:value-of select="$compliance" />
213
							</xsl:otherwise>
214
						</xsl:choose>
215
					</xsl:variable>
216
					<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#addWorkflowModal"
217
						ng-click="findRepoHiWorkflows('{normalize-space($definitiveCompliance)}', '{normalize-space($typology)}')">
218
						add workflow
219
					</button>
220
					<button type="button" class="btn btn-sm btn-default pull-right" ng-click="refresh()">
221
						<span class="glyphicon glyphicon-refresh"></span>
222
					</button>
223
				</div>
224
			</div>
225
		</form>
226
				
227
		<wf-process-modal proc-id="currentProcId" visible="showProcModal" />
228
		<repo-access-params-modal ds-id="{$profileId}" iface="{$ifaceId}" protocol="{$protocol}" visible="showAccessParamsModal" reload="1" />
229
						
230
		<div id="addWorkflowModal" class="modal fade" tabindex="-1" role="dialog">
231
			<div class="modal-dialog modal-lg">
232
				<div class="modal-content">
233
					<div class="modal-header">
234
						<button type="button" class="close" data-dismiss="modal">
235
							<xsl:text disable-output-escaping="yes"><![CDATA[&times;]]></xsl:text>
236
						</button>
237
						<h4 class="modal-title">Select workflow</h4>
238
					</div>
239
					<div class="modal-body">
240
						<div ng-repeat="e in availableRepohiWfs" class="panel panel-default">
241
							<div class="panel-heading">
242
								<a ng-click="newRepoWorkflow('{$profileId}', '{$ifaceId}', e.id)" data-dismiss="modal" href="javascript:void(0)">{{e.name}}</a>
243
								<a href="isManager.do#/profile/{{{{e.id}}}}" class="pull-right">[link]</a>
244
								<br /><span class="text-muted small">{{e.description}}</span>
245
							</div>
246
							<table class="table table-striped table-condensed small">
247
								<tr>
248
									<th class="col-xs-3 text-right">Typology prefixes</th>
249
									<td>{{e.ifaceTypes.join()}}</td>
250
								</tr><tr>
251
									<th class="col-xs-3 text-right">Compliance prefixes</th>
252
									<td>{{e.compliances.join()}}</td>
253
								</tr><tr ng-repeat="f in e.fields">
254
									<th class="col-xs-3 text-right">{{f.k}}</th>
255
									<td>{{f.v}}</td>
256
								</tr>
257
							</table>
258
						</div>
259
					</div>
260
					<div class="modal-footer">
261
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
262
					</div>
263
				</div>
264
			</div>
265
		</div>
266
	</xsl:template>
267

    
268
</xsl:stylesheet>
(1-1/3)