X-Git-Url: https://dev.renevier.net/gitweb.cgi?p=syp.git;a=blobdiff_plain;f=js%2Fadmin.js;h=48c1eed55637c4af755de547eca9c3f1a9e5d1cf;hp=c7be3dbb00abedaf53790952a4459e23bee1ea39;hb=c58963cfcd8a6ec3cd5374af8412c883b38e1a38;hpb=57511b4efd7402ef58de66ac1fe2c01ed1b1d7b5 diff --git a/js/admin.js b/js/admin.js index c7be3db..48c1eed 100644 --- a/js/admin.js +++ b/js/admin.js @@ -56,12 +56,10 @@ OpenLayers.Control.SypDragFeature = OpenLayers.Class (OpenLayers.Control.DragFea var Admin = { Settings: { - MARKER_ICON: "openlayers/img/marker-blue.png", - MARKER_ICON_HEIGHT: 25, - MARKER_SELECT_ICON: "openlayers/img/marker-green.png", - MARKER_SELECT_ICON_HEIGHT: 25, - MARKER_TEMPORARY_ICON: "openlayers/img/marker-gold.png", - MARKER_TEMPORARY_ICON_HEIGHT: 25 + MARKER_ICON: "media/marker-normal.png", + MARKER_SELECT_ICON: "media/marker-selected.png", + MARKER_TEMPORARY_ICON: "media/marker-temp.png", + MARKER_HEIGHT: 25 }, map: null, @@ -123,7 +121,7 @@ var Admin = { this.moveFeatureControl.deactivate(); this.selFeatureControl.activate(); this.checkForFeatures(); - $("#newfeature_button").show().val("ajouter un emplacement"); + $("#newfeature_button").show().val(SypStrings.AddItem); $("#newfeature_button").unbind("click").click(function () { Admin.addNewFeature(); }); @@ -137,18 +135,15 @@ var Admin = { var styleMap = new OpenLayers.StyleMap ( {"default": { externalGraphic: this.Settings.MARKER_ICON, - graphicHeight: this.Settings.MARKER_ICON_HEIGHT - || 32 + graphicHeight: this.Settings.MARKER_HEIGHT || 32 }, "temporary": { externalGraphic: this.Settings.MARKER_TEMPORARY_ICON, - graphicHeight: this.Settings.MARKER_TEMPORARY_ICON_HEIGHT - || 32 + graphicHeight: this.Settings.MARKER_HEIGHT || 32 }, "select": { externalGraphic: this.Settings.MARKER_SELECT_ICON, - graphicHeight: this.Settings.MARKER_SELECT_ICON_HEIGHT - || 32 + graphicHeight: this.Settings.MARKER_HEIGHT || 32 }}); var layer = new OpenLayers.Layer.GML("KML", "items.php", @@ -230,7 +225,7 @@ var Admin = { this.currentFeature = feature; this.currentFeatureLocation = new OpenLayers.Pixel(feature.geometry.x, feature.geometry.y); $("#editor").show(); - $("#instructions").text("Vous pouvez déplacer le marqueur en effectuant un glisser-déposer."); + $("#instructions").text(SypStrings.DragDropHowto); $("#title").val(feature.attributes.name); var fullDesc = $(feature.attributes.description).parent(); $("#description").val(fullDesc.find('p').text()); @@ -250,11 +245,13 @@ var Admin = { checkForFeatures: function () { if (this.dataLayer.features.length != 0) { - $("#instructions").text("Pour modifier les données d'une image, sélectionnez le marqueur correspondant."); + $("#instructions").text(SypStrings.SelectHowto); } }, addNewFeature: function () { + alert (SypStrings.DisabledForDemo); + return; function cancel() { $(document).unbind("keydown"); Admin.reset() @@ -269,7 +266,7 @@ var Admin = { $("#newfeature_button").val("annuler"); $("#newfeature_button").unbind("click").click(cancel); - $("#instructions").text("Cliquez sur la carte pour ajouter un marqueur."); + $("#instructions").text(SypStrings.AddHowto); this.selFeatureControl.deactivate(); this.addFeatureControl.activate(); FeatureMgr.reset(); @@ -358,11 +355,14 @@ var FeatureMgr = { }, del: function (feature) { + alert (SypStrings.DisabledForDemo); + return; var form = $("#feature_delete"); form.find('input[name="fid"]').val(feature.fid); AjaxMgr.add({ form: form, - oncomplete: OpenLayers.Function.bind(this.ajaxReply, this) + oncomplete: OpenLayers.Function.bind(this.ajaxReply, this), + onsend: function() { $("#editor_throbber").css("visibility", "visible"); } }); }, @@ -389,13 +389,15 @@ var FeatureMgr = { } AjaxMgr.add({ form: form, - oncomplete: OpenLayers.Function.bind(this.ajaxReply, this) + oncomplete: OpenLayers.Function.bind(this.ajaxReply, this), + onsend: function() { $("#editor_throbber").css("visibility", "visible"); } }); }, ajaxReply: function (data) { + $("#editor_throbber").css("visibility", "hidden"); if (!data) { - this.commError("Il s'est produit une erreur serveur."); + this.commError(SypStrings.ServerError); return; } @@ -406,38 +408,40 @@ var FeatureMgr = { switch (xml.documentElement.getAttribute("reason")) { case "unauthorized": $("#login_area").show(); + $("#cookie_warning").show(); this.reset(); + Admin.cancelCurrentFeature(); Admin.reset(); break; case "server": - this.commError("Il s'est produit une erreur serveur."); + this.commError(SypStrings.ServerError); $("title").focus(); break; case "unreferenced": - this.commError("La fiche n'était pas référencée sur le serveur."); + this.commError(SypStrings.UnreferencedError); Admin.reloadLayer(Admin.dataLayer); Admin.closeEditor(); break; case "nochange": - this.commError("Aucun changement n'a été effectué."); + this.commError(SypStrings.NochangeError); Admin.closeEditor(); break; case "request": - this.commError("Le serveur n'a pas compris la requête. Il s'agit probablement d'un bug dans SYP."); + this.commError(SypStrings.RequestError); $("title").focus(); break; case "toobig": - this.commError("L'image est trop grande et n'a pas été acceptée par le serveur."); + this.commError(SypStrings.ToobigError); $("#image_file").parent().html($("#image_file").parent().html()); $("#image_file").focus(); break; case "notimage": - this.commError("Le fichier ne semble pas être une image."); + this.commError(SypStrings.NotimageError); $("#image_file").parent().html($("#image_file").parent().html()); $("#image_file").focus(); break; default: - this.commError("Il s'est produit une erreur inconnue."); + this.commError(SypStrings.UnknownError); $("title").focus(); break; } @@ -445,7 +449,7 @@ var FeatureMgr = { case "success": switch (xml.documentElement.getAttribute("request")) { case "del": - this.commSuccess("La suppression s'est déroulée correctement."); + this.commSuccess(SypStrings.DelSucces); var someFeature = false; var self = this; $.each($(xml).find("FEATURE,feature"), function () { @@ -462,7 +466,7 @@ var FeatureMgr = { } }); if (someFeature == false) { - this.commError("Le serveur a fait une réponse incohérente."); + this.commError(SypStrings.UnconsistentError); } else { Admin.closeEditor(); } @@ -503,20 +507,20 @@ var FeatureMgr = { }); if (someFeature == false) { - this.commError("Le serveur a fait une réponse incohérente."); + this.commError(SypStrings.UnconsistentError); } else { - this.commSuccess("La sauvegarde s'est déroulée correctement."); + this.commSuccess(SypStrings.UpdateSucces); Admin.closeEditor(); } break; default: - this.commError("Le serveur a fait une réponse incohérente."); + this.commError(SypStrings.UnconsistentError); break; } break; default: - this.commError("Le serveur a fait une réponse incohérente."); + this.commError(SypStrings.UnconsistentError); break; } }, @@ -529,10 +533,6 @@ var FeatureMgr = { commError: function (message) { $("#server_comm").text(message); $("#server_comm").removeClass().addClass("error"); - if (message.length) { - // this.move(Admin.currentFeature, Admin.currentFeatureLocation); - // Admin.reset(); - } } } @@ -637,7 +637,7 @@ var pwdMgr = { }, 0); if (!data) { - this.commError("Il s'est produit une erreur serveur."); + this.commError(SypStrings.ServerError); $("#login_error").show(); window.setTimeout(function() { $("#password").focus().select(); @@ -650,16 +650,16 @@ var pwdMgr = { case "error": switch (xml.documentElement.getAttribute("reason")) { case "server": - this.commError("Il s'est produit une erreur serveur."); + this.commError(SypStrings.ServerError); break; case "unauthorized": - this.commError("Le mot de passe n'est pas correct."); + this.commError(SypStrings.UnauthorizedError); break; case "request": - this.commError("Le serveur n'a pas compris la requête. Il s'agit probablement d'un bug dans SYP."); + this.commError(SypStrings.RequestError); break; default: - this.commError("Il s'est produit une erreur inconnue."); + this.commError(SypStrings.UnknownError); break; } $("#login_error").show(); @@ -672,7 +672,7 @@ var pwdMgr = { $("#login_area").hide(); break; default: - this.commError("Le serveur a fait une réponse incohérente."); + this.commError(SypStrings.UnconsistentError); break; } }, @@ -710,6 +710,8 @@ $(window).load(function () { return false; }); $("#image_delete").click(function() { + alert (SypStrings.DisabledForDemo); + return; $("#img").removeAttr('src'); // needs to rebuild element otherwise some browsers still // display image.