Index: lams_gradebook/web/includes/javascript/blockexportbutton.js
===================================================================
RCS file: /usr/local/cvsroot/lams_gradebook/web/includes/javascript/blockexportbutton.js,v
diff -u -r1.1 -r1.2
--- lams_gradebook/web/includes/javascript/blockexportbutton.js 6 Sep 2012 16:03:19 -0000 1.1
+++ lams_gradebook/web/includes/javascript/blockexportbutton.js 28 Oct 2013 14:28:02 -0000 1.2
@@ -1,40 +1,37 @@
-//In order to use this script define exportExcelUrl and languageLabelWait variables first.
+//Detecting the file download dialog in the browser:
+//http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx
+var fileDownloadCheckTimer;
-//Detecting-the-file-download-dialog-in-the-browser: http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx
- var fileDownloadCheckTimer;
- function blockExportButton() {
- var token = new Date().getTime(); //use the current timestamp as the token value
+function blockExportButton(areaToBlock, exportExcelUrl, labelWait) {
+ var token = new Date().getTime(); //use the current timestamp as the token value
- $('#export-link-area').block({
- message: '
' + languageLabelWait + '
',
- baseZ: 1000000,
- fadeIn: 0,
- css: {
- border: 'none',
- padding: '3px',
- backgroundColor: '#000',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px',
- opacity: .8
- },
- overlayCSS: {
- opacity: 0
- }
- });
-
- fileDownloadCheckTimer = window.setInterval(function () {
- var cookieValue = $.cookie('fileDownloadToken');
- if (cookieValue == token) {
- unBlockExportButton();
- }
- }, 1000);
-
- document.location.href = exportExcelUrl + "&downloadTokenValue=" + token;
- return false;
+ $('#' + areaToBlock).block({
+ message: '' + labelWait + '
',
+ baseZ: 1000000,
+ fadeIn: 0,
+ css: {
+ border: 'none',
+ padding: $('#' + areaToBlock).height()/2 + 'px',
+ backgroundColor: '#000',
+ '-webkit-border-radius': '10px',
+ '-moz-border-radius': '10px',
+ opacity: .98
+ },
+ overlayCSS: {
+ opacity: 0
}
-
- function unBlockExportButton() {
+ });
+
+ fileDownloadCheckTimer = window.setInterval(function () {
+ var cookieValue = $.cookie('fileDownloadToken');
+ if (cookieValue == token) {
+ //unBlock export button
window.clearInterval(fileDownloadCheckTimer);
$.cookie('fileDownloadToken', null); //clears this cookie value
- $('#export-link-area').unblock();
- }
\ No newline at end of file
+ $('#' + areaToBlock).unblock();
+ }
+ }, 1000);
+
+ document.location.href = exportExcelUrl + "&downloadTokenValue=" + token;
+ return false;
+}
\ No newline at end of file