]> dev.renevier.net Git - syj.git/commitdiff
allow uploading a route as a file
authorarno <arno@renevier.net>
Fri, 18 Mar 2011 11:30:20 +0000 (12:30 +0100)
committerarno <arno@renevier.net>
Sun, 20 Mar 2011 14:46:55 +0000 (15:46 +0100)
20 files changed:
application/Bootstrap.php
application/controllers/ErrorController.php
application/controllers/IdxController.php
application/controllers/PathController.php
application/controllers/helpers/SyjApi.php
application/controllers/helpers/SyjPostData.php
application/exception/InvalidGeomUpload.php [new file with mode: 0644]
application/exception/ToolargeGeomUpload.php [new file with mode: 0644]
application/forms/Geom.php
application/interface/Processor.php [new file with mode: 0644]
application/languages/lang_en.po
application/languages/lang_fr.po
application/languages/lang_ja.po
application/views/helpers/FooterLink.php
application/views/scripts/idx/index.phtml
library/gisconverter
public/css/syj.css
public/js/syj.js
public/js/utils.js
public/modifiablepath

index 5da7d3e218aa93533a938652c4da1edecfe43c38..36471f3c38c3c159991fe184a0a134a1cc4dda20 100644 (file)
@@ -14,8 +14,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
         parent::_bootstrap($resource);
     }
 
-    public function run()
-    {
+    public function run() {
         $sessionConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
         Zend_Session::setOptions($sessionConfig->toArray());
         Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->initView(APPLICATION_PATH . '/views/', 'Syj_View');
@@ -38,7 +37,16 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
                 return;
             }
 
-            $dirpath = implode('/', array_map('strtolower', array_slice($segments, 1, -1)));
+            $isinterface = false;
+            if (strtolower(end($segments)) == "interface") {
+                $isinterface = true;
+                array_pop($segments);
+            }
+
+            $dirpath = implode(DIRECTORY_SEPARATOR, array_map('strtolower', array_slice($segments, 1, -1)));
+            if ($isinterface) {
+                $dirpath = "interface" . DIRECTORY_SEPARATOR . $dirpath;
+            }
             $filename = APPLICATION_PATH . '/' . ($dirpath ? $dirpath . '/' : '') . end($segments) . '.php';
             if (Zend_Loader::isReadable($filename)) {
                 include_once $filename;
index 28f321bf563c2c317440d327a21d3ad89f5ba91d..486c24a948aef9138291d49a3ba910f2f5e2bc39 100644 (file)
@@ -43,6 +43,11 @@ class ErrorController extends Zend_Controller_Action
 
         if ($error_code == 400 and $error->request->isXmlHttpRequest()) {
             return $this->_helper->json(array('message' => $error->exception->getMessage()));
+        } else if ($error->exception instanceof Syj_Exception_InvalidGeomUpload) {
+            // invalid file upload: we will redirect to main page
+            $this->_helper->SyjReset->resetPlaceHolders();
+            $this->_request->setControllerName('idx')->setActionName('error')->setDispatched(false);
+            return;
         }
 
         // conditionally display exceptions
index 790c8c766348edd0f88205b23670ee96db772c3d..b7d36839f01499feadc193250114259723cfc00e 100644 (file)
@@ -33,14 +33,11 @@ class IdxController extends Zend_Controller_Action
     }
 
     public function indexAction() {
-        $url = $this->getRequest()->getUserParam('url');
-
-        $geomform = new Syj_Form_Geom(array('name' => 'geomform'));
-        $loginform = new Syj_Form_Login(array('name' => 'loginform', 'action' => 'login'));
-        $userform = new Syj_Form_User(array('name' => 'userform', 'action' => 'user'));
-        $newpwdform = new Syj_Form_Newpwd(array('name' => 'newpwdform', 'action' => 'newpwd'));
+        $this->_initForms();
 
+        $url = $this->getRequest()->getUserParam('url');
         if (isset($url)) {
+            $this->view->geomform->setAction("");
             $pathMapper = new Syj_Model_PathMapper();
             $path = new Syj_Model_Path();
             if (!$pathMapper->findByUrl($url, $path)) {
@@ -62,21 +59,10 @@ class IdxController extends Zend_Controller_Action
             $this->view->path = $path;
             $jsgeom = new phptojs\JsObject('gInitialGeom', array('data' => (string) $path->geom));
             $this->view->headScript()->prependScript((string) $jsgeom);
-            $loginform->login_geom_id->setValue((string)$path->id);
-            $geomform->geom_title->setValue($path->title);
+            $this->view->loginform->login_geom_id->setValue((string)$path->id);
+            $this->view->geomform->geom_title->setValue($path->title);
         } else {
-            $geomform->setAction('path');
-
-            $lat = $this->getRequest()->getQuery('lat');
-            $lon = $this->getRequest()->getQuery('lon');
-            $zoom = $this->getRequest()->getQuery('zoom');
-            if (is_numeric ($lat) and is_numeric ($lon) and is_numeric ($zoom)) {
-                $initialpos = array('lat' => (float)$lat, 'lon' => (float)$lon, 'zoom' => (int)$zoom);
-            } else {
-                $initialpos =  $this->_helper->syjGeoip($this->getRequest()->getClientIp(true));
-            }
-
-            $this->view->headScript()->prependScript((string) new phptojs\JsObject('gInitialPos', $initialpos));
+            $this->_setInitialPos();
             $title = "Show your journey";
         }
 
@@ -88,11 +74,52 @@ class IdxController extends Zend_Controller_Action
         }
         $this->view->headTitle($title);
         $this->view->headMeta()->appendName('description', $this->view->translate('website to share routes'));
-        $this->view->geomform = $geomform;
-        $this->view->loginform = $loginform;
-        $this->view->userform = $userform;
-        $this->view->newpwdform = $newpwdform;
+
+        $this->view->loggedUser = $this->_helper->SyjSession->user();
+    }
+
+    protected function _initForms() {
+        $this->view->geomform = new Syj_Form_Geom(array('name' => 'geomform', 'action' => 'path'));
+        $this->view->loginform = new Syj_Form_Login(array('name' => 'loginform', 'action' => 'login'));
+        $this->view->userform = new Syj_Form_User(array('name' => 'userform', 'action' => 'user'));
+        $this->view->newpwdform = new Syj_Form_Newpwd(array('name' => 'newpwdform', 'action' => 'newpwd'));
+    }
+
+    protected function _setInitialPos() {
+        $lat = $this->getRequest()->getQuery('lat');
+        $lon = $this->getRequest()->getQuery('lon');
+        $zoom = $this->getRequest()->getQuery('zoom');
+        if (is_numeric ($lat) and is_numeric ($lon) and is_numeric ($zoom)) {
+            $initialpos = array('lat' => (float)$lat, 'lon' => (float)$lon, 'zoom' => (int)$zoom);
+        } else {
+            $initialpos =  $this->_helper->syjGeoip($this->getRequest()->getClientIp(true));
+        }
+        $this->view->headScript()->prependScript((string) new phptojs\JsObject('gInitialPos', $initialpos));
+    }
+
+    public function errorAction() {
+        Zend_Controller_Front::getInstance()->getRequest()->setRequestUri($this->_request->getBaseUrl());
+        $this->_initForms();
+        $this->_setInitialPos();
+
+        $this->_jsLoggedInfo(null);
+        $this->_jsLocaleStrings();
+
+        $this->view->headTitle("Show your journey");
+        $this->view->headMeta()->appendName('description', $this->view->translate('website to share routes'));
         $this->view->loggedUser = $this->_helper->SyjSession->user();
+        $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/index.:suffix');
+
+        $error = $this->_getParam('error_handler');
+        if ($error) {
+            if ($error->exception instanceof Syj_Exception_ToolargeGeomUpload) {
+                $maxsize = $this->_bytesToString(min($this->_strToBytes(ini_get('upload_max_filesize')),
+                                                    $this->_strToBytes(ini_get('upload_max_filesize'))));
+                $this->view->errorMsg = $this->view->translate('File too large. File size must not exceed %s', $maxsize);
+            } else if ($error->exception instanceof Syj_Exception_InvalidGeomUpload) {
+                $this->view->errorMsg = $this->view->translate("Invalid file");
+            }
+        }
     }
 
     protected function _jsLoggedInfo(Syj_Model_Path $path = null) {
@@ -157,4 +184,35 @@ class IdxController extends Zend_Controller_Action
             );
     }
 
+    private function _strToBytes($value) {
+        $value = trim($value);
+        if (is_numeric($value)) {
+            return (integer) $value;
+        }
+        $last = strtolower($value[strlen($value)-1]);
+        $value = (int)$value;
+        switch ($last) {
+            case 'k' :
+                $value *= 1024;
+            break;
+            case 'm' :
+                $value *= 1024 * 1024;
+            break;
+            case 'g' :
+                $value *= 1024 * 1024 * 1024;
+            break;
+            default :
+            break;
+        }
+        return $value;
+    }
+
+    private function _bytesToString($size) {
+        $sizes = array('B', 'kB', 'MB', 'GB');
+        for ($c=0; $c < (count ($sizes) - 1) && $size >= 1024; $c++) {
+            $size = $size / 1024;
+        }
+        return round($size) . $sizes[$c];
+    }
+
 }
