Code style improvements, fixed JS errors, fixd HTML validity issues

This commit is contained in:
Herman van Rink
2009-09-13 13:10:21 +00:00
parent 818a664b3d
commit 35ee91c422
3 changed files with 27 additions and 17 deletions

View File

@@ -235,10 +235,10 @@ function PMA_replication_master_replicated_dbs($link = null)
$ignore_db = array(); $ignore_db = array();
if (!empty($data[0]['Binlog_Do_DB'])) { if (!empty($data[0]['Binlog_Do_DB'])) {
$do_db = explode($data[0]['Binlog_Do_DB'], ','); $do_db = explode(',', $data[0]['Binlog_Do_DB']);
} }
if (!empty($data[0]['Binlog_Ignore_DB'])) { if (!empty($data[0]['Binlog_Ignore_DB'])) {
$ignore_db = explode($data[0]['Binlog_Ignore_DB'], ','); $ignore_db = explode(',', $data[0]['Binlog_Ignore_DB']);
} }
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link); $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link);
@@ -330,6 +330,7 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
{ {
PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_link, $j, $row_count); PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_link, $j, $row_count);
} }
/** /**
* INTEGRATION OF STRUCTURE DIFFERENCE CODE * INTEGRATION OF STRUCTURE DIFFERENCE CODE
* *

View File

@@ -25,9 +25,9 @@ $jscode['configure_master'] =
'});'."\n". '});'."\n".
'$(\'db_type\').addEvent(\'change\',function() {'."\n". '$(\'db_type\').addEvent(\'change\',function() {'."\n".
' if ($(\'db_type\').getSelected().get(\'value\')=="all")'."\n". ' if ($(\'db_type\').getSelected().get(\'value\')=="all")'."\n".
' $(\'rep\').set(\'html\', c_text+c_ignore+c_output+\';\');'."\n". ' $(\'rep\').set(\'html\', c_text+c_ignore+c_output);'."\n".
' else'."\n". ' else'."\n".
' $(\'rep\').set(\'html\', c_text+c_do+c_output+\';\');'."\n". ' $(\'rep\').set(\'html\', c_text+c_do+c_output);'."\n".
'});'."\n". '});'."\n".
'$(\'db_select\').addEvent(\'change\',function() {'."\n". '$(\'db_select\').addEvent(\'change\',function() {'."\n".
@@ -104,20 +104,20 @@ function PMA_replication_gui_changemaster($submitname) {
echo $GLOBALS['strSlaveConfigure'].'<br />'."\n"; echo $GLOBALS['strSlaveConfigure'].'<br />'."\n";
echo '<pre>server-id='.time().'</pre>'."\n"; echo '<pre>server-id='.time().'</pre>'."\n";
echo ' <div class="item">'."\n"; echo ' <div class="item">'."\n";
echo ' <label for="select_pred_username">'. $GLOBALS['strUserName'].':</label>'."\n"; echo ' <label for="text_username">'. $GLOBALS['strUserName'].':</label>'."\n";
echo ' <input type="text" name="username" maxlength="'. $username_length .'" title="'. $GLOBALS['strUserName'] .'" onchange="pred_username.value = \'userdefined\';" />'."\n"; echo ' <input type="text" name="username" id="text_username" maxlength="'. $username_length .'" title="'. $GLOBALS['strUserName'] .'" />'."\n";
echo ' </div>'."\n"; echo ' </div>'."\n";
echo ' <div class="item">'."\n"; echo ' <div class="item">'."\n";
echo ' <label for="select_pred_password">'. $GLOBALS['strPassword'] .' :</label>'."\n"; echo ' <label for="text_pma_pw">'. $GLOBALS['strPassword'] .' :</label>'."\n";
echo ' <input type="password" id="text_pma_pw" name="pma_pw" title="'. $GLOBALS['strPassword'] .'" onchange="pred_password.value = \'userdefined\';" />'."\n"; echo ' <input type="password" id="text_pma_pw" name="pma_pw" title="'. $GLOBALS['strPassword'] .'" />'."\n";
echo ' </div>'."\n"; echo ' </div>'."\n";
echo ' <div class="item">'."\n"; echo ' <div class="item">'."\n";
echo ' <label for="select_pred_hostname">'.$GLOBALS['strHost'].' :</label>'."\n"; echo ' <label for="text_hostname">'.$GLOBALS['strHost'].' :</label>'."\n";
echo ' <input type="text" name="hostname" maxlength="'. $hostname_length .'" value="" />'."\n"; echo ' <input type="text" id="text_hostname" name="hostname" maxlength="'. $hostname_length .'" value="" />'."\n";
echo ' </div>'."\n"; echo ' </div>'."\n";
echo ' <div class="item">'."\n"; echo ' <div class="item">'."\n";
echo ' <label for="select_pred_hostname">'.$GLOBALS['strPort'].':</label>'."\n"; echo ' <label for="text_port">'.$GLOBALS['strPort'].':</label>'."\n";
echo ' <input type="text" name="port" maxlength="6" value="3306" />'."\n"; echo ' <input type="text" id="text_port" name="port" maxlength="6" value="3306" />'."\n";
echo ' </div>'."\n"; echo ' </div>'."\n";
echo ' </fieldset>'."\n"; echo ' </fieldset>'."\n";
echo ' <fieldset id="fieldset_user_privtable_footer" class="tblFooters">'."\n"; echo ' <fieldset id="fieldset_user_privtable_footer" class="tblFooters">'."\n";

View File

@@ -108,6 +108,8 @@ if (isset($GLOBALS['sr_take_action'])) {
PMA_replication_slave_control("START"); PMA_replication_slave_control("START");
} elseif (isset($GLOBALS['sl_sync'])) { } elseif (isset($GLOBALS['sl_sync'])) {
// TODO username, host and port could be read from 'show slave status',
// when asked for a password this might work in more situations the just after changing master (where the master password is stored in session)
$src_link = PMA_replication_connect_to_master($_SESSION['replication']['m_username'], $_SESSION['replication']['m_password'], $_SESSION['replication']['m_hostname'], $_SESSION['replication']['m_port']); $src_link = PMA_replication_connect_to_master($_SESSION['replication']['m_username'], $_SESSION['replication']['m_password'], $_SESSION['replication']['m_hostname'], $_SESSION['replication']['m_port']);
$trg_link = null; // using null to indicate the current PMA server $trg_link = null; // using null to indicate the current PMA server
@@ -115,12 +117,13 @@ if (isset($GLOBALS['sr_take_action'])) {
$do_db = array(); $do_db = array();
$ignore_db = array(); $ignore_db = array();
$dblist = array();
if (!empty($data[0]['Binlog_Do_DB'])) { if (!empty($data[0]['Binlog_Do_DB'])) {
$do_db = explode($data[0]['Binlog_Do_DB'], ','); $do_db = explode(',', $data[0]['Binlog_Do_DB']);
} }
if (!empty($data[0]['Binlog_Ignore_DB'])) { if (!empty($data[0]['Binlog_Ignore_DB'])) {
$ignore_db = explode($data[0]['Binlog_Ignore_DB'], ','); $ignore_db = explode(',', $data[0]['Binlog_Ignore_DB']);
} }
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $src_link); $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $src_link);
@@ -143,15 +146,19 @@ if (isset($GLOBALS['sr_take_action'])) {
} }
} // end while } // end while
unset($do_db, $ignore_db, $data);
if (isset($GLOBALS['repl_data'])) { if (isset($GLOBALS['repl_data'])) {
$data = true; $include_data = true;
} else { } else {
$data = false; $include_data = false;
} }
foreach ($dblist as $db) { foreach ($dblist as $db) {
PMA_replication_synchronize_db($db, $src_link, $trg_link, $data); PMA_replication_synchronize_db($db, $src_link, $trg_link, $include_data);
} }
// TODO some form of user feedback error/success would be nice // TODO some form of user feedback error/success would be nice
// What happens if $dblist is empty?
// or sync failed?
} }
if ($refresh) { if ($refresh) {
@@ -367,6 +374,7 @@ if ($server_master_status) {
} }
if (isset($GLOBALS['mr_configure'])) { if (isset($GLOBALS['mr_configure'])) {
// Render the 'Master configuration' section
echo PMA_js_mootools_domready($jscode['configure_master']); echo PMA_js_mootools_domready($jscode['configure_master']);
echo '<fieldset>'."\n"; echo '<fieldset>'."\n";
echo '<legend>'. $GLOBALS['strReplicationMasterConfiguration'] .'</legend>'."\n"; echo '<legend>'. $GLOBALS['strReplicationMasterConfiguration'] .'</legend>'."\n";
@@ -398,6 +406,7 @@ if (isset($GLOBALS['mr_configure'])) {
echo '</div>'; echo '</div>';
if (!isset($GLOBALS['repl_clear_scr'])) { if (!isset($GLOBALS['repl_clear_scr'])) {
// Render the 'Slave configuration' section
echo '<fieldset>'."\n"; echo '<fieldset>'."\n";
echo '<legend>' . $GLOBALS['strReplicationSlave'] . '</legend>'."\n"; echo '<legend>' . $GLOBALS['strReplicationSlave'] . '</legend>'."\n";
if ($server_slave_status) { if ($server_slave_status) {