//  
BlueQuartz.US Forum Index HOME
BlueQuartz.US
Open Source Info for Open Source Users
RegisterRegister 
MemberlistMemberlist
UsergroupsUsergroups
FAQFAQ   
SearchSearch
SubscriptionsSubscriptions
ProfileProfile   
Private messagesPrivate messages   
Log inLog in 
Are You Paying More Than Wholesale For Your Names?   Join the Hottest Domain Name Reseller Program Around!

 
Post new topic   Reply to topic    BlueQuartz.US Forum Index -> phpMyAdmin Developers
 Inline editing and updated values Previous Topic
Next Topic
Message Author
PostPosted: Thu Jul 29, 2010 9:04 am    
Subject: Inline editing and updated values
Reply with quote  
Ninad Pundalik

Hi,

During the saving of an inline edit, I'm generating the update query
with JavaScript on the client side, and posting it to tbl_replace.php,
which prepares some variables for sql.php. sql.php then executes the
update query, and generates an output in JSON, which is evaluated by
jQuery at the client side. If the query has been successful, the
values that were in the textarea/input fields, are taken as the new
value for that field and the HTML is updated to that effect.

The above process creates a few problems for me. When the table being
edited has a foreign key or transformed field, the javascript does not
know what is the value to be displayed after a successful edit. For
the foreign keys, I am generating the anchor at the server side in
sql.php and adding it to the JSON output. However, the anchor is not
being generated correctly, as the WHERE clause is missing. After the
query has been executed, sql.php does not know the values of
individual fields, and hence, I cannot generate the WHERE clause
necessary for the anchor.

Similarly, for transformations, I don't have the value of the field,
and hence, I cannot transform the new value to generate the HTML,
which I can add to the JSON output.

In libraries/display_tbl.lib.php, the WHERE clause is generated on the
fly for each field, as '= <field's value>', while the transformation
is done in the function PMA_prepare_row_data().

The solution I have in mind for the transformation problem is to post
an associative array to tbl_replace.php containing the field name and
it's new value, which I'll use after the query has been executed and
generate the HTML with this array. As for the first problem (foreign
key's anchor), I've been stuck at it for some time and can't see a way
out.

Could someone suggest a better solution?

Thanks!

--
Ninad S. Pundalik

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Thu Jul 29, 2010 12:26 pm    
Subject: Inline editing and updated values
Reply with quote  
Marc Delisle

Ninad Pundalik a écrit :
Quote:
Hi,

Could someone suggest a better solution?

Thanks!

Ninad,
I wanted to make some tests to answer you but there are merge conflicts
in server_privileges.php and sql.php, leading to PHP parse errors.

--
Marc Delisle
http://infomarc.info

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Thu Jul 29, 2010 2:17 pm    
Subject: Inline editing and updated values
Reply with quote  
Marc Delisle

Ninad Pundalik a écrit :
Quote:
Hi,

During the saving of an inline edit, I'm generating the update query
with JavaScript on the client side, and posting it to tbl_replace.php,
which prepares some variables for sql.php. sql.php then executes the
update query, and generates an output in JSON, which is evaluated by
jQuery at the client side. If the query has been successful, the
values that were in the textarea/input fields, are taken as the new
value for that field and the HTML is updated to that effect.

(...)
Ninad,
while looking for a solution, I noticed another problem. When you
generate the UPDATE query, it seems you are taking the column name from
the displayed header and this is not correct as in my sample table,
there are column comments (which are displayed in the header while
browsing).

--
Marc Delisle
http://infomarc.info

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Fri Jul 30, 2010 8:53 am    
Subject: Inline editing and updated values
Reply with quote  
Ninad Pundalik

On 30/08/2010, Marc Delisle <marc@infomarc.info> wrote:
Quote:
(...)
Ninad,
while looking for a solution, I noticed another problem. When you
generate the UPDATE query, it seems you are taking the column name from
the displayed header and this is not correct as in my sample table,
there are column comments (which are displayed in the header while
browsing).
Yes, I'm taking the column name from the header. I'll add comments to
a table and see if I can further improve the code, so that it extracts
only the field name and not the comments. If this is not easily
possible, I might put the comments in a span by modifying the
libraries/display_tbl.lib.php and tell jQuery to not read from that
span.

Thanks for the heads up! :)

