/** * This function shows the screen to add thumbs in content items. * This function is used by the image browser plugin. * */ function plugin($e_name) { HTML_imagebrowser::plugin($this, $e_name); }
function resizeFolderImages(&$data) { HTML_imagebrowser::attachCSS(); // Set toolbar items for the page JToolBarHelper::title(JText::_(_IMAGEBROWSER_FOLDER_RESIZE_IMAGES), 'generic.png'); JToolBarHelper::back(); ?> <script type="text/javascript"> window.addEvent('domready', function() { var tips = new Tips(); /** * reqState is a custom option, onRequest/onComplete can handle * it like a property. Its used here to take track of the element * for the specific Ajax requests. * * We define options here because it saves code and all * Ajax instances have the same options. We also add a Tips::build * to show the responseText */ var options = { method: 'get', onRequest: function(){ this.options.reqState .addClass('ajax-loading') .setHTML('Request ...'); }, onComplete: function(resp){ this.options.reqState .removeClass('ajax-loading') .setProperty('title', 'Response: :: ' + resp) .setHTML('Complete!'); tips.build(this.options.reqState); } }; var xhrs = [ <?php for ($i = 0; $i < count($data->images); $i++) { ?> <?php if ($i > 0) { echo ','; } ?> <?php $url = 'index.php?option=' . $data->option . '&task=resize_images&folder=' . $data->current_folder . '&file=' . $data->images[$i]['file']; ?> new Ajax('<?php echo $url; ?> ', $merge({reqState: $('req-state-<?php echo $i; ?> ')}, options)) <?php } ?> ]; /** * The group, it has one Event that waits for all Ajax instances to finish * it: onComplete. When all requests are complete this onComplete is fired. */ var group = new Group(<?php for ($i = 0; $i < count($data->images); $i++) { if ($i > 0) { echo ','; } echo 'xhrs[' . $i . ']'; } ?> ); group .addEvent('onRequest', function() { $('req-state-all') .addClass('ajax-loading') .setHTML('<?php echo JText::_(_IMAGEBROWSER_ALL_REQUESTS_STARTED, true); ?> ...'); }). addEvent('onComplete', function() { $('req-state-all') .removeClass('ajax-loading') .setHTML('<?php echo JText::_(_IMAGEBROWSER_ALL_COMPLETED, true); ?> !'); }); /** * The event which starts the request. */ $('req-start').addEvent('click', function(e) { new Event(e).stop(); xhrs.each(function(xhr){ xhr.request(); }); }); }); </script> <h3><?php echo _IMAGEBROWSER_FOLDER_RESIZE_IMAGES; ?> : <?php echo $data->current_folder; ?> </h3> <a id="req-start" href="#"><?php echo _IMAGEBROWSER_START_IMAGE_RESIZING; ?> </a> <dl id="req-states"> <?php for ($i = 0; $i < count($data->images); $i++) { ?> <dt><?php echo $data->images[$i]['file']; ?> :</dt> <dd id="req-state-<?php echo $i; ?> ">-</dd> <?php } ?> <dt><strong><?php echo _IMAGEBROWSER_OVERALL; ?> :</strong></dt> <dd id="req-state-all">-</dd> </dl> <div><a href="Javascript:window.history.back();">[ <?php echo JText::_(_IMAGEBROWSER_LANG_BACK); ?> ]</a></div> <br /> <?php }