Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-05-07 19:02:22 +02:00
commit 91af39c8f7
3 changed files with 96 additions and 30 deletions

View File

@ -1,6 +1,7 @@
phpMyAdmin - ChangeLog
======================
<<<<<<< HEAD
4.1.0.0 (not yet released)
+ rfe #499 On user creation, warn if the user already exists
+ Use indeterminate check all checkbox in server privileges
@ -9,6 +10,7 @@ phpMyAdmin - ChangeLog
+ [interface] Make warning about existing config directory clearer
+ rfe #1414 Allow specifying controlport
+ PMA_DBI functions in database interface libraries renamed to be compliant with PEAR standards
+ rfe #1412 Creating a view from an empty set of results
4.0.1.0 (not yet released)
- bug #3879 Import broken for CSV using LOAD DATA

View File

@ -5136,12 +5136,70 @@ class PMA_DisplayResults
} // end of the '_getPlacedTableNavigations()' function
/**
* Generates HTML to display the Create view in span tag
*
* @param array $analyzed_sql the analyzed Query
* @param string $url_query String with URL Parameters
*
* @return string
*
* @access private
*
* @see _getResultsOperations()
*/
private function _getLinkForCreateView($analyzed_sql, $url_query)
{
$results_operations_html = '';
if (!PMA_DRIZZLE && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
$ajax_class = ' ajax';
$results_operations_html .= '<span>'
. PMA_Util::linkOrButton(
'view_create.php' . $url_query,
PMA_Util::getIcon(
'b_views.png', __('Create view'), true
),
array('class' => 'create_view' . $ajax_class), true, true, ''
)
. '</span>' . "\n";
}
return $results_operations_html;
}
/**
* Calls the _getResultsOperations with $only_view as true
*
* @param array $analyzed_sql the analyzed Query
*
* @return string
*
* @access public
*
*/
public function getCreateViewQueryResultOp($analyzed_sql)
{
$results_operations_html = '';
$fake_display_mode = array();
//calling to _getResultOperations with a fake display mode
//and setting only_view parameter to be true to generate just view
$results_operations_html .= $this->_getResultsOperations(
$fake_display_mode,
$analyzed_sql,
true
);
return $results_operations_html;
}
/**
* Get operations that are available on results.
*
* @param array $the_disp_mode the display mode
* @param array $analyzed_sql the analyzed query
* @param array $the_disp_mode the display mode
* @param array $analyzed_sql the analyzed query
* @param boolean $only_view Whether to show only view
*
* @return string $results_operations_html html content
*
@ -5149,31 +5207,42 @@ class PMA_DisplayResults
*
* @see getTable()
*/
private function _getResultsOperations($the_disp_mode, $analyzed_sql)
private function _getResultsOperations(
$the_disp_mode, $analyzed_sql, $only_view = false
)
{
$results_operations_html = '';
$fields_meta = $this->__get('fields_meta'); // To safe use in foreach
$header_shown = false;
$header = '<fieldset><legend>' . __('Query results operations')
. '</legend>';
if (($the_disp_mode[6] == '1') || ($the_disp_mode[9] == '1')) {
// Displays "printable view" link if required
if ($the_disp_mode[9] == '1') {
if (!$header_shown) {
$results_operations_html .= $header;
$header_shown = true;
}
$_url_params = array(
$_url_params = array(
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'printview' => '1',
'sql_query' => $this->__get('sql_query'),
);
$url_query = PMA_generate_common_url($_url_params);
$url_query = PMA_generate_common_url($_url_params);
if (!$header_shown) {
$results_operations_html .= $header;
$header_shown = true;
}
// if empty result set was produced we need to
// show only view and not other options
if ($only_view == true) {
$results_operations_html .= $this->_getLinkForCreateView($analyzed_sql,$url_query);
if ($header_shown) {
$results_operations_html .= '</fieldset><br />';
}
return $results_operations_html;
}
if (($the_disp_mode[6] == '1') || ($the_disp_mode[9] == '1')) {
// Displays "printable view" link if required
if ($the_disp_mode[9] == '1') {
$results_operations_html
.= PMA_Util::linkOrButton(
@ -5317,20 +5386,7 @@ class PMA_DisplayResults
$header_shown = true;
}
if (!PMA_DRIZZLE && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
$ajax_class = ' ajax';
$results_operations_html .= '<span>'
. PMA_Util::linkOrButton(
'view_create.php' . $url_query,
PMA_Util::getIcon(
'b_views.png', __('Create view'), true
),
array('class' => 'create_view' . $ajax_class), true, true, ''
)
. '</span>' . "\n";
}
$results_operations_html .= $this->_getLinkForCreateView($analyzed_sql,$url_query);
if ($header_shown) {
$results_operations_html .= '</fieldset><br />';

View File

@ -872,6 +872,14 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$response->isSuccess($message->isSuccess());
// No need to manually send the message
// The Response class will handle that automatically
$query__type = PMA_DisplayResults::QUERY_TYPE_SELECT;
if ($analyzed_sql[0]['querytype'] == $query__type) {
$createViewHTML = $displayResultsObject->getCreateViewQueryResultOp(
$analyzed_sql
);
$response->addHTML($createViewHTML.'<br />');
}
$response->addJSON(isset($extra_data) ? $extra_data : array());
if (empty($_REQUEST['ajax_page_request'])) {
$response->addJSON('message', $message);