issue 593 - batch manager block deletion; simpler php code + exact progress feed back ...

This commit is contained in:
modus75
2017-01-10 21:24:25 +01:00
parent bf5b50c979
commit 37fc55e6b6
3 changed files with 28 additions and 27 deletions
+26 -19
View File
@@ -278,25 +278,32 @@ jQuery('#applyAction').click(function(e) {
continue;
}
queuedManager.add({
type: 'POST',
url: 'ws.php?format=json',
data: {
method: "pwg.images.delete",
pwg_token: jQuery("input[name=pwg_token").val(),
return_details: true,
image_id: image_ids.join(',')
},
dataType: 'json',
success: ( function(data) {
todo += data.result.nb_processed;
progressDelete(todo, progressBar_max, true)
}),
error: ( function(data) {
todo += deleteBlockSize; // TODO: might be not exact, if last query
progressDelete(todo, progressBar_max, false)
})
});
(function(ids) {
var thisBatchSize = ids.length;
queuedManager.add({
type: 'POST',
url: 'ws.php?format=json',
data: {
method: "pwg.images.delete",
pwg_token: jQuery("input[name=pwg_token").val(),
image_id: ids
},
dataType: 'json',
success: function(data) {
todo += thisBatchSize;
var isOk = data.stat && "ok" == data.stat;
if (isOk && data.result != thisBatchSize)
/*TODO: user feedback only data.result images out of thisBatchSize were deleted*/;
/*TODO: user feedback if isError*/
progressDelete(todo, progressBar_max, isOk);
},
error: function(data) {
todo += thisBatchSize;
/*TODO: user feedback*/
progressDelete(todo, progressBar_max, false);
}
});
} )(image_ids);
image_ids = Array();
}
+2 -7
View File
@@ -1737,15 +1737,10 @@ function ws_images_delete($params, $service)
}
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
delete_elements($image_ids, true);
$ret = delete_elements($image_ids, true);
invalidate_user_cache();
if ($params['return_details'])
{
return array(
'nb_processed' => count($image_ids),
);
}
return $ret;
}
/**
-1
View File
@@ -504,7 +504,6 @@ function ws_addDefaultMethods( $arr )
array(
'image_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY),
'pwg_token' => array(),
'return_details' => array('default'=>false, 'type'=>WS_TYPE_BOOL),
),
'Deletes image(s).',
$ws_functions_root . 'pwg.images.php',