diff --git a/ChangeLog b/ChangeLog
index 205e19866b..7a14f69867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -50,7 +50,7 @@ VerboseMultiSubmit, ReplaceHelpImg
- bug #3527531 [interface] GC-maxlifetime warning incorrectly displayed
- bug #3526916 [interface] Search fails with JS error when tooltips disabled
-3.5.2.0 (not yet released)
+3.5.2.0 (2012-07-07)
- bug #3521416 [interface] JS error when editing index
- bug #3521313 [core] Call to undefined function __()
- bug #3521016 [edit] NOW() function incorrectly selected
diff --git a/db_qbe.php b/db_qbe.php
index f27bd1f1b8..7ed278204b 100644
--- a/db_qbe.php
+++ b/db_qbe.php
@@ -40,6 +40,15 @@ foreach (array_keys($_POST) as $post_key) {
}
}
}
+/**
+ * Initialize some more global variables
+ */
+$GLOBALS['curField'] = array();
+$GLOBALS['curSort'] = array();
+$GLOBALS['curShow'] = array();
+$GLOBALS['curCriteria'] = array();
+$GLOBALS['curAndOrRow'] = array();
+$GLOBALS['curAndOrCol'] = array();
/**
* Gets the relation settings
@@ -170,32 +179,393 @@ $realwidth = $form_column_width . 'ex';
*/
/**
- * Enter description here...
+ * Provides select options list containing column names
*
- * @param array $columns
- * @param integer $column_number
- * @param string $selected
+ * @param array $columns All Column Names
+ * @param integer $column_number Column Number (0,1,2) or more
+ * @param string $selected Selected criteria column name
+ *
+ * @return HTML for select options
*/
function showColumnSelectCell($columns, $column_number, $selected = '')
{
- ?>
-
- |
- ';
+ $html_output .= '';
+ return $html_output;
+}
+
+/**
+ * Provides select options list containing sort options (ASC/DESC)
+ *
+ * @param integer $column_number Column Number (0,1,2) or more
+ * @param string $realwidth Largest column width found
+ * @param string $asc_selected Selected criteria 'Ascending'
+ * @param string $desc_selected Selected criteria 'Descending'
+ *
+ * @return HTML for select options
+ */
+function getSortSelectCell($column_number, $realwidth, $asc_selected = '',
+ $desc_selected = '')
+{
+ $html_output = '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= ' | ';
+ return $html_output;
+}
+
+/**
+ * Provides search form's row containing column select options
+ *
+ * @param array $criteria_column_count Number of criteria columns
+ * @param integer $columns All column names
+ * @param string $ins_col If a new criteria column is needed
+ * @param string $del_col If a criteria column is to be deleted
+ *
+ * @return HTML for search table's row
+ */
+function PMA_dbQbegetColumnNamesRow(
+ $criteria_column_count, $columns, $ins_col = null, $del_col = null
+) {
+ $html_output = '';
+ $html_output .= '| ' . __('Column') . ': | ';
+ $z = 0;
+ for ($column_index = 0; $column_index < $criteria_column_count; $column_index++)
+ {
+ if (isset($ins_col[$column_index]) && $ins_col[$column_index] == 'on') {
+ $html_output .= showColumnSelectCell($columns, $z);
+ $z++;
+ }
+ if (! empty($del_col) && isset($del_col[$column_index]) && $del_col[$column_index] == 'on') {
+ continue;
+ }
+ $selected = '';
+ if (isset($_REQUEST['Field'][$column_index])) {
+ $selected = $_REQUEST['Field'][$column_index];
+ $GLOBALS['curField'][$z] = $_REQUEST['Field'][$column_index];
+ }
+ $html_output .= showColumnSelectCell($columns, $z, $selected);
+ $z++;
+ } // end for
+ $html_output .= '
';
+ return $html_output;
+}
+
+/**
+ * Provides search form's row containing sort(ASC/DESC) select options
+ *
+ * @param array $criteria_column_count Number of criteria columns
+ * @param string $realwidth Largest column width found
+ * @param string $ins_col If a new criteria column is needed
+ * @param string $del_col If a criteria column is to be deleted
+ *
+ * @return HTML for search table's row
+ */
+function PMA_dbQbegetSortRow(
+ $criteria_column_count, $realwidth, $ins_col = null, $del_col = null
+) {
+ $html_output = '';
+ $html_output .= '| ' . __('Sort') . ': | ';
+ $z = 0;
+ for ($column_index = 0; $column_index < $criteria_column_count; $column_index++)
+ {
+ if (! empty($ins_col) && isset($ins_col[$column_index]) && $ins_col[$column_index] == 'on') {
+ $html_output .= getSortSelectCell($z, $realwidth);
+ $z++;
+ } // end if
+
+ if (! empty($del_col) && isset($del_col[$column_index]) && $del_col[$column_index] == 'on') {
+ continue;
+ }
+ // If they have chosen all fields using the * selector,
+ // then sorting is not available, Fix for Bug #570698
+ if (isset($_REQUEST['Sort'][$column_index]) && isset($_REQUEST['Field'][$column_index])
+ && substr($_REQUEST['Field'][$column_index], -2) == '.*'
+ ) {
+ $_REQUEST['Sort'][$column_index] = '';
+ } //end if
+ // Set asc_selected
+ if (isset($_REQUEST['Sort'][$column_index]) && $_REQUEST['Sort'][$column_index] == 'ASC') {
+ $GLOBALS['curSort'][$z] = $_REQUEST['Sort'][$column_index];
+ $asc_selected = ' selected="selected"';
+ } else {
+ $asc_selected = '';
+ } // end if
+ // Set desc selected
+ if (isset($_REQUEST['Sort'][$column_index]) && $_REQUEST['Sort'][$column_index] == 'DESC') {
+ $GLOBALS['curSort'][$z] = $_REQUEST['Sort'][$column_index];
+ $desc_selected = ' selected="selected"';
+ } else {
+ $desc_selected = '';
+ } // end if
+ $html_output .= getSortSelectCell(
+ $z, $realwidth, $asc_selected, $desc_selected
+ );
+ $z++;
+ } // end for
+ $html_output .= '
';
+ return $html_output;
+}
+
+/**
+ * Provides search form's row containing SHOW checkboxes
+ *
+ * @param array $criteria_column_count Number of criteria columns
+ * @param string $ins_col If a new criteria column is needed
+ * @param string $del_col If a criteria column is to be deleted
+ *
+ * @return HTML for search table's row
+ */
+function PMA_dbQbegetShowRow(
+ $criteria_column_count, $ins_col = null, $del_col = null
+) {
+ $html_output = '';
+ $html_output .= '| ' . __('Show') . ': | ';
+ $z = 0;
+ for ($column_index = 0; $column_index < $criteria_column_count; $column_index++)
+ {
+ if (! empty($ins_col) && isset($ins_col[$column_index]) && $ins_col[$column_index] == 'on') {
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= ' | ';
+ $z++;
+ } // end if
+ if (! empty($del_col) && isset($del_col[$column_index]) && $del_col[$column_index] == 'on') {
+ continue;
+ }
+ if (isset($_REQUEST['Show'][$column_index])) {
+ $checked = ' checked="checked"';
+ $GLOBALS['curShow'][$z] = $_REQUEST['Show'][$column_index];
+ } else {
+ $checked = '';
+ }
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= ' | ';
+ $z++;
+ } // end for
+ $html_output .= '
';
+ return $html_output;
+}
+
+/**
+ * Provides search form's row containing criteria Inputboxes
+ *
+ * @param array $criteria_column_count Number of criteria columns
+ * @param string $realwidth Largest column width found
+ * @param string $criteria Already Filled criteria
+ * @param string $prev_criteria Previously filled criteria(hidden form field)
+ * @param string $ins_col If a new criteria column is needed
+ * @param string $del_col If a criteria column is to be deleted
+ *
+ * @return HTML for search table's row
+ */
+function PMA_dbQbegetCriteriaInputboxRow(
+ $criteria_column_count, $realwidth, $criteria, $prev_criteria,
+ $ins_col = null, $del_col = null
+) {
+ $html_output = '';
+ $html_output .= '| ' . __('Criteria') . ': | ';
+ $z = 0;
+ for ($column_index = 0; $column_index < $criteria_column_count; $column_index++)
+ {
+ if (! empty($ins_col) && isset($ins_col[$column_index]) && $ins_col[$column_index] == 'on') {
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= ' | ';
+ $z++;
+ } // end if
+ if (! empty($del_col) && isset($del_col[$column_index]) && $del_col[$column_index] == 'on') {
+ continue;
+ }
+ if (isset($criteria[$column_index])) {
+ $tmp_criteria = $criteria[$column_index];
+ }
+ if ((empty($prev_criteria) || ! isset($prev_criteria[$column_index]))
+ || $prev_criteria[$column_index] != htmlspecialchars($tmp_criteria)
+ ) {
+ $GLOBALS['curCriteria'][$z] = $tmp_criteria;
+ } else {
+ $GLOBALS['curCriteria'][$z] = $prev_criteria[$column_index];
+ }
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= ' | ';
+ $z++;
+ } // end for
+ $html_output .= '
';
+ return $html_output;
+}
+
+/**
+ * Provides footer options for adding/deleting row/columns
+ *
+ * @param string $type Whether row or column
+ *
+ * @return HTML for footer options
+ */
+function PMA_dbQbeGetFootersOptions($type)
+{
+ $html_output = '';
+ $html_output .= (($type == 'row')
+ ? __('Add/Delete criteria rows') : __('Add/Delete columns'));
+ $html_output .= ':';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '';
+ $html_output .= '
';
+ return $html_output;
+}
+
+/**
+ * Provides search form table's footer options
+ *
+ * @return HTML for table footer
+ */
+function PMA_dbQbeGetTableFooters()
+{
+ $html_output = '';
+ return $html_output;
+}
+
+/**
+ * Provides a select list of database tables
+ *
+ * @param array $table_names Names of all the tables
+ *
+ * @return HTML for table select list
+ */
+function PMA_dbQbeGetTablesList($table_names)
+{
+ $html_output = '';
+ $html_output .= '
';
+ $html_output .= '';
+ $html_output .= '';
+ return $html_output;
+}
+
+/**
+ * Provides And/Or modification cell along with Insert/Delete options
+ * (For modifying search form's table columns)
+ *
+ * @param integer $column_number Column Number (0,1,2) or more
+ * @param array $selected Selected criteria column name
+ *
+ * @return HTML for modification cell
+ */
+function PMA_dbQbeGetAndOrColCell($column_number, $selected = null)
+{
+ $html_output = '';
+ $html_output .= '' . __('Or') . ':';
+ $html_output .= '';
+ $html_output .= ' ' . __('And') . ':';
+ $html_output .= '';
+ $html_output .= ' ' . __('Ins');
+ $html_output .= '';
+ $html_output .= ' ' . __('Del');
+ $html_output .= '';
+ $html_output .= ' | ';
+ return $html_output;
+}
+
+/**
+ * Provides search form's row containing column modifications options
+ * (For modifying search form's table columns)
+ *
+ * @param array $criteria_column_count Number of criteria columns
+ * @param string $realwidth Largest column width found
+ * @param string $criteria Already Filled criteria
+ * @param string $prev_criteria Previously filled criteria(hidden form field)
+ * @param string $ins_col If a new criteria column is needed
+ * @param string $del_col If a criteria column is to be deleted
+ *
+ * @return HTML for search table's row
+ */
+function PMA_dbQbeGetModifyColumnsRow($criteria_column_count, $and_or_col,
+ $ins_col = null, $del_col = null
+) {
+ $html_output = '';
+ $html_output .= '| ' . __('Modify') . ': | ';
+ $z = 0;
+ for ($x = 0; $x < $criteria_column_count; $x++) {
+ if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') {
+ $html_output .= PMA_dbQbeGetAndOrColCell($z);
+ $z++;
+ } // end if
+
+ if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') {
+ continue;
+ }
+
+ if (isset($and_or_col[$x])) {
+ $GLOBALS['curAndOrCol'][$z] = $and_or_col[$x];
+ }
+ if (isset($and_or_col[$x]) && $and_or_col[$x] == 'or') {
+ $chk['or'] = ' checked="checked"';
+ $chk['and'] = '';
+ } else {
+ $chk['and'] = ' checked="checked"';
+ $chk['or'] = '';
+ }
+ $html_output .= PMA_dbQbeGetAndOrColCell($z, $chk);
+ $z++;
+ } // end for
+ $html_output .= '
';
+ return $html_output;
}
if ($cfgRelation['designerwork']) {
@@ -217,172 +587,20 @@ if ($cfgRelation['designerwork']) {