[submodule "public/simplebox"]
path = public/simplebox
url = git://github.com/arenevier/simplebox.git
+[submodule "public/store.js"]
+ path = public/store.js
+ url = git://github.com/cloudhead/store.js.git
- pseudo.gif files has been generated with http://ajaxload.info/ generator and
is free for use.
+- layer-switcher-maximize-flipped.png is a flipped version of
+ layer-switcher-maximize.png from OpenLayers. As such it is licensed under a
+ modified BSD license.
===============================================================================
; This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
; and is published under the AGPL license. */
[production]
-scripts.idx = OpenLayers, ModifiablePath, prototype, simplebox, utils, syj
+scripts.idx = OpenLayers, ModifiablePath, prototype, simplebox, utils, syj, store
scripts.rawidx = OpenLayers, syjraw
scripts.login = prototype, utils, login
scripts.contact = prototype, utils, contact
protected function _jsRawLocaleStrings() {
$this->view->jslocales = array(
'osmAttribution' => __("Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"),
+ 'mapquestAttribution' => __("Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"),
);
}
'canResubmit' => __("Now, you can retry to save"),
'routeBy' => __("route by"),
'osmAttribution' => __("Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"),
+ 'mapquestAttribution' => __("Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"),
'pseudoChecking' => __("checking availibilty"),
'availablePseudo' => __("available pseudo"),
'unavailablePseudo' => __("unavailable pseudo"),
msgstr ""
"Project-Id-Version: syj\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-04-04 13:05+0200\n"
+"POT-Creation-Date: 2011-04-12 23:13+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: arno <arno@renevier.net>\n"
"Language-Team: arno <arno@renevier.net>\n"
msgstr "gpx export"
#: application/views/scripts/idx/index.phtml:112
-#: application/controllers/IdxController.php:182
+#: application/controllers/IdxController.php:183
msgid "duplicate"
msgstr "duplicate"
#: application/views/scripts/idx/index.phtml:114
-#: application/controllers/IdxController.php:180
+#: application/controllers/IdxController.php:181
msgid "edit"
msgstr "edit"
#: application/controllers/ContactController.php:121
#: application/controllers/NewpwdController.php:68
#: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:184
+#: application/controllers/IdxController.php:185
msgid "Value is required"
msgstr "Value is required"
msgstr "route by"
#: application/controllers/IdxController.php:177
+msgid "Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"
+msgstr "Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"
+
+#: application/controllers/IdxController.php:178
msgid "checking availibilty"
msgstr "checking availibilty"
-#: application/controllers/IdxController.php:178
+#: application/controllers/IdxController.php:179
msgid "available pseudo"
msgstr "available pseudo"
-#: application/controllers/IdxController.php:179
+#: application/controllers/IdxController.php:180
msgid "unavailable pseudo"
msgstr "unavailable pseudo"
-#: application/controllers/IdxController.php:181
+#: application/controllers/IdxController.php:182
msgid "create"
msgstr "create"
-#: application/controllers/IdxController.php:183
+#: application/controllers/IdxController.php:184
msgid "You have an unsaved route"
msgstr "You have an unsaved route"
-#: application/controllers/IdxController.php:185
+#: application/controllers/IdxController.php:186
msgid "no result"
msgstr "no result"
-#: application/controllers/IdxController.php:186
+#: application/controllers/IdxController.php:187
msgid "could not analyze file content"
msgstr "could not analyze file content"
msgstr ""
"Project-Id-Version: syj\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-04-04 13:05+0200\n"
+"POT-Creation-Date: 2011-04-12 23:13+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: arno <arno@renevier.net>\n"
"Language-Team: arno <arno@renevier.net>\n"
msgstr "export gpx"
#: application/views/scripts/idx/index.phtml:112
-#: application/controllers/IdxController.php:182
+#: application/controllers/IdxController.php:183
msgid "duplicate"
msgstr "dupliquer"
#: application/views/scripts/idx/index.phtml:114
-#: application/controllers/IdxController.php:180
+#: application/controllers/IdxController.php:181
msgid "edit"
msgstr "modifier"
#: application/controllers/ContactController.php:121
#: application/controllers/NewpwdController.php:68
#: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:184
+#: application/controllers/IdxController.php:185
msgid "Value is required"
msgstr "Le champ est requis"
msgstr "tracé par"
#: application/controllers/IdxController.php:177
+msgid "Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"
+msgstr "Carte par MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> et contributeurs, <a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>"
+
+#: application/controllers/IdxController.php:178
msgid "checking availibilty"
msgstr "vérification de la disponibilité"
-#: application/controllers/IdxController.php:178
+#: application/controllers/IdxController.php:179
msgid "available pseudo"
msgstr "pseudo disponible"
-#: application/controllers/IdxController.php:179
+#: application/controllers/IdxController.php:180
msgid "unavailable pseudo"
msgstr "pseudo non disponible"
-#: application/controllers/IdxController.php:181
+#: application/controllers/IdxController.php:182
msgid "create"
msgstr "créér"
-#: application/controllers/IdxController.php:183
+#: application/controllers/IdxController.php:184
msgid "You have an unsaved route"
msgstr "Vous avez un itinéraire non sauvegardé"
-#: application/controllers/IdxController.php:185
+#: application/controllers/IdxController.php:186
msgid "no result"
msgstr "pas de résultat"
-#: application/controllers/IdxController.php:186
+#: application/controllers/IdxController.php:187
msgid "could not analyze file content"
msgstr "impossible d'analyser le contenu du fichier"
msgstr ""
"Project-Id-Version: syj\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-04-04 13:05+0200\n"
+"POT-Creation-Date: 2011-04-12 23:13+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: S.Higashi <s_higash@mua.biglobe.ne.jp>\n"
"Language: \n"
msgstr "gpxにエクスポート"
#: application/views/scripts/idx/index.phtml:112
-#: application/controllers/IdxController.php:182
+#: application/controllers/IdxController.php:183
msgid "duplicate"
msgstr "複製"
#: application/views/scripts/idx/index.phtml:114
-#: application/controllers/IdxController.php:180
+#: application/controllers/IdxController.php:181
msgid "edit"
msgstr "編集"
#: application/controllers/ContactController.php:121
#: application/controllers/NewpwdController.php:68
#: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:184
+#: application/controllers/IdxController.php:185
msgid "Value is required"
msgstr "値が必要です"
msgstr "ルート作成者"
#: application/controllers/IdxController.php:177
+msgid ""
+"Map by MapQuest, <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> "
+"and contributors, <a href='http://creativecommons.org/licenses/by-"
+"sa/2.0/'>CC-BY-SA</a>"
+msgstr ""
+
+#: application/controllers/IdxController.php:178
msgid "checking availibilty"
msgstr "利用可能かチェック中"
-#: application/controllers/IdxController.php:178
+#: application/controllers/IdxController.php:179
msgid "available pseudo"
msgstr "利用出来るID"
-#: application/controllers/IdxController.php:179
+#: application/controllers/IdxController.php:180
msgid "unavailable pseudo"
msgstr "利用できないID"
-#: application/controllers/IdxController.php:181
+#: application/controllers/IdxController.php:182
msgid "create"
msgstr "作成"
-#: application/controllers/IdxController.php:183
+#: application/controllers/IdxController.php:184
msgid "You have an unsaved route"
msgstr "保存されていないルートがあります"
-#: application/controllers/IdxController.php:185
+#: application/controllers/IdxController.php:186
msgid "no result"
msgstr "結果がありません"
-#: application/controllers/IdxController.php:186
+#: application/controllers/IdxController.php:187
msgid "could not analyze file content"
msgstr "ファイル内容を分析できませんでした"
left: 0.5em;
}
+.olControlLayerSwitcher {
+ bottom: 4em;
+ top: auto;
+ left: 13px;
+ opacity: 0.75;
+ height: 6em;
+ max-width: intrinsic;
+ max-width: -moz-max-content;
+}
+
+/* setting opacity to .olControlLayerSwitcher does not work */
+.olControlLayerSwitcher .layersDiv,
+.olControlLayerSwitcher .maximizeDiv,
+.olControlLayerSwitcher .minimizeDiv
+{
+ filter:alpha(opacity=75);
+}
+
+.olControlLayerSwitcher .dataLayersDiv, .olControlLayerSwitcher .dataLbl {
+ display: none;
+}
+.olControlLayerSwitcher .layersDiv {
+ padding: 5px 12px 5px 36px;
+}
+.olControlLayerSwitcher .maximizeDiv {
+ top: -6em;
+}
+.olControlLayerSwitcher .minimizeDiv {
+ left: 4px;
+}
+
/*
* main message rules
*/
/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
and is published under the AGPL license. */
-.olControlPanZoom, .olControlAttribution {
+.olControlPanZoom, .olControlAttribution, .olControlLayerSwitcher {
display: none;
}
#message, #other-language, #menu, #user_area, #login_area, #newpwd_area, #termsofusearea, #footer, #map-overlay {
--- /dev/null
+../store.js/store.js
\ No newline at end of file
mode: 'view',
init: function() {
- var externalGraphic, baseURL, baseLayer, layerOptions, hidemessenger;
+ var externalGraphic, baseURL, osmLayer, layerOptions, hidemessenger, layerCode, parameters;
// is svg context, opera does not resolve links with base element is svg context
externalGraphic = styleMap.edit.styles.select.defaultStyle.externalGraphic;
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoom(),
+ this.createLayerSwitcher(),
new OpenLayers.Control.Attribution()
],
theme: null
});
- baseLayer = new OpenLayers.Layer.OSM("OSM", [
+ osmLayer = new OpenLayers.Layer.OSM("OSM", [
'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'],
- { wrapDateLine: true , attribution: SyjStrings.osmAttribution });
+ { wrapDateLine: true , attribution: SyjStrings.osmAttribution, layerCode: 'O'});
+
+ mapquestLayer = new OpenLayers.Layer.OSM("Mapquest", [
+ 'http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png'],
+ { wrapDateLine: true , attribution: SyjStrings.mapquestAttribution, layerCode: 'M'});
layerOptions = {format: OpenLayers.Format.WKT,
projection: WGS84,
attribution: SyjStrings.geomAttribution };
this.viewLayer = new OpenLayers.Layer.Vector("View Layer", layerOptions);
- this.map.addLayers([baseLayer, this.viewLayer]);
+ this.map.addLayers([osmLayer, mapquestLayer, this.viewLayer]);
+
+ this.map.setBaseLayer(mapquestLayer);
+ layerCode = null;
+ parameters = OpenLayers.Util.getParameters(window.location.href);
+ if (parameters.layer) {
+ layerCode = parameters.layer;
+ try {
+ store.remove('baselayer');
+ } catch(e) {}
+ } else {
+ try {
+ layerCode = store.get('baselayer');
+ } catch(e) {}
+ }
+
+ if (layerCode) {
+ layerCode = layerCode.toUpperCase();
+ var self = this;
+ $([osmLayer, mapquestLayer]).each(function(layer) {
+ if (layer.layerCode === layerCode) {
+ self.map.setBaseLayer(layer);
+ }
+ });
+ }
+
+
+ this.map.events.register("changebaselayer", this, this.saveBaseLayer);
if ($("edit-btn")) {
$("edit-btn").observe('click', function() {
SYJPathLength.update();
},
+ saveBaseLayer: function(data) {
+ try {
+ store.set('baselayer', data.layer.layerCode);
+ } catch(e) {}
+ },
+
+ createLayerSwitcher: function() {
+ var control = new OpenLayers.Control.LayerSwitcher({roundedCorner: false});
+ // XXX: we need to "live-patch" LayerSwitcher to use our icons. We use
+ // a regexp instead of a string in case OpenLayers is modified and in
+ // case browsers modify the function representation
+ control.loadContents = eval('(function() { return (' + control.loadContents.toString().replace(
+ /\s*=\s*imgLocation\s*\+\s*['"]layer-switcher-maximize\.png['"]\s*;/,
+ " = 'icons/layer-switcher-maximize-flipped.png';"
+ ) + ')}())');
+ var oldMaximizeControl = control.maximizeControl;
+ var self = this;
+ control.maximizeControl = (function(oldfunc) {
+ return function() {
+ oldfunc.apply(control, arguments);
+ self.messenger.hide();
+ };
+ }(control.maximizeControl));
+
+ return control;
+ },
+
initMaPos: function (aPos) {
var extent = null, center = null, zoom = 0;
map.style.height = map.offsetHeight.toString() + 'px';
}
+function mapquestLayer() {
+ return new OpenLayers.Layer.OSM("Mapquest", [
+ 'http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ 'http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png'],
+ { attribution: SyjStrings.mapquestAttribution});
+}
+
+function osmLayer() {
+ return new OpenLayers.Layer.OSM("OSM", [
+ 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
+ 'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
+ 'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'],
+ { attribution: SyjStrings.osmAttribution});
+}
+
function init() {
var map = new OpenLayers.Map('map', {
controls: [ new OpenLayers.Control.Attribution() ],
theme: null}),
- baseLayer = new OpenLayers.Layer.OSM("OSM", null, { attribution: SyjStrings.osmAttribution }),
+ parameters = OpenLayers.Util.getParameters(window.location.href),
+ baseLayer = null,
layerOptions = {format: OpenLayers.Format.WKT,
projection: WGS84,
viewLayer = new OpenLayers.Layer.Vector("View Layer", layerOptions),
wkt = new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 });
+ if (parameters.layer) {
+ switch (parameters.layer.toUpperCase()) {
+ case 'M':
+ baseLayer = mapquestLayer();
+ break;
+ case 'O':
+ baseLayer = osmLayer();
+ break;
+ }
+ }
+
+ if (!baseLayer) {
+ baseLayer = osmLayer();
+ }
+
map.addLayers([baseLayer, viewLayer]);
viewLayer.addFeatures([wkt.read(gInitialGeom.data)]);
extent = viewLayer.getDataExtent();
--- /dev/null
+Subproject commit 25c640b09962bcbf46a17e88817ce195118cfeac
return itself;
-}());
\ No newline at end of file
+}());
OpenLayers/Console.js
OpenLayers/Control/Attribution.js
OpenLayers/Control/DrawFeature.js
+OpenLayers/Control/LayerSwitcher.js
OpenLayers/Control/Navigation.js
OpenLayers/Control/DragFeature.js
OpenLayers/Control/PanZoom.js