Skip to content

Commit

Permalink
Merge pull request phpmyadmin#200 from hisamith/css_change
Browse files Browse the repository at this point in the history
[Contest-6] No hard-coded icons in css
  • Loading branch information
lem9 committed Mar 15, 2013
2 parents 523e95d + 563eef9 commit 79b7d3c
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 239 deletions.
30 changes: 18 additions & 12 deletions index.php
Expand Up @@ -120,9 +120,9 @@
if (! $cfg['NavigationDisplayServers']
&& (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)
) {
echo '<li id="li_select_server">';
echo '<li id="li_select_server" class="no_bullets" >';
include_once 'libraries/select_server.lib.php';
echo PMA_selectServer(true, true);
echo PMA_Util::getImage('s_host.png') . " " . PMA_selectServer(true, true);
echo '</li>';
}

Expand All @@ -137,22 +137,23 @@
if ($cfg['ShowChgPassword']) {
$conditional_class = 'ajax';
PMA_printListItem(
__('Change password'),
PMA_Util::getImage('s_passwd.png') . " " . __('Change password'),
'li_change_password',
'user_password.php?' . $common_url_query,
null,
null,
'change_password_anchor',
null,
"no_bullets",
$conditional_class
);
}
} // end if
echo ' <li id="li_select_mysql_collation">';
echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
echo ' <form method="post" action="index.php">' . "\n"
. PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
. ' <label for="select_collation_connection">' . "\n"
. ' ' . __('Server connection collation') . "\n"
. ' '. PMA_Util::getImage('s_asci.png') . " "
. __('Server connection collation') . "\n"
// put the doc link in the form so that it appears on the same line
. PMA_Util::showMySQLDocu(
'MySQL_Database_Administration',
Expand Down Expand Up @@ -183,17 +184,18 @@

// Displays language selection combo
if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
echo '<li id="li_select_lang">';
echo '<li id="li_select_lang" class="no_bullets">';
include_once 'libraries/display_select_lang.lib.php';
echo PMA_getLanguageSelectorHtml();
echo PMA_Util::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
echo '</li>';
}

// ThemeManager if available

if ($GLOBALS['cfg']['ThemeManager']) {
echo '<li id="li_select_theme">';
echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
echo '<li id="li_select_theme" class="no_bullets">';
echo PMA_Util::getImage('s_theme.png') . " "
. $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
echo '</li>';
}
echo '<li id="li_select_fontsize">';
Expand All @@ -207,9 +209,13 @@
if ($server > 0) {
echo '<ul>';
echo PMA_printListItem(
__('More settings'),
PMA_Util::getImage('b_tblops.png')." " .__('More settings'),
'li_user_preferences',
'prefs_manage.php?' . $common_url_query
'prefs_manage.php?' . $common_url_query,
null,
null,
null,
"no_bullets"
);
echo '</ul>';
}
Expand Down
25 changes: 25 additions & 0 deletions libraries/Message.class.php
Expand Up @@ -639,6 +639,9 @@ public function getMessage()
}
}

if ($this->isDisplayed()) {
$message = $this->getMessageWithIcon($message);
}
if (count($this->getParams()) > 0) {
$message = PMA_Message::format($message, $this->getParams());
}
Expand Down Expand Up @@ -720,5 +723,27 @@ public function isDisplayed($isDisplayed = false)

return $this->isDisplayed;
}