--
Ninad S. Pundalik

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Fri Jul 30, 2010 9:42 am    
Subject: Inline editing and updated values
Reply with quote  
Ninad Pundalik

On 30/07/2010, Ninad Pundalik <ninadsp16289@gmail.com> wrote:
Quote:
On 30/08/2010, Marc Delisle <marc@infomarc.info> wrote:
Quote:
(...)
Ninad,
while looking for a solution, I noticed another problem. When you
generate the UPDATE query, it seems you are taking the column name from
the displayed header and this is not correct as in my sample table,
there are column comments (which are displayed in the header while
browsing).
Yes, I'm taking the column name from the header. I'll add comments to
a table and see if I can further improve the code, so that it extracts
only the field name and not the comments. If this is not easily
possible, I might put the comments in a span by modifying the
libraries/display_tbl.lib.php and tell jQuery to not read from that
span.

The comments already are in a span. Fixed this in commit e47b213.

--
Ninad S. Pundalik

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Wed Aug 04, 2010 12:45 pm    
Subject: Inline editing and updated values
Reply with quote  
Ninad Pundalik

Hi,

In the function that extracts the name of the field (getFieldName in
sql.js) from the table's header, I've put in an if condition that
checks if the current text direction is LTR or RTL. I've tested the
function for English (LTR). Could someone please confirm that it
works for an RTL language? Here's what you could do to test it in
Firebug:

0. Open up http://demo.phpmyadmin.net/gsoc-ninadsp/ .
1. Go to any page that shows results from a table. (Browse or make an
SQL query on a table).
2. Browse the sql.js script in Firebug and set a breakpoint on line
31. That is the line where the field_name variable is trimmed.
3. Click on the Inline Edit anchor, and check the value of field_name
at the breakpoint. If it is the same as the field's name, and the
field has been truncated/transformed, the value of the field should be
retrieved correctly from the server and put in the <textarea> element.

Thanks a lot for the help!

P.S.: As of revision 7acb4cb, a separate inline edit anchor is
appended to each row after the table is loaded if javascript is
enabled, so please do check the title text before clicking on the edit
anchors seen there before clicking. Before the code is merged into
master, I'd prefer to use a different icon for inline edit, so that
this confusion does not happen.

--
Ninad S. Pundalik

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Thu Aug 05, 2010 7:10 am    
Subject: Inline editing and updated values
Reply with quote  
Marc Delisle

Ninad Pundalik a écrit :
Quote:
Hi,

In the function that extracts the name of the field (getFieldName in
sql.js) from the table's header, I've put in an if condition that
checks if the current text direction is LTR or RTL. I've tested the
function for English (LTR). Could someone please confirm that it
works for an RTL language? Here's what you could do to test it in
Firebug:

0. Open up http://demo.phpmyadmin.net/gsoc-ninadsp/ .
1. Go to any page that shows results from a table. (Browse or make an
SQL query on a table).
2. Browse the sql.js script in Firebug and set a breakpoint on line
31. That is the line where the field_name variable is trimmed.
3. Click on the Inline Edit anchor, and check the value of field_name
at the breakpoint. If it is the same as the field's name, and the
field has been truncated/transformed, the value of the field should be
retrieved correctly from the server and put in the <textarea> element.

Thanks a lot for the help!

P.S.: As of revision 7acb4cb, a separate inline edit anchor is
appended to each row after the table is loaded if javascript is
enabled, so please do check the title text before clicking on the edit
anchors seen there before clicking. Before the code is merged into
master, I'd prefer to use a different icon for inline edit, so that
this confusion does not happen.

Hi Ninad,
I tested with Hebrew and it works fine (I had columns with comments).

--
Marc Delisle
http://infomarc.info

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
PostPosted: Thu Aug 05, 2010 1:24 pm    
Subject: Inline editing and updated values
Reply with quote  
Ninad Pundalik

Hi Marc,

On 05/08/2010, Marc Delisle <marc@infomarc.info> wrote:
Quote:
Hi Ninad,
I tested with Hebrew and it works fine (I had columns with comments).

Thank you for testing it. I'm working on the support for image and
application transformations now, and inline editing should be complete
in a day or two, unless we encounter a major bug. :)

--
Ninad S. Pundalik

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BlueQuartz.US Forum Index -> phpMyAdmin Developers All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group