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

Last change on this file since 17434 was 17434, checked in by mistic100, 12 years ago

bug with albums with close names
bug with apostrophe in albums name and description

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