]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into fixing-998-master
authorThomas Mueller <thomas.mueller@tmit.eu>
Fri, 18 Jan 2013 22:22:34 +0000 (23:22 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Fri, 18 Jan 2013 22:22:34 +0000 (23:22 +0100)
Conflicts:
apps/files/ajax/upload.php
apps/files/js/files.js

1  2 
apps/files/ajax/upload.php
apps/files/index.php
apps/files/js/files.js
core/css/styles.css
core/js/js.js
core/templates/layout.user.php
lib/helper.php
settings/js/users.js
settings/templates/users.php

index b6705db671227cc09437660dac15526f752bac22,933980196086f94321acc265457dce5d9232ccd3..8f0084e2bc01e44b3e77ad85b885bab2ebef3dd7
@@@ -42,7 -54,9 +54,9 @@@ foreach($files['size'] as $size) 
        $totalSize+=$size;
  }
  if($totalSize>OC_Filesystem::free_space($dir)) {
-       OCP\JSON::error(array('data' => array( 'message' => $l->t( 'Not enough storage available' ))));
 -      OCP\JSON::error(array('data' => array( 'message' => $l->t( 'Not enough space available' ),
++      OCP\JSON::error(array('data' => array( 'message' => $l->t( 'Not enough storage available' ),
+               'uploadMaxFilesize'=>$maxUploadFilesize,
+               'maxHumanFilesize'=>$maxHumanFilesize)));
        exit();
  }
  
index 9d3eb410791f685ff0abdc48dca60d526bf28fe3,1c4b7fbd497aba5119b3878b4f6d51d35eddaa03..2c6b689b0c9d3b1518249a02fd6382534a467fb1
@@@ -89,18 -84,15 +84,18 @@@ $maxUploadFilesize=OCP\Util::maxUploadF
  
  $permissions = OCP\PERMISSION_READ;
  if (OC_Filesystem::isUpdatable($dir . '/')) {
-     $permissions |= OCP\PERMISSION_UPDATE;
+       $permissions |= OCP\PERMISSION_UPDATE;
  }
  if (OC_Filesystem::isDeletable($dir . '/')) {
-     $permissions |= OCP\PERMISSION_DELETE;
+       $permissions |= OCP\PERMISSION_DELETE;
  }
  if (OC_Filesystem::isSharable($dir . '/')) {
-     $permissions |= OCP\PERMISSION_SHARE;
+       $permissions |= OCP\PERMISSION_SHARE;
  }
  
 +// information about storage capacities
 +$storageInfo=OC_Helper::getStorageInfo();
 +
  $tmpl = new OCP\Template('files', 'index', 'user');
  $tmpl->assign('fileList', $list->fetchPage(), false);
  $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
index 426f91c7928a317dd94908cf52f228f5c8f3c26c,0488062dbcaffeb00f5a7d0f1318d0b88f3862fa..f4d572b6954edcc8f3dbf788c783a14ba849628d
@@@ -26,9 -26,27 +26,26 @@@ Files=
                });
                procesSelection();
        },
+       updateMaxUploadFilesize:function(response) {
+               if(response == undefined) {
+                       return;
+               }
+               if(response.data !== undefined && response.data.uploadMaxFilesize !== undefined) {
+                       $('#max_upload').val(response.data.uploadMaxFilesize);
+                       $('#data-upload-form a').attr('original-title', response.data.maxHumanFilesize);
+               }
+               if(response[0] == undefined) {
+                       return;
+               }
+               if(response[0].uploadMaxFilesize !== undefined) {
+                       $('#max_upload').val(response[0].uploadMaxFilesize);
+                       $('#data-upload-form a').attr('original-title', response[0].maxHumanFilesize);
+               }
+       },
        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) {
                                return false;
                        }
                }
 -              $('#notification').fadeOut();
 +              OC.Notification.hide();
                return true;
