Opened 20 years ago
Closed 19 years ago
#2539 closed defect (bug) (wontfix)
Better maintainability of client-server administration code.
| Reported by: | mdawaffe | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | General | Version: | 2.0.1 |
| Severity: | normal | Keywords: | AJAX |
| Cc: | Focuses: |
Description
Much of the server-DB interaction code for administration is in one place (admin-db.php). It'd be nice if all the client-server interaction code were in one place as well (admin-delta.php?).
Example: you can delete a comment both by going through list-manipulation.php and edit-comments.php. With one file, we could see if we were
- doing AJAX and just die() some strings like we do now in list-manipulation.php, or
- rockin it old school and redirect to the right template.
Easier to keep all our ducks in a row (cf. #2538).
(Is this a dupe? I seem to remember seeing some conversation about related issues, but can't find anything here or on the lists.)
Change History (5)
#2
@
20 years ago
We could define a DOING_AJAX constant in list-manipulation.php and then have all the cases in that file point to where they are handled in the regular, non-AJAX files ('delete-post' going to post.php with $action = 'delete' ). These non-AJAX sections would then have to be tweaked to change their behaviour based on DOING_AJAX. That keeps the JS simple.
Alternatively, we could get rid of list-manipulation.php altogether and make the JS beefy enough to direct the AJAX calls to the right file. I'd like to keep the JS as small as possible, though. Plus, it'll be tricky to detect if we're doing an AJAX call.
Thoughts? PS: No need to take care of this right away.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In trunk, I've been trying to separate the template stuff from the interaction stuff from the db stuff. post.php, for example, is pretty much just an interaction layer between the templates and the DB functions. Same with comment.php, page.ph, and link.php. categories.php needs to have the interaction bits moved into category.php. Some of these still handle displaying the edit form, but the form is included from another file so there are no template bits directly mixed in with the interaction code.