From a51f2533ea741eee452d5d6aead37ae268667912 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 26 Oct 2005 17:32:19 +0000 Subject: [PATCH] unified message boxes (error, warning, confirmation) --- ChangeLog | 7 + css/phpmyadmin.css.php | 8 + db_operations.php | 15 +- libraries/auth/cookie.auth.lib.php | 30 ++- libraries/auth/http.auth.lib.php | 13 +- libraries/common.lib.php | 19 +- mult_submits.inc.php | 127 +++++------- server_privileges.php | 2 +- sql.php | 48 ++--- .../darkblue_orange/css/theme_right.css.php | 182 ++++++++---------- themes/original/css/theme_right.css.php | 110 ++++++++--- 11 files changed, 273 insertions(+), 288 deletions(-) diff --git a/ChangeLog b/ChangeLog index db18744ad9..9dbb00cebe 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-10-26 Sebastian Mendel + * themes/*/theme_right.css.php, libraries/auth/http.auth.lib.php, + db_operations.php, mult_submits.inc.php, server_privileges.php, + css/phpmyadmin.css.php, libraries/common.lib.php, sql.php, + libraries/auth/cookie.auth.lib.php: + unified message boxes (error, warning, confirmation) + 2005-10-25 Michal Čihař * lang/english: "Log in" is correct naming for action (RFE #945440). * tbl_properties_operations.php: Allow to change auto_increment for diff --git a/css/phpmyadmin.css.php b/css/phpmyadmin.css.php index eb9a08321b..1964025c66 100644 --- a/css/phpmyadmin.css.php +++ b/css/phpmyadmin.css.php @@ -8,6 +8,14 @@ require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/sqlparser.lib.php'); +if ( $GLOBALS['text_dir'] === 'ltr' ) { + $right = 'right'; + $left = 'left'; +} else { + $right = 'left'; + $left = 'right'; +} + // Gets the default font sizes // garvin: TODO: Should be optimized to not include the whole common.lib.php bunch // but only functions used to determine browser heritage. diff --git a/db_operations.php b/db_operations.php index 5109354d04..9dca70a781 100644 --- a/db_operations.php +++ b/db_operations.php @@ -251,18 +251,15 @@ if (!$is_information_schema) { . ' ' . "\n" . ' ' . "\n\n"; } + + echo ''; - if ($num_tables > 0 + if ( $num_tables > 0 && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) { - echo '' - . '
' . $strError . '
' - . '' - . sprintf(wordwrap($strRelationNotWorking,65,'
'), '', '') - . ''; + echo '

' . $strError . '

' + . sprintf( $strRelationNotWorking, '', '') + . '
'; } // end if -?> - -' . "\n" + . ' ' . "\n"; + // Displays the warning message and the login form if (empty($GLOBALS['cfg']['blowfish_secret'])) { ?> - - - -
- - - - - +

+ +
' . "\n" - . ' ' . "\n" - . ' ' . "\n" + echo ' ' . "\n" . ''; exit(); } ?> +

' . $GLOBALS['strError'] . '

' . "\n"; + echo $conn_error . '' . "\n"; + } +?>
target="_top"> @@ -296,11 +297,6 @@ if (top != self) { '; - echo '
' . $GLOBALS['strError'] . '
' . "\n"; - echo ''. $conn_error . '' . "\n"; - } ?> diff --git a/libraries/auth/http.auth.lib.php b/libraries/auth/http.auth.lib.php index e4157882b9..97ef3a3986 100644 --- a/libraries/auth/http.auth.lib.php +++ b/libraries/auth/http.auth.lib.php @@ -19,8 +19,7 @@ * * @access public */ -function PMA_auth() -{ +function PMA_auth() { global $right_font_family, $font_size, $font_bigger; header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"'); @@ -34,9 +33,7 @@ function PMA_auth() require('./libraries/header_meta_style.inc.php'); ?> - - - +

@@ -44,18 +41,14 @@ function PMA_auth()


-

+
- ' . "\n"; - echo '

' . $GLOBALS['strError'] . '

' . "\n"; + echo '

' . $GLOBALS['strError'] . '

' . "\n"; // if the config password is wrong, or the MySQL server does not // respond, do not show the query that would reveal the // username/password @@ -623,13 +623,11 @@ if ($is_minimum_common == FALSE) { // Robbat2 - 12 January 2003, 9:46PM // Revised, Robbat2 - 13 January 2003, 2:59PM if (function_exists('PMA_SQP_isError') && PMA_SQP_isError()) { - echo '
' . "\n"; echo PMA_SQP_getErrorString() . "\n"; - echo '
' . "\n"; + echo '
' . "\n"; } // --- // modified to show me the help on sql errors (Michael Keck) - echo '
' . "\n"; echo '

' . $GLOBALS['strSQLQuery'] . ':' . "\n"; if (strstr(strtolower($formatted_sql),'select')) { // please show me help to the error on select echo PMA_showMySQLDocu('Reference', 'SELECT'); @@ -653,7 +651,7 @@ if ($is_minimum_common == FALSE) { echo '

' . "\n" .'

' . "\n" .' ' . $formatted_sql . "\n" - .'

' . "\n"; + .'

' . "\n"; } // end if $tmp_mysql_error = ''; // for saving the original $error_message @@ -663,7 +661,7 @@ if ($is_minimum_common == FALSE) { $error_message = preg_replace("@((\015\012)|(\015)|(\012)){3,}@", "\n\n", $error_message); } // modified to show me the help on error-returns (Michael Keck) - echo '

' . "\n" + echo '

' . "\n" . ' ' . $GLOBALS['strMySQLSaid'] . '' . PMA_showMySQLDocu('Error-returns', 'Error-returns') . "\n" @@ -1910,10 +1908,10 @@ window.parent.updateTableTitle( '', '

- - - + +

+
> ', '
+ +
+

'; + . ';
'; break; case 'drop_db': $full_query .= 'DROP DATABASE ' - . PMA_backquote(htmlspecialchars(urldecode($sval))) - . ';
'; + . PMA_backquote(htmlspecialchars(urldecode($sval))) + . ';
'; break; case 'drop_tbl': - $current = urldecode($sval); - if (!empty($views) && in_array($current, $views)) { + $current = urldecode($sval); + if (!empty($views) && in_array($current, $views)) { $full_query_views .= (empty($full_query_views) ? 'DROP VIEW ' : ', ') - . PMA_backquote(htmlspecialchars($current)); - } else { + . PMA_backquote(htmlspecialchars($current)); + } else { $full_query .= (empty($full_query) ? 'DROP TABLE ' : ', ') - . PMA_backquote(htmlspecialchars($current)); + . PMA_backquote(htmlspecialchars($current)); } break; @@ -178,16 +178,16 @@ if (!empty($submit_mult) && !empty($what)) { case 'primary_fld': if ($full_query == '') { $full_query .= 'ALTER TABLE ' - . PMA_backquote(htmlspecialchars($table)) - . '
  DROP PRIMARY KEY,' - . '
   ADD PRIMARY KEY(' - . '
     ' - . PMA_backquote(htmlspecialchars(urldecode($sval))) - . ','; + . PMA_backquote(htmlspecialchars($table)) + . '
  DROP PRIMARY KEY,' + . '
   ADD PRIMARY KEY(' + . '
     ' + . PMA_backquote(htmlspecialchars(urldecode($sval))) + . ','; } else { $full_query .= '
     ' - . PMA_backquote(htmlspecialchars(urldecode($sval))) - . ','; + . PMA_backquote(htmlspecialchars(urldecode($sval))) + . ','; } if ($i == $selected_cnt-1) { $full_query = preg_replace('@,$@', ');
', $full_query); @@ -197,14 +197,14 @@ if (!empty($submit_mult) && !empty($what)) { case 'drop_fld': if ($full_query == '') { $full_query .= 'ALTER TABLE ' - . PMA_backquote(htmlspecialchars($table)) - . '
  DROP ' - . PMA_backquote(htmlspecialchars(urldecode($sval))) - . ','; + . PMA_backquote(htmlspecialchars($table)) + . '
  DROP ' + . PMA_backquote(htmlspecialchars(urldecode($sval))) + . ','; } else { $full_query .= '
  DROP ' - . PMA_backquote(htmlspecialchars(urldecode($sval))) - . ','; + . PMA_backquote(htmlspecialchars(urldecode($sval))) + . ','; } if ($i == $selected_cnt-1) { $full_query = preg_replace('@,$@', ';
', $full_query); @@ -215,57 +215,36 @@ if (!empty($submit_mult) && !empty($what)) { } if ($what == 'drop_tbl') { if (!empty($full_query)) { - $full_query .= ';
' . "\n"; - } - if (!empty($full_query_views)) { - $full_query .= $full_query_views . ';
' . "\n"; - } - unset($full_query_views); + $full_query .= ';
' . "\n"; + } + if (!empty($full_query_views)) { + $full_query .= $full_query_views . ';
' . "\n"; + } + unset($full_query_views); } // Displays the form -?> + ?> - - - - - - - - - - -
- ' : ''); - echo $strDoYouReally . ': ' . "\n"; - ?> -
- ' . $full_query . ' ?
' . "\n"; - ?> -
+ $sval) { - echo ' ' . "\n"; + echo '' . "\n"; } if ($what == 'drop_tbl' && !empty($views)) { foreach ($views as $current) { - echo ' ' . "\n"; - } + echo '' . "\n"; + } } - ?> - - ' . "\n"; echo '' . "\n"; @@ -277,15 +256,15 @@ if (!empty($submit_mult) && !empty($what)) { echo '' . "\n"; } ?> +
+ : + +
+
- -
+ diff --git a/server_privileges.php b/server_privileges.php index ef5dd42553..bbfedf5eaf 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -1255,7 +1255,7 @@ if (empty($adduser) && empty($checkprivs)) { . ' ' . "\n"; } // end if (display overview) echo '' . "\n" - . '
' . "\n" + . '
' . "\n" . ' ' . sprintf($GLOBALS['strFlushPrivilegesNote'], '', '') . "\n" . '
' . "\n"; } diff --git a/sql.php b/sql.php index 5a9d91cf5f..58ce37e7d9 100644 --- a/sql.php +++ b/sql.php @@ -208,37 +208,15 @@ if (!$cfg['Confirm'] $do_confirm = isset($analyzed_sql[0]['queryflags']['need_confirm']); } -if ($do_confirm) { +if ( $do_confirm ) { $stripped_sql_query = $sql_query; require_once('./header.inc.php'); - echo '' . "\n"; - if ($is_drop_database) { - echo ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . '
' . "\n"; - if($cfg['ErrorIconic']){ - echo ' '; - } - echo $strDropDatabaseStrongWarning . ' 
' . "\n"; - } else { - echo '
' . "\n"; - if($cfg['ErrorIconic']){ - echo ' '; - } + if ( $is_drop_database) { + echo '

' . $strDropDatabaseStrongWarning . '

'; } - echo $strDoYouReally . "\n" - . '
' . "\n" - . ' ' . htmlspecialchars($stripped_sql_query) . ' ?
' . "\n" - . '
' . "\n" + echo '' . "\n" + .PMA_generate_common_hidden_inputs($db, (isset($table)?$table:'')); ?> - @@ -248,15 +226,19 @@ if ($do_confirm) { + ' . "\n" + .' ' . $strDoYouReally . '' + .' ' . htmlspecialchars( $stripped_sql_query ) . '' . "\n" + .'' . "\n" + .'
' . "\n"; + ?> ' . "\n" - . '
'; - echo "\n"; -} // end if + echo '' . "\n" + . '' . "\n"; +} // end if $do_confirm /** diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index d224dfaccf..fc2bdff180 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -145,12 +145,6 @@ dfn:hover{ font-style: normal; cursor: help; } -.warning{ - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; - font-weight: bold; - color: #cc0000; -} td.topline{ font-size: 1px; } @@ -291,51 +285,89 @@ span.tab, span.tabcaution { /* end topmenu */ -/* Warning showing div with right border and optional icon */ - +/* message boxes: warning, error, confirmation */ +.warning { + color: #CC0000; + background-color: #FFFFCC; +} +p.warning, +h1.warning, div.warning { - border: 1px solid #cc0000; -/* - -*/ - background-image: url(../themes/darkblue_orange/img/s_warn.png); - background-repeat: no-repeat; - background-position: 10px 10px; - padding: 10px 10px 10px 36px; - margin: 0px; -/* - -*/ + margin: 0.5em 0 0.5em 0; + border: 0.1em solid #CC0000; width: 90%; -} - -div.error { - width: 100%; - border: 1px solid #cc0000; - background-color: #ffffcc; - padding: 0px; -} - -div.error div.text { - padding: 5px; -} - -div.error div.head { - background-color: #cc0000; - font-weight: bold; - color: #ffffff; -/* - -*/ - background-image: url(../themes/darkblue_orange/img/s_error.png); + + background-image: url(../themes/original/img/s_warn.png); background-repeat: no-repeat; - background-position: 2px 50%; - padding: 2px 2px 2px 30px; -/* - -*/ - margin: 0px; + background-position: 10px; 50%; + padding: 10px 10px 10px 36px; + + padding: 0.5em; + } +.warning h1 { + border-bottom: 0.1em solid #cc0000; + font-weight: bold; + text-align: left; + margin: 0 0 0.2em 0; +} + +.error { + background-color: #FFFFCC; + color: #ff0000; +} +p.error, +h1.error, +div.error { + margin: 0.5em 0 0.5em 0; + border: 0.1em solid #ff0000; + width: 90%; + + background-image: url(../themes/original/img/s_error.png); + background-repeat: no-repeat; + + background-position: 10px 50%; + padding: 10px 10px 10px 36px; + + background-position: 100% 50%; + padding: 10px 36px 10px 10px; + + + padding: 0.5em; + +} +div.error h1 { + border-bottom: 0.1em solid #ff0000; + font-weight: bold; + text-align: left; + margin: 0 0 0.2em 0; +} + +.confirmation { + background-color: #FFFFCC; +} +fieldset.confirmation { + border: 0.1em solid #FF0000; +} +fieldset.confirmation legend { + border-left: 0.1em solid #FF0000; + border-right: 0.1em solid #FF0000; + font-weight: bold; + + background-image: url(../themes/original/img/s_really.png); + background-repeat: no-repeat; + + background-position: 5px 50%; + padding: 0.2em 0.2em 0.2em 25px; + + background-position: 100% 50%; + padding: 0.2em 25px 0.2em 0.2em; + + +} +/* end messageboxes */ + + .print{font-family:arial;font-size:8pt;} /* MySQL Parser */ @@ -358,19 +390,6 @@ div.error div.head { .syntax_quote_backtick {} /* tables */ -.tblError { - border: 1px solid #cc0000; - background-color: #ffffcc; -} -.tblWarn, div.tblWarn { - border: 1px solid #cc0000; - background-color: #ffffff; -} -div.tblWarn { - padding: 5px 5px 5px 5px; - margin: 2px 0px 2px 0px; - width: 100%; -} .tblHeaders{ font-weight: bold; color: #ffffff; @@ -396,49 +415,6 @@ div.tblWarn { text-decoration: none; color: #ffffff; } -.tblHeadError { - font-weight: bold; - color: #ffffff; - background-color: #cc0000; - background-image: url(../themes/darkblue_orange/img/tbl_error.png); - background-repeat: repeat-x; - background-position: top; - height: 18px; -} -div.errorhead { - font-weight: bold; - color: #ffffff; - text-align: left; - - background-image: url(../themes/darkblue_orange/img/s_error.png); - background-repeat: no-repeat; - background-position: 2px 50%; - padding: 2px 2px 2px 20px; - - margin: 0px; -} - -.tblHeadWarn { - background-color: #ffcc00; - font-weight: bold; - color: #000000; - background-image: url(../themes/darkblue_orange/img/tbl_th.png); - background-repeat: repeat-x; - background-position: top; - height: 18px; -} -div.warnhead { - font-weight: bold; - color: #ffffff; - text-align: left; - - background-image: url(../themes/darkblue_orange/img/s_warn.png); - background-repeat: no-repeat; - background-position: 2px 50%; - padding: 2px 2px 2px 20px; - - margin: 0px; -} /* forbidden, no privilegs */ .noPrivileges{ diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index a3fd775206..bd8109f17d 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -49,8 +49,6 @@ a.drop:visited {font-family: ; color: #ff0000} a.drop:hover {font-family: ; color: #ffffff; background-color:#ff0000; text-decoration: none} dfn {font-style: normal} dfn:hover {font-style: normal; cursor: help} -.warning {font-family: ; font-size: ; font-weight: bold; color: #FF0000} -.tblcomment {font-family: ; font-size: ; font-weight: normal; color: #000099; } td.topline {font-size: 1px} @@ -204,38 +202,89 @@ span.tab, span.tabcaution { /* end topmenu */ -/* Warning showing div with right border and optional icon */ -.errorhead { - background-color: #FF0000; +/* message boxes: warning, error, confirmation */ +.warning { + color: #CC0000; + background-color: #FFFFCC; +} +h1.warning, +div.warning { + margin: 0.5em 0 0.5em 0; + border: 0.1em solid #CC0000; + + background-image: url(../themes/original/img/s_warn.png); + background-repeat: no-repeat; + background-position: 10px; 50%; + padding: 10px 10px 10px 36px; + + padding: 0.5em; + +} +.warning h1 { + border-bottom: 0.1em solid #cc0000; font-weight: bold; - color: #ffffff; text-align: left; + margin: 0 0 0.2em 0; +} + +.error { + background-color: #FFFFCC; + color: #ff0000; +} +h1.error, +div.error { + margin: 0.5em 0 0.5em 0; + border: 0.1em solid #ff0000; background-image: url(../themes/original/img/s_error.png); background-repeat: no-repeat; - background-position: 5px 50%; - padding: 0 0 0 25px; + + background-position: 10px 50%; + padding: 10px 10px 10px 36px; + + background-position: 100% 50%; + padding: 10px 36px 10px 10px; + - padding: 0.2em; + padding: 0.5em; - margin: 0.5em 0 0 0; +} +div.error h1 { + border-bottom: 0.1em solid #ff0000; + font-weight: bold; + text-align: left; + margin: 0 0 0.2em 0; } -/* tables */ -.error, -.tblError { - border: 1px solid #FF0000; + +.confirmation { background-color: #FFFFCC; } -.tblWarn, div.tblWarn, div.warning { - border: 1px solid #FF0000; - background-color: #FFFFFF; +fieldset.confirmation { + border: 0.1em solid #FF0000; } -div.tblWarn, div.warning { - padding: 5px 5px 5px 5px; - margin: 0.5em 0px 0.5em 0px; +fieldset.confirmation legend { + border-left: 0.1em solid #FF0000; + border-right: 0.1em solid #FF0000; + font-weight: bold; + + background-image: url(../themes/original/img/s_really.png); + background-repeat: no-repeat; + + background-position: 5px 50%; + padding: 0.2em 0.2em 0.2em 25px; + + background-position: 100% 50%; + padding: 0.2em 25px 0.2em 0.2em; + + } +/* end messageboxes */ + + +.tblcomment {font-size: ; font-weight: normal; color: #000099; } + .tblHeaders { background-color: ; font-weight: bold; @@ -246,20 +295,19 @@ div.tblWarn, div.warning { font-weight: normal; color: #000000; } -.tblHeaders a:link, .tblHeaders a:active, .tblHeaders a:visited, .tblFooters a:link, .tblFooters a:active, .tblFooters a:visited { +.tblHeaders a:link, +.tblHeaders a:active, +.tblHeaders a:visited, +.tblFooters a:link, +.tblFooters a:active, +.tblFooters a:visited { color: #0000FF; } -.tblHeaders a:hover, .tblFooters a:hover { color: #FF0000; } -.tblHeadError { - background-color: #FF0000; - font-weight: bold; - color: #FFFFFF; -} -.tblHeadWarn { - background-color: #FFCC00; - font-weight: bold; - color: #000000; +.tblHeaders a:hover, +.tblFooters a:hover { + color: #FF0000; } + /* forbidden, no privilegs */ .noPrivileges{ color: #FF0000;