/** * ----------------------------------------------------------------------------- * @package smartVISU * @author Martin Gleiß * @copyright 2012 - 2015 * @license GPL [http://www.gnu.de] * ----------------------------------------------------------------------------- */ /** * Displays a calendarlist * * @param {id=} unique id for this widget (optional) * @param {text=} a title to display (optional) * @param {value=25} the number of displayed calendar entries (optional, default 25) * @param {color[?]=grey} one color for all or a list of colors for each calendar (optional, grey or as defined in configuration) * @param {duration=1h} the refresh interval for this widget (optional, default 1h) * @param {text[?]=} name of calendars to show, multiples in array form (optional, default: as defined in configuration) * @param {text(D,l)=} option to display the weekdays: 'D' = short format, 'l' = full name (optional, default = '') * * @see misc/fundamentals#Array-Form * @see misc/fundamentals#Duration-Format * * @author Martin Gleiß, Stefan Widmer */ {% macro list(id, title, count, color, repeat, calendar, weekday) %} /** handle default colors from config */ {% set configcolors = config_calendar_color|split(',') %} {% set confignames = config_calendar_name|split(',') %} {% if color is empty %} /** build associative array of calendar name and according color */ {% set calendarcolors = [] %} {% for configname in confignames %} {% set calendarcolors = calendarcolors|merge({ (configname|trim|lower): configcolors[loop.index0]|trim }) %} {% endfor %} /** find color for calendars */ {% set calendar = calendar|default(confignames) %} {% set color = [] %} {% for calendarname in (calendar is iterable ? calendar : [calendar]) %} {% set color = color|merge([calendarcolors[calendarname|trim|lower]]) %} {% endfor %} {% endif %}