<commit_before><!DOCTYPE html>
<!--
/*
 *  This file is part of Renspur.
 *
 *  Copyright (C) 2017  leo.winter, burghard.britzke <EMAIL>
 *
 *  Rennspur is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Rennspur is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */
 -->
<ui:composition template="index.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="title">#{translation.event}</ui:define>
	<ui:define name="content">
		<div class="ui-fluid">
			<p:panelGrid columns="2" layout="grid"
				columnClasses="ui-grid-col-7,ui-grid-col-5">
				<p:panelGrid columns="2" layout="grid"
					styleClass="ui-panelgrid-blank"
					columnClasses="ui-grid-col-3,ui-grid-col-9">
					<p:outputLabel value="#{translation.club}" />

					<p:selectOneMenu value="#{selectedEventBean.event.club}"
						converter="#{clubConverter}"
						filter="#{fn:length(clubBean.clubs) gt 6}" autoWidth="false"
						styleClass="ui-grid-col-12">
						<f:selectItems value="#{clubBean.clubs}" var="club"
							itemLabel="#{club.name}" itemValue="#{club}">
						</f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="#{translation.name}" />
					<h:inputText id="name" value="#{selectedEventBean.event.name}"
						styleClass="ui-grid-col-12" />

					<p:outputLabel value="#{translation.handicap}" />
					<p:selectBooleanCheckbox id="handicap"
						value="#{selectedEventBean.event.handicap}" />
					<p:outputLabel value="#{translation.startDate}" />
					<p:calendar value="#{selectedEventBean.event.startDate}"
						navigator="true" pattern="dd.MM.yyyy"
						locale="#{view.locale.language}" />
					<p:outputLabel value="#{translation.endDate}" />
					<p:calendar value="#{selectedEventBean.event.endDate}"
						navigator="true" pattern="dd.MM.yyyy"
						locale="#{view.locale.language}" />
				</p:panelGrid>
				<p:dataTable id="races-datatable"
					value="#{selectedEventBean.event.races}" var="race">
					<f:facet name="header">#{translation.races}</f:facet>
					<f:facet name="footer">
						<p:panelGrid columns="2" styleClass="ui-panelgrid-blank">
							<p:commandButton icon="fa fa-minus"
								actionListener="#{raceBean.removeLast}" update="races-datatable"
								disabled="#{empty raceBean.races or not empty raceBean.races[raceBean.races.size()-1].waypoints}" />
							<p:commandButton icon="fa fa-plus"
								actionListener="#{raceBean.add}" update="races-datatable" />
						</p:panelGrid>
					</f:facet>
					<p:column headerText="#{translation.number}">
						<h:outputText value="#{race.number}" />
					</p:column>
					<p:column headerText="#{translation.finished}" disabled="true">
						<p:selectBooleanCheckbox value="#{race.finished}" />
					</p:column>
				</p:dataTable>
			</p:panelGrid>
			<h:inputHidden id="rs-map-latitude"
				value="#{selectedEventBean.event.latitude}" />
			<h:inputHidden id="rs-map-longitude"
				value="#{selectedEventBean.event.longitude}" />
			<h:inputHidden id="rs-map-resolution"
				value="#{selectedEventBean.event.resolution}" />
			<h:inputHidden id="rs-map-rotation"
				value="#{selectedEventBean.event.rotation}" />
			<h:outputStylesheet name="webjars/openlayers/4.0.1/ol.css" />
			<h:outputStylesheet name="rs.css" library="css" />
			<h:outputScript name="webjars/openlayers/4.0.1/ol-debug.js"
				target="head" />
			<h:outputScript name="rs-debug.js" library="js" target="head" />
			<div id="rs-map">
				<div id="rs-map">
					<select id="mapStyleList" title="Change Theme">
						<option>T</option>
						<option value="toner">Toner</option>
						<option value="terrain">Terrain</option>
						<option value="watercolor">Watercolor</option>
					</select>
				</div>
			</div>
			<script type="application/ecmascript">
				let rsMap = new rs.Map({
				    center : [  Number($("[id$='rs-map-longitude']").val()),
				                Number( $("[id$='rs-map-latitude']").val())],
					resolution : Number($("[id$='rs-map-resolution']").val()),
					rotation :   Number($("[id$='rs-map-rotation']").val()),
				    theme : 'toner',
				    userTheme_ : 'false'
				});
				rsMap.map.on("change:size", function(event){
				    let newValue = event.target.get(event.key);
				    // change in width of map determines change in resolution
				    // so that map shows the correct sector
				    let change = event.oldValue[1]/newValue[1];
				    let view = event.target.getView();
				    view.setResolution(view.getResolution()*change);
				    console.log(change);
				});
				rsMap.map.getView().on("change:center", function(event) {
				    let center = ol.proj.toLonLat(event.target.getCenter());
		            $("[id$='rs-map-longitude']").val(center[0]);
		            $("[id$='rs-map-latitude']").val(center[1]);
				});
				rsMap.map.getView().on("change:resolution",function(event){
				    $("[id$='rs-map-resolution']").val(event.target.getResolution());
				});
				rsMap.map.getView().on("change:rotation", function(event){<commit_msg>#38 watercolor is the default theme again<commit_after><!DOCTYPE html>
<!--
/*
 *  This file is part of Renspur.
 *
 *  Copyright (C) 2017  leo.winter, burghard.britzke <EMAIL>
 *
 *  Rennspur is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Rennspur is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */
 -->
<ui:composition template="index.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="title">#{translation.event}</ui:define>
	<ui:define name="content">
		<div class="ui-fluid">
			<p:panelGrid columns="2" layout="grid"
				columnClasses="ui-grid-col-7,ui-grid-col-5">
				<p:panelGrid columns="2" layout="grid"
					styleClass="ui-panelgrid-blank"
					columnClasses="ui-grid-col-3,ui-grid-col-9">
					<p:outputLabel value="#{translation.club}" />

					<p:selectOneMenu value="#{selectedEventBean.event.club}"
						converter="#{clubConverter}"
						filter="#{fn:length(clubBean.clubs) gt 6}" autoWidth="false"
						styleClass="ui-grid-col-12">
						<f:selectItems value="#{clubBean.clubs}" var="club"
							itemLabel="#{club.name}" itemValue="#{club}">
						</f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="#{translation.name}" />
					<h:inputText id="name" value="#{selectedEventBean.event.name}"
						styleClass="ui-grid-col-12" />

					<p:outputLabel value="#{translation.handicap}" />
					<p:selectBooleanCheckbox id="handicap"
						value="#{selectedEventBean.event.handicap}" />
					<p:outputLabel value="#{translation.startDate}" />
					<p:calendar value="#{selectedEventBean.event.startDate}"
						navigator="true" pattern="dd.MM.yyyy"
						locale="#{view.locale.language}" />
					<p:outputLabel value="#{translation.endDate}" />
					<p:calendar value="#{selectedEventBean.event.endDate}"
						navigator="true" pattern="dd.MM.yyyy"
						locale="#{view.locale.language}" />
				</p:panelGrid>
				<p:dataTable id="races-datatable"
					value="#{selectedEventBean.event.races}" var="race">
					<f:facet name="header">#{translation.races}</f:facet>
					<f:facet name="footer">
						<p:panelGrid columns="2" styleClass="ui-panelgrid-blank">
							<p:commandButton icon="fa fa-minus"
								actionListener="#{raceBean.removeLast}" update="races-datatable"
								disabled="#{empty raceBean.races or not empty raceBean.races[raceBean.races.size()-1].waypoints}" />
							<p:commandButton icon="fa fa-plus"
								actionListener="#{raceBean.add}" update="races-datatable" />
						</p:panelGrid>
					</f:facet>
					<p:column headerText="#{translation.number}">
						<h:outputText value="#{race.number}" />
					</p:column>
					<p:column headerText="#{translation.finished}" disabled="true">
						<p:selectBooleanCheckbox value="#{race.finished}" />
					</p:column>
				</p:dataTable>
			</p:panelGrid>
			<h:inputHidden id="rs-map-latitude"
				value="#{selectedEventBean.event.latitude}" />
			<h:inputHidden id="rs-map-longitude"
				value="#{selectedEventBean.event.longitude}" />
			<h:inputHidden id="rs-map-resolution"
				value="#{selectedEventBean.event.resolution}" />
			<h:inputHidden id="rs-map-rotation"
				value="#{selectedEventBean.event.rotation}" />
			<h:outputStylesheet name="webjars/openlayers/4.0.1/ol.css" />
			<h:outputStylesheet name="rs.css" library="css" />
			<h:outputScript name="webjars/openlayers/4.0.1/ol-debug.js"
				target="head" />
			<h:outputScript name="rs-debug.js" library="js" target="head" />
			<div id="rs-map">
				<div id="rs-map">
					<select id="mapStyleList" title="Change Theme">
						<option>T</option>
						<option value="toner">Toner</option>
						<option value="terrain">Terrain</option>
						<option value="watercolor">Watercolor</option>
					</select>
				</div>
			</div>
			<script type="application/ecmascript">
				let rsMap = new rs.Map({
				    center : [  Number($("[id$='rs-map-longitude']").val()),
				                Number( $("[id$='rs-map-latitude']").val())],
					resolution : Number($("[id$='rs-map-resolution']").val()),
					rotation :   Number($("[id$='rs-map-rotation']").val()),
				    theme : 'watercolor',
				    userTheme_ : 'false'
				});
				rsMap.map.on("change:size", function(event){
				    let newValue = event.target.get(event.key);
				    // change in width of map determines change in resolution
				    // so that map shows the correct sector
				    let change = event.oldValue[1]/newValue[1];
				    let view = event.target.getView();
				    view.setResolution(view.getResolution()*change);
				    console.log(change);
				});
				rsMap.map.getView().on("change:center", function(event) {
				    let center = ol.proj.toLonLat(event.target.getCenter());
		            $("[id$='rs-map-longitude']").val(center[0]);
		            $("[id$='rs-map-latitude']").val(center[1]);
				});
				rsMap.map.getView().on("change:resolution",function(event){
				    $("[id$='rs-map-resolution']").val(event.target.getResolution());
				});
				rsMap.map.getView().on("change:rotation", function(event){
{'fraction_non_alphanumeric': 0.182652793564746, 'fraction_numerical': 0.005945615108857218, 'mean_word_length': 3.62515163768702, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7639203', 'n_tokens_mistral': 4596, 'n_tokens_neox': 3776, 'n_words': 647}