Closed (fixed)
Project:
Signup
Version:
6.x-1.x-dev
Component:
Views integration
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
6 Nov 2008 at 10:37 UTC
Updated:
7 Jan 2009 at 01:09 UTC
Jump to comment: Most recent file
I've committed the initial D6 port to HEAD. See #222217-29: Port to 6.x for an initial attempt at Views2 integration. I haven't reviewed or tested it at all, so that code is not committed yet. Anyone who wants to help in testing the D6 port, that'd be a great place to start. You can basically just replace the contents of signup/views with the files from that tar.gz file duellj posted:
http://drupal.org/files/issues/signup_views.2.tar_.gz
Let's use this new issue for all discussion of the initial Views2 port for signup...
Thanks,
-Derek
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 330820_signup_views2_port.21.patch | 61.18 KB | dww |
| #20 | 330820_signup_views2_port.20.patch | 59.77 KB | dww |
| #19 | 330820_signup_views2_port.19.patch | 60.26 KB | dww |
| #19 | 330820_signup_handler_argument_signup_user_uid.inc_.19.txt | 1.16 KB | dww |
| #18 | 330820_signup_views2_port.18.patch | 57.89 KB | dww |
Comments
Comment #1
dwwUpon further testing, the stuff from duellj needed a lot of work, since that was before some of the final views API changes (e.g. hook_views_handlers(), etc). But, it was still a very good starting point. I've split all the handlers into separate .inc files, did some other fixes to make it work with the official views 6.x-2.1 release, and corrected #330961: Call to undefined function views_load_cache() (which I marked as duplicate with this issue).
Mostly this is working now, and folks are free to play with this and test it. The reasons I'm leaving it CNW are:
A) The 'signup_user_list' view from #243035: How to list all signed up users in a view?? isn't included here as a default view.
B) As a result of (A), I haven't really tested if the advanced setting to embed a view for the attendee list on signup nodes works at all.
C) The advanced setting to embed a view still hard-codes page and block display types from the views1 days. In the views2 world of multiple display types, we need to rethink this setting. Related to this, theme_signup_view_label() still is looking for
$view->blocketc, which no longer exists.D) We don't take advantage of views2 relationships at all. Signup is a perfect candidate for exposing a relationship. I'm not yet sure if we should handle that as a followup issue, or if we should more fundamentally think the views2 support around the basis of a relationship before we commit all this.
Comment #2
geodaniel commentedThe views support works on the whole, though as you point out there are issues with embedding the view on a node, and in particular I get an error about undefined function views_build_view() when I try that.
Comment #3
scottrigbyhi dww,I'm trying to allow users to Signup for one or more times for each event (datefield) -- so far, I've had to made different events for each time I want to make available (which get's kind of bloated and redundant). Here are a few possible solutions I can imagine including Views integration, and would need help am hoping one of these will allow me to use Signup for this. (I'm asking which if any of these ideas seems the most plausible?):
1. It could be useful to create several date fields on each event, and allow users to Signup for each date-field as desired.
2. Perhaps there could be a Signup link made available to views (so one could create for instance a table list of events, with a Signup link next to each - similar to Flag)?
3. Or can 'Signup' (and 'Cancel signup') be exposed as Drupal Actions, so other modules like Flag could trigger the action? Actually, this seems the most ideal...
Thanks for considering this possibilities - and advice about which if any are the most likely :)
Scott
Edit: Yep - you're right, this is not the place for this (sorry bout that)
Comment #4
dww@scottrigby: Please don't derail this issue with other feature requests. This is about getting the existing views support working in views2, nothing more. That said, please see:
#325493: Signup per time slots
#166619: expose form elements as views "fields"
Comment #5
scottrigbydww, ok, regarding testing Views2 integration,
I set up a clean D6.6 installation with only:
* cck-6.x-2.0.tar.gz
* date-6.x-2.x-dev.tar.gz
* signup-6.x-1.x-dev(2).tar.gz
* views-6.x-2.1.tar.gz
Then applied patch in #1
It took me some time to realize that signup.views_default.inc & signup.views.inc both go in the signup/views directory... and that the 9 handlers go in signup/views/handlers directory (the patch added them all to the signup root, didn't create the handlers directory etc - but maybe I'm just not applying the patch correctly). Anyway, now I finally get the Signup views :)
* I made a new content type 'event' and added a date field.
* created an event
* signed up for my event
All seems to work well :)
The signup_current_signups & signup_available_signups views show up on my user profile under the Signups tab.
I'd test more but not sure exactly what's available to test here - this is very promising though!
Scott
dww, btw I asked a more related question about the status of exposing form elements to Views2 in that other issue (thanks for the pointer). I mention it here because this is about Views2 integration... but keeping it there because it sounds like more of a feature request :)
Comment #6
dwwNew patch that renames the handlers to be in accordance with the suggested naming scheme for handlers. Still doesn't add relationship support, that's coming soon (and will really fix up a lot of the somewhat kludgy handlers in here now).
Oh, and yes, all the signup_handler*.inc files should go into the views/handlers directory. That directory now exists in CVS, there are just no files in there, so you might need a
cvs up -d viewsbefore you apply the patch...Comment #7
duellj commentedThanks for updates to this patch, dww! I've found a couple bugs, but before I post a patch, a couple questions:
If I, for example, rename the field handler for $data['signup_log']['uid'] from views_handler_field_signup_user_username to signup_handler_field_signup_user_username (as it is named in signup_vies_handlers()), then views can find the field handler.
Is this a bug from views, or by design? I haven't quite familiarized myself with the new API completely yet.
Thanks,
Jon
Comment #8
dwwYeah, I just renamed the files, classes, and references in signup_views_handlers(). I forgot to rename them in signup_views_data(), but that's an easy fix.
However, a few of these handlers are stupid (from the original views support, not because you did anything wrong converting to views2) now that views supports relationships. I've been getting some help from merlinofchaos on how to best handle these things, and will be posting a new patch sometime soon (hopefully tomorrow) that introduces relationships between nodes and users by means of the {signup_log} table. Once we have that, we can remove a few of these existing handlers and fix the default views to use the relationship, instead. That'll also make it a lot easier to implement the signup_user_list view I mentioned in 1.A above.
Comment #9
dwwThis fixes signup_views_data() for all the new class names, and includes the stub of a missing handler (signup_handler_field_signup_user_email). However, I still haven't actually had a chance to get the relationships working, and that needs to happen before any of this is committed, since it means the default views are going to need to be different, some of the handlers will need to be re-written, and some of the handlers won't be needed at all.
Comment #10
dwwGetting closer.... ;)
- Adds a relationship in {signup_log} to the {users} table.
- Removes signup_handler_field_signup_user_username (which you can now get from the relationship).
- Removes signup_handler_argument_signup_user_uid (which you can mostly get from the relationship).
- Adds the signup_user_list default view, using the relationship.
- Fixes the signup_current_signups default view to use the relationship.
- Breaks the signup_available_signups default view by trying to use the relationship. ;)
While drinking the relationship koolaid, I thought we could completely get rid of signup_handler_argument_signup_user_uid. However, I asked merlinofchaos about it and he said the support in that argument for "nodes this user didn't signup for" is really tricky. So, it's possible we'll need to restore this custom argument handler after all, but I'm going to see if there's a better way still utilizing the relationship before we do it that.
Here's the updated TODO-list for this issue:
A)
The 'signup_user_list' view isn't included here as a default view.Done.B)
Fix the code to embed a view for the signup user list on signup nodes.Fixed with patch #11.C) Fix the UI so that you can select the display you want from the currently selected view, instead of the D5 page vs. block hard-coded stuff.
D)
We don't take advantage of views2 relationships at all.Done.E)
Figure out how to build the signup_available_signups view, ideally using the "Signup: User" relationship, but perhaps by going back to our custom signup_handler_argument_signup_user_uid argument handler.Fixed by patch #20.F)
Add an argument validator plugin to filter on signup-enabled nodes (so that signup_user_list only appears on signup-enabled nodes). This is the D6 way to do this, instead of the D5 hook_views_url_tokens() that exposed a "$signup" url token.Fixed by patch #12.G)
Implement signup_handler_field_signup_user_email such that if it's an authenticated signup, we grab the {users}.mail field from the relationship and if it's anonymous, we grab {signup_log}.anon_mail directly from our table.Fixed by patch #13 (I think). ;)Comment #11
dww(B) is now fixed. (C) is a little tricky, since it seems like the best thing would be to use a little AJAX to figure out what display ids are available based on the currently selected view. Not sure I want to get that complicated. For now, it works with 'page' and 'block' displays, which should probably cover 98% of all use-cases, anyway.
Comment #12
dwwFixes (F) by adding a "Signup status" argument validator plugin, and adds that to the signup_user_list view. Also fixes a syntax error in signup.install from the previous patch. ;)
Comment #13
dwwThis seems to be the right way to fix (G). I'm including the signup_handler_field_signup_user_email.inc file as a separate attachment, too, to hopefully make it easier to get views2 experts to confirm. ;)
Comment #14
dwwRerolled after #328840: Rename the email tokens, especially %event and %eventurl
Comment #15
scottrigbyHi dww - I tested #13 on a clean install and it looks like the Signup validation is not correct --
Looking at the view 'signup_available_signups' for example:
- I click on the argument
- look under 'Validator options'
- the validator has '' selected, rather than 'Signup status'
- yet Signup status appears below no matter what is selected.
This actually happens when 'nid' is selected as an argument for any view.
Comment #16
dwwdo you have a singup/views/plugins directory with a .inc file in it after you apply the patch?
Comment #17
scottrigbyThe patch didn't create that directory, but I gathered form looking over the patch (and talking with you earlier about the handlers) that there needs to be a signup/views/plugins directory.
The file signup_plugin_argument_validate_signup_status.inc was added to the signup/ root, but I moved it to the signup/views/plugins directory (and again moved all handlers to signup/views/handlers).
I'm attaching the results of my auto/manual patching
Comment #18
dwwAfter feedback from merlinofchaos via IRC, improved signup_handler_field_signup_user_email.inc quite a bit.
NOTE to reviewers: To apply this patch, you need to checkout a fresh copy of signup from HEAD, run
cvs up -dto make sure you have the views/handlers and views/plugins directories, then from the root of the signup directory, runpatch -p0 < 330820_signup_views2_port.18.patch.Comment #19
dwwThis fixes (E), the signup_available_signups view. merlinofchaos thinks that a custom argument handler is really the only way to get this working (like we had up until patch #10). So, this fixes up signup_handler_argument_signup_user_uid.inc a bit, changes the signup_available_signups view to use this argument handler and not the
{signup_log} -> {users}relationship, and otherwise gets the view working properly again.I'm a little worried that this argument handler completely breaks if you add the
{signup_log} -> {users}relationship on a view that uses it, since that adds an INNER JOIN on {users}, and that breaks the LEFT JOIN logic the handler is doing. Not sure what to do about that part. Also, the UI is a little confusing -- perhaps this handler shouldn't be general, and should be named specifically as the "filters nodes the given user id has not signed up for" argument handler, and then do away with the checkbox. Not sure about that, either. ;)Once these questions are resolved, the only thing that remains from the known problems is (C) -- how to select the right display name for the view you want to embed for the user listing. merlin's suggestion there was to just have a single selector with "name - display_name" options. Makes for a bigger list, but much easier than trying to split it out into two settings.
Comment #20
dwwThis fixes up some of the problems with signup_handler_argument_signup_user_uid.inc, although things are still a little broken if you add the
{signup_log} -> {users}relationship. That relationship really doesn't make sense for views trying to use this argument, so I think it's fine. I also changed it to use a pseudo field definition in signup_views_data() so that I had more control over how this argument appears in the UI, and did in fact hard-code it to be the "nodes you haven't signed up for" argument, instead of trying to be a generic one that can handle either.Comment #21
dwwWoo hoo, this solves all known issues. ;) (C) is now solved as per merlin's suggestion which I described in #19. Definitely makes for a slightly unwieldy drop-down list, but otherwise, it works great. Sites can always implement their own version of theme_signup_view_label() if they want to remove the descriptions, etc.
Comment #22
dwwDecided to commit this to HEAD, since it all seems to work for me. However, more testing is definitely welcome. If anyone else runs into any problems, please open new issues about them. Thanks!
Comment #23
dwwNote: the previous version of this was broken if you tried to embed a block view as the signup user list. The problem was that I was using
$view->execute_display(). merlinofchaos tells me that returns output suitable for the display's context, and in the case of block displays, that means an array suitable for hook_block(). If we just want the rendered HTML for the display, we need to use$view->preview(). Slightly counter-intuitive, but it works. Committed to HEAD.Comment #24
jrbeemanMy initial testing is showing good results and no issues to report so far. I'll keep testing, but it's definitely good enough to . I've been using Signup 5-2.4 until now and the Views integration is a very welcome addition. It will allow me to clear out a large portion of the messy node signup admin override code I had written for the Signup Status module.
Comment #25
dwwFYI: related bugs/problems:
#336442: Views2 filters for signup disabled/enabled and 'send confirmation' broken by cut+paste error
#336450: Signup's views2 boolean filters have terrible UI
#336461: Incorrect filter handler for "Signup: Reminder: Enabled/Disabled"
Comment #27
dwwJust noticed one other minor problem with the initial Views2 support -- we no longer need to conditionally load anything in signup_init() since Views does that automatically thanks to hook_views_api(). Committed to HEAD and DRUPAL-6--1:
http://drupal.org/cvs?commit=163084
http://drupal.org/cvs?commit=163085