I know that there is another issue which tries to provide a switch to active save-draft per content type (http://drupal.org/node/1057490). But I strongly believe it would be better to have this option on the content type page (eg admin/structure/types/manage/{my-content-type}).

Taking the automatic nodetile module (http://drupal.org/project/auto_nodetitle) as a blueprint, I have built this functionality.

I hope that this will be commited, and therefor I am willing to further work in the code, if needed.

Patch follows...

Comments

valderama’s picture

here are 2 patches (one with the modification, the second with a new file).

apply both.

valderama’s picture

Status: Active » Needs review

changing status to "needs review"

beeradb’s picture

StatusFileSize
new3.38 KB

I think this is super reasonable functionality and should be included. I did a review + cleanup of this patch and I believe it's good to go.

* Lots of whitespace and coding standards cleanups
* Moved the default to be enabled for all content types.
* Removed the update hook, as it was no longer needed (and wasn't originally used in the first place?).

populist’s picture

Would it be possible to have the Save Draft functionality default to being on instead of being required to turn on each time?

populist’s picture

Check that. Looks like #3 may have done that.

johnhanley’s picture

+1

Also back-port to Drupal 6.

rooby’s picture

Title: Provide option to enable "save-draft" feature on content-type page » Provide an option to enable "save draft" feature per content type
StatusFileSize
new3.97 KB

Here is a new version of the patch in #3.

Changes are:
* A tiny bit of code cleanup.
* Changed the option from radios to a single checkbox as there is only enabled or disabled.
* Moved the fieldset summary js into the existing behavior instead of creating a new one (no point having them separate unless they are going to be in different files).
* Changed the js to automatically handle other checkbox settings that may be added in future (I am planning to add one in another issue).
* Changed the name of the save_draft variable to save_draft_enabled, because save_draft is the namespace and enabled is the variable.
* Removed the save_draft_get_setting() function as it is redundant.
* Changes the part that checks access & enable flag to check for enabled flag first so that the access check function isn't run for no reason.
*

rooby’s picture

Same patch as #7 but with tests to test enabled & disabled.

beeradb’s picture

Status: Needs review » Fixed

Committed #8 with one small change, I adjusted the weight on the save_draft tab so it wasn't the default tab when editing content types.

Thanks for the work guys.

valderama’s picture

I am happy to see this committed finally!

And thanks for the credit :)

rooby’s picture

Great thanks. I was hoping this would get in as I was building on top of it for the patch in #1786442: Allow saving drafts with missing required fields.

rooby’s picture

Status: Fixed » Needs review
StatusFileSize
new620 bytes

Sorry, but the patch in #8 was not quite right.

It was missing the install file that was in the older versions of the patch and had some file permissions changes that it shouldn't have had.

This one will fix it.

rooby’s picture

Status: Needs review » Reviewed & tested by the community

As per #1786442-23: Allow saving drafts with missing required fields, which tests this patch along with the one in that issue, this should also be RTBC

mrpauldriver’s picture

I think this is important functionality.

Any chance that this commit and later patch can be rolled into an updated release?

dooug’s picture

Applied the patch from #12 cleanly against latest 7.x-1.x-dev. This also fixes the file permissions on save_draft.module and save_draft.test.

I tested the uninstall and the variables are removed. Works as expected. Thanks! Please commit this!

rooby’s picture

I have commit access now so I will commit in the next few days when I get a few minutes.

deanflory’s picture

When I use the latest file commits copied over 7.x-1.4 to create a "dev" version that doesn't exist on the project page, I get this WSOD error when attempting to enable the module:

Parse error: syntax error, unexpected T_STRING in /.../sites/all/modules/save_draft/save_draft.module on line 1

I'm going to try it with just v1.4 and the patch in this issue without any other commits included, otherwise I'll deem this module unusable, what a mess. I've decided to just use the Save & Edit module instead as is provides the same functionality for new nodes.

rooby’s picture

I have had no internet at home for the last week but this week I will sort all this out.

I have now shown the dev versions on the project page

Renee S’s picture

Any luck with this? There hasn't been a new dev since before this issue. Thanks!

rooby’s picture

Really sorry peoples.

The follow up in #12 has been committed.

rooby’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Patch (to be ported)

Will backport to drupal 6.

pmackay’s picture

Is there any chance of getting a v1.5 release out that would include this on 7.x?

maedi’s picture

Well the per content type setting does seem to be on the dev branch.

mrpauldriver’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Removing patch to be ported as D6 is nearly done with. Changing to RTBC as this needs to go into the next version for D7

rooby’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

There is no action here for D7 as it has already been committed.

I would like to do a D6 commit for either this patch or an upgrade path to D7 since currently the 2 versions are out of sync.

I have planned some time to work on this module this weekend to go through the issue queue and get a new stable release out.

rooby’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Fixed

Since this has already been committed to D7 and D6 is no longer supported, setting back to 7 and marking as fixed.

I cannot reproduce the issue in #23 however if you can please feel free to reopen.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.