2014-05-30 19:08 GMT+08:00 Atul Pratap Singh atulpratapsingh05@gmail.com:
Edward,
On Fri, May 30, 2014 at 2:02 PM, Edward Cheng c4150221@gmail.com wrote:
I'm writting AJAX part now. Have a look at this commit:
https://github.com/WhaleWatching/phpmyadmin/commit/a382070ee42b72474842d20e8... See my comment on it: For get response data I add a param, run between requestHandler and responseHandler.
As I understand, this mid-handler is your responsehandler that subsequently makes a call to the generic responsehandler of ajax.js. So it is not a real custom handler (that requests + handles response independent of the generic one)
Also, as I understand from your code, the proposed console would store a log of run queries and on running a query from console, the results will be displayed in the same way as happens when running a query from SQL tab. Right ?
Sometimes people'll run queries on console while they're browsing other pages, not SQL tab.
As per this understanding, you need a real custom handler because executing SQL and handling its response in PMA involves many custom checks and calls not only at response stage but also at request stage. For ex:-
checkSqlQuery()
Sorry I don't get this :), just run it if some errors we can wait response to tell users
- bookmark handling
Bookmark handling will use another functions and send another AJAX request, old way is not good enough.
reloading navigation for certain queries
reloading navigation, global handlers take this job is better
- refreshing main panel for certain queries
Do you main #page_content ?
- triggering grid edit for results
etc. see in sql.js near $("#sqlqueryform.ajax").live('submit', function (event) {
I have noticed this handler.
Or did you plan to duplicate above checks and calls into your midhandler?
No, midhandler just get result and append to console corresponding message(e.g. shows under query string "SELECT * FROM `mysql`.`user`")
Also, I don't understand why you need to call the generic response-handler of ajax.js? Remember that we don't need to populate AJAX.cache either.
My eng is not very well, so I draw a picture, see attachment
Thanks :)
Now middle handler runs well, but I can't send message ID to PMA_console._responseMidHandler, my questions are:
- Is the middle handler OK? Or is there another way to
custom my AJAX request(I need pages jump use global AJAX handlers)
Yes, you need to totally skip the generc/global AJAX handlers, for that you add a "class=ajax" to your form and write a custom handler.
-- Regards
Atul Pratap Singh http://blog.atulsisodia.in/
Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel