Import progress bar fix from GIT

This commit is contained in:
Tomas Srnka
2010-03-02 09:28:56 +00:00
parent 4cfa667b97
commit 9e8618c4f9
5 changed files with 19 additions and 49 deletions

View File

@@ -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
} }

View File

@@ -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" src="import.php?<?php echo PMA_generate_common_url(); ?>"></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
@@ -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...)
} }
@@ -132,12 +101,12 @@ if (empty($import_list)) {
$('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; ?>');
$('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>

View File

@@ -1334,7 +1334,7 @@ function PMA_displayQuery($query) {
function PMA_syncDisplayHeaderSource($src_db) { function PMA_syncDisplayHeaderSource($src_db) {
echo '<div id="serverstatus" style = "overflow: auto; width: 1020px; height: 220px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding:0px; margin-bottom: 1em "> '; echo '<div id="serverstatus" style = "overflow: auto; width: 1020px; height: 220px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding:0px; margin-bottom: 1em "> ';
echo '<table id="serverstatustraffic" class="data" width="55%">'; echo '<table id="serverstatusconnections" class="data" width="55%">';
echo '<tr>'; echo '<tr>';
echo '<th>' . $GLOBALS['strDatabase_src'] . ': ' . $src_db . '<br />('; echo '<th>' . $GLOBALS['strDatabase_src'] . ': ' . $src_db . '<br />(';
if ('cur' == $_SESSION['src_type']) { if ('cur' == $_SESSION['src_type']) {

View File

@@ -255,7 +255,7 @@ if ((isset($_REQUEST['submit_connect']))) {
*/ */
echo '<form name="synchronize_form" id="synchronize_form" method="post" action="server_synchronize.php">' echo '<form name="synchronize_form" id="synchronize_form" method="post" action="server_synchronize.php">'
. PMA_generate_common_hidden_inputs('', ''); . PMA_generate_common_hidden_inputs('', '');
echo '<table class="data" width = "50%"> echo '<table id="serverstatustraffic" class="data" width = "60%">
<tr> <tr>
<td> <h2>' <td> <h2>'
. ($GLOBALS['cfg']['MainPageIconic'] . ($GLOBALS['cfg']['MainPageIconic']
@@ -455,7 +455,7 @@ if ((isset($_REQUEST['submit_connect']))) {
* This fieldset displays the checkbox to confirm deletion of previous rows from target tables * This fieldset displays the checkbox to confirm deletion of previous rows from target tables
*/ */
echo '<fieldset> echo '<fieldset>
<p><input type= "checkbox" name="delete_rows" id ="delete_rows" />' . $strTableDeleteRows . ' </p> <p><input type= "checkbox" name="delete_rows" id ="delete_rows" /><label for="delete_rows">' . $strTableDeleteRows . '</label> </p>
</fieldset> </fieldset>
<fieldset class="tblFooters">'; <fieldset class="tblFooters">';
echo '<input type="button" name="apply_changes" value="' . $GLOBALS['strApplyChanges'] echo '<input type="button" name="apply_changes" value="' . $GLOBALS['strApplyChanges']
@@ -899,7 +899,7 @@ if (isset($_REQUEST['Table_ids'])) {
* This fieldset displays the checkbox to confirm deletion of previous rows from target tables * This fieldset displays the checkbox to confirm deletion of previous rows from target tables
*/ */
echo '<fieldset> echo '<fieldset>
<p><input type= "checkbox" name="delete_rows" id ="delete_rows" />' . $strTableDeleteRows . ' </p> <p><input type="checkbox" name="delete_rows" id ="delete_rows" /><label for="delete_rows">' . $strTableDeleteRows . '</label> </p>
</fieldset>'; </fieldset>';
echo '<fieldset class="tblFooters">'; echo '<fieldset class="tblFooters">';

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB