Hi,
The date field widget repeat options, whilst very flexible, are overkill for some simple use cases. For example, a birthday or anniversary reminder where the repeat rule will be every year. (It's also a bit off-putting when asked for the end date in a birthday/anniversary context!)
It would be great to be able to set a field up with a preset rule so that the user is presented with a checkbox labelled something like 'every year'. One example is the Amazon 'create reminders' form which has a single 'every year' check box. Looking at iCal I see there are selections for every day, every week, every month, and every year, plus a custom option which leads to the full repeat options form.
As I couldn't see any mention of this sort of functionality I took the liberty of making a small patch which supports the basic use of a single checkbox to invoke a single preset rule. To enable the checkbox (and disable the standard repeat form) there is a setting in the date widget settings page, together with settings to enter the preset rule and to give the checkbox a label.
An example rule would be: RRULE:FREQ=YEARLY;INTERVAL=1;UNTIL=20120615T230000Z;WKST=SU. There has to be an UNTIL in there but in this context I would set it to the expected life of the site. I think there are plans to remove the requirement for UNTIL but from what I've seen that's a major change.
If there's any interest I'm sure it wouldn't be too hard to roll something more substantial.
Andy
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | date_repeat_presets-6.x-1.x-dev.tar_.gz | 8.08 KB | chaps2 |
| #25 | date_repeat_presets-6.x-2.x-dev.tar_.gz | 4.51 KB | chaps2 |
| #20 | date-397902-3.patch | 21.75 KB | chaps2 |
| #16 | repeat.png | 11.67 KB | entrigan |
| #2 | date-397902-2.patch | 23.49 KB | chaps2 |
Comments
Comment #1
chaps2 commentedoh, and here's the patch:
Comment #2
chaps2 commentedAnybody?...
Here's a slightly improved version. Check out a demo on http://demo1.locologic.co.uk. Log in as cckfp/cckfp to get admin rights over content types and edit event type to see the admin interface. Create events or edit user profile to see it in action.
Comment #3
arlinsandbulte commentedI checked out your demo, looks nice, but I think this is a better approach: #272404: Make 'until' field optional.
If we just make the until date optional, you would not need a check box for every year (or every month, or every week, or every day, or every hour........), and it could use the current repeat options, which are already in place.
Also, we don't need to eliminate the year requirement for things like birthdays and anniversaries. Those items could just be set as yearly repeating with no until date (goes forever). After all, they DID really happen on an actual date with a year.
I do agree that the current repeat options can be overkill and confusing, but they are quite powerful, allowing for all sorts of repeat options. Instead of reducing the functionality, though, the interface could be improved. Also, if you don't want to expose all that power on your site, how about using some hook_form_alter or theming to adjust?
What do other people think? Do my thoughts above make sense? What direction should the Date module take?
Comment #4
chaps2 commented@arlinsandbulte - thanks for your comments - great to have some feedback.
IMO this patch and #272404 address different issues. Removing the need for the until field helps - being prompted for an end date can be a very unnatural thing in some contexts - but it's not the whole story.
In my demo I have two fields birthday and anniversary on the user profile node which are implicitly repeating dates. The user shouldn't be prompted for any repeat date information. This patch allows you to do that.
NB the lack of year field is nothing to do with the patch but how I configured the date field widgets. If I wanted the year then the fields would be labelled date of birth and marriage date respectively! Also repeating dates store a row in the database for each repeat (although the #272404 issue should fix that) - if somebody entered the birthdays of all their elderly relatives there would be 80 odd rows for each birthday entered most of which are serving no purpose whatsoever (I mean rows not relatives!). If I do need the year they were born I'd probably capture it in a separate field.
In answer to your last point I think this patch compliments the existing repeat date functionality. It certainly doesn't reduce it. Of course you can do much with hook_form_alter and theming but IMHO this is a regular feature that should be accessible to all.
Comment #5
karens commentedI agree there is a need for a simpler UI for repeats, but there is no agreement about exactly what that would look like. I think your concept is interesting, a number of preset rules with simple labels, 'yearly', 'weekly', 'every Monday, Wednesday, and Friday', etc. The problem is deciding what those presets should be and coming up with a list that is long enough to be useful without being overwhelming.
We can easily add in a field setting to allow a switch from the 'simple' to the 'advanced' form, or keep the advanced options hidden away in a collapsed fieldset, or whatever.
Before spending time writing code though, I would like to see some thought go into exactly what this UI would look like -- what options would be shown in our 'simple' model.
I have been looking at other calendar systems for guidance -- Google calendar, Yahoo calendar, Upcoming.org, Meetup.com, etc. I think it is perfectly acceptable to take screenshots from them and make notes and changes on them and saying 'we should make it look like this'.
Comment #6
chaps2 commentedLooking at iCal (I will look at some others) here's what I would want it to look like:
From a user's perspective we should support the following types of repeat date UI:
Full repeating date but without until date. Until date is preset by admin (per field or system? - per field with system default). Takes some pressure off a proper implementation of #272404: Make 'until' field optional although export would reveal hidden UNTIL.or 4. I don't see any sense in combining 1 + 3or 4. List of presets includes a custom option.For the administrator the date widget admin interface needs:
Checkbox to hide and preset until date.Field to enter the until date - similar to the "date to" field.I suppose an alternative to admin preset rule entry would be to use the full repeat date UI in place of a text field - clunky but easier.
@KarenS - having used cck, date, and calendar, I really appreciate the time and effort you (and others) have put into them - truly impressive!
Comment #7
arlinsandbulte commentedHmmm, all good thoughts here.
Here is another one:
What if we are approaching this from the wrong direction? In the case of a birthday or anniversary, in reality, these ARE SINGLE dates (I was born on mm/dd/yy at hh:mn), but they are recognized annually (or monthly or weekly in the case of young love-sick couples anniversaries’ ;-).
We could keep the date as such (just a single date event)...
BUT....
In our views, we should be able to filter ignoring the year. So, we could make a list with all birthdays this month or all brithdays today. Or somehow, show all birthdays on the calendar regardless of the calendar year.
This would also be useful for those that want to do some sort of "on this day in history" type queries.
This approach places the burden on how the view display is configured and not how the date is entered, which I think is appealing. Users would have a simple date enty from, but all the heavy lifting would be done by the site builder.
Maybe this is possible now?
Comment #8
chaps2 commented@arlinsandbulte - your proposal addresses implicitly repetitive dates only as it doesn't give the user any option to specify any repeat rule - whether preset or not.
It probably is possible to do it this way but I don't think that negates the need to do it the other way as well. You propose to make a single date look like a repeating date - putting that repeating logic in any view, notifications, or other code/configuration that needs to treat a single date as such. That may be acceptable for very simple use cases but doesn't support the general case very well. If a date represents a repeating event (and I do think a birthday is such an event - but lets not limit the discussion to birthdays and anniversaries) then it is more correct (and more valuable) to codify that information with the date.
Comment #9
arlinsandbulte commentedAhhh, wait. I get it now (at least I think so). I was ignoring the title here. We are really talking about 2 different things.
Your proposal is ONLY about adding another widget type or options for simpler repeat options. The underlying data structure and format need not change, just the options presented to the user. Not quite as all-inclusive, but that is not always needed.
Great! I wholeheartedly agree!
Sorry for confusing the issue.
I was trying to promote the #272404: Make 'until' field optional issue, which I now understand is something completely different than what you intended (although as you said, quite desirable).
I will put the "on this day in history" feature request in another issue.
Comment #10
chaps2 commentedPerhaps I'm guilty of confusing the issue by including an until date work-around in the list of features for the UI. I'll remove it as it doesn't really belong in this issue.
Comment #11
linksync commentedHi chaps 2 - love your patch - had a client that needed to add several hundred pages to their site, all with anniversaries, and your repeat option saved them.
Any chance you could post a patch version for the most recent dev version of Date?
Thanks again.
Comment #12
xkater commentedsubscribe
Comment #13
entrigan commentedI like the simplified interface. Now if it only supported multiple presets then this could be a viable widget.
Comment #14
entrigan commentedchaps2: Have you considered splitting this out into a separate module? that might make it easier to work with and hack on.
Comment #15
entrigan commentedI tested the patch from #2 against 2.x-dev and I am getting several of the following error:
warning: date_format() expects parameter 1 to be DateTime, string given in /Applications/MAMP/htdocs/repo/date/sites/all/modules/date/date_api.module on line 710.However the patch works, and it is correctly saving the repeated dates. Thanks for the great patch!
Comment #16
entrigan commentedI hard-coded and hacked the widget a bit so that it is a select list with a predetermined rrule set of options (see image).
I tried splitting it out into its own module, unsuccessfully. I had trouble integrating with the existing date widgets/fields (it seemed like a few things were hard coded). Anyway my code is not well designed, so I am not going to post it, but if anyone wants more info I am glad to share.
Comment #17
nadav commentedTHANK YOU!
chaps2 from #2
You are #1!!
Comment #18
bmblack commented@entrigan - I'm trying to accomplish exactly what your screenshot shows. Could you please share your info w/ me?
Comment #19
twistedindustries commented@entrigan - I second that, please post some code.
I applied the patch from #2 into Date 6.x-2.6 and it didn't seem to work.
Comment #20
chaps2 commentedThanks for all your comments.
Here's an updated patch that works with Date 6.x-2.6 and the latest 6.x-2.x-dev versions. Enjoy!
Comment #21
Marlies commentedI've installed the patch but I'm getting an error now when i go to the specific content type to edit: - manage fields - date:
Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/date/date/date_admin.inc' (include_path='.;C:\php5\pear') in C:\wamp\www\website\sites\all\modules\date\date\date.module on line 546
Comment #22
chaps2 commentedIs it possible that you have applied the patch incorrectly? Is the date_admin.inc file still there?. Which version have you applied it to and what steps did you take to apply the patch?
Comment #23
Marlies commentedIt was my first patch ever..
but I applied it to date 6.x
my steps were;
I put the patch file at C:/
opened Cygwin.bat (like cmd)
with cd I went to the specific map of the date module
then i patched it;
c:/cygwin/bin/patch.exe -p0 <
this should be correct, i followed cygwin steps @ drupal website
it patched 3 files:
date/date_admin.inc
date/date_repeat.inc
date_repeat/date_repeat-form.inc
so after it did that, i tried to go to content type - manage fields - date.. but then I get the error.
The file date_admin.inc is still there..
Comment #24
Marlies commentedit works now! Don't know why, I copied the patched files to a seperate folder, then I downloaded my (working) website again with the normal files, than I copied the pathed files and overwrited the normal files, now it does work! I am so glad!! Thank you so much!
Comment #25
chaps2 commentedI finally got round to putting this stuff in a separate module.
The module supports two types of preset:
It's a bit rough and ready but please have a play!
Andy
Comment #26
chaps2 commentedA quick demo of what it does: http://screencast.com/t/D0hSzdjgy2cl
Comment #27
kirkcaraway commentedchaps2, I've installed the presets module and activated it, but can't find where to set the presets. Very excited about this module. Saves me a lot of hacking. Thanks.
Comment #28
chaps2 commented@kirkcaraway - in a nutshell, the configuration options are added to any CCK repeat date field widget options after the "Repeat Display" setting at the botton of the form. The widget type of the date field must have "with Repeat options".
Comment #29
kirkcaraway commentedThanks, I found it and it works fine. Great job. I can see a lot of people who will find this very useful.
Comment #30
chaps2 commentedHere is a much improved version although it now has a dependency on the ahah_helper module.
I've set this to "needs review" as I have requested CVS access to release this module on d.o. and would appreciate some feedback as to whether that is the best way to go with this requirement.
Comment #31
chaps2 commentedThere's a demo at drpdemo.locologic.co.uk.
Comment #32
entrigan commentedJust tested it out, it works great and as expected.
In my opinion, this simplified widget is in most cases superior and more appropriate than the current date repeat selection widget, and therefor this module should be (once ready) included in the date module.
However understandably there are a lot of reasons why adding ui complexity to an "api" module would be unwanted, in which case I say we get this released as a separate contrib module ASAP.
Comment #33
eL commentedNice, I am looking for this solution for two days. Thanks!
But module itself is not working very well... If I chose Preset type, web freeze... and AHAH module is in conflict with HS module at all.
And there are some warnings:
Warning: Call-time pass-by-reference has been deprecated in C:\wamp\www\sites\all\modules\date_repeat_presets\date_repeat_presets.module on line 8
Comment #34
clintthayer commentedSubscribe
Comment #35
entrigan commented@eL, I did not have any of these erros. What versios of each module are you using? and by HS are you referring to hierarchical select?
Comment #36
chaps2 commentedNow released as a module - http://drupal.org/project/date_repeat_presets!
@entrigan, thanks for the code review.
@eL, thanks for the feedback. I've cleared those warnings in the released version but I would need more info on the "web freeze". Would you open an issue on the new project page please?
Andy