From c88420a247a1d63e56f8434ba497cb87f4aedc39 Mon Sep 17 00:00:00 2001 From: Samith Dassanayake Date: Sat, 2 Mar 2013 22:07:48 +0530 Subject: [PATCH 1/5] [Contest1] No hard-coded icons in css Modified "list-style-type" to "none" for the list items that has an image as the bullet point and aligned them --- index.php | 28 +++++++++++++---------- libraries/display_create_database.lib.php | 2 +- server_databases.php | 2 +- themes/pmahomme/css/common.css.php | 20 ++++++++++------ 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/index.php b/index.php index 17899ddb35..fb064a3763 100644 --- a/index.php +++ b/index.php @@ -120,9 +120,9 @@ if ($server > 0 if (! $cfg['NavigationDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1) ) { - echo '
  • '; + echo '
  • '; include_once 'libraries/select_server.lib.php'; - echo PMA_selectServer(true, true); + echo PMA_Util::getImage('s_host.png')." ".PMA_selectServer(true, true); echo '
  • '; } @@ -137,22 +137,22 @@ if ($server > 0 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 '
  • '; + echo '
  • '; echo '
    ' . "\n" . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection') . '  ' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?>
    + '. PMA_Util::getImage('b_newdb.png')." " . __('Create database') . ' ' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?>
    diff --git a/server_databases.php b/server_databases.php index dc52517f3a..8072feb88c 100644 --- a/server_databases.php +++ b/server_databases.php @@ -142,7 +142,7 @@ echo '

    ' . "\n" * Create database. */ if ($cfg['ShowCreateDb']) { - echo '
    • ' . "\n"; + echo '
      • ' . "\n"; include 'libraries/display_create_database.lib.php'; echo '
      • ' . "\n"; echo '
      ' . "\n"; diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index b4da75ff19..989b97d26b 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -1651,20 +1651,26 @@ div#queryboxcontainer div#bookmarkoptions { /* iconic view for ul items */ + +li.no_bullets { + list-style-type:none !important; + margin-left: -25px !important; //align with other list items which have bullets +} + li#li_create_database { - list-style-image: url(getImgPath('b_newdb.png');?>); + //list-style-image: url(getImgPath('b_newdb.png');?>); } li#li_select_lang { - list-style-image: url(getImgPath('s_lang.png');?>); + //list-style-image: url(getImgPath('s_lang.png');?>); } li#li_select_mysql_collation { - list-style-image: url(getImgPath('s_asci.png');?>); + //list-style-image: url(getImgPath('s_asci.png');?>); } li#li_select_theme { - list-style-image: url(getImgPath('s_theme.png');?>); + //list-style-image: url(getImgPath('s_theme.png');?>); } li#li_user_info { @@ -1708,7 +1714,7 @@ li#li_import { } li#li_change_password { - list-style-image: url(getImgPath('s_passwd.png');?>); + //list-style-image: url(getImgPath('s_passwd.png');?>); } li#li_log_out { @@ -1728,7 +1734,7 @@ li#li_flush_privileges { } li#li_user_preferences { - list-style-image: url(getImgPath('b_tblops.png');?>); + //list-style-image: url(getImgPath('b_tblops.png');?>); } /* END iconic view for ul items */ @@ -1875,7 +1881,7 @@ textarea#partitiondefinition { } #li_select_server { - list-style-image: url(getImgPath('s_host.png');?>); + //list-style-image: url(getImgPath('s_host.png');?>); } #list_server { From bc47ff43b9862bf14cf6023c8ffd34534209b00c Mon Sep 17 00:00:00 2001 From: Samith Dassanayake Date: Tue, 5 Mar 2013 22:28:00 +0530 Subject: [PATCH 2/5] All of the hard-coded images that are also available as a CSS sprite replaced by their sprite counterparts. Remove unused css styles for iconic view for ul items. Update the CSS file in the "original" theme. --- libraries/Message.class.php | 29 +++++++- themes/original/css/common.css.php | 114 +---------------------------- themes/pmahomme/css/common.css.php | 111 +--------------------------- 3 files changed, 33 insertions(+), 221 deletions(-) diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 4d6f535407..f0c5f9a906 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -78,7 +78,7 @@ class PMA_Message PMA_Message::NOTICE => 'notice', PMA_Message::ERROR => 'error', ); - + /** * The message number * @@ -638,7 +638,10 @@ class PMA_Message $message = $string; } } - + + if ($this->isDisplayed()) { + $message = $this->getMessageWithIcon($message); + } if (count($this->getParams()) > 0) { $message = PMA_Message::format($message, $this->getParams()); } @@ -651,7 +654,7 @@ class PMA_Message return $message; } - + /** * returns PMA_Message::$string * @@ -720,5 +723,25 @@ class PMA_Message 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; + + } } ?> diff --git a/themes/original/css/common.css.php b/themes/original/css/common.css.php index 9a5b1d62d5..9a477e919f 100644 --- a/themes/original/css/common.css.php +++ b/themes/original/css/common.css.php @@ -487,15 +487,6 @@ div.error { h1.success, div.success { border-color: #00FF00; - background-image: url(getImgPath('s_success.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - padding: 0.2em 0.2em 0.2em 25px; - - background-position: 99% 50%; - padding: 0.2em 35px 0.2em 0.2em; - } .success h1 { border-color: #00FF00; @@ -508,15 +499,6 @@ div.success { h1.notice, div.notice { border-color: #FFD700; - background-image: url(getImgPath('s_notice.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - padding: 0.2em 0.2em 0.2em 25px; - - background-position: 99% 50%; - padding: 0.2em 35px 0.2em 0.2em; - } .notice h1 { border-color: #FFD700; @@ -530,15 +512,6 @@ div.notice { h1.error, div.error { border-color: #ff0000; - background-image: url(getImgPath('s_error.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - padding: 0.2em 0.2em 0.2em 25px; - - background-position: 99% 50%; - padding: 0.2em 35px 0.2em 0.2em; - } div.error h1 { border-color: #ff0000; @@ -1279,90 +1252,15 @@ div#queryboxcontainer div#bookmarkoptions { } /* END main page */ - /* iconic view for ul items */ -li#li_create_database { - list-style-image: url(getImgPath('b_newdb.png');?>); + +li.no_bullets { + list-style-type:none !important; + margin-left: -25px !important; //align with other list items which have bullets } -li#li_select_lang { - list-style-image: url(getImgPath('s_lang.png');?>); -} - -li#li_select_mysql_collation { - list-style-image: url(getImgPath('s_asci.png');?>); -} - -li#li_select_theme { - list-style-image: url(getImgPath('s_theme.png');?>); -} - -li#li_user_info { - /* list-style-image: url(getImgPath('s_rights.png');?>); */ -} - -li#li_mysql_status { - list-style-image: url(getImgPath('s_status.png');?>); -} - -li#li_mysql_variables { - list-style-image: url(getImgPath('s_vars.png');?>); -} - -li#li_mysql_processes { - list-style-image: url(getImgPath('s_process.png');?>); -} - -li#li_mysql_collations { - list-style-image: url(getImgPath('s_asci.png');?>); -} - -li#li_mysql_engines { - list-style-image: url(getImgPath('b_engine.png');?>); -} - -li#li_mysql_binlogs { - list-style-image: url(getImgPath('s_tbl.png');?>); -} - -li#li_mysql_databases { - list-style-image: url(getImgPath('s_db.png');?>); -} - -li#li_export { - list-style-image: url(getImgPath('b_export.png');?>); -} - -li#li_import { - list-style-image: url(getImgPath('b_import.png');?>); -} - -li#li_change_password { - list-style-image: url(getImgPath('s_passwd.png');?>); -} - -li#li_log_out { - list-style-image: url(getImgPath('s_loggoff.png');?>); -} - -li#li_mysql_privilegs { - list-style-image: url(getImgPath('s_rights.png');?>); -} - -li#li_switch_dbstats { - list-style-image: url(getImgPath('b_dbstatistics.png');?>); -} - -li#li_flush_privileges { - list-style-image: url(getImgPath('s_reload.png');?>); -} - -li#li_user_preferences { - list-style-image: url(getImgPath('b_tblops.png');?>); -} /* END iconic view for ul items */ - #body_browse_foreigners { background: ; margin: .5em .5em 0 .5em; @@ -1490,10 +1388,6 @@ textarea#partitiondefinition { display: none; } -#li_select_server { - list-style-image: url(getImgPath('s_host.png');?>); -} - #list_server { list-style-image: none; } diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index 989b97d26b..2f666af693 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -701,7 +701,7 @@ div.error { background-repeat: no-repeat; background-position: 10px 50%; - padding: 10px 10px 10px 25px; + padding: 10px 10px 10px 10px; background-position: 99% 50%; padding: 10px 35px 10px 10px; @@ -729,14 +729,7 @@ div.error { h1.success, div.success { - border-color: #a2d246; - background-image: url(getImgPath('s_success.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - - background-position: 99% 50%; - + border-color: #a2d246; } .success h1 { border-color: #00FF00; @@ -750,13 +743,6 @@ div.success { h1.notice, div.notice { border-color: #3a6c7e; - background-image: url(getImgPath('s_notice.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - - background-position: 99% 50%; - } .notice h1 { @@ -771,14 +757,7 @@ div.notice { h1.error, div.error { - border-color: #333; - background-image: url(getImgPath('s_error.png');?>); - background-repeat: no-repeat; - - background-position: 5px 50%; - - background-position: 99% 50%; - + border-color: #333; } div.error h1 { @@ -1657,88 +1636,8 @@ li.no_bullets { margin-left: -25px !important; //align with other list items which have bullets } -li#li_create_database { - //list-style-image: url(getImgPath('b_newdb.png');?>); -} - -li#li_select_lang { - //list-style-image: url(getImgPath('s_lang.png');?>); -} - -li#li_select_mysql_collation { - //list-style-image: url(getImgPath('s_asci.png');?>); -} - -li#li_select_theme { - //list-style-image: url(getImgPath('s_theme.png');?>); -} - -li#li_user_info { - /* list-style-image: url(getImgPath('s_rights.png');?>); */ -} - -li#li_mysql_status { - list-style-image: url(getImgPath('s_status.png');?>); -} - -li#li_mysql_variables { - list-style-image: url(getImgPath('s_vars.png');?>); -} - -li#li_mysql_processes { - list-style-image: url(getImgPath('s_process.png');?>); -} - -li#li_mysql_collations { - list-style-image: url(getImgPath('s_asci.png');?>); -} - -li#li_mysql_engines { - list-style-image: url(getImgPath('b_engine.png');?>); -} - -li#li_mysql_binlogs { - list-style-image: url(getImgPath('s_tbl.png');?>); -} - -li#li_mysql_databases { - list-style-image: url(getImgPath('s_db.png');?>); -} - -li#li_export { - list-style-image: url(getImgPath('b_export.png');?>); -} - -li#li_import { - list-style-image: url(getImgPath('b_import.png');?>); -} - -li#li_change_password { - //list-style-image: url(getImgPath('s_passwd.png');?>); -} - -li#li_log_out { - list-style-image: url(getImgPath('s_loggoff.png');?>); -} - -li#li_mysql_privilegs { - list-style-image: url(getImgPath('s_rights.png');?>); -} - -li#li_switch_dbstats { - list-style-image: url(getImgPath('b_dbstatistics.png');?>); -} - -li#li_flush_privileges { - list-style-image: url(getImgPath('s_reload.png');?>); -} - -li#li_user_preferences { - //list-style-image: url(getImgPath('b_tblops.png');?>); -} /* END iconic view for ul items */ - #body_browse_foreigners { background: ; margin: .5em .5em 0 .5em; @@ -1880,10 +1779,6 @@ textarea#partitiondefinition { display: none; } -#li_select_server { - //list-style-image: url(getImgPath('s_host.png');?>); -} - #list_server { list-style-image: none; } From 8b7ef92205213d1eac2f54d1e576e4855d303609 Mon Sep 17 00:00:00 2001 From: Samith Dassanayake Date: Wed, 6 Mar 2013 22:03:30 +0530 Subject: [PATCH 3/5] Update the test cases according to the changes for Message.class.php --- test/classes/PMA_Message_test.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/classes/PMA_Message_test.php b/test/classes/PMA_Message_test.php index 5560e784b5..b240f6036d 100644 --- a/test/classes/PMA_Message_test.php +++ b/test/classes/PMA_Message_test.php @@ -504,7 +504,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase $this->assertFalse($this->object->isDisplayed()); $this->object->setMessage('Test Message'); - $this->expectOutputString('
      Test Message
      '); + $this->expectOutputString('
      Test Message
      '); $this->object->display(); $this->assertTrue($this->object->isDisplayed()); @@ -519,7 +519,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase { $this->object->setMessage('Test Message'); $this->assertEquals( - '
      Test Message
      ', + '
      Test Message
      ', $this->object->getDisplay() ); } @@ -539,9 +539,9 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase public function providerAffectedRows() { return array( - array(1, '
      1 row affected.
      '), - array(2, '
      2 rows affected.
      '), - array(10000, '
      10000 rows affected.
      '), + array(1, '
      1 row affected.
      '), + array(2, '
      2 rows affected.
      '), + array(10000, '
      10000 rows affected.
      '), ); } @@ -567,9 +567,9 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase public function providerInsertedRows() { return array( - array(1, '
      1 row inserted.
      '), - array(2, '
      2 rows inserted.
      '), - array(100000, '
      100000 rows inserted.
      '), + array(1, '
      1 row inserted.
      '), + array(2, '
      2 rows inserted.
      '), + array(100000, '
      100000 rows inserted.
      '), ); } @@ -595,9 +595,9 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase public function providerDeletedRows() { return array( - array(1, '
      1 row deleted.
      '), - array(2, '
      2 rows deleted.
      '), - array(500000, '
      500000 rows deleted.
      '), + array(1, '
      1 row deleted.
      '), + array(2, '
      2 rows deleted.
      '), + array(500000, '
      500000 rows deleted.
      '), ); } From 16fcf1398371be76f2d649892e5b556c8cbd8849 Mon Sep 17 00:00:00 2001 From: Samith Dassanayake Date: Fri, 8 Mar 2013 22:43:17 +0530 Subject: [PATCH 4/5] Fixed coding style --- index.php | 20 +++++++++++--------- libraries/Message.class.php | 12 +++++++----- libraries/display_create_database.lib.php | 6 +++++- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index fb064a3763..7789cc461c 100644 --- a/index.php +++ b/index.php @@ -122,7 +122,7 @@ if ($server > 0 ) { echo '
    • '; include_once 'libraries/select_server.lib.php'; - echo PMA_Util::getImage('s_host.png')." ".PMA_selectServer(true, true); + echo PMA_Util::getImage('s_host.png') . " " . PMA_selectServer(true, true); echo '
    • '; } @@ -137,7 +137,7 @@ if ($server > 0 if ($cfg['ShowChgPassword']) { $conditional_class = 'ajax'; PMA_printListItem( - PMA_Util::getImage('s_passwd.png')." ".__('Change password'), + PMA_Util::getImage('s_passwd.png') . " " . __('Change password'), 'li_change_password', 'user_password.php?' . $common_url_query, null, @@ -152,7 +152,8 @@ if ($server > 0 echo ' ' . "\n" . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection') . '  ' . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?>
      + ' + . PMA_Util::getImage('b_newdb.png') + . " " . __('Create database') + . ' ' + . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?>
      From 563eef9f403a2f44dba053640836af66bc6c6db7 Mon Sep 17 00:00:00 2001 From: Samith Dassanayake Date: Fri, 8 Mar 2013 22:50:33 +0530 Subject: [PATCH 5/5] Fixed coding style --- libraries/Message.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 1c92dc7636..1f93ad2de4 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -638,7 +638,7 @@ class PMA_Message $message = $string; } } - + if ($this->isDisplayed()) { $message = $this->getMessageWithIcon($message); } @@ -654,7 +654,7 @@ class PMA_Message return $message; } - + /** * returns PMA_Message::$string *