index bb969e82c8ed6b15888a6cf9de01adc0510c7a4e..cdd067b6f4ba2b43722f7256d32d19fd2dd506e3 100644 (file)
@@ -16,8 +16,14 @@ class PathController extends Zend_Controller_Action
         $path->creatorIp = $this->getRequest()->getClientIp(true);
 
         $this->save($path, $formData);
-        $data = array('redirect' => "idx/" . (string)$path->id);
-        $this->_helper->SyjApi->setCode(201)->setBodyJson($data);
+
+        $redirecturl = "idx/" . (string)$path->id;
+        if ($this->getRequest()->isXmlHttpRequest()) {
+            $data = array('redirect' => $redirecturl);
+            $this->_helper->SyjApi->setCode(201)->setBodyJson($data);
+        } else {
+            $this->_helper->SyjApi->setRedirect($redirecturl, 303);
+        }
     }
 
     public function updateAction() {
@@ -55,12 +61,22 @@ class PathController extends Zend_Controller_Action
 
     public function save(Syj_Model_Path $path, $formData) {
         /* setting geom property */
-        $decoder = new gisconverter\WKT();
-        try {
-            $geom = $decoder->geomFromText($formData["geom_data"]);
-        } catch (gisconverter\CustomException $e) {
-            throw new Syj_Exception_Request();
+        $geom = null;
+        foreach (array("WKT", "KML", "GPX", "geoJSON") as $dectype) {
+            $classname = 'gisconverter\\' . $dectype;
+            $decoder = new $classname();
+            try {
+                $geom = $decoder->geomFromText($formData["geom_data"]);
+            } catch (Exception $e) {
+            }
+            if ($geom) {
+                break;
+            }
         }
+        if (!$geom) {
+            throw new Syj_Exception_InvalidGeomUpload();
+        }
+
         if ($geom::name != "LineString") {
             throw new Syj_Exception_Request();
         }
index 21aa9dd9f9b3fe5e4c88a2eb37bdaa4d8240eb5d..bfb97927d1a2aeb97d51573869a4a040308d2646 100644 (file)
@@ -8,6 +8,7 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
     protected $_checkIfNoneMatch = false;
     protected $_body = '';
     protected $_code = 200;
+    protected $_redirect = '';
 
     public function init() {
         $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
@@ -51,6 +52,20 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
         return $this->_code;
     }
 
+    public function setRedirect($url, $code = 0) {
+        $this->_redirect = (string)$url;
+        if (is_numeric($code) && (int)$code >= 300 && (int)$code < 400) {
+            $this->_code;
+        } else if (!isset($this->_code)) {
+            $this->code = 301;
+        }
+        return $this;
+    }
+
+    public function getRedirect() {
+        return $this->_redirect;
+    }
+
     public function setCheckIfNoneMatch($check) {
         $this->_checkIfNoneMatch = (boolean)$check;
         return $this;
@@ -80,6 +95,10 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
             $response->setHeader ('Etag', $etag);
         }
 
+        if ($this->_redirect) {
+            $response->setHeader ('Location', $this->_redirect);
+        }
+
         $response->setHttpResponseCode($this->_code)
                  ->setBody($this->_body);
     }
index 3f18222545f7e2e0cfdd710bf40310ea9b8fd52f..b80fd2bacc25a7cc7f9e471f714331f9025242c3 100644 (file)
@@ -17,6 +17,11 @@ class Syj_Controller_Action_Helper_SyjPostData extends Zend_Controller_Action_He
             throw new Syj_Exception_Request();
         }
         $data = $this->getRequest()->getPost();
+
+        if ($form instanceof Syj_Processor_Interface) {
+            $form->process($data);
+        }
+
         if (!$form->isValid($data)) {
             throw new Syj_Exception_Request();
         }
diff --git a/application/exception/InvalidGeomUpload.php b/application/exception/InvalidGeomUpload.php
new file mode 100644 (file)
index 0000000..9911db5
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+class Syj_Exception_InvalidGeomUpload extends Syj_Exception_Request
+{
+     protected $_message = 'invalidgeomupload';
+}
+?>
diff --git a/application/exception/ToolargeGeomUpload.php b/application/exception/ToolargeGeomUpload.php
new file mode 100644 (file)
index 0000000..26eab34
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+class Syj_Exception_ToolargeGeomUpload extends Syj_Exception_InvalidGeomUpload
+{
+     protected $_message = 'toolargegeomupload';
+}
+?>
index 3d99a87bd6014b7522b2bee84c7bef81439be960..4515f016e10956722deb89114579a1eee7bd009d 100644 (file)
@@ -2,25 +2,39 @@
 /*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
     and is published under the AGPL license. */
 
-class Syj_Form_Geom extends Zend_Form
+class Syj_Form_Geom extends Zend_Form implements Syj_Processor_Interface
 {
-    protected $_elementDecorators = array( 'ViewHelper', 'Errors',);
-
     protected $_decorators = array(
                             'FormElements' => array('decorator' => 'FormElements', 'options' => null),
                             'Form' => array('decorator' => 'Form', 'options' => null)
                             );
 
-    public function init() {
-        $data = array('Hidden', 'geom_data', array('required' => true));
+    public function __construct($options = null) {
+        $translator = $this->getTranslator();
+
+        $data = array('Hidden', 'geom_data', array('required' => true, 'decorators' => array('ViewHelper', 'Errors')));
+
+        $upload = array('File', 'geom_upload', array("label" => $translator->translate("choose route from a file"),
+                                        'validators' => array(),
+                                        'ignoreNoFile' => true,
+                                        'decorators' => array(
+                                            'File',
+                                            'Errors',
+                                            array('Label', array('separator' => '<br>')),
+                                            array('HtmlTag', array('tag' => 'div', 'id' => 'geom_upload_container')),
+                                        )));
 
         $title = array('Text', 'geom_title', array(
             'label' => __("optional title for this journey"),
             'attribs' => array('maxlength' => '40', 'size' => '20'),
-            'validators' => array(new Zend_Validate_StringLength(0, 40))
-            ));
+            'validators' => array(new Zend_Validate_StringLength(0, 40)),
+            'decorators' => array(
+                                'ViewHelper',
+                                'Errors',
+                                array('Label', array('separator' => '<br>')),
+                                array('HtmlTag', array('tag' => 'div', 'id' => 'geom_title_container')),
+                                )));
 
-        $translator = $this->getTranslator();
         $anchor = $this->getView()->Anchor("termsofuse?format=raw",
                                            $translator->translate("terms of use"),
                                            array('id' => 'geom_termsofuse_anchor'));
@@ -33,16 +47,44 @@ class Syj_Form_Geom extends Zend_Form
                                   'label',
                                   array('HtmlTag', array('tag' => 'div', 'id' => 'geom_accept_container', 'class' => 'logged-hide')))));
 
-        $submit = array('Submit', 'geom_submit', array('label' => __("save")));
-
-        $this->addElements(array($data, $title, $touaccept, $submit));
+        $submit = array('Submit', 'geom_submit', array('label' => __("save"), 'decorators' => array(
+                            'ViewHelper',
+                            'Errors',
+                            array('HtmlTag', array('tag' => 'br', 'openOnly' => true)))));
+        $this->addElements(array($data, $upload, $title, $touaccept, $submit));
 
         $decorator = $this->geom_accept->getDecorator('Zend_Form_Decorator_Label');
         $decorator->setOption('escape', false);
 
-        $this->geom_title->addDecorator('HtmlTag', array('tag' => 'br', 'openOnly' => true))->
-            addDecorator('label');
-        $this->geom_submit->addDecorator('HtmlTag', array('tag' => 'br', 'openOnly' => true));
+        parent::__construct($options);
+    }
+
+    public function process(&$data) {
+        $upload = null;
+        if ($this->getValue("geom_upload")) {
+            $file = $this->geom_upload;
+            $upload = $file->getDestination() . DIRECTORY_SEPARATOR . $file->getValue();
 
+            if (!isset($data["geom_data"]) || !$data["geom_data"]) {
+                if (!file_exists($upload)) {
+                    throw new Zend_Exception();
+                }
+                if (!@filesize($upload)) {
+                    throw new Syj_Exception_InvalidGeomUpload();
+                }
+                $content = @file_get_contents ($upload);
+                if ($content == false) {
+                    throw new Zend_Exception();
+                }
+                $data['geom_data'] = $content;
+            }
+            @unlink ($upload);
+        } else if (isset($_FILES['geom_upload']) and ($_FILES['geom_upload']['error']) == UPLOAD_ERR_INI_SIZE) {
+            throw new Syj_Exception_ToolargeGeomUpload();
+        } else {
+            $this->removeElement("geom_upload");
+        }
+        return $this;
     }
