Commit 5cd762f9 authored by barth23's avatar barth23
Browse files

Merge branch 'feature/register-list-view' into 'staging'

merge Feature/register-list-view into staging

See merge request ARCHITRAVE/SADE!10
parents 5943467c 7ea07d73
......@@ -591,4 +591,14 @@
<lang key="en">works</lang>
<lang key="fr">les œuvres</lang>
</word>
<word key="button_other">
<lang key="de">andere</lang>
<lang key="en">other</lang>
<lang key="fr">autre</lang>
</word>
<word key="button_unnamed">
<lang key="de">unbenannt</lang>
<lang key="en">unnamed</lang>
<lang key="fr">sans nom</lang>
</word>
</translation>
\ No newline at end of file
xquery version "3.1";
(:~
: This skript is launched on each click on a button of the register.html
: @author Florian Barth
:)
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare option exist:serialize "method=xhtml media-type=text/html";
(:
declare variable $button_parameter := "persons";
declare variable $language_parameter := "de";
declare variable $letter_value := "button_unnamed";
declare variable $letter_text := "unnamed";
:)
declare variable $button_parameter := request:get-parameter("button_parameter", ());
declare variable $language_parameter := request:get-parameter("$language_parameter", ());
declare variable $language_parameter := request:get-parameter("language_parameter", ());
declare variable $letter_value := request:get-parameter("letter_value_parameter", ());
declare variable $letter_text := request:get-parameter("letter_text_parameter", ());
declare variable $language :=
if ($language_parameter = "de") then "de"
else if ($language_parameter = "fr") then "fra"
else ();
declare variable $EntityNames :=
if ($button_parameter = "persons") then doc("/db/apps/sade-architrave/templates/register/persons.xml")//tei:person//tei:persName[@xml:lang=$language]
else if ($button_parameter = "places") then doc("/db/apps/sade-architrave/templates/register/places.xml")//tei:place//tei:placeName[@xml:lang=$language and @type='current']
else if ($button_parameter = "works") then doc("/db/apps/sade-architrave/templates/register/works.xml")//tei:item/tei:name[@xml:lang=$language]
else();
declare variable $entityClass :=
if ($button_parameter = "persons") then "persName"
else if ($button_parameter = "places") then "placeName"
else if ($button_parameter = "works") then "ArtWork"
else();
declare variable $entityAbbr :=
if ($button_parameter = "persons") then "psn"
else if ($button_parameter = "places") then "plc"
else if ($button_parameter = "works") then "wrk"
else();
declare variable $openEntity :=
if ($button_parameter = "persons") then "openPersName"
else if ($button_parameter = "places") then "openPlaceName"
else if ($button_parameter = "works") then "openArtWork"
else();
<div>
<script src="templates/js/registers.js"></script>
declare variable $entityElements :=
if ($button_parameter = "persons") then doc("/db/apps/sade-architrave/templates/register/persons.xml")//tei:person
else if ($button_parameter = "places") then doc("/db/apps/sade-architrave/templates/register/places.xml")//tei:place
else if ($button_parameter = "works") then doc("/db/apps/sade-architrave/templates/register/works.xml")//tei:item
else();
declare variable $letter_query :=
if ($letter_value = "button_other") then "^[^A-Za-zÄäÖöÜüÉéÎîÈè]"
else "^[" || $letter_value || "]";
<div>
<ul>
{
if ($button_parameter = "persons") then
for $person in doc("/db/apps/sade-architrave/templates/register/persons.xml")//tei:person//tei:persName[@xml:lang='de']
order by $person/text() (: text() puts empty entries at the end :)
return
<li><a>{$person}</a></li>
if ($letter_value = "button_unnamed") then <h2 style="margin-bottom: 5rem;"></h2>
else <h2>{string($letter_text)}</h2>
}
else if ($button_parameter = "places") then
for $place in doc("/db/apps/sade-architrave/templates/register/places.xml")//tei:place//tei:placeName[@xml:lang='de' and @type='current']
order by $place/text() (: text() puts empty entries at the end :)
return
<li><a class="placeName" href="#" onclick="openPlaceName('plc:textgrid:3pg0g')" textgriduri="plc:textgrid:3pg0g">{$place}</a></li>
{
if ($letter_value = "button_unnamed") then
for $EntityName at $pos in $EntityNames
(:
VARIABLE $tgUri DOESNT WORK HERE IN CONTRAST TO THE ELSE STATEMENT BELOW
let $tgUri := data($entityElements[$pos]/@xml:id)
:)
where $EntityName[not(text())]
return
element xhtml:li
{
element xhtml:a
{
attribute class {$entityClass},
attribute href {"#/"},
attribute onclick {$openEntity || "('" || $entityAbbr || ":" || data($entityElements[$pos]/@xml:id) || "')"},
attribute textgriduri {"('" || $entityAbbr || ":" || data($entityElements[$pos]/@xml:id) || "')"},
string($letter_text)
}
}
else if ($button_parameter = "works") then
for $item in doc("/db/apps/sade-architrave/templates/register/works.xml")//tei:item/tei:name[@xml:lang='de']
order by $item/text() (: text() puts empty entries at the end :)
else
for $EntityName at $pos in $EntityNames
let $tgUri := data($entityElements[$pos]/@xml:id)
where matches(string($EntityNames[$pos]), $letter_query)
order by $EntityName/text()
return
<li>{$item}</li>
else ()
element xhtml:li
{
element xhtml:a
{
attribute class {$entityClass},
attribute href {"#/"},
attribute onclick {$openEntity || "('" || $entityAbbr || ":" || $tgUri || "')"},
attribute textgriduri {"('" || $entityAbbr || ":" || $tgUri || "')"},
$EntityName
}
}
}
</ul>
</div>
\ No newline at end of file
<div data-template="templates:surround" data-template-with="templates/page_index.html" data-template-at="content-container">
<style>
.arch-list-view-content{
width: 81.25vw;
max-width: 1200px;
margin: 0px auto;
margin-top: 25px;
}
.arch-list-view-radio-slider{
margin-top:25px;
}
.arch-list-view-ul{
min-height: 38.5rem;
}
ul {
list-style: none;
/*width: 200px; */
text-indent: -20px; /* key property */
margin-left: 20px; /* key property */
}
li { margin-bottom: 10px; }
.btn-group > .btn:not(:first-child),
.btn-group:not(:first-child) {
margin-left: 0px; }
/*
.p-content {
width: 81.25vw;
max-width: 1200px;
margin: 0px auto; }
.arch-content {
min-height: 40rem; }
*/
</style>
<!-- error modal for error messages -->
<div data-template="templates:surround" data-template-with="templates/modal_error.html" data-template-at="content-container"/>
<!-- error modal for register entries -->
<div data-template="templates:surround" data-template-with="templates/modal_register.html" data-template-at="content-container"/>
<div id="content-container">
<div class="row arch-list-view-content p-content">
<div class="col-md-6 ">
<div class="arch-list-view-radio-slider">
<div class="btn-toolbar btn-group-toggle btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="register_button" id="option1" value="persons" autocomplete="off" checked="checked"/>
<i class="fas fa-user"/>
 
