The branch, master has been updated
via 6b5f3b996201be64d344eded98db712aefa53417 (commit)
from 360101dbfb809d2ecd080a836e91f9d2d3a33ea3 (commit)
- Log -----------------------------------------------------------------
commit 6b5f3b996201be64d344eded98db712aefa53417
Author: Marc Delisle <marc(a)infomarc.info>
Date: Mon Apr 5 09:09:35 2010 -0400
finish conversion of Replication feature from Mootools to jQuery
-----------------------------------------------------------------------
Summary of changes:
js/replication.js | 27 ++++++++++++++++++++++++
libraries/common.lib.php | 26 -----------------------
libraries/replication.inc.php | 2 -
libraries/replication_gui.lib.php | 41 -------------------------------------
server_replication.php | 4 +--
5 files changed, 28 insertions(+), 72 deletions(-)
diff --git a/js/replication.js b/js/replication.js
index 0912125..c3e77e8 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 + "<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);
+ });
});
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 3e8a180..d99793a 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 .= '<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
diff --git a/libraries/replication.inc.php b/libraries/replication.inc.php
index 0504428..f2681a6 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 9a015ff..2f508ff 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 . '<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
*
diff --git a/server_replication.php b/server_replication.php
index ddf681f..285bca7 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 '<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">';
hooks/post-receive
--
phpMyAdmin