Avoid duplicate NOW in keywords.
[phpmyadmin-themes.git] / enum_editor.php
blob74ed09a281b251840f01c277d770c6b5a335d9b9
1 <?php
3 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 /**
5 * Displays a form for editing ENUM and SET values with more space (as an alternative to doing it in tbl_alter.php)
6 * This form is only for users with JavaScript disabled -- users with JavaScript enabled will see a different form
7 * defined in tbl_properties.inc.php
8 * @package phpMyAdmin
9 */
11 require_once './libraries/common.inc.php';
12 require_once './libraries/header_http.inc.php';
13 require_once './libraries/header_meta_style.inc.php';
16 </head>
18 <body>
19 <form action="enum_editor.php" method="get">
20 <div id="enum_editor_no_js">
21 <h3><?php printf(__('Values for the column "%s"'), htmlspecialchars($_GET['field'])); ?></h3>
22 <p><?php echo __('Enter each value in a separate field, enclosed in single quotes. If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').'); ?></p>
23 <div id="values">
24 <?php
25 $values = '';
26 if (isset($_GET['values'])) { // This page was displayed when the "add a new value" link or the link in tbl_alter.php was clicked
27 $values = urldecode($_GET['values']);
28 } elseif (isset($_GET['num_fields'])) { // This page was displayed from submitting this form
29 for($field_num = 1; $field_num <= $_GET['num_fields']; $field_num++) {
30 $values .= $_GET['field' . $field_num] . ",";
33 // Display the values in text fields, excluding empty strings
34 $field_counter = 0;
35 $stripped_values = array(); // The values to display in the output
36 foreach(split(",", $values) as $value) {
37 if(trim($value) != "") {
38 $field_counter++;
39 echo sprintf('<input type="text" size="30" value="%s" name="field' . $field_counter . '" />', htmlspecialchars($value));
40 $stripped_values[] = htmlspecialchars($value);
44 $total_fields = $field_counter;
45 // If extra empty fields are added, display them
46 if(isset($_GET['extra_fields'])) {
47 $total_fields += $_GET['extra_fields'];
48 for($i = $field_counter+1; $i <= $total_fields; $i++) {
49 echo '<input type="text" size="30" name="field' . $i . '"/>';
51 } else {
52 $_GET['extra_fields'] = 0;
56 </div>
57 <p>
58 <a href="enum_editor.php?token=<?php echo urlencode($_GET['token']); ?>&field=<?php echo urlencode($_GET['field']); ?>&extra_fields=<?php echo $_GET['extra_fields'] + 1; ?>&values=<?php echo $values; ?>">
59 + Restart insertion and add a new value
60 </a>
61 </p>
62 <input type="hidden" name="token" value="<?php echo $_GET['token']; ?>" />
63 <input type="hidden" name="field" value="<?php echo $_GET['field']; ?>" />
64 <input type="hidden" name="num_fields" value="<?php echo $total_fields; ?>" />
65 <input type="submit" value="Go" />
66 </form>
68 <div id="enum_editor_output">
69 <h3>Output</h3>
70 <p>Copy and paste the joined values into the "Length/Values" field</p>
71 <textarea id="joined_values" cols="95" rows="5"><?php echo join(",", $stripped_values); ?></textarea>
72 </div>
73 </div>
74 </body>
75 </html>