diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2010-07-31 21:16:17 -0700 | 
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-31 21:16:17 -0700 | 
| commit | 7607e1f932dda53144792d0b7e8674a34fbc7f9a (patch) | |
| tree | 5b312e8a82d19c05928d22165545d0adf13ebff1 /modules/gallery/helpers/gallery_error.php | |
| parent | be4ad8e96d53f04a8f975aedde625a1f3e17dafd (diff) | |
Full pass over all the JSON encoding and JS dialog code.  We now abide
by the following rules:
1) An initial dialog or panel load can take either HTML or JSON, but
   the mime type must accurately reflect its payload.
2) dialog form submits can handle a pure HTML response, but the mime
   type must also be correct.  This properly resolves the problem
   where the reauth code gets a JSON response first from the reauth
   code, and then an HTML response when you reauth and continue on to
   a given form -- try it out with Admin > Settings > Advanced.
3) All JSON replies must set the mime type correctly.  The json::reply
   convenience function does this for us.
4) By default, any HTML content sent back in the JSON response should be
   in the "html" field, no longer the "form" field.
The combination of these allows us to stop doing boilerplate code like
this in our controllers:
  // Print our view, JSON encoded
  json::reply(array("form" => (string) $view));
instead, controllers can just return HTML, eg:
  // Print our view
  print $view;
That's much more intuitive for developers.
Diffstat (limited to 'modules/gallery/helpers/gallery_error.php')
0 files changed, 0 insertions, 0 deletions
