Skip to content
Newer
Older
100644 468 lines (432 sloc) 16.3 KB
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Handles table zoom search tab
5 *
6 * display table zoom search form, create SQL queries from form data
7 *
8 */
9
10 /**
11 * Gets some core libraries
12 */
13 require_once './libraries/common.inc.php';
14 require_once './libraries/mysql_charsets.lib.php';
91d372f @ammaryasir Added a library file for the table-search and zoom-search code
ammaryasir authored May 29, 2011
15 require_once './libraries/tbl_select.lib.php';
eaea003 @ammaryasir Added some features
ammaryasir authored Jun 21, 2011
16 require_once './libraries/relation.lib.php';
03a1a84 @ammaryasir Test
ammaryasir authored Jul 5, 2011
17 require_once './libraries/tbl_info.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
18
eaea003 @ammaryasir Added some features
ammaryasir authored Jun 20, 2011
19 $GLOBALS['js_include'][] = 'makegrid.js';
20 $GLOBALS['js_include'][] = 'sql.js';
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored Jul 1, 2011
21 $GLOBALS['js_include'][] = 'functions.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored Jun 17, 2011
22 $GLOBALS['js_include'][] = 'tbl_zoom_plot.js';
7a821c8 @ammaryasir Improved the panning feature
ammaryasir authored Aug 19, 2011
23 $GLOBALS['js_include'][] = 'date.js';
ed98d7e @ammaryasir Added: Mousewheel zoom and panning feature
ammaryasir authored Aug 15, 2011
24 $GLOBALS['js_include'][] = 'jquery/jquery.mousewheel.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored Jun 16, 2011
25 $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
26 /* Files required for chart exporting */
e09759b @ammaryasir Added support for ploting strings(char,varchar,enums)
ammaryasir authored Jul 25, 2011
27 $GLOBALS['js_include'][] = 'highcharts/exporting.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored Jun 16, 2011
28 $GLOBALS['js_include'][] = 'canvg/canvg.js';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
29 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
30 $GLOBALS['js_include'][] = 'jquery/timepicker.js';
31
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in librari…
ammaryasir authored May 31, 2011
32
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
33 /**
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored Aug 3, 2011
34 * Handle AJAX request for data row on point select
35 * @var post_params Object containing parameters for the POST request
36 */
37
38 if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) {
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
39 $extra_data = array();
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
40 $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`'
41 . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
42 $result = PMA_DBI_query($row_info_query . ";", null, PMA_DBI_QUERY_STORE);
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored Aug 3, 2011
43 $fields_meta = PMA_DBI_get_fields_meta($result);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
44 while ($row = PMA_DBI_fetch_assoc($result)) {
45 $extra_data['row_info'] = $row;
46 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
47 PMA_ajaxResponse(null, true, $extra_data);
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored Aug 3, 2011
48 }
49
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored Jul 10, 2011
50 $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaThemeImage);
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
51 /**
52 * Not selection yet required -> displays the selection form
53 */
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
54
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
55 // Gets some core libraries
56 require_once './libraries/tbl_common.php';
57 $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
58
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
59 /**
60 * Gets tables informations
61 */
62 require_once './libraries/tbl_info.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
63
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
64 /**
65 * Displays top menu links
66 */
67 require_once './libraries/tbl_links.inc.php';
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored Aug 3, 2011
68
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
69 if (! isset($goto)) {
70 $goto = $GLOBALS['cfg']['DefaultTabTable'];
71 }
72 // Defines the url to return to in case of error in the next sql statement
73 $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
74
75 // Gets the list and number of fields
76
347fca5 @nijel Use same order of database and table params as elsewhere
nijel authored Aug 25, 2011
77 list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($db, $table);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
78 $fields_cnt = count($fields_list);
79
80 // retrieve keys into foreign fields, if any
81 // check also foreigners even if relwork is FALSE (to get
82 // foreign keys from innodb)
83 $foreigners = PMA_getForeigners($db, $table);
84 $flag = 1;
85 $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
86 if (! isset($zoom_submit) && ! isset($inputs)) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
87 $dataLabel = PMA_getDisplayField($db, $table);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
88 }
89 ?>
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored Jul 10, 2011
90 <div id="sqlqueryresults"></div>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
91 <fieldset id="fieldset_subtab">
92 <?php
93 $url_params = array();
94 $url_params['db'] = $db;
95 $url_params['table'] = $table;
a06d689 @lem9 Avoid duplicate ids
lem9 authored Aug 26, 2011
96 echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2');
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
97
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
98 /**
99 * Set the field name,type,collation and whether null on select of a coulmn
100 */
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
101 if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) {
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored Jun 1, 2011
102 $flag = 2;
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
103 for ($i = 0 ; $i < 4 ; $i++) {
104 if ($inputs[$i] != 'pma_null') {
105 $key = array_search($inputs[$i], $fields_list);
106 $tbl_fields_type[$i] = $fields_type[$key];
107 $tbl_fields_collation[$i] = $fields_collation[$key];
108 $tbl_fields_null[$i] = $fields_null[$key];
109 }
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored May 31, 2011
110 }
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
111 }
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored Aug 3, 2011
112
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
113 /*
114 * Form for input criteria
115 */
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 9, 2011
116
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored Jun 6, 2011
117 ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
118 <form method="post" action="tbl_zoom_select.php" name="insertForm" id="zoom_search_form"
119 <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
120 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
121 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
122 <input type="hidden" name="back" value="tbl_zoom_select.php" />
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
123 <input type="hidden" name="flag" id="id_flag" value="<?php echo $flag; ?>" />
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
124
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored Jul 1, 2011
125 <fieldset id="inputSection">
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored Jun 5, 2011
126
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored Jul 25, 2011
127 <legend><?php echo __('Do a "query by example" (wildcard: "%") for two different columns') ?></legend>
eaea003 @ammaryasir Added some features
ammaryasir authored Jun 20, 2011
128 <table class="data">
129 <?php echo PMA_tbl_setTableHeader();?>
130 <tbody>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
131 <?php
132 $odd_row = true;
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
133
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
134 for ($i = 0; $i < 4; $i++) {
135 if ($i == 2) {
136 echo "<tr><td>";
eaea003 @ammaryasir Added some features
ammaryasir authored Jun 20, 2011
137 echo __("Additional search criteria");
56a73a4 @lem9 XHTML problems
lem9 authored Sep 17, 2011
138 echo "</td></tr>";
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
139 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
140 ?>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
141 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
142 <th><select name="inputs[]" id="<?php echo 'tableid_' . $i; ?>" >
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
143 <option value="<?php echo 'pma_null'; ?>"><?php echo __('None'); ?></option>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
144 <?php
145 for ($j = 0 ; $j < $fields_cnt ; $j++) {
146 if (isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])) {?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
147 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
148 <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
149 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
150 } else { ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
151 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>">
152 <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
153 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
154 }
155 } ?>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
156 </select></th>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
157 <td><?php if (isset($tbl_fields_type[$i])) echo $tbl_fields_type[$i]; ?></td>
158 <td><?php if (isset($tbl_fields_collation[$i])) echo $tbl_fields_collation[$i]; ?></td>
159 <td>
160 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
161 if (isset($inputs) && $inputs[$i] != 'pma_null') { ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
162 <select name="zoomFunc[]">
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
163 <?php
164 if (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
165 foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
166 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == htmlspecialchars($fc)) {
167 echo "\n" . ' '
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
168 . '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
169 . htmlspecialchars($fc) . '</option>';
170 } else {
171 echo "\n" . ' '
172 . '<option value="' . htmlspecialchars($fc) . '">'
173 . htmlspecialchars($fc) . '</option>';
174 }
175 }
176 } elseif (preg_match('@char|blob|text|set@i', $tbl_fields_type[$i])) {
177 foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
178 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
179 echo "\n" . ' '
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
180 . '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
181 . htmlspecialchars($fc) . '</option>';
182 } else {
183 echo "\n" . ' '
184 . '<option value="' . htmlspecialchars($fc) . '">'
185 . htmlspecialchars($fc) . '</option>';
186 }
187 }
188 } else {
189 foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
190 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
191 echo "\n" . ' '
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
192 . '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
193 . htmlspecialchars($fc) . '</option>';
194 } else {
195 echo "\n" . ' '
196 . '<option value="' . htmlspecialchars($fc) . '">'
197 . htmlspecialchars($fc) . '</option>';
198 }
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
199 }
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
200 } // end if... else...
201
202 if ($tbl_fields_null[$i]) {
203 foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
204 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
205 echo "\n" . ' '
471e10a @lem9 Fix some of the XHTML problems
lem9 authored Aug 23, 2011
206 . '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
207 . htmlspecialchars($fc) . '</option>';
208 } else {
209 echo "\n" . ' '
210 . '<option value="' . htmlspecialchars($fc) . '">'
211 . htmlspecialchars($fc) . '</option>';
212 }
213 }
214 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
215 ?>
216 </select>
217 </td>
218 <td>
219 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
220 $field = $inputs[$i];
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
221
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
222 $foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
223 if (isset($fields)) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
224 echo PMA_getForeignFields_Values(
225 $foreigners, $foreignData, $field, $tbl_fields_type, $i, $db,
226 $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], $fields
227 );
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
228 } else {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
229 echo PMA_getForeignFields_Values(
230 $foreigners, $foreignData, $field, $tbl_fields_type, $i, $db,
231 $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], ''
232 );
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in librari…
ammaryasir authored May 31, 2011
233 }
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
234 } else { ?>
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
235
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
236 </td><td></td>
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored May 31, 2011
237
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
238 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
239 } ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
240
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
241 </tr>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
242 <tr><td>
243 <input type="hidden" name="types[<?php echo $i; ?>]" id="types_<?php echo $i; ?>"
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
244 value="<?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?>" />
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
245 <input type="hidden" name="collations[<?php echo $i; ?>]"
246 value="<?php if(isset($tbl_fields_collation[$i]))echo $tbl_fields_collation[$i]; ?>" />
247 </td></tr>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
248
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
249 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
250 }//end for
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
251 ?>
dc35ecf @lem9 XHTML problems
lem9 authored Sep 17, 2011
252 </tbody>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
253 </table>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
254
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
255 <?php
256 /*
257 * Other inputs like data label and mode go after selection of column criteria
258 */
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored Jul 15, 2011
259
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored Aug 23, 2011
260 //Set default datalabel if not selected
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
261 if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
262 if ($dataLabel == '') {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
263 $dataLabel = PMA_getDisplayField($db, $table);
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored Jul 14, 2011
264 }
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
265 }
266 ?>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored Aug 1, 2011
267 <table class="data">
dc35ecf @lem9 XHTML problems
lem9 authored Sep 17, 2011
268 <tr><td><label for="dataLabel"><?php echo __("Data Label"); ?></label></td>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
269 <td><select name="dataLabel" id='dataLabel' >
270 <option value = ''> <?php echo __('None'); ?> </option>
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
271 <?php
272 for ($j = 0; $j < $fields_cnt; $j++) {
273 if (isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
274 ?>
275 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
276 <?php echo htmlspecialchars($fields_list[$j]);?></option>
277 <?php
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
278 } else {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
279 ?>
280 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" >
281 <?php echo htmlspecialchars($fields_list[$j]);?></option>
282 <?php
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
283 }
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
284 }
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
285 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
286 </select>
287 </td></tr>
9e566cd @lem9 Other XHTML fixes
lem9 authored Aug 23, 2011
288 <tr><td><label for="maxRowPlotLimit"><?php echo __("Maximum rows to plot"); ?></label></td>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored Aug 1, 2011
289 <td>
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
290 <?php
9e566cd @lem9 Other XHTML fixes
lem9 authored Aug 23, 2011
291 echo '<input type="text" name="maxPlotLimit" id="maxRowPlotLimit" value="';
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
292 if (! empty($maxPlotLimit)) {
d630321 @lem9 Missing HTML escape
lem9 authored Sep 7, 2011
293 echo htmlspecialchars($maxPlotLimit);
9e566cd @lem9 Other XHTML fixes
lem9 authored Aug 23, 2011
294 } else {
295 echo $GLOBALS['cfg']['maxRowPlotLimit'];
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
296 }
9e566cd @lem9 Other XHTML fixes
lem9 authored Aug 23, 2011
297 echo '" /></td></tr>';
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
298 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored Jun 8, 2011
299 </table>
64425cc @ammaryasir Fixed some issues and added support for plotting strings
ammaryasir authored Jun 10, 2011
300
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
301 </fieldset>
302 <fieldset class="tblFooters">
303 <input type="hidden" name="max_number_of_fields"
304 value="<?php echo $fields_cnt; ?>" />
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored Jul 25, 2011
305 <input type="submit" name="zoom_submit" id="inputFormSubmitId" value="<?php echo __('Go'); ?>" />
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
306 </fieldset>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
307 </form>
dc35ecf @lem9 XHTML problems
lem9 authored Sep 17, 2011
308 </fieldset>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
309
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
310 <?php
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
311
312 /*
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
313 * Handle the input criteria and generate the query result
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
314 * Form for displaying query results
315 */
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
316 if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' && $inputs[0] != $inputs[1]) {
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored Jul 1, 2011
317
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
318 /*
319 * Query generation part
320 */
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
321 $w = $data = array();
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
322 $sql_query = 'SELECT *';
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored Jul 1, 2011
323
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
324 //Add the table
325 $sql_query .= ' FROM ' . PMA_backquote($table);
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
326 for ($i = 0; $i < 4; $i++) {
327 if ($inputs[$i] == 'pma_null') {
328 continue;
329 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
330 $tmp = array();
331 // The where clause
332 $charsets = array();
333 $cnt_func = count($zoomFunc[$i]);
334 $func_type = $zoomFunc[$i];
335 list($charsets[$i]) = explode('_', $collations[$i]);
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
336 $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type])
337 && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1)
338 ? true
339 : false;
340 $whereClause = PMA_tbl_search_getWhereClause(
341 $fields[$i], $inputs[$i], $types[$i],
342 $collations[$i], $func_type, $unaryFlag
343 );
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
344 if ($whereClause) {
345 $w[] = $whereClause;
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
346 }
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
347 } // end for
348 if ($w) {
349 $sql_query .= ' WHERE ' . implode(' AND ', $w);
350 }
351 $sql_query .= ' LIMIT ' . $maxPlotLimit;
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored Jul 14, 2011
352
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
353 /*
354 * Query execution part
355 */
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
356 $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE);
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored Jul 10, 2011
357 $fields_meta = PMA_DBI_get_fields_meta($result);
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
358 while ($row = PMA_DBI_fetch_assoc($result)) {
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored Jul 10, 2011
359 //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
360 $tmpRow = array();
361 foreach ($row as $val) {
362 $tmpRow[] = $val;
363 }
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored Jul 10, 2011
364 //Get unique conditon on each row (will be needed for row update)
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
365 $uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true);
e3cb99d @ammaryasir Added better support for datetime fields
ammaryasir authored Aug 12, 2011
366
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
367 //Append it to row array as where_clause
368 $row['where_clause'] = $uniqueCondition[0];
369 if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
370 $data[] = array(
371 $inputs[0] => $row[$inputs[0]],
372 $inputs[1] => $row[$inputs[1]],
373 'where_clause' => $uniqueCondition[0]
374 );
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
375 } elseif ($dataLabel) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
376 $data[] = array(
377 $inputs[0] => $row[$inputs[0]],
378 $inputs[1] => $row[$inputs[1]],
379 $dataLabel => $row[$dataLabel],
380 'where_clause' => $uniqueCondition[0]
381 );
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
382 } else {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
383 $data[] = array(
384 $inputs[0] => $row[$inputs[0]],
385 $inputs[1] => $row[$inputs[1]],
386 $dataLabel => '',
387 'where_clause' => $uniqueCondition[0]
388 );
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
389 }
6f619e4 @nijel Whitespace cleanup
nijel authored Aug 13, 2011
390 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
391 /*
392 * Form for displaying point data and also the scatter plot
393 */
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
394 ?>
395 <form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form"
396 <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
397 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
398 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
399 <input type="hidden" name="back" value="tbl_zoom_select.php" />
400
401 <fieldset id="displaySection">
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
402 <legend><?php echo __('Browse/Edit the points') ?></legend>
403 <center>
404 <?php
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
405 //JSON encode the data(query result)
406 if (isset($zoom_submit) && ! empty($data)) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
407 ?>
408 <div id='resizer' style="width:600px;height:400px">
409 <center><a href="#" onClick="displayHelp();"><?php echo __('How to use'); ?></a></center>
410 <div id="querydata" style="display:none">
411 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
412 echo json_encode($data);
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
413 ?>
414 </div>
415 <div id="querychart" style="float:right"></div>
416 </div>
417 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
418 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
419 ?>
420 </center>
421 <fieldset id='dataDisplay' style="display:none">
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
422 <fieldset>
423 <table class="data">
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
424 <thead>
425 <tr>
426 <th> <?php echo __('Column'); ?> </th>
427 <th> <?php echo __('Null'); ?> </th>
428 <th> <?php echo __('Value'); ?> </th>
429 </tr>
430 </thead>
431 <tbody>
432 <?php
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
433 $odd_row = true;
434 for ($i = 4; $i < $fields_cnt + 4; $i++) {
435 $tbl_fields_type[$i] = $fields_type[$i - 4];
436 $fieldpopup = $fields_list[$i - 4];
437 $foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
438 ?>
439 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
440 <th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th>
441 <th><?php echo '<input type="checkbox" class="checkbox_null" name="fields_null[ '
442 . $i . ' ]" id="fields_null_id_' . $i . '" />'; ?>
443 </th>
444 <th> <?php
445 echo PMA_getForeignFields_Values(
446 $foreigners, $foreignData, $fieldpopup, $tbl_fields_type,
447 $i, $db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], ''
448 ); ?>
449 </th>
450 </tr>
451 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored Aug 25, 2011
452 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
453 ?>
454 </tbody>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
455 </table>
456 </fieldset>
457 <fieldset class="tblFooters">
6cc3ff4 @ammaryasir Data point content is now displayed as a dialog box which opens on cl…
ammaryasir authored Jul 22, 2011
458 <input type="submit" id="submitForm" name="edit_point" value="<?php echo __('Submit'); ?>" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
459 </fieldset>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
460 </fieldset>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
461 </fieldset>
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and …
ammaryasir authored Jul 7, 2011
462 <input type="hidden" id="queryID" name="sql_query" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored Jul 4, 2011
463 </form>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored Sep 17, 2011
464 <?php
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and …
ammaryasir authored Jul 7, 2011
465 }
0bf475b @lem9 Coding style
lem9 authored Aug 23, 2011
466 require './libraries/footer.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored May 26, 2011
467 ?>
Something went wrong with that request. Please try again.