Draft module update released

After a lot of time working on another program, I’ve finally been able to devote some energy to the Draft Module that I created and currently maintain on the Drupal Web framework.

The main feature requested for Draft module was a PHP page view instead of forcing the use of Views module. While on my hiatus from Drupal, I brainstormed how to make the PHP version of the page as functional and easy to use as the Views version of the module, as well as allowing the administrator to alter columns.

First order of the day was to add three additional columns to the module’s table in the database. These columns were "title," "body," and "cron_remove." The "title" column is now utilized to hold the title of the node you have saved as draft. The "body" column is utilized to store the body of the node you have saved as draft. The "cron_remove" column was added to make cron's cleanup process easier. The old configuration made cron check for fields and other pertinent information; in this new release cron simply checks whether the "cron_remove" variable has ever been set. If the variable has been set, cron will ignore then entry.

Next was to split the module into two separate modules and remove the Views functionality from the core Draft module. This was quite a painless task requiring creating the sub module draft_views and moving the Views API functionality into the new module. Re-naming all of the Views include functions and making sure that I found all references in the Draft module took around ten minutes to fully remove and update with the extra _views_ text in either the handler, class or function call.

Next, I created a PHP page view for the Draft module to replace the Views view (which was moved into the draft_views module). I wanted the PHP view to allow the system administrator to determine which fields were displayed to the users. I decided to make the viewable fields a configuration option for the module. The system administrator can check the pertinent fields they wish to display in the page, and when the system generates the PHP page it will omit any fields the system administrator did not check. For the PHP view the system administrator is also able to specify the number of drafts that can be viewed per page and I implemented a pager so the user can switch from page to page. The table headers were also made click–sortable; the end functionality of the PHP view is the same as in the Views implementation.

Once the above functionality was added to the module, the next step was to go through the eight weeks of issues in the queue. I wanted to fix the issues in the module without losing any functionality and make the fixes as configurable as possible. My goal was to ensure removing old pieces of the module didn’t decrease functionality.

The main issues resolved in this module update:

Main features:

  • #368017 split Drafts and Views so there is no initial reliance
    on views. PHP view has been added to the main drafts module so people can see their drafts if Views module integration is not active.

Module changes:

  • #379838 Portuguese (Brazilian) translation (thanks to lourenzo).
  • #367165 updated default fields shown in the view (view was updated to accommodate the new database fields).
  • #361812 added configurable view URL for draft views module so the user can specify it if they change the draft view URL.

Bug fixes:

  • #406648 added units for the autosave interval in administrator settings.
  • #367184 added same as above and also for user form settings.
  • #368286 shortened the text fields utilized for autosave intervals.
  • #369042 reworked so cron will not delete the draft if the admin specifies.
  • #367171 updated the “processing draft” message; moved to right hand corner instead of bulky div in the middle of the users screen.
  • #353252 fixed bug with node names and underscores not being handled properly.
  • #367180 provided user feedback when draft was loading since it looked like nothing was happening for the draft populate form timeout.
  • #348165 code updated for FCKEditor and verified with their site to work.
  • #361809 fixed issue where preview button would stop drafts from being saved.

This update has a lot of new material, so my next blog post regarding Drafts will focus on how to configure and administer the module.

Comments

Some minor issues remained

Some minor issues remained with the Draft module particularly with the FCKEditor. These minor issues have been corrected and module release 6.x.1-4 is the current official release for the Draft module. Below is an overview of the bug fixes that were not caught in the original release above.

Main features:
- #415122 Added the ability to go back to the node edit when using the save
draft functionality on an existing node. This will save the system
creating a new node every time and will instead update the existing
node already created in the system.

Bug fixes:
- #418314 Updating the FCKEditor code so that the html is there before it finishes
loading that way the data is put correctly in the FCKEditor box for the
textarea
- #416100 Added handling so the module would not fail if the content module
does not exist in the users installation. Do not want to make the
content module a dependency so have added code to fallback to a default
if the content module does not exist. (This code was introduced
originally to handle the admin selecting the Title and Body field from
the content types list of known fields supplied by the content module)
- #420394 Added check for user permissions in the user edit form since the module
was always showing the draft information even if the user did not have
sufficient privileges to access drafts in the system

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options