-     displayStorageWarnings: function() {
-         var usedSpacePercent = $('#usedSpacePercent').val();
-         if (usedSpacePercent > 98) {
 +      },
-         }
-         if (usedSpacePercent > 90) {
++      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); 
+       Files.bindKeyboardShortcuts(document, jQuery);
        $('#fileList tr').each(function(){
                //little hack to set unescape filenames in attribute
                $(this).attr('data-file',decodeURIComponent($(this).attr('data-file')));
                                                                                        var response;
                                                                                        response=jQuery.parseJSON(result);
                                                                                        if(response[0] == undefined || response[0].status != 'success') {
-                                                 OC.Notification.show(t('files', response.data.message));
 -                                                                                              $('#notification').text(t('files', response.data.message));
 -                                                                                              $('#notification').fadeIn();
++                                                                                              OC.Notification.show(t('files', response.data.message));
                                                                                        }
+                                                                                       Files.updateMaxUploadFilesize(response);
                                                                                        var file=response[0];
                                                                                        // TODO: this doesn't work if the file name has been changed server side
                                                                                        delete uploadingFiles[dirName][file.name];
                                                                                                //TODO update file upload size limit
                                                                                                FileList.loadingDone(file.name, file.id);
                                                                                        } else {
-                                                 Files.cancelUpload(this.files[0].name);
+                                                                                               Files.cancelUpload(this.files[0].name);
 -                                                                                              $('#notification').text(t('files', response.data.message));
 -                                                                                              $('#notification').fadeIn();
 +                                                                                              OC.Notification.show(t('files', response.data.message));
                                                                                                $('#fileList > tr').not('[data-mime]').fadeOut();
                                                                                                $('#fileList > tr').not('[data-mime]').remove();
                                                                                        }
--                                                                              })
--                                                              .error(function(jqXHR, textStatus, errorThrown) {
--                                                                      if(errorThrown === 'abort') {
-                                         Files.cancelUpload(this.files[0].name);
-                                                                               OC.Notification.show(t('files', 'Upload cancelled.'));
 -                                                                              Files.cancelUpload(this.files[0].name);
 -                                                                              $('#notification').hide();
 -                                                                              $('#notification').text(t('files', 'Upload cancelled.'));
 -                                                                              $('#notification').fadeIn();
--                                                                      }
--                                                              });
++                                                                      })
++                                                                      .error(function(jqXHR, textStatus, errorThrown) {
++                                                                              if(errorThrown === 'abort') {
++                                                                                      Files.cancelUpload(this.files[0].name);
++                                                                                      OC.Notification.show(t('files', 'Upload cancelled.'));
++                                                                              }
++                                                                      });
                                                                uploadingFiles[uniqueName] = jqXHR;
                                                        }
                                                }
                                                                //TODO update file upload size limit
                                                                FileList.loadingDone(file.name, file.id);
                                                        } else {
-                                 //TODO Files.cancelUpload(/*where do we get the filename*/);
+                                                               //TODO Files.cancelUpload(/*where do we get the filename*/);
 -                                                              $('#notification').text(t('files', response.data.message));
 -                                                              $('#notification').fadeIn();
 +                                                              OC.Notification.show(t('files', response.data.message));
                                                                $('#fileList > tr').not('[data-mime]').fadeOut();
                                                                $('#fileList > tr').not('[data-mime]').remove();
                                                        }
  
        resizeBreadcrumbs(true);
  
 +      // display storage warnings
 +      setTimeout ( "Files.displayStorageWarnings()", 100 );
 +      OC.Notification.setDefault(Files.displayStorageWarnings);
++
+       // file space size sync
+       function update_storage_statistics() {
+               $.getJSON(OC.filePath('files','ajax','getstoragestats.php'),function(response) {
+                       Files.updateMaxUploadFilesize(response);
+               });
+       }
+       // start on load - we ask the server every 5 minutes
+       var update_storage_statistics_interval = 5*60*1000;
+       var update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
+       // Use jquery-visibility to de-/re-activate file stats sync
+       if ($.support.pageVisibility) {
+               $(document).on({
+                       'show.visibility': function() {
+                               if (!update_storage_statistics_interval_id) {
+                                       update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
+                               }
+                       },
+                       'hide.visibility': function() {
+                               clearInterval(update_storage_statistics_interval_id);
+                               update_storage_statistics_interval_id = 0;
+                       }
+               });
+       }
  });
  
  function scanFiles(force,dir){
Simple merge
diff --cc core/js/js.js
Simple merge
Simple merge
diff --cc lib/helper.php
Simple merge
Simple merge
Simple merge