commit
223adc3167
|
@ -5,7 +5,6 @@ OCP\User::checkLoggedIn();
|
|||
|
||||
OCP\App::setActiveNavigationEntry('files_index');
|
||||
|
||||
OCP\Util::addScript('files_trashbin', 'trash');
|
||||
OCP\Util::addScript('files_trashbin', 'disableDefaultActions');
|
||||
OCP\Util::addScript('files', 'fileactions');
|
||||
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
|
||||
|
@ -15,6 +14,7 @@ OCP\Util::addScript('files', 'filelist');
|
|||
// filelist overrides
|
||||
OCP\Util::addScript('files_trashbin', 'filelist');
|
||||
OCP\Util::addscript('files', 'files');
|
||||
OCP\Util::addScript('files_trashbin', 'trash');
|
||||
|
||||
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
|
||||
|
||||
|
|
|
@ -4,13 +4,11 @@ $(document).ready(function() {
|
|||
if (typeof FileActions !== 'undefined') {
|
||||
FileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
|
||||
var tr = $('tr').filterAttr('data-file', filename);
|
||||
var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
|
||||
var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date");
|
||||
var files = tr.attr('data-file');
|
||||
undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner;
|
||||
var deleteAction = $('tr').filterAttr('data-file', filename).children("td.date").children(".action.delete");
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
disableActions();
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
|
||||
{files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
|
||||
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
function(result) {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
|
@ -21,7 +19,8 @@ $(document).ready(function() {
|
|||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
};
|
||||
|
@ -30,16 +29,12 @@ $(document).ready(function() {
|
|||
return OC.imagePath('core', 'actions/delete');
|
||||
}, function(filename) {
|
||||
$('.tipsy').remove();
|
||||
|
||||
var tr = $('tr').filterAttr('data-file', filename);
|
||||
var deleteAction = $('tr').filterAttr('data-file', filename).children("td.date").children(".action.delete");
|
||||
var oldHTML = deleteAction[0].outerHTML;
|
||||
var newHTML = '<img class="move2trash" data-action="Delete" title="'+t('files', 'delete file permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
|
||||
var files = tr.attr('data-file');
|
||||
deleteAction[0].outerHTML = newHTML;
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
disableActions();
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
|
||||
{files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') },
|
||||
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
function(result) {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
|
@ -50,7 +45,8 @@ $(document).ready(function() {
|
|||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -65,11 +61,12 @@ $(document).ready(function() {
|
|||
$('td.filename input:checkbox').attr('checked', false);
|
||||
$('td.filename input:checkbox').parent().parent().removeClass('selected');
|
||||
}
|
||||
processSelection();
|
||||
procesSelection();
|
||||
});
|
||||
|
||||
$('td.filename input:checkbox').live('change',function(event) {
|
||||
$('#fileList').on('click', 'td.filename a', function(event) {
|
||||
if (event.shiftKey) {
|
||||
event.preventDefault();
|
||||
var last = $(lastChecked).parent().parent().prevAll().length;
|
||||
var first = $(this).parent().parent().prevAll().length;
|
||||
var start = Math.min(first, last);
|
||||
|
@ -77,7 +74,7 @@ $(document).ready(function() {
|
|||
var rows = $(this).parent().parent().parent().children('tr');
|
||||
for (var i = start; i < end; i++) {
|
||||
$(rows).each(function(index) {
|
||||
if (index === i) {
|
||||
if (index == i) {
|
||||
var checkbox = $(this).children().children('input:checkbox');
|
||||
$(checkbox).attr('checked', 'checked');
|
||||
$(checkbox).parent().parent().addClass('selected');
|
||||
|
@ -85,28 +82,32 @@ $(document).ready(function() {
|
|||
});
|
||||
}
|
||||
}
|
||||
var selectedCount=$('td.filename input:checkbox:checked').length;
|
||||
$(this).parent().parent().toggleClass('selected');
|
||||
if(!$(this).attr('checked')){
|
||||
$('#select_all').attr('checked',false);
|
||||
var checkbox = $(this).parent().children('input:checkbox');
|
||||
lastChecked = checkbox;
|
||||
if ($(checkbox).attr('checked')) {
|
||||
$(checkbox).removeAttr('checked');
|
||||
$(checkbox).parent().parent().removeClass('selected');
|
||||
$('#select_all').removeAttr('checked');
|
||||
} else {
|
||||
$(checkbox).attr('checked', 'checked');
|
||||
$(checkbox).parent().parent().toggleClass('selected');
|
||||
var selectedCount = $('td.filename input:checkbox:checked').length;
|
||||
if (selectedCount == $('td.filename input:checkbox').length) {
|
||||
$('#select_all').attr('checked',true);
|
||||
$('#select_all').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
processSelection();
|
||||
procesSelection();
|
||||
});
|
||||
|
||||
$('.undelete').click('click', function(event) {
|
||||
event.preventDefault();
|
||||
var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
|
||||
var files = getSelectedFiles('file');
|
||||
var fileslist = JSON.stringify(files);
|
||||
var dirlisting = getSelectedFiles('dirlisting')[0];
|
||||
disableActions();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var undeleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date");
|
||||
undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner;
|
||||
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
}
|
||||
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
|
||||
|
@ -120,21 +121,21 @@ $(document).ready(function() {
|
|||
OC.dialogs.alert(result.data.message, t('core', 'Error'));
|
||||
}
|
||||
enableActions();
|
||||
});
|
||||
FileList.updateFileSummary();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('.delete').click('click', function(event) {
|
||||
event.preventDefault();
|
||||
console.log("delete selected");
|
||||
var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'Delete permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
|
||||
var files = getSelectedFiles('file');
|
||||
var fileslist = JSON.stringify(files);
|
||||
var dirlisting = getSelectedFiles('dirlisting')[0];
|
||||
|
||||
disableActions();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date");
|
||||
deleteAction[0].innerHTML = deleteAction[0].innerHTML+spinner;
|
||||
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
}
|
||||
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
|
||||
|
@ -148,7 +149,10 @@ $(document).ready(function() {
|
|||
OC.dialogs.alert(result.data.message, t('core', 'Error'));
|
||||
}
|
||||
enableActions();
|
||||
});
|
||||
FileList.updateFileSummary();
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
$('#fileList').on('click', 'td.filename a', function(event) {
|
||||
|
@ -182,34 +186,6 @@ $(document).ready(function() {
|
|||
};
|
||||
});
|
||||
|
||||
function processSelection(){
|
||||
var selected=getSelectedFiles();
|
||||
var selectedFiles=selected.filter(function(el){return el.type === 'file'});
|
||||
var selectedFolders=selected.filter(function(el){return el.type === 'dir'});
|
||||
if(selectedFiles.length === 0 && selectedFolders.length === 0) {
|
||||
$('#headerName>span.name').text(t('files','Name'));
|
||||
$('#modified').text(t('files','Deleted'));
|
||||
$('table').removeClass('multiselect');
|
||||
$('.selectedActions').hide();
|
||||
}
|
||||
else {
|
||||
$('.selectedActions').show();
|
||||
var selection='';
|
||||
if(selectedFolders.length>0){
|
||||
selection += n('files', '%n folder', '%n folders', selectedFolders.length);
|
||||
if(selectedFiles.length>0){
|
||||
selection+=' & ';
|
||||
}
|
||||
}
|
||||
if(selectedFiles.length>0){
|
||||
selection += n('files', '%n file', '%n files', selectedFiles.length);
|
||||
}
|
||||
$('#headerName>span.name').text(selection);
|
||||
$('#modified').text('');
|
||||
$('table').addClass('multiselect');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get a list of selected files
|
||||
* @param string property (option) the property of the file requested
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th id='headerName'>
|
||||
<div id="headerName-container">
|
||||
<input type="checkbox" id="select_all" />
|
||||
<label for="select_all"></label>
|
||||
<span class='name'><?php p($l->t( 'Name' )); ?></span>
|
||||
<span class='selectedActions'>
|
||||
<a href="" class="undelete">
|
||||
|
@ -26,6 +28,7 @@
|
|||
<?php p($l->t('Restore'))?>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</th>
|
||||
<th id="headerDate">
|
||||
<span id="modified"><?php p($l->t( 'Deleted' )); ?></span>
|
||||
|
|
Loading…
Reference in New Issue