make use of new third 'class' parameter for PMA_showMessage()

This commit is contained in:
Sebastian Mendel
2007-10-09 12:16:10 +00:00
parent 534ac6fe1d
commit ec7a30f4fd
11 changed files with 48 additions and 36 deletions

View File

@@ -30,8 +30,11 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$move = false;
}
$_msg_type = 'success';
if (!isset($newname) || !strlen($newname)) {
$message = $strDatabaseEmpty;
$_message = $strDatabaseEmpty;
$_msg_type = 'error';
} else {
$sql_query = ''; // in case target db exists
if ($move ||
@@ -85,9 +88,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
// value of $what for this table only
$this_what = $what;
if (!isset($tables_full[$each_table]['Engine'])) {
$tables_full[$each_table]['Engine'] = $tables_full[$each_table]['Type'];
}
// do not copy the data from a Merge table
// note: on the calling FORM, 'data' means 'structure and data'
if ($tables_full[$each_table]['Engine'] == 'MRG_MyISAM') {
@@ -107,7 +107,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
unset($GLOBALS['sql_constraints_query']);
}
}
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
} // end (foreach)
unset($each_table);
@@ -154,10 +154,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$sql_query .= "\n" . $local_query;
PMA_DBI_query($local_query);
}
$message = sprintf($strRenameDatabaseOK, htmlspecialchars($db),
$_message = sprintf($strRenameDatabaseOK, htmlspecialchars($db),
htmlspecialchars($newname));
} else {
$message = sprintf($strCopyDatabaseOK, htmlspecialchars($db),
$_message = sprintf($strCopyDatabaseOK, htmlspecialchars($db),
htmlspecialchars($newname));
}
$reload = true;
@@ -202,6 +202,11 @@ if (empty($is_info)) {
$sub_part = '_structure';
require './libraries/db_info.inc.php';
echo "\n";
if (iseet($_message)) {
PMA_showMessage($_message, $sql_query, $_msg_type);
unset($_message, $_msg_type);
}
}
$db_collation = PMA_getDbCollation($db);

View File

@@ -50,8 +50,8 @@ if (!empty($sql_query)) {
// upload limit has been reached, let's assume the second possibility.
if ($_POST == array() && $_GET == array()) {
require_once './libraries/header.inc.php';
$show_error_header = TRUE;
PMA_showMessage(sprintf($strUploadLimit, '[a@./Documentation.html#faq1_16@_blank]', '[/a]'));
PMA_showMessage(sprintf($strUploadLimit, '[a@./Documentation.html#faq1_16@_blank]', '[/a]'),
null, 'error');
require './libraries/footer.inc.php';
}

View File

@@ -35,9 +35,7 @@ $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $exp
/* Fail if we didn't find any plugin */
if (empty($export_list)) {
$GLOBALS['show_error_header'] = TRUE;
PMA_showMessage($strCanNotLoadExportPlugins);
unset($GLOBALS['show_error_header']);
PMA_showMessage($strCanNotLoadExportPlugins, null, 'error');
require './libraries/footer.inc.php';
}
?>

View File

@@ -16,9 +16,7 @@ $import_list = PMA_getPlugins('./libraries/import/', $import_type);
/* Fail if we didn't find any plugin */
if (empty($import_list)) {
$GLOBALS['show_error_header'] = TRUE;
PMA_showMessage($strCanNotLoadImportPlugins);
unset($GLOBALS['show_error_header']);
PMA_showMessage($strCanNotLoadImportPlugins, null, 'error');
require './libraries/footer.inc.php';
}
?>

View File

@@ -1868,7 +1868,13 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
$last_shown_rec = ($_SESSION['userconf']['max_rows'] == 'all' || $pos_next > $total)
? $total - 1
: $pos_next - 1;
PMA_showMessage($GLOBALS['strShowingRecords'] . ' ' . $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec . ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')');
PMA_showMessage($GLOBALS['strShowingRecords'] . ' '
. $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec
. ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count
. ' ' . $GLOBALS['strTotal'] . $selectstring . ', '
. sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')',
$sql_query,
'success');
if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) {
echo '<div class="notice">' . "\n";
@@ -1876,7 +1882,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
echo '</div>' . "\n";
}
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
PMA_showMessage($GLOBALS['strSQLQuery']);
PMA_showMessage($GLOBALS['strSuccess'], $sql_query, 'success');
}
// 2.3 Displays the navigation bars

