Le 2011-05-27 12:34, Thilanka Kaushalya a écrit :
Hi Marc,
I started working on improving the "*Add a new user in db-> privileges*" by providing a dialog such as in "*Add a new user in Server->privilege*" option. In that case I'm going to reuse the code in "(#fieldset_add_user).click" action in server_privileges.js file. The only modification I had to do is add the class="ajax" to link on db->privileges and now it pops up the dialog box.
Hi Thilanka, I assume that this class will be added only if $cfg['AjaxEnable'] is true.
The next part is, after adding a new user we have to add that user to the list table in db->privileges and then sort it according to the alphabetical order of user names. In server->privileges, "*appendNewUser() in server_privileges.js" *method has used and it is sorting the rows be selecting the first character in the label and then according to that. It is okay because server->privileges table has same type of rows. But in "* db->privileges*" table it has used two type of rows where one shows columns related to "global" privileges and other is to database specific privileges corresponding to each user. So I cannot use the same "*appendNewUser() in server_privileges.js"* method to add and sort the table. I came up with some approaches to overcome this problem.
- Change the table structure where do not use two rows but use same row
and line break to get them down. In this case I'll be able to reuse the same method where I think more appropriate in this case. 2. Do a refresh to the "*db->privileges*" page so it reloads the table. 3. Keep the table as it is in current and develop a method to sort it.
I'm confused with what method to use. So please can you clarify me on this problem. Thank you.
I suggest going for #2, provided this is done via AJAX (only refresh the usersForm by obtaining the new list from a call to server_privileges.js).
So in server_privileges.php starting at line 2142, instead of using echo to generate the form, it would be gathered in a variable using a logic similar to the one in server_privileges.php starting at line 1357. Then it's either echoed if not coming from an ajax request, or sent via PMA_ajaxResponse().
P.S. can you update http://wiki.phpmyadmin.net/pma/AJAXify_Interface when one of your features is implemented?