Calendar: Request: Support for CATEGORIES field

Created on 30 Sep 2016  Â·  17Comments  Â·  Source: nextcloud/calendar

(Spinoff from #71)

The ical standard defines a CATEGORIES field. I would like this to be exposed in the calendar app as well.

A simple text field would do in the short term.

A nicer solution for the future would be a combination of free form field and auto-complete.

Ideally, categories could somehow modify the appearance of a VEVENT. Thunderbird does this with a tiny colour-flag, but sky's the limit.

Here's an example of categorized entries in Thunderbird's calendar. (the "Urlaub" entries have a category)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

2 - developing enhancement-approved

Most helpful comment

@georgehrke Thank you very much!
Now at least I can see a path in the code! :-)
With some dirty code I'm already able to read the categories in the event popup, but I have to familiarize a bit more with nc code...
I will keep you informed about my progress.

All 17 comments

A nicer solution for the future would be a combination of free form field and auto-complete.

Well, ideally this would even be integrated with Nextcloud's tag system, but that's something for the very far future ^^

Ideally, categories could somehow modify the appearance of a VEVENT. Thunderbird does this with a tiny colour-flag, but sky's the limit.

Here's an example of categorized entries in Thunderbird's calendar. (the "Urlaub" entries have a category)

Can you define a color or does thunderbird just generate one?

There's a bunch of pre-defined categories in a drop down and i can add my own as well:

tb-categories-chooser

And, albeit well-hidden, you _can_ edit the colors! (Thanks for suggesting that, so far I didn't bother to check :D ). If you run Thunderbird, go to Top-right Burger menu -> Settings -> Settings -> Calendar-Tab -> Categories-Sub-Tab.

tb-categories-settings

Another possibility seems to be, to edit userChrome.css - the calendar entries receive classes of their own, apparently. Here's an example involving moon calendar via categories, css classes and userChrome (german, sorry). This should allow even more styling, but I haven't personally confirmed that this way (still?) works.

That would be really interesting to be able to categorize events.

To give some ideas, the "old-days" (doesn't work since 9.0 version) Calendar+ app did it by using the first letter of the category and randomly chosen colors (probably using an algorithm like ones for contacts):
calendarplus

It's not developed anymore, but the code is still there:
https://github.com/libasys/calendarplus

Maybe there is something to get from there.

I would really love having colored categories in the web app. I use them all the time in Thunderbird (and I also use the addon Calendar Tweaks to display the color of the category on all the event, not just a little colored bar on the side, it's wayyy more convenient).

I will be happy to help with this feature, but some introduction with the current code would be greatly appreciated to shorten the times.

@gabrieleturchi This issue should be implemented in two phases ideally :)

  1. Add categories to the event editor
  2. Later on add a coloring like suggested by @ccoenen

Let's start with the first:

  • There is a simple event model, that takes the ical data and converts it into a simple javascript object that we can use for templating and data binding in our angular controller
  • uncomment this line to allow parsing (and saving) of categories
  • Afterwards you should be able to access it as $scope.properties.categories in https://github.com/nextcloud/calendar/blob/master/js/app/controllers/editorcontroller.js
  • this is the corresponding template: https://github.com/nextcloud/calendar/blob/master/templates/part.eventsinfo.php

To see how the input works for files, see https://github.com/nextcloud/server/blob/4904117ba8206d24324d5c6a2f8150a1641e4ac5/core/js/systemtags/systemtagsinputfield.js
You can use something like this to get the same with angular: http://mbenford.github.io/ngTagsInput/
This was just the first hit i found, maybe do some more research on that ;)

There is already a tags system in Nextcloud: https://github.com/nextcloud/server/blob/master/lib/public/SystemTag/ISystemTagManager.php

To access it, you would have to write a SystemTagsController in the Calendar, that gets you a list of all tags, creates new ones, etc.
It will be similar to https://github.com/nextcloud/calendar/blob/master/controller/contactcontroller.php

@georgehrke Thank you very much!
Now at least I can see a path in the code! :-)
With some dirty code I'm already able to read the categories in the event popup, but I have to familiarize a bit more with nc code...
I will keep you informed about my progress.

any plan when the feature will be available?

@samuelstein
fb4381e2-4065-42ca-aa7a-b933f6cef123

See the milestone in the right sidebar 😉

thanks for your quick replay. i saw it but the interesting question is when will be milestone 2 released?

I would love this feature but I want to point to a difficulty not yet mentioned. One event can have multiple categories. Thunderbird does allow multiple categories but does only show one color. I don't know how Thunderbird does choose the color, I can't find a rule but I haven't searched carefully.

What to do? I don't think that multiple colors are a good way out. If it won't be decided by chance, perhaps radio buttons are a good choice.

Cheers corvus albus

First one wins. This would already be immensely better than having no categories at all. Also this is less about styling and more about syncing tags and CATEGORIES so one can use them in both Nextcloud and Thunderbird (and others, of course).

Regarding the radio buttons: this would limit people to choosing at most one category for no other reason than "we can't figure out which color wins". What would you do with items synced in from other sources that might already have two or more categories? Making this a radio box solves only a part of the problem, while severely limiting functionality.

i completely agree with you @ccoenen .
Defining colors is not really necessary for the moment. for me they could be randomly chosen.

Regarding the radio buttons: this would limit people to choosing at most one category for no other reason than "we can't figure out which color wins". What would you do with items synced in from other sources that might already have two or more categories? Making this a radio box solves only a part of the problem, while severely limiting functionality.

To make the suggestion clearer: I thought only of radio buttons for choosing the category which defines the color and not to limit the number of categories.

But indeed, if you sync events from other sources that have more than one category you have to do a random color choice at first.

And at least it is better to have colors than to have not. Most events will have only one category anyway. But I think it is important to know the problem exists. Then one can decide how to deal with it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deanforrest picture deanforrest  Â·  4Comments

andre5tz picture andre5tz  Â·  3Comments

georgehrke picture georgehrke  Â·  4Comments

mauritslamers picture mauritslamers  Â·  4Comments

cloud2018 picture cloud2018  Â·  3Comments