<span data-template="lang:translate" data-template-content="register_persons"/>
</label>
<label class="btn btn-primary">
<input type="radio" name="register_button" id="option2" value="places" autocomplete="off"/>
<i class="fas fa-map-marker-alt"/>
 
<span data-template="lang:translate" data-template-content="register_places"/>
</label>
<label class="btn btn-primary">
<input type="radio" name="register_button" id="option3" value="works" autocomplete="off"/>
<i class="fas fa-gem"/>
 
<span data-template="lang:translate" data-template-content="register_works"/>
</label>
</div>
</div>
<div class="arch-list-view-radio-slider">
<div class="btn-toolbar btn-group-toggle btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="letter_button" value="AaÄä" autocomplete="off" checked="checked"/>
A
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Bb" autocomplete="off"/>
B
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Cc" autocomplete="off"/>
C
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Dd" autocomplete="off"/>
D
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="EeÉéÈè" autocomplete="off"/>
E
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Ff" autocomplete="off"/>
F
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Gg" autocomplete="off"/>
G
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Hh" autocomplete="off"/>
H
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="IiÎî" autocomplete="off"/>
I
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Jj" autocomplete="off"/>
J
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Kk" autocomplete="off"/>
K
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Ll" autocomplete="off"/>
L
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Mm" autocomplete="off"/>
M
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Nn" autocomplete="off"/>
N
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="OoÖö" autocomplete="off"/>
O
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Pp" autocomplete="off"/>
P
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Qq" autocomplete="off"/>
Q
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Rr" autocomplete="off"/>
R
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Ss" autocomplete="off"/>
S
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Tt" autocomplete="off"/>
T
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="UuÜü" autocomplete="off"/>
U
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="Vv" autocomplete="off"/>
V
</label>
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="XYZxyz" autocomplete="off"/>
XYZ
</label>
<!--
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="button_other" autocomplete="off"/>
<span data-template="lang:translate" data-template-content="button_other"/>
</label>
-->
<label class="btn btn-primary">
<input type="radio" name="letter_button" value="button_unnamed" autocomplete="off"/>
<span data-template="lang:translate" data-template-content="button_unnamed"/>
</label>
</div>
</div>
</div>
<div id="register_content" class="col-md-6 arch-list-view-ul"/>
</div>
</div>
<script type="text/javascript" src="templates/js/jquery.browser.min.js"/>
<script type="text/javascript" src="templates/js/edition.js"/>
<script type="text/javascript" src="templates/js/registers.js"/>
<script>
// LOAD CONTENT FOR INITAL BUTTON
/////////////////////////////////
// LOAD INITIAL REGISTER BUTTON VALUE
var button_value = $("input[name='register_button']:checked").attr("value");
// LOAD PARAMETER FOR FIRST OPTION (persons) in selected language:
var language = $("span &gt; lang").attr("key");
// LOAD INITIAL LETTER VALUE
var letter_value = $("input[name='letter_button']:checked").attr("value");
var letter_text = $("input[name='letter_button']:checked").parent()[0].innerText;
$.post("modules/architrave/transform_register.xq",
{
button_parameter: button_value,
language_parameter: language,
letter_value_parameter: letter_value,
letter_text_parameter: letter_text
},
function(data,status){
$( '#register_content' ).html(data);
});
// HANDLING WHEN REGISTER RADIO BUTTON IS CHANGED
/////////////////////////////////
$("input[name='register_button']").change(function(){
// LOAD *CHANGED* VALUES
var button_value = $("input[name='register_button']:checked").attr("value");
var letter_value = $("input[name='letter_button']:checked").attr("value");
var letter_text = $("input[name='letter_button']:checked").parent()[0].innerText;
$.post("modules/architrave/transform_register.xq",
{
button_parameter: button_value,
language_parameter: language,
letter_value_parameter: letter_value,
letter_text_parameter: letter_text
},
function(data,status){
$( '#register_content' ).html(data);
});
});
// HANDLING WHEN LETTER BUTTON IS CHANGED
/////////////////////////////////
$("input[name='letter_button']").change(function(){
// LOAD *CHANGED* VALUES
var button_value = $("input[name='register_button']:checked").attr("value");
var letter_value = $("input[name='letter_button']:checked").attr("value");
var letter_text = $("input[name='letter_button']:checked").parent()[0].innerText;
$.post("modules/architrave/transform_register.xq",
{
button_parameter: button_value,
language_parameter: language,
letter_value_parameter: letter_value,
letter_text_parameter: letter_text
},
function(data,status){
$( '#register_content' ).html(data);
});
});
</script>
</div>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment