I check the draft Form and I think we should improve the setting form. In order to use the draft feature, I must complete the following steps :

- Check the Draft setting form (I think configuration will be there by default)
- Goto Content type list (I have to check the code to understand this)
- Select content type I want to enable draft feature
- Submit the form

Not yet, I have to go to my profile to enable autosave feature (this is most useful feature, after all).

So I suggest that :

- Allow user to enable draft features for content types on Draft Setting, and keep the checkbox on Content Type form too. [recommend]

- Display a message to user when they create content that they can enable auto save feature in their profile. This message can be disable by user [suggest] or let enable the auto save feature by default [suggest]

I'm willing to help on this feature.

:)

Comments

darren.ferguson’s picture

MMM need to think on these since i know that the reason for having the draft informaiton in content types is other modules do the same like translation etc.

As for auto save i did it this way due to a requirement for us to have it that way, might make it change able but we are trying to make the modules so we do not have to patch, and if i turn it the other way for autosave then i need to patch in our system.

nquocbao’s picture

Yes, for the draft information we keep in the content types, but also provide the options to enable draft on content type in the draft setting form, or at least provide a message to user where and how to enable draft. help is missing, i thought.

I will make an example tonight.

nquocbao’s picture

StatusFileSize
new24.11 KB

Here is the first version. sorry for the zip, I'm using windows and i'm quite new to CVS so I can't generate patch for this changes :(

Changes:

- user can enable draft for content types directly in Draft setting form (draft_admin_settings)
- draft is only saved when user changes form. This will save requests & improve performance for the module. (Drupal.draft.saveForm)
- prevent multi draft save as a same time (Drupal.draft.saveForm)

I think we should replace the "draft is saving" div with something more interesting. Please check http://preloaders.net/

I also found that draft doesn't play nice with Nicedit, it can't save the form. I will check it.

I will add more features tomorrow.

Thanks

P/s : Because I need this module in production, so I will pay alot of contribution to it. Please give your comment :)

nquocbao’s picture

Issue tags: +Usability
nquocbao’s picture

Title: Usability » Module enhancement
nquocbao’s picture

I found that draft doesn't work correctly when enable for edit node. When I edit a node and save form as draft, the link in Draft List leads me to node/add.

Also, We should run a cron to remove all empty draft (data = null) ,since this is user mistake.

I will try to work it out.

nquocbao’s picture

I found a bug :

- open a create node form which draft is enabled
- don't type anything, click save
- form validation fails and turn you back to the form
- save as draft failed now because the form is cached and draft_form_alter isn't called

I will try to work it out

nquocbao’s picture

StatusFileSize
new28.78 KB
new1.62 KB

Here is the v2 version :

- add cron to remove empty draft from user
- nicEdit now works well with draft
- improve the "saving" message (check the screenshot). This is requested by user : #367171: Better presentation for "saving draft" feedback

nquocbao’s picture

StatusFileSize
new4.05 KB
new29.13 KB

Here's the v3

- fix the bug which I described in #7
- remind user that he can enable auto save feature in his profile [check screenshot]

Draft module is getting better and better :)

nquocbao’s picture

I will fix recent issues in next version. Meanwhile I'm thinking about allow draft to correctly restore form for exist node. Currently Draft only restore form to new node (check #6).

This will require me to change the db structure. I will try to fingure it out.

nquocbao’s picture

Status: Active » Needs review
StatusFileSize
new29.57 KB
new2.96 KB

v4:

- Remove default draft_autosave_interval , since it's not used anywhere. This value is only used when user enable autosave, but when user enable auto save, interval value is also set (default 30000) and then it is override by user setting (it's a circular problem). So I just add default parameter to 30000 (draft_init_js)

- update draft_uninstall to remove all draft variables correctly (include user setting)

- draft is only created in draft_save, this means drupal doesn't have to create draft for every form build, draft is only created when user press save as draft or autosave trigger it

- draft now also save node id and node title. This requires changes in schema, i also provide a update function, run update.php if you need to update from your old version

Currently I'm implementing the quick load feature (check the screenshot). It will allow user to load his last draft and allow him to go to his draft queue quickly. But in order to implement this feature, I think I will need to replace current draft/list generated by views with a better one.

