The scheduled times of each program are listed on program nodes, even if a schedule is unpublished.
At first I thought it would be enough to add a check for node.status within station_schedule_get_list(), but it goes a bit deeper than that.
station_schedule_nodeapi() loads in schedule items regardless of a schedule being published.

This patch just adds a check to node.status, I hope this is the proper way to do this...

Comments

drewish’s picture

Hum... I need to look at the schedule item edit forms and make sure they don't use the loaded array to check for collisions. Perhaps we should just look at the program nodes in hook_nodeapi and remove them from the schedule when they're unpublished so you can schedule something else?

tim.plunkett’s picture

It took me until now to sit down and figure out what you meant.

If unpublishing a program also unscheduled it, that would be brilliant, and I'm considering investing some time into figuring that out.

Your worry about collisions refers to PROGRAMS being unpublished.
But my issue is separate from that. I'm talking about on a program node, where it says when a program is scheduled.
If the SCHEDULE is unpublished, it will still list when the program is on that schedule. This fixes that.

I've been using my patch above, and have since added, removed, unpublished, and republished schedules with no error.

tim.plunkett’s picture

StatusFileSize
new1.65 KB
new1.56 KB

Adding an update case to station_schedule_nodeapi seemed like the best way to unschedule programs when they're unpublished.

However, I wasn't sure the best way to go about doing that...

So I made two patches!

Let me know if either of them are the correct way of doing things.

tim.plunkett’s picture

I'd mark this RTBC but it needs a second opinion.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

While working on #757408: Add views filter for "Is default schedule", I noticed that the setting for default schedule allowed unpublished schedules. This patch does the same thing as #3, but station_schedule_get_list() now won't return unpublished schedules.

It works beautifully.

tim.plunkett’s picture

StatusFileSize
new2.33 KB

d'oh

drewish’s picture

Status: Reviewed & tested by the community » Needs review

I feel like if we're going to remove it from the schedule we should form alter the Published checkbox to put a warning that unpublishing it will remove it from the schedule. Otherwise you'd be in for a surprise and be annoyed that you loose some data. Perhaps it would be better to just not display unpublished programs? At least to people with out administer schedule or nodes permissions?

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.93 KB

You're correct, removing an unpublished program without warning is bad UX.
I think it might be worth working in an option to do that, or a warning, but the main purpose of this issue was to suppress the loading of unpublished programs.
So I think we should commit the patch that does that, and I'll open a separate issue for the new feature.

drewish’s picture

Looks good to me.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed to HEAD.

Status: Fixed » Closed (fixed)

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