diff --git a/js/replication.js b/js/replication.js index 091212570..c3e77e83f 100644 --- a/js/replication.js +++ b/js/replication.js @@ -4,6 +4,30 @@ * */ $(document).ready(function() { + var conf_database_list = ""; + var random_server_id = Math.floor(Math.random() * 10000000); + var conf_prefix = "server-id=" + random_server_id + "
log-bin=mysql-bin
log-error=mysql-bin.err
"; + var conf_ignore = "binlog_ignore_db="; + var conf_do = "binlog_do_db="; + $('#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); + }); + $('#master_status_href').click(function() { $('#replication_master_section').toggle(); }); @@ -22,4 +46,7 @@ $(document).ready(function() { $('#slave_synchronization_href').click(function() { $('#slave_synchronization_gui').toggle(); }); + $('#db_reset_href').click(function() { + $('#db_select option:selected').attr('selected', false); + }); }); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 3e8a180f7..d99793a51 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2730,32 +2730,6 @@ function PMA_getTitleForTarget($target) { return $GLOBALS[$GLOBALS['cfg']['DefaultTabTranslationMapping'][$target]]; } -/** - * The function creates javascript and html code, which run given mootools/JS code when DOM is ready - * - * @param String $code - Mootools/JS code, which will be run - * @param boolena $print - If true, then the code is printed, otherwise is returned - * - * @return String - the code - */ -function PMA_js_mootools_domready($code, $print=true) -{ - // these generated newlines are needed - $out = ''; - $out .= ''; - - //if ($print) - // echo $out; - - return $out; -} - function PMA_js($code, $print=true) { // these generated newlines are needed diff --git a/libraries/replication.inc.php b/libraries/replication.inc.php index 05044285d..f2681a668 100644 --- a/libraries/replication.inc.php +++ b/libraries/replication.inc.php @@ -90,8 +90,6 @@ $slave_variables_oks = array( 'Slave_SQL_Running' => 'Yes', ); -$serverid = time(); - // check which replication is available and set $server_{master/slave}_status and assign values foreach ($replication_types as $type) { if (count(${"server_{$type}_replication"}) > 0) { diff --git a/libraries/replication_gui.lib.php b/libraries/replication_gui.lib.php index 9a015ff56..2f508ff79 100644 --- a/libraries/replication_gui.lib.php +++ b/libraries/replication_gui.lib.php @@ -9,47 +9,6 @@ if (! defined('PHPMYADMIN')) { exit; } -// Add JS events to generate example my.cnf config lines -$jscode['configure_master'] = - 'var c_output = "";' . "\n" . - 'var c_text = "server-id=' . $serverid . '
log-bin=mysql-bin
log-error=mysql-bin.err
";' . "\n" . - 'var c_ignore = "binlog_ignore_db=";' . "\n" . - 'var c_do = "binlog_do_db=";' . "\n" . - - '$(\'db_reset_href\').addEvent(\'click\', function() {' . "\n" . - ' $(\'db_select\').getSelected().each(function(el) {' . "\n" . - ' el.selected = false;' . "\n" . - ' });' . "\n" . - ' $(\'rep\').set(\'html\', c_text);' . "\n" . - '});' . "\n" . - '$(\'db_type\').addEvent(\'change\',function() {' . "\n" . - ' if ($(\'db_type\').getSelected().get(\'value\')=="all")' . "\n" . - ' $(\'rep\').set(\'html\', c_text+c_ignore+c_output);' . "\n" . - ' else' . "\n" . - ' $(\'rep\').set(\'html\', c_text+c_do+c_output);' . "\n" . - '});' . "\n" . - - '$(\'db_select\').addEvent(\'change\',function() {' . "\n" . - ' var count = 0;' . "\n" . - - ' $(\'db_select\').getSelected().each(function(el) { ' . "\n" . - ' if (count==0)' . "\n" . - ' c_output = el.get(\'value\');' . "\n" . - ' else' . "\n" . - ' c_output = c_output + \',\' +el.get(\'value\');' . "\n" . - - ' count=count+1;' . "\n" . - - ' if ($(\'db_select\').getSelected().length==count) {' . "\n" . - ' if ($(\'db_type\').getSelected().get(\'value\')=="all")' . "\n" . - ' $(\'rep\').set(\'html\', c_text+c_ignore+c_output);' . "\n" . - ' else' . "\n" . - ' $(\'rep\').set(\'html\', c_text+c_do+c_output);' . "\n" . - ' count = 0;' . "\n" . - ' }' . "\n" . - ' });' . "\n" . - '});' . "\n"; - /** * returns code for selecting databases * diff --git a/server_replication.php b/server_replication.php index ddf681f26..285bca7d6 100644 --- a/server_replication.php +++ b/server_replication.php @@ -16,7 +16,6 @@ require_once './libraries/common.inc.php'; */ $GLOBALS['js_include'][] = 'server_privileges.js'; $GLOBALS['js_include'][] = 'functions.js'; -$GLOBALS['js_include'][] = 'mootools-more.js'; $GLOBALS['js_include'][] = 'replication.js'; require './libraries/server_common.inc.php'; @@ -214,7 +213,6 @@ if ($server_master_status) { if (isset($GLOBALS['mr_configure'])) { // Render the 'Master configuration' section - echo PMA_js_mootools_domready($jscode['configure_master']); echo '
'; echo '' . $GLOBALS['strReplicationMasterConfiguration'] . ''; echo $GLOBALS['strReplicationMasterChooseMode'] . '

'; @@ -228,7 +226,7 @@ if (isset($GLOBALS['mr_configure'])) { echo PMA_replication_db_multibox(); echo '

'; echo $GLOBALS['strReplicationAddLines'] . '
'; - echo '
server-id='. $serverid . '
log-bin=mysql-bin
log-error=mysql-bin.err
'; + echo '
';
     echo $GLOBALS['strReplicationRestartServer'];
     echo '
'; echo '
';