]> dev.renevier.net Git - syj.git/commitdiff
search a place with nominatim
authorarno <arno@renevier.net>
Fri, 20 Aug 2010 13:02:21 +0000 (15:02 +0200)
committerarno <arno@renevier.net>
Sat, 21 Aug 2010 08:40:59 +0000 (10:40 +0200)
16 files changed:
COPYING.TXT
application/configs/application.ini
application/controllers/AccountController.php
application/controllers/ContactController.php
application/controllers/IdxController.php
application/controllers/NewpwdController.php
application/controllers/NominatimController.php [new file with mode: 0644]
application/controllers/helpers/SyjApi.php
application/languages/lang_en.po
application/languages/lang_fr.po
application/views/scripts/idx/index.phtml
public/css/syj.css
public/icons/throbber.gif [moved from public/icons/pseudo-throbber.gif with 100% similarity]
public/icons/world.png [new file with mode: 0644]
public/js/syj.js
public/js/utils.js

index b8188b7eb877708de5f339868b44ccd90f544d42..6128571b20ed87fea9f28e297f860739e3fb13f1 100644 (file)
@@ -2,13 +2,13 @@
   Version 3, and redistributed under the conditions of this license. A copy of
   modified AGPL license is included in this file.
 
-- delete.png, bullet_arrow_down.png and bullet_arrow_right.png comes form
-  FamFamFam Silk Icons. Author is Mark James. They are licensed under a
+- delete.png, bullet_arrow_down.png, bullet_arrow_right.png and world.png come
+  form FamFamFam Silk Icons. Author is Mark James. They are licensed under a
   Creative Commons Attribution 2.5 License. See
   http://www.famfamfam.com/lab/icons/silk/ for more informations.
 
-- pseudo-throbber.gif files has been generated with http://ajaxload.info/
-  generator and is free for use.
+- pseudo.gif files has been generated with http://ajaxload.info/ generator and
+  is free for use.
 
 
 
index 1f0a587d2a778fc7b9e74f49654a5c346dc7e5d2..3c743966438b847009aee82eee8f71548c6d0286 100644 (file)
@@ -106,6 +106,10 @@ resources.router.routes.list.defaults.action = "index"
 resources.router.routes.faq.route = "faq/"
 resources.router.routes.faq.defaults.controller = "faq"
 resources.router.routes.faq.defaults.action = "index"
+; nominatim/
+resources.router.routes.nominatim.route = "nominatim/"
+resources.router.routes.nominatim.defaults.controller = "nominatim"
+resources.router.routes.nominatim.defaults.action = "index"
 
 ; database
 resources.db.params.username = "syj"
index 57ea4d41d04be8c489a63181d8db3ad7e4bf7a34..c9c986ecba33ff6741ae1526acfb6c5344f892b1 100644 (file)
@@ -68,7 +68,7 @@ class AccountController extends Zend_Controller_Action
 
     protected function _jsLocaleStrings() {
         $this->view->jslocales = array(
-            'notEmptyField' => __("Value is required and can't be empty"),
+            'notEmptyField' => __("Value is required"),
             'passwordNoMatchWarn' => __("Password do not match"),
             'passwordLenghtWarn' => array(__("At least %d characters"), 6),
             'nochangeWarn' => __("You have made no change"),
index e72c467514b4bb89bda10917af81261fcb995ae5..3e82c7dc8bff5f86d37e92f0a0fb7d66f2437ccb 100644 (file)
@@ -119,7 +119,7 @@ class ContactController extends Zend_Controller_Action
 
     protected function _jsLocaleStrings() {
         $this->view->jslocales = array(
-            'notEmptyField' => __("Value is required and can't be empty"),
+            'notEmptyField' => __("Value is required"),
             'invalidMail' => __("Invalid email"));
     }
 }
index 77281103f48ff648a6164e999878c1f488fe1176..10506dab3aee3a286a16bea8439ddcc6e03b52a9 100644 (file)
@@ -147,6 +147,8 @@ class IdxController extends Zend_Controller_Action
             'createAction' => __("create"),
             'cloneAction' => __("duplicate"),
             'unsavedConfirmExit' => __("You have an unsaved route"),
+            'notEmptyField' => __("Value is required"),
+            'noResult' => __("no result"),
             );
     }
 
index 1a4ab0798bc7d1c7f0d4bbc4e9e7b3e42fd94e12..de8ec3b644fcb9a242fc518fb253d94d411bbd41 100644 (file)
@@ -66,7 +66,7 @@ class NewpwdController extends Zend_Controller_Action
 
     protected function _jsLocaleStrings() {
         $this->view->jslocales = array(
-            'notEmptyField' => __("Value is required and can't be empty"),
+            'notEmptyField' => __("Value is required"),
             );
     }
 }
