fixed 3 BUGS: BUG-31: can post move/del/restore DBoxes without highlighted files/content; BUG-33: can call move/del/restore on mixed content - prob. stop it? (e.g right-click from search with highlighted files in both Bin and non Bin locations); BUG-34: shift-clicking (left or right) from a non-highlighted state does not add the shift-clicked item. ALSO removed ability to right-click change sel...
This commit is contained in:
4
BUGs
4
BUGs
@@ -1,3 +1 @@
|
||||
### Next: 34
|
||||
BUG-31: can post move/del/restore DBoxes without highlighted files/content
|
||||
BUG-33: can call move/del/restore on mixed content - prob. stop it? (e.g right-click from search with highlighted files in both Bin and non Bin locations)
|
||||
### Next: 35
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
<button id="next" name="next" class="sm-txt btn btn-info"><i class="fas fa-arrow-alt-circle-right"></i></button>
|
||||
</div>
|
||||
<div class="col my-auto">
|
||||
<button id="move" name="move" class="sm-txt btn btn-primary ml-4" onClick="MoveDBox(); return false;"><i class="fas fa-folder-plus"></i></button>
|
||||
<button id="move" disabled name="move" class="sm-txt btn btn-primary ml-4" onClick="MoveDBox(); return false;"><i class="fas fa-folder-plus"></i></button>
|
||||
{% if "files_rbp" in request.url %}
|
||||
<button id="del" name="del" class="sm-txt btn btn-success mx-1" onClick="DelDBox('Restore'); return false;">
|
||||
<button id="del" disabled name="del" class="sm-txt btn btn-success mx-1" onClick="DelDBox('Restore'); return false;">
|
||||
<i class="fas fa-trash-restore-alt"></i>
|
||||
{% else %}
|
||||
<button id="del" name="del" class="sm-txt btn btn-danger mx-1" onClick="DelDBox('Delete'); return false;">
|
||||
<button id="del" disabled name="del" class="sm-txt btn btn-danger mx-1" onClick="DelDBox('Delete'); return false;">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
{% endif %}
|
||||
</button>
|
||||
@@ -234,7 +234,6 @@ function GetSelnAsData()
|
||||
|
||||
function DelDBox(del_or_undel)
|
||||
{
|
||||
console.log(del_or_undel)
|
||||
to_del = GetSelnAsData()
|
||||
$('#dbox-title').html(del_or_undel+' Selected File(s)')
|
||||
div ='<div class="row col-lg-12"><p class="col">' + del_or_undel + ' the following files?</p></div>'
|
||||
@@ -310,8 +309,6 @@ function ChangeSize(clicked_button,sz)
|
||||
// whether you click after highlight or before
|
||||
function DoSel(e, el)
|
||||
{
|
||||
console.log(e)
|
||||
console.log(el)
|
||||
if( e.ctrlKey )
|
||||
{
|
||||
$(el).toggleClass('highlight')
|
||||
@@ -322,6 +319,12 @@ function DoSel(e, el)
|
||||
st=Number($('.highlight').first().attr('img'))
|
||||
end=Number($('.highlight').last().attr('img'))
|
||||
clicked=Number($(el).attr('img'))
|
||||
// if we shift-click first element, then st/end are NaN, so just highlightthe one clicked
|
||||
if( isNaN(st) )
|
||||
{
|
||||
$('.figure').slice( clicked, clicked+1 ).addClass('highlight')
|
||||
return
|
||||
}
|
||||
if( clicked > end )
|
||||
$('.figure').slice( end, clicked+1 ).addClass('highlight')
|
||||
else
|
||||
@@ -332,35 +335,58 @@ function DoSel(e, el)
|
||||
$(el).addClass('highlight')
|
||||
}
|
||||
|
||||
$('.figure').click( function(e) { DoSel(e, this ); return false; });
|
||||
$(document).on('click', function(e) { $('.highlight').removeClass('highlight') });
|
||||
function SetButtonState() {
|
||||
var sel=false
|
||||
$('.highlight').each(function( index ) { sel=true } )
|
||||
if( sel ) {
|
||||
$('#move').attr('disabled', false )
|
||||
$('#del').attr('disabled', false )
|
||||
} else {
|
||||
$('#move').attr('disabled', true )
|
||||
$('#del').attr('disabled', true )
|
||||
}
|
||||
}
|
||||
|
||||
function SelContainsBinAndNotBin() {
|
||||
var bin=false
|
||||
var not_bin=false
|
||||
$('.highlight').each(function( index ) {
|
||||
if( $(this).attr('path_type') == "Bin" ) {
|
||||
bin=true
|
||||
} else {
|
||||
not_bin=true
|
||||
}
|
||||
} )
|
||||
if( bin && not_bin )
|
||||
return true
|
||||
else
|
||||
return false
|
||||
}
|
||||
|
||||
$('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; });
|
||||
$(document).on('click', function(e) { $('.highlight').removeClass('highlight') ; SetButtonState() });
|
||||
|
||||
$.contextMenu({
|
||||
selector: '.figure',
|
||||
build: function($triggerElement, e){
|
||||
DoSel(e, e.currentTarget )
|
||||
if (e.currentTarget.getAttribute('path_type') == 'Bin' ) {
|
||||
var tst;
|
||||
item_list = {
|
||||
details: { name: "Details..." },
|
||||
view: { name: "View File" },
|
||||
sep: "---",
|
||||
move: { name: "Move selected file(s) to new storage folder" },
|
||||
undel: { name: "Restore selected file(s)" }
|
||||
move: { name: "Move selected file(s) to new storage folder" }
|
||||
}
|
||||
if( SelContainsBinAndNotBin() ) {
|
||||
item_list['both']= { name: 'Cannot delete and restore at same time', disabled: true }
|
||||
} else {
|
||||
item_list = {
|
||||
details: { name: "Details..." },
|
||||
view: { name: "View File" },
|
||||
sep: "---",
|
||||
move: { name: "Move selected file(s) to new storage folder" },
|
||||
del: { name: "Delete Selected file(s)" }
|
||||
}
|
||||
if (e.currentTarget.getAttribute('path_type') == 'Bin' )
|
||||
item_list['undel']= { name: "Restore selected file(s)" }
|
||||
else
|
||||
item_list['del']= { name: "Delete Selected file(s)" }
|
||||
}
|
||||
|
||||
return {
|
||||
callback: function( key, options) {
|
||||
console.log( $(this).attr('id') )
|
||||
console.log( $(this).attr('path_type') )
|
||||
if( key == "view" ) { document.location.href = $(this).find('a').attr('href'); }
|
||||
if( key == "move" ) { MoveDBox() }
|
||||
if( key == "del" ) { DelDBox('Delete') }
|
||||
|
||||
Reference in New Issue
Block a user