",
color ? "style=\"background: #fff\" " : "");
localtime_r(&e->e_start, &a);
stop = e->e_start + e->e_duration;
localtime_r(&stop, &b);
tcp_qprintf(tq,
"
"
"%02d:%02d-%02d:%02d"
"
",
a.tm_hour, a.tm_min, b.tm_hour, b.tm_min);
tcp_qprintf(tq,
"
"
"%s"
"
",
e->e_title);
tcp_qprintf(tq, "
");
}
static void
ajax_list_events(tcp_queue_t *tq, th_channel_t *ch, int lines)
{
event_t *e;
int i;
e = epg_event_find_current_or_upcoming(ch);
for(i = 0; i < 3 && e != NULL; i++) {
ajax_output_event(tq, e, 0, !(i & 1));
e = TAILQ_NEXT(e, e_link);
}
}
/*
* Display a list of all channels within the given group
*
* Group is given by 'tag' as an ASCII string in remain
*/
int
ajax_channel_tab(http_connection_t *hc, http_reply_t *hr,
const char *remain, void *opaque)
{
tcp_queue_t *tq = &hr->hr_tq;
th_channel_t *ch;
th_channel_group_t *tcg;
char dispname[20];
struct sockaddr_in *si;
if(remain == NULL || (tcg = channel_group_by_tag(atoi(remain))) == NULL)
return HTTP_STATUS_NOT_FOUND;
TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) {
if(LIST_FIRST(&ch->ch_transports) == NULL)
continue;
tcp_qprintf(tq, "");
snprintf(dispname, sizeof(dispname), "%s", ch->ch_name);
strcpy(dispname + sizeof(dispname) - 4, "...");
ajax_box_begin(tq, AJAX_BOX_SIDEBOX, NULL, NULL, dispname);
/* inner */
tcp_qprintf(tq,
"
");
tcp_qprintf(tq,
"
");
if(ch->ch_icon != NULL) {
tcp_qprintf(tq, "

",
ch->ch_icon);
}
tcp_qprintf(tq, "
");
tcp_qprintf(tq, "
");
si = (struct sockaddr_in *)&hc->hc_tcp_session.tcp_self_addr;
tcp_qprintf(tq,
"
Stream",
inet_ntoa(si->sin_addr), ntohs(si->sin_port),
ch->ch_sname);
tcp_qprintf(tq, "
");
tcp_qprintf(tq, "
");
tcp_qprintf(tq, "
", ch->ch_tag);
ajax_list_events(tq, ch, 3);
tcp_qprintf(tq, "
");
ajax_box_end(tq, AJAX_BOX_SIDEBOX);
tcp_qprintf(tq, "
");
}
http_output_html(hc, hr);
return 0;
}
/*
* Channel (group)s AJAX page
*
* This is the top level menu for this c-file
*/
int
ajax_channelgroup_tab(http_connection_t *hc, http_reply_t *hr)
{
tcp_queue_t *tq = &hr->hr_tq;
ajax_box_begin(tq, AJAX_BOX_FILLED, "channelgroupmenu", NULL, NULL);
ajax_box_end(tq, AJAX_BOX_FILLED);
tcp_qprintf(tq, "