diff --git a/application/controllers/NominatimController.php b/application/controllers/NominatimController.php
new file mode 100644 (file)
index 0000000..b254c80
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+class NominatimController extends Zend_Controller_Action
+{
+
+    public function indexAction() {
+        $search = $this->getRequest()->getQuery('nominatim-search');
+        if (!isset($search)) {
+            throw new Syj_Exception_Request();
+        }
+
+        $serverUrl = rtrim($this->view->serverUrl(), '/');
+        $baseUrl = trim($this->view->baseUrl(), '/');
+        $href = $serverUrl . '/' . ($baseUrl ? ($baseUrl . '/'): '');
+
+        $client = new Zend_Http_Client('http://nominatim.openstreetmap.org/search', array(
+                        'useragent' => ('Zend_Http_Client for ' . $href)));
+        $client->setParameterGet(array('q' => $search,
+                                       'format' => 'json',
+                                       'email' => Zend_Controller_Front::getInstance()->getParam('webmasterEmail')));
+
+        $response = $client->request();
+        $data = json_decode($response->getBody());
+        if (!$data) {
+            $data = array();
+        }
+        $this->_helper->SyjApi->setBodyJson($data)->setCode($response->getStatus());
+    }
+}
index 37b010afcc95146b64f897fc53de3183a79136e4..21aa9dd9f9b3fe5e4c88a2eb37bdaa4d8240eb5d 100644 (file)
@@ -30,6 +30,7 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
     public function setBodyJson($data) {
         $this->setBody(json_encode($data))
              ->setContentType('application/json');
+        return $this;
     }
 
     public function setBody($body) {
index 658a7991877f939788d2de46bbab34d257dfc2b2..59e393b392400d2b94cfbd1b95af382f3925ca6e 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: syj\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-08-19 20:01+0200\n"
+"POT-Creation-Date: 2010-08-20 14:01+0200\n"
 "PO-Revision-Date: \n"
 "Last-Translator: arno <arno@renevier.net>\n"
 "Language-Team: arno <arno@renevier.net>\n"
@@ -37,12 +37,8 @@ msgstr "go to main page"
 
 #: application/views/scripts/contact/index.phtml:8
 #, php-format
-msgid ""
-"There was an unkwown message when sending the message. Please try again "
-"later, or send a mail directly to <a href=\"mailto:%s\">%s</a>"
-msgstr ""
-"There was an unkwown message when sending the message. Please try again "
-"later, or send a mail directly to <a href=\"mailto:%s\">%s</a>"
+msgid "There was an unkwown message when sending the message. Please try again later, or send a mail directly to <a href=\"mailto:%s\">%s</a>"
+msgstr "There was an unkwown message when sending the message. Please try again later, or send a mail directly to <a href=\"mailto:%s\">%s</a>"
 
 #: application/views/scripts/contact/success.phtml:4
 msgid "Email was send successfully"
@@ -59,12 +55,8 @@ msgid "Welcome on Syj."
 msgstr "Welcome on Syj."
 
 #: application/views/scripts/idx/index.phtml:17
-msgid ""
-"To create a journey, just click on the map to add points to your route. You "
-"can zoom and move map with controls upper left."
-msgstr ""
-"To create a journey, just click on the map to add points to your route. You "
-"can zoom and move map with controls upper left."
+msgid "To create a journey, just click on the map to add points to your route. You can zoom and move map with controls upper left."
+msgstr "To create a journey, just click on the map to add points to your route. You can zoom and move map with controls upper left."
 
 #: application/views/scripts/idx/index.phtml:19
 msgid "When you have finished a path, press \"save\", button."
@@ -72,12 +64,13 @@ msgstr "When you have finished a path, press \"save\", button."
 
 #: application/views/scripts/idx/index.phtml:32
 #: application/controllers/LoginController.php:8
-#: application/layouts/scripts/footer.phtml:74 application/forms/Login.php:26
+#: application/layouts/scripts/footer.phtml:74
+#: application/forms/Login.php:26
 msgid "login"
 msgstr "login"
 
 #: application/views/scripts/idx/index.phtml:34
-#: application/views/scripts/idx/index.phtml:88
+#: application/views/scripts/idx/index.phtml:105
 msgid "create an account"
 msgstr "create an account"
 
@@ -85,83 +78,55 @@ msgstr "create an account"
 msgid "Whith an account, you can manage and modify your routes"
 msgstr "Whith an account, you can manage and modify your routes"
 
-#: application/views/scripts/idx/index.phtml:52
+#: application/views/scripts/idx/index.phtml:53
 #: application/controllers/IdxController.php:148
 msgid "duplicate"
 msgstr "duplicate"
 
-#: application/views/scripts/idx/index.phtml:54
+#: application/views/scripts/idx/index.phtml:55
 #: application/controllers/IdxController.php:146
 msgid "edit"
 msgstr "edit"
 
-#: application/views/scripts/idx/index.phtml:56
+#: application/views/scripts/idx/index.phtml:59
+msgid "Search a place"
+msgstr "Search a place"
+
+#: application/views/scripts/idx/index.phtml:63
+msgid "Ok"
+msgstr "Ok"
+
+#: application/views/scripts/idx/index.phtml:67
+msgid "more results"
+msgstr "more results"
+
+#: application/views/scripts/idx/index.phtml:73
 msgid "start a route"
 msgstr "start a route"
 
 #: application/views/scripts/termsofuse/index.phtml:5
-msgid ""
-"Show Your Journey is a site whose goal is to allow anyone to publish routes, "
-"for example, hiking itinerary, bicycle trip, travel itinerary or whatever."
-msgstr ""
-"Show Your Journey is a site whose goal is to allow anyone to publish routes, "
-"for example, hiking itinerary, bicycle trip, travel itinerary or whatever."
+msgid "Show Your Journey is a site whose goal is to allow anyone to publish routes, for example, hiking itinerary, bicycle trip, travel itinerary or whatever."
+msgstr "Show Your Journey is a site whose goal is to allow anyone to publish routes, for example, hiking itinerary, bicycle trip, travel itinerary or whatever."
 
 #: application/views/scripts/termsofuse/index.phtml:9
-msgid ""
-"In order to publish a route, you must first create an account. A valid email "
-"is asked for, and ip address of account creation is stored on the server. "
-"Those informations will not be divulged to anyone without the user explicit "
-"permission."
-msgstr ""
-"In order to publish a route, you must first create an account. A valid email "
-"is asked for, and ip address of account creation is stored on the server. "
-"Those informations will not be divulged to anyone without the user explicit "
-"permission."
+msgid "In order to publish a route, you must first create an account. A valid email is asked for, and ip address of account creation is stored on the server. Those informations will not be divulged to anyone without the user explicit permission."
+msgstr "In order to publish a route, you must first create an account. A valid email is asked for, and ip address of account creation is stored on the server. Those informations will not be divulged to anyone without the user explicit permission."
 
 #: application/views/scripts/termsofuse/index.phtml:13
-msgid ""
-"When you create a route, you accept that it's free for any use. This means "
-"you accept that anyone can reuse, reproduce, or republish your itinerary, or "
-"a modified version of it for any purpose. This also means you need to get "
-"appropriate permissions from the creator if you want to upload a route you "
-"didn't create yourself."
-msgstr ""
-"When you create a route, you accept that it's free for any use. This means "
-"you accept that anyone can reuse, reproduce, or republish your itinerary, or "
-"a modified version of it for any purpose. This also means you need to get "
-"appropriate permissions from the creator if you want to upload a route you "
-"didn't create yourself."
+msgid "When you create a route, you accept that it's free for any use. This means you accept that anyone can reuse, reproduce, or republish your itinerary, or a modified version of it for any purpose. This also means you need to get appropriate permissions from the creator if you want to upload a route you didn't create yourself."
+msgstr "When you create a route, you accept that it's free for any use. This means you accept that anyone can reuse, reproduce, or republish your itinerary, or a modified version of it for any purpose. This also means you need to get appropriate permissions from the creator if you want to upload a route you didn't create yourself."
 
 #: application/views/scripts/termsofuse/index.phtml:17
-msgid ""
-"Show Your Journey is not responsible for the accuracy of the routes "
-"published. It's the user responsibility to check that a route is accessible "
-"and safe."
-msgstr ""
-"Show Your Journey is not responsible for the accuracy of the routes "
-"published. It's the user responsibility to check that a route is accessible "
-"and safe."
+msgid "Show Your Journey is not responsible for the accuracy of the routes published. It's the user responsibility to check that a route is accessible and safe."
+msgstr "Show Your Journey is not responsible for the accuracy of the routes published. It's the user responsibility to check that a route is accessible and safe."
 
 #: application/views/scripts/termsofuse/index.phtml:21
-msgid ""
-"Show Your Journey service is provided \"as is\" with no guarantee for "
-"accuracy or accessibility."
-msgstr ""
-"Show Your Journey service is provided \"as is\" with no guarantee for "
-"accuracy or accessibility."
+msgid "Show Your Journey service is provided \"as is\" with no guarantee for accuracy or accessibility."
+msgstr "Show Your Journey service is provided \"as is\" with no guarantee for accuracy or accessibility."
 
 #: application/views/scripts/termsofuse/index.phtml:25
-msgid ""
-"Sources of the software running the website are <a href=\"http://dev."
-"renevier.net/?p=syj.git\">publicly available</a> under a agpl license. The "
-"map used to display the routes comes from <a href=\"http://www.openstreetmap."
-"org/\">openstreetmap</a>."
-msgstr ""
-"Sources of the software running the website are <a href=\"http://dev."
-"renevier.net/?p=syj.git\">publicly available</a> under a agpl license. The "
-"map used to display the routes comes from <a href=\"http://www.openstreetmap."
-"org/\">openstreetmap</a>."
+msgid "Sources of the software running the website are <a href=\"http://dev.renevier.net/?p=syj.git\">publicly available</a> under a agpl license. The map used to display the routes comes from <a href=\"http://www.openstreetmap.org/\">openstreetmap</a>."
+msgstr "Sources of the software running the website are <a href=\"http://dev.renevier.net/?p=syj.git\">publicly available</a> under a agpl license. The map used to display the routes comes from <a href=\"http://www.openstreetmap.org/\">openstreetmap</a>."
 
 #: application/views/scripts/newpwd/success.phtml:4
 #: application/controllers/IdxController.php:139
@@ -203,14 +168,8 @@ msgstr "log in"
 
 #: application/views/scripts/pending/password_validate.phtml:15
 #, php-format
-msgid ""
-"Your new password is now <strong>%s</strong>. You can %s with this new "
-"password. Don't forget to change it again to a personal password as soon as "
-"possible."
-msgstr ""
-"Your new password is now <strong>%s</strong>. You can %s with this new "
-"password. Don't forget to change it again to a personal password as soon as "
-"possible."
+msgid "Your new password is now <strong>%s</strong>. You can %s with this new password. Don't forget to change it again to a personal password as soon as possible."
+msgstr "Your new password is now <strong>%s</strong>. You can %s with this new password. Don't forget to change it again to a personal password as soon as possible."
 
 #: application/views/scripts/account/success.phtml:4
 msgid "Your account was modified successfully"
@@ -261,16 +220,8 @@ msgid "What's syj?"
 msgstr "What's syj?"
 
 #: application/views/scripts/faq/index.phtml:7
-msgid ""
-"<acronym title=\"Show your journey\">Syj</acronym> is a website to share "
-"routes. You draw a route on a map background, and then, you get an link to "
-"share it. You can then show clever bicycle rides, your last hiking, or any "
-"route you want."
-msgstr ""
-"<acronym title=\"Show your journey\">Syj</acronym> est un site de partage "
-"d'itiis a website to share routes. You draw a route on a map background, and "
-"then, you get an link to share it. You can then show clever bicycle rides, "
-"your last hiking, or any route you want."
+msgid "<acronym title=\"Show your journey\">Syj</acronym> is a website to share routes. You draw a route on a map background, and then, you get an link to share it. You can then show clever bicycle rides, your last hiking, or any route you want."
+msgstr "<acronym title=\"Show your journey\">Syj</acronym> est un site de partage d'itiis a website to share routes. You draw a route on a map background, and then, you get an link to share it. You can then show clever bicycle rides, your last hiking, or any route you want."
 
 #: application/views/scripts/faq/index.phtml:9
 msgid "How do I modify a route?"
@@ -278,54 +229,24 @@ msgstr "How do I modify a route?"
 
 #: application/views/scripts/faq/index.phtml:10
 #, php-format
-msgid ""
-"When you're editing a route, you can drag and drop a point to move it. If "
-"you want to delete it, you need to press the Shift key. While you hold the "
-"button, points will have an icon%s over them. Clicking that icon will delete "
-"the point."
-msgstr ""
-"When you're editing a route, you can drag and drop a point to move it. If "
-"you want to delete it, you need to press the Shift key. While you hold the "
-"button, points will have an icon%s over them. Clicking that icon will delete "
-"the point."
+msgid "When you're editing a route, you can drag and drop a point to move it. If you want to delete it, you need to press the Shift key. While you hold the button, points will have an icon%s over them. Clicking that icon will delete the point."
+msgstr "When you're editing a route, you can drag and drop a point to move it. If you want to delete it, you need to press the Shift key. While you hold the button, points will have an icon%s over them. Clicking that icon will delete the point."
 
 #: application/views/scripts/faq/index.phtml:12
 msgid "Why should I create a account?"
 msgstr "Why should I create a account?"
 
 #: application/views/scripts/faq/index.phtml:13
-msgid ""
-"You can create routes without a account. But if you want to modify your "
-"routes afterwards, you need to be registered when creating the route."
-msgstr ""
-"You can create routes without a account. But if you want to modify your "
-"routes afterwards, you need to be registered when creating the route."
+msgid "You can create routes without a account. But if you want to modify your routes afterwards, you need to be registered when creating the route."
+msgstr "You can create routes without a account. But if you want to modify your routes afterwards, you need to be registered when creating the route."
 
 #: application/views/scripts/faq/index.phtml:15
 msgid "Is it possible to have my route \"attach\" nearby paths?"
 msgstr "Is it possible to have my route \"attach\" nearby paths?"
 
 #: application/views/scripts/faq/index.phtml:16
-msgid ""
-"When you create a route with syj, you must draw each point on the map. If "
-"your route follows an existing path, you still need to draw the layer "
-"manually: syj will not try to attach nearby existing paths. There are three "
-"main reasons. One bad reason: it would a lot of work to implement. And two "
-"good reasons: syj uses OpenStreetMap as a background map, and the map is "
-"still unfinished in many areas. Also, depending on your route, you may wish "
-"to attach to motorways, footways, biycle lanes, railways, &hellip;. If you "
-"are in a place with lot of differents routes, it would be nearly impossible "
-"to always choose the right way."
-msgstr ""
-"When you create a route with syj, you must draw each point on the map. If "
-"your route follows an existing path, you still need to draw the layer "
-"manually: syj will not try to attach nearby existing paths. There are three "
-"main reasons. One bad reason: it would a lot of work to implement. And two "
-"good reasons: syj uses OpenStreetMap as a background map, and the map is "
-"still unfinished in many areas. Also, depending on your route, you may wish "
-"to attach to motorways, footways, biycle lanes, railways, &hellip;. If you "
-"are in a place with lot of differents routes, it would be nearly impossible "
-"to always choose the right way."
+msgid "When you create a route with syj, you must draw each point on the map. If your route follows an existing path, you still need to draw the layer manually: syj will not try to attach nearby existing paths. There are three main reasons. One bad reason: it would a lot of work to implement. And two good reasons: syj uses OpenStreetMap as a background map, and the map is still unfinished in many areas. Also, depending on your route, you may wish to attach to motorways, footways, biycle lanes, railways, &hellip;. If you are in a place with lot of differents routes, it would be nearly impossible to always choose the right way."
+msgstr "When you create a route with syj, you must draw each point on the map. If your route follows an existing path, you still need to draw the layer manually: syj will not try to attach nearby existing paths. There are three main reasons. One bad reason: it would a lot of work to implement. And two good reasons: syj uses OpenStreetMap as a background map, and the map is still unfinished in many areas. Also, depending on your route, you may wish to attach to motorways, footways, biycle lanes, railways, &hellip;. If you are in a place with lot of differents routes, it would be nearly impossible to always choose the right way."
 
 #: application/views/helpers/LogoutLink.php:10
 #: application/layouts/scripts/footer.phtml:67
@@ -360,15 +281,13 @@ msgstr "[SYJ] Reset your password"
 msgid ""
 "Hi %user%,\n"
 "\n"
-"Someone, probably you, has asked to reset your password. If you want to "
-"reset\n"
+"Someone, probably you, has asked to reset your password. If you want to reset\n"
 "your password, please follow this link:\n"
 "%hashurl%\n"
 "\n"
 "If you do not not confirm within 2 days, your password will not be reset.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -377,15 +296,13 @@ msgid ""
 msgstr ""
 "Hi %user%,\n"
 "\n"
-"Someone, probably you, has asked to reset your password. If you want to "
-"reset\n"
+"Someone, probably you, has asked to reset your password. If you want to reset\n"
 "your password, please follow this link:\n"
 "%hashurl%\n"
 "\n"
 "If you do not not confirm within 2 days, your password will not be reset.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -400,17 +317,14 @@ msgstr "[SYJ] Validate your account"
 msgid ""
 "Hi %user%, and welcome on syj\n"
 "\n"
-"Your account is currently active, but you need to confirm your inscription "
-"by\n"
+"Your account is currently active, but you need to confirm your inscription by\n"
 "following this link:\n"
 "%hashurl%\n"
 "\n"
-"If you do not not confirm your inscription within 7 days, your account will "
-"be\n"
+"If you do not not confirm your inscription within 7 days, your account will be\n"
 "deleted.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -419,17 +333,14 @@ msgid ""
 msgstr ""
 "Hi %user%, and welcome on syj\n"
 "\n"
-"Your account is currently active, but you need to confirm your inscription "
-"by\n"
+"Your account is currently active, but you need to confirm your inscription by\n"
 "following this link:\n"
 "%hashurl%\n"
 "\n"
-"If you do not not confirm your inscription within 7 days, your account will "
-"be\n"
+"If you do not not confirm your inscription within 7 days, your account will be\n"
 "deleted.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -448,8 +359,7 @@ msgid ""
 "account will be deleted tomorrow. Please follow this link:\n"
 "%hashurl%\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -462,8 +372,7 @@ msgstr ""
 "account will be deleted tomorrow. Please follow this link:\n"
 "%hashurl%\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Thanks,\n"
@@ -478,12 +387,10 @@ msgstr "[SYJ] Account deactivated"
 msgid ""
 "Hi %user%,\n"
 "\n"
-"You have not validated your syj account on time. Therefore, your account "
-"have\n"
+"You have not validated your syj account on time. Therefore, your account have\n"
 "been deleted. Nevertheless, you can still create a new account.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Regards,\n"
@@ -492,12 +399,10 @@ msgid ""
 msgstr ""
 "Hi %user%,\n"
 "\n"
-"You have not validated your syj account on time. Therefore, your account "
-"have\n"
+"You have not validated your syj account on time. Therefore, your account have\n"
 "been deleted. Nevertheless, you can still create a new account.\n"
 "\n"
-"Please do not reply this email. If you need to contact us, please use the "
-"form\n"
+"Please do not reply this email. If you need to contact us, please use the form\n"
 "contact at %contacturl%\n"
 "\n"
 "Regards,\n"
@@ -544,12 +449,13 @@ msgstr "Hi,"
 #: application/controllers/ContactController.php:122
 #: application/controllers/NewpwdController.php:69
 #: application/controllers/AccountController.php:71
-#: application/forms/Contact.php:27
-msgid "Value is required and can't be empty"
-msgstr "Value is required and can't be empty"
+#: application/controllers/IdxController.php:150
+msgid "Value is required"
+msgstr "Value is required"
 
 #: application/controllers/ContactController.php:123
-#: application/forms/Contact.php:32 application/validate/EmailAddress.php:13
+#: application/forms/Contact.php:32
+#: application/validate/EmailAddress.php:13
 msgid "Invalid email"
 msgstr "Invalid email"
 
@@ -558,7 +464,8 @@ msgid "Oups, something went wrong"
 msgstr "Oups, something went wrong"
 
 #: application/controllers/TermsofuseController.php:10
-#: application/layouts/scripts/footer.phtml:87 application/forms/Geom.php:25
+#: application/layouts/scripts/footer.phtml:87
+#: application/forms/Geom.php:25
 #: application/forms/User.php:44
 msgid "terms of use"
 msgstr "terms of use"
@@ -579,10 +486,8 @@ msgstr "server could not be reached"
 
 #: application/controllers/ListController.php:37
 #: application/controllers/IdxController.php:123
-msgid ""
-"server did not understood request. That's probably caused by a bug in SYJ"
-msgstr ""
-"server did not understood request. That's probably caused by a bug in SYJ"
+msgid "server did not understood request. That's probably caused by a bug in SYJ"
+msgstr "server did not understood request. That's probably caused by a bug in SYJ"
 
 #: application/controllers/ListController.php:38
 #: application/controllers/IdxController.php:124
@@ -624,7 +529,8 @@ msgid "Password do not match"
 msgstr "Password do not match"
 
 #: application/controllers/AccountController.php:73
-#: application/forms/Account.php:33 application/forms/User.php:20
+#: application/forms/Account.php:33
+#: application/forms/User.php:20
 #, php-format
 msgid "At least %d characters"
 msgstr "At least %d characters"
@@ -657,12 +563,8 @@ msgid "save took place successfully"
 msgstr "save took place successfully"
 
 #: application/controllers/IdxController.php:125
-msgid ""
-"similar path seems to already exist. Please do not create two exactly "
-"identical paths"
-msgstr ""
-"similar path seems to already exist. Please do not create two exactly "
-"identical paths"
+msgid "similar path seems to already exist. Please do not create two exactly identical paths"
+msgstr "similar path seems to already exist. Please do not create two exactly identical paths"
 
 #: application/controllers/IdxController.php:130
 msgid "Login correct"
@@ -720,6 +622,10 @@ msgstr "create"
 msgid "You have an unsaved route"
 msgstr "You have an unsaved route"
 
+#: application/controllers/IdxController.php:151
+msgid "no result"
+msgstr "no result"
+
 #: application/layouts/scripts/footer.phtml:28
 msgid "contact"
 msgstr "contact"
@@ -732,7 +638,8 @@ msgstr "faq"
 msgid "user"
 msgstr "user"
 
-#: application/forms/Login.php:10 application/forms/Account.php:35
+#: application/forms/Login.php:10
+#: application/forms/Account.php:35
 #: application/forms/User.php:23
 msgid "password"
 msgstr "password"
@@ -741,6 +648,10 @@ msgstr "password"
 msgid "I forgot my password"
 msgstr "I forgot my password"
 
+#: application/forms/Contact.php:27
+msgid "Value is required and can't be empty"
+msgstr "Value is required and can't be empty"
+
 #: application/forms/Contact.php:36
 msgid "Email:"
 msgstr "Email:"
@@ -769,7 +680,8 @@ msgstr "Send a message"
 msgid "optional title for this journey"
 msgstr "optional title for this journey"
 
-#: application/forms/Geom.php:27 application/forms/User.php:46
+#: application/forms/Geom.php:27
+#: application/forms/User.php:46
 #, php-format
 msgid "I've read and accepted %s"
 msgstr "I've read and accepted %s"
@@ -779,12 +691,14 @@ msgstr "I've read and accepted %s"
 msgid "save"
 msgstr "save"
 
-#: application/forms/Account.php:27 application/forms/User.php:36
+#: application/forms/Account.php:27
+#: application/forms/User.php:36
 #: application/forms/Newpwd.php:28
 msgid "email"
 msgstr "email"
 
-#: application/forms/Account.php:42 application/forms/User.php:30
+#: application/forms/Account.php:42
+#: application/forms/User.php:30
 msgid "confirm password"
 msgstr "confirm password"
 
@@ -805,12 +719,8 @@ msgid "user name"
 msgstr "user name"
 
 #: application/forms/User.php:37
-msgid ""
-"After creating your account, you will receive a confirmation email. You have "
-"7 days to confirm otherwise, your account will be deleted."
-msgstr ""
-"After creating your account, you will receive a confirmation email. You have "
-"7 days to confirm otherwise, your account will be deleted."
+msgid "After creating your account, you will receive a confirmation email. You have 7 days to confirm otherwise, your account will be deleted."
+msgstr "After creating your account, you will receive a confirmation email. You have 7 days to confirm otherwise, your account will be deleted."
 
 #: application/forms/User.php:59
 msgid "create account"
@@ -818,12 +728,8 @@ msgstr "create account"
 
 #: application/forms/Pending/ResetPassword.php:11
 #, php-format
-msgid ""
-"Hi %s. Someone, probably you, has asked to reset password for your account. "
-"To get a new password, validate with following button."
-msgstr ""
-"Hi %s. Someone, probably you, has asked to reset password for your account. "
-"To get a new password, validate with following button."
+msgid "Hi %s. Someone, probably you, has asked to reset password for your account. To get a new password, validate with following button."
+msgstr "Hi %s. Someone, probably you, has asked to reset password for your account. To get a new password, validate with following button."
 
 #: application/forms/Pending/ResetPassword.php:16
 #: application/forms/Newpwd.php:33
@@ -835,47 +741,30 @@ msgid "cancel request"
 msgstr "cancel request"
 
 #: application/forms/Pending/ResetPassword.php:24
-msgid ""
-"To cancel this request, press following button. Your password will not "
-"change."
-msgstr ""
-"To cancel this request, press following button. Your password will not "
-"change."
+msgid "To cancel this request, press following button. Your password will not change."
+msgstr "To cancel this request, press following button. Your password will not change."
 
 #: application/forms/Pending/ValidateCreation.php:11
 #, php-format
-msgid ""
-"Someone, probably you, has registered an account %s with email address %s on "
-"syj. To confirm this account creation, validate with following button."
-msgstr ""
-"Someone, probably you, has registered an account %s with email address %s on "
-"syj. To confirm this account creation, validate with following button."
+msgid "Someone, probably you, has registered an account %s with email address %s on syj. To confirm this account creation, validate with following button."
+msgstr "Someone, probably you, has registered an account %s with email address %s on syj. To confirm this account creation, validate with following button."
 
 #: application/forms/Pending/ValidateCreation.php:24
-msgid ""
-"To cancel account creation, press following button. The account and all its "
-"data will be deleted."
-msgstr ""
-"To cancel account creation, press following button. The account and all its "
-"data will be deleted."
+msgid "To cancel account creation, press following button. The account and all its data will be deleted."
+msgstr "To cancel account creation, press following button. The account and all its data will be deleted."
 
 #~ msgid "modify"
 #~ msgstr "modify"
-
 #~ msgid "pseudo available"
 #~ msgstr "pseudo available"
-
 #~ msgid "pseudo not available"
 #~ msgstr "pseudo not available"
-
 #~ msgid "pseudo must only contain letters, digits, dots or underscores"
 #~ msgstr "pseudo must only contain letters, digits, dots or underscores"
-
 #~ msgid "You need to login before retrying to save"
 #~ msgstr "You need to login before retrying to save"
-
 #~ msgid "You need to have cookies enabled to login to SYJ"
 #~ msgstr "You need to have cookies enabled to login to SYJ"
-
 #~ msgid "reset password"
 #~ msgstr "reset password"
+
index eb3dea51a361de3516d186d25016e6655118f74e..ffe55218e2c348b96fb03cc6feaad3db3ce5423e 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: syj\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-08-19 20:01+0200\n"
+"POT-Creation-Date: 2010-08-20 14:01+0200\n"
 "PO-Revision-Date: \n"
 "Last-Translator: arno <arno@renevier.net>\n"
 "Language-Team: arno <arno@renevier.net>\n"
@@ -70,7 +70,7 @@ msgid "login"
 msgstr "connexion"
 
 #: application/views/scripts/idx/index.phtml:34
-#: application/views/scripts/idx/index.phtml:88
+#: application/views/scripts/idx/index.phtml:105
 msgid "create an account"
 msgstr "créer un compte"
 
@@ -78,17 +78,29 @@ msgstr "créer un compte"
 msgid "Whith an account, you can manage and modify your routes"
 msgstr "Avec un compte, vous pourrez gérer et modifier vos itinéraires"
 
-#: application/views/scripts/idx/index.phtml:52
+#: application/views/scripts/idx/index.phtml:53
 #: application/controllers/IdxController.php:148
 msgid "duplicate"
 msgstr "dupliquer"
 
-#: application/views/scripts/idx/index.phtml:54
+#: application/views/scripts/idx/index.phtml:55
 #: application/controllers/IdxController.php:146
 msgid "edit"
 msgstr "modifier"
 
-#: application/views/scripts/idx/index.phtml:56
+#: application/views/scripts/idx/index.phtml:59
+msgid "Search a place"
+msgstr "Rechercher un lieu"
+
+#: application/views/scripts/idx/index.phtml:63
+msgid "Ok"
+msgstr "Ok"
+
+#: application/views/scripts/idx/index.phtml:67
+msgid "more results"
+msgstr "plus de résultats"
+
+#: application/views/scripts/idx/index.phtml:73
 msgid "start a route"
 msgstr "commencer un itinéraire"
 
@@ -439,9 +451,9 @@ msgstr "Bonjour,"
 #: application/controllers/ContactController.php:122
 #: application/controllers/NewpwdController.php:69
 #: application/controllers/AccountController.php:71
-#: application/forms/Contact.php:27
-msgid "Value is required and can't be empty"
-msgstr "Le champ est requis, et ne doit pas être vide"
+#: application/controllers/IdxController.php:150
+msgid "Value is required"
+msgstr "Le champ est requis"
 
 #: application/controllers/ContactController.php:123
 #: application/forms/Contact.php:32
@@ -612,6 +624,10 @@ msgstr "créér"
 msgid "You have an unsaved route"
 msgstr "Vous avez un itinéraire non sauvegardé"
 
+#: application/controllers/IdxController.php:151
+msgid "no result"
+msgstr "pas de résultat"
+
 #: application/layouts/scripts/footer.phtml:28
 msgid "contact"
 msgstr "contact"
@@ -634,6 +650,10 @@ msgstr "mot de passe"
 msgid "I forgot my password"
 msgstr "J'ai oublié mon mot de passe"
 
+#: application/forms/Contact.php:27
+msgid "Value is required and can't be empty"
+msgstr "Le champ est requis, et ne doit pas être vide"
+
 #: application/forms/Contact.php:36
 msgid "Email:"
 msgstr "Email:"
index 38de1516b78db1ba2a8d60ff807e25c509bcf485..743c2513ed79d4dac927c57b27f0ee7763a496eb 100644 (file)
 
     <div id="data_controls">
         <div id="data_controls_btns">
+
     <?php if (isset($this->path)) { ?>
         <input id="clone-btn" name="clone-btn" type="button" value="<?php echo $this->translate('duplicate');?>">
         <br>
         <input id="edit-btn" name="edit-btn" type="button" value="<?php echo $this->translate('edit');?>">
     <?php } else {?>
+
+        <form id="nominatim-form" action="nominatim" method="get">
+            <div><a id="nominatim-label" href=""><?php echo $this->translate('Search a place')?></a></div>
+            <div id="nominatim-message" class="message"></div>
+            <div id="nominatim-controls">
+            <input name="nominatim-search" id="nominatim-search">
+            <input type="submit" id="nominatim-submit" name="nominatim-submit" value="<?php echo $this->translate('Ok')?>">
+            <img id="nominatim-throbber" src="icons/throbber.gif">
+            </div>
+
+            <div id="nominatim-suggestions">
+            <div id="nominatim-suggestions-title"><?php echo $this->translate('more results')?></div>
+            <ul id="nominatim-suggestions-list"></ul>
+            </div>
+
+        </form>
+
         <input id="create-btn" name="create-btn" type="button" value="<?php echo $this->translate('start a route');?>">
     <?php } ?>
         </div>
index 1360f7ebaf1fdf4b02e5bc817e21f0f862b1165b..18e5927c8c8cfbd68568fbdb17a7e94f391d136e 100644 (file)
@@ -67,6 +67,59 @@ body, html {
 #data_controls_btns {
     padding: 5px 10px 5px 10px;
 }
+
+#nominatim-form {
+    text-align: left;
+    padding-bottom: 7px;
+    margin-bottom: 3px;
+    border-bottom: 1px solid black;
+}
+#nominatim-message {
+    max-width: 16em;
+    padding: 15px 0 15px 0;
+}
+#nominatim-label {
+    text-decoration: none;
+}
+#nominatim-search {
+    border: 1px solid black;
+}
+#nominatim-submit {
+    width: 26px;
+    border: 1px solid black;
+    padding: 0;
+}
+#nominatim-suggestions {
+    border: 2px solid blue;
+    -moz-border-radius: 8px;
+    -webkit-border-radius: 8px;
+    border-radius: 8px;
+    margin-top: 8px;
+    max-width: 360px;
+    width: 360px\9; /* ie only */
+    position: absolute;
+    background-color: white;
+}
+#nominatim-suggestions-title {
+    text-align: center;
+    font-weight: bold;
+}
+#nominatim-suggestions-list {
+    list-style: none;
+    padding: 0 16px 0 12px;
+}
+#nominatim-suggestions-list li.current {
+    background-color: #D3D3D3;
+}
+.nominatim-suggestions-icon {
+    border: none;
+    vertical-align: middle;
+    margin-right: 4px;
+}
+.nominatim-suggestions-link {
+    text-decoration: none;
+}
+
 #geomform {
     padding: 25px 45px 20px 45px;
     *width: 40%; /* otherwise takes all screen width in ie<7 */
