Dear all

A customer of us needed the views support for revision moderation. Most of the fields are already implemented in Views 2.

A common field and a filter that is missing is the field "Node Revision State".

Attached you will find a patch with the Views 2 implementation.

Please review it and include it in the next release.

Credits: ayalon Gmbh, www.ayalon.ch

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nirbhasa’s picture

I tested the patch - a couple of things:

1. The views files folder should probably be called 'views' instead of 'views2'

2. The field and filter title (Revision moderation: Node Revision: State) is a bit unweildy, could just change it to (Revision moderation: Revision state).

3. In the filter handler, the 3 options 'Current','Under revision','old' are declared in the operations function. This means that the exposed filter looks very funny unless you unlock the operator.

4. The filter works, but at the moment I am only able to link to current revisions in my views fields - I haven't ruled out that it could be some error on my part though :) Ill try and investigate further.

But the basic field and filter does work as advertised - if people are happy to commit in its current imperfect state, ill upload a patch changing 1 and 2.

nirbhasa’s picture

FileSize
6.14 KB

Heres the aforementioned patch

nirbhasa’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
7.41 KB

I tackled point 3 above and came up with a sturdier filter mechanism - attaching new patch.

As regards point 4 - i think its to do with the node revision filters in views itself, and nothing to do with this module

nirbhasa’s picture

Status: Reviewed & tested by the community » Needs review

Oops - I dont think can mark my own patches RTBC :)

jbrauer’s picture

Status: Needs review » Needs work

Thanks for this it looks like a great start. I need to look at it more thoroughly.

At a glance there are a couple of minor coding style issues. There should be no ?> tag in the revision_moderation.views.inc file and there is an empty comment at the very end of the patch that should be removed.

makara’s picture

Status: Needs work » Needs review
FileSize
9.01 KB

Cleaned a lot.

Also added the field and filter handlers that filter/display node/revisions not published or pending revision.

tanoshimi’s picture

Thanks for the patch - it appeared to apply succesfully, but when I select the 'Revision moderation: Revision state' field to add to an existing view and click the Add button, I get a popup javascript alert box stating:
"An error occurred at http://localhost/drupal/admin/build/views/ajax/add-item/vw_Revisions/def...."

I'm using Drupal 6.15 and Views 6.x-2.x-dev as at 31/12/09 - I'd love to help debug more, but I'm not quite sure where to start...

tanoshimi’s picture

Actually, looking at this again I'm not sure that the patch in #6 is rolled correctly (at least, it doesn't seem to apply correctly using WinGnu32 patch under Windows).

After applying the patch, the contents of my revision_moderation module root directory looks like this:

revision_moderation.info
revision_moderation.install
revision_moderation.module
revision_moderation.views.inc
revision_moderation_actions.inc
views_handler_field_revision_moderation_in_moderation.inc
views_handler_field_revision_moderation_state.inc
views_handler_field_revision_moderation_in_moderation.inc
views_handler_field_revision_moderation_state.inc

There's two obvious issues here: the first is that I have duplicate copies of each of the views handler include files. Looking at the patch,
moderation_in_moderation.inc is created both in line 120 and line 203
moderation_state.inc is created both in line 158 and line 236

Secondly, it appears that these includes should have been created in a /views subdirectory, but on my instance at least, they're getting created in the module root. Unfortunately, manually fixing both these problems has not prevented the error I reported previously. I'll keep investigating.

makara’s picture

Hi tanoshimi,

Not sure what's the problem. I followed http://drupal.org/node/550576 "Adding directories" to add a "views" folder. And I tested on CVS DRUPAL-6--1 with "patch -p0" successfully.

The two pair of handlers are not the same, one is field, another is filter.

Makara

tanoshimi’s picture

Hi Makara,

Thanks for the reply - no, I don't know why the files weren't created in the subdirectory either.
It might not be a problem with the patch - I'm wondering if it's to do with a permissions issue of the GnuWin32 patch.exe not being able to create new folders (I am running Win Vista...) but I've never had a problem with other patch files.

I had realised that the include files were different, but I don't think it's a great idea to have two identically-named files, one containing the filter and one containing the field. I would expect either these should be merged into the same .inc file, or alternatively they be named something like as follows:
views_handler_field_revision_moderation_in_moderation.inc
views_handler_filter_revision_moderation_in_moderation.inc
views_handler_field_revision_moderation_state.inc
views_handler_filter_revision_moderation_state.inc

anyway, thanks for your help.

jamesodmitchell’s picture

I have installed the patch by running the command in terminal and all the files appeared in the revision_moderation folder. What do I need to do to install it to make it appear in views ?

Please help I have been looking everywhere for this!

Thanks
James

hillaryneaf’s picture

subscribing

jbrauer’s picture

Status: Needs review » Fixed

Committed to CVS. http://drupal.org/node/289697 will contain this patch once it is refreshed.

Status: Fixed » Closed (fixed)

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