[Pkg-owncloud-commits] [owncloud] 256/394: enable enter in ie by using .submit()+form instead of .change(), use notifications when name is empty

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:19 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 474fdef5d4104da40d85d8422c85cc84a0c758be
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Tue Dec 18 16:36:26 2012 +0100

    enable enter in ie by using .submit()+form instead of .change(), use notifications when name is empty
---
 apps/files/css/files.css |    2 +-
 apps/files/js/files.js   |   43 ++++++++++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index c7c7273..ffa0788 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -19,7 +19,7 @@
 #new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; }
 #new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em }
 #new>ul>li>p { cursor:pointer; }
-#new>ul>li>input { padding:0.3em; margin:-0.3em; }
+#new>ul>li>form>input { padding:0.3em; margin:-0.3em; }
 #new, .file_upload_filename { border:1px solid; border-color:#51a351 #419341 #387038; -moz-box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; }
 #new .popup { border-top-left-radius:0; }
 
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 9cfdd14..61f6617 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -509,7 +509,7 @@ $(document).ready(function() {
 
 		$('#new li').each(function(i,element){
 			if($(element).children('p').length==0){
-				$(element).children('input').remove();
+				$(element).children('form').remove();
 				$(element).append('<p>'+$(element).data('text')+'</p>');
 			}
 		});
@@ -519,19 +519,32 @@ $(document).ready(function() {
 		$(this).data('text',text);
 		$(this).children('p').remove();
 		var input=$('<input>');
-		$(this).append(input);
+		var form=$('<form></form>');
+		form.append(input);
+		$(this).append(form);
 		input.focus();
-		input.change(function(){
-            if (type != 'web' && Files.containsInvalidCharacters($(this).val())) {
-                return;
-            } else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') {
-                $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));
-                $('#notification').fadeIn();
-                return;
-            }
-            var name = getUniqueName($(this).val());
-			if (name != $(this).val()) {
-				FileList.checkName(name, $(this).val(), true);
+		form.submit(function(event){
+			event.stopPropagation();
+			event.preventDefault();
+			var newname=input.val();
+			if(type != 'web' && Files.containsInvalidCharacters(newname)){
+				return false;
+			} else if (newname.length == 0) {
+				if(type == 'web') {
+					$('#notification').text(t('files', "URL cannot be empty."));
+				} else {
+					$('#notification').text(t('files', "Name cannot be empty."));
+				}
+				$('#notification').fadeIn();
+				return false;
+			} else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') {
+				$('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));
+				$('#notification').fadeIn();
+				return false;
+			}
+			var name = getUniqueName(newname);
+			if (newname != name) {
+				FileList.checkName(name, newname, true);
 				var hidden = true;
 			} else {
 				var hidden = false;
@@ -614,8 +627,8 @@ $(document).ready(function() {
 					});
 					break;
 			}
-			var li=$(this).parent();
-			$(this).remove();
+			var li=form.parent();
+			form.remove();
 			li.append('<p>'+li.data('text')+'</p>');
 			$('#new>a').click();
 		});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list