bug #3301249 [interface] Iconic table operations does not remove inline edit label

This commit is contained in:
Madhura Jayaratne
2011-05-17 22:15:58 +05:30
parent 2f2157cf24
commit b091f91f92
7 changed files with 86 additions and 49 deletions

View File

@@ -11,6 +11,7 @@
- bug #3285929 [privileges] Revert temporary fix - bug #3285929 [privileges] Revert temporary fix
- bug #3302872 [synchronize] Synchronize and user name - bug #3302872 [synchronize] Synchronize and user name
- bug #3302733 [core] Some browsers report an insecure https connection - bug #3302733 [core] Some browsers report an insecure https connection
- bug #3301249 [interface] Iconic table operations does not remove inline edit label
3.4.0.0 (2011-05-11) 3.4.0.0 (2011-05-11)
+ rfe #2890226 [view] Enable VIEW rename + rfe #2890226 [view] Enable VIEW rename

View File

@@ -606,7 +606,7 @@ $(document).ready(function() {
*/ */
$('tr.odd:not(.noclick), tr.even:not(.noclick)').live('click',function(e) { $('tr.odd:not(.noclick), tr.even:not(.noclick)').live('click',function(e) {
// do not trigger when clicked on anchor // do not trigger when clicked on anchor
if ($(e.target).is('a, a *')) { if ($(e.target).is('a, img, a *')) {
return; return;
} }
// XXX: FF fires two click events for <label> (label and checkbox), so we need to handle this differently // XXX: FF fires two click events for <label> (label and checkbox), so we need to handle this differently

View File

@@ -86,6 +86,7 @@ $js_messages['strSearching'] = __('Searching');
$js_messages['strHideQueryBox'] = __('Hide query box'); $js_messages['strHideQueryBox'] = __('Hide query box');
$js_messages['strShowQueryBox'] = __('Show query box'); $js_messages['strShowQueryBox'] = __('Show query box');
$js_messages['strInlineEdit'] = __('Inline Edit'); $js_messages['strInlineEdit'] = __('Inline Edit');
$js_messages['strEdit'] = __('Edit');
$js_messages['strSave'] = __('Save'); $js_messages['strSave'] = __('Save');
$js_messages['strHide'] = __('Hide'); $js_messages['strHide'] = __('Hide');

131
js/sql.js
View File

@@ -7,13 +7,14 @@
* *
*/ */
var $data_a;
/** /**
* decode a string URL_encoded * decode a string URL_encoded
* *
* @param string str * @param string str
* @return string the URL-decoded string * @return string the URL-decoded string
*/ */
var data_vt;
function PMA_urldecode(str) { function PMA_urldecode(str) {
return decodeURIComponent(str.replace(/\+/g, '%20')); return decodeURIComponent(str.replace(/\+/g, '%20'));
} }
@@ -81,10 +82,16 @@ function appendInlineAnchor() {
$cloned_tr.find('td') $cloned_tr.find('td')
.addClass('inline_edit_anchor') .addClass('inline_edit_anchor')
.find('a').attr('href', '#') .find('a').attr('href', '#');
.find('span') var $edit_span = $cloned_tr.find('span:contains("' + PMA_messages['strEdit'] + '")');
.text(' ' + PMA_messages['strInlineEdit']) var $span = $cloned_tr.find('a').find('span');
.prepend($img_object); if ($edit_span.length > 0) {
$span.text(' ' + PMA_messages['strInlineEdit']);
$span.prepend($img_object);
} else {
$span.text('');
$span.append($img_object);
}
$cloned_tr.insertAfter($this_tr); $cloned_tr.insertAfter($this_tr);
}); });
@@ -109,14 +116,16 @@ function appendInlineAnchor() {
if ($img_object.length != 0) { if ($img_object.length != 0) {
var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit'); var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
$img_object.attr('src', img_src); $img_object.attr('src', img_src);
$cloned_anchor $cloned_anchor.find('a').attr('href', '#');
.find('a').attr('href', '#') var $edit_span = $cloned_anchor.find('span:contains("' + PMA_messages['strEdit'] + '")');
.find('span') var $span = $cloned_anchor.find('a').find('span');
.text(' ' + PMA_messages['strInlineEdit']); if ($edit_span.length > 0) {
$cloned_anchor $span.text(' ' + PMA_messages['strInlineEdit']);
.find('span') $span.prepend($img_object);
.first() } else {
.prepend($img_object); $span.text('');
$span.append($img_object);
}
} else { } else {
// Only text is displayed. See $cfg['PropertiesIconic'] // Only text is displayed. See $cfg['PropertiesIconic']
$cloned_anchor.find('a').attr('href', '#'); $cloned_anchor.find('a').attr('href', '#');
@@ -447,24 +456,58 @@ $(document).ready(function() {
// Looping through all columns or rows, to find the required data and then storing it in an array. // Looping through all columns or rows, to find the required data and then storing it in an array.
var $this_children = $edit_td.children('span.nowrap').children('a').children('span.nowrap'); var $this_children = $edit_td.children('span.nowrap').children('a').children('span.nowrap');
if (disp_mode != 'vertical') { // Keep the original data preserved.
$this_children.empty(); $data_a = $edit_td.children('span.nowrap').children('a').clone();
$this_children.text(PMA_messages['strSave']);
// Change the inline edit to save.
var $img_object = $this_children.find('img');
// If texts are displayed. See $cfg['PropertiesIconic']
if ($this_children.parent('a').find('span:contains("' + PMA_messages['strInlineEdit'] + '")').length > 0) {
$this_children.text(' ' + PMA_messages['strSave']);
} else { } else {
// vertical $this_children.empty();
data_vt = $this_children.html();
$this_children.text(PMA_messages['strSave']);
} }
var hide_link = '<br /><br /><a id="hide">' + PMA_messages['strHide'] + '</a>'; // If icons are displayed. See $cfg['PropertiesIconic']
if (disp_mode != 'vertical') { if ($img_object.length > 0) {
$edit_td.append(hide_link); $img_object.attr('title', PMA_messages['strSave']);
$('#table_results tbody tr td a#hide').click(function() { var img_src = $img_object.attr('src').replace(/b_inline_edit/,'b_save');
$this_children = $(this).siblings('span.nowrap').children('a').children('span.nowrap'); $img_object.attr('src', img_src);
$this_children.empty(); $this_children.prepend($img_object);
$this_children.text(PMA_messages['strInlineEdit']); }
// Clone the save link and change it to create the hide link.
var $hide_a = $edit_td.children('span.nowrap').children('a').clone().attr('id', 'hide');
var $hide_span = $hide_a.find('span');
var $img_object = $hide_a.find('span img');
// If texts are displayed. See $cfg['PropertiesIconic']
if ($hide_a.find('span:contains("' + PMA_messages['strSave'] + '")').length > 0) {
$hide_span.text(' ' + PMA_messages['strHide']);
} else {
$hide_span.empty();
}
// If icons are displayed. See $cfg['PropertiesIconic']
if ($img_object.length > 0) {
$img_object.attr('title', PMA_messages['strHide']);
var img_src = $img_object.attr('src').replace(/b_save/,'b_close');
$img_object.attr('src', img_src);
$hide_span.prepend($img_object);
}
// Add hide icon and/or text.
$edit_td.children('span.nowrap').append($('<br /><br />')).append($hide_a);
if (disp_mode != 'vertical') {
$('#table_results tbody tr td span a#hide').click(function() {
var $this_hide = $(this).parents('td');
var $this_span = $this_hide.find('span');
$this_span.find('a, br').remove();
$this_span.append($data_a.clone());
var $this_hide = $(this).parent();
$this_hide.removeClass("inline_edit_active hover").addClass("inline_edit_anchor"); $this_hide.removeClass("inline_edit_active hover").addClass("inline_edit_anchor");
$this_hide.parent().removeClass("hover noclick"); $this_hide.parent().removeClass("hover noclick");
$this_hide.siblings().removeClass("hover"); $this_hide.siblings().removeClass("hover");
@@ -489,14 +532,15 @@ $(document).ready(function() {
var txt = ''; var txt = '';
var rows = $edit_td.parent().siblings().length; var rows = $edit_td.parent().siblings().length;
$edit_td.append(hide_link); $('#table_results tbody tr td span a#hide').click(function() {
$('#table_results tbody tr td a#hide').click(function() { var $hide_a = $(this);
var pos = $(this).parent().index(); var pos = $hide_a.parents('td').index();
var $chg_submit = $(this).parent().children('span.nowrap').children('a').children('span.nowrap');
$chg_submit.empty();
$chg_submit.append(data_vt);
var $this_row = $(this).parents('tr'); var $this_span = $hide_a.parent();
$this_span.find('a, br').remove();
$this_span.append($data_a.clone());
var $this_row = $this_span.parents('tr');
// changing inline_edit_active to inline_edit_anchor // changing inline_edit_active to inline_edit_anchor
$this_row.siblings("tr:eq(3) td:eq(" + pos + ")").removeClass("inline_edit_active").addClass("inline_edit_anchor"); $this_row.siblings("tr:eq(3) td:eq(" + pos + ")").removeClass("inline_edit_active").addClass("inline_edit_anchor");
@@ -962,19 +1006,10 @@ $(document).ready(function() {
*/ */
function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data, disp_mode) { function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data, disp_mode) {
// deleting the hide button // deleting the hide button. remove <br><br><a> tags
// remove <br><br><a> tags $del_hide.find('a, br').remove();
for ( var i = 0; i <= 2; i++) { // append inline edit button.
$del_hide.next().remove(); $del_hide.append($data_a.clone());
}
if(disp_mode != 'vertical'){
$chg_submit.empty();
$chg_submit.html('<span class="nowrap"></span>');
$chg_submit.children('span.nowrap').text(PMA_messages['strInlineEdit']);
} else {
$chg_submit.children('span.nowrap').empty();
$chg_submit.children('span.nowrap').append(data_vt);
}
// changing inline_edit_active to inline_edit_anchor // changing inline_edit_active to inline_edit_anchor
$this_td.removeClass('inline_edit_active').addClass('inline_edit_anchor'); $this_td.removeClass('inline_edit_active').addClass('inline_edit_anchor');
@@ -984,7 +1019,7 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
if(disp_mode != 'vertical') { if(disp_mode != 'vertical') {
$this_td.parent('tr').removeClass('hover').find('td').removeClass('hover'); $this_td.parent('tr').removeClass('hover').find('td').removeClass('hover');
} else { } else {
$this_td.parents('tbody').find('tr').find('td:eq(' + $this_td.index() + ')').removeClass('marked'); $this_td.parents('tbody').find('tr').find('td:eq(' + $this_td.index() + ')').removeClass('marked hover');
} }
$input_siblings.each(function() { $input_siblings.each(function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B