Backported uploadprogress part of rev 13423 and 13424 to QA_3_3 and MAINT_3_3_0
This commit is contained in:
@@ -18,6 +18,7 @@ if (isset($GLOBALS["message"]) && $GLOBALS["message"]) {
|
|||||||
|
|
||||||
header('Content-type: text/html');
|
header('Content-type: text/html');
|
||||||
|
|
||||||
|
usleep(300000); // wait 0.3 sec before we check for $_SESSION variable, which is set inside import.php
|
||||||
while ($_SESSION['Import_message']['message'] == null) { // wait until message is available
|
while ($_SESSION['Import_message']['message'] == null) { // wait until message is available
|
||||||
usleep(250000); // 0.25 sec
|
usleep(250000); // 0.25 sec
|
||||||
}
|
}
|
||||||
|
@@ -26,41 +26,13 @@ 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"></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;" />
|
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<!--
|
window.addEvent('domready', function() {
|
||||||
// Mootools code for handling Ajax requests
|
|
||||||
window.addEvent('load', function() {
|
|
||||||
// webkit fix from 3rd source, but it does not work sometimes (??) --
|
|
||||||
// toms
|
|
||||||
////////////////////////////// {{{{{
|
|
||||||
Request.HTML.implement({
|
|
||||||
|
|
||||||
processHTML: function(text) {
|
|
||||||
var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
|
|
||||||
text = (match) ? match[1] : text;
|
|
||||||
|
|
||||||
var container = new Element('div');
|
|
||||||
|
|
||||||
return $try(function(){
|
|
||||||
var root = '<root>' + text + '</root>', doc;
|
|
||||||
doc = new DOMParser().parseFromString(root, 'text/html');
|
|
||||||
root = doc.getElementsByTagName('root')[0];
|
|
||||||
for (var i = 0, k = root.childNodes.length; i < k; i++){
|
|
||||||
var child = Element.clone(root.childNodes[i], true, true);
|
|
||||||
if (child) container.grab(child);
|
|
||||||
}
|
|
||||||
return container;
|
|
||||||
}) || container.set('html', text);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
////////////////////////// }}}}}
|
|
||||||
// add event when user click on "Go" button
|
// add event when user click on "Go" button
|
||||||
$('buttonGo').addEvent('click', function() {
|
$('buttonGo').addEvent('click', function() {
|
||||||
$('upload_form_form').setStyle("display", "none"); // hide form
|
$('upload_form_form').setStyle("display", "none"); // hide form
|
||||||
@@ -84,7 +56,7 @@ if (empty($import_list)) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
update: 'upload_form_status',
|
update: 'upload_form_status',
|
||||||
onComplete: function(response) {
|
onComplete: function(response) {
|
||||||
objectsReturned = JSON.decode(response);
|
objectsReturned = JSON.decode(response);
|
||||||
|
|
||||||
$each(objectsReturned, function(item, index) {
|
$each(objectsReturned, function(item, index) {
|
||||||
|
|
||||||
@@ -96,32 +68,29 @@ if (empty($import_list)) {
|
|||||||
$('import_form_status').setStyle('display', 'inline');
|
$('import_form_status').setStyle('display', 'inline');
|
||||||
$('import_form_status').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportProceedingFile; ?> ');
|
$('import_form_status').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportProceedingFile; ?> ');
|
||||||
$('import_form_status').load('import_status.php?message=true&<?php echo PMA_generate_common_url(); ?>'); // loads the message, either success or mysql error
|
$('import_form_status').load('import_status.php?message=true&<?php echo PMA_generate_common_url(); ?>'); // loads the message, either success or mysql error
|
||||||
//]]>
|
|
||||||
<?php
|
<?php
|
||||||
// reload the left sidebar when the import is finished
|
// reload the left sidebar when the import is finished
|
||||||
$GLOBALS['reload']=true;
|
$GLOBALS['reload']=true;
|
||||||
PMA_reloadNavigation(true);
|
PMA_reloadNavigation(true);
|
||||||
?>
|
?>
|
||||||
//<![CDATA[
|
} // if finished==item
|
||||||
} // if [finished==item]
|
} // if index==finished
|
||||||
} // if [index==finished]
|
|
||||||
if (index=="percent")
|
if (index=="percent")
|
||||||
percent = item;
|
percent = item;
|
||||||
|
|
||||||
if (index=="total")
|
if (index=="total")
|
||||||
total = item;
|
total = item;
|
||||||
if (index=="complete")
|
if (index=="complete")
|
||||||
complete = item;
|
complete = item;
|
||||||
}); // [$each]
|
}); // $each
|
||||||
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 PMA_jsFormat($strImportLargeFileUploading); ?>');
|
$('upload_form_status_info').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo PMA_jsFormat($strImportLargeFileUploading); ?>');
|
||||||
$('upload_form_status').setStyle("display", "none");
|
$('upload_form_status').setStyle("display", "none");
|
||||||
} else {
|
} else {
|
||||||
$('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]
|
} // onComplete
|
||||||
}); // [request]
|
}); // [equest
|
||||||
perform_upload = function () {
|
perform_upload = function () {
|
||||||
request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...)
|
request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...)
|
||||||
}
|
}
|
||||||
@@ -129,15 +98,15 @@ if (empty($import_list)) {
|
|||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
$('upload_form_status_info').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportUploadInfoNotAvailable; ?>');
|
$('upload_form_status_info').set('html', '<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" /> <?php echo $strImportUploadInfoNotAvailable . PMA_showDocu('faq2_9'); ?>');
|
||||||
$('upload_form_status').setStyle("display", "none");
|
$('upload_form_status').setStyle("display", "none");
|
||||||
<?php
|
<?php
|
||||||
} //[else]
|
} // else
|
||||||
?>
|
?>
|
||||||
}); //if [click]
|
}); // if click
|
||||||
}); // if [load]
|
}); // domready
|
||||||
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"'; ?>>');
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
Reference in New Issue
Block a user