2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PhpMyAdmin\Message
;
9 use PhpMyAdmin\Operations
;
10 use PhpMyAdmin\Response
;
18 require_once './libraries/common.inc.php';
20 $pma_table = new Table($GLOBALS['table'], $GLOBALS['db']);
23 * Load JavaScript files
25 $response = Response
::getInstance();
26 $header = $response->getHeader();
27 $scripts = $header->getScripts();
28 $scripts->addFile('tbl_operations.js');
33 require './libraries/tbl_common.inc.php';
34 $url_query .= '&goto=view_operations.php&back=view_operations.php';
35 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
37 $operations = new Operations();
42 $_message = new Message
;
44 if (isset($_POST['submitoptions'])) {
46 if (isset($_POST['new_name'])) {
47 if ($pma_table->rename($_POST['new_name'])) {
48 $_message->addText($pma_table->getLastMessage());
50 $GLOBALS['table'] = $pma_table->getName();
51 /* Force reread after rename */
52 $pma_table->getStatusInfo(null, true);
55 $_message->addText($pma_table->getLastError());
60 $warning_messages = $operations->getWarningMessagesArray();
64 // set to success by default, because result set could be empty
65 // (for example, a table rename)
66 if (empty($_message->getString())) {
69 __('Your SQL query has been executed successfully.')
72 $_message->addText(__('Error'));
74 // $result should exist, regardless of $_message
75 $_type = $result ?
'success' : 'error';
77 if (! empty($warning_messages)) {
78 $_message->addMessagesString($warning_messages);
79 $_message->isError(true);
80 unset($warning_messages);
82 echo Util
::getMessage(
83 $_message, $sql_query, $_type
86 unset($_message, $_type);
88 $url_params['goto'] = 'view_operations.php';
89 $url_params['back'] = 'view_operations.php';
95 <!-- Table operations
-->
97 <form method
="post" action
="view_operations.php">
98 <?php
echo Url
::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); ?
>
99 <input type
="hidden" name
="reload" value
="1" />
101 <legend
><?php
echo __('Operations'); ?
></legend
>
104 <!-- Change view name
-->
105 <tr
><td
><?php
echo __('Rename view to'); ?
></td
>
106 <td
><input type
="text" name
="new_name" onfocus
="this.select()"
107 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>"
113 <fieldset
class="tblFooters">
114 <input type
="hidden" name
="submitoptions" value
="1" />
115 <input type
="submit" value
="<?php echo __('Go'); ?>" />
120 $drop_view_url_params = array_merge(
123 'sql_query' => 'DROP VIEW ' . Util
::backquote(
126 'goto' => 'tbl_structure.php',
129 'message_to_show' => sprintf(
130 __('View %s has been dropped.'),
131 htmlspecialchars($GLOBALS['table'])
133 'table' => $GLOBALS['table']
137 echo '<fieldset class="caution">';
138 echo '<legend>' , __('Delete data or table') , '</legend>';
141 echo $operations->getDeleteDataOrTablelink(
142 $drop_view_url_params,
144 __('Delete the view (DROP)'),