harrrrrrr’s picture

Version:6.x-3.9» 7.x-3.11
Status:Active» Reviewed & tested by the community

Tested and approved.

harrrrrrr’s picture

Version:7.x-3.11» 6.x-3.11
quicksketch’s picture

Title:Webfrom status views handler» Add a Views handler (field/filter/sort/etc.) for Webform "status" field
Category:support» feature
Status:Reviewed & tested by the community» Needs work
+  $data['webform']['table']['group'] = t('Webform infos');
+  $data['webform']['table']['join'] = array(
+    'node' => array(
+      'left_field' => 'nid',
+      'field' => 'nid',
+    ),
+  );

The name of this category should probably be just "Webform". "infos" is not a real word.

+    'title' => t('Satus'),

Should be "Status".

+      'handler' => 'views_handler_field_numeric',

We should write a custom handler for "Active" or "Inactive" to be displayed instead of 0 or 1 for the field value, just like the Node Published/Unpublished field and filter. Using the numeric handler is functional but lazy.

jweowu’s picture

Version:6.x-3.15» 6.x-3.11
new1.05 KB

Here's a re-roll of the original patch (edit: for 7.x-3.15). I've fixed the language issues, but haven't implemented a custom handler.

I've also changed the join to an inner join, because an outer join was unnecessary (for the query being generated).

An outer join might potentially be desirable, as no row is added to the webform table until a form component is created. However the View would need to be testing the specified value against COALESCE(webform.status, 0) or similar for a left join to actually return those rows. A NULL webform probably shouldn't be considered equivalent to a closed webform, though.

jweowu’s picture

Version:7.x-3.15» 6.x-3.15

edit: Oops.

jweowu’s picture

Version:6.x-3.11» 7.x-3.15

Ah, I had meant to set that to 7.x-3.15. I saw the 6.x-3.9 » 7.x-3.11 change in #1, didn't notice that it had been changed back in #2, and managed to just adjust the minor number without even noticing the major number. So to clarify, the original patch was for Drupal 6, and the patch in #4 is for Drupal 7.

quicksketch’s picture

Version:6.x-3.11» 7.x-3.15

The latest patch works on both D6 and D7 without changes.

This patch needs a dedicated handler for Open/Closed status for both the field and filter. The comment module Views integration provides a pretty good example of how to do this with minimal effort.

bdone’s picture

Version:7.x-3.15» 6.x-3.x-dev
Status:Needs work» Needs review
new4.13 KB

here's a patch against 6.x-3.x that includes...

  • boolean vs. numeric handlers
  • adds a dedicated field handler
  • adds a dedicated filter handler
  • formats code comments to match existing ones
bdone’s picture

Version:6.x-3.x-dev» 7.x-3.x-dev
new8.62 KB
new4.05 KB

here's the same patch against 7.x-3.x and a view export for testing

bdone’s picture

do these patches need anything else for a review?

quicksketch’s picture

Status:Needs review» Needs work
new2.18 KB

The D6 patch doesn't seem compatible with Views 2 on Drupal 6. Was this written against Views 3?

The D7 patch worked pretty well but the type (open/closed, yes/no, etc.) would always revert back to open/close when editing. I've fixed that problem in this iteration.

This patch also makes a new "Webform" group in Views, but we're currently piggy-backing off the "Node" or "Content" groups for things like the Webform Edit and Results links. I think it'd make sense to convert these all to the "Webform" group, or we can keep using the existing groups. We shouldn't split between two different locations though.

quicksketch’s picture

Doh, apparently I just forgot to add the new files to the webform/views directory. Patch worked fine in Views 2 after that minor fix. I'll look into the minor cleanup and post an updated patch.

quicksketch’s picture

Status:Needs work» Fixed
new7.46 KB
new7.46 KB

Updated patches that simply move all the Webform fields into a common category.

Status:Fixed» Closed (fixed)

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