WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#2561 closed defect (bug) (fixed)

AJAX Admin

Reported by: mdawaffe Owned by: mdawaffe
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0.2
Component: Administration Keywords: AJAX ajaxcat list-manipulation bg|2nd-opinion bg|has-patch
Focuses: Cc:

Description

Leverage the Web 2.0 paradigm of... whatever. Slap on some AJAX for a few admin UI function to get rid of annoying page reloads.

Item deletion and dimming (class changing)

  1. Mass Edit Mode Comments (was #1810)
  2. edit.php comments (was #2552)
  3. Plugin (de)activation
  4. Custom Fields

Item addition

  1. Custom Fields
  2. Categories (Manage->Categories)
  3. Bookmarks? (Bookmarks->Manage Bookmarks)
  4. Users

Attachments (9)

2561.diff (42.9 KB) - added by mdawaffe 14 years ago.
Round 1 *FIGHT!*
2561b.diff (43.9 KB) - added by mdawaffe 14 years ago.
Fixes escaping/slash issues. Supersedes 2561.diff
2561c.diff (49.0 KB) - added by mdawaffe 14 years ago.
No plugins. Better everything else.
2561d.diff (51.2 KB) - added by mdawaffe 14 years ago.
Fix first meta bug.
2561e.diff (51.7 KB) - added by mdawaffe 14 years ago.
Fix new meta after update a different meta bug
2561f.diff (55.6 KB) - added by mdawaffe 14 years ago.
fixes some bugs reported by ryan and mark
2561h.diff (58.2 KB) - added by mdawaffe 14 years ago.
What happened to g? More bug fixes.
2561i.diff (59.9 KB) - added by mdawaffe 14 years ago.
i18n. Some typos. Some sec fixes.
2561j.diff (59.8 KB) - added by mdawaffe 14 years ago.
Almost at 1/2 alphabet! Fixes single quote problem in Custom Fields

Download all attachments as: .zip

Change History (34)

#1 @mdawaffe
14 years ago

I'm working on a patch for this now. I should have some code for this tomorrow that does at least a chunk of all this.

#2 @ryan
14 years ago

Nice. Looking forward to it.

#3 @westi
14 years ago

Looks good.

What about bringing in the AJAX multiselect delete code from #923

The changes to list-manipulation.js there should hopefully support generic multiselect delete.

@mdawaffe
14 years ago

Round 1 *FIGHT!*

#4 @mdawaffe
14 years ago

2561.diff

Fixes:

All mentioned Item deletion/dimming.
Better ajaxcat. Update individual custom fields.

Does Not yet:

Do any item addition (though should be fairly simple now)

Known bugs:

Update a custom field. Update it again and it won't go through AJAX. (Source of problem known, looking into best solution.)

Compatibility:

Unknown. Testing (all working) on FF 1.5.0.1/MAC 10.latest, FF 1.0.7/WinXP, IE 6.0.something/WinXP

Methodology:

"Class like" JS. Simple things: PHP sends '-1' (!current_user_can), '0' (does not exist, something broke), '1' (all is well). Complicated things: PHP sends '-1', '0' (as above), XML object with id and escaped raw HTML for inclusion into list.

#5 @mdawaffe
14 years ago

PS: When testing (and please do!), make sure and do a hard refresh or two to clear JS cache.

#6 @mdawaffe
14 years ago

TODO:

i18n

#7 @mdawaffe
14 years ago

KNOWN BUGS:

Some escaping/slashes issues.

#8 @mdawaffe
14 years ago

  • Status changed from new to assigned

westi, I'll look into it after things settle in. Also, will #923 be made less important when deletion is on the fly anyway?

@mdawaffe
14 years ago

Fixes escaping/slash issues. Supersedes 2561.diff

#9 @mdawaffe
14 years ago

2561b.diff (full patch)

FIXES:

escaping/slash issues.

#10 @markjaquith
14 years ago

Custom fields delete through asynchronously and update once, as you said. What else should I be testing? Scrolling up it's hard to tell what is currently implemented.

#11 @mdawaffe
14 years ago

This should currently (grouped by what chunk of code implements the feature)

Delete

  1. Posts on Manage->Posts
  2. Pages on Manage->Pages
  3. Comments on Manage->Posts: click on comments # link for a particular post
  4. Categories on Manage->Categories
  5. Comments on Manage->Comments
  6. Comments on Manage->Awaiting Moreration (Delete Just this comment)
  7. Bookmarks on Bookmarks->Manage Bookmarks

"Dim" (change the coler of)

  1. Comments when moderating through Manage->Posts: click on comments # link for a particular post
  2. Plugins when de(activating) on Plugins->Plugins

Update

  1. Individual (pre-existing) Custom Fields on Write->Post/Page

Add

  1. Categories through Write->Post/Page or Bookmarks->Add Bookmarks

At some point, this ticket should also have a patch for adding

  1. Users from Users->Authors & Users
  2. Categories from Manage->Categories
  3. New Custom Fields from Write->Post/Page
  4. Possibly Bookmarks from Bookmarks->Manage Bookmarks

#12 @ryan
14 years ago

Maybe we should continue doing a page reload for plugin activation. Plugins can add menus and submenus when activated, and those menus won't show up if we don't refresh.

#13 @mdawaffe
14 years ago

Good point. I wanted plugins to work here since it's annoying to go through them one by one if you have a bunch to activate/deactivate. It wouldn't be too hard to update the menus live, now that the JS is more abstracted. We'd only have to change the top level menu and the Plugins one.

Should I look into that?

Otherwise, most everything is working on my local copy. I hope to have another patch up in the next couple days that does a better job of keeping the slashes under control and that adds items besides categories as well.

#14 @ryan
14 years ago

How about a separate patch for plugins so we can get the rest of it in and play with plugins on the side?

#15 @mdawaffe
14 years ago

Can do.

@mdawaffe
14 years ago

No plugins. Better everything else.

#16 @mdawaffe
14 years ago

2561c.diff

Delete

  1. Posts on Manage->Posts
  2. Pages on Manage->Pages
  3. Comments on Manage->Posts: click on comments # link for a particular post
  4. Categories on Manage->Categories
  5. Comments on Manage->Comments
  6. Comments on Manage->Awaiting Moreration (Delete Just this comment)
  7. Bookmarks on Bookmarks->Manage Bookmarks
  8. Custom Fields on Write->Post/Page

"Dim" (change the coler of)

  1. Comments when moderating through Manage->Posts: click on comments # link for a particular post

Update

  1. Individual Custom Fields on Write->Post/Page

Add

  1. Categories through Write->Post/Page or Bookmarks->Add Bookmarks
  2. Categories from Manage->Categories
  3. New Custom Fields from Write->Post/Page

Does not do anything with plugins as above. Does not do user addition, which will be a little tricky with the current way users are listed.

Needs

  1. Better wp-admin.css for category UL on Write->Post/Page / Bookmarks->Add Bookmarks (fine in FF, ugly in IE).

This latest patch tested only in FF 1.0.5.1/Max OS X

#17 @mdawaffe
14 years ago

  • Keywords bg|2nd-opinion bg|has-patch added
  • Version changed from 2.0.1 to 2.0.2

I'd like to get this reviewed and altered by others and committed if appropriate. Users, plugins and potentially bookmarks can be spun off to their own tickets.

@mdawaffe
14 years ago

Fix first meta bug.

@mdawaffe
14 years ago

Fix new meta after update a different meta bug

@mdawaffe
14 years ago

fixes some bugs reported by ryan and mark

@mdawaffe
14 years ago

What happened to g? More bug fixes.

#18 @mdawaffe
14 years ago

2561h.diff

Fixes several bugs (problems listed belew should now be fixed):

  1. Not adding new custom fields in IE.
  2. Problems deleting/custom fields in IE.
  3. class="alternate" problems.
  4. Deleting items with ' " / & in their titles
  5. AJAX calls in quick succession (e.g. dblclick) explodes
  6. Updating unchanged meta caused breakage.

General cleanup.

  1. Simplify a few functions.
  2. Should play nice now on No AJAX and on No JS.

@mdawaffe
14 years ago

i18n. Some typos. Some sec fixes.

#19 @mdawaffe
14 years ago

2561i.diff

New Stuff:

  1. i18n: needs checking.
  2. check_ajax_ref
  3. clean up a couple typos.

In serious need of cross-browser. Especially older stuff.

#20 @mdawaffe
14 years ago

Cross-browser testing, that is.

#21 @mdawaffe
14 years ago

Please test creating and deleting things (categories, post, custom fields...) with funny characters in their titles:

' " < & % \

Characters that might screw up any kind of escaping/encoding.

Remember to hard refresh for new JS.

#22 @ryan
14 years ago

So far so good on Firefox 1.0.7 and 1.5.0.1.

Got the AJAX ref checking working with the secure admin plugin too.

#23 @markjaquith
14 years ago

In IE 6.0/WinXP and FF 1.5.0.1/OS X, deletion of a Custom Field with a single quote in the key name resulted in a page refresh, and no alert confirmation. The deletion occured, however. Minor issue.

I haven't tested it all thoroughly, but initially, it seems very good! I'll try to test more later.

@mdawaffe
14 years ago

Almost at 1/2 alphabet! Fixes single quote problem in Custom Fields

#24 @mdawaffe
14 years ago

markjaquith, fixed in 2561j.diff

#25 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3660]) AJAX, cause you love it. Props mdawaffe. fixes #2561

Note: See TracTickets for help on using tickets.