This project is read-only.

Error with DateTimeField (and a querying question)

Topics: Troubleshooting, Writing modules
Aug 24, 2011 at 10:49 PM
Edited Aug 24, 2011 at 10:50 PM

My scenario is one where I have an "Event" content type.  I want to add a datetime field to it and then in my driver have the ability to query for events both in the past and in the future.  There are two problems:

1.) Installing the datetimefield from the gallery causes an error:

Package installation failed.
There was an error installing the requested package. This can happen if the server does not have write access to the '~/Modules' or '~/Themes' folder of the web site. If the site is running in shared hosted environement, adding write access to these folders sometimes needs to be done manually through the Hoster control panel. Once Themes and Modules have been installed, it is recommended to remove write access to these folders.
Version string portion was too short or too long.
In addition to that error displaying in red, I also see the green 'Orchard.Module.Contrib.DateTimeField 0.6.3' installed successfully

This error only happens in one instance of my Orchard, not my other instance, so it's got to be something on our end, but I hoped someone might have seen that error and knew what it meant. 

2.) To potentially make #1 a moot point, in doing some searching, I stumbled upon the link below (involving some guy and Bertrand) that indicates you can't do a query on content items filtering by a field on the item, and that you should use a content part.  Did I understand that correctly?  I'll basically have to create a date/time part that allows for date input and join to that to filter past/future events?
Here's the link I mentioned
Aug 24, 2011 at 10:56 PM

1- I have never see this message. Is the module working ?

2- Dynamic content fields can't be queried right now. And there is no declarative ways of doing quries right now too. You could use the Search aPI to do a query on Events and this field, but as you have to do some code for your query, yes, the only solution is to create a content part, with a date property, and use it for your queries.

Another reusable solution would be to create an DateAndTime Content Part which contains only a Date, thus can be attached to any content type, and could have some routes to display those content items, along with a Calendar view.

Aug 24, 2011 at 11:00 PM

1. ) Well, the code gets put into our solution, but it's not being seen by Orchard.  Furthermore, when I try installing again, it says its already installed.  Not sure what the deal is, but it's definitely on our end because I can install it in another instance just fine.

2.) As for your suggestion, that's kind of what I'm doing anyways, though I'm tailoring it a  bit to our client's requirements...thanks for the response...

Aug 25, 2011 at 2:11 PM

I've seen that first error message before, and the problem was exactly as the message described. We were deploying to shared hosting, and the ~/Modules and ~/Themes folders didn't have write access, which I had to enable through the host's control panel. The part about "Version string portion ..." I didn't see though, so I don't know what's going on there. :-)

Aug 25, 2011 at 2:43 PM

Yeah, I mean, I understand the first message, even though giving write access to those folders didn't fix the problem...

Aug 26, 2011 at 3:28 PM

Just a followup, my colleague found the issue...apparently one of our modules had "1" in the version instead of "1.0" and that was killing it.  Hope this helps someone else if they run into this issue...