Changeset 9947


Ignore:
Timestamp:
Mar 31, 2011, 11:32:35 AM (13 years ago)
Author:
patdenice
Message:

Use ajaxmanager

Location:
extensions/autoupdate/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/trunk/template/autoupdate.js

    r9935 r9947  
     1var todo = 0;
     2var queuedManager = $.manageAjax.create('queued', {
     3        queue: true, 
     4        maxRequests: 1,
     5  beforeSend: function() { autoupdate_bar_toggle(1); },
     6  complete: function() { autoupdate_bar_toggle(-1); }
     7});
     8
    19function updateAll() {
    210  if (confirm(confirmMsg)) {
    3     extList = [];
    411    jQuery('.updateExtension').each( function() {
    5       if (jQuery(this).parents('div').css('display') == 'block') {
    6         extList.push(jQuery(this).attr('onClick'));
    7       }
     12      if (jQuery(this).parents('div').css('display') == 'block')
     13        jQuery(this).click();
    814    });
    9     if (extList.length > 0) eval(extList[0]);
    1015  }
    1116};
     
    5762
    5863function upgradeExtension(type, id, revision) {
    59   jQuery('.autoupdate_bar').toggle();
    60   jQuery.ajax({
     64  queuedManager.add({
    6165    type: 'GET',
     66    dataType: 'json',
    6267    url: 'ws.php',
    6368    data: { method: 'pwg.'+type+'s.update', id: id, revision: revision, pwg_token: pwg_token, format: 'json' },
    6469    success: function(data) {
    6570      if (data['stat'] == 'ok') {
     71        jQuery.jGrowl( data['result'], { theme: 'success', header: successHead, life: 4000, sticky: false });
    6672        jQuery("#"+type+"_"+id).remove();
    6773        checkFieldsets();
    68         jQuery.jGrowl(
    69           data['result'],
    70           {
    71             theme:  'success',
    72             header: successHead,
    73             life:   4000,
    74             sticky: false
    75           }
    76         );
    77         if (extList.length > 0) extList.shift();
    78         if (extList.length > 0) eval(extList[0]);
    7974      } else {
    80         jQuery.jGrowl(
    81           data['result'],
    82           {
    83             theme:  'error',
    84             header: errorHead,
    85             sticky: true
    86           }
    87         );
    88         extList = [];
     75        jQuery.jGrowl( data['result'], { theme: 'error', header: errorHead, sticky: true });
    8976      }
    90       jQuery('.autoupdate_bar').toggle();
    9177    },
    9278    error: function(data) {
    93       jQuery.jGrowl(
    94         errorMsg,
    95         {
    96           theme:  'error',
    97           header: errorHead,
    98           sticky: true
    99         }
    100       );
    101       extList = [];
    102       jQuery('.autoupdate_bar').toggle();
    103     },
    104     dataType: 'json'
     79      jQuery.jGrowl( errorMsg, { theme: 'error', header: errorHead, sticky: true });
     80    }
    10581  });
    10682};
     
    12197  });
    12298};
     99
     100function autoupdate_bar_toggle(i) {
     101  todo = todo + i;
     102  if ((i == 1 && todo == 1) || (i == -1 && todo == 0))
     103    jQuery('.autoupdate_bar').toggle();
     104}
  • extensions/autoupdate/trunk/template/update_ext.tpl

    r9735 r9947  
     1{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' }
    12{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' }
    2 {combine_script id='jquery.autoupdate' load='footer' require='jquery' path='plugins/autoupdate/template/autoupdate.js' }
     3{combine_script id='jquery.autoupdate' load='footer' require='jquery.ajaxmanager,jquery.jgrowl' path='plugins/autoupdate/template/autoupdate.js' }
    34{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
    45
    5 {footer_script require='jquery.autoupdate,jquery.effects.blind,jquery.jgrowl'}
     6{footer_script require='jquery.autoupdate,jquery.effects.blind'}
    67var pwg_token = '{$PWG_TOKEN}';
    78var extList = new Array();
  • extensions/autoupdate/trunk/ws_functions.inc.php

    r9935 r9947  
    22
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4 
    5 global $conf;
    64
    75$service = &$arr[0];
Note: See TracChangeset for help on using the changeset viewer.