]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into fixing-998-master
authorThomas Mueller <thomas.mueller@tmit.eu>
Sun, 6 Jan 2013 21:28:21 +0000 (22:28 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Sun, 6 Jan 2013 21:28:21 +0000 (22:28 +0100)
Conflicts:
apps/files/js/files.js

1  2 
apps/files/js/filelist.js
apps/files/js/files.js

Simple merge
index 6166b240e83303d732507ba6d3d7c5d2612a3004,ba2495eb7280ce4b571fca0f0694b8ce0ae9ea3c..ac47f390826ad0abadeaa9bbda2ea131f61ee750
@@@ -26,27 -26,30 +26,37 @@@ Files=
                });
                procesSelection();
        },
-       containsInvalidCharacters:function (name) {
+     isFileNameValid:function (name) {
+         if (name === '.') {
 -            $('#notification').text(t('files', "'.' is an invalid file name."));
 -            $('#notification').fadeIn();
++            OC.Notification.show(t('files', "'.' is an invalid file name."));
+             return false;
+         }
+         if (name.length == 0) {
 -            $('#notification').text(t('files', "File name cannot be empty."));
 -            $('#notification').fadeIn();
++            OC.Notification.show(t('files', "File name cannot be empty."));
+             return false;
+         }
+         // check for invalid characters
                var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
                for (var i = 0; i < invalid_characters.length; i++) {
                        if (name.indexOf(invalid_characters[i]) != -1) {
 -                              $('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
 -                              $('#notification').fadeIn();
 +                              OC.Notification.show(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
-                               return true;
+                               return false;
                        }
                }
 -              $('#notification').fadeOut();
 +        OC.Notification.hide();
-               return false;
+               return true;
 -      }
 +      },
 +    displayStorageWarnings: function() {
 +        var usedSpacePercent = $('#usedSpacePercent').val();
 +        if (usedSpacePercent > 98) {
 +            OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!'));
 +            return;
 +        }
 +        if (usedSpacePercent > 90) {
 +            OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', {usedSpacePercent: usedSpacePercent}));
 +        }
 +    }
  };
  $(document).ready(function() {
        Files.bindKeyboardShortcuts(document, jQuery); 
                $(this).append(input);
                input.focus();
                input.change(function(){
-                       if (type != 'web' && Files.containsInvalidCharacters($(this).val())) {
+                       if (type != 'web' && !Files.isFileNameValid($(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();
 +                OC.Notification.show(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));
                                return;
                        }
                        if (FileList.lastAction) {