I am trying to add a color scheme to calendar events using Taxonomy terms however I am running into some issues.
First, when I select "Based on Taxonomy", I only get the option to select the Taxonomy field if the field is rendered as Link not Plain Text.
However, either way does not give me the subsequent options to customize the different Taxonomy terms colors.

I would appreciate any help on this.
I am running Drupal 7.10
All of the modules are up to date, as of 01/03/2012.
I also attached screenshots below.

I would appreciate any help, thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jimboh’s picture

I have a view created in alpha1 that uses taxonomy striping (and still works since updating to alpha2).
I am however unable to get a new view working with striping (as prev comment). If I export the working striping view and re-import it as a new view, the striping configuration is no longer working/available.
I am ignorant re view in code etc so not sure of the implications.

tjferre’s picture

I am glad to hear, I am not the only one having these issues....
Does anyone have any ideas on how to fix this issue?

Netrics’s picture

Having the same issue as well, and I am on the latest dev version.

johnv’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
14.94 KB

The attached patch fixes Taxonomy striping for Calendar Entities (not the deprecated Calendar items).
It includes code cleanup, which I will explain below.
It also includes new functionality from #1394362: Add Stripe / Legend based on Field_name. Logically, that should be handled in a separate patch, but it is combined.

Fixed taxonomy striping, mainly in two places:
- function options_form() used $vocab->name instead of $vocab->machine_name
- function calendar_taxonomy_stripe() wrong call to field_get_items()

Code cleanup:
- options_form() : reordered parameters for form-elements, so several legends are better comparable
- function calendar_XXX_stripe()
-- centralized init of $event->stripe ad $event->stripe_label
-- removed $GLOBALS['calendar_stripe_labels'], which becomes immensly big, and has no use (anymore?)
-- shorter logic

New functionality:
- you can use all legend types together, by calling every calendar_XXX_stripe() function, instead of only the last selected;
- you can set a different stripe for each date field.

davidneedham’s picture

Title: Taxonomy Striping Issues » Broken Taxonomy Striping fixed + Code cleanup + New Striping on Date field.
Status: Active » Reviewed & tested by the community

The patch in #4 fixed the bug where taxonomy terms did not show up in striping settings.

Update: The only issue I've seen so far is that the legend shows striping on items not selected. For example, I have selected to stripe by taxonomy and set colors for each term. When I view the month, I see a legend that says "Events" and the color white as well as "field_event_date" and the color white.

