From db98e1f62272cff0b425133aa3b909c5cfa6183d Mon Sep 17 00:00:00 2001 From: arno Date: Fri, 20 Aug 2010 15:02:21 +0200 Subject: [PATCH] search a place with nominatim --- COPYING.TXT | 8 +- application/configs/application.ini | 4 + application/controllers/AccountController.php | 2 +- application/controllers/ContactController.php | 2 +- application/controllers/IdxController.php | 2 + application/controllers/NewpwdController.php | 2 +- .../controllers/NominatimController.php | 31 ++ application/controllers/helpers/SyjApi.php | 1 + application/languages/lang_en.po | 313 ++++++------------ application/languages/lang_fr.po | 36 +- application/views/scripts/idx/index.phtml | 18 + public/css/syj.css | 53 +++ .../{pseudo-throbber.gif => throbber.gif} | Bin public/icons/world.png | Bin 0 -> 923 bytes public/js/syj.js | 145 +++++++- public/js/utils.js | 8 +- 16 files changed, 395 insertions(+), 230 deletions(-) create mode 100644 application/controllers/NominatimController.php rename public/icons/{pseudo-throbber.gif => throbber.gif} (100%) create mode 100644 public/icons/world.png diff --git a/COPYING.TXT b/COPYING.TXT index b8188b7..6128571 100644 --- a/COPYING.TXT +++ b/COPYING.TXT @@ -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. diff --git a/application/configs/application.ini b/application/configs/application.ini index 1f0a587..3c74396 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -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" diff --git a/application/controllers/AccountController.php b/application/controllers/AccountController.php index 57ea4d4..c9c986e 100644 --- a/application/controllers/AccountController.php +++ b/application/controllers/AccountController.php @@ -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"), diff --git a/application/controllers/ContactController.php b/application/controllers/ContactController.php index e72c467..3e82c7d 100644 --- a/application/controllers/ContactController.php +++ b/application/controllers/ContactController.php @@ -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")); } } diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index 7728110..10506da 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -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"), ); } diff --git a/application/controllers/NewpwdController.php b/application/controllers/NewpwdController.php index 1a4ab07..de8ec3b 100644 --- a/application/controllers/NewpwdController.php +++ b/application/controllers/NewpwdController.php @@ -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 index 0000000..b254c80 --- /dev/null +++ b/application/controllers/NominatimController.php @@ -0,0 +1,31 @@ +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()); + } +} diff --git a/application/controllers/helpers/SyjApi.php b/application/controllers/helpers/SyjApi.php index 37b010a..21aa9dd 100644 --- a/application/controllers/helpers/SyjApi.php +++ b/application/controllers/helpers/SyjApi.php @@ -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) { diff --git a/application/languages/lang_en.po b/application/languages/lang_en.po index 658a799..59e393b 100644 --- a/application/languages/lang_en.po +++ b/application/languages/lang_en.po @@ -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 \n" "Language-Team: arno \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 %s" -msgstr "" -"There was an unkwown message when sending the message. Please try again " -"later, or send a mail directly to %s" +msgid "There was an unkwown message when sending the message. Please try again later, or send a mail directly to %s" +msgstr "There was an unkwown message when sending the message. Please try again later, or send a mail directly to %s" #: 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 publicly available under a agpl license. The " -"map used to display the routes comes from openstreetmap." -msgstr "" -"Sources of the software running the website are publicly available under a agpl license. The " -"map used to display the routes comes from openstreetmap." +msgid "Sources of the software running the website are publicly available under a agpl license. The map used to display the routes comes from openstreetmap." +msgstr "Sources of the software running the website are publicly available under a agpl license. The map used to display the routes comes from openstreetmap." #: 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 %s. 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 %s. 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 %s. 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 %s. 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 "" -"Syj 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 "" -"Syj 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 "Syj 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 "Syj 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, …. 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, …. 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, …. 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, …. 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" + diff --git a/application/languages/lang_fr.po b/application/languages/lang_fr.po index eb3dea5..ffe5521 100644 --- a/application/languages/lang_fr.po +++ b/application/languages/lang_fr.po @@ -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 \n" "Language-Team: arno \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:" diff --git a/application/views/scripts/idx/index.phtml b/application/views/scripts/idx/index.phtml index 38de151..743c251 100644 --- a/application/views/scripts/idx/index.phtml +++ b/application/views/scripts/idx/index.phtml @@ -48,11 +48,29 @@
+ path)) { ?>
+ +
+ +
+
+ + + +
+ +
+
translate('more results')?>
+
    +
    + +
    +
    diff --git a/public/css/syj.css b/public/css/syj.css index 1360f7e..18e5927 100644 --- a/public/css/syj.css +++ b/public/css/syj.css @@ -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/pseudo-throbber.gif b/public/icons/throbber.gif similarity index 100% rename from public/icons/pseudo-throbber.gif rename to public/icons/throbber.gif diff --git a/public/icons/world.png b/public/icons/world.png new file mode 100644 index 0000000000000000000000000000000000000000..68f21d30116710e48a8bf462cb32441e51fad5f6 GIT binary patch literal 923 zcmV;M17!S(P)A9)b<7tX~vT z$e)FfZ+`X4_uKyq#wJHC;J3lH{lhQkUc~Wid;*pnjhM12xe-bPByd^xuQ9zgeM^Mm z*tc)|P}LtTnHXr@Gkmmbkg^O2bqyhO>LP|qjIwW2@Di+4EuKm~&tOO2!N3o{128Hl z9v%fgerM0C#)7P|PMvxr*!Gf?eGA8f{OT6fS`9l>LQCg)p=~c$Zr|AT_0+_?F*JJk zlapOT2Q(wWx-LMq(TxXxLn+U;!LV)MhNp~ommdh+fo8T*&g-yQbbG&ze&=>tC(Ar=&^1xlA;Jc(6 zcCi_xs8k}-S&#ONOHm%e@#nGC7F++8C~r29Or!_{(QGQEG)+O^J1BCPmgM4JAzC8I z`jS9bO>|}Jq_#$IRzp0d34>)&3L%7MN)eTv!0B!^nn}f4z2*vFE@jv3dn zG>H)u>FR7_d2JcsjvfZ$vkP~xik@T^(_N)nx=tqJV+tQjQ`owJ83bf`zX6Ear*=Mhzn5QUuXE|v zR33Qyi8G!0{H2r##d#6R6YmYbZz4NTssT;cXiGb6lxO+k@{ba@2D~*hKDY6N;Bkh> xhhCRLejsJkAIT{5sICHcfU`5>bKmUb{{y)0nR3PMMxX!y002ovPDHLkV1nl+t-}BS literal 0 HcmV?d00001 diff --git a/public/js/syj.js b/public/js/syj.js index 39ecd4f..b3c8d80 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -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; diff --git a/public/js/utils.js b/public/js/utils.js index 85fe57a..dfc1a3d 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -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) { -- 2.39.2