Skip to content
Permalink
Browse files

issue 593 - batch manager block deletion; simpler php code + exact pr…

…ogress feed back ...
  • Loading branch information...
modus75 committed Jan 10, 2017
1 parent bf5b50c commit 37fc55e6b654893a1df22c1cf6355572b2074496
Showing with 28 additions and 27 deletions.
  1. +26 −19 admin/themes/default/js/batchManagerGlobal.js
  2. +2 −7 include/ws_functions/pwg.images.php
  3. +0 −1 ws.php
@@ -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();
}
@@ -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;

This comment has been minimized.

Copy link
@plegall

plegall Jan 12, 2017

Member

Hi @vvinogradsky as you can see, in Piwigo 2.9, method pwg.images.delete will return the number of images deleted. Is that a problem for your Lightroom plugin?

This comment has been minimized.

Copy link
@vvinogradsky

vvinogradsky Jan 12, 2017

Hi @plegall,
Thanks for asking! No, this will not cause any issues.

}
/**
1 ws.php
@@ -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',

0 comments on commit 37fc55e

Please sign in to comment.
You can’t perform that action at this time.