Closed (fixed)
Project:
Administration menu
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Apr 2009 at 17:22 UTC
Updated:
18 Apr 2009 at 14:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
markus_petrux commentedAdding a class to the body?
Comment #2
sunI tinkered pretty long about this issue...
Idea and conclusion:
Neither the DOM, nor a custom variable in Drupal.admin decides whether we ran AJAX already. The real indicator is the hash we get via Drupal.settings. This is especially important when considering that we might use further hashes for on-demand loaded sub-menus.
So what we want is:
- A registry of already requested hashes in Drupal.admin.hashes (property name could be a bit more descriptive though)
- Drupal.admin.getCache() always checks this registry before issuing another request. After successfully issuing an AJAX request, the given hash is added to the registry.
Remaining question is how we determine whether a request was successful. If I'm not mistaken, the onSuccess callback is always executed currently, even in case the server responds with a 404/403 or garbled output. You can certainly prove me wrong on that. :)
Comment #3
markus_petrux commentedAs per the jQuery docs. $.ajax has several callbacks:
-
success: A function to be called if the request succeeds.-
error: A function to be called if the request fails.-
complete: A function to be called when the request finishes (after success and error callbacks are executed).So that
completecallback can be used to clean up anything started via ajax request, andsuccesscallback to account for requests that succeeded, for example to update the hashes list. :)Comment #4
sunUntested.
Comment #5
sunTested and committed to all branches.