2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PMA\libraries\Table
;
9 use PMA\libraries\Response
;
10 use PMA\libraries\URL
;
15 require_once './libraries/common.inc.php';
17 $pma_table = new Table($GLOBALS['table'], $GLOBALS['db']);
20 * functions implementation for this script
22 require_once 'libraries/operations.lib.php';
25 * Load JavaScript files
27 $response = Response
::getInstance();
28 $header = $response->getHeader();
29 $scripts = $header->getScripts();
30 $scripts->addFile('tbl_operations.js');
35 require './libraries/tbl_common.inc.php';
36 $url_query .= '&goto=view_operations.php&back=view_operations.php';
37 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
40 * Gets tables information
43 require './libraries/tbl_info.inc.php';
49 $_message = new PMA\libraries\Message
;
51 if (isset($_REQUEST['submitoptions'])) {
53 if (isset($_REQUEST['new_name'])) {
54 if ($pma_table->rename($_REQUEST['new_name'])) {
55 $_message->addText($pma_table->getLastMessage());
57 $GLOBALS['table'] = $pma_table->getName();
61 $_message->addText($pma_table->getLastError());
66 $warning_messages = PMA_getWarningMessagesArray();
70 // set to success by default, because result set could be empty
71 // (for example, a table rename)
72 if (empty($_message->getString())) {
75 __('Your SQL query has been executed successfully.')
78 $_message->addText(__('Error'));
80 // $result should exist, regardless of $_message
81 $_type = $result ?
'success' : 'error';
83 if (! empty($warning_messages)) {
84 $_message->addMessagesString($warning_messages);
85 $_message->isError(true);
86 unset($warning_messages);
88 echo PMA\libraries\Util
::getMessage(
89 $_message, $sql_query, $_type
92 unset($_message, $_type);
94 $url_params['goto'] = 'view_operations.php';
95 $url_params['back'] = 'view_operations.php';
101 <!-- Table operations
-->
102 <div
class="operations_half_width">
103 <form method
="post" action
="view_operations.php">
104 <?php
echo URL
::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); ?
>
105 <input type
="hidden" name
="reload" value
="1" />
107 <legend
><?php
echo __('Operations'); ?
></legend
>
110 <!-- Change view name
-->
111 <tr
><td
><?php
echo __('Rename view to'); ?
></td
>
112 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
113 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>"
119 <fieldset
class="tblFooters">
120 <input type
="hidden" name
="submitoptions" value
="1" />
121 <input type
="submit" value
="<?php echo __('Go'); ?>" />
126 $drop_view_url_params = array_merge(
129 'sql_query' => 'DROP VIEW ' . PMA\libraries\Util
::backquote(
132 'goto' => 'tbl_structure.php',
135 'message_to_show' => sprintf(
136 __('View %s has been dropped.'),
137 htmlspecialchars($GLOBALS['table'])
139 'table' => $GLOBALS['table']
142 echo '<div class="operations_half_width">';
143 echo '<fieldset class="caution">';
144 echo '<legend>' , __('Delete data or table') , '</legend>';
147 echo PMA_getDeleteDataOrTableLink(
148 $drop_view_url_params,
150 __('Delete the view (DROP)'),