+
 }
diff --git a/application/interface/Processor.php b/application/interface/Processor.php
new file mode 100644 (file)
index 0000000..cf86bc4
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+interface Syj_Processor_Interface {
+    public function process(&$data);
+}
index 26bfcb113a43f804f6f2c348621ff01b2769f4dd..94442c23e8598dca174754e27b958c3c4d5a121a 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: syj\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-14 15:01+0100\n"
+"POT-Creation-Date: 2011-03-18 17:25+0100\n"
 "PO-Revision-Date: \n"
 "Last-Translator: arno <arno@renevier.net>\n"
 "Language-Team: arno <arno@renevier.net>\n"
@@ -50,84 +50,84 @@ msgstr "Email was send successfully"
 msgid "SYJ needs javascript. Please activate scripts in your browser."
 msgstr "SYJ needs javascript. Please activate scripts in your browser."
 
-#: application/views/scripts/idx/index.phtml:15
+#: application/views/scripts/idx/index.phtml:21
 msgid "Welcome on Syj."
 msgstr "Welcome on Syj."
 
-#: application/views/scripts/idx/index.phtml:17
+#: application/views/scripts/idx/index.phtml:23
 msgid "To create a journey, just press <strong>\"start a route\"</strong> button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner"
 msgstr "To create a journey, just press <strong>\"start a route\"</strong> button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner"
 
-#: application/views/scripts/idx/index.phtml:19
+#: application/views/scripts/idx/index.phtml:25
 msgid "When you have finished a path, press \"create\", button."
 msgstr "When you have finished a path, press \"create\", button."
 
-#: application/views/scripts/idx/index.phtml:25
+#: application/views/scripts/idx/index.phtml:35
 msgid "route length"
 msgstr "route length"
 
-#: application/views/scripts/idx/index.phtml:38
+#: application/views/scripts/idx/index.phtml:48
 #: application/controllers/LoginController.php:8
 #: application/layouts/scripts/footer.phtml:74
-#: application/forms/Login.php:26
+#: application/forms/Login.php:23
 msgid "login"
 msgstr "login"
 
-#: application/views/scripts/idx/index.phtml:40
-#: application/views/scripts/idx/index.phtml:158
+#: application/views/scripts/idx/index.phtml:50
+#: application/views/scripts/idx/index.phtml:168
 msgid "create an account"
 msgstr "create an account"
 
-#: application/views/scripts/idx/index.phtml:41
+#: application/views/scripts/idx/index.phtml:51
 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:58
+#: application/views/scripts/idx/index.phtml:68
 msgid "route infos"
 msgstr "route infos"
 
-#: application/views/scripts/idx/index.phtml:62
-#: application/views/scripts/idx/index.phtml:71
+#: application/views/scripts/idx/index.phtml:72
+#: application/views/scripts/idx/index.phtml:81
 msgid "direct link"
 msgstr "direct link"
 
-#: application/views/scripts/idx/index.phtml:75
+#: application/views/scripts/idx/index.phtml:85
 msgid "export"
 msgstr "export"
 
-#: application/views/scripts/idx/index.phtml:80
-#: application/views/scripts/idx/index.phtml:81
+#: application/views/scripts/idx/index.phtml:90
+#: application/views/scripts/idx/index.phtml:91
 msgid "kml export"
 msgstr "kml export"
 
-#: application/views/scripts/idx/index.phtml:87
-#: application/views/scripts/idx/index.phtml:88
+#: application/views/scripts/idx/index.phtml:97
+#: application/views/scripts/idx/index.phtml:98
 msgid "gpx export"
 msgstr "gpx export"
 
-#: application/views/scripts/idx/index.phtml:101
-#: application/controllers/IdxController.php:143
+#: application/views/scripts/idx/index.phtml:111
+#: application/controllers/IdxController.php:179
 msgid "duplicate"
 msgstr "duplicate"
 
-#: application/views/scripts/idx/index.phtml:103
-#: application/controllers/IdxController.php:141
+#: application/views/scripts/idx/index.phtml:113
+#: application/controllers/IdxController.php:177
 msgid "edit"
 msgstr "edit"
 
-#: application/views/scripts/idx/index.phtml:107
+#: application/views/scripts/idx/index.phtml:117
 msgid "Search a place"
 msgstr "Search a place"
 
-#: application/views/scripts/idx/index.phtml:111
+#: application/views/scripts/idx/index.phtml:121
 msgid "Ok"
 msgstr "Ok"
 
-#: application/views/scripts/idx/index.phtml:117
+#: application/views/scripts/idx/index.phtml:127
 msgid "start a route"
 msgstr "start a route"
 
-#: application/views/scripts/idx/index.phtml:129
+#: application/views/scripts/idx/index.phtml:139
 msgid "more results"
 msgstr "more results"
 
@@ -156,7 +156,7 @@ msgid "Sources of the software running the website are <a href=\"http://dev.rene
 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:134
+#: application/controllers/IdxController.php:170
 msgid "A link to reset your password has been emailed to you"
 msgstr "A link to reset your password has been emailed to you"
 
@@ -275,7 +275,7 @@ msgstr "Is it possible to have my route \"attach\" nearby paths?"
 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/views/helpers/LogoutLink.php:9
 #: application/layouts/scripts/footer.phtml:67
 msgid "logout"
 msgstr "logout"
@@ -437,7 +437,7 @@ msgstr ""
 "Syj team"
 
 #: application/controllers/LoginController.php:99
-#: application/controllers/IdxController.php:124
+#: application/controllers/IdxController.php:160
 msgid "you must enter a login name"
 msgstr "you must enter a login name"
 
@@ -476,7 +476,7 @@ msgstr "Hi,"
 #: application/controllers/ContactController.php:121
 #: application/controllers/NewpwdController.php:68
 #: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:145
+#: application/controllers/IdxController.php:181
 msgid "Value is required"
 msgstr "Value is required"
 
@@ -486,13 +486,13 @@ msgstr "Value is required"
 msgid "Invalid email"
 msgstr "Invalid email"
 
-#: application/controllers/ErrorController.php:55
+#: application/controllers/ErrorController.php:59
 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/forms/Geom.php:39
 #: application/forms/User.php:44
 msgid "terms of use"
 msgstr "terms of use"
@@ -507,27 +507,27 @@ msgid "There is no undo. Delete this route definitively ?"
 msgstr "There is no undo. Delete this route definitively ?"
 
 #: application/controllers/ListController.php:33
-#: application/controllers/IdxController.php:121
+#: application/controllers/IdxController.php:157
 msgid "server could not be reached"
 msgstr "server could not be reached"
 
 #: application/controllers/ListController.php:34
-#: application/controllers/IdxController.php:118
+#: application/controllers/IdxController.php:154
 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:35
-#: application/controllers/IdxController.php:119
+#: application/controllers/IdxController.php:155
 msgid "route not referenced on the server. It has probably been deleted."
 msgstr "route not referenced on the server. It has probably been deleted."
 
 #: application/controllers/ListController.php:36
-#: application/controllers/IdxController.php:122
+#: application/controllers/IdxController.php:158
 msgid "there was a server error"
 msgstr "there was a server error"
 
 #: application/controllers/ListController.php:37
-#: application/controllers/IdxController.php:123
+#: application/controllers/IdxController.php:159
 msgid "there was an unknown error"
 msgstr "there was an unknown error"
 
@@ -545,12 +545,12 @@ msgid "Wrong password"
 msgstr "Wrong password"
 
 #: application/controllers/AccountController.php:43
-#: application/controllers/IdxController.php:132
+#: application/controllers/IdxController.php:168
 msgid "an user is already registered with this email"
 msgstr "an user is already registered with this email"
 
 #: application/controllers/AccountController.php:71
-#: application/controllers/IdxController.php:128
+#: application/controllers/IdxController.php:164
 #: application/forms/Account.php:40
 msgid "Password do not match"
 msgstr "Password do not match"
@@ -567,97 +567,107 @@ msgid "You have made no change"
 msgstr "You have made no change"
 
 #: application/controllers/IdxController.php:26
-#: application/controllers/IdxController.php:78
+#: application/controllers/IdxController.php:73
 #, php-format
 msgid "route by <strong>%s</strong>"
 msgstr "route by <strong>%s</strong>"
 
-#: application/controllers/IdxController.php:48
+#: application/controllers/IdxController.php:45
 msgid "route has been deleted"
 msgstr "route has been deleted"
 
-#: application/controllers/IdxController.php:51
+#: application/controllers/IdxController.php:48
 msgid "route does not exist"
 msgstr "route does not exist"
 
-#: application/controllers/IdxController.php:81
+#: application/controllers/IdxController.php:76
+#: application/controllers/IdxController.php:109
 msgid "website to share routes"
 msgstr "website to share routes"
 
