Commit be933d28 authored by Clouard Regis's avatar Clouard Regis
Browse files

Revised print map

parent 28d79f03
......@@ -92,7 +92,7 @@ function previewXml(data, divXml) {
} else if (index === total - 1) {
indexCell.innerHTML = "Arr."
} else {
indexCell.innerHTML = index;
indexCell.innerHTML = "" + index;
}
let nameCell = document.createElement("td");
nameCell.innerHTML = value[0];
......@@ -122,7 +122,7 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
img.src = response.url;
} else {
let error = document.getElementById("map-not-found");
error.style.display="block";
error.style.display = "block";
img.width = 0;
img.height = 0;
overlay.setUrl("/empty");
......@@ -159,7 +159,7 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
function addControlPointOnMap(data, map) {
for (let [key, value] of Object.entries(data.xml2)) {
a = L.circleMarker(value, {
const a = L.circleMarker(value, {
radius: 8.0,
fillColor: '#ff0000',
color: '#000000',
......@@ -177,15 +177,15 @@ function showPreview(data, divXml, divMap, divLeaflet, map, overlay, img) {
addControlPointOnMap(data, map);
}
function printMap(imageURL){ //see library printJS for further print options.
// see library printJS for further print options.
function printMap(imageURL) {
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.print();
}
function switchMapDisplay(overlay, overlayOpacity){
function switchMapDisplay(overlay, overlayOpacity) {
let hideButton = document.getElementById("hide-map");
let showButton = document.getElementById("show-map");
overlayOpacity === 100 ? (overlayOpacity = 0, hideButton.style.display = "block", showButton.style.display = "none" ) : (overlayOpacity = 100, hideButton.style.display = "none", showButton.style.display = "block" ) ;
overlayOpacity === 100 ? (overlayOpacity = 0, hideButton.style.display = "block", showButton.style.display = "none") : (overlayOpacity = 100, hideButton.style.display = "none", showButton.style.display = "block");
overlay.setOpacity(overlayOpacity);
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ final class Version20210421121523 extends AbstractMigration
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE course ADD printable TINYINT(1) NOT NULL DEFAULT false');
$this->addSql('ALTER TABLE missing_control_point RENAME INDEX idx_d3f3931591cc992 TO IDX_52AD13B591CC992');
/*$this->addSql('ALTER TABLE missing_control_point RENAME INDEX idx_d3f3931591cc992 TO IDX_52AD13B591CC992');*/
$this->addSql('ALTER TABLE track CHANGE format format INT NOT NULL');
$this->addSql('ALTER TABLE user CHANGE email email LONGTEXT NOT NULL');
}
......@@ -34,7 +34,7 @@ final class Version20210421121523 extends AbstractMigration
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE course DROP printable');
$this->addSql('ALTER TABLE missing_control_point RENAME INDEX idx_52ad13b591cc992 TO IDX_D3F3931591CC992');
/*$this->addSql('ALTER TABLE missing_control_point RENAME INDEX idx_52ad13b591cc992 TO IDX_D3F3931591CC992');*/
$this->addSql('ALTER TABLE track CHANGE format format INT DEFAULT 0');
$this->addSql('ALTER TABLE user CHANGE email email TEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
}
......
......@@ -121,7 +121,7 @@ class CourseValidator
public static function checkPrintable(bool $printable): int
{
if ($printable !== true && $printable !== false) {
if ($printable !== true && $printable !== false) { // TODO Simplify
return self::$ERROR_COURSE_PRINTABLE_INVALID;
}
......
......@@ -60,7 +60,7 @@ class CreateCourse
return $data;
}
private function generatePreviewXml1(string $xml)
private function generatePreviewXml1(string $xml) // TODO 1 ?
{
$error = CourseValidator::checkXml($xml);
if ($error == CourseValidator::$NO_ERROR) {
......@@ -79,7 +79,7 @@ class CreateCourse
}
}
private function generatePreviewXml2(string $xml)
private function generatePreviewXml2(string $xml) // TODO 2 ?
{
$error = CourseValidator::checkXml($xml);
if ($error == CourseValidator::$NO_ERROR) {
......@@ -121,7 +121,7 @@ class CreateCourse
{
$data = array();
$post = $request->request;
if ($post->get("xml") == "true") { // TODO Strange test, why not if ($post->get("xml")) {
if ($post->get("xml") == "true") {
$xml = file_get_contents(FileUploader::getFile($this->user->getId(), "xml"));
$data["xml1"] = $this->generatePreviewXml1($xml);
$data["xml2"] = $this->generatePreviewXml2($xml);
......
......@@ -55,7 +55,7 @@
printableMap.print();
}
function switchMapDisplay(){
function switchMapDisplay(){ // TODO new
let hideButton = document.getElementById("hide-map");
let showButton = document.getElementById("show-map");
overlayOpacity === 100 ? (overlayOpacity = 0, hideButton.style.display = "block", showButton.style.display = "none" ) : (overlayOpacity = 100, hideButton.style.display = "none", showButton.style.display = "block" ) ;
......
Markdown is supported
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