Closed (fixed)
Project:
CCK Time
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 May 2008 at 06:22 UTC
Updated:
15 Apr 2012 at 00:56 UTC
Jump to comment: Most recent file
Comments
Comment #1
bookout commentedI would also like to see this for Drupal 6. I'd be happy to help with testing.
Comment #2
capellicI just tried to run CCK Time through Deadwood (http://drupal.org/project/deadwood). I was able to add the Field to my content type as text/Date. But then when I went to add a new node of that content type, the field wasn't thre.
Comment #3
Gerald Mengisen commentedSubscribing
Comment #4
yesct commentedI'm in need of this too
Comment #5
tyromind commentedI had submitted a feature request on the Date project for this function. I don't know what's involved with porting over but is there a possibility?
Date feature request: http://drupal.org/node/339638
Comment #6
steve.m commentedHey all. We are now testing a D6 version of this module. I'd like to see it released within the week.
Comment #7
tyromind commentedAwesome! Need help testing?
Comment #8
jesss commentedHas there been any progress on this?
Comment #9
cyberskier commentedSubscribing.
Comment #10
tyromind commentedThis feature's also being discussed at #219794: Allow dates without years. on the Date Module. Mostly looking to this module being ported, and hoping it could support timezones from the date module - so everyone could see the time displayed in they're own timezone
Comment #11
aqua_linksunten commentedwould be cool to see this module for d6!
Comment #12
Witch commentedsubscribe
Comment #13
bluecobalt commentedHey steve.m, any word on this? Do you have a version for testing? How far are you on this? Need help?
Comment #14
greenbeans commentedI've made a very preliminary D6 port -- hasn't been rigorously tested, but sort of works under the circumstances I need it for.
Comment #15
keesee commentedthanks for the initial port. here's a fatal error that I ran into when attempting to add a cck time field to a content type.
Fatal error: Maximum execution time of 30 seconds exceeded in /home/xxx/sites/all/modules/cck_time/cck_time.module on line 189
Comment #16
greenbeans commentedCorpX, that looks like an issue with your server configuration and the fact that Drupal's not exactly a lightweight framework -- not specific to this module.
Comment #17
steve.m commentedI just grabbed greenbeans' port, and will check it out ASAP.
Comment #18
keesee commentedThx for the feed back. I'll look into server logs. I'm testing a new site and doing so on a virtual server. I guess it has its limitations. thx.
Comment #19
pschopf commentedCan we think about a database storage in seconds (0 - 86400), then the time field would be sortable.
It is relatively easy to convert to/from h:m:s to seconds ($value is here the number of seconds):
and
In the above, I am anticipating adding an 'to time...' field that might cause you to want to have "next day" appended, such as you see when a scheduled airline flight takes off at 11:00pm and arrives at 1:00am (next day). The flight takes off every day, so the date is not relevant, but the "next day" concept is.
At first, I was opposed to including Timezone information because that would introduce date information, but my airline example leads me to want to add timezone information someday - the plane lands 3000km away, can the end of the time interval be expressed in the local time at the destination??? (Someday)
Comment #20
greenbeans commentedpschopf -- that sounds like a great idea. Do you want to implement it? I just don't have time (er, pun unintended) at the moment. I agree that the current storage is clunky. Although simply always storing a 24-hr clock value would also be sortable. We'd just have to add a DB field to indicate how the number should be edited / displayed. Your call; storage should be transparent to the end-user anyway.
Comment #21
steve.m commentedIf anyone working on D6 code here has a CVS account, drop me a line, and I'll add you as a maintainer of this module.
Comment #22
Gerald Mengisen commentedpschopf: nice idea, but what would be the migration path for existing nodes where the time is saved as text? Maybe a mass-update action?
Comment #23
greenbeans commentedTracked down the problem CorpX was having -- uninitialized values were causing the module to get stuck in an infinite loop. Here's a corrected version.
Comment #24
keesee commentedSweet! thx greenbeans! I'll test it early next week and report back.
--
J.
Comment #25
pschopf commented@greenbeans: I have done a personal "time_of_day" module so as to avoid confusion, and have learned a lot about the inner workings of cck with
dprint_r(array('line'=>__LINE__,'file'=>__FILE__,'fieldxxx'=>$fieldxxx));all over the code. I have set up 3 "clock formats" 0=>'seconds', 12=>'12 hour clock', 24=>'24 hour clock', which seem to work, and to be recognized when adding the field to a cck node type.
I am now having trouble intercepting the 'save' and 'update' operations to translate from 12 or 24 hour clock to seconds before inserting into the database. Would you like to look it over?
Comment #26
greenbeans commented@pschopf -- I'm in a launch crunch right now, might be a few weeks till I could get to it. I might not be your best bet anyway. I don't really grok the CCK API yet, and kind of felt this one out by trial and error. Actually, you could probably look through the CCK Time code to figure out how it's done. There are some manipulations in there pre-save to convert the three form fields into one DB field.
Comment #27
pzero commentedHi,
Is there any plan to make an official CCK Time build for Drupal 6?
Thanks.
Comment #28
pschopf commented@greenbeans: I guess we are at about the same stage. I will continue on. If it gets working, it can be merged into CCK Time if we want.
If anyone want to tell me how to take output from a textfield widget (12:00pm) and get it stored as 43200, jump in. I can do the calculation, it is just knowing all the new CCK "field_instance" stuff.
Comment #29
tregismoreira commented@greenbeans:
I installed the module, and apparently is working perfectly, except for the following facts:
- Even if I select the 24-hour format, the AM-PM field appears.
- Below the fields of time, is written Array. I think you missed something in the programming of the module, but I do not identify.
How could I do to solve these problems?
Grateful in advance!
Comment #30
greenbeans commentedSorry, I don't have any time right now to fix those problems, but if you know any PHP, you should be able to dig into the code and find the solutions.
Maybe pschopf's version, once complete, will be a little more polished.
Comment #31
muhleder commentedHad to change the theme function to get double zeros for on the hour times eg 1:00PM
You might want to add leading zeros to the hour too if you're in 24hour mode.
Comment #32
ianchan commentedsubscribe
Comment #33
Gerald Mengisen commentedTried out the file from comment #23 today, got the same problems as #29 plus the problem that in edit mode, the hours, minutes and am/pm combobox are shown stacked vertically underneath each other instead of next to each other in the Garland theme.
Nevertheless, thanks for the work done and I hope I can contribute some solutions soon (have never dealt with CCK fields before, however...).
Comment #34
Gerald Mengisen commentedAbout the vertically stacked comboboxes:
The D5 version had one div more:
<div class="cck-time-element"\>before the
<div id='edit...' class="form-item">With that div, the comboboxes are probably going to show up OK since the "cck-time-element" class floats left.
Beats me at the moment where in the code to add that div....
Comment #35
Gerald Mengisen commentedHere is now a version based on greenbean's work at comment #23 (thanks very much!). The following changes have been implemented:
On a side note, it seems that OpenConcept (where the original maintainer of this module works) had ported the module internally to D6 already by the end of last year: http://openconcept.ca/blog/pawel/updating_cck_time_widget_from_drupal_5_...
It is unfortunate that they did not choose to publish their results for whatever reason. I did ask them a few weeks back if they would share the module, but unfortunately, I never got a reply.
Comment #36
anthonym commentedThanks for this. Just tried it out. I have two time fields for start and end times. I originally had them checked as required, but when I tried to save the node, I got a message that the fields were required, and it wouldn't save. I went back and unchecked required, and then it worked.
Comment #37
ianchan commentedI tired the files from #35 but it didn't work. It only seemed to save the default values.
Working off the .module file in #35 and using some of the other CCK modules as reference, I was able to come up with something that almost works. However, I can't figure out how to merge the fields. Or maybe they are merging BUT right now all that is saving to the database is the first numeral.
So for example, when I save 12:00PM, only "1" is saved to the database! If I save 8:00AM, only "8" is saved, etc. Any ideas, tips? Thanks in advance...
The attached is what I've come up with thus far.
Comment #38
Gerald Mengisen commentedSome ideas to check:
- What is the data type of your time field in the database? varchar(1) could lead to the problems you describe.
- Do you see the problem with existing CCK time fields or did you also to create new ones?
Comment #39
EgorfromMurmansk commentedsubscribe
Comment #40
kenorb commentedFixed issue with field required on submission.
Comment #41
fallsemo commentedSubscribe.
#40 patch works - except that now it doesn't seem to store more than one group when using the new "Multi group" feature in CCK 3
Not to complicate things but it is where CCK is heading and it WAS working before.
Comment #42
kenorb commentedSo how it was working before if it was not possible to even submit the form?
Comment #43
fallsemo commentedSorry,
I had no problem submitting the form before using #35
The problems previously for me had been:
1. Values submitted as X:00 would appear (and store) as X:0
2. Default values would not store properly. In my case, I had set a default to be 2:30PM and it would show up on the form as 2:30AM
But yeah, if I changed this value on the form and hit submit it would show up (and store) the value just fine.
Your patch seemed to resolve both of these issues for me.
Comment #44
Gerald Mengisen commentedStrange, I've been using the version from comment #35 ever since without the problems posted above. Maybe because I'm using 24h time formation?
One warning however: when I recalculated the auto node titles from the content menu, all CCK Time values were lost. Maybe this wouldn't be the case with the later patches. And yes, +1 for the Backup and Migrate module :-)
Comment #45
bomarmonk commentedYes, I definitely need the issue mentioned in #41 to be resolved for implementation of this module with multigroups (for the same use-case scenario illustrated in fallsemo's images-- office hours). Is multigroup and CCK time working for you now, fallsemo? Let me know. Thanks.
Comment #46
fallsemo commentedIts not. I ended up scratching it and doing something else :(
I can help test if a patch rolls in.
Comment #47
rcharamella commentedHow do you "install" this time field?
Comment #48
aprice42 commentedI have successfully installed the module from #35, and I can add a new time field to a content type. However, I have two fields (field_begins & field_ends) that I created with the 5.x version of the module and the content associated with those fields is not showing up when I add the fields to a view.
Here are some inconsistencies I am noticing when comparing the database entries:
The new time field I created shows the type and widget as "cck_time" While my old fields show the type and widget as "text"
The old fields also have no value for the column "db_colums" while every other field has a value there.
I am guessing that this is a clue to what is going wrong however, working directly with the drupal database is new territory for me. Can anyone advise me on what I can do to remedy this issue?
One other note, when I updated this module and ran update.php there were no updates attempted.
Thanks,
Andy
Comment #49
Gerald Mengisen commented#48
Yes, I had the same problem. I had to recreate the view column.
Comment #50
bomarmonk commentedFor making this work with content multigroup (CCK 3):
Comment #51
quicksketchI took the Zip from #40 and ported it to a new module called "timefield". It's the same thing only it stores the data differently. I didn't like storing the data as text since you can't sort on the data. In addition you can't change from 12 to 24 hour formats after the field has been set up (well you can but the data isn't migrated).
This version also works with multiple values and handles requireness correctly. However it does not upgrade data from the old cck_time format to timefield. I'd be really happy to see this become a separate project, but I do not have the availability to support more modules at this time. It'd probably be good to move away from the name "CCK" regardless, since it's been renamed to "Field" in Drupal 7.
Comment #52
bomarmonk commentedTesting Quick Sketch's latest version of this module in #51; it's working great with multigroup. How about an official release of the development version? This is good stuff! Thanks for your work on this, sketch.
Comment #53
mautumn commentedSubscribing
Comment #54
rc2020 commentedsubscribing
Comment #55
bomarmonk commentedQuicksketch, I vote that your module in #51 gets turned into a new project: Time Field. Can someone maintain this? Any takers? I can apply patches, but have never worked with CVS. There's also an issue over at the Date module that's related to this. I'll see if I can't get any interest drummed-up over there. Thanks again for your work on this!
Comment #56
joshmillerYay for monolithic issue ques with ENTIRE modules in them.
No, seriously, thank you for this timefield module from #51.
We are using it extensively on a new site. Below is a bug one of our programmers is actively dealing with and trying to fix. I will keep you up to date. This bug is only encountered when trying to sort multiple times in Views.
Small bug noticed in the new `time' field. It thinks that 12:01AM to 12:59AM comes between 11:59AM and 1:00PM. I can understand how this could happen programatically, but it does pose a problem when a "lunch" is entered at 12:30PM, it shows up at the end of the session list, instead of in the middle where it should be. If you set the time to 12:30AM, it shows up in the middle.
Comment #57
kenorb commentedComment #58
Junro commentedHello,
I'm testing Time cck submodule.
1. The name widget in /admin/content/node-type/*/fields shouldn't be Date. I think "Time" will be more appropriate because Date widget already exists.
2. How to customize the time format?
We can choose only between 12 & 24 format with a only display: 12:23.
I would like to have something like this: 12 hrs 23 min or 12h23.
Comment #59
dml commentedI've also been using the timefield module from #51, and I'm very happy with it.
There's one small issue where if you enter 12:30pm it shows up as 12:30am (either that, or I've forgotten how a 12hr analog clock works, which is entirely possible). I think a change along the following lines to the timefield_time function should fix that.
Comment #60
mautumn commented@quicksketch thanks very much for this. It works a treat.
I actually don't like the UI for datetime: the time UI element is very poor compared to the terrific popup calendar on the date part. So I have combined your time module with the date part of the datetime - in a rather amateurish clumsy way (because I don't know enough to do it property and nor do I have the time to learn). I have two "disposable" fields - date and your time - for the UI, and I use a rule to combine the two values together into another datetime value. It works much better. UE/UI is crucial for us.
It would be good if someone had the knowledge and time to integrate the two properly. At least make time a "proper project...?
Comment #61
cyberwolf commentedSubscribing.
Comment #62
bomarmonk commented@GlossyIbis, have you seen this patch for time input with the date module. It adds a time insert for time fields associated with the date module. Maybe the same code can be used for the CCK time field: http://drupal.org/node/233047
Comment #63
kenorb commentedCommitted version from #40
http://drupal.org/cvs?commit=352460
Any further patches are welcome.
Comment #64
kenorb commentedComment #65
rwd commentedPatched the D6 port to accept empty values if the field is not required, awaiting review at #766832: Accept empty values if CCK Time field not required.
Comment #66
cyberwolf commentedUsing the timefield contribution from #51 here as well, great job @quicksketch!
How do the committed changes (#63) to CCK Time compare to timefield?
Comment #67
kenorb commented#40
Comment #69
drecute commentedWill be starting up support for views integration for this module.
Comment #70
henrijs.seso commentedlol. subsr.
Comment #71
Roze-1 commentedSubscribing !
Comment #72
doublejosh commentedTested today on a D6 site. Works great.