If you have sometime, please take a look at this. I have pay alot of time to this :(

Thanks

bsimon’s picture

I just tried draft_v4 to try to give you some feedback... I had some problems - edit: I Just realized I needed to run update.php, which is probably why I had all these error messages... so you can probably ignore them. The difficulty with testing this is that (although I do backup db), I still don't really like to mess with the db on a production site.

On any create content page, I get this type of error when the page loads:

user warning: Unknown column 'title' in 'field list' query: select draft_id,title,updated from drafts where nid = 0 and node_type = 'page' LIMIT 0, 1 in /[PATH]/sites/all/modules/draft/draft.module on line 192.

I also get this error on /draft/list view, sometimes (maybe only just after Draft Module has performed some action)

user warning: Unknown column 'title' in 'field list' query: UPDATE drafts SET title = '', data = 'a:21:{s:5:\"title\";s:0:\"\";s:16:\"menu(link_title)\";s:0:\"\";s:12:\"menu(parent)\";s:15:\"primary-links:0\";s:12:\"menu(weight)\";s:1:\"0\";s:8:\"language\";s:0:\"\";s:14:\"teaser_include\";s:1:\"1\";s:9:\"teaser_js\";s:0:\"\";s:4:\"body\";s:0:\"\";s:6:\"format\";s:1:\"1\";s:7:\"changed\";s:0:\"\";s:7:\"form_id\";s:14:\"page_node_form\";s:8:\"revision\";s:0:\"\";s:3:\"log\";s:0:\"\";s:4:\"path\";s:0:\"\";s:7:\"comment\";s:1:\"0\";s:4:\"name\";s:7:\"[USERNAME]\";s:4:\"date\";s:0:\"\";s:6:\"status\";s:1:\"1\";s:7:\"promote\";s:0:\"\";s:6:\"sticky\";s:0:\"\";s:7:\"node_id\";s:4:\"null\";}', updated = 1234440081 WHERE draft_id = 7736 in /[PATH]/sites/all/modules/draft/draft.module on line 334.

I also use a modified draft/list/ view (it displays more fields and displays them in reverse order). This appeared with a slightly different error message

user warning: Unknown column 'nid' in 'field list' query: INSERT INTO drafts (nid, title, node_type, uid, updated, data) VALUES (0, '', 'page', 1, 1234439961, 'a:21:{s:5:\"title\";s:0:\"\";s:16:\"menu(link_title)\";s:0:\"\";s:12:\"menu(parent)\";s:15:\"primary-links:0\";s:12:\"menu(weight)\";s:1:\"0\";s:8:\"language\";s:0:\"\";s:14:\"teaser_include\";s:1:\"1\";s:9:\"teaser_js\";s:0:\"\";s:4:\"body\";s:0:\"\";s:6:\"format\";s:1:\"1\";s:7:\"changed\";s:0:\"\";s:7:\"form_id\";s:14:\"page_node_form\";s:8:\"revision\";s:0:\"\";s:3:\"log\";s:0:\"\";s:4:\"path\";s:0:\"\";s:7:\"comment\";s:1:\"0\";s:4:\"name\";s:7:\"[USERNAME]\";s:4:\"date\";s:0:\"\";s:6:\"status\";s:1:\"1\";s:7:\"promote\";s:0:\"\";s:6:\"sticky\";s:0:\"\";s:7:\"node_id\";s:4:\"null\";}') in /[PATH]/sites/all/modules/draft/draft.module on line 337.

I tried clearing the cache on the drupal server, but no improvement

I had problems with FCKeditor and Draft before, so normally I use a slightly modified draft.js (see http://drupal.org/node/348165#comment-1229474). I did not change draft_v4's draft.js, because I guess this is a different problem.

When I switched from FCKeditor to the plain textarea, it still didn't work. I clicked on 'save as draft', I got the new saving animation in the window top right corner, but nothing new in /draft/list

I replaced draft_v4 with the old draft module files and it is working OK again.

Sorry that this was a very quick test, so it's possible I've done something wrong or not given 100% accurate information here - it's a production site so I can't be very adventurous with my testing... hope this helps, anyway.

nquocbao’s picture

Hi,

Thanks for your feedback. It's really useful to me. Because in the v4 vesion, I add some new fields so you will need to run update.php to update the db. Can you please confirm that it works again after your update ?

I will update your fck problem in the next version.

Really thanks for your reply :) it's first one

adshill’s picture

Hi there,

Was this updated to include a bug fix for this: http://drupal.org/node/353252

All the best,

Adam

adshill’s picture

I installed the update, then ran update.php. During the update.php process (update 6000) I got the following:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL' at line 1 query: ALTER TABLE drafts ADD `title` VARCHAR DEFAULT NULL in /home/annalin1/public_html/includes/database.mysql-common.inc on line 298.

and then when I go to the add node page I get the following error:

user warning: Unknown column 'title' in 'field list' query: select draft_id,title,updated from drafts where nid = 0 and node_type = 'grant_application_form' LIMIT 0, 1 in /home/annalin1/public_html/modules/draft/draft.module on line 192.

Rendering Draft useless.

Any ideas?

Thanks,

Adam

fab65’s picture

Hi, I just install the path v4 but now, i have an issue.
_ I create a new node.
_ I set a title and some word in body field.
_ I save as draft
_ I'm going to /draft/list, it appears in list
_ I click on Edit, the form node load but my modification aren't appear.
With Firebug, i have an error (file jquery.field.js?J (ligne 326)):

inHash is undefined :
 } else if( typeof inHash[n] != "undefined" ){

What's happen?

darren.ferguson’s picture

Status: Needs review » Closed (won't fix)

This thread is not the module draft module there will be a new release with updates to the draft module you can check http://www.openbandlabs.com/blog/2009/mar/3/draft-module-future-improvem... for the road map that the draft module will be taking.

This code that has been put up is constantly giving people errors and also adds new database columns which might not be in the future draft module hence use it at your own risk, i will not be supporting anything in this thread, i will be supporting the future draft module based on the information in the blog posting above.

StevenSokulski’s picture

The blog post you mention is 404ing. Is there somewhere else that I can see a roadmap for this module?

darren.ferguson’s picture

The road map has been reached in that there are some small open bugs in it but no other information as yet regarding future information.
If someone wants features they can ask for them and if implementable and will not effect the module in other ways they can be implemented. Trying to find the time right now is tough since some other work is in the way however if it is in the queue when time is available it will be looked into.