-#: application/controllers/IdxController.php:111
-#: application/controllers/IdxController.php:137
+#: application/controllers/IdxController.php:118
+#, php-format
+msgid "File too large. File size must not exceed %s"
+msgstr "File too large. File size must not exceed %s"
+
+#: application/controllers/IdxController.php:120
+msgid "Invalid file"
+msgstr "Invalid file"
+
+#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:173
 msgid "Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 msgstr "Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 
-#: application/controllers/IdxController.php:117
+#: application/controllers/IdxController.php:153
 msgid "save took place successfully"
 msgstr "save took place successfully"
 
-#: application/controllers/IdxController.php:120
+#: application/controllers/IdxController.php:156
 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:125
+#: application/controllers/IdxController.php:161
 msgid "Login correct"
 msgstr "Login correct"
 
-#: application/controllers/IdxController.php:126
+#: application/controllers/IdxController.php:162
 msgid "Wrong login/password"
 msgstr "Wrong login/password"
 
-#: application/controllers/IdxController.php:127
+#: application/controllers/IdxController.php:163
 msgid "you must enter a password"
 msgstr "you must enter a password"
 
-#: application/controllers/IdxController.php:129
+#: application/controllers/IdxController.php:165
 msgid "You must accept terms of use"
 msgstr "You must accept terms of use"
 
-#: application/controllers/IdxController.php:130
+#: application/controllers/IdxController.php:166
 msgid "you must enter an email"
 msgstr "you must enter an email"
 
-#: application/controllers/IdxController.php:131
+#: application/controllers/IdxController.php:167
 msgid "invalid email"
 msgstr "invalid email"
 
-#: application/controllers/IdxController.php:133
+#: application/controllers/IdxController.php:169
 msgid "Account created"
 msgstr "Account created"
 
-#: application/controllers/IdxController.php:135
+#: application/controllers/IdxController.php:171
 msgid "Now, you can retry to save"
 msgstr "Now, you can retry to save"
 
-#: application/controllers/IdxController.php:136
+#: application/controllers/IdxController.php:172
 msgid "route by"
 msgstr "route by"
 
-#: application/controllers/IdxController.php:138
+#: application/controllers/IdxController.php:174
 msgid "checking availibilty"
 msgstr "checking availibilty"
 
-#: application/controllers/IdxController.php:139
+#: application/controllers/IdxController.php:175
 msgid "available pseudo"
 msgstr "available pseudo"
 
-#: application/controllers/IdxController.php:140
+#: application/controllers/IdxController.php:176
 msgid "unavailable pseudo"
 msgstr "unavailable pseudo"
 
-#: application/controllers/IdxController.php:142
+#: application/controllers/IdxController.php:178
 msgid "create"
 msgstr "create"
 
-#: application/controllers/IdxController.php:144
+#: application/controllers/IdxController.php:180
 msgid "You have an unsaved route"
 msgstr "You have an unsaved route"
 
-#: application/controllers/IdxController.php:146
+#: application/controllers/IdxController.php:182
 msgid "no result"
 msgstr "no result"
 
-#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:183
 msgid "could not analyze file content"
 msgstr "could not analyze file content"
 
@@ -679,7 +689,7 @@ msgstr "user"
 msgid "password"
 msgstr "password"
 
-#: application/forms/Login.php:23
+#: application/forms/Login.php:20
 msgid "I forgot my password"
 msgstr "I forgot my password"
 
@@ -711,17 +721,21 @@ msgstr "Send"
 msgid "Send a message"
 msgstr "Send a message"
 
-#: application/forms/Geom.php:18
+#: application/forms/Geom.php:17
+msgid "choose route from a file"
+msgstr "choose route from a file"
+
+#: application/forms/Geom.php:28
 msgid "optional title for this journey"
 msgstr "optional title for this journey"
 
-#: application/forms/Geom.php:27
+#: application/forms/Geom.php:41
 #: application/forms/User.php:46
 #, php-format
 msgid "I've read and accepted %s"
 msgstr "I've read and accepted %s"
 
-#: application/forms/Geom.php:36
+#: application/forms/Geom.php:50
 #: application/forms/Pending/ValidateCreation.php:17
 msgid "save"
 msgstr "save"
index c474f2bed3f4f04122e6b95b924ae4af0f3c481f..dddee2918311ae78e770e8af0a15a11c040f2e90 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: syj\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-14 15:01+0100\n"
+"POT-Creation-Date: 2011-03-18 17:25+0100\n"
 "PO-Revision-Date: \n"
 "Last-Translator: arno <arno@renevier.net>\n"
 "Language-Team: arno <arno@renevier.net>\n"
@@ -50,84 +50,84 @@ msgstr "L'email a été envoyé avec succès"
 msgid "SYJ needs javascript. Please activate scripts in your browser."
 msgstr "SYJ a besoin de javascript pour fonctionner. Veuillez activer les scripts dans votre navigateur."
 
-#: application/views/scripts/idx/index.phtml:15
+#: application/views/scripts/idx/index.phtml:21
 msgid "Welcome on Syj."
 msgstr "Bienvenue sur Syj."
 
-#: application/views/scripts/idx/index.phtml:17
+#: application/views/scripts/idx/index.phtml:23
 msgid "To create a journey, just press <strong>\"start a route\"</strong> button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner"
 msgstr "Pour créer un trajet, pressez simplement le bouton <strong>\"commencer un itinéraire\"</strong> puis cliquez sur la carte pour ajouter des points à votre tracé. Vous pouvez zoomer et bouger la carte avec les boutons en haut à gauche."
 
-#: application/views/scripts/idx/index.phtml:19
+#: application/views/scripts/idx/index.phtml:25
 msgid "When you have finished a path, press \"create\", button."
 msgstr "Lorsque vous avez fini votre tracé, pressez le bouton \"créer\"."
 
-#: application/views/scripts/idx/index.phtml:25
+#: application/views/scripts/idx/index.phtml:35
 msgid "route length"
 msgstr "longueur du tracé"
 
-#: application/views/scripts/idx/index.phtml:38
+#: application/views/scripts/idx/index.phtml:48
 #: application/controllers/LoginController.php:8
 #: application/layouts/scripts/footer.phtml:74
-#: application/forms/Login.php:26
+#: application/forms/Login.php:23
 msgid "login"
 msgstr "connexion"
 
-#: application/views/scripts/idx/index.phtml:40
-#: application/views/scripts/idx/index.phtml:158
+#: application/views/scripts/idx/index.phtml:50
+#: application/views/scripts/idx/index.phtml:168
 msgid "create an account"
 msgstr "créer un compte"
 
-#: application/views/scripts/idx/index.phtml:41
+#: application/views/scripts/idx/index.phtml:51
 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:58
+#: application/views/scripts/idx/index.phtml:68
 msgid "route infos"
 msgstr "informations sur le tracé"
 
-#: application/views/scripts/idx/index.phtml:62
-#: application/views/scripts/idx/index.phtml:71
+#: application/views/scripts/idx/index.phtml:72
+#: application/views/scripts/idx/index.phtml:81
 msgid "direct link"
 msgstr "lien direct"
 
-#: application/views/scripts/idx/index.phtml:75
+#: application/views/scripts/idx/index.phtml:85
 msgid "export"
 msgstr "export"
 
-#: application/views/scripts/idx/index.phtml:80
-#: application/views/scripts/idx/index.phtml:81
+#: application/views/scripts/idx/index.phtml:90
+#: application/views/scripts/idx/index.phtml:91
 msgid "kml export"
 msgstr "export kml"
 
-#: application/views/scripts/idx/index.phtml:87
-#: application/views/scripts/idx/index.phtml:88
+#: application/views/scripts/idx/index.phtml:97
+#: application/views/scripts/idx/index.phtml:98
 msgid "gpx export"
 msgstr "export gpx"
 
-#: application/views/scripts/idx/index.phtml:101
-#: application/controllers/IdxController.php:143
+#: application/views/scripts/idx/index.phtml:111
+#: application/controllers/IdxController.php:179
 msgid "duplicate"
 msgstr "dupliquer"
 
-#: application/views/scripts/idx/index.phtml:103
-#: application/controllers/IdxController.php:141
+#: application/views/scripts/idx/index.phtml:113
+#: application/controllers/IdxController.php:177
 msgid "edit"
 msgstr "modifier"
 
-#: application/views/scripts/idx/index.phtml:107
+#: application/views/scripts/idx/index.phtml:117
 msgid "Search a place"
 msgstr "Rechercher un lieu"
 
-#: application/views/scripts/idx/index.phtml:111
+#: application/views/scripts/idx/index.phtml:121
 msgid "Ok"
 msgstr "Ok"
 
-#: application/views/scripts/idx/index.phtml:117
+#: application/views/scripts/idx/index.phtml:127
 msgid "start a route"
 msgstr "commencer un itinéraire"
 