/**
* Returns the message with corresponding image icon
*
* @param string $message the message(s)
*
* @return string message with icon
*/
public function getMessageWithIcon($message)
{
$image = '';
if ('error' == $this->getLevel()) {
$image = 's_error.png';
} elseif ('success' == $this->getLevel()) {
$image = 's_success.png';
} else {
$image = 's_notice.png';
}
$message = PMA_Message::notice(PMA_Util::getImage($image)) . " " . $message;
return $message;

}
}
?>
6 changes: 5 additions & 1 deletion libraries/display_create_database.lib.php
Expand Up @@ -18,7 +18,11 @@
// The user is allowed to create a db
?>
<form method="post" action="db_create.php" id="create_database_form" class="ajax"><strong>
<?php echo '<label for="text_create_db">' . __('Create database') . '</label>&nbsp;' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
<?php echo '<label for="text_create_db">'
. PMA_Util::getImage('b_newdb.png')
. " " . __('Create database')
. '</label>&nbsp;'
. PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
<?php echo PMA_generate_common_hidden_inputs('', '', 5); ?>
<input type="hidden" name="reload" value="1" />
<input type="text" name="new_db" value="<?php echo $db_to_create; ?>" maxlength="64" class="textfield" id="text_create_db"/>
Expand Down
2 changes: 1 addition & 1 deletion server_databases.php
Expand Up @@ -142,7 +142,7 @@
* Create database.
*/
if ($cfg['ShowCreateDb']) {
echo '<ul><li id="li_create_database">' . "\n";
echo '<ul><li id="li_create_database" class="no_bullets">' . "\n";
include 'libraries/display_create_database.lib.php';
echo ' </li>' . "\n";
echo '</ul>' . "\n";
Expand Down
22 changes: 11 additions & 11 deletions test/classes/PMA_Message_test.php
Expand Up @@ -504,7 +504,7 @@ public function testDisplay()
$this->assertFalse($this->object->isDisplayed());
$this->object->setMessage('Test Message');

$this->expectOutputString('<div class="notice">Test Message</div>');
$this->expectOutputString('<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> Test Message</div>');
$this->object->display();

$this->assertTrue($this->object->isDisplayed());
Expand All @@ -519,7 +519,7 @@ public function testGetDisplay()
{
$this->object->setMessage('Test Message');
$this->assertEquals(
'<div class="notice">Test Message</div>',
'<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> Test Message</div>',
$this->object->getDisplay()
);
}
Expand All @@ -539,9 +539,9 @@ public function testIsDisplayed()
public function providerAffectedRows()
{
return array(
array(1, '<div class="notice"> 1 row affected.</div>'),
array(2, '<div class="notice"> 2 rows affected.</div>'),
array(10000, '<div class="notice"> 10000 rows affected.</div>'),
array(1, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 1 row affected.</div>'),
array(2, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 2 rows affected.</div>'),
array(10000, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 10000 rows affected.</div>'),
);
}

Expand All @@ -567,9 +567,9 @@ public function testAffectedRows($rows, $output)
public function providerInsertedRows()
{
return array(
array(1, '<div class="notice"> 1 row inserted.</div>'),
array(2, '<div class="notice"> 2 rows inserted.</div>'),
array(100000, '<div class="notice"> 100000 rows inserted.</div>'),
array(1, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 1 row inserted.</div>'),
array(2, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 2 rows inserted.</div>'),
array(100000, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 100000 rows inserted.</div>'),
);
}

Expand All @@ -595,9 +595,9 @@ public function testInsertedRows($rows, $output)
public function providerDeletedRows()
{
return array(
array(1, '<div class="notice"> 1 row deleted.</div>'),
array(2, '<div class="notice"> 2 rows deleted.</div>'),
array(500000, '<div class="notice"> 500000 rows deleted.</div>'),
array(1, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 1 row deleted.</div>'),
array(2, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 2 rows deleted.</div>'),
array(500000, '<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> 500000 rows deleted.</div>'),
);
}

Expand Down
112 changes: 3 additions & 109 deletions themes/original/css/common.css.php
Expand Up @@ -487,15 +487,6 @@
h1.success,
div.success {
border-color: #00FF00;
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_success.png');?>);
background-repeat: no-repeat;
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 5px 50%;
padding: 0.2em 0.2em 0.2em 25px;
<?php } else { ?>
background-position: 99% 50%;
padding: 0.2em 35px 0.2em 0.2em;
<?php } ?>
}
.success h1 {
border-color: #00FF00;
Expand All @@ -508,15 +499,6 @@
h1.notice,
div.notice {
border-color: #FFD700;
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_notice.png');?>);
background-repeat: no-repeat;
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 5px 50%;
padding: 0.2em 0.2em 0.2em 25px;
<?php } else { ?>
background-position: 99% 50%;
padding: 0.2em 35px 0.2em 0.2em;
<?php } ?>
}
.notice h1 {
border-color: #FFD700;
Expand All @@ -530,15 +512,6 @@
h1.error,
div.error {
border-color: #ff0000;
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_error.png');?>);
background-repeat: no-repeat;
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 5px 50%;
padding: 0.2em 0.2em 0.2em 25px;
<?php } else { ?>
background-position: 99% 50%;
padding: 0.2em 35px 0.2em 0.2em;
<?php } ?>
}
div.error h1 {
border-color: #ff0000;
Expand Down Expand Up @@ -1279,90 +1252,15 @@
}
/* END main page */


/* iconic view for ul items */
li#li_create_database {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_newdb.png');?>);
}

li#li_select_lang {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_lang.png');?>);
}

li#li_select_mysql_collation {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_asci.png');?>);
}

li#li_select_theme {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_theme.png');?>);
}

li#li_user_info {
/* list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_rights.png');?>); */
}

li#li_mysql_status {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_status.png');?>);
li.no_bullets {
list-style-type:none !important;
margin-left: -25px !important; //align with other list items which have bullets
}

li#li_mysql_variables {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_vars.png');?>);
}

li#li_mysql_processes {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_process.png');?>);
}

li#li_mysql_collations {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_asci.png');?>);
}

li#li_mysql_engines {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_engine.png');?>);
}

li#li_mysql_binlogs {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_tbl.png');?>);
}

li#li_mysql_databases {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_db.png');?>);
}

li#li_export {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_export.png');?>);
}

li#li_import {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_import.png');?>);
}

li#li_change_password {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_passwd.png');?>);
}

li#li_log_out {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_loggoff.png');?>);
}

li#li_mysql_privilegs {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_rights.png');?>);
}

li#li_switch_dbstats {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_dbstatistics.png');?>);
}

li#li_flush_privileges {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_reload.png');?>);
}

li#li_user_preferences {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('b_tblops.png');?>);
}
/* END iconic view for ul items */


#body_browse_foreigners {
background: <?php echo $GLOBALS['cfg']['NaviBackground']; ?>;
margin: .5em .5em 0 .5em;
Expand Down Expand Up @@ -1490,10 +1388,6 @@
display: none;
}

#li_select_server {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath('s_host.png');?>);
}

#list_server {
list-style-image: none;
}
Expand Down

0 comments on commit 79b7d3c

Please sign in to comment.