Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-06-05 12:40:11 +02:00
commit 98a79d2c42
5 changed files with 103 additions and 47 deletions

View File

@ -12,11 +12,14 @@
+ rfe #3078542 Remember the last sort order for each table
+ AJAX for Create table in navigation panel
+ rfe #3310562 Wording about Column
+ AJAX for Add a user in Database privileges
3.4.3.0 (not yet released)
- bug #3311170 [sync] Missing helper icons in Synchronize
- patch #3304473 [setup] Redefine a lable that was wrong
- bug #3304544 [parser] master is not a reserved word
- bug #3307616 [edit] Inline edit updates multiple duplicate rows
- patch #3311539 [edit] Inline edit does not escape backslashes
3.4.2.0 (not yet released)
- bug #3301249 [interface] Iconic table operations does not remove inline edit label

View File

@ -79,6 +79,9 @@ $js_messages['strCreateTable'] = __('Create Table');
$js_messages['strYes'] = __('Yes');
$js_messages['strNo'] = __('No');
/* For db_stucture.js */
$js_messages['strInsertTable'] = __('Insert Table');
/* For db_search.js */
$js_messages['strSearching'] = __('Searching');
$js_messages['strHideSearchResults'] = __('Hide search results');

View File

@ -154,7 +154,7 @@ $(document).ready(function() {
*
* @see PMA_ajaxShowMessage()
* @see appendNewUser()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @memberOf jQuery
* @name add_user_click
*
@ -176,14 +176,14 @@ $(document).ready(function() {
*/
var $form = $(this).find("form[name=usersForm]").last();
if( ! checkAddUser($form.get(0)) ) {
if (! checkAddUser($form.get(0))) {
PMA_ajaxShowMessage(PMA_messages['strFormEmpty']);
return false;
}
//We also need to post the value of the submit button in order to get this to work correctly
$.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function(data) {
if(data.success == true) {
if (data.success == true) {
$("#add_user_dialog").dialog("close").remove();
PMA_ajaxShowMessage(data.message);
$("#topmenucontainer")
@ -191,20 +191,58 @@ $(document).ready(function() {
.remove()
.end()
.after(data.sql_query);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
var $notice_class = $("#topmenucontainer").next("div").find('.notice');
if($notice_class.text() == '') {
$notice_class.remove();
}
appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
var $notice_class = $("#topmenucontainer").next("div").find('.notice');
if ($notice_class.text() == '') {
$notice_class.remove();
}
if ($('#fieldset_add_user a.ajax').attr('name') == 'db_specific') {
/*process the fieldset_add_user attribute and get the val of privileges*/
var url = $('#fieldset_add_user a.ajax').attr('val');
if (url.substring(url.length - 23, url.length) == "&goto=db_operations.php") {
url = url.substring(0, url.length - 23);
}
url = url + "&ajax_request=true&db_specific=true";
/* post request for get the updated userForm table */
$.post($form.attr('action' ), url, function(priv_data) {
/*Remove the old userForm table*/
if ($('#userFormDiv').length != 0) {
$('#userFormDiv').remove();
} else {
$("#usersForm").remove();
}
var user_div = $('<div id="userFormDiv"></div>');
/*If the JSON string parsed correctly*/
if (typeof priv_data.success != 'undefined') {
if (priv_data.success == true) {
user_div
.html(priv_data.user_form)
.insertAfter('#result_query');
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, "7000");
}
} else {
/*parse the JSON string*/
var obj = $.parseJSON(priv_data);
user_div
.html(obj.user_form)
.insertAfter('#result_query');
}
});
} else {
appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string);
}
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000");
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, "7000");
}
})
};
button_options[PMA_messages['strCancel']] = function() {$(this).dialog("close").remove();}
button_options[PMA_messages['strCancel']] = function() { $(this).dialog("close").remove(); }
$.get($(this).attr("href"), {'ajax_request':true}, function(data) {
$('<div id="add_user_dialog"></div>')
@ -224,7 +262,7 @@ $(document).ready(function() {
buttons: button_options
}); //dialog options end
displayPasswordGenerateButton();
PMA_ajaxRemoveMessage($msgbox);
PMA_ajaxRemoveMessage($msgbox);
}); // end $.get()
});//end of Add New User AJAX event handler
@ -234,7 +272,7 @@ $(document).ready(function() {
* Ajax event handler for 'Reload Privileges' anchor
*
* @see PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @memberOf jQuery
* @name reload_privileges_click
*/
@ -258,7 +296,7 @@ $(document).ready(function() {
* AJAX handler for 'Revoke User'
*
* @see PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @memberOf jQuery
* @name revoke_user_click
*/
@ -268,7 +306,7 @@ $(document).ready(function() {
PMA_ajaxShowMessage(PMA_messages['strRemovingSelectedUsers']);
$form = $("#usersForm");
$.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).attr('value') + "&ajax_request=true", function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
@ -309,7 +347,7 @@ $(document).ready(function() {
* Step 1: Load Edit User Dialog
* @memberOf jQuery
* @name edit_user_click
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
*/
$(".edit_user_anchor.ajax").live('click', function(event) {
/** @lends jQuery */
@ -334,15 +372,15 @@ $(document).ready(function() {
buttons: button_options
}); //dialog options end
displayPasswordGenerateButton();
PMA_ajaxRemoveMessage($msgbox);
PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()
})
/**
* Step 2: Submit the Edit User Dialog
*
*
* @see PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @memberOf jQuery
* @name edit_user_submit
*/
@ -368,7 +406,7 @@ $(document).ready(function() {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
//Close the jQueryUI dialog
$("#edit_user_dialog").dialog("close").remove();
@ -422,7 +460,7 @@ $(document).ready(function() {
* AJAX handler for 'Export Privileges'
*
* @see PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @memberOf jQuery
* @name export_user_click
*/
@ -445,7 +483,7 @@ $(document).ready(function() {
width : 500,
buttons: button_options
});
PMA_ajaxRemoveMessage($msgbox);
PMA_ajaxRemoveMessage($msgbox);
}) //end $.get
}) //end export privileges
@ -453,7 +491,7 @@ $(document).ready(function() {
* AJAX handler to Paginate the Users Table
*
* @see PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
* @see $cfg['AjaxEnable']
* @name paginate_users_table_click
* @memberOf jQuery
*/
@ -476,7 +514,7 @@ $(document).ready(function() {
})// end of the paginate users table
/*
* Additional confirmation dialog after clicking
* Additional confirmation dialog after clicking
* 'Drop the databases...'
*/
$('#checkbox_drop_users_db').click(function() {

View File

@ -944,9 +944,14 @@ $(document).ready(function() {
//Remove the last ',' appended in the above loop
sql_query = sql_query.replace(/,\s$/, '');
//Fix non-escaped backslashes
sql_query = sql_query.replace(/\\/g, '\\\\');
new_clause = new_clause.substring(0, new_clause.length-5);
new_clause = PMA_urlencode(new_clause);
sql_query += ' WHERE ' + PMA_urldecode(where_clause);
// Avoid updating more than one row in case there is no primary key
// (happened only for duplicate rows)
sql_query += ' LIMIT 1';
/**
* @var rel_fields_list String, url encoded representation of {@link relations_fields}
*/

View File

@ -1358,7 +1358,7 @@ $link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="s
* If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges,
* show $message and exit.
*/
if( $GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog'])) {
if( $GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog']) && ! isset($_REQUEST['db_specific'])) {
if(isset($sql_query)) {
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
@ -2140,7 +2140,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. '</form>' . "\n";
} else {
// check the privileges for a particular database.
echo '<form id="usersForm"><table id="dbspecificuserrights" class="data">' . "\n"
$user_form = '<form id="usersForm"><table id="dbspecificuserrights" class="data">' . "\n"
. '<caption class="tblHeaders">' . "\n"
. PMA_getIcon('b_usrcheck.png')
. ' ' . sprintf(__('Users having access to &quot;%s&quot;'), '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n"
@ -2235,29 +2235,29 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
$current_privileges[] = $row;
$row = PMA_DBI_fetch_assoc($res);
}
echo ' <tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
$user_form .= ' <tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td';
if (count($current_privileges) > 1) {
echo ' rowspan="' . count($current_privileges) . '"';
$user_form .= ' rowspan="' . count($current_privileges) . '"';
}
echo '>' . (empty($current_user) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($current_user)) . "\n"
$user_form .= '>' . (empty($current_user) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($current_user)) . "\n"
. ' </td>' . "\n"
. ' <td';
if (count($current_privileges) > 1) {
echo ' rowspan="' . count($current_privileges) . '"';
$user_form .= ' rowspan="' . count($current_privileges) . '"';
}
echo '>' . htmlspecialchars($current_host) . '</td>' . "\n";
$user_form .= '>' . htmlspecialchars($current_host) . '</td>' . "\n";
foreach ($current_privileges as $current) {
echo ' <td>' . "\n"
$user_form .= ' <td>' . "\n"
. ' ';
if (! isset($current['Db']) || $current['Db'] == '*') {
echo __('global');
$user_form .= __('global');
} elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) {
echo __('database-specific');
$user_form .= __('database-specific');
} else {
echo __('wildcard'), ': <tt>' . htmlspecialchars($current['Db']) . '</tt>';
$user_form .= __('wildcard'). ': <tt>' . htmlspecialchars($current['Db']) . '</tt>';
}
echo "\n"
$user_form .= "\n"
. ' </td>' . "\n"
. ' <td>' . "\n"
. ' <tt>' . "\n"
@ -2268,11 +2268,11 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. ' ' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . "\n"
. ' </td>' . "\n"
. ' <td>' . "\n";
printf($link_edit, urlencode($current_user),
$user_form .= sprintf($link_edit, urlencode($current_user),
urlencode($current_host),
urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']),
'');
echo '</td>' . "\n"
$user_form .= '</td>' . "\n"
. ' </tr>' . "\n";
}
if (empty($row) && empty($row1) && empty($row2)) {
@ -2281,21 +2281,28 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
$odd_row = ! $odd_row;
}
} else {
echo ' <tr class="odd">' . "\n"
$user_form .= ' <tr class="odd">' . "\n"
. ' <td colspan="6">' . "\n"
. ' ' . __('No user found.') . "\n"
. ' </td>' . "\n"
. ' </tr>' . "\n";
}
echo '</tbody>' . "\n"
$user_form .= '</tbody>' . "\n"
. '</table></form>' . "\n";
// Offer to create a new user for the current database
echo '<fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . htmlspecialchars($checkprivs) .'">' . "\n"
. PMA_getIcon('b_usradd.png')
. ' ' . __('Add a new User') . '</a>' . "\n"
. '</fieldset>' . "\n";
if($GLOBALS['is_ajax_request'] == true){
$extra_data['user_form'] = $user_form;
$message = PMA_Message::success(__('New user has been added.'));
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}else{
// Offer to create a new user for the current database
$user_form .= '<fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . htmlspecialchars($checkprivs) .'" val="'.'checkprivs='.htmlspecialchars($checkprivs). '&'.$GLOBALS['url_query'] . '" class="'.$conditional_class.'" name="db_specific">' . "\n"
. PMA_getIcon('b_usradd.png')
. ' ' . __('Add a new User') . '</a>' . "\n"
. '</fieldset>' . "\n";
echo $user_form ;
}
} // end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...