-#: application/views/scripts/idx/index.phtml:129
+#: application/views/scripts/idx/index.phtml:139
 msgid "more results"
 msgstr "plus de résultats"
 
@@ -156,7 +156,7 @@ msgid "Sources of the software running the website are <a href=\"http://dev.rene
 msgstr "Les sources du logiciel qui fait tourner le site web sont <a href=\"http://dev.renevier.net/?p=syj.git\">disponibles publiquement</a> sous une licence agpl. La carte utilisée pour l'affichage des itinéraires vient d'<a href=\"http://www.openstreetmap.org/\">openstreetmap</a>."
 
 #: application/views/scripts/newpwd/success.phtml:4
-#: application/controllers/IdxController.php:134
+#: application/controllers/IdxController.php:170
 msgid "A link to reset your password has been emailed to you"
 msgstr "Un email contenant un lien pour réinitialiser votre mot de passe vous a été envoyé"
 
@@ -275,7 +275,7 @@ msgstr "Est-ce que c'est possible d'&nbsp;«&nbsp;accrocher&nbsp;» les routes ?
 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 "Lorsque vous créez un itinéraire avec syj, vous devez placer chaque point sur la carte. Si votre itinéraire suit un chemin, vous devez quand même dessiner la surcouche à la main&nbsp;: syj ne va pas chercher à accrocher les chemins proches. Il y a trois raisons principales à cela. Une mauvaise raison&nbsp;: cela demanderait beaucoup de travail à mettre en place. Et deux bonnes raisons&nbsp;: syj utilise OpenStreetMap comme fond de carte. Or, il y a beaucoup d'endroits où cette carte est incomplète. D'autre part, selon l'itinéraire, vous voudriez accrocher l'autoroute, ou bien les chemins piétons, ou les pistes cyclables, ou les rails de tramway, &hellip;. Si vous êtes dans un endroit avec différents types de routes, syj n'arrivera probablement pas à choisir la bonne route."
 
-#: application/views/helpers/LogoutLink.php:10
+#: application/views/helpers/LogoutLink.php:9
 #: application/layouts/scripts/footer.phtml:67
 msgid "logout"
 msgstr "déconnexion"
@@ -439,7 +439,7 @@ msgstr ""
 "L'équipe de Syj"
 
 #: application/controllers/LoginController.php:99
-#: application/controllers/IdxController.php:124
+#: application/controllers/IdxController.php:160
 msgid "you must enter a login name"
 msgstr "vous devez entrer un nom d'utilisateur"
 
@@ -478,7 +478,7 @@ msgstr "Bonjour,"
 #: application/controllers/ContactController.php:121
 #: application/controllers/NewpwdController.php:68
 #: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:145
+#: application/controllers/IdxController.php:181
 msgid "Value is required"
 msgstr "Le champ est requis"
 
@@ -488,13 +488,13 @@ msgstr "Le champ est requis"
 msgid "Invalid email"
 msgstr "Email invalide"
 
-#: application/controllers/ErrorController.php:55
+#: application/controllers/ErrorController.php:59
 msgid "Oups, something went wrong"
 msgstr "Oups, il y a eu un souci"
 
 #: application/controllers/TermsofuseController.php:10
 #: application/layouts/scripts/footer.phtml:87
-#: application/forms/Geom.php:25
+#: application/forms/Geom.php:39
 #: application/forms/User.php:44
 msgid "terms of use"
 msgstr "conditions d'utilisation"
@@ -509,27 +509,27 @@ msgid "There is no undo. Delete this route definitively ?"
 msgstr "Vous ne pourrez pas annuler. Supprimer l'itinéraire définitivement ?"
 
 #: application/controllers/ListController.php:33
-#: application/controllers/IdxController.php:121
+#: application/controllers/IdxController.php:157
 msgid "server could not be reached"
 msgstr "serveur inaccessible"
 
 #: application/controllers/ListController.php:34
-#: application/controllers/IdxController.php:118
+#: application/controllers/IdxController.php:154
 msgid "server did not understood request. That's probably caused by a bug in SYJ"
 msgstr "Le serveur n'a pas compris la requête. Il s'agit probablement d'un bug dans SYJ"
 
 #: application/controllers/ListController.php:35
-#: application/controllers/IdxController.php:119
+#: application/controllers/IdxController.php:155
 msgid "route not referenced on the server. It has probably been deleted."
 msgstr "chemin non référencé sur le serveur. Il a probablement été supprimé."
 
 #: application/controllers/ListController.php:36
-#: application/controllers/IdxController.php:122
+#: application/controllers/IdxController.php:158
 msgid "there was a server error"
 msgstr "Il s'est produit une erreur serveur"
 
 #: application/controllers/ListController.php:37
-#: application/controllers/IdxController.php:123
+#: application/controllers/IdxController.php:159
 msgid "there was an unknown error"
 msgstr "Il s'est produit une erreur inconnue"
 
@@ -547,12 +547,12 @@ msgid "Wrong password"
 msgstr "Mauvais mot de passe"
 
 #: application/controllers/AccountController.php:43
-#: application/controllers/IdxController.php:132
+#: application/controllers/IdxController.php:168
 msgid "an user is already registered with this email"
 msgstr "il y'a déjà un utilisateur enregistré avec cet email"
 
 #: application/controllers/AccountController.php:71
-#: application/controllers/IdxController.php:128
+#: application/controllers/IdxController.php:164
 #: application/forms/Account.php:40
 msgid "Password do not match"
 msgstr "Les mots de passe ne correspondent pas"
@@ -569,97 +569,107 @@ msgid "You have made no change"
 msgstr "Vous n'avez fait aucun changement"
 
 #: application/controllers/IdxController.php:26
-#: application/controllers/IdxController.php:78
+#: application/controllers/IdxController.php:73
 #, php-format
 msgid "route by <strong>%s</strong>"
 msgstr "tracé par <strong>%s</strong>"
 
-#: application/controllers/IdxController.php:48
+#: application/controllers/IdxController.php:45
 msgid "route has been deleted"
 msgstr "l'itinéraire a été supprimé"
 
-#: application/controllers/IdxController.php:51
+#: application/controllers/IdxController.php:48
 msgid "route does not exist"
 msgstr "L'itinéraire n'existe pas"
 
-#: application/controllers/IdxController.php:81
+#: application/controllers/IdxController.php:76
+#: application/controllers/IdxController.php:109
 msgid "website to share routes"
 msgstr "site de partage d'itinéraires"
 
-#: application/controllers/IdxController.php:111
-#: application/controllers/IdxController.php:137
+#: application/controllers/IdxController.php:118
+#, php-format
+msgid "File too large. File size must not exceed %s"
+msgstr "Fichier trop gros. La taille ne doit pas dépasser %s"
+
+#: application/controllers/IdxController.php:120
+msgid "Invalid file"
+msgstr "Fichier invalide"
+
+#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:173
 msgid "Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 msgstr "Carte par <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 
-#: application/controllers/IdxController.php:117
+#: application/controllers/IdxController.php:153
 msgid "save took place successfully"
 msgstr "La sauvegarde s'est déroulée correctement"
 
-#: application/controllers/IdxController.php:120
+#: application/controllers/IdxController.php:156
 msgid "similar path seems to already exist. Please do not create two exactly identical paths"
 msgstr "Il semble qu'il y ait déjà un chemin similaire. Veuillez ne pas créer deux chemins exactement identiques"
 
-#: application/controllers/IdxController.php:125
+#: application/controllers/IdxController.php:161
 msgid "Login correct"
 msgstr "Vous êtes connecté"
 
-#: application/controllers/IdxController.php:126
+#: application/controllers/IdxController.php:162
 msgid "Wrong login/password"
 msgstr "Mauvais nom d'utilisateur ou mot de passe"
 
-#: application/controllers/IdxController.php:127
+#: application/controllers/IdxController.php:163
 msgid "you must enter a password"
 msgstr "vous devez entrer un mot de passe"
 
-#: application/controllers/IdxController.php:129
+#: application/controllers/IdxController.php:165
 msgid "You must accept terms of use"
 msgstr "Vous devez accepter les conditions d'utilisation"
 
-#: application/controllers/IdxController.php:130
+#: application/controllers/IdxController.php:166
 msgid "you must enter an email"
 msgstr "vous devez entrer un email"
 
-#: application/controllers/IdxController.php:131
+#: application/controllers/IdxController.php:167
 msgid "invalid email"
 msgstr "email invalide"
 
-#: application/controllers/IdxController.php:133
+#: application/controllers/IdxController.php:169
 msgid "Account created"
 msgstr "Compte créé"
 
-#: application/controllers/IdxController.php:135
+#: application/controllers/IdxController.php:171
 msgid "Now, you can retry to save"
 msgstr "Maintenant, vous pouvez réessayer de sauvegarder"
 
