Closed (fixed)
Project:
Revision scheduler
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Nov 2011 at 21:25 UTC
Updated:
11 Nov 2014 at 04:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dixon_I need this for a project of mine. So if this isn't worked on currently, I'll start it.
Comment #2
schnitzel commentedWe have the exact same issue with a customer project and need this functionality in the next 1-2 weeks.
We would suggest this workflow:
Our editors (only rights to create drafts, not publish) should have the possibility to suggest a publication date.
If the publisher (rights for publish) tries to publish the node before the suggested date, he gets an notification if he would to create an scheduled publication.
If he publishes the revision after the suggested date the revision is published immediately. And the cron does not check for the suggested date.
What do you think of this suggestion?
how is the status with you dixon_? Because we could also provide some coding force to achieve this solution
Comment #3
dixon_I haven't started work on this yet.
@Schnitzel Your workflow is different from what we had in mind. It sounds more complex than the average solution.
Our workflow would be more straight forward, where one role will have the permission to schedule state changes. Everyone of the same role can change the scheduling. We identified that this won't be a problem as long as it's visible on everyone's Workbench when an article is scheduled for state change.
But again, I haven't started anything yet. We will probably start within the coming 2 weeks. But our sprint prioritization might change. I'm unassigning myself, since I can't guarantee anything :/
Comment #4
schnitzel commentedSo you would allow to Editors to schedule a publication even if they don't have the permission to publish?
That's the problem we try to fix in our solution.
So assigning this to me, because we will work on it this week, if it is then too hard for the average solution we will see :)
Comment #5
dixon_Yes, in our workflow normal editors will actually have permission to publish and schedule. Review is done peer-to-peer on a general consensus basis to keep the editorial workflow a bit quicker and agile.
But it should be configurable, the same way as workbench are today. I have looked at the code quick, and it seems to be so that users can schedule state changes to state they have access to. So we already have a great deal of flexibility in the current code.
Comment #6
vasi1186 commentedHere is a patch that adds a new option in the Publish options fieldset (in the case of nodes) to schedule an operation at a certain date.
Comment #7
vasi1186 commentedThe above patch does not check if the user has access to schedule revisions. Use this patch instead.
Comment #8
schnitzel commentedSo a short explanation what this patch is doing:
This patch will allow Users which have the right to create new Schedules directly while creating a new Revision.
It is not fixed to Schedule only to the publish state, it can be any transaction scheduled.
If you want to make it plain simple (for example to allow only schedules to the publish state) you need to change the code, but this is the most general way we found (@Dave agree with this?)
In our Customer Project we had a more complex workflow:
The Editors didn't have the publish rights, so they had to enter an "suggested schedule". For this we added a "state" field for each Schedule, which can be "suggested" or "active". If the Editors create a new Revision with a "suggested schedule" it creates a new RevisionSchedule with the "suggested" state.
Then the Publisher have in the moderate area not only the possibility to publish the Revision, they also have the possibility to "activate the suggested schedule".
We are testing now this Patch and probably will contribute it tomorrow.
We splited up these two functionalities because the second case is a bit complex and also changes some stuff from the module which maybe is too much, what do you think @Dave?
Cheers
Comment #9
dlcerva commentedOne issue with this patch involves there being no check to see if the entity is capable being revised by workbench. For instance, the field_attach_form will apply to users and taxonomy terms which in turn errors out when attempting to add/update/delete these types.
Comment #10
vasi1186 commentedAdapted the patch to check if the entity supports revisions or not.
Comment #11
theunraveler commented@vasi1186: make sure you roll your patches relative to the module's directory, rather than from your Drupal root. See #707484: Making a patch for more info.
Here is the patch in #10 rerolled for
patch -p1.Comment #12
wmostrey commentedThe patch in #11 applies cleanly to the latest dev code, and it works as advertised: scheduled revisions transition on the correct time.
I do feel that the user experience can improve quite a bit though. For example when creating a revision we could output the information that is available on /moderation/schedule on this edit form as well. If an older revision is scheduled to be published, then an editor creating a new revision will want to be aware of this. Another good place to put this information is on /moderation as part of the information displayed for that revision.
Maybe this belongs in separate issue, but it definitely needs some more attention.
Comment #13
wmostrey commentedSorry, needs review. Maybe one extra before it gets committed?
Comment #14
schnitzel commentedIn our solution for the customer we show the information about existing schedules in the yellow information box on top of the node and also in the moderation tab, check the screenshots (unfortunately a bit german).
If you think this would make the UX better (I think so) we could write a patch for it.
Comment #15
e0ipsoSchnitzel, screenshots look very primising. A patch would be great!
Comment #16
hyperglide commentedAgree would love to see this module go stable!
Comment #17
jec006 commentedThis works for me - further enhancement can be a new issue and/or subsequent patches imho
Comment #18
grndlvl commentedWith the current validation handler being attached to the submit button the node_validation callback is never called. I have tracked this down to http://api.drupal.org/api/drupal/includes!form.inc/function/form_execute...
From form_execute_handlers().
From the patch
I have moved the validator out of the conditional locally but left the submit in(It does not seem to be affected in the same way, although I am not sure why).
I am not really sure why it was attached to the button so I just left it for now. If I have a chance this week I will re-roll the patch accordingly.
Comment #19
grndlvl commentedChanging to needs work
Comment #20
vasi1186 commentedAttached is a patch that implements these features (in addition to the one provided in #11. Also, the change in #18 is included):
- on the view published, view draft, edit draft and view revision pages you can see a list with the scheduled operations for that revision and the user can run or cancel each operation.
- also, on the moderation page (where you see all the revision), just below the moderation form you should also see a list with the scheduled operation of that revision, and you can run or cancel each operation. The next step would be to put show the scheduled operations in the moderation page for all revisions, but I don't know if it possible without some changed in the workbench_moderation module (didn't spend to much time to find a solution).
Maybe some small adjustments are needed, and also maybe some documentation... but feel free to test it and give your feedback.
Comment #21
johnpitcairn commentedPatch does what it says on the tin.
However, my editor-level users generally do not have the "administer content" permission, which means they do not see the "Publishing Options" fieldset, and the scheduler form is dumped into the top level. In this case, the scheduler form should be added to the "Revision Information" fieldset.
Revised patch attached.
Comment #22
johnpitcairn commentedIt appears the patch at #20 or earlier added the function revision_scheduler_get_revision_schedule() - this does not check that the revision nid and vid are actually set, which they are not for a new node. A PHP error warning results.
Re-rolled patch attached - this adds a check for nid and vid, and returns an empty array if those are not set, so any calling function foreach loops do not break.
Comment #23
hyperglide commentedAny updates on the status of this patch and commit?
Thanks,
Comment #24
hyperglide commentedAny way to get help reviewing this work?
Thank you!
Comment #25
johnpitcairn commentedYou can always review it yourself - if you have applied the patch to the latest dev version and believe it works, change the status to RTBC.
Comment #26
hyperglide commented@John Pitcairn thank you for suggestion. I tried to apply to patch --
drush patch http://drupal.org/node/1342824#comment-5642652but did not take. any help please?
Comment #27
johnpitcairn commentedhttp://drupal.org/patch/apply
Comment #28
hyperglide commentedTested the patch and worked as noted.
Advise review by someone with commit ability and commit it.
Comment #29
johnpitcairn commentedI've had this patch running on 2 sites in production since February. What are the chances of a commit?
Comment #30
hyperglide commentedSame -- have running on our site for 30+ days.
Comment #31
coredumperror commentedThis patch may be slightly too over-reaching. When you've got the latest Field Collection dev release installed, the patch's new revision scheduling subform gets adding into each field collection. I don't know if this is a problem on Field Collection's side or this patch's, though, since I'm not entirely familiar with what either module is doing.
Comment #32
hyperglide commentedI would also say the patch shows up on Drupal Commerce Order Page.
Comment #33
lotyrin commentedConfirming that this doesn't always appear where it belongs.
Comment #34
lotyrin commentedThis changes revision_scheduler_field_attach_form() to guard instead of nesting, and checks for available schedule operations (in addition to existing checks for a revisioned entity and user access to schedule operations) before modifying the form.
On my current project at least, this resolves the cases where forms were being inappropriately modified (commerce order form).
Ive also addressed some code style issues throughout the patch.
Some lines - mostly calls to t() - are excessively long and should consider splitting out and preparing some values in advance.
I also feel some of the API additions are in poor taste. For instance, revision_scheduler_get_revision_schedule(), which is node-specific and superfluous. It seems the patch should extend revision_scheduler_operation_load_multiple() to support loading scheduled operations based on passed conditions (entity type, id and/or revision id).
Comment #35
hyperglide commented@lotyrin is #34 Ready for testing? or still needs more work?
Comment #36
lotyrin commentedGood question.
I'd like to see my concerns from #34 addressed, but they could be follow-ups to this, I suppose.
Comment #37
dagmarThis patch contains some improvements to version provided in #34.
First, it only show the scheduled option in the 'Revision' tab. In my opinion, there is no point to allow to schedule a revision if the user cannot create a new revision.
Also, the options to schedule a revision are only available after check the option "Create new revision". And the date widget is only visible after select an operation.
Comment #38
dagmarSorry wrong patch, here is the interdiff from #34 and the right patch.
Comment #39
hyperglide commented#39 does not play weil with workbench_moderation - I suspect as there is no 'new revision' option the scheduler fields never are shown.
I hope #34 can be comitted or #39 revised
Comment #40
capellicI applied the patch from #34 per @HyperGlide's recommendation in #39. Works great! Thanks all!
Comment #41
seanbTried to improve the support for workbench_moderation in the patch from #38. Hope it helps!
Comment #42
drupalmonkey commentedThe patch in #41 works for me.
Some comments though:
There is an implementation of hook_install() in the patch, is this really necessary? If it is, there should be a hook_update_N() that does the same thing for people who already have the module installed.
This is the same basic functionality as provided at: node/%/moderation/schedule/add
but there is zero code overlap or reuse, is there some way to fix this up to reuse some of the code in these 2 spots?
Comment #43
hyperglide commentedPatch - 41 is good for us..
Comment #44
gmclelland commented@seanB - Your patch applies but contains some white space errors.
I just tested the patch #41 on http://simplytest.me/
Went to the article content type settings - checked "Create a new revision"
Note: I did not have workbench_moderation installed.
Went to Create Article at node/add/article
The settings do appear in the correct place under the "Revision Information" tab on node/edit. I was able to scheduled an operation and my node saved fine. After saving the node and re-editing, I no longer see the PHP Notices.
It does seem strange that you can't choose the revision that you want to schedule.
That might be solved with the patch at #1828646-7: Provide a regular publish/unpublish revision operation (without workbench), but there is a conflict when trying to use both patches at the same time. Only one patch or the other can apply at one time.
Hope that information/testing helps
Comment #45
gmclelland commentedMore testing shows that the patch in #38 also throws the same Error Notices when trying to add a new node.
I'm still able to the Schedule the operation, but there is no way to see what is scheduled unless you make two revisions on the node.
After you make two revisions on the node, then the "Revisions" tab appears on the node where you can then view the scheduled operations. That is a Drupal core behavior that might need to be overridden to always show the revisions tab when viewing the node if a revision has be scheduled? Otherwise how would a person see the scheduled operation?
Regarding my comment in #44:
-This could be easily solved/clarified by changing the help text under "Scheduled operation" to "Please select an operation that should be scheduled for this revision."
Hopefully someone could chime in hear with a fix to the error notices
Comment #46
gmclelland commentedI'm not sure if this correct, but I modified the patch in #41 and added an if wrapper to the function:
if (isset($entity->nid) && isset($entity->vid)) {That seems to make the errors in #44 go away for me. Note: I haven't tried this with workbench_moderation.
Comment #47
gmclelland commentedAlso with #41 I seem to be getting these notices when I try to add a node as a person that doesn't have access to the publish fieldset.
If I give the user the "Administer content" permission, then the error goes away.
I'm guessing it would need some kind of permission check here?
Comment #48
ericduran commentedThis is so it can work with workbench moderation 2.x
Very similar to the last patches just without any of the workbench_moderation 1.x stuff and a little more generic.
Comment #49
reinier-v commented41: revision_scheduler-in_node_edit_form-1342824-41.patch queued for re-testing.
Comment #50
bleen commentedComment #51
dave reidI think this will need to be updated for the latest changes. Updates were made to the default form with date elements, the date pattern, etc. I can try and reroll.
Comment #52
dave reidOk took a stab at this and I think I have it pretty much working now. I made quite a few changes from the latest patch:
Follow-ups:
Filed #2301399: The 'delete' operation for nodes should not be available when node_revision_delete() will fail
It would be great if we could get a couple people to really run through this patch and test it out. Maybe ericduran, bleen18, and gmclelland?
Comment #53
dave reidRevised patch which also adds re-checking of operation access when the user changes the revision selection on the independent add-new-scheduled-revision form. Also more massive form cleanups by allowing the revision ID to be changed for existing scheduled operations. Added static caching to the 'available operations' function since it was getting called quite often.
Comment #54
dave reidI'd love to include this in the next release, to be tagged this week. Anyone up for review?
Comment #55
gmclelland commented@Dave Reid - Testing the patch in #53. If I choose revert on the node/edit form under Revision Scheduler, am I supposed to see a revision drop down list to choose which revision? or is it assumed that you are reverting to the previous revision?
See the attached images for clarification.
In combination with the patch in #1828646-13: Provide a regular publish/unpublish revision operation (without workbench), I have successfully reverted, published, and unpublished an existing node. I also tested creating a new unpublished node and scheduled it to be published.
Hope that helps
Comment #56
dave reidIt's always assumed you are scheduling the revision you're editing or end up creating. Which wouldn't make too much sense if we offer revert if you're editing the latest revision, we should maybe consider hiding it in that case.
Comment #57
dave reidMade some final tweaks to allow consistent use of hook_form_revision_scheduler_edit_form_alter() to alter the use of the scheduling form in all three places it is output now (entity forms, create form, edit form).
Comment #58
dave reidFinal version that adds extensive test coverage for the revision scheduler on the entity form itself. Fixed undiscovered bugs in access control for operations, as well as execution order of processing operations.
Comment #60
dave reid