日历问题 - Icalendar 库,制作实际的日历

发布于 2024-08-15 22:55:28 字数 895 浏览 1 评论 0原文

我有一些关于日历的问题

  1. 是否有任何好的日历可以为 asp.net mvc 或 jquery 生成。我想找到一个可以制作日历并具有类似功能的东西。

    • 生成所有月份(但当然仅包含当前显示的月份)
    • 如果日历事件的名称太长,它会被截断,如果您点击它,则会弹出一个窗口,向您显示完整的描述
    • 能够向日历添加新任务。因此,当您点击它时,会弹出一个对话框,您可以填写信息。

    基本上就是 Google 日历的功能。您可以添加任务,然后它会弹出类似地点、时间通知区域。

    那么 .net MVC 或 jquery 是否有类似的解决方案?如果没有,那么我愿意在需要时使用其他 JavaScript 框架,但不会。

    我查看了http://arshaw.com/fullcalendar/,它确实没有包含所有内容我需要。

    我喜欢这个http://www.redredred.com。 au/projects/jquery-week-calendar/

    因为它几乎可以满足我的要求,但主要缺点是它只能完成几周而不是整个月。

  2. 是否有某种库可以让我轻松导入 Google 日历数据、Outlook 日历数据以及基本上任何主要的日历程序。

    我知道icalendar就像标准格式,所以有没有一个C#库可以解析这些东西?

  3. 我需要将日历数据存储在数据库中。数据库表会是什么样子?

I have some questions regarding calendars

  1. 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.

  2. 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?

  3. I going to need to store the calendar data in a database. How would the database table look like?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少女七分熟 2024-08-22 22:55:28

老实说,我认为对于客户端来说,你的要求有点太多了。最好的选择是找到一款既可以开箱即用地完成您想要的功能,又具有足够的自定义功能以允许您填写您正在寻找的功能的产品。要么这样,要么从头开始编写代码。老实说,您正在为客户端事件在前端渲染一个带有一些 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.

染柒℉ 2024-08-22 22:55:28

为什么一开始不那么雄心勃勃呢?谷歌有一个庞大的团队在制定他们的日历,如果你希望在不花几年时间的情况下复制它,最终只会得到一个未完成的项目。

1

您说您不喜欢 FullCalendar,但它确实支持日历中您需要的 95% 的功能,减去实际单击日期来添加事件的功能。

FullCalendar 非常适合显示
事件,但它不是完整的
事件内容管理解决方案。
除了将事件拖到
不同的时间/日期,您无法更改
事件的名称或其他相关的
数据。由您决定是否添加此内容
通过 FullCalendar 的功能
事件挂钩

您将获得一个 dayClick 事件可以用来添加事件。不过,我不会费心走这条路,只是在页面上有一个单独的面板,其中有一个名称文本框,一个小图标,可以显示 Jquery UI 日历。这听起来技术含量很低,但让点击事件在所有浏览器中工作将是一项艰巨的任务。

当您单击日期时,此文本框会显示完整的事件名称,从而解决了长文本裁剪问题。或者这会向您显示一个漂亮的静态html您可能已经看过类似 iCal 的解决方案。

可以使用 HTML 而不是使用 jQuery 静态地生成当年的月历。

2

如果您坚持使用 Outlook 和 Google 的 iCalendar 格式(两者都支持它),那么为该格式编写解析器就非常容易,因为它是一种简单的文本格式。 这个问题提供了有关制作一个问题的更多详细信息,您可以使用现有的库。

3

如下所示的等效 SQL 类型的简单表就足够了:

Events
Id
Name
Location
DateTime Start
DateTime End
bool IsRecurring

重复事件将是最难的部分,因为您必须执行计算才能计算出下一个事件。您不必将每次出现的情况都存储在数据库中。使用纪元进行计算可能会有所帮助,这是 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.

FullCalendar is great for displaying
events, but it isn't a complete
solution for event content-management.
Beyond dragging an event to a
different time/day, you cannot change
an event's name or other associated
data. It is up to you to add this
functionality through FullCalendar's
event hooks

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:

Events
Id
Name
Location
DateTime Start
DateTime End
bool IsRecurring

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文