Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / view_operations.php
blobb707ca5d126daec8f896261093bc2fbddbde7744
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
12 require_once './libraries/common.inc.php';
13 require_once './libraries/Table.class.php';
15 $pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
17 /**
18 * Runs common work
20 require './libraries/tbl_common.php';
21 $url_query .= '&amp;goto=view_operations.php&amp;back=view_operations.php';
22 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
24 /**
25 * Gets tables informations
28 require './libraries/tbl_info.inc.php';
29 $reread_info = false;
31 /**
32 * Updates if required
34 if (isset($_REQUEST['submitoptions'])) {
35 $_message = '';
36 $warning_messages = array();
38 if (isset($_REQUEST['new_name'])) {
39 if ($pma_table->rename($_REQUEST['new_name'], null, $is_view = true)) {
40 $_message .= $pma_table->getLastMessage();
41 $result = true;
42 $GLOBALS['table'] = $pma_table->getName();
43 $reread_info = true;
44 $reload = true;
45 } else {
46 $_message .= $pma_table->getLastError();
47 $result = false;
52 /**
53 * Displays top menu links
55 require_once './libraries/tbl_links.inc.php';
57 if (isset($result)) {
58 // set to success by default, because result set could be empty
59 // (for example, a table rename)
60 $_type = 'success';
61 if (empty($_message)) {
62 $_message = $result ? __('Your SQL query has been executed successfully') : __('Error');
63 // $result should exist, regardless of $_message
64 $_type = $result ? 'success' : 'error';
66 if (! empty($warning_messages)) {
67 $_message = new PMA_Message;
68 $_message->addMessages($warning_messages);
69 $_message->isWarning(true);
70 unset($warning_messages);
72 PMA_showMessage($_message, $sql_query, $_type, $is_view = true);
73 unset($_message, $_type);
76 $url_params['goto'] = 'view_operations.php';
77 $url_params['back'] = 'view_operations.php';
79 /**
80 * Displays the page
83 <!-- Table operations -->
84 <div id="div_table_options">
85 <form method="post" action="view_operations.php">
86 <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
87 <input type="hidden" name="reload" value="1" />
88 <fieldset>
89 <legend><?php echo __('Operations'); ?></legend>
91 <table>
92 <!-- Change view name -->
93 <tr><td><?php echo __('Rename view to'); ?></td>
94 <td><input type="text" size="20" name="new_name" onfocus="this.select()"
95 value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
96 </td>
97 </tr>
98 </table>
99 </fieldset>
100 <fieldset class="tblFooters">
101 <input type="submit" name="submitoptions" value="<?php echo __('Go'); ?>" />
102 </fieldset>
103 </form>
104 </div>
106 <?php
108 * Displays the footer
110 require_once './libraries/footer.inc.php';