diff --git a/lang/english-utf-8.inc.php b/lang/english-utf-8.inc.php index d03d061a8..3e4e01f4a 100644 --- a/lang/english-utf-8.inc.php +++ b/lang/english-utf-8.inc.php @@ -1565,4 +1565,8 @@ $strYes = 'Yes'; $strZeroRemovesTheLimit = 'Note: Setting these options to 0 (zero) removes the limit.'; $strZip = '"zipped"'; +$strDatabase_src = 'Source Database'; +$strDatabase_trg = 'Target Database'; +$strRemoteServer = 'Remote Server'; +$strCurrentServer = 'Current Server'; ?> diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 382fd1260..63987661b 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2717,4 +2717,40 @@ function PMA_duplicateFirstNewline($string){ 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) +{ + $out = ''; + $out .= ''."\n"; + + if ($print) + echo $out; + + return $out; +} + +function PMA_js($code, $print=true) +{ + $out = ''; + $out .= ''."\n"; + + if ($print) + echo $out; + + return $out; +} ?> diff --git a/server_synchronize.php b/server_synchronize.php index 6582cbee9..9a86b5ff4 100644 --- a/server_synchronize.php +++ b/server_synchronize.php @@ -16,6 +16,7 @@ require_once './libraries/common.inc.php'; * Does the common work */ $GLOBALS['js_include'][] = 'functions.js'; +$GLOBALS['js_include'][] = 'mootools.js'; require_once './libraries/server_common.inc.php'; /** @@ -41,13 +42,14 @@ if (isset($_REQUEST['token'])) { $_SESSION['token'] = $_REQUEST['token']; } +// variable for code saving +$cons = array ("src", "trg"); /** * Displays the page when 'Go' is pressed */ if ((isset($_REQUEST['submit_connect']))) { - $cons = array ("src", "trg"); foreach ($cons as $con) { ${"{$con}_host"} = $_REQUEST[$con.'_host']; ${"{$con}_username"} = $_REQUEST[$con.'_username']; @@ -55,8 +57,15 @@ if ((isset($_REQUEST['submit_connect']))) { ${"{$con}_port"} = $_REQUEST[$con.'_port']; ${"{$con}_socket"} = $_REQUEST[$con.'_socket']; ${"{$con}_db"} = $_REQUEST[$con.'_db']; + ${"{$con}_type"} = $_REQUEST[$con.'_type']; ${"{$con}_url"} = ''; + if (${"{$con}_type"}=='cur') { + ${"{$con}_connection"} = null; + ${"{$con}_db"} = $_REQUEST[$con.'_db_sel']; + continue; + } + if (isset(${"{$con}_socket"}) && !empty(${"{$con}_socket"})) { ${"{$con}_url"} = ':'.${"{$con}_socket"}; ${"{$con}_server"}['socket'] = ${"{$con}_socket"}; @@ -71,9 +80,8 @@ if ((isset($_REQUEST['submit_connect']))) { ${"{$con}_connection"} = @mysql_connect(${"{$con}_url"}, ${"{$con}_username"}, ${"{$con}_password"}); } - unset ($con, $cons); - if (!($src_connection) || !($trg_connection)) { + if ((!$src_connection && $src_type=='rmt') || (!$trg_connection && $trg_type=='rmt')) { /** * Displays the connection error string if * connections are not established @@ -89,17 +97,19 @@ if ((isset($_REQUEST['submit_connect']))) { echo ''; unset($_REQUEST['submit_connect']); - } else if (($src_connection) && ($trg_connection)) { + } else { /** * Creating the link object for both source and target databases and * selecting the source and target databases using these links */ - $src_link = PMA_DBI_connect($src_username, $src_password, $is_controluser = false, $src_server); - $src_connection = PMA_DBI_select_db($src_db, $src_link); - - $trg_link = PMA_DBI_connect($trg_username, $trg_password, $is_controluser = false, $trg_server); - $trg_connection = PMA_DBI_select_db($trg_db, $trg_link); - + foreach ($cons as $con) { + if (${"{$con}_connection"}!=null) + ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); + else + ${"{$con}_link"} = null; + ${"{$con}_db_selected"} = PMA_DBI_select_db(${"{$con}_db"}, ${"{$con}_link"}); + } + if (($src_db_selected != 1) || ($trg_db_selected != 1)) { /** * Displays error string if the database(s) did not exist @@ -218,6 +228,8 @@ if ((isset($_REQUEST['submit_connect']))) { $_SESSION['trg_password'] = $trg_password; $_SESSION['src_server'] = $src_server; $_SESSION['trg_server'] = $trg_server; + $_SESSION['src_type'] = $src_type; + $_SESSION['trg_type'] = $trg_type; $_SESSION['matching_tables_keys'] = $matching_tables_keys; $_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields; $_SESSION['uncommon_tables_row_count'] = $row_count; @@ -510,6 +522,8 @@ if (isset($_REQUEST['Table_ids'])) { $trg_password = $_SESSION['trg_password']; $src_server = $_SESSION['src_server']; $trg_server = $_SESSION['trg_server']; + $src_type = $_SESSION['src_type']; + $trg_type = $_SESSION['trg_type']; $uncommon_tables = $_SESSION['uncommon_tables']; $matching_tables = $_SESSION['matching_tables']; $matching_tables_keys = $_SESSION['matching_tables_keys']; @@ -537,8 +551,12 @@ if (isset($_REQUEST['Table_ids'])) { /** * Creating link object for source and target databases */ - $src_link = PMA_DBI_connect($src_username, $src_password, $is_controluser = false, $src_server); - $trg_link = PMA_DBI_connect($trg_username, $trg_password, $is_controluser = false, $trg_server); + foreach ($cons as $con) { + if (${"{$con}_type"}=="rmt") + ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); + else + ${"{$con}_link"} = null; + } /** * Initializing arrays to save the table ids whose data and structure difference is to be applied @@ -1197,72 +1215,86 @@ if (isset($_REQUEST['synchronize_db'])) { >' // TODO: add check if all var. are filled in . PMA_generate_common_hidden_inputs('', ''); echo '
'."\n"; - echo 'Synchronization'."\n"; + echo ''. $GLOBALS['strSynchronize']. ''."\n"; /** - * Displays the form for source server + * Displays the forms */ - echo ' - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source Database
'. $GLOBALS['strHost']. '
'. $GLOBALS['strPort']. '
'. $GLOBALS['strSocket']. '
'. $GLOBALS['strUserName']. '
'. $GLOBALS['strPassword']. '
'. $GLOBALS['strDatabase']. '
'; + + $databases = PMA_DBI_get_databases_full(null, false, null, $sort_by, + 'SCHEMA_NAME', 0, true); + + foreach ($cons as $type) { + echo ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'. $GLOBALS['strDatabase_'.$type] .'
+ +
'. $GLOBALS['strHost']. '
'. $GLOBALS['strPort']. '
'. $GLOBALS['strSocket']. '
'. $GLOBALS['strUserName']. '
'. $GLOBALS['strPassword']. '
'. $GLOBALS['strDatabase']. '
'; + + + PMA_js(''. + '$(\''.$type.'_type\').addEvent(\'change\',function() {'."\n". + ' if ($(\''.$type.'tr1\').getStyle(\'display\')=="none") {'."\n". + ' for (var i=1; i<7; i++)'."\n". + ' $(\''.$type.'tr\'+i).tween(\'display\', \'table-row\');'."\n". + ' $(\''.$type.'tr7\').tween(\'display\', \'none\');'."\n". + ' }'."\n". + ' else {'."\n". + ' for (var i=1; i<7; i++)'."\n". + ' $(\''.$type.'tr\'+i).tween(\'display\', \'none\');'."\n". + ' $(\''.$type.'tr7\').tween(\'display\', \'table-row\');'."\n". + ' }'."\n". + '});'."\n" + ); + } + unset ($types, $type); - /** - * Displays the form for target server - */ - echo ' - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Target Database
'. $GLOBALS['strHost']. '
'. $GLOBALS['strPort']. '
'. $GLOBALS['strSocket']. '
'. $GLOBALS['strUserName']. '
'. $GLOBALS['strPassword']. '
'. $GLOBALS['strDatabase']. '
+ echo '
diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index c88e0d60f..8a02cb391 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -894,7 +894,8 @@ div#serverstatus table caption a.top { } div#serverstatus div#serverstatusqueriesdetails table, -div#serverstatus table#serverstatustraffic, +div#serverstatus table#serverstatustraffic_src, +div#serverstatus table#serverstatustraffic_trg, div#serverstatus table#serverstatusconnections { float: ; } @@ -1243,3 +1244,10 @@ div.upload_progress_bar_inner height: 12px; margin: 1px; } + +table#serverconnection_src_remote, +table#serverconnection_trg_remote, +table#serverconnection_src_local, +table#serverconnection_trg_local { + float:left; +} diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 0cb100869..467219af4 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -1194,4 +1194,11 @@ div.upload_progress_bar_inner width: 0px; height: 12px; margin: 1px; -} \ No newline at end of file +} + +table#serverconnection_src_remote, +table#serverconnection_trg_remote, +table#serverconnection_src_local, +table#serverconnection_trg_local { + float:left; +}