-#: application/controllers/IdxController.php:136
+#: application/controllers/IdxController.php:172
 msgid "route by"
 msgstr "tracé par"
 
-#: application/controllers/IdxController.php:138
+#: application/controllers/IdxController.php:174
 msgid "checking availibilty"
 msgstr "vérification de la disponibilité"
 
-#: application/controllers/IdxController.php:139
+#: application/controllers/IdxController.php:175
 msgid "available pseudo"
 msgstr "pseudo disponible"
 
-#: application/controllers/IdxController.php:140
+#: application/controllers/IdxController.php:176
 msgid "unavailable pseudo"
 msgstr "pseudo non disponible"
 
-#: application/controllers/IdxController.php:142
+#: application/controllers/IdxController.php:178
 msgid "create"
 msgstr "créér"
 
-#: application/controllers/IdxController.php:144
+#: application/controllers/IdxController.php:180
 msgid "You have an unsaved route"
 msgstr "Vous avez un itinéraire non sauvegardé"
 
-#: application/controllers/IdxController.php:146
+#: application/controllers/IdxController.php:182
 msgid "no result"
 msgstr "pas de résultat"
 
-#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:183
 msgid "could not analyze file content"
 msgstr "impossible d'analyser le contenu du fichier"
 
@@ -681,7 +691,7 @@ msgstr "utilisateur"
 msgid "password"
 msgstr "mot de passe"
 
-#: application/forms/Login.php:23
+#: application/forms/Login.php:20
 msgid "I forgot my password"
 msgstr "J'ai oublié mon mot de passe"
 
@@ -713,17 +723,21 @@ msgstr "Envoyer"
 msgid "Send a message"
 msgstr "Envoyer un message"
 
-#: application/forms/Geom.php:18
+#: application/forms/Geom.php:17
+msgid "choose route from a file"
+msgstr "choisir un itinéraire à partir d'un fichier"
+
+#: application/forms/Geom.php:28
 msgid "optional title for this journey"
 msgstr "titre facultatif pour ce trajet"
 
-#: application/forms/Geom.php:27
+#: application/forms/Geom.php:41
 #: application/forms/User.php:46
 #, php-format
 msgid "I've read and accepted %s"
 msgstr "J'ai lu et accepté les %s"
 
-#: application/forms/Geom.php:36
+#: application/forms/Geom.php:50
 #: application/forms/Pending/ValidateCreation.php:17
 msgid "save"
 msgstr "enregistrer"
index 0ee0be0c2e631e23b7656a3ff03406ec635b6027..1c270c3d205578e07939109e0c4f525ff9736dc4 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: syj\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-14 15:01+0100\n"
+"POT-Creation-Date: 2011-03-18 17:25+0100\n"
 "PO-Revision-Date: \n"
 "Last-Translator: S.Higashi <s_higash@mua.biglobe.ne.jp>\n"
 "Language: \n"
@@ -48,11 +48,11 @@ msgstr ""
 "SYJはjavascriptを使用します。あなたのブラウザでjavascriptを使えるように設定し"
 "てください"
 
-#: application/views/scripts/idx/index.phtml:15
+#: application/views/scripts/idx/index.phtml:21
 msgid "Welcome on Syj."
 msgstr "Syjへようこそ。"
 
-#: application/views/scripts/idx/index.phtml:17
+#: application/views/scripts/idx/index.phtml:23
 msgid ""
 "To create a journey, just press <strong>\"start a route\"</strong> button, "
 "then click on the map to add points to your route. You can zoom and move the "
@@ -62,75 +62,75 @@ msgstr ""
 "ださい。そしてマップをクリックしながらルートに沿ってポイントを追加してくださ"
 "い。画面左上のコントロールでマップのズームや移動ができます"
 
-#: application/views/scripts/idx/index.phtml:19
+#: application/views/scripts/idx/index.phtml:25
 msgid "When you have finished a path, press \"create\", button."
 msgstr "パスを描き終わったら、\"作成\"ボタンを押してください"
 
-#: application/views/scripts/idx/index.phtml:25
+#: application/views/scripts/idx/index.phtml:35
 msgid "route length"
 msgstr "ルート長"
 
-#: application/views/scripts/idx/index.phtml:38
+#: application/views/scripts/idx/index.phtml:48
 #: 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:23
 msgid "login"
 msgstr "ログイン"
 
-#: application/views/scripts/idx/index.phtml:40
-#: application/views/scripts/idx/index.phtml:158
+#: application/views/scripts/idx/index.phtml:50
+#: application/views/scripts/idx/index.phtml:168
 msgid "create an account"
 msgstr "アカウントを作成"
 
-#: application/views/scripts/idx/index.phtml:41
+#: application/views/scripts/idx/index.phtml:51
 msgid "Whith an account, you can manage and modify your routes"
 msgstr "アカウントがあれば、自分のルートを管理、変更できます"
 
-#: application/views/scripts/idx/index.phtml:58
+#: application/views/scripts/idx/index.phtml:68
 msgid "route infos"
 msgstr "ルート情報"
 
-#: application/views/scripts/idx/index.phtml:62
-#: application/views/scripts/idx/index.phtml:71
+#: application/views/scripts/idx/index.phtml:72
+#: application/views/scripts/idx/index.phtml:81
 msgid "direct link"
 msgstr "ダイレクトリンク"
 
-#: application/views/scripts/idx/index.phtml:75
+#: application/views/scripts/idx/index.phtml:85
 msgid "export"
 msgstr "エクスポート"
 
-#: application/views/scripts/idx/index.phtml:80
-#: application/views/scripts/idx/index.phtml:81
+#: application/views/scripts/idx/index.phtml:90
+#: application/views/scripts/idx/index.phtml:91
 msgid "kml export"
 msgstr "kmlにエクスポート"
 
-#: application/views/scripts/idx/index.phtml:87
-#: application/views/scripts/idx/index.phtml:88
+#: application/views/scripts/idx/index.phtml:97
+#: application/views/scripts/idx/index.phtml:98
 msgid "gpx export"
 msgstr "gpxにエクスポート"
 
-#: application/views/scripts/idx/index.phtml:101
-#: application/controllers/IdxController.php:143
+#: application/views/scripts/idx/index.phtml:111
+#: application/controllers/IdxController.php:179
 msgid "duplicate"
 msgstr "複製"
 
-#: application/views/scripts/idx/index.phtml:103
-#: application/controllers/IdxController.php:141
+#: application/views/scripts/idx/index.phtml:113
+#: application/controllers/IdxController.php:177
 msgid "edit"
 msgstr "編集"
 
-#: application/views/scripts/idx/index.phtml:107
+#: application/views/scripts/idx/index.phtml:117
 msgid "Search a place"
 msgstr "場所をさがす"
 
-#: application/views/scripts/idx/index.phtml:111
+#: application/views/scripts/idx/index.phtml:121
 msgid "Ok"
 msgstr "OK"
 
-#: application/views/scripts/idx/index.phtml:117
+#: application/views/scripts/idx/index.phtml:127
 msgid "start a route"
 msgstr "ルート開始"
 
-#: application/views/scripts/idx/index.phtml:129
+#: application/views/scripts/idx/index.phtml:139
 msgid "more results"
 msgstr "もっと"
 
@@ -197,7 +197,7 @@ msgstr ""
 "\">openstreetmap</a>です。"
 
 #: application/views/scripts/newpwd/success.phtml:4
-#: application/controllers/IdxController.php:134
+#: application/controllers/IdxController.php:170
 msgid "A link to reset your password has been emailed to you"
 msgstr "パスワードをリセットするためのURLがあなた宛に送られました"
 
@@ -359,7 +359,7 @@ msgstr ""
 "用レーン、鉄道…などを添付したいと思うでしょう。あなたが多くの異なるルートがあ"
 "る場所にいるなら、常に正しい道を選ぶのは不可能に近いでしょう。"
 
-#: application/views/helpers/LogoutLink.php:10
+#: application/views/helpers/LogoutLink.php:9
 #: application/layouts/scripts/footer.phtml:67
 msgid "logout"
 msgstr "ログアウト"
@@ -532,7 +532,7 @@ msgstr ""
 "Syj チーム"
 
 #: application/controllers/LoginController.php:99
-#: application/controllers/IdxController.php:124
+#: application/controllers/IdxController.php:160
 msgid "you must enter a login name"
 msgstr "ログイン名を入力してください"
 
@@ -571,7 +571,7 @@ msgstr "Hi,"
 #: application/controllers/ContactController.php:121
 #: application/controllers/NewpwdController.php:68
 #: application/controllers/AccountController.php:70
-#: application/controllers/IdxController.php:145
+#: application/controllers/IdxController.php:181
 msgid "Value is required"
 msgstr "値が必要です"
 
@@ -580,12 +580,12 @@ msgstr "値が必要です"
 msgid "Invalid email"
 msgstr "不正なメールアドレス"
 
