Skip to content

Commit

Permalink
Updated recommendation search form and export header.
Browse files Browse the repository at this point in the history
  • Loading branch information
margaretha committed Jul 8, 2021
1 parent 420dd0e commit ae0842e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 17 deletions.
41 changes: 32 additions & 9 deletions SIS/clarin/modules/recommended-formats.xql
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,28 @@ declare function rf:print-recommendation($type) {
()
};

declare function rf:print-centers() {
declare function rf:print-centers($center) {
for $c in data($center:centers/@id)
return
<option value="{$c}">{$c}</option>
if ($c eq $center)
then
(<option value="{$c}" selected="selected">{$c}</option>)
else
(<option value="{$c}">{$c}</option>)
};

declare function rf:print-domains() {
declare function rf:print-domains($domainId) {
for $d in $format:domains
let $id := $d/@id
return
<option value="{$d/@id}">{$d/name/text()}</option>
if ($id eq $domainId)
then
<option value="{$id}" selected="selected">{$d/name/text()}</option>
else
<option value="{$id}">{$d/name/text()}</option>
};

(: deprecated
declare function rf:print-domains($path) {
let $size := count($format:domains)
let $lastDomain := $format:domains[$size]
Expand All @@ -70,6 +80,14 @@ declare function rf:print-domains($path) {
($link, " | ")
else
($link)
};:)

declare function rf:print-option($selected, $value,$label) {
if ($selected eq $value)
then
<option value="{$value}" selected="selected">{$label}</option>
else
<option value="{$value}">{$label}</option>
};

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

return
<result>
<filter>
<center>{$center}</center>
<domain>{$domainName}</domain>
<level>{rf:print-recommendation-level($recommendationType)}</level>
</filter>
<header>
<title>CLARIN Standards Information System (SIS) export</title>
<url>{app:link("views/recommended-formats-with-search.xq")}</url>
<date>{fn:current-dateTime()}</date>
<filter>
<center>{$center}</center>
<domain>{$domainName}</domain>
<level>{rf:print-recommendation-level($recommendationType)}</level>
</filter>
</header>
<formats>{$rows}</formats>
</result>

Expand Down
16 changes: 8 additions & 8 deletions SIS/clarin/views/recommended-formats-with-search.xq
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ else
<tr>
<td>
<select name="center" class="inputSelect" style="width:200px;">
<option value="" selected="selected">Select centre ...</option>
{rf:print-centers()}
{rf:print-option($center, "", "Select centre ...")}
{rf:print-centers($center)}
</select>
</td>
<td>
<select name="domain" class="inputSelect" style="width:200px;">
<option value="" selected="selected">Select domain ...</option>
{rf:print-domains()}
{rf:print-option($domainId, "", "Select domain ...")}
{rf:print-domains($domainId)}
</select>
</td>
<td>
<select name="type" class="inputSelect" style="width:200px;">
<option value="" selected="selected">Select recommendation ...</option>
<option value="1">recommended</option>
<option value="2">acceptable</option>
<option value="3">deprecated</option>
{rf:print-option($recommendationType, "", "Select recommendation ...")}
{rf:print-option($recommendationType, "1", "recommended")}
{rf:print-option($recommendationType, "2", "acceptable")}
{rf:print-option($recommendationType, "3", "deprecated")}
</select>
</td>
<td>
Expand Down

0 comments on commit ae0842e

Please sign in to comment.