[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5-5977-g6405357

Michal Čihař nijel at users.sourceforge.net
Tue Jul 27 09:45:53 CEST 2010


The branch, master has been updated
       via  6405357c0fae5b218b05391e7080e1fd3d6e4b82 (commit)
       via  39e4c95813f0f18e0f58cabfc7495ea6bccb6f87 (commit)
       via  36b632893183c493b93abfa7b96a116a76aedb86 (commit)
       via  1c17bfc1210f4c013621aabe832c022143124251 (commit)
       via  659bd9c8385f24ac9fb26838118acad6e372504e (commit)
      from  a47c6e8bea4fa15bf1455e6ac8413ce014a12932 (commit)


- Log -----------------------------------------------------------------
commit 6405357c0fae5b218b05391e7080e1fd3d6e4b82
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Jul 27 09:43:39 2010 +0200

    Changelog entry.

commit 39e4c95813f0f18e0f58cabfc7495ea6bccb6f87
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Jul 27 09:42:46 2010 +0200

    Remove drop/empty table links from table tabs.

commit 36b632893183c493b93abfa7b96a116a76aedb86
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Jul 27 09:42:08 2010 +0200

    Remove drop tab from database tabs.

commit 1c17bfc1210f4c013621aabe832c022143124251
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Jul 27 09:39:27 2010 +0200

    Add drop link to the database operations tab.

commit 659bd9c8385f24ac9fb26838118acad6e372504e
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Jul 27 09:31:30 2010 +0200

    Add trop/empty links to table operations tab.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                      |    1 +
 db_operations.php                              |   34 +++++++++++++++++
 libraries/db_links.inc.php                     |   19 ---------
 libraries/tbl_links.inc.php                    |   34 +----------------
 tbl_operations.php                             |   48 ++++++++++++++++++++++++
 themes/darkblue_orange/css/theme_right.css.php |    7 +++
 themes/original/css/theme_right.css.php        |    7 +++
 7 files changed, 98 insertions(+), 52 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6fd14f1..6930da5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -97,6 +97,7 @@ $Id$
 - [interface] Better formatting for SQL validator results.
 - [doc] The linked-tables infrastructure is now called phpMyAdmin
   configuration storage.
+- [interface] Move drop/empty links from being tabs to Operations tab.
 
 3.3.6.0 (not yet released)
 - bug #3033063 [core] Navi gets wrong db name
diff --git a/db_operations.php b/db_operations.php
index eb8c6a2..53a2821 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -364,7 +364,41 @@ if (!$is_information_schema) {
         <input type="submit" value="<?php echo __('Go'); ?>" onclick="return confirmLink(this, 'CREATE DATABASE ... <?php echo __('and then'); ?> DROP DATABASE <?php echo PMA_jsFormat($db); ?>')" />
     </fieldset>
     </form>
+<?php
+// Drop link if allowed
+// Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
+// Don't allow to easilly drop mysql database, RFE #1327514.
+if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
+?>
+<fieldset class="caution">
+ <legend><?php
+if ($cfg['PropertiesIconic']) {
+    echo '<img class="icon" src="' . $pmaThemeImage . 'b_deltbl.png"'
+        .' alt="" width="16" height="16" />';
+}
+echo __('Remove database');
+?></legend>
 
+<ul>
+<?php
+    $this_sql_query = 'DROP DATABASE ' . PMA_backquote($GLOBALS['db']);
+    $this_url_params = array(
+            'sql_query' => $this_sql_query,
+            'back' => 'db_operations.php',
+            'goto' => 'main.php',
+            'reload' => '1',
+            'purge' => '1',
+            'zero_rows' => sprintf(__('Database %s has been dropped.'), htmlspecialchars(PMA_backquote($db))),
+            'db' => NULL,
+        );
+    ?>
+    <li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLinkDropDB(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')">
+            <?php echo __('Drop the database (DROP)'); ?></a>
+        <?php echo PMA_showMySQLDocu('SQL-Syntax', 'DROP_DATABASE'); ?>
+    </li>
+</ul>
+</fieldset>
+<?php } ?>
     <?php
     /**
      * Copy database
diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php
index 860d3d8..0dfa5a8 100644
--- a/libraries/db_links.inc.php
+++ b/libraries/db_links.inc.php
@@ -34,19 +34,6 @@ $is_superuser = PMA_isSuperuser();
 /**
  * Prepares links
  */
-// Drop link if allowed
-// Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
-// Don't allow to easilly drop mysql database, RFE #1327514.
-if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
-    $tab_drop['link'] = 'sql.php';
-    $tab_drop['args']['sql_query']  = 'DROP DATABASE ' . PMA_backquote($db);
-    $tab_drop['args']['zero_rows']  = sprintf(__('Database %s has been dropped.'), htmlspecialchars(PMA_backquote($db)));
-    $tab_drop['args']['goto']       = 'main.php';
-    $tab_drop['args']['back']       = 'db' . $sub_part . '.php';
-    $tab_drop['args']['reload']     = 1;
-    $tab_drop['args']['purge']      = 1;
-    $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
-}
 
 /**
  * export, search and qbe links if there is at least one table
@@ -95,9 +82,6 @@ if (! $db_is_information_schema) {
     $tab_import['link']     = 'db_import.php';
     $tab_import['text']     = __('Import');
     $tab_import['icon']     = 'b_import.png';
-    $tab_drop['text']       = __('Drop');
-    $tab_drop['icon']       = 'b_deltbl.png';
-    $tab_drop['class']      = 'caution';
     $tab_operation['link']  = 'db_operations.php';
     $tab_operation['text']  = __('Operations');
     $tab_operation['icon']  = 'b_tblops.png';
@@ -132,9 +116,6 @@ if (! $db_is_information_schema) {
     if ($is_superuser) {
         $tabs[] =& $tab_privileges;
     }
-    if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
-        $tabs[] =& $tab_drop;
-    }
 }
 
 $url_params['db'] = $db;
diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php
index ef61293..445cf66 100644
--- a/libraries/tbl_links.inc.php
+++ b/libraries/tbl_links.inc.php
@@ -91,23 +91,10 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
     $tabs['operation']['icon'] = 'b_tblops.png';
     $tabs['operation']['link'] = 'tbl_operations.php';
     $tabs['operation']['text'] = __('Operations');
-
-    $tabs['empty']['link']  = 'sql.php';
-    $tabs['empty']['args']['reload']    = 1;
-    $tabs['empty']['args']['sql_query'] = 'TRUNCATE TABLE ' . PMA_backquote($table);
-    $tabs['empty']['args']['zero_rows'] = sprintf(__('Table %s has been emptied'), htmlspecialchars($table));
-    $tabs['empty']['attr']  = 'onclick="return confirmLink(this, \'TRUNCATE TABLE ' . PMA_jsFormat($table) . '\')"';
-    $tabs['empty']['args']['goto'] = 'tbl_structure.php';
-    $tabs['empty']['class'] = 'caution';
-    $tabs['empty']['icon'] = 'b_empty.png';
-    $tabs['empty']['text'] = __('Empty');
-    if ($table_info_num_rows == 0) {
-        $tabs['empty']['warning'] = __('Table seems to be empty!');
-    }
 }
 
 /**
- * Views support a limited number of operations 
+ * Views support a limited number of operations
  */
 if ($tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
     $tabs['operation']['icon'] = 'b_tblops.png';
@@ -115,25 +102,6 @@ if ($tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_sc
     $tabs['operation']['text'] = __('Operations');
 }
 
-/**
- * no drop in information_schema
- */
-if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
-    $tabs['drop']['icon'] = 'b_deltbl.png';
-    $tabs['drop']['link'] = 'sql.php';
-    $tabs['drop']['url_params'] = array('table' => NULL);
-    $tabs['drop']['text'] = __('Drop');
-    $tabs['drop']['args']['reload']     = 1;
-    $tabs['drop']['args']['purge']      = 1;
-    $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
-    $tabs['drop']['args']['sql_query']  = $drop_command . ' ' . PMA_backquote($table);
-    $tabs['drop']['args']['goto']       = 'db_structure.php';
-    $tabs['drop']['args']['zero_rows']  = sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table));
-    $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
-    unset($drop_command);
-    $tabs['drop']['class'] = 'caution';
-}
-
 if ($table_info_num_rows == 0 && !$tbl_is_view) {
     $tabs['browse']['warning'] = __('Table seems to be empty!');
     $tabs['search']['warning'] = __('Table seems to be empty!');
diff --git a/tbl_operations.php b/tbl_operations.php
index 493a17f..baab85a 100644
--- a/tbl_operations.php
+++ b/tbl_operations.php
@@ -636,6 +636,54 @@ $this_url_params = array_merge($url_params,
 </ul>
 </fieldset>
 </div>
+<?php if (! (isset($db_is_information_schema) && $db_is_information_schema)) { ?>
+<div id="div_table_removal">
+<fieldset class="caution">
+ <legend><?php echo __('Table removal'); ?></legend>
+
+<ul>
+<?php
+if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
+    $this_sql_query = 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table']);
+    $this_url_params = array_merge($url_params,
+        array(
+            'sql_query' => $this_sql_query,
+            'goto' => 'tbl_structure.php',
+            'reload' => '1',
+            'zero_rows' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)),
+        ));
+    ?>
+    <li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLink(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')">
+            <?php echo __('Empty the table (TRUNCATE)'); ?></a>
+        <?php echo PMA_showMySQLDocu('SQL-Syntax', 'TRUNCATE_TABLE'); ?>
+    </li>
+<?php
+}
+if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
+    $this_sql_query = 'DROP TABLE ' . PMA_backquote($GLOBALS['table']);
+    $this_url_params = array_merge($url_params,
+        array(
+            'sql_query' => $this_sql_query,
+            'goto' => 'db_operations.php',
+            'reload' => '1',
+            'purge' => '1',
+            'zero_rows' => sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)),
+            'table' => NULL,
+        ));
+    ?>
+    <li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLink(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')">
+            <?php echo __('Drop the table (DROP)'); ?></a>
+        <?php echo PMA_showMySQLDocu('SQL-Syntax', 'DROP_TABLE'); ?>
+    </li>
+<?php
+}
+?>
+</ul>
+</fieldset>
+</div>
+<?php
+}
+?>
 <?php if (PMA_Partition::havePartitioning()) {
     $partition_names = PMA_Partition::getPartitionNames($db, $table);
     // show the Partition maintenance section only if we detect a partition
diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php
index b6fe2a2..75c44f3 100644
--- a/themes/darkblue_orange/css/theme_right.css.php
+++ b/themes/darkblue_orange/css/theme_right.css.php
@@ -651,6 +651,13 @@ a.tabcaution:hover {
     color: #FFFFFF;
     background-color:   #FF0000;
 }
+fieldset.caution a {
+    color:              #FF0000;
+}
+fieldset.caution a:hover {
+    color:              #ffffff;
+    background-color:   #FF0000;
+}
 
 <?php if ($GLOBALS['cfg']['LightTabs']) { ?>
 /* active tab */
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 53f0f23..a8db826 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -626,6 +626,13 @@ a.tabcaution:hover {
     color: #FFFFFF;
     background-color:   #FF0000;
 }
+fieldset.caution a {
+    color:              #FF0000;
+}
+fieldset.caution a:hover {
+    color:              #ffffff;
+    background-color:   #FF0000;
+}
 
 <?php if ($GLOBALS['cfg']['LightTabs']) { ?>
 /* active tab */


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list