Project

General

Profile

Download (1.85 KB) Statistics
| Branch: | Tag: | Revision:
1
var fileDownloadCheckTimer;
2
/**
3
 * function to block the UI as 
4
 * long as the download have not started yet,
5
 * in order to not start several requests at
6
 * the same time.
7
 * 
8
 */
9
function blockUIForDownload() {
10
    
11
    var token = new Date().getTime()/1000|0;//'1234'; //use the current timestamp as the token value
12
    jQuery('#downloadTokenValueId').val(token);
13
      fileDownloadCheckTimer = window.setInterval(function () {
14
          var cookieValue = jQuery.cookie('fileDownloadToken');
15
          if (cookieValue == token) {
16
              finishDownload();
17
          }
18

    
19
      }, 1000);
20
      jQuery.blockUI( { message:'</br><h1><img src="../css/jquery-ui/images/ajax-loader.png">Please wait until the file is ready to download...</h1><br/>'});
21
  }
22

    
23
function finishDownload() {
24
  window.clearInterval(fileDownloadCheckTimer);
25
  jQuery.cookie('fileDownloadToken', null); //clears this cookie value
26
  jQuery.unblockUI();
27
}
28

    
29
/**
30
 * 
31
 * function validates combobox 
32
 * and if selected item is empty,
33
 * it jumps back to default value. 
34
 * 
35
 */
36
function validateForm(){
37
    var classification_select = document.getElementById("edit-csv-export-classification-select");
38
    if(classification_select.value==null || classification_select.value == -1|| classification_select.value==""){
39
        classification_select.selectedIndex = 0;
40
    }
41
}
42

    
43

    
44
/**
45
 *  function to select & deselect all
46
 *  checkboxes in one fieldset.
47
 */
48
jQuery(function () {
49
    jQuery("#checkall").click(function () {
50
        jQuery(this).parents("fieldset:eq(0)").find(":checkbox").attr("checked", this.checked);
51
    });
52
});
53

    
54
/**
55
 * function to sort all checkboxes
56
 * in a alpanumerical way
57
 */
58

    
59
//var elements = jQuery('input');
60
//var sorted = jQuery(jQuery(elements).toArray().sort(function(a, b) {
61
//  return a.value > b.value;
62
//}));
63
//
64
//jQuery(elements).each(function(i) {
65
//	jQuery(this).after(jQuery(sorted).eq(i));
66
//});
(1-1/3)