Good day!
I just upgraded a site from Drupal 4.6 to Drupal 5, as an interim step on the way to Drupal 6. This site uses the Scheduler module extensively, and our staff really needed the feature to show a list of all scheduled nodes under Drupal path "admin/content/node/scheduler".
Rather than submit a feature request asking for the needed feature, I coded it myself and am herewith contributing a patch that I have tested on my development and production environments. I hope that you will consider including this feature into the code base. The patch is a diff against scheduler.module, CVS version 1.46.4.34.
I am committed to forward-port this patch to the Drupal 6 version of Scheduler in the near future also, but right now I needed it in Drupal 5 first.
Kind regards,
Scott Courtney ("syscrusher")
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | scheduler_d6_list_of_scheduled_nodes.patch | 2.59 KB | jonathan1055 |
| #17 | scheduler5_list_of_scheduled_nodes.patch | 2.76 KB | eric-alexander schaefer |
| #16 | scheduled_content.info | 249 bytes | jonathan1055 |
| #16 | scheduled_content.module.txt | 2.07 KB | jonathan1055 |
| #16 | scheduled_content.views_default.inc_.txt | 9.7 KB | jonathan1055 |
Comments
Comment #1
syscrusher commentedComment #2
syscrusher commentedComment #3
eric-alexander schaefer commentedWhats wrong with the views module? All the sites I maintain have a page and a block with scheduled nodes.
Comment #4
syscrusher commentedI like Views just fine, but I think there are several reasons for having this functionality within Scheduler:
IMO the second reason is quite a bit more important than the first. A block view wouldn't cut it for my application, as we schedule content many days ahead in some situations. Thus, there could be twenty or thirty nodes scheduled at one time, more than will fit into a reasonable block.
I'll ask the counter-question: Since the code is extant, is there a good reason not to include it in the module? It's not a large line count to maintain, nor is it particularly complex to update to D7 and beyond.
Kind regards,
Scott (syscrusher)
Comment #5
syscrusher commentedThinking about this further....
If you don't want the scheduled nodes in the code, how about a point-and-click option in the admin page for Scheduler that detects whether Views is installed, and if it is, sets up an appropriate View page with the same Drupal path as the contrib I've offered, then have Scheduler be smart enough to pick up the existence of that path and add it to the node admin as a tab the way my contrib does. Seems this might be the best of both worlds, because after using this quick-setup mechanism the administrator would be free to customize the View as they wish.
There is precedent for this sort of behavior in the Event module.
Kind regards,
Scott (syscrusher)
Comment #6
eric-alexander schaefer commentedOK. Since it is a tab in the node admin section and the code is really straitforward...
The patch looks good. But could you enlighten me on this part:
Is this using documented behaviour or is it a hack? Sure looks like a hack. (No offense, I am just getting nervous when I encounter $_GET in contributed modules).
Comment #7
syscrusher commentedHmmmm.... I ported my patch from the old version of Scheduler itself. I agree with you that $_GET isn't something we normally want to see, but I am not sure offhand what the preferred mechanism is nowadays. I'll look into this and get back to you ASAP. Thanks.
Scott
Comment #8
eric-alexander schaefer commentedScott? Any progress?
Comment #9
superdave913 commentedJust wanted to see if the Drupal 6 port, mentioned in the original post, was ever created!?
Comment #10
jonathan1055 commentedI had also written this functionality before I saw this post. It uses views (as Eric preferred) but no admin work in views is required as the module provides the view. The results are shown in two tabs, 'Scheduled for publishing' and 'Scheduled for unpublishing'. The column titles are sortable and edit & delete links are provided. I also wrote an addition to the 'time ago' format which will now display time periods to the future as well as the past.
Attached is a screen grab. If anyone is interested I can create a patch file. (although I did the work in a separate scheduler_mods module just for my own use, so it is not in a state to be rolled just yet).
Jonathan
Comment #11
eric-alexander schaefer commentedI don't even know what the current status of this is. Scott?
Comment #12
superdave913 commentedIf it wouldn't be too much trouble to provide the patch, I would imagine others could benefit. I would think Scott and Eric might like to see different ways of attacking it.
Comment #13
eric-alexander schaefer commentedI would commit Scotts patch if I knew if the
$_GET[]s are OK.Comment #14
superdave913 commentedIn the meantime, would someone be willing to use the export option, to export the view they use? It might be easy enough to provide this in a contrib folder of the tarball.
Comment #15
jonathan1055 commented@Superdave913 #12 #14
I could attach here the three files of my scheduler_mods module in their entirety. One of them is an export of the two views I created.
But what would be even better is instead of being a separate module (which I did for very quick development, just experimenting) is if they could be put into a subfolder of /scheduler/ as you suggest, and this could be enabled by an admin checkbox, with default setting = whether views module is installed.
I don't think I want to make the current files public because it is not correct to create a whole new module, and if users get this it could just create more bug issues for us all to deal with. But I will attempt to integrate it into a subfolder of /scheduler/ and then show you what it looks like.
@eric #13
I do not want to conflict with this work. I agree with syscrusher that it could be good to have code in this module which give the functionality without relying on views being installed. I think there should be a good solution which caters for both.
Jonathan
Comment #16
jonathan1055 commentedOK, attached are three files for a sub-module of scheduler, which I have called scheduled_content. The three files need to be placed in a new folder within modules/scheduler/. The new folder can be called anything, but I called it scheduled_content just to be consistent. This will create a new module which is dependent on views, so it cannot be used if views is not installed.
When enabled, it creates a new link in the navigation menu under admin->content management called 'scheduled content'. If necessary this link can be moved or copied using the admin menu UI to a higher position in the menu tree where it can bee seen by users who have been granted scheduler permission but who don't have full admin rights.
I am sure there are many things required to improved this code, but at least here is a starter, as requested by syscrusher and superdave913. I have checked it with coder module for drupal coding standards. I am on D6, so you may need to alter quite a bit to test with D5 (sorry).
One thing which does definitely need looking at is that it uses a new time format that I added to my views module code, which is like 'time ago' but displays the time period forward to a datetime in the future. See my screengrab in #10 above. I think this should be implemented within views properly, but until that happens we might need a work-around.
Anyway, please let me know if anyone has any success in installing and using this, or report any errors and bugs.
Jonathan
Comment #17
eric-alexander schaefer commentedI merged syscrushers patch manually into the current 5.x cvs version and rerolled a patch (attached).
If someone reviews/tests this ok I will commit it and create a new release.
But we still need a version for 6.x. Lets see, the evening is still young...
Comment #18
jonathan1055 commentedEric,
I have already merged in syscrushers patch into my D6 site and it works fine. To save you the trouble, I will make a patch right now and post it here.
Jonathan
Comment #19
jonathan1055 commentedHere is the D6 patch. I rolled it against 6.x-1.3 but I think it should apply reasonably cleanly to the 27th Jan dev version, but I have not checked this.
Hope it helps. Sorry for the delay - due to having to work out how to check two access parameters.
Jonathan
Comment #20
eric-alexander schaefer commentedI made it a Tab (MENU_LOCAL_TASK) and commited it.
D6: http://drupal.org/cvs?commit=198724
D5: http://drupal.org/cvs?commit=198726
Thanks a lot!
Comment #21
jonathan1055 commentedNice idea to have it as a tab - much better than a sub-menu link.
I guess you were happy with your concern in #13 about the $_GET ?
May I suggest that the table column titles are changed to 'Publish on' and 'Unpublish on' to match the words used elsewhere in the module and edit form, instead of using 'Post' and 'Hide'.
Jonathan
Comment #22
eric-alexander schaefer commentedAbout the $_GET: The content of is not really used there. The values are set with default values in case they do not exist.
Ofcourse you are right about the column headers. I will change that.
Thanks again,
Eric
Comment #23
eric-alexander schaefer commentedD5: http://drupal.org/cvs?commit=199032
D6: http://drupal.org/cvs?commit=199036
Comment #24
jonathan1055 commentedEric,
When you changed the title headers you missed the next bit of code, where 'Post' should be changed to 'Publish on'. Also in my opinion, it is better to have the default sort order Ascending not Descending, so that the next item to be published appears first in the table not last. That seems logical to me, I think, as you are more likely to read the list downwards and assume time flows downwards. The code to change is:
which becomes
Jonathan
Comment #25
eric-alexander schaefer commentedThanks. You are right.
D6: http://drupal.org/cvs?commit=199750
D5: http://drupal.org/cvs?commit=199752
Comment #26
jonathan1055 commentedI've downloaded and tested the D6 version, all correct. Viewed the D5 changes via cvs and looks identical.
Excellent work, thanks.
When I have better integrated and enhanced my views-based version (see #16) I will start a new post to discuss it, so I am happy for this issue to be set back to fixed. I am not sure of the etiquette of me changing the status to fixed, seeing as you have done the commits, so I have left it for you.
Jonathan
Comment #27
eric-alexander schaefer commentedThe usual workflow would be setting it to "reviewed & tested by the community". I will keep it in this state for a couple of days before setting it to fixed.
Thanks,
Eric
Comment #28
superdave913 commentedWill this be sparking an official update version release?
Comment #29
eric-alexander schaefer commented@superdave913: There will be a new official release in a couple of days for both 5.x and 6.x.
Comment #31
superdave913 commentedFor some reason the official release isn't appearing on the project page.
Comment #32
eric-alexander schaefer commentedWell, "couple of days" is a flexible term...
Comment #33
superdave913 commentedI was just surprised the ticket was closed before it was uploaded to the project page.
Comment #34
eric-alexander schaefer commentedRelease 6.x-1.4: http://drupal.org/node/516514
Comment #35
superdave913 commentedAwesome! Much appreciated!