From abba49a44e3e3ae69cec3163223c1ba6edbf5193 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Tue, 3 Apr 2012 21:13:44 +0200 Subject: [PATCH] - added GUI support for language switching - first tests for support of printing --- WebContent/OSRM.GUI.js | 6 +- WebContent/images/printer.pdf | Bin 0 -> 4623 bytes WebContent/images/printer.png | Bin 0 -> 347 bytes WebContent/images/printer_active.png | Bin 0 -> 349 bytes WebContent/images/printer_hover.png | Bin 0 -> 350 bytes WebContent/images/printer_inactive.png | Bin 0 -> 322 bytes WebContent/localization/OSRM.Locale.de.js | 64 ++++++++++++++ WebContent/localization/OSRM.Locale.en.js | 64 ++++++++++++++ WebContent/localization/OSRM.Localization.js | 74 +++++++++++++++++ WebContent/main.css | 31 ++++++- WebContent/main.html | 18 ++-- WebContent/main.js | 7 +- WebContent/printing/OSRM.Printing.js | 60 ++++++++++++++ WebContent/printing/printing.html | 83 +++++++++++++++++++ 14 files changed, 395 insertions(+), 12 deletions(-) create mode 100644 WebContent/images/printer.pdf create mode 100644 WebContent/images/printer.png create mode 100644 WebContent/images/printer_active.png create mode 100644 WebContent/images/printer_hover.png create mode 100644 WebContent/images/printer_inactive.png create mode 100644 WebContent/localization/OSRM.Locale.de.js create mode 100644 WebContent/localization/OSRM.Locale.en.js create mode 100644 WebContent/localization/OSRM.Localization.js create mode 100644 WebContent/printing/OSRM.Printing.js create mode 100644 WebContent/printing/printing.html diff --git a/WebContent/OSRM.GUI.js b/WebContent/OSRM.GUI.js index b1ede611b..223c2a914 100644 --- a/WebContent/OSRM.GUI.js +++ b/WebContent/OSRM.GUI.js @@ -29,8 +29,10 @@ width: null, init: function() { OSRM.GUI.visible = true; OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; - - // translate +}, + +// set language dependent labels +setLanguage: function() { document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM"); document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS"); document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET"); diff --git a/WebContent/images/printer.pdf b/WebContent/images/printer.pdf new file mode 100644 index 0000000000000000000000000000000000000000..91928b90f9f740f0166bdd5e3d21720bbc00524c GIT binary patch literal 4623 zcmds5dpuNm8z*mMLKd-6>yScX&Y6oD*E z-4Yh;1f+PxHr|=XuWW_WZuj^ZPyDvxRJJ zs}C7qQCI*3*uFu)jvXj8l^GI9g+LHQGyqMq1RwxSqay!iW+*c=fX?zmTB2}Edbk}5 zp#x|#6^7{?7HUxtSs|gyV8J28t=a z5WpZV*fN;N@{lK!3e&CWG`1gII2IS?(5b%XOFF3Px@18dju@4S#6tNtVUUSh*OfgXo9l4YVH>#Z?Y<9*(n( zAtp2fEzyn{`^yV&#WQlN6))(~(mXStN873wk$bc%93`1iHpVx20lFM7OnY9aIxn3? zd%Rt9Ik3bfYhDC4fQ~|w*esaNg1LauDa7NYp@;&Ipy#k@u5=g)VlMBCY$3LLZ#6~Sw$wf0$z)W0-&wwVGJ6bVrS(o3`yazZ*mC`?!2(S zDCp^a4C=dt!6PsbaTp}XNgQ^F$c`fb1Uv*75db0xAulXB@QQXam4o;MU_^tzOKBrS zUkvU=+#uYCaXXR>330P|kv-BaM>*j<%Gdn)5K4&KjC0`4ksF#5;|_lG>SQlhtPG1j03AR8Mqr*JhU4WYtk&2 zexSUStk}6dcWc823tgO|eC<(y1+LzPB}in7`F%v-z6J3T{MQR%z3tMCbYGxIE*sc|@ zT&YTU?^uQ2oRA;&xw%z47k2K}T zxi*&?zB?Q&u;{OH{#v2_^u$%~sw?#*KJ`|*|S5iwJ`_9>X(=%HX zTRNSNm`|BjeRJB)s;h303Z9!)1P4-Bo)ro+pL%!I?T>7VjGk|ABOaq|Jfx%IRO8!K z@g@Fft8$kJ(+K9Z~kmo@7PQ${AC35yNt`@mo}Ze=segFcEHEDx@kZ!Z$Yv9SH-6V z)E(LmDwNaX8N(5G8P#3nq7$wclzi^y7sT7ERe6S|W}O_qo^vC!l$I98d@5k%a7kRE zQq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n!Ls-wF*J8cs8uD1F1^^YzcIMfty?8oct z`U`>-UZ02`Q-S<@&En39H#PsIP8=c-bD~Gyoi literal 0 HcmV?d00001 diff --git a/WebContent/localization/OSRM.Locale.de.js b/WebContent/localization/OSRM.Locale.de.js new file mode 100644 index 000000000..20094d1d6 --- /dev/null +++ b/WebContent/localization/OSRM.Locale.de.js @@ -0,0 +1,64 @@ +/* +This program 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 +any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM localization +// [German language support] + + +OSRM.Localization["de"] = { +//gui +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", +"GUI_START": "Start", +"GUI_END": "Ziel", +"GUI_RESET": "Reset", +"GUI_SEARCH": "Zeigen", +"GUI_REVERSE": "Umdrehen", +"GUI_OPTIONS": "Kartenwerkzeuge", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Unbenannte Straßen hervorheben", +"GUI_START_TOOLTIP": "Startposition eingeben", +"GUI_END_TOOLTIP": "Zielposition eingeben", +"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by KIT - Geocoder by OSM", +// geocoder +"SEARCH_RESULTS": "Suchergebnisse", +"TIMED_OUT": "Zeitüberschreitung", +"NO_RESULTS_FOUND": "Keine Ergebnisse gefunden", +"NO_RESULTS_FOUND_SOURCE": "Keine Ergebnisse gefunden für Start", +"NO_RESULTS_FOUND_TARGET": "Keine Ergebnisse gefunden für Ziel", +// routing +"ROUTE_DESCRIPTION": "Routenbeschreibung", +"GET_LINK_TO_ROUTE": "Generiere Link", +"GENERATE_LINK_TO_ROUTE": "Warte auf Antwort", +"LINK_TO_ROUTE_TIMEOUT": "nicht möglich", +"GPX_FILE": "GPX Datei", +"DISTANCE": "Distanz", +"DURATION": "Dauer", +"YOUR_ROUTE_IS_BEING_COMPUTED": "Ihre Route wird berechnet", +"NO_ROUTE_FOUND": "Keine Route hierher möglich", +// directions +"N": "Norden", +"O": "Ost", +"S": "Süden", +"W": "Westen", +"NO": "Nordost", +"SO": "Südost", +"SW": "Südwest", +"NW": "Nordwest" +}; + +// set GUI language on load +OSRM.GUI.setLanguage(); \ No newline at end of file diff --git a/WebContent/localization/OSRM.Locale.en.js b/WebContent/localization/OSRM.Locale.en.js new file mode 100644 index 000000000..686eb30bb --- /dev/null +++ b/WebContent/localization/OSRM.Locale.en.js @@ -0,0 +1,64 @@ +/* +This program 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 +any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM localization +// [English language support] + + +OSRM.Localization["en"] = { +//gui +"OPEN_JOSM": "JOSM", +"OPEN_OSMBUGS": "OSM Bugs", +"GUI_START": "Start", +"GUI_END": "End", +"GUI_RESET": "  Reset  ", +"GUI_SEARCH": "  Show  ", +"GUI_REVERSE": "Reverse", +"GUI_OPTIONS": "Mapping Tools", +"GUI_HIGHLIGHT_UNNAMED_ROADS": "Highlight unnamed streets", +"GUI_START_TOOLTIP": "Enter start", +"GUI_END_TOOLTIP": "Enter destination", +"GUI_LEGAL_NOTICE": "GUI2 v"+OSRM.VERSION+" "+OSRM.DATE+" - OSRM hosting by KIT - Geocoder by OSM", +// geocoder +"SEARCH_RESULTS": "Search Results", +"TIMED_OUT": "Timed Out", +"NO_RESULTS_FOUND": "No results found", +"NO_RESULTS_FOUND_SOURCE": "No results found for start", +"NO_RESULTS_FOUND_TARGET": "No results found for end", +//routing +"ROUTE_DESCRIPTION": "Route Description", +"GET_LINK_TO_ROUTE": "Generate Link", +"GENERATE_LINK_TO_ROUTE": "waiting for link", +"LINK_TO_ROUTE_TIMEOUT": "not available", +"GPX_FILE": "GPX File", +"DISTANCE": "Distance", +"DURATION": "Duration", +"YOUR_ROUTE_IS_BEING_COMPUTED": "Your route is being computed", +"NO_ROUTE_FOUND": "No route possible", +// directions +"N": "north", +"E": "east", +"S": "south", +"W": "west", +"NE": "northeast", +"SE": "southeast", +"SW": "southwest", +"NW": "northwest" +}; + +//set GUI language on load +OSRM.GUI.setLanguage(); \ No newline at end of file diff --git a/WebContent/localization/OSRM.Localization.js b/WebContent/localization/OSRM.Localization.js new file mode 100644 index 000000000..597e939b0 --- /dev/null +++ b/WebContent/localization/OSRM.Localization.js @@ -0,0 +1,74 @@ +/* +This program 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 +any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. +*/ + +// OSRM localization +// [basic localization options] + + +OSRM.Localization = { + +supported_languages: ["en", "de"], + +// initialize localization +init: function() { + // create dropdown menu + var select = document.createElement('select'); + select.id = "language-toggle"; + select.onchange = function() { OSRM.Localization.change(this.value); }; + + // fill dropdown menu + for(var i=0, size=OSRM.Localization.supported_languages.length; i English string -> input string +translate: function(text) { + if( OSRM.Localization[OSRM.DEFAULTS.LANGUAGE] && OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text] ) + return OSRM.Localization[OSRM.DEFAULTS.LANGUAGE][text]; + else if( OSRM.Localization["en"] && OSRM.Localization["en"][text] ) + return OSRM.Localization["en"][text]; + else + return text; +} +}; + +// shorter call to translate function +OSRM.loc = OSRM.Localization.translate; \ No newline at end of file diff --git a/WebContent/main.css b/WebContent/main.css index 31c9ec175..bbd4e86f8 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -112,9 +112,9 @@ html, body, #map { .main-toggle-out { cursor:pointer; - position:absolute; +/* position:absolute; right:5px; - top:5px; + top:5px;*/ width:16px; height:16px; background-image:url("images/cancel.png"); @@ -322,7 +322,6 @@ html, body, #map { user-select: text; } - /* buttons */ .button { @@ -348,7 +347,7 @@ html, body, #map { color:#FF0000; } - +/* delete marker */ .delete-marker { cursor:pointer; @@ -367,4 +366,28 @@ html, body, #map { .delete-marker:active { background-image:url("images/cancel_active.png"); +} + +/* printer button */ +.printer-inactive +{ + cursor:pointer; + width:16px; + height:16px; + background-image:url("images/printer_inactive.png"); +} +.printer +{ + cursor:pointer; + width:16px; + height:16px; + background-image:url("images/printer.png"); +} +.printer:hover +{ + background-image:url("images/printer_hover.png"); +} +.printer:active +{ + background-image:url("images/printer_active.png"); } \ No newline at end of file diff --git a/WebContent/main.html b/WebContent/main.html index 5d6787d60..939df3ea5 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -64,7 +64,8 @@ or see http://www.gnu.org/licenses/agpl.txt. - + + @@ -78,16 +79,23 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
+
-
+
-
-
+
+
+
+
+
+
+ + + diff --git a/WebContent/main.js b/WebContent/main.js index 76471caa7..1dc16984d 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -27,6 +27,7 @@ OSRM.init = function() { OSRM.prefetchImages(); OSRM.prefetchIcons(); + OSRM.Localization.init(); OSRM.GUI.init(); OSRM.Map.init(); OSRM.Routing.init(); @@ -53,7 +54,11 @@ OSRM.prefetchImages = function() { 'images/cancel_hover.png', 'images/restore.png', 'images/restore_active.png', - 'images/restore_hover.png' + 'images/restore_hover.png', + 'images/printer.png', + 'images/printer_active.png', + 'images/printer_hover.png', + 'images/printer_inactive.png' ]; for(var i=0; ia
b
"); + OSRM.printwindow.focus(); + + OSRM.printwindow.addEventListener("DOMContentLoaded", OSRM.Printing.x, false); +} + +}; \ No newline at end of file diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html new file mode 100644 index 000000000..01382ab0b --- /dev/null +++ b/WebContent/printing/printing.html @@ -0,0 +1,83 @@ + + + + + + + + + + + + +OSRM Website + + + + + + + + + + + + + + + + + + + + + +
+
+ + +