--- /dev/null
+admin.php
\ No newline at end of file
--- /dev/null
+admin.php
\ No newline at end of file
/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
license. */
-require_once ("./inc/settings.php");
-require_once ("./inc/db/mysql.php");
-require_once ("./inc/utils.php");
-
-$error = false;
-try {
- $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
- $usrtblexists = $connection->users_table_exists ();
- $itemstblexists = $connection->items_table_exists ();
-} catch (Exception $e) {
- $error = true;
-}
-if (!$usrtblexists || !$itemstblexists) {
- $error = true;
-}
- if ($error) {
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
- <title>SYP admin</title>
- <link rel="stylesheet" href="./media/admin.css" type="text/css">
-</head>
-<body>
- <p class="error center">SYP n'est pas correctement installé. Veuillez
- consulter le fichier README.txt et suivez les instructions
- d'installation.</p>
-</body>
-</html>
-<?php
- exit ();
- } // if ($error)
+ require ('inc/langutils.php');
+ require ('inc/templates_admin.php');
?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
- <title>SYP admin</title>
-
- <link rel="stylesheet" href="./media/admin.css" type="text/css">
- <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
-
- <script type="text/javascript">
- <?php
- $bbox = $connection->mbr ();
- printf ("var sypOrig = [%.18F, %.18F, %.18F, %.18F];\n",
- $bbox [0], $bbox [1], $bbox [2], $bbox [3]);
- ?>
- </script>
- <script src="./js/jquery-1.3.2.js" type="text/javascript"></script>
- <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
- <script src="./js/admin.js" type="text/javascript"></script>
-
- <noscript>
- <style type="text/css">
- #map, #editor, #admin, #login_area {
- display: none;
- }
- </style>
- </noscript>
-
-</head>
-
-<body>
-
- <noscript>
- <p>SYP nécessite javascript pour fonctionner. Veuillez activer les scripts
- dans votre navigateur.</p>
- </noscript>
-
-
- <div id="map"></div>
-
- <div id="admin" class="center">
- <input id="newfeature_button" type="button" value="ajouter un emplacement">
- <p id="server_comm"></p>
- <p id="instructions"></p>
- </div>
-
- <p id="logout"><a href="logout.php">Déconnexion</a></p>
-
- <div id="editor" class="center">
- <input id="editor_close" type="image" src="openlayers/theme/default/img/close.gif"
- title="fermer sans enregistrer" alt="fermer">
- <form id="feature_update" method="post" enctype="multipart/form-data">
- <label for="title">titre :</label><br>
- <input id="title" name="title"><br>
- <label for="description">description :</label><br>
- <textarea id="description" name="description" rows="4"></textarea><br>
- <div><img id="img"></div>
- <input id="image_delete" type="button" value="supprimer l'image">
- <div>
- <label for="image_file">ajouter une image :</label>
- <input id="image_file" type="file" name="image_file">
- </div>
- <br>
- <div class="center">
- <input id="validate_editor" type="submit" value="Valider les changements">
- </div>
- <input type="hidden" name="request">
- <input type="hidden" name="lon">
- <input type="hidden" name="lat">
- <input type="hidden" name="fid">
- <input type="hidden" name="keep_img">
- </form>
- <form id="feature_delete" method="post">
- <input id="delete" type="submit" value="Supprimer la fiche">
- <input type="hidden" name="request" value="del">
- <input type="hidden" name="fid">
- </form>
- </div>
-
- <div id="login_area"
- <?php
- if ($connection->checkpwdmd5 ("admin",
- $_COOKIE [sprintf ("%sauth", DBPREFIX)])) {
- echo ' class="hidden"';
- }
- ?>>
- <div id="login_transparency"></div>
- <div id="login_padding"></div>
- <div id="login_content">
- <form id="login_form" method="post">
- <table>
- <tr>
- <td><label for="password">mot de passe</label></td>
- <td style="width: 100%"><input id="password" name="password" type="password"></td>
- </tr>
- </table>
- <p class="center">
- <input id="login_submit" type="submit" value="Connexion">
- <input type="hidden" name="request" value="auth">
- </p>
- <p id="pwd_throbber" class="throbber center">
- Connexion en cours
- <img src="media/pwd_throbber.gif" alt="throbber">
- </p>
- <p class="error center" id="login_error"></p>
- </form>
- </div>
- </div>
-
- <iframe id="api_frame" name="api_frame" src="" frameborder="0" width="0" height="0"></iframe>
-
-</body>
-</html>
cp -RLp inc/ $DESTDIR/
# other php files
-cp -p admin.php api.php index.php items.php logout.php wizard.php $DESTDIR/
+cp -p admin.*php index.*php api.php items.php logout.php wizard.php $DESTDIR/
# media
cp -RLp media/ $DESTDIR/
--- /dev/null
+<?php
+ $translations['en'] = array(
+ // your name
+ "_translator_name" => "arno renevier",
+
+ // your email
+ "_translator_mail" => "arno@renevier.net",
+
+ // your language name in your language. It will be used to link to
+ // pages in your languages from pages in other
+ "_language_name" => "english",
+
+ /* starts translation */
+
+ "SYP needs javascript. Please activate scripts in your browser."
+ => "",
+
+ "propulsed by <a href=\\\"http://syp.renevier.net\\\">syp</a>"
+ => "",
+
+ "There is no image registered on this site."
+ => "",
+
+ "SYP admin"
+ => "",
+
+ "SYP is not correctly installed. Please read README.txt file and follow\n" .
+ " installation instructions."
+ => "",
+
+ "add a place"
+ => "",
+
+ "You can move an item by drag & droping it."
+ => "",
+
+ "To modify an item data, select matching marker."
+ => "",
+
+ "Click on the map to add a marker."
+ => "",
+
+ "There was a server error."
+ => "",
+
+ "Item was not registered on the server."
+ => "",
+
+ "No change was made."
+ => "",
+
+ "Server did not understood request. That's probably caused by a bug in SYP."
+ => "",
+
+ "Image was too big and was not accepted by server."
+ => "",
+
+ "Password is not correct."
+ => "",
+
+ "File does not look like an image."
+ => "",
+
+ "Server reply was inconsistent."
+ => "",
+
+ "There was an unknown error."
+ => "",
+
+ "Removal took place correctly."
+ => "",
+
+ "Save took place correctly."
+ => "",
+
+ "Logout"
+ => "",
+
+ "close without saving"
+ => "",
+
+ "close"
+ => "",
+
+ "title:"
+ => "",
+
+ "description:"
+ => "",
+
+ "delete image"
+ => "",
+
+ "add an image:"
+ => "",
+
+ "Validate changes"
+ => "",
+
+ "Delete item"
+ => "",
+
+ "password"
+ => "",
+
+ "Connection"
+ => "",
+
+ "Connecting"
+ => "",
+
+ "This feature is not enabled on demo site"
+ => "",
+
+ )
+?>
--- /dev/null
+<?php
+ $translations['fr'] = array(
+ // your name
+ "_translator_name" => "arno renevier",
+
+ // your email
+ "_translator_mail" => "arno@renevier.net",
+
+ // your language name in your language. It will be used to link to
+ // pages in your languages from pages in other
+ "_language_name" => "français",
+
+ /* starts translation */
+
+
+ "SYP needs javascript. Please activate scripts in your browser."
+ =>
+ "SYP a besoin de javascript pour fonctionner. Veuillez activer les scripts dans votre navigateur."
+ ,
+
+ "propulsed by <a href=\\\"http://syp.renevier.net\\\">syp</a>"
+ =>
+ "propulsé par <a href=\\\"http://syp.renevier.net\\\">syp</a>"
+ ,
+
+ "There is no image registered on this site."
+ =>
+ "Il n'y a aucune image enregistrée sur le site."
+ ,
+
+ "SYP admin"
+ =>
+ "administration de SYP"
+ ,
+
+ "SYP is not correctly installed. Please read README.txt file and follow\n" .
+ " installation instructions."
+ =>
+ "SYP n'est pas correctement installé. Veuillez\n" .
+ " consulter le fichier README.txt et suivez les instructions\n" .
+ " d'installation."
+ ,
+
+ "add a place"
+ =>
+ "ajouter un emplacement"
+ ,
+
+ "You can move an item by drag & droping it."
+ =>
+ "Vous pouvez déplacer le marqueur en le glissant-déposant."
+ ,
+
+ "To modify an item data, select matching marker."
+ =>
+ "Pour modifier les données d'un item, sélectionnez le marqueur correspondant."
+ ,
+
+ "Click on the map to add a marker."
+ =>
+ "Cliquez sur la carte pour ajouter un marqueur."
+ ,
+
+ "There was a server error."
+ =>
+ "Il s'est produit une erreur serveur."
+ ,
+
+ "Item was not registered on the server."
+ =>
+ "La fiche n'était pas référencée sur le serveur"
+ ,
+
+ "No change was made."
+ =>
+ "Aucun changement n'a été effectué."
+ ,
+
+ "Server did not understood request. That's probably caused by a bug in SYP."
+ =>
+ "Le serveur n'a pas compris la requête. Il s'agit probablement d'un bug dans SYP."
+ ,
+
+ "Image was too big and was not accepted by server."
+ =>
+ "L'image est trop grande et n'a pas été acceptée par le serveur."
+ ,
+
+ "Password is not correct."
+ =>
+ "Le mot de passe n'est pas correct."
+ ,
+
+ "File does not look like an image."
+ =>
+ "Le fichier ne semble pas être une image."
+ ,
+
+ "Server reply was inconsistent."
+ =>
+ "Le serveur a fait une réponse incohérente"
+ ,
+
+ "There was an unknown error."
+ =>
+ "Il s'est produit une erreur inconnue."
+ ,
+
+ "Removal took place correctly."
+ =>
+ "La suppression s'est déroulée correctement."
+ ,
+
+ "Save took place correctly."
+ =>
+ "La sauvegarde s'est déroulée correctement."
+ ,
+
+ "Logout"
+ =>
+ "Déconnexion"
+ ,
+
+ "close without saving"
+ =>
+ "fermer sans enregistrer"
+ ,
+
+ "close"
+ =>
+ "fermer"
+ ,
+
+ "title:"
+ =>
+ "titre :"
+ ,
+
+ "description:"
+ =>
+ "description :"
+ ,
+
+ "delete image"
+ =>
+ "supprimer l'image"
+ ,
+
+ "add an image:"
+ =>
+ "ajouter une image :"
+ ,
+
+ "Validate changes"
+ =>
+ "Valider les changements"
+ ,
+
+ "Delete item"
+ =>
+ "Supprimer la fiche"
+ ,
+
+ "password"
+ =>
+ "mot de passe"
+ ,
+
+ "Connection"
+ =>
+ "Connexion"
+ ,
+
+ "Connecting"
+ =>
+ "Connexion en cours"
+ ,
+
+ "This feature is not enabled on demo site"
+ =>
+ "Cette fonctionnalité est désactivée sur le site de démonstration"
+ ,
+
+ )
+?>
--- /dev/null
+how to add a language:
+----------------------
+If you want to add language xy, run
+$ ./updatelang.php xy
+then, translate all strings in xy/syp.php
+
+how to update a language:
+-------------------------
+If you want to update language xy, run
+$ ./updatelang.php xy
+then, translate empty strings xy/syp.php
+
+how to remove a language:
+-------------------------
+If you want to remove language xy, remove xy directory, and unlink symbolic
+links in root directory:
+$ rm -r xy/
+$ rm ../../*.xy.php
+
+*******************
+* IMPORTANT NOTES *
+*******************
+
+- you can split a translated string in several lines, but it must stay a php string:
+ use a dot (".") to tell the php interpreter that string is not finished.
--- /dev/null
+#!/usr/bin/php
+<?php
+
+// only execute from command line
+if (!(isset ($argc)) || !(isset ($argv))) {
+ exit (0);
+}
+
+$ROOTDIR="../../";
+$SCRIPTS=array("admin"); // scripts in rootdir we need to link to
+
+function usage() {
+ global $argv;
+ return ("Usage: " . $argv[0] . " [lang1] [lang2]\n");
+}
+
+function warn($str) { // writes string to stderr
+ error ($str);
+}
+
+function error($str) { // writes string to stderr
+ $stderr = fopen ('php://stderr', 'w');
+ fwrite ($stderr, $str);
+ fclose ($stderr);
+}
+
+function main($argv, $argc, $rootdir, $scripts) {
+ $options = getopt("h");
+ if (isset ($options ['h'])) {
+ print usage ();
+ return 0;
+ }
+
+ if ($argc <= 1) { // update all existing langs
+ foreach (scandir (".") as $entry) {
+ if (is_dir ($entry) && !($entry[0] == ".") && !($entry == "en")) {
+ updatelang ($entry, $rootdir, $scripts);
+ }
+ }
+ } else {
+ foreach (array_slice ($argv, 1) as $item) {
+ updatelang ($item, $rootdir, $scripts);
+ }
+ }
+
+ return 0;
+}
+
+function escape_newline ($str, $tab) {
+ return str_replace("\n", "\\n\" .\n$tab$tab\"", $str);
+}
+function escape_slash ($str) {
+ $res = str_replace("\\", "\\\\", $str);
+ $res = str_replace("\"", "\\\"", $res);
+ return $res;
+}
+
+function escape_all ($str, $tab) {
+ $str = escape_slash ($str);
+ $str = escape_newline ($str, $tab);
+ return $str;
+}
+
+function updatelang($lang, $rootdir, $scripts) {
+ if (!preg_match ('/^[a-zA-Z]{2,3}(-[a-zA-Z]{2,3})?$/', $lang)) {
+ warn ("$lang is not a valid lang format.\n");
+ return false;
+ }
+ if ($lang == "en") {
+ warn ("en is reference language. It must be managed manually.\n");
+ return false;
+ }
+
+ if (!is_dir ($lang)) {
+ if (!mkdir ($lang)) {
+ error ("could not create $lang directory.\n");
+ return false;
+ }
+ }
+
+ require ("en/syp.php");
+ if (is_file ("$lang/syp.php")) {
+ require ("$lang/syp.php");
+ }
+
+ $translator_name = $translations[$lang]["_translator_name"];
+ $translator_mail = $translations[$lang]["_translator_mail"];
+ $language_name = $translations[$lang]["_language_name"];
+
+ $tab = str_repeat (" ", 4);
+
+ $tmpname = tempnam ("", "");
+ $output = fopen($tmpname, "w");
+
+ fwrite ($output, "<?php\n");
+
+ fwrite ($output, "$tab" . "\$translations['" . $lang . "'] = array(\n");
+ fwrite ($output, "$tab$tab" . "// your name\n");
+ fwrite ($output, "$tab$tab" . "\"_translator_name\" => \"" . escape_slash ($translator_name) . "\",\n");
+ fwrite ($output, "\n");
+
+ fwrite ($output, "$tab$tab" . "// your email\n");
+ fwrite ($output, "$tab$tab" . "\"_translator_mail\" => \"" . escape_slash ($translator_mail) . "\",\n");
+ fwrite ($output, "\n");
+
+ fwrite ($output, "$tab$tab" . "// your language name in your language. It will be used to link to\n");
+ fwrite ($output, "$tab$tab" . "// pages in your languages from pages in other\n");
+ fwrite ($output, "$tab$tab" . "\"_language_name\" => \"" . escape_slash ($language_name) . "\",\n");
+ fwrite ($output, "\n");
+
+ fwrite ($output, "$tab$tab" . "/* starts translation */\n");
+ fwrite ($output, "\n");
+ fwrite ($output, "\n");
+
+ foreach ($translations['en'] as $key => $value) {
+ if ($key[0] == "_") {
+ continue;
+ }
+ $value = $translations[$lang][$key];
+
+ fwrite ($output, "$tab$tab" . "\"" . escape_all ($key, $tab) . "\"" . "\n");
+ fwrite ($output, "$tab$tab " . "=>\n");
+ fwrite ($output, "$tab$tab" . "\"" . escape_all ($value, $tab) . "\"" . "\n");
+ fwrite ($output, "$tab$tab " . ",\n");
+ fwrite ($output, "\n");
+ }
+
+ fwrite ($output, "$tab" . ")\n");
+ fwrite ($output, "?>"); // <?php <- fixes vim syntax
+
+ fclose($output);
+
+ if (!rename ($tmpname, "$lang/syp.php")) {
+ error ("could not move $tmpname to $lang/sys.php");
+ unlink ($tmpname);
+ return false;
+ }
+ if (!chmod ("$lang/syp.php", 0644)) {
+ error ("could not set permissions to $lang/sys.php");
+ return false;
+ }
+
+ foreach ($scripts as $script) {
+ $link = $rootdir . "/" . $script . "." . $lang . ".php";
+ $target = $script . ".php";
+ if (!file_exists ($link)) {
+ if (!symlink ($target, $link)) {
+ error ("could not link $target to $link");
+ }
+ }
+ }
+ return true;
+}
+
+exit (main($argv, $argc, $ROOTDIR, $SCRIPTS));
+?>
--- /dev/null
+<?php
+/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
+ license. */
+
+ $language_list = Array ();
+
+function ptrans ($str) {
+ echo trans ($str);
+}
+
+function trans ($str) {
+ global $translations, $lang;
+
+ $res = $translations[$lang][$str];
+ if (!isset ($res) || strlen ($res) == 0) {
+ return $str;
+ } else {
+ return $res;
+ }
+}
+
+function parse_accept_language () {
+ global $translations;
+ $possibilities = array();
+ if (isset ($_SERVER ['HTTP_ACCEPT_LANGUAGE'])) {
+ // set to lower case now
+ $accepts = explode (',',
+ strtolower ($_SERVER ['HTTP_ACCEPT_LANGUAGE']));
+ foreach ($accepts as $acc) {
+ if (preg_match ('/^\s*([a-zA-Z-]+)\s*$/', $acc, $matches)) {
+ $possibilities [$matches [1]] = 1.0;
+ }
+ if (preg_match ('/^\s*([a-zA-Z-]+)\s*;\s*q\s*=\s*([0-9\.]+)\s*$/',
+ $acc, $matches)) {
+ $val = floatval ($matches [2]);
+ if ($val > 1.0) {
+ $val = 1.0;
+ }
+ $possibilities [$matches [1]] = $val;
+ }
+ }
+ arsort ($possibilities);
+ foreach ($possibilities as $lang => $value) {
+ if (isset ($translations [$lang])) {
+ return $lang;
+ }
+ }
+ }
+ return "en"; // nothing found; default to english
+}
+
+function other_languages ($current_lang) {
+ $script = pathinfo ($_SERVER ["SCRIPT_NAME"], PATHINFO_FILENAME);
+ $dotpos = strpos ($script, '.');
+ if ($dotpos !== false) {
+ $script = substr ($script, 0, $dotpos);
+ }
+
+ global $translations;
+ $links = Array ();
+ foreach ($translations as $lang => $obj) {
+ $lang_name = $obj ["_language_name"];
+ if ($lang == $current_lang) {
+ array_push ($links, "<a>$lang_name</a>");
+ } else {
+ array_push ($links, "<a href=\"$script.$lang.php\" title=\"$lang_name\" lang=\"$lang\" hreflang=\"$lang\">$lang_name</a>");
+ }
+ }
+ echo "<div id=\"other-language\">" . join("", $links) . "</div>\n";
+}
+
+// load languages
+foreach (scandir ("inc/i10n/") as $entry) {
+ if (is_dir ("inc/i10n/$entry") && ($entry [0] != ".")) {
+ $target = "inc/i10n/$entry/syp.php";
+ if (is_file ($target)) {
+ include $target;
+ }
+ }
+}
+
+// detects language
+$fname = pathinfo ($_SERVER ["SCRIPT_NAME"], PATHINFO_FILENAME);
+$lang = ltrim (strstr ($fname, '.'), '.');
+if ((!isset ($lang)) ||
+ (strlen ($lang) == 0) ||
+ (!isset ($translations [$lang]))) {
+ $lang = parse_accept_language ();
+}
--- /dev/null
+<?php
+/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
+ license. */
+
+require_once ("./inc/settings.php");
+require_once ("./inc/db/mysql.php");
+require_once ("./inc/utils.php");
+
+$error = false;
+try {
+ $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
+ $usrtblexists = $connection->users_table_exists ();
+ $itemstblexists = $connection->items_table_exists ();
+} catch (Exception $e) {
+ $error = true;
+}
+if (!$usrtblexists || !$itemstblexists) {
+ $error = true;
+}
+ if ($error) {
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
+ <title><?php ptrans('SYP admin')?></title>
+ <link rel="stylesheet" href="./media/admin.css" type="text/css">
+</head>
+<body>
+ <p class="error center"><?php ptrans('SYP is not correctly installed. Please read README.txt file and follow
+ installation instructions.')?></p>
+</body>
+</html>
+<?php
+ exit ();
+ } // if ($error)
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
+ <title><?php ptrans('SYP admin');?></title>
+
+ <link rel="stylesheet" href="./media/admin.css" type="text/css">
+ <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
+
+ <script type="text/javascript">
+ var SypStrings = {
+ AddItem: "<?php ptrans('add a place')?>",
+ DragDropHowto: "<?php ptrans('You can move an item by drag & droping it.')?>",
+ SelectHowto: "<?php ptrans('To modify an item data, select matching marker.')?>",
+ AddHowto: "<?php ptrans('Click on the map to add a marker.')?>",
+ ServerError: "<?php ptrans('There was a server error.')?>",
+ UnreferencedError: "<?php ptrans('Item was not registered on the server.')?>",
+ NochangeError: "<?php ptrans('No change was made.')?>",
+ RequestError: "<?php ptrans('Server did not understood request. That\'s probably caused by a bug in SYP.')?>",
+ ToobigError: "<?php ptrans('Image was too big and was not accepted by server.')?>",
+ UnauthorizedError: "<?php ptrans('Password is not correct.')?>",
+ NotimageError: "<?php ptrans('File does not look like an image.')?>",
+ UnconsistentError: "<?php ptrans('Server reply was inconsistent.')?>",
+ UnknownError: "<?php ptrans('There was an unknown error.')?>",
+ DelSucces: "<?php ptrans('Removal took place correctly.')?>",
+ UpdateSucces: "<?php ptrans('Save took place correctly.')?>"
+ };
+
+ <?php
+ $bbox = $connection->mbr ();
+ printf ("var sypOrig = [%.18F, %.18F, %.18F, %.18F];\n",
+ $bbox [0], $bbox [1], $bbox [2], $bbox [3]);
+ ?>
+
+ </script>
+ <script src="./js/jquery-1.3.2.js" type="text/javascript"></script>
+ <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
+ <script src="./js/admin.js" type="text/javascript"></script>
+
+ <noscript>
+ <style type="text/css">
+ #map, #editor, #admin, #login_area {
+ display: none;
+ }
+ </style>
+ </noscript>
+
+</head>
+
+<body>
+
+ <noscript>
+ <p><?php ptrans('SYP needs javascript. Please activate scripts in your browser.')?></p>
+ </noscript>
+
+ <div id="header">
+ <?php other_languages($lang) ?>
+ <p id="logout"><a href="logout.php"><?php ptrans('Logout')?></a></p>
+ </div>
+
+
+ <div id="map"></div>
+
+ <div id="admin" class="center">
+ <input id="newfeature_button" type="button" value="<?php ptrans('add a place')?>">
+ <p id="server_comm"></p>
+ <p id="instructions"></p>
+ </div>
+
+ <div id="editor" class="center">
+ <input id="editor_close" type="image" src="openlayers/theme/default/img/close.gif"
+ title="<?php ptrans('close without saving')?>" alt="<?php ptrans('close')?>">
+ <form id="feature_update" method="post" enctype="multipart/form-data">
+ <label for="title"><?php ptrans('title:')?></label><br>
+ <input id="title" name="title"><br>
+ <label for="description"><?php ptrans('description:')?></label><br>
+ <textarea id="description" name="description" rows="4"></textarea><br>
+ <div><img id="img"></div>
+ <input id="image_delete" type="button" value="<?php ptrans('delete image')?>">
+ <div>
+ <label for="image_file"><?php ptrans('add an image:')?></label>
+ <input id="image_file" type="file" name="image_file">
+ </div>
+ <br>
+ <div class="center">
+ <input id="validate_editor" type="submit" value="<?php ptrans('Validate changes')?>">
+ </div>
+ <input type="hidden" name="request">
+ <input type="hidden" name="lon">
+ <input type="hidden" name="lat">
+ <input type="hidden" name="fid">
+ <input type="hidden" name="keep_img">
+ </form>
+ <form id="feature_delete" method="post">
+ <input id="delete" type="submit" value="<?php ptrans('Delete item')?>">
+ <input type="hidden" name="request" value="del">
+ <input type="hidden" name="fid">
+ </form>
+ </div>
+
+ <div id="login_area"
+ <?php
+ if ($connection->checkpwdmd5 ("admin",
+ $_COOKIE [sprintf ("%sauth", DBPREFIX)])) {
+ echo ' class="hidden"';
+ }
+ ?>>
+ <div id="login_transparency"></div>
+ <div id="login_padding"></div>
+ <div id="login_content">
+ <form id="login_form" method="post">
+ <table>
+ <tr>
+ <td><label for="password"><?php ptrans('password')?></label></td>
+ <td style="width: 100%"><input id="password" name="password" type="password"></td>
+ </tr>
+ </table>
+ <p class="center">
+ <input id="login_submit" type="submit" value="<?php ptrans('Connection')?>">
+ <input type="hidden" name="request" value="auth">
+ </p>
+ <p id="pwd_throbber" class="throbber center">
+ <?php ptrans('Connecting')?>
+ <img src="media/pwd_throbber.gif" alt="throbber">
+ </p>
+ <p class="error center" id="login_error"></p>
+ </form>
+ </div>
+ </div>
+
+ <iframe id="api_frame" name="api_frame" src="" frameborder="0" width="0" height="0"></iframe>
+
+</body>
+</html>
--- /dev/null
+<?php
+/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
+ license. */
+
+require_once ("./inc/settings.php");
+require_once ("./inc/db/mysql.php");
+
+try {
+ $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
+} catch (Exception $e) {
+}
+
+$bbox = $connection->mbr ();
+?>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
+ <title><?php echo defined ("SITETITLE") ? SITETITLE : "SYP"?></title>
+ <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="./media/syp.css" type="text/css">
+
+ <script type="text/javascript">
+ var SypStrings = {
+ language: "<?php echo $lang ?>",
+ propulsedByLink: "<?php ptrans('propulsed by <a href=\"http://syp.renevier.net\">syp</a>')?>",
+ noImageRegistered: "<?php ptrans('There is no image registered on this site.')?>"
+ };
+ <?php
+ printf ("var sypOrig = [%.18F, %.18F, %.18F, %.18F];\n",
+ $bbox [0], $bbox [1], $bbox [2], $bbox [3]);
+ ?>
+ </script>
+ <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
+ <script src="./js/syp.js" type="text/javascript"></script>
+
+ <noscript>
+ <style type="text/css">
+ #map {
+ display: none;
+ }
+ </style>
+ </noscript>
+
+ </head>
+
+ <body onload="SYP.init();">
+
+ <noscript>
+ <p><?php ptrans('SYP needs javascript. Please activate scripts in your browser.')?></p>
+ </noscript>
+
+ <div id="map"></div>
+ <div id="message"></div>
+
+</body>
+</html>
--- /dev/null
+index.php
\ No newline at end of file
--- /dev/null
+index.php
\ No newline at end of file
/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
license. */
-require_once ("./inc/settings.php");
-require_once ("./inc/db/mysql.php");
-
-try {
- $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
-} catch (Exception $e) {
-}
-
-$bbox = $connection->mbr ();
+ require ('inc/langutils.php');
+ require ('inc/templates_index.php');
?>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
- <title><?php echo defined ("SITETITLE") ? SITETITLE : "SYP"?></title>
- <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
- <link rel="stylesheet" href="./media/syp.css" type="text/css">
-
- <script type="text/javascript">
- <?php
- printf ("var sypOrig = [%.18F, %.18F, %.18F, %.18F];\n",
- $bbox [0], $bbox [1], $bbox [2], $bbox [3]);
- ?>
- </script>
- <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
- <script src="./js/syp.js" type="text/javascript"></script>
-
- <noscript>
- <style type="text/css">
- #map {
- display: none;
- }
- </style>
- </noscript>
-
- </head>
-
- <body onload="SYP.init();">
-
- <noscript>
- <p>SYP nécessite javascript pour fonctionner. Veuillez activer les
- scripts dans votre navigateur.</p>
- </noscript>
-
- <div id="map"></div>
- <div id="message"></div>
-
-</body>
-</html>
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();
});
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());
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);
}
},
$("#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();
ajaxReply: function (data) {
if (!data) {
- this.commError("Il s'est produit une erreur serveur.");
+ this.commError(SypStrings.ServerError);
return;
}
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;
}
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 () {
}
});
if (someFeature == false) {
- this.commError("Le serveur a fait une réponse incohérente.");
+ this.commError(SypStrings.UnconsistentError);
} else {
Admin.closeEditor();
}
});
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;
}
},
}, 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();
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();
$("#login_area").hide();
break;
default:
- this.commError("Le serveur a fait une réponse incohérente.");
+ this.commError(SypStrings.UnconsistentError);
break;
}
},
OpenLayers.Control.SypAttribution = OpenLayers.Class (OpenLayers.Control.Attribution, {
updateAttribution: function() {
- var attributions = ['propulsed by <a href="http://syp.renevier.net">syp</a>'];
+ var attributions = [SypStrings.propulsedByLink];
if (this.map && this.map.layers) {
for(var i=0, len=this.map.layers.length; i<len; i++) {
var layer = this.map.layers[i];
checkForFeatures: function() {
var features = this.dataLayer.features;
if (features.length == 0) {
- var message = "Il n'y a aucune image enregistrée sur le site.";
+ var message = SypStrings.noImageRegistered;
this.Utils.displayUserMessage(message, "warn");
}
},
}
};
+// if possible, determine language with HTTP_ACCEPT_LANGUAGE instead of
+// navigator.language
+if (OpenLayers.Lang[SypStrings.language]) {
+ OpenLayers.Lang.setCode(SypStrings.language);
+}
+
// avoid alerts
OpenLayers.Console.userError = function(error) {
SYP.Utils.displayUserMessage(error, "error");
/*
- * misc
+ * header
*/
+#header {
+ height: 2em;
+}
#logout {
float: right;
margin: 0px 10px 0px 0px;
}
+#other-language {
+ float: left;
+ margin-top: 1px;
+}
+#other-language a:hover {
+ background-color: #BBBBFF;
+}
+#other-language a {
+ position: relative; /* needed to display top and bottom borders in ie */
+ text-decoration: none;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-top: 3px;
+ padding-bottom: 3px;
+ border: #BBBBFF 1px solid;
+}
/*
* map
#map {
position: absolute;
- top: 4px;
+ top: 2em;
left: 4px;
height: 50%;
width: 50%;
*/
#admin {
+ margin-top: 3em;
position: fixed;
- top: 53%;
+ top: 50%;
width: 50%;
}
OpenLayers/Tile/WFS.js
OpenLayers/Request/XMLHttpRequest.js
OpenLayers/Layer/SphericalMercator.js
+OpenLayers/Lang/en.js
+OpenLayers/Lang/fr.js
[exclude]