added ribbon restriction to filter dialog + several minor changes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-01-13 08:31:10 +04:00
parent 92de8870e6
commit 94940e78f1
5 changed files with 30 additions and 5 deletions

View File

@ -314,6 +314,10 @@ function filterImagesDialog(){
'no'
]}
cfg['sep2'] = '---'
cfg['Ribbon'] = {select: [
'all',
'current only'
]}
cfg['Keep ribbons'] = false
formDialog(null,
@ -386,6 +390,11 @@ function filterImagesDialog(){
} else {
gids = getUnmarked(gids)
}
} else if(/^Ribbon/.test(field) && res[field].trim() != 'all'){
if(res[field] == 'current only'){
gids = getRibbonGIDs(gids)
}
}
}

View File

@ -709,12 +709,22 @@ function getGIDRibbonIndex(gid, data){
// - number - ribbon index
// - gid
// - image
// - list - return only images in ribbon
//
// XXX we should be able to pass both a ribbon number and a list of
// gids to filter...
function getRibbonGIDs(a, no_clone, data){
data = data == null ? DATA : data
if(typeof(a) == typeof(123)){
return data.ribbons[a].slice()
var res = data.ribbons[a]
} else {
var res = data.ribbons[getGIDRibbonIndex(a.constructor.name != 'Array' ? a : null, data)]
}
if(a.constructor.name = 'Array'){
res = res.filter(function(e){
return a.indexOf(e) >= 0
})
}
var res = data.ribbons[getGIDRibbonIndex(a, data)]
if(no_clone){
return res
}

View File

@ -436,8 +436,9 @@ function loadFileImages(path, no_load_diffs){
//
// NOTE: if an explicit name is given then this will not remove anything.
// NOTE: this will use CONFIG.cache_dir as the location if no name is given.
function saveFileImages(name){
var remove_diffs = (name == null)
function saveFileImages(name, remove_diffs){
//remove_diffs = remove_diffs == null ? (name == null) : remove_diffs
remove_diffs = remove_diffs == null ? false : remove_diffs
name = name == null ? normalizePath(CONFIG.cache_dir_var +'/'+ Date.timeStamp()) : name
if(window.dumpJSON == null){

View File

@ -155,7 +155,7 @@ function removeTag(tags, gid, tagset, images){
})
// clear the tags...
if(updated && img.tags.length == 0){
if(updated && img.tags != null && img.tags.length == 0){
delete img.tags
}

View File

@ -1262,6 +1262,11 @@ function showImageInfo(){
'<tr><td>Position (ribbon): </td><td>'+ (DATA.ribbons[r].indexOf(gid)+1) +
'/'+ DATA.ribbons[r].length +'</td></tr>'+
'<tr><td>Position (global): </td><td>'+ (order+1) +'/'+ DATA.order.length +'</td></tr>'+
'<tr><td>Sorted: </td><td>'+
//(((DATA.order.length-tagSelectAND('unsorted', DATA.order).length)/DATA.order.length)*100+'').split('.')[0] +
//(((DATA.order.length-tagSelectAND('unsorted').length)/DATA.order.length)*100+'').split('.')[0] +
(((DATA.order.length-TAGS['unsorted'].length)/DATA.order.length)*100+'').split('.')[0] +
'%</td></tr>'+
// editable fields...
'<tr><td colspan="2"><hr></td></tr>'+