diff --git a/ajax/personal.php b/ajax/personal.php index 4d29f8cd..bcb846a3 100644 --- a/ajax/personal.php +++ b/ajax/personal.php @@ -15,13 +15,15 @@ namespace OCA\Documents; \OCP\JSON::callCheck(); \OCP\JSON::checkLoggedIn(); +$l = \OC_L10N::get('documents'); + $savePath = isset($_POST['savePath']) ? $_POST['savePath'] : null; if (!is_null($savePath)){ if (\OC\Files\Filesystem::file_exists($savePath) ===false ){ if(!\OC\Files\Filesystem::mkdir($savePath)){ \OCP\JSON::error( array( - 'data' => array('message'=>'') + 'data' => array('message'=> $l->t('An error occurred while changing directory.')) ) ); } @@ -29,10 +31,10 @@ if (!is_null($savePath)){ \OCP\Config::setUserValue(\OCP\User::getUser(), 'documents', 'save_path', $savePath); \OCP\JSON::success( array( - 'data' => array('message'=>'') + 'data' => array('message'=> $l->t('Directory saved successfully.')) ) ); exit(); } -exit(); \ No newline at end of file +exit(); diff --git a/js/personal.js b/js/personal.js index 00363b00..ed92c097 100644 --- a/js/personal.js +++ b/js/personal.js @@ -12,4 +12,10 @@ $(document).ready(function(){ } }; $('#documents-default-path').blur(documentsSettings.save); -}); \ No newline at end of file + $('#documents-default-path').keypress(function( event ) { + if (event.which == 13) { + event.preventDefault(); + documentsSettings.save(); + } + }); +}); diff --git a/templates/documents.php b/templates/documents.php index 036b6263..11bca4ce 100755 --- a/templates/documents.php +++ b/templates/documents.php @@ -4,7 +4,7 @@ -