View File

@@ -144,7 +144,7 @@ if (count($binary_logs) > 1) {
echo '</form>';
}
PMA_showMessage($GLOBALS['strSuccess']);
PMA_showMessage($GLOBALS['strSuccess'], null, 'success');
/**
* Displays the page

View File

@@ -49,7 +49,7 @@ echo '<h2>' . "\n"
$sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST';
$result = PMA_DBI_query($sql_query);
PMA_showMessage($GLOBALS['strSuccess']);
PMA_showMessage($GLOBALS['strSuccess'], null, 'success');
/**

View File

@@ -572,10 +572,7 @@ else {
// Display previous update query (from tbl_replace)
if (isset($disp_query) && $cfg['ShowSQL'] == true) {
$tmp_sql_query = $GLOBALS['sql_query'];
$GLOBALS['sql_query'] = $disp_query;
PMA_showMessage($disp_message);
$GLOBALS['sql_query'] = $tmp_sql_query;
PMA_showMessage($disp_message, $disp_query, 'success');
}
if (isset($profiling_results)) {

View File

@@ -43,23 +43,23 @@ PMA_DBI_select_db($GLOBALS['db']);
require './libraries/tbl_info.inc.php';
$reread_info = false;
$errors = array();
$table_alters = array();
/**
* Updates table comment, type and options if required
*/
if (isset($_REQUEST['submitoptions'])) {
$message = '';
$_message = '';
if (isset($_REQUEST['new_name'])) {
if ($pma_table->rename($_REQUEST['new_name'])) {
$message .= $pma_table->getLastMessage();
$GLOBALS['table'] = $pma_table->getName();;
$_message .= $pma_table->getLastMessage();
$result = true;
$GLOBALS['table'] = $pma_table->getName();
$reread_info = true;
$reload = true;
} else {
$errors[] = $pma_table->getLastError();
$message .= $pma_table->getLastError();
$_message .= $pma_table->getLastError();
$result = false;
}
}
if (isset($_REQUEST['comment'])
@@ -108,7 +108,7 @@ if (isset($_REQUEST['submitoptions'])) {
if (count($table_alters) > 0) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
$sql_query .= "\r\n" . implode("\r\n", $table_alters);
$message .= PMA_DBI_query($sql_query) ? $strSuccess : $strError;
$result .= PMA_DBI_query($sql_query) ? true : false;
$reread_info = true;
unset($table_alters);
}
@@ -123,7 +123,7 @@ if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
$sql_query .= ' DESC';
}
$message = PMA_DBI_query($sql_query) ? $strSuccess : $strError;
$result = PMA_DBI_query($sql_query);
} // end if
@@ -138,6 +138,14 @@ unset($reread_info);
*/
require_once './libraries/tbl_links.inc.php';
if (isset($result)) {
if (empty($_message)) {
$_message = $result ? $strSuccess : $strError;
$_type = $result ? 'success' : 'error';
}
PMA_showMessage($_message, $sql_query, $_type);
}
$url_params['goto'] = 'tbl_operations.php';
$url_params['back'] = 'tbl_operations.php';
@@ -501,7 +509,7 @@ if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
?>
</ul>
<?php
} // end if ($result)
} // end if ($foreign)
} // end if (!empty($cfg['Server']['relation']))

View File

@@ -229,9 +229,9 @@ if (isset($_REQUEST['destination_innodb'])) {
} // end foreach
if (!empty($display_query)) {
if ($seen_error) {
PMA_showMessage($strError);
PMA_showMessage($strError, null, 'error');
} else {
PMA_showMessage($strSuccess);
PMA_showMessage($strSuccess, null, 'success');
}
}
} // end if isset($destination_innodb)

View File

@@ -108,7 +108,7 @@ if (isset($_REQUEST['nopass'])) {
// Displays the page
require_once './libraries/header.inc.php';
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
PMA_showMessage($strUpdateProfileMessage, $sql_query);
PMA_showMessage($strUpdateProfileMessage, $sql_query, 'success');
?>
<a href="index.php<?php echo PMA_generate_common_url($_url_params); ?>" target="_parent">
<b><?php echo $strBack; ?></b></a>