Skip to content

Commit ae0842e

Browse files
committed
Updated recommendation search form and export header.
1 parent 420dd0e commit ae0842e

File tree

2 files changed

+40
-17
lines changed

2 files changed

+40
-17
lines changed

SIS/clarin/modules/recommended-formats.xql

+32-9
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,28 @@ declare function rf:print-recommendation($type) {
4545
()
4646
};
4747

48-
declare function rf:print-centers() {
48+
declare function rf:print-centers($center) {
4949
for $c in data($center:centers/@id)
5050
return
51-
<option value="{$c}">{$c}</option>
51+
if ($c eq $center)
52+
then
53+
(<option value="{$c}" selected="selected">{$c}</option>)
54+
else
55+
(<option value="{$c}">{$c}</option>)
5256
};
5357

54-
declare function rf:print-domains() {
58+
declare function rf:print-domains($domainId) {
5559
for $d in $format:domains
60+
let $id := $d/@id
5661
return
57-
<option value="{$d/@id}">{$d/name/text()}</option>
62+
if ($id eq $domainId)
63+
then
64+
<option value="{$id}" selected="selected">{$d/name/text()}</option>
65+
else
66+
<option value="{$id}">{$d/name/text()}</option>
5867
};
5968

69+
(: deprecated
6070
declare function rf:print-domains($path) {
6171
let $size := count($format:domains)
6272
let $lastDomain := $format:domains[$size]
@@ -70,6 +80,14 @@ declare function rf:print-domains($path) {
7080
($link, " | ")
7181
else
7282
($link)
83+
};:)
84+
85+
declare function rf:print-option($selected, $value,$label) {
86+
if ($selected eq $value)
87+
then
88+
<option value="{$value}" selected="selected">{$label}</option>
89+
else
90+
<option value="{$value}">{$label}</option>
7391
};
7492

7593
declare function rf:print-recommendation-level($recommendationNumber) {
@@ -222,11 +240,16 @@ declare function rf:export-table($center, $domainId, $recommendationType, $nodes
222240

223241
return
224242
<result>
225-
<filter>
226-
<center>{$center}</center>
227-
<domain>{$domainName}</domain>
228-
<level>{rf:print-recommendation-level($recommendationType)}</level>
229-
</filter>
243+
<header>
244+
<title>CLARIN Standards Information System (SIS) export</title>
245+
<url>{app:link("views/recommended-formats-with-search.xq")}</url>
246+
<date>{fn:current-dateTime()}</date>
247+
<filter>
248+
<center>{$center}</center>
249+
<domain>{$domainName}</domain>
250+
<level>{rf:print-recommendation-level($recommendationType)}</level>
251+
</filter>
252+
</header>
230253
<formats>{$rows}</formats>
231254
</result>
232255

SIS/clarin/views/recommended-formats-with-search.xq

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ else
4646
<tr>
4747
<td>
4848
<select name="center" class="inputSelect" style="width:200px;">
49-
<option value="" selected="selected">Select centre ...</option>
50-
{rf:print-centers()}
49+
{rf:print-option($center, "", "Select centre ...")}
50+
{rf:print-centers($center)}
5151
</select>
5252
</td>
5353
<td>
5454
<select name="domain" class="inputSelect" style="width:200px;">
55-
<option value="" selected="selected">Select domain ...</option>
56-
{rf:print-domains()}
55+
{rf:print-option($domainId, "", "Select domain ...")}
56+
{rf:print-domains($domainId)}
5757
</select>
5858
</td>
5959
<td>
6060
<select name="type" class="inputSelect" style="width:200px;">
61-
<option value="" selected="selected">Select recommendation ...</option>
62-
<option value="1">recommended</option>
63-
<option value="2">acceptable</option>
64-
<option value="3">deprecated</option>
61+
{rf:print-option($recommendationType, "", "Select recommendation ...")}
62+
{rf:print-option($recommendationType, "1", "recommended")}
63+
{rf:print-option($recommendationType, "2", "acceptable")}
64+
{rf:print-option($recommendationType, "3", "deprecated")}
6565
</select>
6666
</td>
6767
<td>

0 commit comments

Comments
 (0)