diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-07-23 22:06:03 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-07-23 22:06:03 +0200 |
commit | fb40d9e1e65ea5f23bdaa534dbb1b3758d8c2cbd (patch) | |
tree | 48bfa8512b49a3e168fa01d68260599735fb9f35 /core/js | |
parent | e3ea3ed3c563fce2b5fe1addfe199e3aaec7abdb (diff) | |
parent | 7ad38535e51812e08042e46bd550aa9cc5781955 (diff) | |
download | nextcloud-server-fb40d9e1e65ea5f23bdaa534dbb1b3758d8c2cbd.tar.gz nextcloud-server-fb40d9e1e65ea5f23bdaa534dbb1b3758d8c2cbd.zip |
Merge branch 'master' into groups
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/eventsource.js | 6 | ||||
-rw-r--r-- | core/js/js.js | 18 | ||||
-rw-r--r-- | core/js/share.js | 15 | ||||
-rw-r--r-- | core/js/update.js | 5 |
4 files changed, 28 insertions, 16 deletions
diff --git a/core/js/eventsource.js b/core/js/eventsource.js index ce8c8387c8e..536b180bc8f 100644 --- a/core/js/eventsource.js +++ b/core/js/eventsource.js @@ -110,7 +110,11 @@ OC.EventSource.prototype={ this.listeners[type].push(callback); }else{ this.source.addEventListener(type,function(e){ - callback(JSON.parse(e.data)); + if (typeof e.data != 'undefined') { + callback(JSON.parse(e.data)); + } else { + callback(''); + } },false); } }else{ diff --git a/core/js/js.js b/core/js/js.js index 3904787c4e5..cf4e72324dc 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -226,8 +226,12 @@ var OC={ var path=OC.filePath(app,'css',style+'.css'); if(OC.addStyle.loaded.indexOf(path)===-1){ OC.addStyle.loaded.push(path); - style=$('<link rel="stylesheet" type="text/css" href="'+path+'"/>'); - $('head').append(style); + if (document.createStyleSheet) { + document.createStyleSheet(path); + } else { + style=$('<link rel="stylesheet" type="text/css" href="'+path+'"/>'); + $('head').append(style); + } } }, basename: function(path) { @@ -662,8 +666,6 @@ $(document).ready(function(){ $('.selectedActions a').tipsy({gravity:'s', fade:true, live:true}); $('a.delete').tipsy({gravity: 'e', fade:true, live:true}); $('a.action').tipsy({gravity:'s', fade:true, live:true}); - $('#headerSize').tipsy({gravity:'s', fade:true, live:true}); - $('td.filesize').tipsy({gravity:'s', fade:true, live:true}); $('td .modified').tipsy({gravity:'s', fade:true, live:true}); $('input').tipsy({gravity:'w', fade:true}); @@ -693,14 +695,6 @@ function humanFileSize(size) { return relativeSize + ' ' + readableFormat; } -function simpleFileSize(bytes) { - var mbytes = Math.round(bytes/(1024*1024/10))/10; - if(bytes == 0) { return '0'; } - else if(mbytes < 0.1) { return '< 0.1'; } - else if(mbytes > 1000) { return '> 1000'; } - else { return mbytes.toFixed(1); } -} - function formatDate(date){ if(typeof date=='number'){ date=new Date(date); diff --git a/core/js/share.js b/core/js/share.js index 21e352ee1c6..e59669cbc2b 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -92,6 +92,7 @@ OC.Share={ } } if (shares) { + OC.Share.statuses[itemSource] = OC.Share.statuses[itemSource] || {}; OC.Share.statuses[itemSource]['link'] = link; } else { delete OC.Share.statuses[itemSource]; @@ -122,7 +123,12 @@ OC.Share={ callback(result.data); } } else { - OC.dialogs.alert(result.data.message, t('core', 'Error while sharing')); + if (result.data && result.data.message) { + var msg = result.data.message; + } else { + var msg = t('core', 'Error'); + } + OC.dialogs.alert(msg, t('core', 'Error while sharing')); } }); }, @@ -161,7 +167,12 @@ OC.Share={ // respective checkbox should be checked or // not. + var publicUploadEnabled = $('#filestable').data('allow-public-upload'); + if (typeof publicUploadEnabled == 'undefined') { + publicUploadEnabled = 'no'; + } var allowPublicUploadStatus = false; + $.each(data.shares, function(key, value) { if (allowPublicUploadStatus) { return true; @@ -181,7 +192,7 @@ OC.Share={ html += '<div id="linkPass">'; html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />'; html += '</div>'; - if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE)) { + if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE) && publicUploadEnabled === 'yes') { html += '<div id="allowPublicUploadWrapper" style="display:none;">'; html += '<input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload"' + ((allowPublicUploadStatus) ? 'checked="checked"' : '') + ' />'; html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>'; diff --git a/core/js/update.js b/core/js/update.js index 8ab02bbf935..2c28e72f7cd 100644 --- a/core/js/update.js +++ b/core/js/update.js @@ -5,6 +5,9 @@ $(document).ready(function () { }); updateEventSource.listen('error', function(message) { $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update')); + message = 'Please reload the page.'; + $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update')); + updateEventSource.close(); }); updateEventSource.listen('failure', function(message) { $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update')); @@ -20,4 +23,4 @@ $(document).ready(function () { window.location.href = OC.webroot; }, 3000); }); -});
\ No newline at end of file +}); |