diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-01-31 23:23:10 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-01-31 23:23:10 +0100 |
commit | 2af6d74bc1bfb8b3ade363c6e8fbdc1b25a42af2 (patch) | |
tree | 22b375aec0d4668be834565ed6f2552cf90244f2 /core/js | |
parent | 11e88f49391a4a38145670f731d20a1fa66040d4 (diff) | |
parent | 317261d6dfa2b95234628c6e6649bcb94999552a (diff) | |
download | nextcloud-server-2af6d74bc1bfb8b3ade363c6e8fbdc1b25a42af2.tar.gz nextcloud-server-2af6d74bc1bfb8b3ade363c6e8fbdc1b25a42af2.zip |
Merge branch 'master' into fixing-js-errors-public-link-master
Conflicts:
apps/files/js/files.js
apps/files/templates/part.list.php
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 1 | ||||
-rw-r--r-- | core/js/share.js | 41 | ||||
-rw-r--r-- | core/js/update.js | 23 |
3 files changed, 53 insertions, 12 deletions
diff --git a/core/js/js.js b/core/js/js.js index 01e47edf268..9c8cf4aa625 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -672,6 +672,7 @@ $(document).ready(function(){ // all the tipsy stuff needs to be here (in reverse order) to work $('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true}); $('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true}); + $('.displayName .action').tipsy({gravity:'se', fade:true, live:true}); $('.password .action').tipsy({gravity:'se', fade:true, live:true}); $('#upload').tipsy({gravity:'w', fade:true}); $('.selectedActions a').tipsy({gravity:'s', fade:true, live:true}); diff --git a/core/js/share.js b/core/js/share.js index bb3ec010ff5..0c45765bd8b 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -23,7 +23,10 @@ OC.Share={ } else { var file = $('tr').filterAttr('data-file', OC.basename(item)); if (file.length > 0) { - $(file).find('.fileactions .action').filterAttr('data-action', 'Share').find('img').attr('src', image); + var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share'); + action.find('img').attr('src', image); + action.addClass('permanent'); + action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared'))); } var dir = $('#dir').val(); if (dir.length > 1) { @@ -32,9 +35,12 @@ OC.Share={ // Search for possible parent folders that are shared while (path != last) { if (path == item) { - var img = $('.fileactions .action').filterAttr('data-action', 'Share').find('img'); + var action = $('.fileactions .action').filterAttr('data-action', 'Share'); + var img = action.find('img'); if (img.attr('src') != OC.imagePath('core', 'actions/public')) { img.attr('src', image); + action.addClass('permanent'); + action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared'))); } } last = path; @@ -48,7 +54,8 @@ OC.Share={ }, updateIcon:function(itemType, itemSource) { if (itemType == 'file' || itemType == 'folder') { - var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file'); + var file = $('tr').filterAttr('data-id', String(itemSource)); + var filename = file.data('file'); if ($('#dir').val() == '/') { itemSource = $('#dir').val() + filename; } else { @@ -75,6 +82,16 @@ OC.Share={ }); if (itemType != 'file' && itemType != 'folder') { $('a.share[data-item="'+itemSource+'"]').css('background', 'url('+image+') no-repeat center'); + } else { + var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share'); + action.find('img').attr('src', image); + if (shares) { + action.addClass('permanent'); + action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared'))); + } else { + action.removeClass('permanent'); + action.html(action.html().replace(t('core', 'Shared'), t('core', 'Share'))); + } } if (shares) { OC.Share.statuses[itemSource] = link; @@ -148,9 +165,9 @@ OC.Share={ var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined) { if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) { - html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.uid_owner})+'</span>'; + html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.displayname_owner})+'</span>'; } else { - html += '<span class="reshare">'+t('core', 'Shared with you by {owner}', {owner: data.reshare.uid_owner})+'</span>'; + html += '<span class="reshare">'+t('core', 'Shared with you by {owner}', {owner: data.reshare.displayname_owner})+'</span>'; } html += '<br />'; } @@ -186,9 +203,9 @@ OC.Share={ OC.Share.showLink(share.token, share.share_with, itemSource); } else { if (share.collection) { - OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, share.collection); + OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.collection); } else { - OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, false); + OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, false); } } if (share.expiration != null) { @@ -228,7 +245,7 @@ OC.Share={ // Default permissions are Read and Share var permissions = OC.PERMISSION_READ | OC.PERMISSION_SHARE; OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() { - OC.Share.addShareWith(shareType, shareWith, permissions, possiblePermissions); + OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions); $('#shareWith').val(''); OC.Share.updateIcon(itemType, itemSource); }); @@ -257,7 +274,7 @@ OC.Share={ } }); }, - addShareWith:function(shareType, shareWith, permissions, possiblePermissions, collection) { + addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, collection) { if (!OC.Share.itemShares[shareType]) { OC.Share.itemShares[shareType] = []; } @@ -272,7 +289,7 @@ OC.Share={ if (collectionList.length > 0) { $(collectionList).append(', '+shareWith); } else { - var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWith})+'</li>'; + var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWithDisplayName})+'</li>'; $('#shareWithList').prepend(html); } } else { @@ -295,9 +312,9 @@ OC.Share={ var html = '<li style="clear: both;" data-share-type="'+shareType+'" data-share-with="'+shareWith+'" title="' + shareWith + '">'; html += '<a href="#" class="unshare" style="display:none;"><img class="svg" alt="'+t('core', 'Unshare')+'" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>'; if(shareWith.length > 14){ - html += shareWith.substr(0,11) + '...'; + html += shareWithDisplayName.substr(0,11) + '...'; }else{ - html += shareWith; + html += shareWithDisplayName; } if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) { if (editChecked == '') { diff --git a/core/js/update.js b/core/js/update.js new file mode 100644 index 00000000000..8ab02bbf935 --- /dev/null +++ b/core/js/update.js @@ -0,0 +1,23 @@ +$(document).ready(function () { + var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php'); + updateEventSource.listen('success', function(message) { + $('<span>').append(message).append('<br />').appendTo($('.update')); + }); + updateEventSource.listen('error', function(message) { + $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update')); + }); + updateEventSource.listen('failure', function(message) { + $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update')); + $('<span>') + .addClass('error bold') + .append('<br />') + .append(t('core', 'The update was unsuccessful. Please report this issue to the <a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.')) + .appendTo($('.update')); + }); + updateEventSource.listen('done', function(message) { + $('<span>').addClass('bold').append('<br />').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update')); + setTimeout(function () { + window.location.href = OC.webroot; + }, 3000); + }); +});
\ No newline at end of file |