The branch, master has been updated via 2142f5f70be44da2a169da402bf262ad654b8212 (commit) via ab325e609a6c2845329ebe5cf18b88821648811c (commit) from ea8cc56becd008beb4cb9c5e7a4eb39195c2128a (commit)
- Log ----------------------------------------------------------------- commit 2142f5f70be44da2a169da402bf262ad654b8212 Author: Michal Čihař mcihar@novell.com Date: Fri Apr 9 16:09:29 2010 +0200
Rewrite generating master configuration.
- Avoid code duplication. - Fix case when user unselected all databases.
commit ab325e609a6c2845329ebe5cf18b88821648811c Author: Michal Čihař mcihar@novell.com Date: Fri Apr 9 15:39:56 2010 +0200
Whitespace cleanup.
-----------------------------------------------------------------------
Summary of changes: js/replication.js | 43 +++++++++++++++++++------------------ libraries/display_import.lib.php | 30 +++++++++++++------------- 2 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/js/replication.js b/js/replication.js index c3e77e8..1a7c785 100644 --- a/js/replication.js +++ b/js/replication.js @@ -3,30 +3,31 @@ * for server_replication.php * */ -$(document).ready(function() { - var conf_database_list = ""; - var random_server_id = Math.floor(Math.random() * 10000000); - var conf_prefix = "server-id=" + random_server_id + "<br />log-bin=mysql-bin<br />log-error=mysql-bin.err<br />"; + +var random_server_id = Math.floor(Math.random() * 10000000); +var conf_prefix = "server-id=" + random_server_id + "<br />log-bin=mysql-bin<br />log-error=mysql-bin.err<br />"; + +function update_config() { var conf_ignore = "binlog_ignore_db="; var conf_do = "binlog_do_db="; + var database_list = $('#db_select option:selected:first').val(); + $('#db_select option:selected:not(:first)').each(function() { + database_list += ',' + $(this).val(); + }); + + if ($('#db_select option:selected').size() == 0) { + $('#rep').html(conf_prefix); + } else if ($('#db_type option:selected').val() == 'all') { + $('#rep').html(conf_prefix + conf_ignore + database_list); + } else { + $('#rep').html(conf_prefix + conf_do + database_list); + } +} + +$(document).ready(function() { $('#rep').html(conf_prefix); - $('#db_type').change(function() { - if ($('#db_type option:selected').val() == 'all') - $('#rep').html(conf_prefix + conf_ignore + conf_database_list); - else - $('#rep').html(conf_prefix + conf_do + conf_database_list); - }); - $('#db_select').change(function() { - conf_database_list = $('#db_select option:selected:first').val(); - $('#db_select option:selected:not(:first)').each(function() { - conf_database_list += ',' + $(this).val(); - }); - // todo: avoid repeating these 5 lines: - if ($('#db_type option:selected').val() == 'all') - $('#rep').html(conf_prefix + conf_ignore + conf_database_list); - else - $('#rep').html(conf_prefix + conf_do + conf_database_list); - }); + $('#db_type').change(update_config); + $('#db_select').change(update_config);
$('#master_status_href').click(function() { $('#replication_master_section').toggle(); diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index b99a8e2..a1989cb 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -29,7 +29,7 @@ if (empty($import_list)) { <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="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"> //<![CDATA[ window.addEvent('domready', function() { @@ -42,12 +42,12 @@ window.addEvent('domready', function() { 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 percent = 0.0; var total = 0; var complete = 0; - + var perform_upload; var periodical_upload;
@@ -57,9 +57,9 @@ window.addEvent('domready', function() { update: 'upload_form_status', onComplete: function(response) { objectsReturned = JSON.decode(response); - + $each(objectsReturned, function(item, index) { - + if (index=="finished") { finished = item; if (finished==true) { @@ -68,19 +68,19 @@ window.addEvent('domready', function() { $('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').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 - $GLOBALS['reload']=true; - PMA_reloadNavigation(true); + $GLOBALS['reload']=true; + PMA_reloadNavigation(true); ?> } // if finished==item - } // if index==finished + } // if index==finished if (index=="percent") percent = item; if (index=="total") total = item; if (index=="complete") - complete = item; + complete = item; }); // $each 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); ?>'); @@ -91,8 +91,8 @@ window.addEvent('domready', function() { } // else } // onComplete }); // [equest - perform_upload = function () { - request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...) + 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 @@ -101,8 +101,8 @@ window.addEvent('domready', function() { $('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"); <?php - } // else - ?> + } // else + ?> }); // if click }); // domready
@@ -112,7 +112,7 @@ window.addEvent('domready', function() { <noscript> <form action="import.php" method="post" enctype="multipart/form-data" name="import"> </noscript> -<input type="hidden" name="<?php echo $ID_KEY; ?>" value="<?php echo $upload_id ; ?>" /> +<input type="hidden" name="<?php echo $ID_KEY; ?>" value="<?php echo $upload_id ; ?>" /> <?php if ($import_type == 'server') { echo PMA_generate_common_hidden_inputs('', '', 1);
hooks/post-receive