[10441] | 1 | {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} |
---|
[4549] | 2 | |
---|
[10441] | 3 | {footer_script}{literal} |
---|
| 4 | var queuedManager = $.manageAjax.create('queued', { |
---|
| 5 | queue: true, |
---|
| 6 | cacheResponse: false, |
---|
| 7 | maxRequests: 3 |
---|
| 8 | }); |
---|
| 9 | |
---|
| 10 | function processThumbs(width,height,gd_version) { |
---|
| 11 | var square=$('input[name="square"]').attr('checked'); |
---|
| 12 | var done=0; |
---|
| 13 | $('tr.nothumb').each(function() { |
---|
| 14 | var file=$(this).find('td.filepath').text(); |
---|
| 15 | $(this).find('td.thumbpic').html('<img src="plugins/Ajax_Thumbnailer/ajax-loader.gif">'); |
---|
| 16 | var td=this; |
---|
| 17 | queuedManager.add({ |
---|
| 18 | type: 'GET', |
---|
| 19 | url: 'ws.php', |
---|
| 20 | data: {method: 'pwg.images.createThumbnail',picture:file,format:'json',width: width,height: height, gd_version: gd_version, square: square}, |
---|
| 21 | dataType: 'json', |
---|
| 22 | success: (function(row) { return function(data) { |
---|
| 23 | if (data.stat =='ok') { |
---|
| 24 | $(row).find('td.thumbpic').html('<img src="'+data.result.tn_file+'"/>'); |
---|
| 25 | $(row).find('td.thumbdim').html(""+data.result.tn_width+"X"+data.result.tn_height); |
---|
| 26 | $(row).find('td.thumbgentime').html(""+data.result.tn_time); |
---|
| 27 | $(row).find('td.thumbsize').html(""+data.result.tn_size); |
---|
| 28 | $(row).removeClass("nothumb"); |
---|
| 29 | } else { |
---|
| 30 | $(row).find('td.thumbpic').html('#ERR#'+data.err+"# : "+data.message); |
---|
| 31 | $(row).removeClass("nothumb"); |
---|
| 32 | $(row).addClass("error"); |
---|
| 33 | } |
---|
| 34 | if (done++ == 20) { |
---|
| 35 | $('tr.item:not(.nothumb)').remove(); |
---|
| 36 | done = 0; |
---|
| 37 | } |
---|
| 38 | };})(td) |
---|
| 39 | }); |
---|
| 40 | }); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | $(document).ready(function(){ |
---|
| 44 | $('input#proceed').click (function () { |
---|
| 45 | var width = $('#width')[0].value; |
---|
| 46 | var height = $('#height')[0].value; |
---|
| 47 | var gd_version=$("input[@name='gd']:checked").val(); |
---|
| 48 | $("input:not(.nodisable)").attr("disabled",true); |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | processThumbs(width,height,gd_version); |
---|
| 52 | }); |
---|
| 53 | |
---|
| 54 | $('input#cancel').click (function () { |
---|
| 55 | queuedManager.clear(); |
---|
| 56 | queuedManager.abort(); |
---|
| 57 | $("input:not(.nodisable)").attr("disabled",false); |
---|
| 58 | $('tr.nothumb td.thumbpic').html(" "); |
---|
| 59 | |
---|
| 60 | }); |
---|
| 61 | |
---|
| 62 | $('input#clear').click (function () { |
---|
| 63 | $('tr.item:not(.nothumb)').remove(); |
---|
| 64 | }); |
---|
| 65 | }); |
---|
| 66 | {/literal}{/footer_script} |
---|
| 67 | |
---|
[4549] | 68 | <div class="titrePage"> |
---|
[10441] | 69 | <h2>{'Thumbnail creation'|@translate}</h2> |
---|
[4549] | 70 | </div> |
---|
| 71 | |
---|
| 72 | {if isset($params) } |
---|
| 73 | <form method="post" action="{$params.F_ACTION}" class="properties"> |
---|
| 74 | |
---|
| 75 | <fieldset> |
---|
[10441] | 76 | <legend>{'Thumbnail creation'|@translate}</legend> |
---|
[4549] | 77 | |
---|
| 78 | <ul> |
---|
| 79 | <li> |
---|
[10441] | 80 | <span class="property">{'GD version'|@translate}</span> |
---|
[4549] | 81 | <label> |
---|
| 82 | <input type="radio" name="gd" value="2" {if $params.GD_SELECTED==2}checked="checked"{/if}>2.x |
---|
| 83 | </label> |
---|
| 84 | <label> |
---|
| 85 | <input type="radio" name="gd" value="1" {if $params.GD_SELECTED==1}checked="checked"{/if}>1.x |
---|
| 86 | </label> |
---|
| 87 | </li> |
---|
| 88 | |
---|
| 89 | <li> |
---|
| 90 | <span class="property"> |
---|
| 91 | <label for="width">{'maximum width'|@translate}</label> |
---|
| 92 | </span> |
---|
| 93 | <input type="text" id="width" name="width" value="{$params.WIDTH_TN}"> |
---|
| 94 | </li> |
---|
| 95 | |
---|
| 96 | <li> |
---|
| 97 | <span class="property"> |
---|
| 98 | <label for="height">{'maximum height'|@translate}</label> |
---|
| 99 | </span> |
---|
| 100 | <input type="text" id="height" name="height" value="{$params.HEIGHT_TN}"> |
---|
| 101 | </li> |
---|
| 102 | </ul> |
---|
| 103 | </fieldset> |
---|
| 104 | |
---|
| 105 | <p><input type="button" name="submit" id="proceed" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}> |
---|
| 106 | <input type="button" class="nodisable" name="submit" id="cancel" value="{'Cancel'|@translate}" {$TAG_INPUT_ENABLED}> |
---|
| 107 | <input type="button" class="nodisable" name="submit" id="clear" value="{'clear_success'|@translate}" {$TAG_INPUT_ENABLED}> |
---|
| 108 | |
---|
| 109 | </p> |
---|
| 110 | </form> |
---|
| 111 | {/if} {*isset params*} |
---|
| 112 | |
---|
[10441] | 113 | {if !empty($remainings) } |
---|
| 114 | <div class="admin">{$TOTAL_NB_REMAINING} {'Number of thumbnails to create'|@translate}</div> |
---|
[4549] | 115 | <table style="width:100%;"> |
---|
| 116 | <tr class="throw"> |
---|
| 117 | <td> </td> |
---|
| 118 | <td style="width:60%;">{'Path'|@translate}</td> |
---|
[10441] | 119 | <td>{'Filesize'|@translate}</td> |
---|
[4549] | 120 | <td>{'Dimensions'|@translate}</td> |
---|
[10441] | 121 | <td>{'Thumbnail'|@translate}</td> |
---|
| 122 | <td>{'generated in'|@translate}</td> |
---|
| 123 | <td>{'Filesize'|@translate}</td> |
---|
[4549] | 124 | <td>{'Dimensions'|@translate}</td> |
---|
| 125 | </tr> |
---|
[10441] | 126 | {foreach from=$remainings item=elt name=remain_loop} |
---|
[4549] | 127 | <tr class="{if $smarty.foreach.remain_loop.index is odd}row1{else}row2{/if} nothumb item" id="th_{$smarty.foreach.remain_loop.iteration}"> |
---|
| 128 | <td>{$smarty.foreach.remain_loop.iteration}</td> |
---|
| 129 | <td class="filepath">{$elt.PATH}</div></td> |
---|
| 130 | <td>{$elt.FILESIZE_IMG}</div></td> |
---|
| 131 | <td>{$elt.WIDTH_IMG} x {$elt.HEIGHT_IMG}</td> |
---|
| 132 | <td class="thumbpic"> </td> |
---|
| 133 | <td class="thumbgentime"> </td> |
---|
| 134 | <td class="thumbsize"> </td> |
---|
| 135 | <td class="thumbdim"> </td> |
---|
| 136 | </tr> |
---|
| 137 | {/foreach} |
---|
| 138 | </table> |
---|
| 139 | {else} |
---|
[10441] | 140 | <div style="text-align:center;font-weight:bold;margin:10px;"> [ {'No missing thumbnail'|@translate} ]</div> |
---|
[4549] | 141 | {/if} |
---|