Project

General

Profile

Download (1.49 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
  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/>'});
14
  fileDownloadCheckTimer = window.setInterval(function () {
15
    var cookieValue = jQuery.cookie('fileDownloadToken');
16
    if (cookieValue == token)
17
     finishDownload();
18
  }, 1000);
19
}
20

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

    
27
/**
28
 * 
29
 * function validates combobox 
30
 * and if selected item is empty,
31
 * it jumps back to default value. 
32
 * 
33
 */
34
function validateForm(){
35
	var select = document.getElementById("edit-combobox");
36
	if(select.value==null || select.value == -1|| select.value==""){
37
		//alert('Please select a valid classification');
38
		//jQuery('#edit-combobox').addClass("error");
39
		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
});
(1-1/3)