finish conversion of Replication feature from Mootools to jQuery
This commit is contained in:
@@ -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 + "<br />log-bin=mysql-bin<br />log-error=mysql-bin.err<br />";
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
@@ -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 .= '<script type="text/javascript">';
|
||||
$out .= "\n" . '// <![CDATA[' . "\n";
|
||||
$out .= 'window.addEvent(\'domready\',function() {';
|
||||
$out .= $code;
|
||||
$out .= '});';
|
||||
$out .= "\n" . '// ]]>' . "\n";
|
||||
$out .= '</script>';
|
||||
|
||||
//if ($print)
|
||||
// echo $out;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function PMA_js($code, $print=true)
|
||||
{
|
||||
// these generated newlines are needed
|
||||
|
@@ -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) {
|
||||
|
@@ -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 . '<br />log-bin=mysql-bin<br />log-error=mysql-bin.err<br />";' . "\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
|
||||
*
|
||||
|
@@ -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 '<fieldset>';
|
||||
echo '<legend>' . $GLOBALS['strReplicationMasterConfiguration'] . '</legend>';
|
||||
echo $GLOBALS['strReplicationMasterChooseMode'] . '<br /><br />';
|
||||
@@ -228,7 +226,7 @@ if (isset($GLOBALS['mr_configure'])) {
|
||||
echo PMA_replication_db_multibox();
|
||||
echo '<br /><br />';
|
||||
echo $GLOBALS['strReplicationAddLines'] . '<br />';
|
||||
echo '<pre id="rep">server-id='. $serverid . '<br />log-bin=mysql-bin<br />log-error=mysql-bin.err<br /></pre>';
|
||||
echo '<pre id="rep"></pre>';
|
||||
echo $GLOBALS['strReplicationRestartServer'];
|
||||
echo '</fieldset>';
|
||||
echo '<fieldset class="tblFooters">';
|
||||
|
Reference in New Issue
Block a user