diff options
author | rvelices <rv-github@modusoptimus.com> | 2014-07-01 19:28:09 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2014-07-01 19:28:09 +0000 |
commit | faa284333d1ad8d385da3b8aa3cef754183257d9 (patch) | |
tree | e8d55be8531bba3ad6101c524701c2ab6047850e /admin/themes/default/js/batchManagerGlobal.js | |
parent | bc3675b380d16bf635d70d6b2128baca98dbaefa (diff) |
bug 3013: Clean batch manager global
git-svn-id: http://piwigo.org/svn/trunk@28909 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/js/batchManagerGlobal.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/admin/themes/default/js/batchManagerGlobal.js b/admin/themes/default/js/batchManagerGlobal.js index f63b840a2..12d5987ac 100644 --- a/admin/themes/default/js/batchManagerGlobal.js +++ b/admin/themes/default/js/batchManagerGlobal.js @@ -93,6 +93,11 @@ jQuery(document).ready(function() { jQuery("a.preview-box").colorbox(); +jQuery('.thumbnails img').tipTip({ + 'delay' : 0, + 'fadeIn' : 200, + 'fadeOut' : 200 +}); /* ********** Actions*/ @@ -130,3 +135,79 @@ $("input[name=remove_date_creation]").click(function () { $("#set_date_creation").show(); } }); + +var derivatives = { + elements: null, + done: 0, + total: 0, + + finished: function() { + return derivatives.done == derivatives.total && derivatives.elements && derivatives.elements.length==0; + } +}; + +function progress(success) { + jQuery('#progressBar').progressBar(derivatives.done, { + max: derivatives.total, + textFormat: 'fraction', + boxImage: 'themes/default/images/progressbar.gif', + barImage: 'themes/default/images/progressbg_orange.gif' + }); + if (success !== undefined) { + var type = success ? 'regenerateSuccess': 'regenerateError', + s = jQuery('[name="'+type+'"]').val(); + jQuery('[name="'+type+'"]').val(++s); + } + + if (derivatives.finished()) { + jQuery('#applyAction').click(); + } +} + +function getDerivativeUrls() { + var ids = derivatives.elements.splice(0, 500); + var params = {max_urls: 100000, ids: ids, types: []}; + jQuery("#action_generate_derivatives input").each( function(i, t) { + if ($(t).is(":checked")) + params.types.push( t.value ); + } ); + + jQuery.ajax( { + type: "POST", + url: 'ws.php?format=json&method=pwg.getMissingDerivatives', + data: params, + dataType: "json", + success: function(data) { + if (!data.stat || data.stat != "ok") { + return; + } + derivatives.total += data.result.urls.length; + progress(); + for (var i=0; i < data.result.urls.length; i++) { + jQuery.manageAjax.add("queued", { + type: 'GET', + url: data.result.urls[i] + "&ajaxload=true", + dataType: 'json', + success: ( function(data) { derivatives.done++; progress(true) }), + error: ( function(data) { derivatives.done++; progress(false) }) + }); + } + if (derivatives.elements.length) + setTimeout( getDerivativeUrls, 25 * (derivatives.total-derivatives.done)); + } + } ); +} + +function selectGenerateDerivAll() { + $("#action_generate_derivatives input[type=checkbox]").prop("checked", true); +} +function selectGenerateDerivNone() { + $("#action_generate_derivatives input[type=checkbox]").prop("checked", false); +} + +function selectDelDerivAll() { + $("#action_delete_derivatives input[type=checkbox]").prop("checked", true); +} +function selectDelDerivNone() { + $("#action_delete_derivatives input[type=checkbox]").prop("checked", false); +} |