-#: application/controllers/ErrorController.php:55
+#: application/controllers/ErrorController.php:59
 msgid "Oups, something went wrong"
 msgstr "おや、何かがおかしいですね"
 
 #: 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:39
 #: application/forms/User.php:44
 msgid "terms of use"
 msgstr "利用条件"
@@ -600,28 +600,28 @@ msgid "There is no undo. Delete this route definitively ?"
 msgstr "やり直しはできません。本当にこのルートを削除しますか?"
 
 #: application/controllers/ListController.php:33
-#: application/controllers/IdxController.php:121
+#: application/controllers/IdxController.php:157
 msgid "server could not be reached"
 msgstr "サーバに届かなかったようです"
 
 #: application/controllers/ListController.php:34
-#: application/controllers/IdxController.php:118
+#: application/controllers/IdxController.php:154
 msgid ""
 "server did not understood request. That's probably caused by a bug in SYJ"
 msgstr "サーバはリクエストを理解できませんでした。おそらくSYJのバグでしょう"
 
 #: application/controllers/ListController.php:35
-#: application/controllers/IdxController.php:119
+#: application/controllers/IdxController.php:155
 msgid "route not referenced on the server. It has probably been deleted."
 msgstr "ルートはサーバ上で参照できませんでした。おそらく削除されています。"
 
 #: application/controllers/ListController.php:36
-#: application/controllers/IdxController.php:122
+#: application/controllers/IdxController.php:158
 msgid "there was a server error"
 msgstr "サーバのエラーがありました"
 
 #: application/controllers/ListController.php:37
-#: application/controllers/IdxController.php:123
+#: application/controllers/IdxController.php:159
 msgid "there was an unknown error"
 msgstr "不明なエラーがありました"
 
@@ -639,12 +639,12 @@ msgid "Wrong password"
 msgstr "間違ったパスワード"
 
 #: application/controllers/AccountController.php:43
-#: application/controllers/IdxController.php:132
+#: application/controllers/IdxController.php:168
 msgid "an user is already registered with this email"
 msgstr "このメールアドレスのユーザが既に登録されています"
 
 #: application/controllers/AccountController.php:71
-#: application/controllers/IdxController.php:128
+#: application/controllers/IdxController.php:164
 #: application/forms/Account.php:40
 msgid "Password do not match"
 msgstr "パスワードが一致しません"
@@ -660,100 +660,111 @@ msgid "You have made no change"
 msgstr "変更していません"
 
 #: application/controllers/IdxController.php:26
-#: application/controllers/IdxController.php:78
+#: application/controllers/IdxController.php:73
 #, php-format
 msgid "route by <strong>%s</strong>"
 msgstr "<strong>%s</strong>のルート"
 
-#: application/controllers/IdxController.php:48
+#: application/controllers/IdxController.php:45
 msgid "route has been deleted"
 msgstr "ルートは削除されました"
 
-#: application/controllers/IdxController.php:51
+#: application/controllers/IdxController.php:48
 msgid "route does not exist"
 msgstr "ルートはありません"
 
-#: application/controllers/IdxController.php:81
+#: application/controllers/IdxController.php:76
+#: application/controllers/IdxController.php:109
 #, fuzzy
 msgid "website to share routes"
 msgstr "ルート開始"
 
-#: application/controllers/IdxController.php:111
-#: application/controllers/IdxController.php:137
+#: application/controllers/IdxController.php:118
+#, php-format
+msgid "File too large. File size must not exceed %s"
+msgstr ""
+
+#: application/controllers/IdxController.php:120
+#, fuzzy
+msgid "Invalid file"
+msgstr "不正なメールアドレス"
+
+#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:173
 msgid "Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 msgstr "Map by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
 
-#: application/controllers/IdxController.php:117
+#: application/controllers/IdxController.php:153
 msgid "save took place successfully"
 msgstr "保存されました"
 
-#: application/controllers/IdxController.php:120
+#: application/controllers/IdxController.php:156
 msgid ""
 "similar path seems to already exist. Please do not create two exactly "
 "identical paths"
 msgstr "類似のパスが既に存在します。全く同じパスをふたつ作成しないでください"
 
-#: application/controllers/IdxController.php:125
+#: application/controllers/IdxController.php:161
 msgid "Login correct"
 msgstr "正常ログイン"
 
-#: application/controllers/IdxController.php:126
+#: application/controllers/IdxController.php:162
 msgid "Wrong login/password"
 msgstr "誤ったログイン/パスワード"
 
-#: application/controllers/IdxController.php:127
+#: application/controllers/IdxController.php:163
 msgid "you must enter a password"
 msgstr "パスワードを入力してください"
 
-#: application/controllers/IdxController.php:129
+#: application/controllers/IdxController.php:165
 msgid "You must accept terms of use"
 msgstr "利用条件を承諾してください"
 
-#: application/controllers/IdxController.php:130
+#: application/controllers/IdxController.php:166
 msgid "you must enter an email"
 msgstr "メールアドレスを入力してください"
 
-#: application/controllers/IdxController.php:131
+#: application/controllers/IdxController.php:167
 msgid "invalid email"
 msgstr "不正なメールアドレス"
 
-#: application/controllers/IdxController.php:133
+#: application/controllers/IdxController.php:169
 msgid "Account created"
 msgstr "アカウントを作成しました"
 
-#: application/controllers/IdxController.php:135
+#: application/controllers/IdxController.php:171
 msgid "Now, you can retry to save"
 msgstr "今は、保存をやり直すことができます"
 
-#: application/controllers/IdxController.php:136
+#: application/controllers/IdxController.php:172
 msgid "route by"
 msgstr "ルート作成者"
 
-#: application/controllers/IdxController.php:138
+#: application/controllers/IdxController.php:174
 msgid "checking availibilty"
 msgstr "利用可能かチェック中"
 
-#: application/controllers/IdxController.php:139
+#: application/controllers/IdxController.php:175
 msgid "available pseudo"
 msgstr "利用出来るID"
 
-#: application/controllers/IdxController.php:140
+#: application/controllers/IdxController.php:176
 msgid "unavailable pseudo"
 msgstr "利用できないID"
 
-#: application/controllers/IdxController.php:142
+#: application/controllers/IdxController.php:178
 msgid "create"
 msgstr "作成"
 
-#: application/controllers/IdxController.php:144
+#: application/controllers/IdxController.php:180
 msgid "You have an unsaved route"
 msgstr "保存されていないルートがあります"
 
-#: application/controllers/IdxController.php:146
+#: application/controllers/IdxController.php:182
 msgid "no result"
 msgstr "結果がありません"
 
-#: application/controllers/IdxController.php:147
+#: application/controllers/IdxController.php:183
 msgid "could not analyze file content"
 msgstr "ファイル内容を分析できませんでした"
 
@@ -774,7 +785,7 @@ msgstr "ユーザ"
 msgid "password"
 msgstr "パスワード"
 
-#: application/forms/Login.php:23
+#: application/forms/Login.php:20
 msgid "I forgot my password"
 msgstr "パスワードを忘れた"
 
@@ -806,16 +817,20 @@ msgstr "送信"
 msgid "Send a message"
 msgstr "メッセージを送信"
 
-#: application/forms/Geom.php:18
+#: application/forms/Geom.php:17
+msgid "choose route from a file"
+msgstr ""
+
+#: application/forms/Geom.php:28
 msgid "optional title for this journey"
 msgstr "この旅の任意の見出し"
 
-#: application/forms/Geom.php:27 application/forms/User.php:46
+#: application/forms/Geom.php:41 application/forms/User.php:46
 #, php-format
 msgid "I've read and accepted %s"
 msgstr "私は %s を読んで承諾しました"
 
-#: application/forms/Geom.php:36
+#: application/forms/Geom.php:50
 #: application/forms/Pending/ValidateCreation.php:17
 msgid "save"
 msgstr "保存"
