Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Following on from discussions in other issues (linked) it has become clear that we need to provide a means for administrators to (a) detect the problem of missing nodes and (b) tidy up the Scheduler table. I have made some enhancements to the 'Scheduled' tab which lists nodes that are scheduled. Currently the rows have an edit link which is broken when the node does not exist.
Here is an example of the existing table
Here is the same data with my enhancements
The changes made are detailed as follows:
- New menu link admin/content/scheduler_delete/% which calls confirmation form for deleting the row. Access only for users with 'Administer Scheduler' permission
- Added Node Type and Node Status into the scheduler content list
- In SQL, take nid from Scheduler table not the node table, to allow more complete info on the data being displayed.
- Use $destination = drupal_get_destination() so that after Edit or Delete is performed (or cancelled) we return to the calling page (currently goes to front page)
- Added 'delete' operation for good nodes using normal node/$nid/delete path
- Added 'delete' operation for bad rows, using new admin/content/scheduler_delete/$nid path
- Removed the 'edit' operation for bad rows as this does not work and gives 'page not found'
- For the pager row at the bottom of the table, make the colspan dynamic, for easier future addition/deletion of columns
- If there are no scheduled nodes, have a different message if viewing just one users nodes
- New function _scheduler_delete_row_confirm() to provide confirmation before deleting the bad row in Scheduler table
- Associated submit function _scheduler_delete_row_confirm_submit() to call scheduler_node_delete() is user confirmed.
- Change in scheduler_node_delete() to accept a plain node id as the parameter in addition to a node object
Patch coming up
Comment | File | Size | Author |
---|---|---|---|
#7 | 2110983_7.scheduled_list_ui.patch | 6.53 KB | jonathan1055 |
Comments
Comment #1
jonathan1055 CreditAttribution: jonathan1055 commentedPatch against 1.1+22
Comment #2
jonathan1055 CreditAttribution: jonathan1055 commentedRe-rolled patch because #1 no longer applies, due to other commits since. This is against 1.1+27
Comment #3
jonathan1055 CreditAttribution: jonathan1055 commentedRe-rolled following 1.1+34
Comment #4
jonathan1055 CreditAttribution: jonathan1055 commentedComment #5
pfrenssenThe screenshots look really nice and useful. I have 15 minutes left on my commute, will attempt a code review in that time span!
I would use the term "stale" or "obsolete" rather than "corrupt".
And maybe a better fit for the path would be "admin/content/scheduler/delete/%" since it is a child page of "admin/content/scheduler"?
I don't really like this kind of type juggling. You could either factor out the deletion to a separate function scheduler_delete_data($nid), or simply copy the line of code that performs the deletion into the submit handler. It's only one line of very obvious code after all.
Code looks good overall!
Comment #6
jonathan1055 CreditAttribution: jonathan1055 commentedThanks for the review, good use of your last 15 minutes. I am also on the train commuting now. Pleased you like it overall.
I've addressed all your points. 'Obsolete' is better tha 'corrupt' you are right. Changed the menu path as that makes more sense. Also added the single db_delete() call into the handler.
Here is a patch against the latest code in git (which is not the latest -dev being shown) and an interdiff file
Jonathan
Comment #7
jonathan1055 CreditAttribution: jonathan1055 commentedNo changes to code but re-rolled as the latest patch failed to apply against 1.1+49-dev
Comment #8
pfrenssenLooking great. I tested it and it works well. It is more consistent with the standard content listing from the node module, and it is easier to use. Some nice small additions as well, like the destination parameter, and the possibility to clean up stale database entries! Thanks a lot Jonathan!
Committed to 7.x-1.x: commit 59635801.
Comment #9
jonathan1055 CreditAttribution: jonathan1055 commentedGlad you like it.
Happy Christmas!