diff --git a/public/icons/world.png b/public/icons/world.png
new file mode 100644 (file)
index 0000000..68f21d3
Binary files /dev/null and b/public/icons/world.png differ
index 39ecd4f90bdf86b8321054ead2e08f823a28612d..b3c8d800cbe3a5a74f2eb9ab812958a99d6d345a 100644 (file)
@@ -887,7 +887,7 @@ var PseudoChecker = {
 
             $("user_pseudo").up('tr').insert({after: row});
             this.messageelt = new Element('span');
-            this.throbber = new Element("img", { src: "icons/pseudo-throbber.gif"});
+            this.throbber = new Element("img", { src: "icons/throbber.gif"});
             row.down('div').insert(this.throbber).insert(this.messageelt);
         }
         if (throbber) {
@@ -962,6 +962,147 @@ var PseudoChecker = {
     }
 };
 
+var Nominatim = (function() {
+    var presubmit = function() {
+        var input = $("nominatim-search");
+        if (input.value.strip().empty()) {
+            $("nominatim-message").setMessage(SyjStrings.notEmptyField, "warn");
+            input.activate();
+            return false;
+        }
+        $("nominatim-suggestions").hide();
+        $("nominatim-message").hide();
+        $("nominatim-throbber").show();
+        return true;
+    };
+
+    var zoomToExtent = function(bounds) { // we must call map.setCenter with forceZoomChange to true. See ol#2798
+        var center = bounds.getCenterLonLat();
+        if (this.baseLayer.wrapDateLine) {
+            var maxExtent = this.getMaxExtent();
+            bounds = bounds.clone();
+            while (bounds.right < bounds.left) {
+                bounds.right += maxExtent.getWidth();
+            }
+            center = bounds.getCenterLonLat().wrapDateLine(maxExtent);
+        }
+        this.setCenter(center, this.getZoomForExtent(bounds), false, true);
+    }
+
+    var success = function(transport) {
+        $("nominatim-throbber").hide();
+
+        if (!transport.responseJSON || !transport.responseJSON.length) {
+            $("nominatim-message").setMessage(SyjStrings.noResult, 'error');
+            $("nominatim-search").activate();
+            return;
+        }
+
+        var place = transport.responseJSON[0],
+            bbox = place.boundingbox;
+
+        if (!bbox || bbox.length !== 4) {
+            $("nominatim-message").setMessage(SyjStrings.requestError, 'error');
+            return;
+        }
+
+        extent = new OpenLayers.Bounds(bbox[2], bbox[1], bbox[3], bbox[0]).transform(WGS84, Mercator);
+        zoomToExtent.call(SYJView.map, extent);
+
+        $("nominatim-suggestions-list").update();
+
+        var clickhandler = function(bbox) {
+            return function(evt) {
+                evt.stop();
+                var extent = new OpenLayers.Bounds(bbox[2], bbox[1], bbox[3], bbox[0]).transform(WGS84, Mercator);
+                $("nominatim-suggestions-list").select("li").invoke('removeClassName', 'current');
+                evt.target.up('li').addClassName('current');
+                SYJView.map.zoomToExtent(extent);
+            };
+        };
+
+        for (var i = 0; i < transport.responseJSON.length; i++) {
+            var item = transport.responseJSON[i];
+            if (item.display_name && item.boundingbox && item.boundingbox.length === 4) {
+                var li = new Element("li");
+                var anchor = new Element("a", {
+                    href: "",
+                    className: "nominatim-suggestions-link"
+                });
+
+                anchor.observe('click', clickhandler(item.boundingbox));
+
+                var text = document.createTextNode(item.display_name);
+                var icon = new Element("img", {
+                    className: "nominatim-suggestions-icon",
+                    src: item.icon || 'icons/world.png'
+                });
+                anchor.appendChild(text); // insert does not work; see prototype #1125
+                li.insert(icon).insert(anchor);
+                $("nominatim-suggestions-list").insert(li);
+                if ($("nominatim-suggestions-list").childNodes.length >= 6) {
+                    break;
+                }
+            }
+        }
+
+        if ($("nominatim-suggestions-list").childNodes.length > 1) {
+            $("nominatim-suggestions").show();
+            $("nominatim-suggestions-list").select("li:first-child")[0].addClassName('current');
+        } else {
+            $("nominatim-suggestions").hide();
+        }
+
+    };
+
+    var failure = function(transport) {
+        $("nominatim-throbber").hide();
+
+        var httpCode = 0, message = SyjStrings.unknownError, input; // default message error
+
+        if (transport) {
+            httpCode = transport.getStatus();
+        }
+
+        switch (httpCode) {
+            case 0:
+                message = SyjStrings.notReachedError;
+            break;
+            case 400:
+            case 404:
+                message = SyjStrings.requestError;
+            break;
+            case 500:
+                message = SyjStrings.serverError;
+            break;
+        }
+
+        $("nominatim-message").setMessage(message, 'error');
+    };
+
+    return {
+        init: function() {
+            if (!$("nominatim-form")) {
+               return;
+            }
+            $("nominatim-controls").hide();
+            $("nominatim-label").observe('click', function(evt) {
+                $("nominatim-controls").show();
+                $("nominatim-search").activate();
+                evt.stop();
+            });
+
+            $("nominatim-form").ajaxize({
+                presubmit: presubmit,
+                onSuccess: success,
+                onFailure: failure
+              });
+            new CloseBtn($("nominatim-suggestions"));
+
+            $$("#nominatim-message, #nominatim-suggestions, #nominatim-throbber").invoke('hide');
+        }
+    };
+}());
 
 document.observe("dom:loaded", function() {
     SYJLogin.init();
@@ -970,7 +1111,9 @@ document.observe("dom:loaded", function() {
     SYJView.init();
     SYJNewpwd.init();
     LoginMgr.updateUI();
+    Nominatim.init();
 });
+
 window.onbeforeunload = function() {
     if (SYJView.unsavedRoute) {
         return SyjStrings.unsavedConfirmExit;
index 85fe57a6acac89af4619ecaef3d3912d95ebc18e..dfc1a3d76952e960e706653b6a94dfdfa9c616d4 100644 (file)
@@ -10,14 +10,18 @@ var CloseBtn = Class.create({
             return;
         }
 
+        if (typeof options !== "object") {
+            options = {};
+        }
+
         style = Object.extend({
             float: "right",
             margin: "2px",
             fontWeight: "bold",
             padding: "0px"
-        }, typeof options === "object" ? options.style: {});
+        }, options.style);
 
-        imgsrc = (options && options.closeBtnSrc) || "icons/close.png";
+        imgsrc = (options.closeBtnSrc) || "icons/close.png";
         btn = new Element("input", { type: "image", src: imgsrc, alt: "X"}).setStyle(style);
         elt.insert({top: btn});
         btn.observe("click", function(evt) {