Put new functionality in to allow choosing existing folder in move code - it goes back and forwards 7 days from the date of this file and finds matching files and uses those dirs, or just dirname matches for those dates and offers them up. Also improved Move code to reject dodgy paths
This commit is contained in:
@@ -37,6 +37,22 @@ function change_rp_sel()
|
||||
$('#move_path_type').val( $('option:selected', '#rp_sel').attr('path_type') )
|
||||
}
|
||||
|
||||
function GetExistingDirsAsDiv( dt, divname )
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST', data: null, url: '/getexistingpaths/'+dt,
|
||||
success: function(data) {
|
||||
$('#'+divname).html(data)
|
||||
dirs = JSON.parse(data)
|
||||
s=''
|
||||
dirs.forEach( function(item, index) {
|
||||
s+= '<button class="btn btn-outline-primary" type="button" onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+'/'+item.suffix+'</button>'
|
||||
} )
|
||||
$('#'+divname).html(s)
|
||||
}
|
||||
} )
|
||||
}
|
||||
|
||||
// show the DBox for a move file, includes all thumbnails of selected files to move
|
||||
// and a pre-populated folder to move them into, with text field to add a suffix
|
||||
function MoveDBox(path_details, db_url)
|
||||
@@ -53,6 +69,8 @@ function MoveDBox(path_details, db_url)
|
||||
div+=GetSelnAsDiv()
|
||||
yr=$('.highlight').first().attr('yr')
|
||||
dt=$('.highlight').first().attr('date')
|
||||
div+='<div class="col-12">Use Existing:</div><div id="existing"></div>'
|
||||
GetExistingDirsAsDiv( dt, "existing" )
|
||||
div+=`
|
||||
<div class="input-group my-3">
|
||||
<alert class="alert alert-primary my-auto py-1">
|
||||
@@ -71,7 +89,7 @@ function MoveDBox(path_details, db_url)
|
||||
div+="value="+yr+'/'+dt+"-"
|
||||
div+=`
|
||||
"></input>
|
||||
<input type="text" name="suffix" class="form-control" placeholder="name"> </input>
|
||||
<input id="suffix" type="text" name="suffix" class="form-control" placeholder="name"> </input>
|
||||
</div>
|
||||
<div class="form-row col-12 mt-2">
|
||||
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-secondary offset-1 col-2">Cancel</button>
|
||||
|
||||
Reference in New Issue
Block a user