Updated JS code for displaying upload and import information

This commit is contained in:
Tomas Srnka
2009-09-13 12:28:35 +00:00
parent 91ba1844eb
commit 818a664b3d
2 changed files with 15 additions and 18 deletions

View File

@@ -14,6 +14,7 @@
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
//require_once './libraries/display_import_functions.lib.php'; //require_once './libraries/display_import_functions.lib.php';
$GLOBALS['js_include'][] = 'functions.js'; $GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'mootools.js';
// reset import messages for ajax request // reset import messages for ajax request
$_SESSION['Import_message']['message'] = null; $_SESSION['Import_message']['message'] = null;

View File

@@ -29,6 +29,7 @@ if (empty($import_list)) {
<iframe id="import_upload_iframe" name="import_upload_iframe" width="1" height="1" style="display: none" src="import.php"></iframe> <iframe id="import_upload_iframe" name="import_upload_iframe" width="1" height="1" style="display: none" src="import.php"></iframe>
<div id="import_form_status" style="display: none;"></div> <div id="import_form_status" style="display: none;"></div>
<div id="importmain"> <div id="importmain">
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
// Mootools code for handling Ajax requests // Mootools code for handling Ajax requests
@@ -57,20 +58,18 @@ if (empty($import_list)) {
} }
}); });
////////////////////////// }}}}} ////////////////////////// }}}}}
// add event when user click on "Go" button // add event when user click on "Go" button
$('buttonGo').addEvent('click', function() { $('buttonGo').addEvent('click', function() {
<?php
if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
?>
$('upload_form_status').set('html', '<div class="upload_progress_bar_outer"><div id="status" class="upload_progress_bar_inner"></div></div>'); // add the progress bar
<?php
}
?>
$('upload_form_form').setStyle("display", "none"); // hide form $('upload_form_form').setStyle("display", "none"); // hide form
$('upload_form_status').setStyle("display", "inline"); // show progress bar $('upload_form_status').setStyle("display", "inline"); // show progress bar
$('upload_form_status_info').setStyle("display", "inline"); // - || - $('upload_form_status_info').setStyle("display", "inline"); // - || -
<?php
if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
?>
$('upload_form_status').set('html', '<div class="upload_progress_bar_outer"><div id="status" class="upload_progress_bar_inner"></div></div>'); // add the progress bar
var finished = false; var finished = false;
var percent = 0.0; var percent = 0.0;
var total = 0; var total = 0;
@@ -111,9 +110,6 @@ if (empty($import_list)) {
if (index=="complete") if (index=="complete")
complete = item; complete = item;
}); // [$each] }); // [$each]
<?php
if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
?>
if (total==0 && complete==0 && percent==0) { if (total==0 && complete==0 && percent==0) {
$('upload_form_status_info').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportLargeFileUploading; ?>'); $('upload_form_status_info').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportLargeFileUploading; ?>');
$('upload_form_status').setStyle("display", "none"); $('upload_form_status').setStyle("display", "none");
@@ -121,6 +117,12 @@ if (empty($import_list)) {
$('upload_form_status_info').set('html', ' '+Math.round(percent)+'%, '+complete+'/'+total); $('upload_form_status_info').set('html', ' '+Math.round(percent)+'%, '+complete+'/'+total);
$('status').tween('width', Math.round(percent)*2+'px'); $('status').tween('width', Math.round(percent)*2+'px');
} //[else] } //[else]
} //[onComplete]
}); // [request]
perform_upload = function () {
request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...)
}
periodical_upload = perform_upload.periodical(1000);
<?php <?php
} else { } else {
?> ?>
@@ -129,13 +131,7 @@ if (empty($import_list)) {
<?php <?php
} //[else] } //[else]
?> ?>
} //[onComplete] }); //if [click]
}); // [request]
perform_upload = function () {
request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...)
}
periodical_upload = perform_upload.periodical(1000);
}); // if [buttonGo]
}); // if [load] }); // if [load]
document.write('<form action="import.php" method="post" enctype="multipart/form-data" name="import" <?php if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") echo 'target="import_upload_iframe"'; ?>>'); document.write('<form action="import.php" method="post" enctype="multipart/form-data" name="import" <?php if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") echo 'target="import_upload_iframe"'; ?>>');
--> -->