source: extensions/pbase2piwigo/admin/template/import.analyze.tpl @ 26201

Last change on this file since 26201 was 26201, checked in by mistic100, 10 years ago

update for 2.6

File size: 2.3 KB
Line 
1{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
2{combine_script id='jquery.jgrowl' load='footer' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
3{combine_css path="themes/default/js/plugins/jquery.jGrowl.css"}
4
5{footer_script require='jquery.ajaxmanager,jquery.jgrowl'}
6(function($){
7  var queue_lenght = 0;
8
9  var queuedManager = $.manageAjax.create('queued', {
10    queue: true, 
11    maxRequests: 1
12  });
13
14  function add_cat_to_parse_queue(url, path) {
15    queuedManager.add({
16      type: 'POST',
17      dataType: 'json',
18      url: 'ws.php?format=json',
19      data: { method: 'pwg.pBase.parse', url: url, path: path },
20      success: function(data) {
21        if (data['stat'] == 'ok') {
22          cats = data['result']['categories'];
23          for (i in cats) {
24            queue_lenght++;
25            add_cat_to_parse_queue(cats[i]['url'], cats[i]['path']);
26          }
27          $('#preview').html($('#preview').html()+data['result']['path']+"\n");
28        }
29        else {
30          $.jGrowl(data['message'], {
31            theme: 'error', sticky: true,
32            header: '{'ERROR'|translate}'
33          });
34          $('.loading').toggle();
35        }
36       
37        queue_lenght--;
38        if (data['stat'] == 'ok' && queue_lenght == 0) {
39          window.location.reload();
40        }
41      },
42      error: function () {
43        $.jGrowl('{'an error happened'|translate|escape:javascript}', {
44          theme: 'error', sticky: true,
45          header: '{'ERROR'|translate}'
46        });
47        $('.loading').toggle();
48      }
49    });
50  }
51
52  $('#begin_analyse').click(function() {
53    login = $('#pbase_login').val();
54   
55    if (login != '') {
56      queue_lenght++;
57      add_cat_to_parse_queue('http://www.pbase.com/'+ login +'/root', '/root');
58      $('.loading').toggle();
59    }
60    return false;
61  });
62}(jQuery));
63{/footer_script}
64
65
66<form action="{$PBASE_ADMIN}-import" method="post">
67  <p><label>{'PBase login'|translate} <input type="text" id="pbase_login"></label></p>
68  <p class="loading"><input type="submit" id="begin_analyse" value="{'Begin analyse'|translate}"></p>
69  <p class="loading" style="display:none;"><img src="{$PBASE_PATH}admin/template/loader-{$themeconf.name}.gif"></p>
70</form>
71
72<pre id="preview" style="margin-left:10px;">
73</pre>
Note: See TracBrowser for help on using the repository browser.