Update update: To make the erroneous legend items disappear I went to the striping setting, selected to stripe by content type, set the color for event to be blank (was #FFFFFF by default) and then selected to stripe by field and set the color to also be blank.

johnv’s picture

Version: 7.x-3.x-dev » 7.x-3.0-alpha2

@davidneedham,
perhaps it is browser dependent? My experience was that the value #ffffff was an indicator for 'no stripe', Your experience is that is must be blank. I only tested with Chome.
indeed, the field must made blank to not show a stripe.

tjferre’s picture

I was going to test your patch however, the module has changed
includes/calendar_plugin_row.inc is no longer in 7.x-3.0-alpha2, it is still in the dev version though.

johnv’s picture

@tjferre, IMO it is the other way around: calendar_plugin_row.inc was not in alfa yet, and is new in -dev. it is the source code for the new Calendar Entities. calendar_plugin_row_node.inc is now deprecated. If you have an installation with alpha2, you need to change the calender formatting in your view from the Deprecated to the CalendarEntities.

Jeana_with_a_j’s picture

@tjferre & @johnv - I'm having the same problem as the OP, and have 7.x-3.0-alpha2 installed. And without a calendar_plugin_row.inc file, I'm not sure how I can apply the patch?

How can I get this working for 7.x-3.0-alpha2? This is also a new install, I'm new to drupal dev, and just installed the calendar plugin last week.

Thanks!
Jeana

davidneedham’s picture

Nah, I'm pretty sure it's not a browser thing. I see this in both firefox and chrome on the mac. #FFFFFF shows up as white. Blank makes those disappear from the legend.

https://img.skitch.com/20120130-88jxfs43kmwc4gppgq7an1mec.jpg

dqd’s picture

Version: 7.x-3.0-alpha2 » 7.x-3.x-dev

since it is already RTBC, we should change the version, because the patch is made for latest --dev version and the patched file doesn't exist in the alpha version the OP talks about. This would help the module maintainers to commit easier. Please help the maintainers by providing some more reports about the patch in connection with the latest 3.x dev version here or - alternatively - provide another patch for alpha and change the version for the issue back to alpha then here afterwards ...

Jeana_with_a_j’s picture

I updated to 7.x-3.x-dev, and applied the patch. It now says that Calendar Items are deprecated switch to Calendar Entities, which I expected. But when I do make the switch to calendar entities and hit "Apply", it never changes the format, and it stays "Calendar Items".

johnv’s picture

@jeanac, tjferre, when I posted the patch, I didn't take notice of this issue's version. So the patch was developed against 7.x-3.x-dev version, not alpha2. Sorry for that.

There seem to be issues with upgrading to the new CalendarEntities, as you already have found out. I started from the demo-view that Calendar-dev provided. Does it work when you re-create the view from scratch?

@davidneedham #5: Indeed, color #ffffff is not a default, but an actual color. You must make the field blank to not appear. I'll edit my post above.

One more feature request: when more then one color applies, then >1 stripes appear in the bar. The event bar is not becoming higher, but text shifts down, eventually partially visible.

dwalker51’s picture

Version: 7.x-3.0-alpha2 » 7.x-3.x-dev
Status: Needs review » Reviewed & tested by the community

Patch worked fine after changing to the 7.x-3.x-dev. great!, but I am also getting the text appearing moved down, and it seems that in setting I can choose the colors , but after clearing the cache, these disappear from the event title.

KarenS’s picture

It would be so much easier if you didn't throw everything into a single patch -- a new feature, a bug fix, and code reorganization. That makes the patch virtually impossible to assess.

KarenS’s picture

Status: Reviewed & tested by the community » Needs work

I have to mark this as needs work because of all the extra stuff in the patch. Plus the person who marked it reviewed and tested did not test most of what was in the patch, the new feature, they tested the bug fix. And I can't even tell where in the patch the bug fix is.

KarenS’s picture

Title: Broken Taxonomy Striping fixed + Code cleanup + New Striping on Date field. » New Striping on Date field.
Category: bug » feature

I pulled out the bug fix and committed that. That required looking through a 380 line patch to find the 4 or 5 lines I needed to fix the bug, which is why we don't mix bug fixes with feature requests.

I don't know if I want to add this feature. And I don't think the code re-organization is needed. The $GLOBALS value is used for the legend block, so it can't be removed. I have no idea what in this patch is left that is still useful but if you want a new feature to be considered, please get rid of the rest of it.

johnv’s picture

Sorry for that huge patch. I'll just stick to complaining the next time.

I am glad you found the bug fix.
Here is a new issue for the $GLOBALS variable: #1438792: remove giant $GLOBALS['calendar_stripe_labels']
I'll post a new patch for the code cleanup. Although it will not change any functionality, it has the following advantages:
- you end up with less code;
- the several striping methods are more alike, thus making it easier to create new striping methods.

johnv’s picture

Please review the following code cleanup for calendar_plugin_row.inc.

- lines 104-190 just reshuffles the array-values. Now they better comparable: they are in the same order, and the constant value are at the bottom of the list, the variable ones at the top. This makes it easier to implement a new stripe-policy.
- lines 388-385 initializes a variable, avoiding doing this 3 times in the striping routines.
- lines 489-535 make the 3 striping routines much simpler.

Compared to #4, this patch does not contain:
- changes of #1438792: remove giant $GLOBALS['calendar_stripe_labels']
- adding more stripes per event. That needs only removeing this switch: switch ($this->options['colors']['legend']) {
- the new striping on the date-field

johnv’s picture

Status: Needs work » Needs review
KarenS’s picture

Title: New Striping on Date field. » Code cleanup for striping
Category: feature » task

Clarify what this is.

KarenS’s picture

Status: Needs review » Needs work

This won't apply any more.

cronecker’s picture

I just updated the Calendar module, in which the release note said "- Issue #1392306 by johnv and KarenS, Fix broken taxonomy striping."
However, I'm still facing the same problem with the "You must add a term field to this view to use taxonomy stripe values. This works best for vocabularies with only a limited number of possible terms."

I also have the latest dev of Date, so I don't really know where the problem lies. Haven't tried any of the patches in this thread yet cause I assumed it was integrated in the latest dev of Calendar.
It doesn't seem to be fixed yet anyhow.

KarenS’s picture

#23 is a different issue, it is a support question about how to use this, not a bug or a task.

johnv’s picture

Status: Needs work » Needs review
FileSize
14 KB

This is an updated version of the patch in #19, which is needed after committing #1438792: remove giant $GLOBALS['calendar_stripe_labels']
See #19 for detailed explanation.

rfulcher’s picture

I just downloaded the latest dev and the taxonomy terms did not show up to assign them colors. Do I need to apply the patch? I was hoping it was already applied in the dev....

johnv’s picture

cronecker and rfulcher, are right: Taxonomy does not show up.

When I compare my versions in #19 and #25, there have been changes committed to functions pre_render() and render(); I can't find the relevant fix ATM. I don't have the time to look into it for the next week, but I hope this helps.

jmatuska’s picture

Version: 7.x-3.x-dev » 7.x-3.0-rc1

calendar team -

i have Calendar module 7.x-3.0-rc1 installed. i did not know till just today in the reading i've done that i should be using the dev version. is there a patch for the version i'm using in order to get the color striping to work? or do i have to uninstall my current mod and install the dev version?

If i DO install the dev version, will i lose all my months of work creating calendar items and dozens of different views using the 3.0-rc1 version? i cannot afford to lose all my months of work up to this point. if i would lose everything and have to start over, i would opt to install a patch, if there is one.

i do believe i have all my taxonomy terms set up correctly, and the Calendar Entities > Settings did let me choose colors for my 5 different event types, so that seems to be working. it's just that the colors are not appearing.

(am viewing calendar in a MONTH display)

thank you,
jean :)

KarenS’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev

Please don't change the version, this is a patch for the dev version. The question in #28 has nothing to do with this issue, but the answer is that the striping is not broken it has been done differently. You won't lose everything and you don't have to start over, you just need to be sure the term reference field has been added to your view so we know what to use for the stripes. But none of that discussion belongs in this issue.

jmatuska’s picture

Version: 7.x-3.x-dev » 7.x-3.0-rc1
FileSize
67.69 KB
153.15 KB

i apologize Karen. i thought i needed a patch since my striping is not appearing, and that's why i added my question here. should i start a new issue/question then?

i do believe i have my term reference field added to my view correctly (Content: Event Type) and my Calendar Entities > Settings dialog is letting me choose colors for my terms, they're just not appearing in my calendar display. So, i must be doing something wrong or leaving something out.

thank you for any help, but i'm sorry i can certainly start a new question if that would be better. (new to drupal; using calendar version 7.x-3.0-rc1)
Jean

KarenS’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev

This is a patch for the dev version, please don't change versions. Yes, each separate problem or task goes into its own issue. This is not the place to discuss a different problem.

And any time you have problems, you need to start by trying the dev version of both Date and Calendar to see if it is already fixed. If not, see if it is already reported. If not, report it.

artatac’s picture

I can confirm that the dev version (22/02) and using all the latest devs of Calendar/date etc the color picker IS appearing for tags. (thank you) but I am now getting the following error message

Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 151 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 152 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 153 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv4\sites\all\modules\calendar\calendar.module).
artatac’s picture

