Merge pull request #12003 from ujjwalwahi/issue_11991
Refactor TableSearchController
This commit is contained in:
commit
ec38e05267
@ -181,48 +181,12 @@ class TableSearchController extends TableController
|
||||
->getScripts()
|
||||
->addFile('tbl_find_replace.js');
|
||||
|
||||
// Show secondary level of tabs
|
||||
$this->response->addHTML(
|
||||
Template::get('secondary_tabs')
|
||||
->render(
|
||||
array(
|
||||
'url_params' => array(
|
||||
'db' => $this->db,
|
||||
'table' => $this->table,
|
||||
),
|
||||
'sub_tabs' => $this->_getSubTabs(),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (isset($_POST['replace'])) {
|
||||
$this->replaceAction();
|
||||
}
|
||||
|
||||
if (!isset($goto)) {
|
||||
$goto = Util::getScriptNameForOption(
|
||||
$GLOBALS['cfg']['DefaultTabTable'], 'table'
|
||||
);
|
||||
}
|
||||
|
||||
// Displays the find and replace form
|
||||
$this->response->addHTML(
|
||||
Template::get('table/search/selection_form')
|
||||
->render(
|
||||
array(
|
||||
'searchType' => $this->_searchType,
|
||||
'db' => $this->db,
|
||||
'table' => $this->table,
|
||||
'goto' => $goto,
|
||||
'self' => $this,
|
||||
'geomColumnFlag' => $this->_geomColumnFlag,
|
||||
'columnNames' => $this->_columnNames,
|
||||
'columnTypes' => $this->_columnTypes,
|
||||
'columnCollations' => $this->_columnCollations,
|
||||
'dataLabel' => null,
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->displaySelectionFormAction();
|
||||
break;
|
||||
|
||||
case 'normal':
|
||||
@ -303,17 +267,9 @@ class TableSearchController extends TableController
|
||||
return;
|
||||
}
|
||||
|
||||
$this->url_query .= '&goto=tbl_select.php&back=tbl_select.php';
|
||||
|
||||
// Gets tables information
|
||||
include_once './libraries/tbl_info.inc.php';
|
||||
|
||||
if (!isset($goto)) {
|
||||
$goto = Util::getScriptNameForOption(
|
||||
$GLOBALS['cfg']['DefaultTabTable'], 'table'
|
||||
);
|
||||
}
|
||||
|
||||
//Set default datalabel if not selected
|
||||
if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
|
||||
$dataLabel = PMA_getDisplayField($this->db, $this->table);
|
||||
@ -322,35 +278,7 @@ class TableSearchController extends TableController
|
||||
}
|
||||
|
||||
// Displays the zoom search form
|
||||
$this->response->addHTML(
|
||||
Template::get('secondary_tabs')
|
||||
->render(
|
||||
array(
|
||||
'url_params' => array(
|
||||
'db' => $this->db,
|
||||
'table' => $this->table,
|
||||
),
|
||||
'sub_tabs' => $this->_getSubTabs(),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->response->addHTML(
|
||||
Template::get('table/search/selection_form')
|
||||
->render(
|
||||
array(
|
||||
'searchType' => $this->_searchType,
|
||||
'db' => $this->db,
|
||||
'table' => $this->table,
|
||||
'goto' => $goto,
|
||||
'self' => $this,
|
||||
'geomColumnFlag' => $this->_geomColumnFlag,
|
||||
'columnNames' => $this->_columnNames,
|
||||
'columnTypes' => $this->_columnTypes,
|
||||
'columnCollations' => $this->_columnCollations,
|
||||
'dataLabel' => $dataLabel,
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->displaySelectionFormAction($dataLabel);
|
||||
|
||||
/*
|
||||
* Handle the input criteria and generate the query result
|
||||
@ -361,6 +289,11 @@ class TableSearchController extends TableController
|
||||
&& $_POST['criteriaColumnNames'][1] != 'pma_null'
|
||||
&& $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]
|
||||
) {
|
||||
if (! isset($goto)) {
|
||||
$goto = Util::getScriptNameForOption(
|
||||
$GLOBALS['cfg']['DefaultTabTable'], 'table'
|
||||
);
|
||||
}
|
||||
$this->zoomSubmitAction($dataLabel, $goto);
|
||||
}
|
||||
break;
|
||||
@ -543,7 +476,7 @@ class TableSearchController extends TableController
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function displaySelectionFormAction()
|
||||
public function displaySelectionFormAction($datalabel = null)
|
||||
{
|
||||
$this->url_query .= '&goto=tbl_select.php&back=tbl_select.php';
|
||||
|
||||
@ -579,7 +512,7 @@ class TableSearchController extends TableController
|
||||
'columnNames' => $this->_columnNames,
|
||||
'columnTypes' => $this->_columnTypes,
|
||||
'columnCollations' => $this->_columnCollations,
|
||||
'dataLabel' => null,
|
||||
'dataLabel' => $datalabel,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user