From 197c979d264f15d82e991f45c7155b2172aae3c6 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 18 Jul 2013 18:40:09 +0200 Subject: use background image instead of img for Files delete icon --- apps/files/js/fileactions.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index aa66a57a7b5..bb0a27638e4 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -125,12 +125,9 @@ var FileActions = { if (typeof trashBinApp !== 'undefined' && trashBinApp) { var html = ''; } else { - var html = ''; + var html = ''; } var element = $(html); - if (img) { - element.append($('')); - } element.data('action', actions['Delete']); element.on('click', {a: null, elem: parent, actionFunc: actions['Delete']}, actionHandler); parent.parent().children().last().append(element); -- cgit v1.2.3 From 8a25d1ad068b67914ae87159e062c28433a3a789 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 18 Jul 2013 18:41:01 +0200 Subject: remove unnecessary tipsy for Files delete --- apps/files/js/fileactions.js | 2 +- core/js/js.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index bb0a27638e4..59cf007f53d 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -125,7 +125,7 @@ var FileActions = { if (typeof trashBinApp !== 'undefined' && trashBinApp) { var html = ''; } else { - var html = ''; + var html = ''; } var element = $(html); element.data('action', actions['Delete']); diff --git a/core/js/js.js b/core/js/js.js index 5158b66d73a..6558adbb6a7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -664,7 +664,6 @@ $(document).ready(function(){ $('.password .action').tipsy({gravity:'se', fade:true, live:true}); $('#upload').tipsy({gravity:'w', fade:true}); $('.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}); -- cgit v1.2.3 From 4bfd61fb7fcbc6394bbf2ee83f733cd09abb63a3 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 18 Jul 2013 18:46:37 +0200 Subject: use new delete icon for deleted files as well --- apps/files/js/fileactions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 59cf007f53d..ef82cd63468 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -123,7 +123,7 @@ var FileActions = { img = img(file); } if (typeof trashBinApp !== 'undefined' && trashBinApp) { - var html = ''; + var html = ''; } else { var html = ''; } -- cgit v1.2.3 From a00cff7c0543a8860b839a0bf345478e99bc6c18 Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Fri, 26 Jul 2013 11:13:43 +0200 Subject: disable "deleted files" button if trash bin is empty --- apps/files/css/files.css | 2 +- apps/files/index.php | 9 ++++++++- apps/files/js/filelist.js | 1 + apps/files/js/files.js | 12 ++++++++++-- apps/files/templates/index.php | 4 +--- apps/files_trashbin/lib/trash.php | 15 +++++++++++++++ 6 files changed, 36 insertions(+), 7 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/css/files.css b/apps/files/css/files.css index f2ca1065eca..117aac4c93e 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -24,7 +24,7 @@ #new>ul>li>p { cursor:pointer; } #new>ul>li>form>input { padding:0.3em; margin:-0.3em; } -#trash { height:17px; margin: 0 1em; z-index:1010; float: right; } +#trash { margin: 0 1em; z-index:1010; float: right; } #upload { height:27px; padding:0; margin-left:0.2em; overflow:hidden; diff --git a/apps/files/index.php b/apps/files/index.php index 2f005391509..4f9e881eb2d 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -126,6 +126,12 @@ if ($needUpgrade) { $publicUploadEnabled = 'no'; } + $trashEnabled = \OCP\App::isEnabled('files_trashbin'); + $trashEmpty = true; + if ($trashEnabled) { + $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); + } + OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); OCP\Util::addscript('files', 'keyboardshortcuts'); @@ -136,7 +142,8 @@ if ($needUpgrade) { $tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/')); $tmpl->assign('permissions', $permissions); $tmpl->assign('files', $files); - $tmpl->assign('trash', \OCP\App::isEnabled('files_trashbin')); + $tmpl->assign('trash', $trashEnabled); + $tmpl->assign('trashEmpty', $trashEmpty); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 04a9fb91649..b858e2580ee 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -392,6 +392,7 @@ var FileList={ files.removeClass('selected'); }); procesSelection(); + checkTrashStatus(); } else { $.each(files,function(index,file) { var deleteAction = $('tr').filterAttr('data-file',file).children("td.date").children(".move2trash"); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 98fc53b71a9..55280edde42 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -121,10 +121,10 @@ $(document).ready(function() { }); // Show trash bin - $('#trash a').live('click', function() { + $('#trash').on('click', function() { window.location=OC.filePath('files_trashbin', '', 'index.php'); }); - + var lastChecked; // Sets the file link behaviour : @@ -845,3 +845,11 @@ function getUniqueName(name){ } return name; } + +function checkTrashStatus() { + $.post(OC.filePath('files_trashbin', 'ajax', 'isEmpty.php'), function(result){ + if (result.data.isEmpty === false) { + $("input[type=button][id=trash]").removeAttr("disabled"); + } + }); +} \ No newline at end of file diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index e0731609368..a70c0eaa117 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -38,9 +38,7 @@ -
- t('Deleted files'));?> -
+ >
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 50fdaccfb1e..cff97418fe4 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -868,5 +868,20 @@ class Trashbin { //Listen to delete user signal \OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook"); } + + /** + * @brief check if trash bin is empty for a given user + * @param string $user + */ + public static function isEmpty($user) { + + $trashSize = self::getTrashbinSize($user); + + if ($trashSize !== false && $trashSize > 0) { + return false; + } + + return true; + } } -- cgit v1.2.3 From 4a9f5f64dabb47163d934324bfeee595d8a51789 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 29 Jul 2013 17:15:20 +0200 Subject: remove whitespaces --- apps/files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 55280edde42..3fad3fae7d3 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -124,7 +124,7 @@ $(document).ready(function() { $('#trash').on('click', function() { window.location=OC.filePath('files_trashbin', '', 'index.php'); }); - + var lastChecked; // Sets the file link behaviour : -- cgit v1.2.3 From 33fe24dc3d12868d79f9b137e9e91eba2b3e5028 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Mon, 29 Jul 2013 19:27:11 +0300 Subject: Replace delete icon with spinner --- apps/files/js/filelist.js | 8 +++----- core/css/styles.css | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 04a9fb91649..dc820dc93e2 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -371,9 +371,7 @@ var FileList={ } for (var i=0; i'; - deleteAction.html(newHTML); + deleteAction.removeClass('delete-icon').addClass('progress-icon'); } // Finish any existing actions if (FileList.lastAction) { @@ -394,8 +392,8 @@ var FileList={ procesSelection(); } else { $.each(files,function(index,file) { - var deleteAction = $('tr').filterAttr('data-file',file).children("td.date").children(".move2trash"); - deleteAction.html(oldHTML); + var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete"); + deleteAction.removeClass('progress-icon').addClass('delete-icon'); }); } }); diff --git a/core/css/styles.css b/core/css/styles.css index 490619c00d4..365de759fdc 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -659,7 +659,7 @@ div.crumb:active { } /* icons */ -.folder-icon, .delete-icon, .edit-icon { +.folder-icon, .delete-icon, .edit-icon, .progress-icon { background-repeat: no-repeat; background-position: center; } @@ -669,7 +669,7 @@ div.crumb:active { background-image: url('../img/actions/delete-hover.svg'); } .edit-icon { background-image: url('../img/actions/rename.svg'); } - +.progress-icon { background-image: url('../img/loading.gif'); } /* buttons */ button.loading { -- cgit v1.2.3 From 1a1c100719643c6056541ffd208642e9f1653c95 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 30 Jul 2013 10:44:01 +0200 Subject: fix loading.gif size for both upload and deletion, force visiblity --- apps/files/js/filelist.js | 2 +- core/css/styles.css | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index dc820dc93e2..e483626a91a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -15,7 +15,7 @@ var FileList={ // filename td td = $('').attr({ "class": "filename", - "style": 'background-image:url('+iconurl+')' + "style": 'background-image:url('+iconurl+'); background-size: 16px;' }); td.append(''); var link_elem = $('').attr({ diff --git a/core/css/styles.css b/core/css/styles.css index 365de759fdc..3af1a311585 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -669,7 +669,13 @@ div.crumb:active { background-image: url('../img/actions/delete-hover.svg'); } .edit-icon { background-image: url('../img/actions/rename.svg'); } -.progress-icon { background-image: url('../img/loading.gif'); } +.progress-icon { + background-image: url('../img/loading.gif'); + background-size: 16px; + /* force show the loading icon, not only on hover */ + opacity: 1 !important; + display: inline !important; +} /* buttons */ button.loading { -- cgit v1.2.3 From ff67f115d403d13dedf77457c539963f50a80eec Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Thu, 8 Aug 2013 13:50:04 +0200 Subject: fix #2711 using a custom event, also use css selectors over filterAttr --- apps/files/js/fileactions.js | 5 +++-- apps/files_sharing/js/share.js | 7 +++++-- core/js/share.js | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index aa66a57a7b5..de67d13559e 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -65,7 +65,7 @@ var FileActions = { FileActions.currentFile = parent; var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions()); var file = FileActions.getCurrentFile(); - if ($('tr').filterAttr('data-file', file).data('renaming')) { + if ($('tr[data-file="'+file+'"]').data('renaming')) { return; } parent.children('a.name').append(''); @@ -164,10 +164,11 @@ $(document).ready(function () { window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val()); }); } - $('#fileList tr').each(function () { FileActions.display($(this).children('td.filename')); }); + + $('#fileList').trigger(jQuery.Event("fileActionsReady")); }); diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index eb5a6e8cb7f..b2efafde4e7 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -4,6 +4,10 @@ $(document).ready(function() { if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) { + $('#fileList').one('fileActionsReady',function(){ + OC.Share.loadIcons('file'); + }); + FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) { if ($('#dir').val() == '/') { var item = $('#dir').val() + filename; @@ -33,6 +37,5 @@ $(document).ready(function() { OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions); } }); - OC.Share.loadIcons('file'); } -}); +}); \ No newline at end of file diff --git a/core/js/share.js b/core/js/share.js index b4b5159b0b5..b0d38c45cb8 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -22,9 +22,9 @@ OC.Share={ if (itemType != 'file' && itemType != 'folder') { $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center'); } else { - var file = $('tr').filterAttr('data-id', item); + var file = $('tr[data-id="'+item+'"]'); if (file.length > 0) { - var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share'); + var action = $(file).find('.fileactions .action[data-action="Share"]'); var img = action.find('img').attr('src', image); action.addClass('permanent'); action.html(' '+t('core', 'Shared')).prepend(img); @@ -36,7 +36,7 @@ OC.Share={ // Search for possible parent folders that are shared while (path != last) { if (path == data['path']) { - var actions = $('.fileactions .action').filterAttr('data-action', 'Share'); + var actions = $('.fileactions .action[data-action="Share"]'); $.each(actions, function(index, action) { var img = $(action).find('img'); if (img.attr('src') != OC.imagePath('core', 'actions/public')) { -- cgit v1.2.3 From 9549bd3e68aa32bb9fa1a9a54bda84fa5070966f Mon Sep 17 00:00:00 2001 From: kondou Date: Fri, 9 Aug 2013 20:37:18 +0200 Subject: Use plural translations --- apps/files/js/filelist.js | 5 +++-- apps/files/js/files.js | 14 +++----------- apps/files_trashbin/js/trash.js | 12 ++---------- core/js/js.js | 10 ++++------ lib/template/functions.php | 10 ++++------ 5 files changed, 16 insertions(+), 35 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index b858e2580ee..e0c72295702 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -452,13 +452,14 @@ $(document).ready(function(){ var currentUploads = parseInt(uploadtext.attr('currentUploads')); currentUploads += 1; uploadtext.attr('currentUploads', currentUploads); + var translatedText = n('files', '%n file uploading', '%n files uploading', currentUploads); if(currentUploads === 1) { var img = OC.imagePath('core', 'loading.gif'); data.context.find('td.filename').attr('style','background-image:url('+img+')'); - uploadtext.text(t('files', '1 file uploading')); + uploadtext.text(translatedText); uploadtext.show(); } else { - uploadtext.text(currentUploads + ' ' + t('files', 'files uploading')); + uploadtext.text(translatedText); } } else { // add as stand-alone row to filelist diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 3fad3fae7d3..53fc25f41b0 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -759,21 +759,13 @@ function procesSelection(){ $('#headerSize').text(humanFileSize(totalSize)); var selection=''; if(selectedFolders.length>0){ - if(selectedFolders.length==1){ - selection+=t('files','1 folder'); - }else{ - selection+=t('files','{count} folders',{count: selectedFolders.length}); - } + selection += n('files', '%n folder', '%n folders', selectedFolders.length); if(selectedFiles.length>0){ selection+=' & '; } } if(selectedFiles.length>0){ - if(selectedFiles.length==1){ - selection+=t('files','1 file'); - }else{ - selection+=t('files','{count} files',{count: selectedFiles.length}); - } + selection += n('files', '%n file', '%n files', selectedFiles.length); } $('#headerName>span.name').text(selection); $('#modified').text(''); @@ -852,4 +844,4 @@ function checkTrashStatus() { $("input[type=button][id=trash]").removeAttr("disabled"); } }); -} \ No newline at end of file +} diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index c3c958b07a7..b14a7240cbe 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -188,21 +188,13 @@ function processSelection(){ $('.selectedActions').show(); var selection=''; if(selectedFolders.length>0){ - if(selectedFolders.length === 1){ - selection+=t('files','1 folder'); - }else{ - selection+=t('files','{count} folders',{count: selectedFolders.length}); - } + selection += n('files', '%n folder', '%n folders', selectedFolders.length); if(selectedFiles.length>0){ selection+=' & '; } } if(selectedFiles.length>0){ - if(selectedFiles.length === 1){ - selection+=t('files','1 file'); - }else{ - selection+=t('files','{count} files',{count: selectedFiles.length}); - } + selection += n('files', '%n file', '%n files', selectedFiles.length); } $('#headerName>span.name').text(selection); $('#modified').text(''); diff --git a/core/js/js.js b/core/js/js.js index 1d1711383f7..0fc4bab80a7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -812,15 +812,13 @@ function relative_modified_date(timestamp) { var diffdays = Math.round(diffhours/24); var diffmonths = Math.round(diffdays/31); if(timediff < 60) { return t('core','seconds ago'); } - else if(timediff < 120) { return t('core','1 minute ago'); } - else if(timediff < 3600) { return t('core','{minutes} minutes ago',{minutes: diffminutes}); } - else if(timediff < 7200) { return t('core','1 hour ago'); } - else if(timediff < 86400) { return t('core','{hours} hours ago',{hours: diffhours}); } + else if(timediff < 3600) { return n('core','%n minute ago', '%n minutes ago', diffminutes); } + else if(timediff < 86400) { return n('core', '%n hour ago', '%n hours ago', diffhours); } else if(timediff < 86400) { return t('core','today'); } else if(timediff < 172800) { return t('core','yesterday'); } - else if(timediff < 2678400) { return t('core','{days} days ago',{days: diffdays}); } + else if(timediff < 2678400) { return n('core', '%n day ago', '%n days ago', diffdays); } else if(timediff < 5184000) { return t('core','last month'); } - else if(timediff < 31556926) { return t('core','{months} months ago',{months: diffmonths}); } + else if(timediff < 31556926) { return n('core', '%n month ago', '%n months ago', diffmonths); } //else if(timediff < 31556926) { return t('core','months ago'); } else if(timediff < 63113852) { return t('core','last year'); } else { return t('core','years ago'); } diff --git a/lib/template/functions.php b/lib/template/functions.php index 2d43cae1c0c..717e197c1cb 100644 --- a/lib/template/functions.php +++ b/lib/template/functions.php @@ -78,15 +78,13 @@ function relative_modified_date($timestamp) { $diffmonths = round($diffdays/31); if($timediff < 60) { return $l->t('seconds ago'); } - else if($timediff < 120) { return $l->t('1 minute ago'); } - else if($timediff < 3600) { return $l->t('%d minutes ago', $diffminutes); } - else if($timediff < 7200) { return $l->t('1 hour ago'); } - else if($timediff < 86400) { return $l->t('%d hours ago', $diffhours); } + else if($timediff < 3600) { return $l->n('%n minute ago', '%n minutes ago', $diffminutes); } + else if($timediff < 86400) { return $l->n('%n hour ago', '%n hours ago', $diffhours); } else if((date('G')-$diffhours) > 0) { return $l->t('today'); } else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); } - else if($timediff < 2678400) { return $l->t('%d days ago', $diffdays); } + else if($timediff < 2678400) { return $l->n('%n day go', '%n days ago', $diffdays); } else if($timediff < 5184000) { return $l->t('last month'); } - else if((date('n')-$diffmonths) > 0) { return $l->t('%d months ago', $diffmonths); } + else if((date('n')-$diffmonths) > 0) { return $l->n('%n month ago', '%n months ago', $diffmonths); } else if($timediff < 63113852) { return $l->t('last year'); } else { return $l->t('years ago'); } } -- cgit v1.2.3 From 400249194726e7cf6fc79d5fe7e92ccca8539244 Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 14 Aug 2013 06:29:19 +0200 Subject: Reword a phrase --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index e0c72295702..f7cc3767b25 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -452,7 +452,7 @@ $(document).ready(function(){ var currentUploads = parseInt(uploadtext.attr('currentUploads')); currentUploads += 1; uploadtext.attr('currentUploads', currentUploads); - var translatedText = n('files', '%n file uploading', '%n files uploading', currentUploads); + var translatedText = n('files', 'Uploading %n file', 'Uploading %n files', currentUploads); if(currentUploads === 1) { var img = OC.imagePath('core', 'loading.gif'); data.context.find('td.filename').attr('style','background-image:url('+img+')'); -- cgit v1.2.3