I spoke to soon - when you apply the colors and save you get

Notice: Trying to get property of non-object in calendar_plugin_row->calendar_taxonomy_stripe() (line 579 of D:\wamp\www\aclv4\sites\all\modules\calendar\includes\calendar_plugin_row.inc).
Notice: Trying to get property of non-object in calendar_plugin_row->calendar_taxonomy_stripe() (line 579 of D:\wamp\www\aclv4\sites\all\modules\calendar\includes\calendar_plugin_row.inc).
Notice: Trying to get property of non-object in calendar_plugin_row->calendar_taxonomy_stripe() (line 579 of D:\wamp\www\aclv4\sites\all\modules\calendar\includes\calendar_plugin_row.inc).
Notice: Trying to get property of non-object in calendar_plugin_row->calendar_taxonomy_stripe() (line 579 of D:\wamp\www\aclv4\sites\all\modules\calendar\includes\calendar_plugin_row.inc).
KarenS’s picture

Status: Needs review » Closed (won't fix)

This is an issue about doing code cleanup. It is not an issue about bugs with taxonomy. I am not going to address those questions here, they have pretty well muddied up this issue enough that it no longer makes any sense. I'm closing this issue because of that. If you have a bug, see if it is already reported. If it isn't already reported open a new issue.

johnv’s picture

Status: Closed (won't fix) » Needs review

@KarenS,
picking up where we left at #27.

In my previous - big- patch, 2 issues remain open:
- Functional errors in taxonomy striping . I have posted a patch for this here: #1447176: Taxonomy striping not working in calendar_plugin_row.inc
- Code cleanup to make the 3 calendar_TYPE_stripe() functions more simple and more resembling, so it is easier to create new striping methods, like #1394362: Add Stripe / Legend based on Field_name.

@@ -104,12 +104,12 :
@@ -196,9 +209,11 :
Make 3 calendar_TYPE_stripe() functions more resembling, move the changing properties up, constant properties down. (the same is already done for taxonomy striping in #1447176 )

@@ -414,6 +429,8 :
Initialize variables, so this is not needed anymore in the 3 calendar_TYPE_stripe() functions, which reduces code complexity.
@@ -531,10 +548,6 : reducing code complexity in Node_type striping @@ -414,6 +429,8
@@ -544,7 +557,7 : function should not return anything.
@@ -602,36 +590,27 : reducing code complexity in OG striping

johnv’s picture

Oops, forgot to attach the patch.

GinaF’s picture

I have 7.x-3.x-dev Calendar and 7.x-2.x-dev Date modules.

I just applied this patch (#36) to my development website and there were no errors, but still no stripes.
When I put it on my live site, I got the WSOD and it threw up lots of errors in my error log:

Warning: date_format() expects parameter 1 to be DateTime, null given in calendar_plugin_style->render() (line 297 of /u01/www/vhosts/www.cir.ed.ac.uk/httpdocs/drupal/sites/all/modules/calendar/includes/cal...).

Notice: Undefined property: stdClass::$calendar_start_date in calendar_plugin_style->render() (line 297 of /u01/www/vhosts/www.cir.ed.ac.uk/httpdocs/drupal/sites/all/modules/calendar/includes/cal...).

Warning: date_format() expects parameter 1 to be DateTime, null given in calendar_plugin_style->render() (line 296 of /u01/www/vhosts/www.cir.ed.ac.uk/httpdocs/drupal/sites/all/modules/calendar/includes/cal...).

Notice: Undefined property: stdClass::$calendar_end_date in calendar_plugin_style->render() (line 296 of /u01/www/vhosts/www.cir.ed.ac.uk/httpdocs/drupal/sites/all/modules/calendar/includes/cal...).

johnv’s picture

@GinaF, To show the Taxonomy stripes, you need to apply #1447176: Taxonomy striping not working in calendar_plugin_row.inc.
Regarding your production site: did you flush caches on your live site? Are all your Date/Calendar/Ctools modules at the same level as your -dev site?

GinaF’s picture

Should I apply both #36 patch AND then the #1447176 patch you refer to?

All modules are the latest versions.
I just flushed cache on live site and tried putting the file up again, but got instant WSOD. Flushing cache on development is fine and no problems there.

johnv’s picture

Yes, both.

I am not sure about the warnings. but the top-of-file says "Default style plugin to render an iCal feed."
Have you an ICal-feed? Did you install the new sub-module http://drupal.org/project/date_ical?

pluginguin’s picture

Version: 7.x-3.x-dev » 7.x-3.0

I'm using calendar 7x-3.0 and date 7x-2.2
My striping works (I attached stripes based on content types).
The calendar block is visible on the page, but it's contents are not.
So I see an empty block, whereas the calendar itself is full of items.

What can be the issue?

GinaF’s picture

I don't use the iCal feed, but i see the module is active. Do I need to install anyway or should I un-enable it?
Sorry, what do you mean by "top-of-file"?

EDIT: Sorry, I do need to update modules in live site. Got taxonomy stripes working in development thanks to patch #36 + http://drupal.org/node/1447176 patch #9.

Sorry, I didn't mean to hijack this post. Just having a lot of frustration with these taxonomy stripes!
Many thanks for your time.

johnv’s picture

Version: 7.x-3.0 » 7.x-3.x-dev

@pluginguin, the calendar- and date-modules are continuously changing. As stated here, you should try out the -dev version if you run into problems.

KarenS’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.