index d108b8f270fb4dcb8b1fa0ae124838618a30bb20..cebae509b396d2fb277749d89d6391423ae56365 100644 (file)
@@ -11,7 +11,10 @@ class Syj_View_Helper_FooterLink extends Zend_View_Helper_Abstract
         } else {
             $href = $page->getHRef();
             if ($redirect) {
-                $currentUri = $this->view->url();
+                $currentUri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
+                if (($pos = strpos($currentUri, '?')) !== false) {
+                    $currentUri = substr($currentUri, 0, $pos);
+                 }
                 $href = $this->view->addParamToUrl($href, 'redirect', $currentUri, true);
             }
             $link = $this->view->anchor($href, $text, array('class' => 'footer-anchor'));
index b0260d2f6279e27f6b094117c8200c05d8a46fdd..ac7e9dd16c830b143536d32ee313993f95a09ba1 100644 (file)
@@ -9,15 +9,25 @@
 </noscript>
 
 <div id="map"></div>
+<div id="map-overlay"></div>
 
-<div id="message" class="message info">
-<?php if (!$this->path and !$this->loggedUser) {?>
-<?php echo $this->translate('Welcome on Syj.')?>
-<br>
-<?php echo $this->translate('To create a journey, just press <strong>"start a route"</strong> button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner')?>
-<br>
-<?php echo $this->translate('When you have finished a path, press "create", button.')?>
-<?php }?>
+<?php
+$message = "";
+$msgclass = "info";
+if ($this->errorMsg) {
+    $message .= $this->errorMsg;
+    $msgclass = "error";
+} else if (!$this->path and !$this->loggedUser) {
+    $message .= $this->translate('Welcome on Syj.');
+    $message .= "<br>";
+    $message .= $this->translate('To create a journey, just press <strong>"start a route"</strong> button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner');
+    $message .= "<br>";
+    $message .= $this->translate('When you have finished a path, press "create", button.');
+}
+?>
+
+<div id="message" class="message <?php echo $msgclass?>">
+    <?php echo $message ?>
 </div>
 
 
index 4ca90e650fc302a04e4f4d2459dbef5a650033e1..e36e873f93eed1db2c5905e6aed46719b9bcd304 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4ca90e650fc302a04e4f4d2459dbef5a650033e1
+Subproject commit e36e873f93eed1db2c5905e6aed46719b9bcd304
index df28e44e85615584f020796b3702527a621742da..07f50de9d5004a08de8ac91caed548a9b79cce75 100644 (file)
@@ -9,13 +9,18 @@ body, html {
 /*
  * map rules
  */
-#map {
+#map, #map-overlay {
     position: absolute;
     top: 0; left: 0; right: 0;
     bottom: 2em;
     *width: 100%;
     *height: 100%;
 }
+#map-overlay {
+    background-color: gray;
+    opacity: 0.2;
+    filter:alpha(opacity=0.2);
+}
 
 .olControlAttribution {
     bottom: 0.5em;
index de3333f5c41d0028b60313604ea9ff0582bfaebc..bfd0a64e7a7bd22cbb7cd50ab4d5b0e29997c75a 100644 (file)
@@ -21,7 +21,7 @@ var SyjSaveUI = {
         this.enableSubmit();
         $("geom_title").disabled = false;
         $("geom_title").activate();
-        $("geomform").removeClassName("disabled");
+        $$("#geom_accept_container, #geom_title_container").invoke('removeClassName', "disabled");
         this.status = "enabled";
         return this;
     },
@@ -33,7 +33,7 @@ var SyjSaveUI = {
         this.disableSubmit();
         $("geom_title").blur();
         $("geom_title").disabled = true;
-        $("geomform").addClassName("disabled");
+        $$("#geom_accept_container, #geom_title_container").invoke('addClassName', "disabled");
         this.status = "disabled";
         return this;
     },
@@ -349,81 +349,15 @@ var SYJView = {
             this.initMaPos(gInitialPos);
         }
 
+        $("map-overlay").hide();
+        $("geom_upload").observe('change', function() {
+            $("map-overlay").show();
+            SyjSaveUI.enable();
+            this.editControl.deactivate();
+        }.bind(this));
+
         document.observe('simplebox:shown', this.observer.bindAsEventListener(this));
         SYJPathLength.update();
-
-        if (window.FileList && window.FileReader) {
-            $("map").observe("dragenter", function(evt) { evt.stop();});
-            $("map").observe("dragover", function(evt) { evt.stop();});
-            $("map").observe("drop", function(evt) {
-                evt.stop();
-                if (this.mode !== "view" || this.viewLayer.features.length) {
-                    return;
-                }
-                if (!evt.dataTransfer.files.length) {
-                    return;
-                }
-                var file = evt.dataTransfer.files[0];
-                var reader = new FileReader();
-                var readerror = function() {
-                    this.messenger.setMessage(SyjStrings.dragFileError, "warn");
-                }.bind(this);
-                reader.onload = function(evt) {
-                    if (evt.error) {
-                        readerror();
-                        return;
-                    }
-
-                    var results = null;
-                    var content = evt.target.result;
-
-                    var engine, i;
-                    var formats = ['KML', 'GPX'];
-
-                    for (i = 0; i < formats.length; i++) {
-                        engine = new OpenLayers.Format[formats[i]]({ internalProjection: Mercator, externalProjection: WGS84 });
-                        try {
-                            results = engine.read(content);
-                        } catch(e) {
-                        }
-                        if (results || results.length) {
-                            continue;
-                        }
-                    }
-                    if (!results || !results.length) {
-                        readerror();
-                        return;
-                    }
-
-
-                    var vector = results[0];
-                    if (vector.geometry.CLASS_NAME !== "OpenLayers.Geometry.LineString") {
-                        readerror();
-                        return;
-                    }
-                    this.viewLayer.addFeatures([vector]);
-                    this.map.zoomToExtent(this.viewLayer.getDataExtent());
-
-                    if ($("edit-btn")) {
-                        $("edit-btn").click();
-                    } else if ($("create-btn")) {
-                        $("create-btn").click();
-                    }
-
-                    if (this.editControl.handler.realPoints.length < 2) {
-                        SyjSaveUI.disable();
-                    } else {
-                        SyjSaveUI.enable();
-                    }
-
-
-                    if (vector.data && vector.data.name) {
-                        $("geom_title").value = vector.data.name;
-                    }
-                 }.bind(this);
-                reader.readAsText(file);
-           }.bind(this));
-        }
     },
 
     initMaPos: function (aPos) {
@@ -472,7 +406,12 @@ var SYJView = {
 
         this.viewMode();
 
-        $("geom_data").value = this.wkt.write(new OpenLayers.Feature.Vector(line));
+        if (line.components.length) {
+            $("geom_data").value = this.wkt.write(new OpenLayers.Feature.Vector(line));
+        } else {
+            $("geom_data").value = "";
+        }
+
         if (this.mode === "edit" && typeof gLoggedInfo.pathid !== "undefined") {
             $("geomform").setAttribute("action", "path/" + gLoggedInfo.pathid.toString() + '/update');
         } else {
@@ -541,14 +480,25 @@ var SYJView = {
             callbacks: {
                 modify: function(f, line) {
                     SYJPathLength.update();
-                    if (!SYJView.unsavedRoute) {
-                        SYJView.unsavedRoute = {};
+
+                    var npoints = this.handler.realPoints.length;
+                    if (npoints === 0) {
+                        $("geom_upload_container").show();
+                        SYJView.unsavedRoute = null;
+                    } else {
+                        if (!SYJView.unsavedRoute) {
+                            SYJView.unsavedRoute = {};
+                        }
                     }
-                    if (this.handler.realPoints.length < 2) {
+
+                    if (npoints < 2) {
                         SyjSaveUI.disable();
                     } else {
                         SyjSaveUI.enable();
                     }
+                },
+                create: function(f, line) {
+                    $("geom_upload_container").hide();
                 }
             },
 
index b16a9c2ec4206c1ec83bba7ca38e20f425585a60..1651b618241ad1ad3e531c5a2a063d7c9c78b279 100644 (file)
@@ -212,7 +212,8 @@ Ajax.Responders.register({
 
 // wrapper around Form.request that sets up the submit listener, stops the
 // submit event, calls presubmit function, calls Form.request and calls a
-// postsubmit function
+// postsubmit function. If form has some visible and activated file inputs,
+// execute presubmit, but do not send the file with ajax.
 Element.addMethods('form', {
     ajaxize : function(form, options) {
         var reqoptions;
@@ -220,7 +221,6 @@ Element.addMethods('form', {
         options = Object.clone(options || {});
 
         $(form).observe('submit', function(evt) {
-            evt.stop(); // cancel form submission
 
             reqoptions = Object.clone(options);
             delete(reqoptions.presubmit);
@@ -229,10 +229,30 @@ Element.addMethods('form', {
 
             if (Object.isFunction(options.presubmit)) {
                 if (options.presubmit(this) === false) {
+                    evt.stop(); // cancel form submission
                     return;
                 }
             }
 
+            // get list of input file not disabled, and not hidden
+            if (this.getInputs('file').find(function(elt) {
+                if (elt.disabled) {
+                    return false;
+                }
+                while (elt && $(elt).identify() !== this.identify()) {
+                    if (!elt.visible()) {
+                        return false;
+                    }
+                    elt = elt.parentNode;
+                }
+                return true;
+             }.bind(this))) {
+                // form has some file inputs. Do not manage on our own.
+                return;
+            }
+
+            evt.stop(); // cancel form submission
+
             var params = reqoptions.parameters, action = this.readAttribute('action') || '';
 
             if (action.blank()) {
index 0d60e74985d83f97299179bdbe61e1dbf7b81971..46b219eaa9f256817614f6277009c65edb2c6b82 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0d60e74985d83f97299179bdbe61e1dbf7b81971
+Subproject commit 46b219eaa9f256817614f6277009c65edb2c6b82