日历问题 - Icalendar 库,制作实际的日历
我有一些关于日历的问题
是否有任何好的日历可以为 asp.net mvc 或 jquery 生成。我想找到一个可以制作日历并具有类似功能的东西。
- 生成所有月份(但当然仅包含当前显示的月份)
- 如果日历事件的名称太长,它会被截断,如果您点击它,则会弹出一个窗口,向您显示完整的描述
- 能够向日历添加新任务。因此,当您点击它时,会弹出一个对话框,您可以填写信息。
基本上就是 Google 日历的功能。您可以添加任务,然后它会弹出类似地点、时间通知区域。
那么 .net MVC 或 jquery 是否有类似的解决方案?如果没有,那么我愿意在需要时使用其他 JavaScript 框架,但不会。
我查看了http://arshaw.com/fullcalendar/,它确实没有包含所有内容我需要。
我喜欢这个http://www.redredred.com。 au/projects/jquery-week-calendar/
因为它几乎可以满足我的要求,但主要缺点是它只能完成几周而不是整个月。
是否有某种库可以让我轻松导入 Google 日历数据、Outlook 日历数据以及基本上任何主要的日历程序。
我知道icalendar就像标准格式,所以有没有一个C#库可以解析这些东西?
我需要将日历数据存储在数据库中。数据库表会是什么样子?
I have some questions regarding calendars
Is there any good calendar generates for either asp.net mvc or jquery. I would like to find something that can make calendars and have features like this.
- Generates all the months (but of course only features the current month that is being displayed)
- If the name of the calendar event is too long it cuts it off and if you click on it a popup comes showing you the full description
- Ability to add a new task to the calendar. So when you click on it pops up a dialog box and you can fill out information.
So basically what Google calendar can do. You can add a task then it pops up with like where, time notifications area.
So is there any sort of solution like this for .net MVC or jquery? If not then I am willing to use other javascript frameworks if needed but rather not.
I checked out http://arshaw.com/fullcalendar/ and it really does not have everything I need.
I like this one http://www.redredred.com.au/projects/jquery-week-calendar/
Since it almost does what I want but the major draw back this is that it only does weeks not a full month.
Is there some sort of library that I can use to easily import google calendar data in, outlook calendar data in and basically any major calendar program.
I know that icalendar is like the standard format so is there a C# library that will like parse this stuff?
I going to need to store the calendar data in a database. How would the database table look like?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
老实说,我认为对于客户端来说,你的要求有点太多了。最好的选择是找到一款既可以开箱即用地完成您想要的功能,又具有足够的自定义功能以允许您填写您正在寻找的功能的产品。要么这样,要么从头开始编写代码。老实说,您正在为客户端事件在前端渲染一个带有一些 jQuery 的表。这很乏味,但不应该太困难。
至于处理日历格式的 .NET 库,我推荐 DDay 的 iCal。它有一些问题,需要一些理解才能运行,但它可以工作(我自己将它用于我从中投影 iCalendar 条目的网站)。
至于数据库中的日历,这完全取决于你。显然,您需要的最少信息是日期字段。我建议使用带有偏移量的东西(SQL Server 2008 有 datetimeoffset),因为您可能需要考虑时区。除此之外,您想要存储的任何信息都取决于您。
为了回应 chobo2 关于如何让数据出现在适当列中的评论,当您渲染表格时,您将拥有一个 7 x 5 的表格(7 天,5 行)。我建议给每个人贴上日期标签。
然后,当您渲染表格时,当您渲染单元格时,您会查看是否有与您的日期相关的任何事件,如果有,则适当地渲染单元格。
I think that for the client side, you are asking for a little too much, to be honest. Your best bet is find the one that does the most that you want out-of-the-box but has enough customization to allow for you to fill in the functionality you are looking for. Either that, or write the code from scratch. To be honest, you are rendering a table with some jQuery on the front end for client-side events. It's tedious, but shouldn't be overly difficult.
As for a .NET library to handle calendar formats, I recommend DDay's iCal. It has some issues and requires some understanding to get running, but it works (I use it myself for a site that I project iCalendar entries from).
As for the calendar in the database, that's really up to you. The minimal amount of information you need is a date field, obviously. I'd recommend something with an offset (SQL Server 2008 has the datetimeoffset) since you might want to take into account time zones. Beyond that, any information you want to store is up to you.
In response to chobo2's comment about how to get the data to appear in the appropriate column, when you render the table, you are going to have a 7 x 5 table (seven days, five rows). I would suggest tagging each of them with the date.
Then, as you render your table, when you render the cell, you look to see if you have any events for your date, if you do, then render the cell appropriately.
为什么一开始不那么雄心勃勃呢?谷歌有一个庞大的团队在制定他们的日历,如果你希望在不花几年时间的情况下复制它,最终只会得到一个未完成的项目。
1
您说您不喜欢 FullCalendar,但它确实支持日历中您需要的 95% 的功能,减去实际单击日期来添加事件的功能。
您将获得一个
dayClick
事件可以用来添加事件。不过,我不会费心走这条路,只是在页面上有一个单独的面板,其中有一个名称文本框,一个小图标,可以显示 Jquery UI 日历。这听起来技术含量很低,但让点击事件在所有浏览器中工作将是一项艰巨的任务。当您单击日期时,此文本框会显示完整的事件名称,从而解决了长文本裁剪问题。或者这会向您显示一个漂亮的静态html您可能已经看过类似 iCal 的解决方案。
可以使用 HTML 而不是使用 jQuery 静态地生成当年的月历。
2
如果您坚持使用 Outlook 和 Google 的 iCalendar 格式(两者都支持它),那么为该格式编写解析器就非常容易,因为它是一种简单的文本格式。 这个问题提供了有关制作一个问题的更多详细信息,您可以使用现有的库。
3
如下所示的等效 SQL 类型的简单表就足够了:
重复事件将是最难的部分,因为您必须执行计算才能计算出下一个事件。您不必将每次出现的情况都存储在数据库中。使用纪元进行计算可能会有所帮助,这是 Exchange 使用的一种技术。
Why don't you start slightly less ambitiously? Google has a large team working on their calendar and for you to hope to replicate that without taking years will just end up with an unfinished project.
1
You said you didn't like FullCalendar but it does support 95% of the features you need from the calendar, minus actually clicking on days to add events.
You get a
dayClick
event which you could use to add an event. I wouldn't bother though going this route though, and simply have a separate panel on the page with a text box for the name, a small icon which makes a Jquery UI calendar appear. It sounds low-tech but the pain of getting the click event working in all browsers would be a big task.This textbox displays the full event name when you click on day which gets around your long text cropping issue. Alternatively this shows you a nice static html iCal-like solution which you may have looked at already.
Generating a month calendar for the year could be done statically using HTML instead of using jQuery.
2
If you stick to the iCalendar format for Outlook and Google, which both support it, then it's very easy to write a parser for that format as it's such a simple text format. This question has more details on making one, you could use an existing library for it.
3
A simple table of equivalent SQL types like below will be enough:
Recurring events will be the hardest part because of the calculations you have to perform to work out the next event. You don't store each occurrence in the database. Using the epoch for the calculations might help out, it's a technique Exchange uses.